From 7e912d14ccffb7d462848d8177202738c7b530cf Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期二, 08 七月 2025 17:31:03 +0800 Subject: [PATCH] art:技术状态鉴定规范-问题修改 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java | 168 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 143 insertions(+), 25 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java index 8ba1b11..341f040 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java @@ -6,20 +6,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.SimpleVersionGenerateUtil; -import org.jeecg.modules.eam.base.entity.BaseFactory; -import org.jeecg.modules.eam.base.entity.BaseFactoryUser; -import org.jeecg.modules.eam.base.service.IBaseFactoryService; -import org.jeecg.modules.eam.base.service.IBaseFactoryUserService; -import org.jeecg.modules.eam.constant.MaintenanceStandardStatusEnum; +import org.jeecg.modules.system.entity.BaseFactory; +import org.jeecg.modules.system.entity.BaseFactoryUser; +import org.jeecg.modules.system.service.IBaseFactoryService; +import org.jeecg.modules.system.service.IBaseFactoryUserService; +import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationCheckCategoryEnum; import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationStandardEnum; -import org.jeecg.modules.eam.entity.EamMaintenanceStandard; -import org.jeecg.modules.eam.entity.EamMaintenanceStandardDetail; import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard; import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail; import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationStandardMapper; @@ -29,11 +28,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -105,6 +101,10 @@ @Override @Transactional(rollbackFor = Exception.class) public boolean addEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request) { + if(!CommonConstant.STATUS_1.equals(request.getHasOtherCheck()) && !CommonConstant.STATUS_1.equals(request.getHasSafetyEquipmentCheck()) && !CommonConstant.STATUS_1.equals(request.getHasPrecisionCheck())) { + //蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫� + throw new JeecgBootException("蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫伙紒"); + } EamTechnicalStatusEvaluationStandard entity = new EamTechnicalStatusEvaluationStandard(); BeanUtils.copyProperties(request, entity); entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.WAIT_SUBMIT.name()); @@ -125,7 +125,31 @@ request.getTableDetailList().forEach(tableDetail -> { tableDetail.setStandardId(entity.getId()); }); - standardDetailService.saveBatch(request.getTableDetailList()); + //鏍规嵁鍒嗙被鍒ゆ柇鏄惁淇濆瓨 + if(CommonConstant.STATUS_1.equals(entity.getHasOtherCheck())) { + //淇濆瓨鍏朵粬鍒嗙被 + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("鍏朵粬妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); + } + if(CommonConstant.STATUS_1.equals(entity.getHasSafetyEquipmentCheck())) { + //淇濆瓨瀹夊叏瑁呯疆鍒嗙被 + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("瀹夊叏瑁呯疆妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); + } + if(CommonConstant.STATUS_1.equals(entity.getHasPrecisionCheck())) { + //淇濆瓨绮惧害妫�楠屽垎绫� + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("绮惧害妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); + } } return true; } @@ -151,36 +175,130 @@ @Override @Transactional(rollbackFor = Exception.class) public boolean editEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request) { + if(!CommonConstant.STATUS_1.equals(request.getHasOtherCheck()) && !CommonConstant.STATUS_1.equals(request.getHasSafetyEquipmentCheck()) && !CommonConstant.STATUS_1.equals(request.getHasPrecisionCheck())) { + //蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫� + throw new JeecgBootException("蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫伙紒"); + } EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId()); if(entity == null){ throw new JeecgBootException("缂栬緫鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); } entity.setStandardName(request.getStandardName()); entity.setEvaluationPeriod(request.getEvaluationPeriod()); + entity.setHasOtherCheck(request.getHasOtherCheck()); + entity.setHasPrecisionCheck(request.getHasPrecisionCheck()); + entity.setHasSafetyEquipmentCheck(request.getHasSafetyEquipmentCheck()); + entity.setRemark(request.getRemark()); this.getBaseMapper().updateById(entity); //澶勭悊璇︽儏 if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { - List<EamTechnicalStatusEvaluationStandardDetail> addList = new ArrayList<>(); - List<EamTechnicalStatusEvaluationStandardDetail> updateList = new ArrayList<>(); + //鍏堝垹闄ゆ鏌ラ」 + standardDetailService.removeByStandardId(entity.getId()); request.getTableDetailList().forEach(tableDetail -> { tableDetail.setStandardId(entity.getId()); - if(tableDetail.getId() == null){ - addList.add(tableDetail); - }else { - updateList.add(tableDetail); - } }); - if(CollectionUtil.isNotEmpty(addList)){ - standardDetailService.saveBatch(addList); + //鏍规嵁鍒嗙被鍒ゆ柇鏄惁淇濆瓨 + if(CommonConstant.STATUS_1.equals(entity.getHasOtherCheck())) { + //淇濆瓨鍏朵粬鍒嗙被 + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("鍏朵粬妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); } - if(CollectionUtil.isNotEmpty(updateList)){ - standardDetailService.updateBatchById(updateList); + if(CommonConstant.STATUS_1.equals(entity.getHasSafetyEquipmentCheck())) { + //淇濆瓨瀹夊叏瑁呯疆鍒嗙被 + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("瀹夊叏瑁呯疆妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); + } + if(CommonConstant.STATUS_1.equals(entity.getHasPrecisionCheck())) { + //淇濆瓨绮惧害妫�楠屽垎绫� + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("绮惧害妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); } } - if(CollectionUtil.isNotEmpty(request.getRemoveDetailList())) { - List<String> ids = request.getRemoveDetailList().stream().map(EamTechnicalStatusEvaluationStandardDetail::getId).collect(Collectors.toList()); - standardDetailService.removeBatchByIds(ids); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean upgrade(EamTechnicalStatusEvaluationStandardRequest request) { + if(!CommonConstant.STATUS_1.equals(request.getHasOtherCheck()) && !CommonConstant.STATUS_1.equals(request.getHasSafetyEquipmentCheck()) && !CommonConstant.STATUS_1.equals(request.getHasPrecisionCheck())) { + //蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫� + throw new JeecgBootException("蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫伙紒"); } + EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId()); + if(entity == null){ + throw new JeecgBootException("鍗囩増鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); + } + + //鏂板涓�涓増鏈� + EamTechnicalStatusEvaluationStandard newEntity = new EamTechnicalStatusEvaluationStandard(); + newEntity.setStandardCode(request.getStandardCode()); + newEntity.setStandardName(request.getStandardName()); + newEntity.setEvaluationPeriod(request.getEvaluationPeriod()); + newEntity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.ENABLE.name()); + //鐗堟湰閫掑 + newEntity.setStandardVersion(SimpleVersionGenerateUtil.addVersion(entity.getStandardVersion())); + //璁惧澶勭悊 + newEntity.setEquipmentId(request.getEquipmentId()); + newEntity.setHasOtherCheck(request.getHasOtherCheck()); + newEntity.setHasPrecisionCheck(request.getHasPrecisionCheck()); + newEntity.setHasSafetyEquipmentCheck(request.getHasSafetyEquipmentCheck()); + //鍒犻櫎鏍囪 + newEntity.setDelFlag(CommonConstant.DEL_FLAG_0); + newEntity.setRemark(request.getRemark()); + //閲嶅鎬ф牎楠� + EamTechnicalStatusEvaluationStandard exist = checkDuplicate(newEntity.getEquipmentId(), entity.getId()); + if(exist != null){ + throw new JeecgBootException("閴村畾瑙勮寖宸插瓨鍦紝涓嶈兘閲嶅娣诲姞锛�"); + } + this.getBaseMapper().insert(newEntity); + //澶勭悊鏄庣粏鏁版嵁 + if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { + request.getTableDetailList().forEach(tableDetail -> { + tableDetail.setId(null); + tableDetail.setCreateBy(null); + tableDetail.setUpdateBy(null); + tableDetail.setCreateTime(null); + tableDetail.setUpdateTime(null); + tableDetail.setStandardId(newEntity.getId()); + }); + //鏍规嵁鍒嗙被鍒ゆ柇鏄惁淇濆瓨 + if(CommonConstant.STATUS_1.equals(entity.getHasOtherCheck())) { + //淇濆瓨鍏朵粬鍒嗙被 + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("鍏朵粬妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); + } + if(CommonConstant.STATUS_1.equals(entity.getHasSafetyEquipmentCheck())) { + //淇濆瓨瀹夊叏瑁呯疆鍒嗙被 + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("瀹夊叏瑁呯疆妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); + } + if(CommonConstant.STATUS_1.equals(entity.getHasPrecisionCheck())) { + //淇濆瓨绮惧害妫�楠屽垎绫� + List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)) { + throw new JeecgBootException("绮惧害妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒"); + } + standardDetailService.saveBatch(collect); + } + } + //绂佺敤鍘熸潵鐨勭増鏈� + entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.DISABLE.name()); + this.getBaseMapper().updateById(entity); return true; } } -- Gitblit v1.9.3