diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java index a42c3b09..58d98cc5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java @@ -57,6 +57,18 @@ public interface RepairMapper { */ int updateRepairedNum(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId); + int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("repairer") Long repairer, @Param("userId") Long userId); + + /** + * 修改维修数量 + * @param id 主键 key + * @param repairNum 维修数量 + * @param userid 用户id + */ + int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid); + + int updateRepairedNumTwoAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("userId") Long userid); + /** * 修改报废数量 * @param id 主键key @@ -108,14 +120,6 @@ public interface RepairMapper { */ int createAgreementTask(RepairTask task); - /** - * 修改维修数量 - * @param id 主键 key - * @param repairNum 维修数量 - * @param userid 用户id - */ - int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid); - /** * 查询是否存在未完成维修的 * @param task 任务信息 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java index 5ee265c7..1a79be93 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java @@ -57,9 +57,6 @@ public class RepairServiceImpl implements RepairService { // 1:内部维修 2:外部返厂维修 3:报废 private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3; - // 维修管理方式--0:编码管理 1:数量管理 - private final int manageTypeByCode = 0, manageTypeByNumber = 1; - @Override public List getRepairTaskList(RepairTask bean) { return repairMapper.getRepairTaskList(bean); @@ -375,7 +372,7 @@ public class RepairServiceImpl implements RepairService { if (bean.getManageType() == null) { throw new ServiceException("请选择物资管理方式"); } - if (Objects.equals(manageTypeByCode, bean.getManageType())) { + if (Objects.equals(MaTypeManageTypeEnum.CODE_DEVICE.getTypeId(), bean.getManageType())) { // 物资管理方式--编码管理 if (bean.getRepairType() == null) { continue; @@ -385,13 +382,13 @@ public class RepairServiceImpl implements RepairService { case inRepairType: { partList = bean.getCodeInRepairPartList(); // 更新维修数量、并修改维修人员 - repairMapper.updateRepairedNum(bean.getId(), 1, loginUser.getUserid(), loginUser.getUserid()); + repairMapper.updateRepairedNumAndStatus(bean.getId(), 1, 1, loginUser.getUserid(), loginUser.getUserid()); break; } case outRepairType: { partList = bean.getCodeOutRepairPartList(); // 更新维修数量、维修人员不变 - repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid()); + repairMapper.updateRepairedNumTwoAndStatus(bean.getId(), 1, 1, loginUser.getUserid()); break; } case scrapRepairType: { @@ -408,7 +405,7 @@ public class RepairServiceImpl implements RepairService { // 统一处理配件集合数据 copeNumberManageInList(bean, partList, loginUser, bean.getManageType()); - } else if (Objects.equals(manageTypeByNumber, bean.getManageType())) { + } else if (Objects.equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId(), bean.getManageType())) { // 物资管理方式--数量管理 if (bean.getId() == null) { throw new ServiceException("请完善参数,维修详情ID为空!"); @@ -598,7 +595,7 @@ public class RepairServiceImpl implements RepairService { throw new ServiceException("请选择物资管理方式"); } // 如果是数量管理,那么默认为内部维修 - if (bean.getRepairType() == null && manageType == manageTypeByNumber) { + if (bean.getRepairType() == null && MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) { bean.setRepairType(inRepairType); } // 再检查还是null的话直接结束任务 @@ -613,11 +610,11 @@ public class RepairServiceImpl implements RepairService { for (RepairPartDetails partDetails : partList) { // 维修记录表信息 repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(inRepairType); - if (manageType == manageTypeByCode) { + if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(manageType)) { repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); } - if (manageType == manageTypeByNumber) { + if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) { repairApplyRecord.setRepairNum(partDetails.getRepairNum()); } repairApplyRecord.setCreateBy(loginUser.getUsername()); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml index f75b269c..12d7a4b4 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml @@ -42,6 +42,33 @@ where id = #{id} + + update repair_apply_details + set repaired_num = #{repairNum}, + status = #{status}, + repairer = #{repairer}, + update_by = #{userId}, + update_time = now() + where id = #{id} + + + + update repair_apply_details + set repaired_num = #{repairNum}, + update_by = #{userId}, + update_time = now() + where id = #{id} + + + + update repair_apply_details + set repaired_num = #{repairNum}, + status = #{status}, + update_by = #{userId}, + update_time = now() + where id = #{id} + + update repair_apply_details set scrap_num = #{scrapNum}, @@ -72,14 +99,6 @@ - - update repair_apply_details - set repaired_num = #{repairNum}, - update_by = #{userId}, - update_time = now() - where id = #{id} - -