diff --git a/common/orm/src/main/java/com/thing/common/orm/entity/BaseTenantEntity.java b/common/orm/src/main/java/com/thing/common/orm/entity/BaseTenantEntity.java index b8a9325..6978bbe 100644 --- a/common/orm/src/main/java/com/thing/common/orm/entity/BaseTenantEntity.java +++ b/common/orm/src/main/java/com/thing/common/orm/entity/BaseTenantEntity.java @@ -3,6 +3,8 @@ package com.thing.common.orm.entity; import com.google.common.collect.Maps; import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.core.keygen.KeyGenerators; import lombok.Data; import lombok.experimental.Accessors; @@ -26,7 +28,7 @@ public class BaseTenantEntity implements Serializable { @Serial private static final long serialVersionUID = 1536009703312548328L; - @Id + @Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId) private Long id; /*------------------------租户信息--------------------------------*/ diff --git a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java index d5b3211..9dc33af 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java @@ -28,7 +28,6 @@ import com.thing.eq.file.service.FileService; import com.thing.sys.biz.dto.SysDeptDTO; import com.thing.sys.biz.dto.SysDictTypeListDTO; import com.thing.sys.biz.entity.SysDictDataEntity; -import com.thing.sys.biz.entity.SysDictTypeEntity; import com.thing.sys.biz.service.SysDeptService; import com.thing.sys.biz.service.SysDictDataService; import com.thing.sys.biz.service.SysDictTypeService; @@ -38,11 +37,13 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; + import java.util.*; import java.util.stream.Collectors; @@ -94,7 +95,7 @@ public class EqWxPlanController { // private IotDictTypeService iotDictTypeService; @GetMapping("page") - @Operation(summary= "分页") + @Operation(summary = "分页") @Parameters({ @Parameter(name = Constant.PAGE, description = "当前页码,从1开始"), @Parameter(name = Constant.LIMIT, description = "每页显示记录数"), @@ -128,16 +129,16 @@ public class EqWxPlanController { EqWxInfoRes eqWxInfoRes = ConvertUtils.sourceToTarget(data, EqWxInfoRes.class); //调整 String userId = data.getWxUser(); - if(StringUtils.isNotBlank(userId)){ + if (StringUtils.isNotBlank(userId)) { String[] split = userId.split(","); List longs = new ArrayList<>(); for (String s : split) { longs.add(Long.parseLong(s)); } List planUserName = sysUserService.getUserNameLists(longs); - String name=""; + String name = ""; for (String s : planUserName) { - name+=s+","; + name += s + ","; } name = name.substring(0, name.length() - 1); eqWxInfoRes.setWxUseText(name); @@ -157,7 +158,7 @@ public class EqWxPlanController { eqWxInfoRes.setBxInfo(storeEqBxMap.get(data.getEqBxId())); } else { EqBxEntity eqBxEntity = null; - if(!Objects.isNull(data.getEqBxId())){ + if (!Objects.isNull(data.getEqBxId())) { eqBxEntity = eqBxService.getById(data.getEqBxId()); } if (!Objects.isNull(eqBxEntity)) { @@ -177,55 +178,59 @@ public class EqWxPlanController { } @GetMapping("{id}/{relationTypeId}") - @Operation(summary= "信息") + @Operation(summary = "信息") // @RequiresPermissions("eqwxplan:eqwxplan:info") public Result get(@PathVariable("id") Long id, @PathVariable(value = "relationTypeId") Long relationTypeId) { - EqWxPlanDTO data = eqWxPlanService.getByIdAs(id,EqWxPlanDTO.class); + EqWxInfoRes data = eqWxPlanService.getByIdAs(id, EqWxInfoRes.class); if (Objects.isNull(data)) { throw new SysException("维修计划不存在"); } - - EqWxInfoRes eqWxInfoRes = new EqWxInfoRes(); - BeanUtils.copyProperties(data, eqWxInfoRes); +// +// EqWxInfoRes eqWxInfoRes = new EqWxInfoRes(); +// BeanUtils.copyProperties(data, eqWxInfoRes); // 查询设备信息 ThingDTO thingDTO = new ThingDTO(); - iotThingBaseInfoService.getThingInfo(thingDTO, data.getThingId(), null, "1", String.valueOf(relationTypeId)); - eqWxInfoRes.setBaseInfo(thingDTO); + ThingDTO thingInfo = iotThingBaseInfoService.getThingInfo(thingDTO, data.getThingId(), null, "1", String.valueOf(relationTypeId)); + data.setBaseInfo(thingInfo); //调整 String userId = data.getWxUser(); String[] split = userId.split(","); - List longs = new ArrayList<>(); + + if (ArrayUtils.isNotEmpty(split)) { + List longs = new ArrayList<>(); for (String s : split) { - longs.add(Long.parseLong(s)); - } List planUserName = sysUserService.getUserNameLists(longs); - String name=""; - for (String s : planUserName) { - name+=s+","; + if(StringUtils.isNotBlank(s)){ + longs.add(Long.parseLong(s)); + } + } + if(CollectionUtil.isNotEmpty(longs)){ + List planUserName = sysUserService.getUserNameLists(longs); + String name = ""; + for (String s : planUserName) { + name += s + ","; + } + name = name.substring(0, name.length() - 1); + data.setWxUseText(name); + } } - name = name.substring(0, name.length() - 1); - eqWxInfoRes.setWxUseText(name); - - BxInfoDTO bxInfoDTO = new BxInfoDTO(); // 查询报修信息 - EqBxEntity eqBxEntity = eqBxService.getById(data.getEqBxId()); - if (!Objects.isNull(eqBxEntity)) { - BeanUtils.copyProperties(eqBxEntity, bxInfoDTO); - eqWxInfoRes.setBxInfo(bxInfoDTO); - + BxInfoDTO bxInfoDTO = eqBxService.getByIdAs(data.getEqBxId(),BxInfoDTO.class); + if (!Objects.isNull(bxInfoDTO)) { + data.setBxInfo(bxInfoDTO); Map> document = fileService.getDocument(data.getEqBxId()); bxInfoDTO.setImageUrls(document.get("image")); bxInfoDTO.setAttachmentUrls(document.get("attachment")); } // 查询维修备件信息 - eqWxInfoRes.setReplacements(eqWxReplacementService.getWxReplacementByWxPlanId(data.getId())); + data.setReplacements(eqWxReplacementService.getWxReplacementByWxPlanId(data.getId())); - return new Result().ok(eqWxInfoRes); + return new Result().ok(data); } @PostMapping - @Operation(summary= "保存") + @Operation(summary = "保存") @LogOperation("保存") // @RequiresPermissions("equipment:maintainRecords:add") public Result save(@RequestBody EqWxPlanAddDTO dto) { @@ -254,7 +259,7 @@ public class EqWxPlanController { } @PutMapping - @Operation(summary= "修改") + @Operation(summary = "修改") @LogOperation("修改") @Transactional(rollbackFor = Exception.class) // @RequiresPermissions("equipment:maintainRecords:update") @@ -278,7 +283,7 @@ public class EqWxPlanController { } @DeleteMapping - @Operation(summary= "删除") + @Operation(summary = "删除") @LogOperation("删除") @Transactional(rollbackFor = Exception.class) // @RequiresPermissions("equipment:maintainRecords:delete") @@ -287,7 +292,7 @@ public class EqWxPlanController { AssertUtils.isArrayEmpty(ids, "id"); for (Long id : ids) { - EqWxPlanDTO eqWxPlanDTO = eqWxPlanService.getByIdAs(id,EqWxPlanDTO.class); + EqWxPlanDTO eqWxPlanDTO = eqWxPlanService.getByIdAs(id, EqWxPlanDTO.class); if (!Objects.isNull(eqWxPlanDTO) && "2".equals(eqWxPlanDTO.getWxStatus())) { throw new SysException("不能删除已完成的维修记录"); } @@ -303,7 +308,7 @@ public class EqWxPlanController { } @PostMapping("export") - @Operation(summary= "导出") + @Operation(summary = "导出") @LogOperation("导出") // @Parameters({ // @Parameter(name = "relationTypeId", description = "结构类型id", paramType = "query", required = true, dataType = "String"), @@ -356,13 +361,14 @@ public class EqWxPlanController { //调整 String userId = data.getWxUser(); String[] split = userId.split(","); - List longs = new ArrayList<>(); - for (String s : split) { - longs.add(Long.parseLong(s)); - } List planUserName = sysUserService.getUserNameLists(longs); - String name=""; + List longs = new ArrayList<>(); + for (String s : split) { + longs.add(Long.parseLong(s)); + } + List planUserName = sysUserService.getUserNameLists(longs); + String name = ""; for (String s : planUserName) { - name+=s+","; + name += s + ","; } name = name.substring(0, name.length() - 1); eqWxPlanExcel.setWxUser(name); @@ -424,16 +430,16 @@ public class EqWxPlanController { } List newList = new ArrayList<>(); List idList = new ArrayList<>(Arrays.asList(ids)); - if (CollectionUtil.isNotEmpty(idList)){ - for (EqWxPlanExcel eqWxPlanExcel : excels ){ - if (idList.contains(eqWxPlanExcel.getId())){ + if (CollectionUtil.isNotEmpty(idList)) { + for (EqWxPlanExcel eqWxPlanExcel : excels) { + if (idList.contains(eqWxPlanExcel.getId())) { newList.add(eqWxPlanExcel); } } - }else{ + } else { newList.addAll(excels); } - ExcelUtils.exportExcel(newList,null, "维修记录", EqWxPlanExcel.class,"维修记录.xls",response); + ExcelUtils.exportExcel(newList, null, "维修记录", EqWxPlanExcel.class, "维修记录.xls", response); } @@ -443,15 +449,15 @@ public class EqWxPlanController { return ""; } List temp = new ArrayList<>(); - Object obj = dictMap.get(dictType); - temp= JSON.parseArray(JSON.toJSONString(obj),SysDictDataEntity.class); + Object obj = dictMap.get(dictType); + temp = JSON.parseArray(JSON.toJSONString(obj), SysDictDataEntity.class); if (CollectionUtil.isEmpty(temp)) { return ""; } Map dictObject = new HashMap<>(); - for (SysDictDataEntity dictData:temp){ - dictObject.put(dictData.getDictValue(),dictData.getDictLabel()); + for (SysDictDataEntity dictData : temp) { + dictObject.put(dictData.getDictValue(), dictData.getDictLabel()); } // List temp = (List) dictMap.get(dictType); diff --git a/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByPlanPartEntity.java b/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByPlanPartEntity.java index 4e1bf02..ded9587 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByPlanPartEntity.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByPlanPartEntity.java @@ -1,11 +1,15 @@ package com.thing.eq.eqby.entity; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; import com.mybatisflex.annotation.Table; -import com.thing.common.orm.entity.BaseDateEntity; +import com.mybatisflex.core.keygen.KeyGenerators; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serial; +import java.io.Serializable; +import java.util.Date; /** * 部件使用记录 @@ -16,11 +20,37 @@ import java.io.Serial; @Data @EqualsAndHashCode(callSuper=false) @Table("eq_by_plan_part") -public class EqByPlanPartEntity extends BaseDateEntity { +public class EqByPlanPartEntity implements Serializable { @Serial private static final long serialVersionUID = 1L; + + @Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId) + private Long id; + + /*------------------------修改记录信息--------------------------------*/ + + /** + * 创建者 + */ + private Long creator; + + /** + * 创建时间 + */ + private Date createDate; + + /** + * 修改人 + */ + private Long updater; + + /** + * 修改时间 + */ + private Date updateDate; + /** * 更换数量 */ diff --git a/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByTemplateEntity.java b/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByTemplateEntity.java index 8d24bff..e9d44e4 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByTemplateEntity.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByTemplateEntity.java @@ -5,6 +5,8 @@ import com.mybatisflex.annotation.Table; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serial; +import java.io.Serializable; import java.util.Date; /** @@ -16,7 +18,9 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @Table("eq_by_template") -public class EqByTemplateEntity { +public class EqByTemplateEntity implements Serializable { + + @Serial private static final long serialVersionUID = 1L; @Id diff --git a/modules/equipment/src/main/java/com/thing/eq/eqby/service/impl/EqByPlanServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/eqby/service/impl/EqByPlanServiceImpl.java index c6915a7..48a1718 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqby/service/impl/EqByPlanServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqby/service/impl/EqByPlanServiceImpl.java @@ -1,6 +1,7 @@ package com.thing.eq.eqby.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.mybatisflex.core.paginate.Page; @@ -23,7 +24,6 @@ import com.thing.eq.utils.SerialNumberUnit; import com.thing.sys.biz.dto.SysDictTypeListDTO; import com.thing.sys.biz.entity.SysDeptEntity; import com.thing.sys.biz.entity.SysDictDataEntity; -import com.thing.sys.biz.entity.SysDictTypeEntity; import com.thing.sys.biz.entity.SysUserEntity; import com.thing.sys.biz.service.SysDeptService; import com.thing.sys.biz.service.SysDictDataService; @@ -86,24 +86,36 @@ public class EqByPlanServiceImpl extends BaseServiceImpl params) { QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq(EqByPlanEntity::getTenantCode,UserContext.getRealTenantCode()); + String byStatus = MapUtil.getStr(params, "byStatus"); + wrapper.eq(EqByPlanEntity::getByStatus, byStatus,StringUtils::isNotBlank); + String by_user = MapUtil.getStr(params, "checkUserId"); + wrapper.like(EqByPlanEntity::getByUser, by_user,StringUtils::isNotBlank); + String byNo = MapUtil.getStr(params, "byNo"); + wrapper.like(EqByPlanEntity::getByNo, byNo,StringUtils::isNotBlank); + + if (params.get("eqIds") != null) { + String eqIds = params.get("eqIds").toString(); + List eqthingIds = Arrays.stream(eqIds.split(",")).map(s -> Long.parseLong(s.trim())).collect(Collectors.toList()); + wrapper.in(EqByPlanEntity::getThingsId, eqthingIds,CollectionUtil.isNotEmpty(eqthingIds)); + } + + Long startTime = MapUtil.getLong(params, "startTime"); + Long endTime = MapUtil.getLong(params, "endTime"); + String relationTypeId = MapUtil.getStr(params, "relationTypeId"); + + return wrapper; } @Override public PageData page(Map params) { - Page page = getPage(params); + int pageNumber = MapUtil.getInt(params, "page",1); + int pageSize = MapUtil.getInt(params, "limit",10); -// IPage thingsEntityPage = baseDao.selectPage(page, getWrapper(params)); - String eqIds; - List eqthingIds = new ArrayList<>(); - if (params.get("eqIds") != null) { - eqIds = params.get("eqIds").toString(); - eqthingIds = Arrays.stream(eqIds.split(",")).map(s -> Long.parseLong(s.trim())).collect(Collectors.toList()); - params.put("eqIdList", eqthingIds); - } - params.put("tenantCode", TenantContext.getTenantCode(SecurityUser.getUser())); + Page paginate = mapper.paginateAs(new Page<>(pageNumber, pageSize), getWrapper(params),EqByPlanDTO.class); + List eqByPlansDTOS = paginate.getRecords(); String relationTypeId = params.get("relationTypeId").toString(); - List eqByPlansDTOS = eqByPlanDao.getListData(params); for (EqByPlanDTO eqByPlansDTO : eqByPlansDTOS) { EqInfo thingsInfo = iotThingsService.getThingInfo(eqByPlansDTO.getThingsId(),relationTypeId); if (thingsInfo != null) { @@ -160,9 +172,13 @@ public class EqByPlanServiceImpl extends BaseServiceImpl eqByPlanPartEntities = ConvertUtils.sourceToTarget(eqByParts, EqByPlanPartEntity.class); + eqByPlanPartService.saveBatch(eqByPlanPartEntities); } } } @@ -197,13 +213,14 @@ public class EqByPlanServiceImpl extends BaseServiceImpl eqByParts = new ArrayList<>(); + List eqByParts = new ArrayList<>(); if (CollectionUtil.isNotEmpty(dto.getThingParts())) { for (EqByPlanPartDTO eqpart : dto.getThingParts()) { - eqpart.setEqByPlanId(dto.getId()); - eqByParts.add(eqpart); + EqByPlanPartEntity eqByPlanPartEntity = ConvertUtils.sourceToTarget(eqpart, EqByPlanPartEntity.class); + eqByPlanPartEntity.setEqByPlanId(dto.getId()); + eqByParts.add(eqByPlanPartEntity); } - eqByPlanPartService.saveDto(ConvertUtils.sourceToTarget(eqByParts, EqByPlanPartEntity.class)); + eqByPlanPartService.saveBatch(ConvertUtils.sourceToTarget(eqByParts, EqByPlanPartEntity.class)); } } diff --git a/modules/equipment/src/main/java/com/thing/eq/eqcheck/controller/EqCheckStandardController.java b/modules/equipment/src/main/java/com/thing/eq/eqcheck/controller/EqCheckStandardController.java index 5e25fed..48db611 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqcheck/controller/EqCheckStandardController.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqcheck/controller/EqCheckStandardController.java @@ -21,6 +21,7 @@ import com.thing.eq.eqcheck.excel.EqCheckStandardExcel; import com.thing.eq.eqcheck.service.EqCheckSettingService; import com.thing.eq.eqcheck.service.EqCheckStandardDetailService; import com.thing.eq.eqcheck.service.EqCheckStandardService; +import com.thing.sys.security.context.UserContext; import com.thing.sys.security.domain.SecurityUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -139,15 +140,13 @@ public class EqCheckStandardController { if (CollectionUtil.isEmpty(detailDTOS)) { throw new SysException("请添加模板检查项"); } - - dto.setTenantCode(SecurityUser.getTenantCode()); + dto.setTenantCode(UserContext.getRealTenantCode()); dto.setCreateDate(new Date()); eqCheckStandardService.saveDto(dto); // if (Objects.isNull(dto.getId())) { // throw new SysException("保存失败"); // } - for (EqCheckStandardDetailDTO detail : detailDTOS) { if ("0".equals(detail.getType()) && (StringUtils.isBlank(detail.getLowerLimit()) || StringUtils.isBlank(detail.getUpperLimit()))) { throw new SysException("标准细项为上下限判定类型时,上下限值不能为空"); diff --git a/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqPatrolCheckPlanEntity.java b/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqPatrolCheckPlanEntity.java index d2386e8..0484385 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqPatrolCheckPlanEntity.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqPatrolCheckPlanEntity.java @@ -1,10 +1,14 @@ package com.thing.eq.eqcheck.entity; import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; import com.mybatisflex.annotation.Table; +import com.mybatisflex.core.keygen.KeyGenerators; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serial; +import java.io.Serializable; import java.util.Date; /** @@ -16,13 +20,15 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper = false) @Table("eq_patrol_check_plan") -public class EqPatrolCheckPlanEntity { +public class EqPatrolCheckPlanEntity implements Serializable { + + @Serial private static final long serialVersionUID = 1L; /** * id */ - @Id + @Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId) private Long id; /** * 创建人 diff --git a/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqSpotCheckPlanEntity.java b/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqSpotCheckPlanEntity.java index 94c0630..5de42a8 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqSpotCheckPlanEntity.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqcheck/entity/EqSpotCheckPlanEntity.java @@ -1,10 +1,14 @@ package com.thing.eq.eqcheck.entity; import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; import com.mybatisflex.annotation.Table; +import com.mybatisflex.core.keygen.KeyGenerators; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serial; +import java.io.Serializable; import java.util.Date; /** @@ -16,10 +20,13 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @Table("eq_spot_check_plan") -public class EqSpotCheckPlanEntity { +public class EqSpotCheckPlanEntity implements Serializable { + + + @Serial private static final long serialVersionUID = 1L; - @Id + @Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId) private Long id; /** * 设备thingid diff --git a/modules/equipment/src/main/java/com/thing/eq/eqcheck/service/impl/EqPatrolCheckPlanServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/eqcheck/service/impl/EqPatrolCheckPlanServiceImpl.java index c0bbfe6..0976911 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqcheck/service/impl/EqPatrolCheckPlanServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqcheck/service/impl/EqPatrolCheckPlanServiceImpl.java @@ -27,6 +27,7 @@ import com.thing.eq.equsergroup.dto.EqUserGroupDTO; import com.thing.eq.equsergroup.service.EqUserGroupService; import com.thing.eq.utils.SerialNumberUnit; import com.thing.sys.security.context.TenantContext; +import com.thing.sys.security.context.UserContext; import com.thing.sys.security.domain.SecurityUser; import com.thing.thing.entity.dto.IotThingEntityDTO; import com.thing.thing.entity.entity.IotThingEntity; @@ -631,26 +632,25 @@ public class EqPatrolCheckPlanServiceImpl extends BaseServiceImpl deviceBaseInfoDTOS) { for (DeviceBaseInfoDTO deviceInfo : deviceBaseInfoDTOS) { - eqScrapService.checkThingStatus(deviceInfo.getThingId()); - List standardDTOS = deviceInfo.getStandardIdList(); //todo if (CollectionUtil.isEmpty(standardDTOS)) { @@ -665,12 +665,12 @@ public class EqPatrolCheckPlanServiceImpl extends BaseServiceImpl eqDTOS = iotThingBaseInfoDao.queryDeviceListByThingsId(new Page<>(page, limit), params,aLong,aLong1,aLong2,eqTypeName,keyWord); @@ -150,7 +149,7 @@ public class IotThingBaseInfoServiceImpl extends BaseServiceImpl settingList, String showDeviceType, String relationTypeId) { - IotThingBaseInfoDTO baseThing = iotThingBaseInfoService.getByThingsId(thingId); + IotThingBaseInfoDTO baseThing = iotThingBaseInfoService.getByIdAs(thingId,IotThingBaseInfoDTO.class); EqScrapEntity eqScrapEntity = eqScrapService.getByEqId(thingId); if(!Objects.isNull(eqScrapEntity)){ @@ -198,9 +197,9 @@ public class IotThingBaseInfoServiceImpl extends BaseServiceImpl standardList = eqCheckStandardService.getStandardListByStandardIdList(standardIdList); standardList.forEach(standard -> { - stringBuilder.append(standard.getName() + ","); + stringBuilder.append(standard.getName()).append(","); }); - thingDTO.setStandardNameList(stringBuilder.length() > 0 ? stringBuilder.toString().substring(0, stringBuilder.length() - 1) : ""); + thingDTO.setStandardNameList(!stringBuilder.isEmpty() ? stringBuilder.substring(0, stringBuilder.length() - 1) : ""); } } diff --git a/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java index 88281bf..fa2b33c 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java @@ -453,13 +453,14 @@ public class IotThingsServiceImpl implements IotThingsService { result.setCode(eq.getCode()); result.setName(eq.getName()); IotThingBaseInfoDTO baseInfoDTO = iotThingBaseInfoService.getByThingsId(thingId); - result.setStandard(baseInfoDTO.getStandard()); - result.setUseDeptId(baseInfoDTO.getUseDeptId()); - result.setEqCode(baseInfoDTO.getEqCode()); - result.setScrap(baseInfoDTO.getScrap()); - result.setScrapDisposal(baseInfoDTO.getScrapDisposal()); + if(!Objects.isNull(baseInfoDTO)){ + result.setStandard(baseInfoDTO.getStandard()); + result.setUseDeptId(baseInfoDTO.getUseDeptId()); + result.setEqCode(baseInfoDTO.getEqCode()); + result.setScrap(baseInfoDTO.getScrap()); + result.setScrapDisposal(baseInfoDTO.getScrapDisposal()); + } return result; -// return iotThingsDao.getThingInfo(thingId,relationTypeId); } @Override