From 2bd307fd976155bb0a8642ab50a8fbe025aff70d Mon Sep 17 00:00:00 2001 From: xiezw Date: Mon, 2 Sep 2024 15:40:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-20240902?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eqbxwx/controller/EqWxPlanController.java | 4 +- .../eqbxwx/service/impl/EqBxServiceImpl.java | 5 ++- .../service/impl/EqWxPlanServiceImpl.java | 2 +- .../java/com/thing/eq/eqby/dto/EqByDTO.java | 4 ++ .../eq/eqby/entity/EqByDetailEntity.java | 4 +- .../eq/eqby/service/impl/EqByServiceImpl.java | 33 ++++++++-------- .../eqcheck/dto/EqPatrolCheckRecordDTO.java | 5 +++ .../mapper/EqSpotCheckRecordMapper.java | 1 + .../impl/EqPatrolCheckPlanServiceImpl.java | 3 ++ .../impl/EqPatrolCheckRecordServiceImpl.java | 10 +++-- .../impl/EqSpotCheckRecordServiceImpl.java | 19 +++++++--- .../entity/EqPartRecordEntity.java | 4 +- .../controller/EqUserGroupController.java | 12 ++++++ .../thing/eq/equsergroup/dto/UserInfoDTO.java | 25 ++++++++++++ .../service/EqUserGroupService.java | 3 ++ .../service/impl/EqUserGroupServiceImpl.java | 26 +++++++++++++ .../eqcheck/EqSpotCheckRecordMapper.xml | 38 +++++++++++++++++++ 17 files changed, 166 insertions(+), 32 deletions(-) create mode 100644 modules/equipment/src/main/java/com/thing/eq/equsergroup/dto/UserInfoDTO.java 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 9dc33af..be50d0d 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 @@ -187,8 +187,8 @@ public class EqWxPlanController { throw new SysException("维修计划不存在"); } // -// EqWxInfoRes eqWxInfoRes = new EqWxInfoRes(); -// BeanUtils.copyProperties(data, eqWxInfoRes); + EqWxInfoRes eqWxInfoRes = new EqWxInfoRes(); + BeanUtils.copyProperties(data, eqWxInfoRes); // 查询设备信息 ThingDTO thingDTO = new ThingDTO(); ThingDTO thingInfo = iotThingBaseInfoService.getThingInfo(thingDTO, data.getThingId(), null, "1", String.valueOf(relationTypeId)); diff --git a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqBxServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqBxServiceImpl.java index 08a46d6..e6c4453 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqBxServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqBxServiceImpl.java @@ -6,6 +6,7 @@ import com.mybatisflex.core.query.QueryWrapper; import com.thing.common.core.constants.Constant; import com.thing.common.core.web.response.PageData; import com.thing.common.orm.service.impl.BaseServiceImpl; +import com.thing.common.orm.utils.IdGenerator; import com.thing.eq.eqbxwx.dto.EqBxDTO; import com.thing.eq.eqbxwx.dto.EqWxPlanAddDTO; import com.thing.eq.eqbxwx.entity.EqBxEntity; @@ -257,8 +258,8 @@ public class EqBxServiceImpl extends BaseServiceImpl imp dto.setBxNo(lastNo); dto.setTenantCode(UserContext.getRealTenantCode()); -// Long eqBxId = IdWorker.getId(); -// dto.setId(eqBxId); + Long eqBxId = IdGenerator.nextId(); + dto.setId(eqBxId); if ("1".equals(dto.getInWx())) { dto.setWxStatus("1"); diff --git a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java index e00b704..a9beb94 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java @@ -297,7 +297,7 @@ public class EqWxPlanServiceImpl extends BaseServiceImpl imp // Long id = IdWorker.getId(); // dto.setId(id); dto.setCreator(null); - dto.setCreateDate(null); + dto.setCreateDate(new Date()); dto.setUpdater(null); - dto.setUpdateDate(null); - //部位保养明细记录 - if (CollectionUtil.isNotEmpty(dto.getEqByDetailDTOList())) { - for (EqByDetailDTO eqByDetailDTO : dto.getEqByDetailDTOList()) { - EqByTemplateDetailDTO detailDTO = eqByTemplateDetailService.getByIdAs(eqByDetailDTO.getByTemplateDetailId(),EqByTemplateDetailDTO.class); - BeanUtils.copyProperties(detailDTO, eqByDetailDTO); - //调整 -// eqByDetailDTO.setId(IdWorker.getId()); -// eqByDetailDTO.setById(id); - } - } + dto.setUpdateDate(new Date()); + dto.setTenantCode(TenantContext.getTenantCode(SecurityUser.getUser())); + //当前时间作为保养执行时间 Long currentTime = System.currentTimeMillis(); if (dto.getByStartTime().getTime() >= eqByPlanDTO.getPlanEndTime().getTime()){ @@ -316,13 +309,21 @@ public class EqByServiceImpl extends BaseServiceImpl imp dto.setByNo(lastNo); //保存保养记录 saveDto(dto); - + //部位保养明细记录 + if (CollectionUtil.isNotEmpty(dto.getEqByDetailDTOList())) { + for (EqByDetailDTO eqByDetailDTO : dto.getEqByDetailDTOList()) { + EqByTemplateDetailDTO detailDTO = eqByTemplateDetailService.getByIdAs(eqByDetailDTO.getByTemplateDetailId(),EqByTemplateDetailDTO.class); + eqByDetailDTO.setById(dto.getId()); + BeanUtils.copyProperties(detailDTO, eqByDetailDTO); + } + } //保存保养明细记录 - eqByDetailService.saveDto(ConvertUtils.sourceToTarget(dto.getEqByDetailDTOList(), EqByDetailEntity.class)); + List eqByDetailEntities = ConvertUtils.sourceToTarget(dto.getEqByDetailDTOList(), EqByDetailEntity.class); + eqByDetailService.saveBatch(eqByDetailEntities); //更新库存 调整 -// updateStock(id, dto); + updateStock(dto.getId(), dto); //更新部件更换记录 - eqPartRecordService.saveDto(ConvertUtils.sourceToTarget(dto.getThingParts(), EqPartRecordEntity.class)); + eqPartRecordService.saveBatch(ConvertUtils.sourceToTarget(dto.getThingParts(), EqPartRecordEntity.class)); } diff --git a/modules/equipment/src/main/java/com/thing/eq/eqcheck/dto/EqPatrolCheckRecordDTO.java b/modules/equipment/src/main/java/com/thing/eq/eqcheck/dto/EqPatrolCheckRecordDTO.java index eaad210..20e4946 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqcheck/dto/EqPatrolCheckRecordDTO.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqcheck/dto/EqPatrolCheckRecordDTO.java @@ -71,4 +71,9 @@ public class EqPatrolCheckRecordDTO extends BaseDTO implements Serializable { @Schema(description = "设备id") private Long thingId; + @Schema(description = "创建时间") + private Date createDate; + @Schema(description = "更新时间") + private Date updateDate; + } diff --git a/modules/equipment/src/main/java/com/thing/eq/eqcheck/mapper/EqSpotCheckRecordMapper.java b/modules/equipment/src/main/java/com/thing/eq/eqcheck/mapper/EqSpotCheckRecordMapper.java index 6ced080..2d9df56 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqcheck/mapper/EqSpotCheckRecordMapper.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqcheck/mapper/EqSpotCheckRecordMapper.java @@ -23,4 +23,5 @@ public interface EqSpotCheckRecordMapper extends PowerBaseMapper searchRecord(@Param("params") Map params); + List searchRecordList(@Param("params")Map params); } 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 0976911..5e53b2a 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 @@ -535,6 +535,9 @@ public class EqPatrolCheckPlanServiceImpl extends BaseServiceImpl eqSpotCheckPlanList = eqSpotCheckRecordDao.searchRecord(new Page<>(page, limit), params); - + Page eqSpotCheckPlanList = new Page<>(); +// Page eqSpotCheckPlanList = eqSpotCheckRecordDao.searchRecord(new Page<>(page, limit), params); + List eqSpotCheckPlanList1 = eqSpotCheckRecordDao.searchRecordList(params); + List eqSpotCheckRecordDTOS = PageUtils.startPage(eqSpotCheckPlanList1, page, limit); + eqSpotCheckPlanList.setRecords(eqSpotCheckRecordDTOS); + eqSpotCheckPlanList.setPageNumber(page); + eqSpotCheckPlanList.setPageSize(limit); + eqSpotCheckPlanList.setTotalRow(CollectionUtils.size(eqSpotCheckPlanList1)); return eqSpotCheckPlanList; } @@ -145,10 +152,12 @@ public class EqSpotCheckRecordServiceImpl extends BaseServiceImpl>().ok(data); } + @GetMapping("groupList") + @Operation(summary="用户组用户列表") + @Parameters({ + @Parameter(name = "groupId", description = "组id") + }) +// @RequiresPermissions("equsergroup:equsergroup:info") + public Result> groupList(@Parameter(hidden = true) @RequestParam Map params){ + List data = eqUserGroupService.groupList(params); + return new Result>().ok(data); + } + @PostMapping @Operation(summary="保存") @LogOperation("保存") diff --git a/modules/equipment/src/main/java/com/thing/eq/equsergroup/dto/UserInfoDTO.java b/modules/equipment/src/main/java/com/thing/eq/equsergroup/dto/UserInfoDTO.java new file mode 100644 index 0000000..061a4c8 --- /dev/null +++ b/modules/equipment/src/main/java/com/thing/eq/equsergroup/dto/UserInfoDTO.java @@ -0,0 +1,25 @@ +package com.thing.eq.equsergroup.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** +* 用户组 +* +* @author xiezw 806671840@qq.com +* @since 3.0 2022-06-24 +*/ +@Data +@Schema(description = "组用户信息") +public class UserInfoDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户id") + private Long userId; + @Schema(description = "名称") + private String userName; + + +} diff --git a/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/EqUserGroupService.java b/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/EqUserGroupService.java index 3140cbc..e59fff0 100644 --- a/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/EqUserGroupService.java +++ b/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/EqUserGroupService.java @@ -6,6 +6,7 @@ package com.thing.eq.equsergroup.service; import com.thing.common.core.web.response.PageData; import com.thing.common.orm.service.IBaseService; import com.thing.eq.equsergroup.dto.EqUserGroupDTO; +import com.thing.eq.equsergroup.dto.UserInfoDTO; import com.thing.eq.equsergroup.entity.EqUserGroupEntity; import java.util.List; @@ -30,4 +31,6 @@ public interface EqUserGroupService extends IBaseService { EqUserGroupDTO getByNameNoCurrenId(String name, Long tenantCode, Long id); PageData page(Map params); + + List groupList(Map params); } diff --git a/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java index f85de74..78f8674 100644 --- a/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java @@ -1,5 +1,6 @@ package com.thing.eq.equsergroup.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.map.MapUtil; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; @@ -7,6 +8,7 @@ import com.thing.common.core.utils.ConvertUtils; import com.thing.common.core.web.response.PageData; import com.thing.common.orm.service.impl.BaseServiceImpl; import com.thing.eq.equsergroup.dto.EqUserGroupDTO; +import com.thing.eq.equsergroup.dto.UserInfoDTO; import com.thing.eq.equsergroup.entity.EqUserGroupEntity; import com.thing.eq.equsergroup.mapper.EqUserGroupMapper; import com.thing.eq.equsergroup.service.EqUserGroupService; @@ -61,6 +63,30 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl(pageList.getRecords(), pageList.getTotalRow()); } + @Override + public List groupList(Map params) { + List result = new ArrayList<>(); + params.put("tenantCode", TenantContext.getTenantCode(SecurityUser.getUser())); + Long groupId = Long.parseLong(params.get("groupId").toString()); + EqUserGroupDTO eqUserGroupDTO = mapper.selectByid(groupId); + //调整 + String userId = eqUserGroupDTO.getUserId(); + String[] split = userId.split(","); + List longs = new ArrayList<>(); + for (String s : split) { + longs.add(Long.parseLong(s)); + UserInfoDTO userInfoDTO = new UserInfoDTO(); + List planUserName = sysUserService.getUserNameLists(longs); + if (CollectionUtil.isEmpty(planUserName)){ + continue; + } + userInfoDTO.setUserId(Long.parseLong(s)); + userInfoDTO.setUserName(planUserName.get(0)); + result.add(userInfoDTO); + } + return result; + } + @Override public void save(EqUserGroupDTO dto) { EqUserGroupEntity eqUserGroupEntity = ConvertUtils.sourceToTarget(dto, EqUserGroupEntity.class); diff --git a/modules/equipment/src/main/resources/mapper/eqcheck/EqSpotCheckRecordMapper.xml b/modules/equipment/src/main/resources/mapper/eqcheck/EqSpotCheckRecordMapper.xml index 2c6e0f4..c9f5921 100644 --- a/modules/equipment/src/main/resources/mapper/eqcheck/EqSpotCheckRecordMapper.xml +++ b/modules/equipment/src/main/resources/mapper/eqcheck/EqSpotCheckRecordMapper.xml @@ -60,5 +60,43 @@ order by record.create_date desc +