pom.xml
@@ -65,6 +65,11 @@ <artifactId>mysql-connector-java</artifactId> <version>8.0.31</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.83</version> </dependency> <!-- <dependency>--> <!-- <groupId>com.baomidou</groupId>--> <!-- <artifactId>mybatis-plus-boot-starter</artifactId>--> src/main/java/com/gkhy/labRiskManage/api/controller/experiment/ExperimentInfoController.java
@@ -51,6 +51,16 @@ experimentAppService.save(getCurrentUserId(),experimentInsertReqBO); return result; } @PostMapping(value = "/temporary") public Result temporary(@RequestBody ExperimentInsertReqBO experimentInsertReqBO){ Result result = new Result(); result.setCode(ResultCode.OK); result.setMsg("暂存成功"); experimentAppService.temporary(getCurrentUserId(),experimentInsertReqBO); return result; } /** * 录入信息 * @param experimentInsertReqBO @@ -65,6 +75,15 @@ return result; } @PostMapping(value = "develop/temporary") public Result developTemporary(@RequestBody ExperimentInsertReqBO experimentInsertReqBO){ Result result = new Result(); result.setCode(ResultCode.OK); result.setMsg("暂存成功"); experimentAppService.developTemporary(getCurrentUserId(),experimentInsertReqBO); return result; } @PostMapping(value = "rectify/save") public Result rectifySave(@RequestBody ExperimentInsertReqBO experimentInsertReqBO){ Result result = new Result(); src/main/java/com/gkhy/labRiskManage/api/controller/experiment/converter/ExperimentApiConverter.java
@@ -30,6 +30,12 @@ for (ExperimentInfoAppQueryDTO experimentInfoAppQueryDTO:experimentInfoAppQueryDTOList){ ExperimentInfoRespDTO experimentInfoRespDTO = new ExperimentInfoRespDTO(); BeanUtils.copyProperties(experimentInfoAppQueryDTO,experimentInfoRespDTO); //实验类型 List<ExperimentAndTypeRespDTO> typeRespDTOs = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoAppQueryDTO.getTypes())){ typeRespDTOs = BeanCopyUtils.copyBeanList(experimentInfoAppQueryDTO.getTypes(),ExperimentAndTypeRespDTO.class); } experimentInfoRespDTO.setTypeList(typeRespDTOs); //实验场所 List<ExperimentAndSiteRespDTO> siteRespDTOs = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoAppQueryDTO.getSites())){ src/main/java/com/gkhy/labRiskManage/api/controller/experiment/dto/req/ExperimentAndTypeInsertReqBO.java
对比新文件 @@ -0,0 +1,20 @@ package com.gkhy.labRiskManage.api.controller.experiment.dto.req; import lombok.Data; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/3/20 * @time: 14:54 */ @Data public class ExperimentAndTypeInsertReqBO { private Long typeId; /** * 类型名称 */ private String typeName; } src/main/java/com/gkhy/labRiskManage/api/controller/experiment/dto/req/ExperimentInsertReqBO.java
@@ -29,7 +29,6 @@ */ private Long liabilityUserId; private String liabilityUserPhone; /** * 安全负责人id */ @@ -135,6 +134,10 @@ * 措施 */ private String measure; /** * 暂存保存:1-保存;2-暂存 */ private Byte stagingTag; /** * 危废情况 @@ -160,8 +163,16 @@ private List<ExperimentAndSiteInsertReqBO> siteList; /** * 实验类型 */ private List<ExperimentAndTypeInsertReqBO> typeList; /** * 演练情况 */ private List<ExperimentAndEmergencyInsertReqBO> emergencyList; } src/main/java/com/gkhy/labRiskManage/api/controller/experiment/dto/resp/ExperimentAndTypeRespDTO.java
对比新文件 @@ -0,0 +1,20 @@ package com.gkhy.labRiskManage.api.controller.experiment.dto.resp; import lombok.Data; /** * @email 1603559716@qq.com * @author: zf * @date: 2022/12/28 * @time: 15:24 */ @Data public class ExperimentAndTypeRespDTO { private Long typeId; /** * 类型名称 */ private String typeName; } src/main/java/com/gkhy/labRiskManage/api/controller/experiment/dto/resp/ExperimentInfoRespDTO.java
@@ -31,6 +31,10 @@ */ private Byte experimentType; /** * 实验类型名称 */ private String experimentTypeName; /** * 实验负责人id */ private Long liabilityUserId; @@ -202,6 +206,13 @@ */ private String assessPerson; /** * 暂存保存:1-保存;2-暂存 */ private Byte stagingTag; private List<ExperimentAndTypeRespDTO> typeList; private List<ExperimentAndSiteRespDTO> siteList; private List<ExperimentAndPersonRespDTO> persons; src/main/java/com/gkhy/labRiskManage/application/experiment/dto/bo/ExperimentAppInsertBO.java
@@ -16,6 +16,9 @@ */ @Data public class ExperimentAppInsertBO { private Long id; /** * 实验名称 */ src/main/java/com/gkhy/labRiskManage/application/experiment/dto/dto/ExperimentInfoAppQueryDTO.java
@@ -2,9 +2,15 @@ import com.gkhy.labRiskManage.api.controller.experiment.dto.resp.ExperimentAndEmergencyRespDTO; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAssessLog; import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentAndTypeDTO; import lombok.Data; import javax.persistence.CascadeType; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import java.time.LocalDateTime; import java.util.List; @@ -30,6 +36,10 @@ * 实验类型:1-化学类;2-生物类;3-辐射类;4-机电类;5-特种设备类;6-其它类 */ private Byte experimentType; /** * 实验类型名称 */ private String experimentTypeName; /** * 实验负责人id */ @@ -204,12 +214,25 @@ * 填报人 */ private String assessPerson; /** * 暂存保存:1-保存;2-暂存 */ private Byte stagingTag; private List<ExperimentAndTypeDTO> types; private List<ExperimentAndSiteAppQueryDTO> sites; private List<ExperimentAndDeviceAppQueryDTO> devices; private List<ExperimentAndPersonAppQueryDTO> persons; private List<ExperimentAndDeviceAppQueryDTO> devices; private List<ExperimentAndStuffAppQueryDTO> stuffs; private List<ExperimentHazardousWasteAppQueryDTO> wastes; private List<ExperimentAndSiteAppQueryDTO> sites; private List<ExperimentAndStuffAppQueryDTO> stuffs; /** * 演练情况 */ src/main/java/com/gkhy/labRiskManage/application/experiment/service/ExperimentAppService.java
@@ -12,8 +12,13 @@ public interface ExperimentAppService { int save(Long currentUserId, ExperimentInsertReqBO experimentAppInsertBO); int temporary(Long currentUserId, ExperimentInsertReqBO experimentAppInsertBO); int developSave(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO); int developTemporary(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO); int deleteById(Long id, Long currentUserId); int updateDevelop(Long currentUserId, List<ExperimentAppDevelopUpdateBO> appDevelopUpdateBOList); src/main/java/com/gkhy/labRiskManage/application/experiment/service/impl/ExperimentAppServiceImpl.java
@@ -13,13 +13,12 @@ import com.gkhy.labRiskManage.commons.exception.BusinessException; import com.gkhy.labRiskManage.commons.model.PageQuery; import com.gkhy.labRiskManage.commons.utils.BeanCopyUtils; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAssessLog; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentInfo; import com.gkhy.labRiskManage.domain.experiment.enums.ExperimentStatusEnum; import com.gkhy.labRiskManage.domain.experiment.enums.ExperimentTagEnum; import com.gkhy.labRiskManage.domain.experiment.enums.*; import com.gkhy.labRiskManage.domain.experiment.model.bo.*; import com.gkhy.labRiskManage.domain.experiment.enums.HazardousWasteEnum; import com.gkhy.labRiskManage.domain.experiment.enums.TimeoutEnum; import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentAndTypeDTO; import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentInfoDTO; import com.gkhy.labRiskManage.domain.experiment.service.*; import com.gkhy.labRiskManage.domain.riskReport.entity.ReportRiskAssessInfo; @@ -57,6 +56,8 @@ private ExperimentAppConverter experimentAppConverter; @Autowired private ExperimentAssessLogService experimentAssessLogService; @Autowired private ExperimentAndTypeService experimentAndTypeService; @Transactional @Override public int save(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { @@ -80,9 +81,14 @@ if(!CollectionUtils.isEmpty(experimentInsertReqBO.getSiteList())){ siteIds = experimentInsertReqBO.getSiteList().stream().map(ExperimentAndSiteInsertReqBO::getSiteId).collect(Collectors.toList()); } //实验类型中间表 List<Long> typeIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getTypeList())){ typeIds = experimentInsertReqBO.getTypeList().stream().map(ExperimentAndTypeInsertReqBO::getTypeId).collect(Collectors.toList()); } //危废中间表 List<ExperimentHazardousWasteAppInsertBO> hazardousWasteInsertBOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentAppInsertBO.getHazardousWasteList())){ if(!CollectionUtils.isEmpty(experimentInsertReqBO.getHazardousWasteList())){ hazardousWasteInsertBOList = experimentAppConverter.getHazardousWasteInsertBOList(experimentInsertReqBO.getHazardousWasteList(),experimentInfoDTO.getId()); } //应急演练 @@ -90,10 +96,14 @@ if(!CollectionUtils.isEmpty(experimentInsertReqBO.getEmergencyList())){ experimentAndEmergencyAppInsertBOList = experimentAppConverter.getExperimentAndEmergencyAppInsertBOList(experimentInsertReqBO.getEmergencyList(), experimentInfoDTO.getId()); } // 暂存清空了之前绑定数据 dealDelete(experimentInfoDTO.getId(),currentUserId); experimentAndDeviceService.saveBatch(currentUserId,deviceAppInsertBOList); experimentAndStuffService.saveBatch(currentUserId,stuffInsertBOList); experimentAndPersonService.saveBatch(currentUserId,personIds,experimentInfoDTO.getId()); experimentAndSiteService.saveBatch(currentUserId, siteIds, experimentInfoDTO.getId()); experimentAndTypeService.saveBatch(currentUserId, typeIds, experimentInfoDTO.getId()); experimentHazardousWasteService.saveBatch(currentUserId,hazardousWasteInsertBOList); experimentAndEmergencyService.saveBatch(currentUserId,experimentAndEmergencyAppInsertBOList); Integer code = StatusEnum.SUCCESS.getCode(); @@ -102,6 +112,31 @@ } return code; } @Override @Transactional public int temporary(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { // if(ExperimentStagingEnum.SAVE.getValue().equals(experimentInsertReqBO.getStagingTag())){ // throw new BusinessException(this.getClass(),ResultCode.PARAM_ERROR_NULL.getCode(),"已保存数据不可操作暂存!"); // } //实验基础信息 ExperimentAppInsertBO experimentAppInsertBO = new ExperimentAppInsertBO(); BeanUtils.copyProperties(experimentInsertReqBO,experimentAppInsertBO); ExperimentInfoDTO experimentInfoDTO = experimentInfoService.temporary(currentUserId,experimentAppInsertBO); //删除业务数据 dealDelete(experimentInfoDTO.getId(),currentUserId); temporary(currentUserId,experimentInsertReqBO,experimentInfoDTO.getId(),experimentAppInsertBO); Integer code = StatusEnum.SUCCESS.getCode(); if(ObjectUtils.isEmpty(experimentInfoDTO)){ code = StatusEnum.FAIL.getCode(); } return code; } @Transactional @Override public int developSave(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { @@ -126,7 +161,7 @@ } //危废中间表 List<ExperimentHazardousWasteAppInsertBO> hazardousWasteInsertBOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentAppInsertBO.getHazardousWasteList())){ if(!CollectionUtils.isEmpty(experimentInsertReqBO.getHazardousWasteList())){ hazardousWasteInsertBOList = experimentAppConverter.getHazardousWasteInsertBOList(experimentInsertReqBO.getHazardousWasteList(),experimentInfoDTO.getId()); } //应急演练 @@ -134,11 +169,20 @@ if(!CollectionUtils.isEmpty(experimentInsertReqBO.getEmergencyList())){ experimentAndEmergencyAppInsertBOList = experimentAppConverter.getExperimentAndEmergencyAppInsertBOList(experimentInsertReqBO.getEmergencyList(), experimentInfoDTO.getId()); } //实验类型中间表 List<Long> typeIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getTypeList())){ typeIds = experimentInsertReqBO.getTypeList().stream().map(ExperimentAndTypeInsertReqBO::getTypeId).collect(Collectors.toList()); } // 暂存清空了之前绑定数据 dealDelete(experimentInfoDTO.getId(),currentUserId); experimentAndDeviceService.saveBatch(currentUserId,deviceAppInsertBOList); experimentAndStuffService.saveBatch(currentUserId,stuffInsertBOList); experimentAndPersonService.saveBatch(currentUserId,personIds,experimentInfoDTO.getId()); experimentAndSiteService.saveBatch(currentUserId, siteIds, experimentInfoDTO.getId()); experimentAndTypeService.saveBatch(currentUserId, typeIds, experimentInfoDTO.getId()); experimentHazardousWasteService.saveBatch(currentUserId,hazardousWasteInsertBOList); experimentAndEmergencyService.saveBatch(currentUserId,experimentAndEmergencyAppInsertBOList); Integer code = StatusEnum.SUCCESS.getCode(); @@ -146,6 +190,88 @@ code = StatusEnum.FAIL.getCode(); } return code; } @Override @Transactional public int developTemporary(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { //实验基础信息 ExperimentAppInsertBO experimentAppInsertBO = new ExperimentAppInsertBO(); BeanUtils.copyProperties(experimentInsertReqBO,experimentAppInsertBO); ExperimentInfoDTO experimentInfoDTO = experimentInfoService.developTemporary(currentUserId,experimentAppInsertBO); //处理中间表数据 dealDelete(experimentInfoDTO.getId(),currentUserId); temporary(currentUserId,experimentInsertReqBO,experimentInfoDTO.getId(),experimentAppInsertBO); Integer code = StatusEnum.SUCCESS.getCode(); if(ObjectUtils.isEmpty(experimentInfoDTO)){ code = StatusEnum.FAIL.getCode(); } return code; } /** * 处理删除 * @param id * @param currentUserId */ private void dealDelete(Long id ,Long currentUserId){ experimentAndTypeService.deleteByExperimentId(id); experimentAndDeviceService.deleteByExperimentId(id,currentUserId); experimentHazardousWasteService.deleteByExperimentId(id,currentUserId); experimentAndPersonService.deleteByExperimentId(id,currentUserId); experimentAndStuffService.deleteByExperimentId(id,currentUserId); experimentAndSiteService.deleteByExperimentId(id); experimentAndEmergencyService.deleteByExperimentId(id); } /** * 处理中间表数据 * @param currentUserId * @param experimentInsertReqBO * @param experimentAppInsertBO */ private void temporary(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO,Long id ,ExperimentAppInsertBO experimentAppInsertBO) { if (!CollectionUtils.isEmpty(experimentInsertReqBO.getDeviceList())){ //设备中间表 List<ExperimentAndDeviceAppInsertBO> deviceAppInsertBOList = experimentAppConverter.getDeviceInsertBOList(experimentInsertReqBO.getDeviceList(),id); experimentAndDeviceService.saveBatch(currentUserId,deviceAppInsertBOList); } if (!CollectionUtils.isEmpty(experimentInsertReqBO.getStuffList())) { //材料中间表 List<ExperimentAndStuffAppInsertBO> stuffInsertBOList = experimentAppConverter.getStuffInsertBOList(experimentInsertReqBO.getStuffList(), id); experimentAndStuffService.saveBatch(currentUserId,stuffInsertBOList); } //实验人员 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getPersons())){ List<Long> personIds = experimentInsertReqBO.getPersons().stream().map(ExperimentAndPersonInsertReqBO::getPersonId).collect(Collectors.toList()); experimentAndPersonService.saveBatch(currentUserId,personIds,id); } //实验地点中间表 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getSiteList())){ List<Long> siteIds = experimentInsertReqBO.getSiteList().stream().map(ExperimentAndSiteInsertReqBO::getSiteId).collect(Collectors.toList()); experimentAndSiteService.saveBatch(currentUserId, siteIds, id); } //实验类型中间表 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getTypeList())){ List<Long> typeIds = experimentInsertReqBO.getTypeList().stream().map(ExperimentAndTypeInsertReqBO::getTypeId).collect(Collectors.toList()); experimentAndTypeService.saveBatch(currentUserId, typeIds, id); } //危废中间表 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getHazardousWasteList())){ List<ExperimentHazardousWasteAppInsertBO> hazardousWasteInsertBOList = experimentAppConverter.getHazardousWasteInsertBOList(experimentInsertReqBO.getHazardousWasteList(),id); experimentHazardousWasteService.saveBatch(currentUserId,hazardousWasteInsertBOList); } //应急演练 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getEmergencyList())){ List<ExperimentAndEmergencyAppInsertBO> experimentAndEmergencyAppInsertBOList = experimentAppConverter.getExperimentAndEmergencyAppInsertBOList(experimentInsertReqBO.getEmergencyList(), id); experimentAndEmergencyService.saveBatch(currentUserId,experimentAndEmergencyAppInsertBOList); } } @Transactional @Override @@ -189,6 +315,11 @@ experimentInfo.setAssessLevel(byExperimentId.getAssessLevel()); experimentInfo.setAssessTime(byExperimentId.getAssessTime()); } List<ExperimentAndTypeDTO> types = experimentInfo.getTypes(); if (!CollectionUtils.isEmpty(types)){ String collect = types.stream().map(type -> type.getTypeName()).collect(Collectors.joining(",")); experimentInfo.setExperimentTypeName(collect); } } result.setData(experimentInfoAppQueryDTOS); @@ -206,6 +337,7 @@ @Transactional(rollbackFor = Exception.class) @Override public int deleteById(Long id, Long currentUserId) { experimentInfoService.deleteById(id,currentUserId); experimentAndDeviceService.deleteByExperimentId(id,currentUserId); experimentHazardousWasteService.deleteByExperimentId(id,currentUserId); @@ -213,6 +345,7 @@ experimentAndStuffService.deleteByExperimentId(id,currentUserId); experimentAndSiteService.deleteByExperimentId(id); experimentAndEmergencyService.deleteByExperimentId(id); experimentAndTypeService.deleteByExperimentId(id); return StatusEnum.SUCCESS.getCode(); } @@ -275,7 +408,8 @@ BeanUtils.copyProperties(searchResult,result); } List<ExperimentInfoDTO> experimentInfoDTOS = (List<ExperimentInfoDTO>)searchResult.getData(); List<ExperimentInfoAppQueryDTO> experimentInfoAppQueryDTOS = BeanCopyUtils.copyBeanList(experimentInfoDTOS, ExperimentInfoAppQueryDTO.class); List<ExperimentInfoAppQueryDTO> experimentInfoAppQueryDTOS = BeanCopyUtils.list2OtherList(experimentInfoDTOS, ExperimentInfoAppQueryDTO.class); for (ExperimentInfoAppQueryDTO experimentInfo : experimentInfoAppQueryDTOS) { List<ExperimentAssessLog> assessLogs = experimentAssessLogService.getAssessLogs(experimentInfo.getExperimentCode()); @@ -287,6 +421,12 @@ experimentInfo.setAssessLevel(byExperimentId.getAssessLevel()); experimentInfo.setAssessTime(byExperimentId.getAssessTime()); } List<ExperimentAndTypeDTO> types = experimentInfo.getTypes(); if (!CollectionUtils.isEmpty(types)){ String collect = types.stream().map(type -> type.getTypeName()).collect(Collectors.joining(",")); experimentInfo.setExperimentTypeName(collect); } } result.setData(experimentInfoAppQueryDTOS); @@ -311,7 +451,7 @@ BeanUtils.copyProperties(searchResult,result); } List<ExperimentInfoDTO> experimentInfoDTOS = (List<ExperimentInfoDTO>)searchResult.getData(); List<ExperimentInfoAppQueryDTO> experimentInfoAppQueryDTOS = BeanCopyUtils.copyBeanList(experimentInfoDTOS, ExperimentInfoAppQueryDTO.class); List<ExperimentInfoAppQueryDTO> experimentInfoAppQueryDTOS = BeanCopyUtils.list2OtherList(experimentInfoDTOS, ExperimentInfoAppQueryDTO.class); for (ExperimentInfoAppQueryDTO experimentInfo : experimentInfoAppQueryDTOS) { List<ExperimentAssessLog> assessLogs = experimentAssessLogService.getAssessLogs(experimentInfo.getExperimentCode()); @@ -323,6 +463,11 @@ experimentInfo.setAssessLevel(byExperimentId.getAssessLevel()); experimentInfo.setAssessTime(byExperimentId.getAssessTime()); } List<ExperimentAndTypeDTO> types = experimentInfo.getTypes(); if (!CollectionUtils.isEmpty(types)){ String collect = types.stream().map(type -> type.getTypeName()).collect(Collectors.joining(",")); experimentInfo.setExperimentTypeName(collect); } } result.setData(experimentInfoAppQueryDTOS); src/main/java/com/gkhy/labRiskManage/commons/utils/BeanCopyUtils.java
@@ -1,5 +1,6 @@ package com.gkhy.labRiskManage.commons.utils; import com.alibaba.fastjson.*; import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.*; import com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto.*; import com.gkhy.labRiskManage.application.basic.dto.bo.BasicExperimentPersonAppQueryBO; @@ -13,6 +14,8 @@ import com.gkhy.labRiskManage.domain.riskReport.model.dto.RiskAssessPlanQueryDTO; import org.springframework.beans.BeanUtils; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -64,6 +67,18 @@ .collect(Collectors.toList()); } public static <T> List<T> list2OtherList(List originList,Class<T> tClass){ List<T> list = new ArrayList<>(); for (Object info : originList) { T t = JSON.parseObject(JSON.toJSONString(info),tClass); list.add(t); } return list; } public static Object copyDeviceAppQueryList(Object data, Class<BasicExperimentDeviceAppQueryDTO> basicExperimentDeviceAppQueryDTOClass) { return data; } src/main/java/com/gkhy/labRiskManage/config/serializa/JacksonConfiguration.java
@@ -1,6 +1,7 @@ package com.gkhy.labRiskManage.config.serializa; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; @@ -27,6 +28,7 @@ javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); mapper.registerModule(javaTimeModule); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false); return mapper; } } src/main/java/com/gkhy/labRiskManage/domain/basic/repository/jpa/BasicExperimentTypeRepository.java
@@ -1,5 +1,6 @@ package com.gkhy.labRiskManage.domain.basic.repository.jpa; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentSite; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentType; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; @@ -20,5 +21,10 @@ */ @Query(value = "select t from BasicExperimentType t where t.deleteStatus = 0") List<BasicExperimentType> listType(); /** * 基础实验类型 - 通过id列表查询 * */ @Query(value = "select t from BasicExperimentType t where t.id in (?1) and t.deleteStatus = 0") List<BasicExperimentType> batchById(List<Long> ids); } src/main/java/com/gkhy/labRiskManage/domain/basic/service/BasicExperimentTypeService.java
@@ -1,6 +1,7 @@ package com.gkhy.labRiskManage.domain.basic.service; import com.gkhy.labRiskManage.domain.basic.model.dto.SiteQueryDTO; import com.gkhy.labRiskManage.domain.basic.model.dto.TypeListDTO; import java.util.List; @@ -14,4 +15,8 @@ * 基础实验类型 - 列表 */ List<TypeListDTO> listBasicExperimentType(); /** * 实验类型 - 通过id列表查询 * */ List<TypeListDTO> getBasicExperimentTypeByIdList(List<Long> ids); } src/main/java/com/gkhy/labRiskManage/domain/basic/service/impl/BasicExperimentTypeServiceImpl.java
@@ -1,13 +1,18 @@ package com.gkhy.labRiskManage.domain.basic.service.impl; import com.gkhy.labRiskManage.commons.enums.ResultCode; import com.gkhy.labRiskManage.commons.exception.BusinessException; import com.gkhy.labRiskManage.commons.utils.BeanCopyUtils; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentSite; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentType; import com.gkhy.labRiskManage.domain.basic.model.dto.SiteQueryDTO; import com.gkhy.labRiskManage.domain.basic.model.dto.TypeListDTO; import com.gkhy.labRiskManage.domain.basic.repository.jpa.BasicExperimentTypeRepository; import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; /** @@ -28,4 +33,18 @@ List<BasicExperimentType> listResult = typeRepository.listType(); return BeanCopyUtils.copyBeanList(listResult, TypeListDTO.class); } @Override public List<TypeListDTO> getBasicExperimentTypeByIdList(List<Long> ids) { if (ids.size() < 1){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "请求参数不能为空"); } List<BasicExperimentType> listResult = typeRepository.batchById(ids); if (listResult.size() < 1){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "查询结果为空"); } return BeanCopyUtils.copyBeanList(listResult, TypeListDTO.class); } } src/main/java/com/gkhy/labRiskManage/domain/experiment/converter/ExperimentInfoDomainConverter.java
@@ -44,6 +44,21 @@ //实验基础信息 ExperimentInfoDTO experimentInfoDTO = new ExperimentInfoDTO(); BeanUtils.copyProperties(experimentInfo,experimentInfoDTO); //实验类型数据 List<ExperimentAndTypeDTO> types = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfo.getTypes())){ for (ExperimentAndType experimentAndType : experimentInfo.getTypes()){ ExperimentAndTypeDTO experimentAndTypeDTO = new ExperimentAndTypeDTO(); experimentAndTypeDTO.setTypeId(experimentAndType.getTypeId()); if(null != experimentAndType.getType()){ experimentAndTypeDTO.setTypeName(experimentAndType.getType().getExperimentType()); } types.add(experimentAndTypeDTO); } } experimentInfoDTO.setTypes(types); //实验场所数据 List<ExperimentAndSiteDTO> sites = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfo.getSites())){ src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentAndDevice.java
@@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentDevice; import org.hibernate.annotations.Where; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -18,6 +19,7 @@ @EntityListeners(AuditingEntityListener.class) @Entity @Table(name = "experiment_and_device") @Where(clause = "delete_status = 0") public class ExperimentAndDevice implements Serializable { private static final long serialVersionUID = -74398808654954420L; src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentAndEmergency.java
@@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.hibernate.annotations.Where; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; @@ -17,6 +18,7 @@ @Data @Entity @Table(name = "experiment_and_emergency") @Where(clause = "delete_status = 0") public class ExperimentAndEmergency { @Id src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentAndPerson.java
@@ -1,6 +1,7 @@ package com.gkhy.labRiskManage.domain.experiment.entity; import com.fasterxml.jackson.annotation.JsonFormat; import org.hibernate.annotations.Where; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -16,6 +17,7 @@ @EntityListeners(AuditingEntityListener.class) @Entity @Table(name = "experiment_and_person") @Where(clause = "delete_status = 0") public class ExperimentAndPerson implements Serializable { private static final long serialVersionUID = 217943177919881451L; src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentAndSite.java
@@ -3,6 +3,7 @@ import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentSite; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentStuff; import lombok.Data; import org.hibernate.annotations.Where; import javax.persistence.*; @@ -16,6 +17,7 @@ @Data @Entity @Table(name = "experiment_and_site") @Where(clause = "delete_status = 0") public class ExperimentAndSite { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentAndStuff.java
@@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentSite; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentStuff; import org.hibernate.annotations.Where; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -19,6 +20,7 @@ @EntityListeners(AuditingEntityListener.class) @Entity @Table(name = "experiment_and_stuff") @Where(clause = "delete_status = 0") public class ExperimentAndStuff implements Serializable { private static final long serialVersionUID = -79650379228221888L; src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentAndType.java
对比新文件 @@ -0,0 +1,43 @@ package com.gkhy.labRiskManage.domain.experiment.entity; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentSite; import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentType; import lombok.Data; import org.hibernate.annotations.Where; import javax.persistence.*; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/3/20 * @time: 15:54 */ @Data @Entity @Table(name = "experiment_and_type") @Where(clause = "delete_status = 0") public class ExperimentAndType { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Long id; /** * 实验ID */ @Column(name = "experiment_id") private Long experimentId; /** * 类型 */ @Column(name = "type_id") private Long typeId; /** * 删除状态:0-正常;1-已删除 */ private Byte deleteStatus; @OneToOne(fetch = FetchType.EAGER,cascade = {CascadeType.REFRESH}) @JoinColumn(name = "type_id",referencedColumnName = "id",insertable =false ,updatable = false) private BasicExperimentType type; } src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentHazardousWaste.java
@@ -1,6 +1,7 @@ package com.gkhy.labRiskManage.domain.experiment.entity; import com.fasterxml.jackson.annotation.JsonFormat; import org.hibernate.annotations.Where; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -16,6 +17,7 @@ @EntityListeners(AuditingEntityListener.class) @Entity @Table(name = "experiment_hazardous_waste") @Where(clause = "delete_status = 0") public class ExperimentHazardousWaste implements Serializable { private static final long serialVersionUID = -50912711565680265L; src/main/java/com/gkhy/labRiskManage/domain/experiment/entity/ExperimentInfo.java
@@ -214,6 +214,15 @@ * 填报人 */ private String informant; /** * 暂存保存:1-保存;2-暂存 */ private Byte stagingTag; @OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.REFRESH}) @JoinColumn(name = "experiment_id",referencedColumnName = "id",insertable =false ,updatable = false) @Fetch(FetchMode.SUBSELECT) private List<ExperimentAndType> types; @OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.REFRESH}) @JoinColumn(name = "experiment_id",referencedColumnName = "id",insertable =false ,updatable = false) src/main/java/com/gkhy/labRiskManage/domain/experiment/enums/ExperimentStagingEnum.java
对比新文件 @@ -0,0 +1,62 @@ package com.gkhy.labRiskManage.domain.experiment.enums; import java.util.HashMap; import java.util.Map; /** * @email 1603559716@qq.com * @author: zf * @date: 2022/12/20 * @time: 17:31 */ public enum ExperimentStagingEnum { SAVE((byte)1,"保存"), NOT_SAVE((byte)2,"暂存"), ; private Byte value; private String dec; ExperimentStagingEnum(Byte value, String dec) { this.value = value; this.dec = dec; } public Byte getValue() { return value; } public void setValue(Byte value) { this.value = value; } public static Map<Byte, ExperimentStagingEnum> getMap() { return map; } public static void setMap(Map<Byte, ExperimentStagingEnum> map) { ExperimentStagingEnum.map = map; } public String getDec() { return dec; } public void setDec(String dec) { this.dec = dec; } static Map<Byte, ExperimentStagingEnum> map; static { map = new HashMap<>(); for(ExperimentStagingEnum e : ExperimentStagingEnum.values()){ map.put(e.value,e); } } public static ExperimentStagingEnum prase(Byte value){ return map.get(value); } } src/main/java/com/gkhy/labRiskManage/domain/experiment/model/dto/ExperimentAndTypeDTO.java
对比新文件 @@ -0,0 +1,18 @@ package com.gkhy.labRiskManage.domain.experiment.model.dto; import lombok.Data; /** * @email 1603559716@qq.com * @author: zf * @date: 2022/12/27 * @time: 15:27 */ @Data public class ExperimentAndTypeDTO { private Long typeId; /** * 场所名称 */ private String typeName; } src/main/java/com/gkhy/labRiskManage/domain/experiment/model/dto/ExperimentInfoDTO.java
@@ -1,5 +1,6 @@ package com.gkhy.labRiskManage.domain.experiment.model.dto; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAssessLog; import lombok.Data; @@ -196,6 +197,12 @@ */ private String assessPerson; /** * 暂存保存:1-保存;2-暂存 */ private Byte stagingTag; private List<ExperimentAndTypeDTO> types; private List<ExperimentAndSiteDTO> sites; src/main/java/com/gkhy/labRiskManage/domain/experiment/repository/jpa/ExperimentAndTypeRepository.java
对比新文件 @@ -0,0 +1,27 @@ package com.gkhy.labRiskManage.domain.experiment.repository.jpa; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndSite; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/3/20 * @time: 16:18 */ @Repository public interface ExperimentAndTypeRepository extends JpaRepository<ExperimentAndType, Long> { @Modifying @Query(value = "update experiment_and_type set delete_status = 1 where experiment_id = :experimentId",nativeQuery = true) int deleteByExperimentId(Long experimentId); @Query(value = "select * from experiment_and_type where delete_status = 0 and experiment_id = :id",nativeQuery = true) List<ExperimentAndType> getByExperimentId(Long id); } src/main/java/com/gkhy/labRiskManage/domain/experiment/service/ExperimentAndTypeService.java
对比新文件 @@ -0,0 +1,20 @@ package com.gkhy.labRiskManage.domain.experiment.service; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndSite; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/3/20 * @time: 15:51 */ public interface ExperimentAndTypeService { boolean saveBatch(Long currentUserId, List<Long> siteIds, Long experimentId); void deleteByExperimentId(Long id); List<ExperimentAndType> getByExperimentId(Long id); } src/main/java/com/gkhy/labRiskManage/domain/experiment/service/ExperimentInfoService.java
@@ -18,8 +18,13 @@ public interface ExperimentInfoService { ExperimentInfoDTO save(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO); ExperimentInfoDTO temporary(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO); ExperimentInfoDTO developSave(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO); ExperimentInfoDTO developTemporary(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO); boolean deleteById(Long id,Long currentUserId); ExperimentInfoDTO getExperimentById(Long id); ExperimentInfoDTO getExperimentByName(String experimentName); src/main/java/com/gkhy/labRiskManage/domain/experiment/service/impl/ExperimentAndEmergencyServiceImpl.java
@@ -38,6 +38,8 @@ experimentAndEmergency.setDeleteStatus(StatusEnum.DELETE_NOT.getCode().byteValue()); experimentAndEmergency.setCreateByUserId(currentUserId); experimentAndEmergency.setUpdateByUserId(currentUserId); //暂时处理20241106 experimentAndEmergency.setId(null); experimentAndEmergencyList.add(experimentAndEmergency); } List<ExperimentAndEmergency> emergencies = repository.saveAll(experimentAndEmergencyList); src/main/java/com/gkhy/labRiskManage/domain/experiment/service/impl/ExperimentAndTypeServiceImpl.java
对比新文件 @@ -0,0 +1,85 @@ package com.gkhy.labRiskManage.domain.experiment.service.impl; import com.gkhy.labRiskManage.commons.enums.ResultCode; import com.gkhy.labRiskManage.commons.enums.StatusEnum; import com.gkhy.labRiskManage.commons.exception.BusinessException; import com.gkhy.labRiskManage.domain.basic.model.dto.SiteQueryDTO; import com.gkhy.labRiskManage.domain.basic.model.dto.TypeListDTO; import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentDeviceTypeService; import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentSiteService; import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentTypeService; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndSite; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; import com.gkhy.labRiskManage.domain.experiment.repository.jpa.ExperimentAndSiteRepository; import com.gkhy.labRiskManage.domain.experiment.repository.jpa.ExperimentAndTypeRepository; import com.gkhy.labRiskManage.domain.experiment.service.ExperimentAndTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/3/20 * @time: 16:01 */ @Service public class ExperimentAndTypeServiceImpl implements ExperimentAndTypeService { @Autowired private BasicExperimentTypeService basicExperimentTypeService; @Autowired private ExperimentAndTypeRepository repository; @Override public boolean saveBatch(Long currentUserId, List<Long> typeIds, Long experimentId) { boolean flag = false; if(CollectionUtils.isEmpty(typeIds)){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"请选择实验类型!"); } if(ObjectUtils.isEmpty(experimentId)){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"实验信息主键不可为空!"); } List<TypeListDTO> basicExperimentTypeByIdList = basicExperimentTypeService.getBasicExperimentTypeByIdList(typeIds); for(Long typeId : typeIds){ List<TypeListDTO> collect = basicExperimentTypeByIdList.stream().filter(site -> site.getId().equals(typeId)).collect(Collectors.toList()); if(collect.size() == 0){ throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(),"实验类型信息不存在!"); } } List<ExperimentAndType> typeList = new ArrayList<>(); typeIds.forEach(e ->{ ExperimentAndType experimentAndType = new ExperimentAndType(); experimentAndType.setExperimentId(experimentId); experimentAndType.setTypeId(e); experimentAndType.setDeleteStatus(StatusEnum.DELETE_NOT.getCode().byteValue()); typeList.add(experimentAndType); }); List<ExperimentAndType> experimentAndTypeList = repository.saveAll(typeList); if(!CollectionUtils.isEmpty(experimentAndTypeList)){ flag = true; } return flag; } @Override public void deleteByExperimentId(Long id) { if(ObjectUtils.isEmpty(id)){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"实验主键不可为空!"); } repository.deleteByExperimentId(id); } @Override public List<ExperimentAndType> getByExperimentId(Long id) { List<ExperimentAndType> experimentAndTypeList = repository.getByExperimentId(id); return experimentAndTypeList; } } src/main/java/com/gkhy/labRiskManage/domain/experiment/service/impl/ExperimentInfoServiceImpl.java
@@ -76,31 +76,32 @@ @Override public ExperimentInfoDTO save(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO) { UserInfoDomainDTO operator = userDomainService.getUserInfoById(currentUserId); //验证权限 List<SysUserRoleBindDomainDTO> roles = operator.getRoles(); boolean flag = false; if(roles != null && roles.size() > 0){ for (SysUserRoleBindDomainDTO role : roles){ if (role.getRoleName().equals(UserRoleEnum.USER_ROLE_1.getDesc())) { flag = true; break; } } } if (!flag){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"该账号无权限录入实验信息!"); } // 20211105去掉权限验证 // //验证权限 // List<SysUserRoleBindDomainDTO> roles = operator.getRoles(); // boolean flag = false; // if(roles != null && roles.size() > 0){ // for (SysUserRoleBindDomainDTO role : roles){ // if (role.getRoleName().equals(UserRoleEnum.USER_ROLE_1.getDesc())) { // flag = true; // break; // } // } // } // if (!flag){ // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"该账号无权限录入实验信息!"); // } //验证 if(ObjectUtils.isEmpty(experimentAppInsertBO.getExperimentName())){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"请填写实验名称!"); } if(ObjectUtils.isEmpty(experimentAppInsertBO.getExperimentType())){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"请选择实验类型!"); } if(ObjectUtils.isEmpty(ExperimentTypeEnum.prase(experimentAppInsertBO.getExperimentType()))){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"实验类型非法!"); } // if(ObjectUtils.isEmpty(experimentAppInsertBO.getExperimentType())){ // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"请选择实验类型!"); // } // if(ObjectUtils.isEmpty(ExperimentTypeEnum.prase(experimentAppInsertBO.getExperimentType()))){ // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"实验类型非法!"); // } if(ObjectUtils.isEmpty(experimentAppInsertBO.getLiabilityUserId())){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"请选择实验负责人!"); } @@ -177,6 +178,7 @@ } ExperimentInfo experimentInfo = new ExperimentInfo(); BeanUtils.copyProperties(experimentAppInsertBO, experimentInfo); experimentInfo.setStagingTag(ExperimentStagingEnum.SAVE.getValue()); experimentInfo.setDeleteStatus(StatusEnum.DELETE_NOT.getCode().byteValue()); experimentInfo.setLiabilityUser(operator.getName()); experimentInfo.setLiabilityUserId(currentUserId); @@ -193,33 +195,58 @@ return converter.getExperimentInfoDTO(experiment); } @Override public ExperimentInfoDTO temporary(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO) { UserInfoDomainDTO operator = userDomainService.getUserInfoById(currentUserId); ExperimentInfo experimentInfo = new ExperimentInfo(); BeanUtils.copyProperties(experimentAppInsertBO, experimentInfo); experimentInfo.setStagingTag(ExperimentStagingEnum.NOT_SAVE.getValue()); experimentInfo.setDeleteStatus(StatusEnum.DELETE_NOT.getCode().byteValue()); experimentInfo.setLiabilityUser(operator.getName()); experimentInfo.setLiabilityUserId(currentUserId); experimentInfo.setStage(ExperimentStageEnum.NOT_EVALUATION.getValue()); experimentInfo.setStatus(ExperimentStatusEnum.NOT_APPLY.getValue()); experimentInfo.setExperimentTag(ExperimentTagEnum.NEW_CREATE.getValue()); experimentInfo.setRectifyStatus(ExperimentRectifyStatusEnum.NOT_RECTIFY.getValue()); experimentInfo.setExperimentCode(generateTestNumber()); experimentInfo.setCreateByUserId(currentUserId); experimentInfo.setInformant(operator == null?"":operator.getName()); experimentInfo.setUpdateByUserId(currentUserId); experimentInfo.setApprovalStatus(ExperimentApprovalStatusEnum.NOT_APPROVAL.getValue()); ExperimentInfo experiment = repository.save(experimentInfo); return converter.getExperimentInfoDTO(experiment); } @Override public ExperimentInfoDTO developSave(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO) { UserInfoDomainDTO operator = userDomainService.getUserInfoById(currentUserId); //验证权限 List<SysUserRoleBindDomainDTO> roles = operator.getRoles(); boolean flag = false; if(roles != null && roles.size() > 0){ for (SysUserRoleBindDomainDTO role : roles){ if (role.getRoleName().equals(UserRoleEnum.USER_ROLE_1.getDesc())) { flag = true; break; } } } if (!flag){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"该账号无权限录入实验信息!"); } // 20211105去掉权限验证 // //验证权限 // List<SysUserRoleBindDomainDTO> roles = operator.getRoles(); // boolean flag = false; // if(roles != null && roles.size() > 0){ // for (SysUserRoleBindDomainDTO role : roles){ // if (role.getRoleName().equals(UserRoleEnum.USER_ROLE_1.getDesc())) { // flag = true; // break; // } // } // } // if (!flag){ // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"该账号无权限录入实验信息!"); // } //验证 if(ObjectUtils.isEmpty(experimentAppInsertBO.getExperimentName())){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"请填写实验名称!"); } if(ObjectUtils.isEmpty(experimentAppInsertBO.getExperimentType())){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"请选择实验类型!"); } if(ObjectUtils.isEmpty(ExperimentTypeEnum.prase(experimentAppInsertBO.getExperimentType()))){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"实验类型非法!"); } // if(ObjectUtils.isEmpty(experimentAppInsertBO.getExperimentType())){ // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"请选择实验类型!"); // } // if(ObjectUtils.isEmpty(ExperimentTypeEnum.prase(experimentAppInsertBO.getExperimentType()))){ // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"实验类型非法!"); // } if(ObjectUtils.isEmpty(experimentAppInsertBO.getLiabilityUserPhone())){ throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"请填写实验负责人手机号!"); } @@ -304,6 +331,7 @@ } ExperimentInfo experimentInfo = new ExperimentInfo(); BeanUtils.copyProperties(experimentAppInsertBO, experimentInfo); experimentInfo.setStagingTag(ExperimentStagingEnum.SAVE.getValue()); experimentInfo.setDeleteStatus(StatusEnum.DELETE_NOT.getCode().byteValue()); experimentInfo.setLiabilityUserId(currentUserId); experimentInfo.setLiabilityUser(operator.getName()); @@ -319,6 +347,30 @@ ExperimentInfo experiment = repository.save(experimentInfo); return converter.getExperimentInfoDTO(experiment); } @Override public ExperimentInfoDTO developTemporary(Long currentUserId, ExperimentAppInsertBO experimentAppInsertBO) { UserInfoDomainDTO operator = userDomainService.getUserInfoById(currentUserId); ExperimentInfo experimentInfo = new ExperimentInfo(); BeanUtils.copyProperties(experimentAppInsertBO, experimentInfo); experimentInfo.setStagingTag(ExperimentStagingEnum.NOT_SAVE.getValue()); experimentInfo.setDeleteStatus(StatusEnum.DELETE_NOT.getCode().byteValue()); experimentInfo.setLiabilityUserId(currentUserId); experimentInfo.setLiabilityUser(operator.getName()); experimentInfo.setStage(ExperimentStageEnum.NOT_EVALUATION.getValue()); experimentInfo.setStatus(ExperimentStatusEnum.NOT_APPLY.getValue()); experimentInfo.setExperimentTag(ExperimentTagEnum.AREADLY_DEVELOP.getValue()); experimentInfo.setRectifyStatus(ExperimentRectifyStatusEnum.NOT_RECTIFY.getValue()); experimentInfo.setExperimentCode(generateTestNumber()); experimentInfo.setCreateByUserId(currentUserId); experimentInfo.setInformant(operator == null?"":operator.getName()); experimentInfo.setUpdateByUserId(currentUserId); experimentInfo.setApprovalStatus(ExperimentApprovalStatusEnum.NOT_APPROVAL.getValue()); ExperimentInfo experiment = repository.save(experimentInfo); return converter.getExperimentInfoDTO(experiment); } @Override @@ -551,9 +603,9 @@ if(!ObjectUtils.isEmpty(ExperimentTagEnum.prase(queryBO.getExperimentTag()))){ predicateList.add(criteriaBuilder.equal(root.get("experimentTag"),queryBO.getExperimentTag())); } if (!ObjectUtils.isEmpty(ExperimentTypeEnum.prase(queryBO.getExperimentType()))){ predicateList.add(criteriaBuilder.equal(root.get("experimentType"), queryBO.getExperimentType())); } // if (!ObjectUtils.isEmpty(ExperimentTypeEnum.prase(queryBO.getExperimentType()))){ // predicateList.add(criteriaBuilder.equal(root.get("experimentType"), queryBO.getExperimentType())); // } if (StrUtil.isNotBlank(queryBO.getExperimentName())){ predicateList.add(criteriaBuilder.like(root.get("experimentName"), '%'+ queryBO.getExperimentName()+'%')); } @@ -575,6 +627,10 @@ ); query.groupBy(root.get("id")); } if (!ObjectUtils.isEmpty(ExperimentTypeEnum.prase(queryBO.getExperimentType()))){ Join<ExperimentInfo, ExperimentAndType> typeJoin = root.join("types", JoinType.LEFT); predicateList.add(criteriaBuilder.equal(typeJoin.get("typeId"), queryBO.getExperimentType())); } //返回组装的条件 return criteriaBuilder.and(predicateList.toArray(predicateList.toArray(new Predicate[0]))); src/main/java/com/gkhy/labRiskManage/domain/riskReport/entity/RiskAssessPlan.java
@@ -2,6 +2,7 @@ import com.gkhy.labRiskManage.domain.basic.entity.BasicTip; import lombok.Data; import org.hibernate.annotations.Where; import javax.persistence.*; import java.math.BigDecimal; @@ -15,6 +16,7 @@ @Data @Entity @Table(name = "risk_assess_plan") @Where(clause = "delete_status = 0") public class RiskAssessPlan implements Serializable { private static final long serialVersionUID = -44756780317221858L; src/main/resources/config/application-dev.yaml
@@ -6,14 +6,14 @@ datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/laboratory_risk_manage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&useAffectedRows=true username: gkhy_dev_team password: Sjscn783fsDsa21 url: jdbc:mysql://127.0.0.1:3306/laboratory_risk_manage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&useAffectedRows=true username: root password: 123456 master: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/laboratory_risk_manage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&useAffectedRows=true username: gkhy_dev_team password: Sjscn783fsDsa21 url: jdbc:mysql://127.0.0.1:3306/laboratory_risk_manage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&useAffectedRows=true username: root password: 123456 type: com.alibaba.druid.pool.DruidDataSource jpa: hibernate: src/main/resources/config/application.yaml
@@ -2,5 +2,5 @@ application: name: labRiskManage profiles: active: dev # active: gslab active: online-uat src/main/resources/config/redisson-dev.yml
@@ -10,13 +10,14 @@ # 命令重试发送时间间隔,单位:毫秒 retryInterval: 1500 # 密码 password: SEF98uvs98dUAUEF90Udssa #password: #password: SEF98uvs98dUAUEF90Udssa # 单个连接最大订阅数量 subscriptionsPerConnection: 5 # 客户端名称 # clientName: null # 节点地址 address: redis://192.168.0.52:6371 address: redis://127.0.0.1:6379 # # 发布和订阅连接的最小空闲连接数 # subscriptionConnectionMinimumIdleSize: 1 # # 发布和订阅连接池大小