| | |
| | | <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>--> |
对比新文件 |
| | |
| | | package com.gkhy.labRiskManage.api.controller.basic.dto.respDto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | @Data |
| | | public class OldRiskAssessResDTO implements Serializable { |
| | | |
| | | private Integer sort; |
| | | private Long id; |
| | | |
| | | private String region; |
| | | |
| | | private String potentialAccident; |
| | | |
| | | private String dangerReason; |
| | | |
| | | private String triggerFactor; |
| | | |
| | | private String accidentResult; |
| | | |
| | | private String l; |
| | | |
| | | private String e; |
| | | |
| | | private String c; |
| | | |
| | | private String d; |
| | | |
| | | private String dangerLevel; |
| | | |
| | | private String controlMeasure; |
| | | |
| | | private String controlLevel; |
| | | |
| | | private LocalDateTime createTime; |
| | | |
| | | private Long createByUserId; |
| | | |
| | | private String createByUserName; |
| | | |
| | | private LocalDateTime updateTime; |
| | | |
| | | private Long updateByUserId; |
| | | |
| | | private String updateByUserName; |
| | | |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | 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(); |
| | |
| | | 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())){ |
对比新文件 |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | */ |
| | | private Long liabilityUserId; |
| | | private String liabilityUserPhone; |
| | | |
| | | /** |
| | | * 安全负责人id |
| | | */ |
| | |
| | | * 措施 |
| | | */ |
| | | private String measure; |
| | | /** |
| | | * 暂存保存:1-保存;2-暂存 |
| | | */ |
| | | private Byte stagingTag; |
| | | |
| | | /** |
| | | * 危废情况 |
| | |
| | | |
| | | private List<ExperimentAndSiteInsertReqBO> siteList; |
| | | |
| | | |
| | | /** |
| | | * 实验类型 |
| | | */ |
| | | |
| | | private List<ExperimentAndTypeInsertReqBO> typeList; |
| | | |
| | | /** |
| | | * 演练情况 |
| | | */ |
| | | private List<ExperimentAndEmergencyInsertReqBO> emergencyList; |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | private Byte experimentType; |
| | | /** |
| | | * 实验类型名称 |
| | | */ |
| | | private String experimentTypeName; |
| | | /** |
| | | * 实验负责人id |
| | | */ |
| | | private Long liabilityUserId; |
| | |
| | | */ |
| | | private String assessPerson; |
| | | |
| | | /** |
| | | * 暂存保存:1-保存;2-暂存 |
| | | */ |
| | | private Byte stagingTag; |
| | | |
| | | private List<ExperimentAndTypeRespDTO> typeList; |
| | | |
| | | private List<ExperimentAndSiteRespDTO> siteList; |
| | | |
| | | private List<ExperimentAndPersonRespDTO> persons; |
| | |
| | | import com.gkhy.labRiskManage.commons.domain.SearchResult; |
| | | import com.gkhy.labRiskManage.commons.enums.ResultCode; |
| | | import com.gkhy.labRiskManage.commons.utils.BeanCopyUtils; |
| | | import com.gkhy.labRiskManage.config.annotation.RepeatSubmit; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | result.setMsg("查询成功"); |
| | | |
| | | SearchResult<ReportQueryRespDTO> queryResult = reportAppService.selectRiskReportPage(getCurrentUserId(), queryReqBO); |
| | | result.setData(BeanCopyUtils.copyReportQueryResp(queryResult.getData(), ReportQueryRespDTO.class)); |
| | | |
| | | BeanCopyUtils.copyReportQueryResp(queryResult.getData(), ReportQueryRespDTO.class); |
| | | result.setData(BeanCopyUtils.copyReportQueryResp(queryResult.getData(), ReportQueryRespDTO.class)); |
| | | result.setPageIndex(queryResult.getPageIndex()); |
| | | result.setPageSize(queryResult.getPageSize()); |
| | | result.setTotal(queryResult.getTotal()); |
| | |
| | | * 风险评估报告 - 生成报告信息 |
| | | */ |
| | | @PostMapping("/insert/insertRiskReport") |
| | | @RepeatSubmit() |
| | | public Result insertRiskReport(@RequestBody JSONObject jsonObject){ |
| | | Result result = new Result(); |
| | | result.setCode(ResultCode.OK); |
| | |
| | | * 风险评估报告 - 填写报告信息 |
| | | */ |
| | | @PostMapping("/update/updateRiskReport") |
| | | @RepeatSubmit() |
| | | public Result updateRiskReport(@RequestBody ReportUpdateReqBO updateReqBO){ |
| | | Result result = new Result(); |
| | | result.setCode(ResultCode.OK); |
| | |
| | | * 风险评估报告 - 报告审核 - 旧 - 两层审核 |
| | | */ |
| | | @PostMapping("/update/report") |
| | | @RepeatSubmit() |
| | | public Result report(@RequestBody ReportReqBO reportReqBO){ |
| | | Result result = new Result(); |
| | | result.setCode(ResultCode.OK); |
| | |
| | | * 风险评估报告 - 报告审核 - 新 - 单次审核 |
| | | */ |
| | | @PostMapping("/update/reportNew") |
| | | @RepeatSubmit() |
| | | public Result reportNew(@RequestBody ReportReqBO reportReqBO){ |
| | | Result result = new Result(); |
| | | result.setCode(ResultCode.OK); |
| | |
| | | */ |
| | | private String planUserName; |
| | | |
| | | /** |
| | | * 工艺流程 |
| | | */ |
| | | private String process; |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | private List<Long> roleIds; |
| | | |
| | | private String pwd; |
| | | |
| | | private String phone; |
| | | |
| | |
| | | createUserBO.setRealName(createNewUserAppReqDTO.getRealName()); |
| | | //如果没有提供密码,初始密码为“123456” |
| | | if(createNewUserAppReqDTO.getPwd() == null || createNewUserAppReqDTO.getPwd().isEmpty()){ |
| | | createNewUserAppReqDTO.setPwd("Gkhy@c413"); |
| | | createNewUserAppReqDTO.setPwd("Gs@123456"); |
| | | } |
| | | |
| | | //todo 2024 弱口令问题处理 |
| | |
| | | bo.setDepId(updateUserAppReqDTO.getDepId()); |
| | | bo.setIdentityStatus(updateUserAppReqDTO.getIdentityStatus()); |
| | | bo.setQualificationAttId(updateUserAppReqDTO.getQualificationAttId()); |
| | | if (!ObjectUtils.isEmpty(updateUserAppReqDTO.getPwd())){ |
| | | if (updateUserAppReqDTO.getPwd().length() < 8){ |
| | | throw new BusinessException(this.getClass(),ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"密码长度不够"); |
| | | } |
| | | if (!updateUserAppReqDTO.getPwd().matches(".*[A-Z].*")){ |
| | | throw new BusinessException(this.getClass(),ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"密码需要包含大小写字母、数字、特殊符号"); |
| | | } |
| | | if (!updateUserAppReqDTO.getPwd().matches(".*[a-z].*")){ |
| | | throw new BusinessException(this.getClass(),ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"密码需要包含大小写字母、数字、特殊符号"); |
| | | } |
| | | if (!updateUserAppReqDTO.getPwd().matches(".*\\d.*")){ |
| | | throw new BusinessException(this.getClass(),ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"密码需要包含大小写字母、数字、特殊符号"); |
| | | } |
| | | if (!updateUserAppReqDTO.getPwd().matches(".*[!@#$%^&*.()?+`~<>,-].*")){ |
| | | throw new BusinessException(this.getClass(),ResultCode.PARAM_ERROR_ILLEGAL.getCode(),"密码需要包含大小写字母、数字、特殊符号"); |
| | | } |
| | | bo.setPwd(updateUserAppReqDTO.getPwd()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | UserInfoDomainDTO updateRs = userDomainService.updateUserInfo(bo); |
| | | //修改用户绑定角色 |
| | | userRoleDomainService.updateUserRole(updateUserAppReqDTO.getId(), updateUserAppReqDTO.getRoleIds()); |
| | |
| | | */ |
| | | @Data |
| | | public class ExperimentAppInsertBO { |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 实验名称 |
| | | */ |
| | |
| | | |
| | | |
| | | 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; |
| | | |
| | |
| | | * 实验类型:1-化学类;2-生物类;3-辐射类;4-机电类;5-特种设备类;6-其它类 |
| | | */ |
| | | private Byte experimentType; |
| | | /** |
| | | * 实验类型名称 |
| | | */ |
| | | private String experimentTypeName; |
| | | /** |
| | | * 实验负责人id |
| | | */ |
| | |
| | | * 填报人 |
| | | */ |
| | | 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; |
| | | |
| | | |
| | | /** |
| | | * 演练情况 |
| | | */ |
| | |
| | | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | private ExperimentAppConverter experimentAppConverter; |
| | | @Autowired |
| | | private ExperimentAssessLogService experimentAssessLogService; |
| | | @Autowired |
| | | private ExperimentAndTypeService experimentAndTypeService; |
| | | @Transactional |
| | | @Override |
| | | public int save(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { |
| | |
| | | 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()); |
| | | } |
| | | //应急演练 |
| | |
| | | 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(); |
| | |
| | | } |
| | | 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) { |
| | |
| | | } |
| | | //危废中间表 |
| | | List<ExperimentHazardousWasteAppInsertBO> hazardousWasteInsertBOList = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(experimentAppInsertBO.getHazardousWasteList())){ |
| | | if(!CollectionUtils.isEmpty(experimentInsertReqBO.getHazardousWasteList())){ |
| | | hazardousWasteInsertBOList = experimentAppConverter.getHazardousWasteInsertBOList(experimentInsertReqBO.getHazardousWasteList(),experimentInfoDTO.getId()); |
| | | } |
| | | //应急演练 |
| | |
| | | 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(); |
| | |
| | | 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 |
| | |
| | | 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); |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public int deleteById(Long id, Long currentUserId) { |
| | | |
| | | experimentInfoService.deleteById(id,currentUserId); |
| | | experimentAndDeviceService.deleteByExperimentId(id,currentUserId); |
| | | experimentHazardousWasteService.deleteByExperimentId(id,currentUserId); |
| | |
| | | experimentAndStuffService.deleteByExperimentId(id,currentUserId); |
| | | experimentAndSiteService.deleteByExperimentId(id); |
| | | experimentAndEmergencyService.deleteByExperimentId(id); |
| | | experimentAndTypeService.deleteByExperimentId(id); |
| | | return StatusEnum.SUCCESS.getCode(); |
| | | } |
| | | |
| | |
| | | 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()); |
| | |
| | | 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); |
| | |
| | | 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()); |
| | |
| | | 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); |
| | |
| | | package com.gkhy.labRiskManage.application.riskReport.dto.dto; |
| | | |
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessResDTO; |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto.ReportExperimentSiteQueryRespDTO; |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto.ReportPersonQueryRespDTO; |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto.ReportRiskSourceQueryRespDTO; |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto.ReportSourceTypeQueryRespDTO; |
| | | import com.gkhy.labRiskManage.domain.basic.entity.OldRiskAssess; |
| | | import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | */ |
| | | private LocalDateTime evaluateTime; |
| | | |
| | | /** |
| | | * 工艺流程 |
| | | */ |
| | | private String process; |
| | | |
| | | List<ReportPersonQueryRespDTO> person; |
| | | /** |
| | | * 风险源类型 |
| | |
| | | * |
| | | */ |
| | | List<ReportExperimentSiteQueryRespDTO> experimentSite; |
| | | /** |
| | | * 实验类型 |
| | | */ |
| | | List<ExperimentAndType> experimentAndType; |
| | | /** |
| | | * 附件 |
| | | */ |
| | | List<OldRiskAssessResDTO> oldRiskAssess; |
| | | } |
| | | |
| | |
| | | package com.gkhy.labRiskManage.application.riskReport.dto.dto; |
| | | |
| | | import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | |
| | | */ |
| | | private String planUserName; |
| | | |
| | | /** |
| | | * 工艺流程 |
| | | */ |
| | | private String process; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.gkhy.labRiskManage.commons.enums.StatusEnum; |
| | | import com.gkhy.labRiskManage.commons.exception.BusinessException; |
| | | import com.gkhy.labRiskManage.commons.utils.BeanCopyUtils; |
| | | import com.gkhy.labRiskManage.config.annotation.RepeatSubmit; |
| | | import com.gkhy.labRiskManage.domain.account.service.UserDomainService; |
| | | import com.gkhy.labRiskManage.domain.experiment.service.ExperimentInfoService; |
| | | import com.gkhy.labRiskManage.domain.riskReport.model.dto.*; |
| | |
| | | } |
| | | int roleTag = 0; |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | roleTag = 1; |
| | | } |
| | | } |
| | | if (roleTag != 1){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限添加"); |
| | | } |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | //20241107修改注释权限 |
| | | // if (roleTag != 1){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限添加"); |
| | | // } |
| | | if (ObjectUtils.isEmpty(riskUnitInsertReqBO.getExperimentId())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选实验不能为空"); |
| | | } |
| | |
| | | } |
| | | int roleTag = 0; |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | roleTag = 1; |
| | | } |
| | | } |
| | | if (roleTag != 1){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限修改"); |
| | | } |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | //20241107修改注释权限 |
| | | // if (roleTag != 1){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限修改"); |
| | | // } |
| | | if (ObjectUtils.isEmpty(updateReqBO.getExperimentId())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选实验不能为空,或实验已被删除"); |
| | | } |
| | |
| | | } |
| | | int roleTag = 0; |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | roleTag = 1; |
| | | } |
| | | } |
| | | if (roleTag != 1){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限添加"); |
| | | } |
| | | //20241107注释 |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | // if (roleTag != 1){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限添加"); |
| | | // } |
| | | RiskUnitDeleteDTO deleteResult = riskUnitService.deleteRiskUnit(currentUserId, id); |
| | | |
| | | if (ObjectUtils.isEmpty(deleteResult)){ |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | .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; |
| | | } |
对比新文件 |
| | |
| | | package com.gkhy.labRiskManage.config.annotation; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 自定义注解防止表单重复提交 |
| | | */ |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface RepeatSubmit { |
| | | /** |
| | | * 间隔时间(ms) 小于此时间视为重复提交 |
| | | * @return |
| | | */ |
| | | public int interval() default 5000; |
| | | |
| | | /** |
| | | * 提示消息 |
| | | * @return |
| | | */ |
| | | public String message() default "不允许重复提交,请稍后再试"; |
| | | } |
对比新文件 |
| | |
| | | package com.gkhy.labRiskManage.config.interceptor; |
| | | |
| | | |
| | | import com.gkhy.labRiskManage.commons.enums.ResultCode; |
| | | import com.gkhy.labRiskManage.commons.exception.BusinessException; |
| | | import com.gkhy.labRiskManage.config.annotation.RepeatSubmit; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * 防止器重复提交拦截 |
| | | * |
| | | */ |
| | | @Component |
| | | public abstract class RepeatSubmitInterceptor implements HandlerInterceptor |
| | | { |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception |
| | | { |
| | | if (handler instanceof HandlerMethod) |
| | | { |
| | | HandlerMethod handlerMethod = (HandlerMethod) handler; |
| | | Method method = handlerMethod.getMethod(); |
| | | RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class); |
| | | if (annotation != null) |
| | | { |
| | | if (this.isRepeatSubmit(request, annotation)) |
| | | { |
| | | //throw new RuntimeException(annotation.message()); |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), annotation.message()); |
| | | |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证是否重复提交由子类实现具体的防重复提交的规则 |
| | | * |
| | | * @param request 请求对象 |
| | | * @param annotation 防复注解 |
| | | * @return 结果 |
| | | */ |
| | | public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation) throws Exception; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | |
| | | private Long qualificationAttId; |
| | | |
| | | private String pwd; |
| | | |
| | | |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.persistence.criteria.*; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | user.setPhone(updateUserBO.getPhone()); |
| | | user.setIdentityStatus(updateUserBO.getIdentityStatus()); |
| | | user.setQualificationAttId(updateUserBO.getQualificationAttId()); |
| | | if (!ObjectUtils.isEmpty(updateUserBO.getPwd())){ |
| | | user.setHash(genPasswordHash(updateUserBO.getPwd(), user.getSalt())); |
| | | } |
| | | //写库 |
| | | User saveUserRs = userRepository.save(user); |
| | | return userInfoDomainConverter.toUserInfoDTO(saveUserRs); |
| | |
| | | User user = userOptional.get(); |
| | | |
| | | //设置初始密码 |
| | | String newPwd = "Gkhy@c413"; |
| | | String newPwd = "Gs@123456"; |
| | | String newHash = genPasswordHash(newPwd, user.getSalt()); |
| | | |
| | | // Integer integer = userRepository.resetPassword(uid, newHash, LocalDateTime.now()); |
| | |
| | | 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; |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | * 基础实验类型 - 列表 |
| | | */ |
| | | List<TypeListDTO> listBasicExperimentType(); |
| | | /** |
| | | * 实验类型 - 通过id列表查询 |
| | | * */ |
| | | List<TypeListDTO> getBasicExperimentTypeByIdList(List<Long> ids); |
| | | } |
| | |
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.repDto.OldRiskAssessQueryReqBO;
|
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessExportRespDTO;
|
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessQueryRespDTO;
|
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessResDTO;
|
| | | import com.gkhy.labRiskManage.commons.domain.Result;
|
| | | import com.gkhy.labRiskManage.commons.domain.SearchResult;
|
| | | import com.gkhy.labRiskManage.domain.basic.entity.OldRiskAssess;
|
| | |
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import java.util.List;
|
| | |
|
| | | public interface OldRiskAssessService {
|
| | |
|
| | |
| | | int importOldRiskAssess(Long currentUserId, MultipartFile file);
|
| | |
|
| | | Result<OldRiskAssessExportRespDTO> exportOldRiskAssess(Long currentUserId, OldRiskAssessQueryReqBO queryReqDO, HttpServletResponse response, HttpServletRequest request);
|
| | |
|
| | |
|
| | | List<OldRiskAssessResDTO> getOldRiskAssessListByRegion(List<String> region);
|
| | | }
|
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.repDto.OldRiskAssessQueryReqBO; |
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessExportRespDTO; |
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessQueryRespDTO; |
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessResDTO; |
| | | import com.gkhy.labRiskManage.commons.domain.Result; |
| | | import com.gkhy.labRiskManage.commons.domain.SearchResult; |
| | | import com.gkhy.labRiskManage.commons.enums.ResultCode; |
| | |
| | | import com.gkhy.labRiskManage.domain.basic.repository.jpa.OldRiskAssessRepository; |
| | | import com.gkhy.labRiskManage.domain.basic.service.OldRiskAssessService; |
| | | import org.apache.poi.hssf.usermodel.*; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | |
| | | import org.springframework.data.jpa.domain.Specification; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.Base64Utils; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | import javax.persistence.criteria.CriteriaQuery; |
| | | import javax.persistence.criteria.Predicate; |
| | | import javax.persistence.criteria.Root; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.NumberFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<OldRiskAssessResDTO> getOldRiskAssessListByRegion(List<String> region) { |
| | | |
| | | Specification<OldRiskAssess> specification = new Specification<OldRiskAssess>() { |
| | | @Override |
| | | public Predicate toPredicate(Root<OldRiskAssess> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) { |
| | | query.orderBy(criteriaBuilder.asc(root.get("region"))); |
| | | List<Predicate> predicateList = new ArrayList<>(); |
| | | predicateList.add(criteriaBuilder.in(root.get("region")).value(region)); |
| | | |
| | | predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"),StatusEnum.DELETE_NOT.getCode())); |
| | | //返回组装的条件 |
| | | return criteriaBuilder.and(predicateList.toArray(predicateList.toArray(new Predicate[0]))); |
| | | } |
| | | }; |
| | | |
| | | List<OldRiskAssess> all = repository.findAll(specification); |
| | | if (ObjectUtils.isEmpty(all)){ |
| | | return null; |
| | | } |
| | | List<OldRiskAssessResDTO> oldRiskAssessResDTOS = BeanCopyUtils.copyBeanList(all, OldRiskAssessResDTO.class); |
| | | oldRiskAssessResDTOS.forEach(oldRiskAssessResDTO -> { |
| | | oldRiskAssessResDTO.setSort(oldRiskAssessResDTOS.indexOf(oldRiskAssessResDTO) + 1); |
| | | }); |
| | | return oldRiskAssessResDTOS; |
| | | } |
| | | |
| | | @Override |
| | | public SearchResult<OldRiskAssessQueryRespDTO> getOldRiskAssessPage(Long currentUserId, OldRiskAssessQueryReqBO queryReqDO) { |
| | | |
| | | //校验参数 |
| | |
| | | //实验基础信息 |
| | | 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())){ |
| | |
| | | |
| | | 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; |
| | |
| | | @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; |
| | | |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | @Data |
| | | @Entity |
| | | @Table(name = "experiment_and_emergency") |
| | | @Where(clause = "delete_status = 0") |
| | | public class ExperimentAndEmergency { |
| | | |
| | | @Id |
| | |
| | | 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; |
| | |
| | | @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; |
| | | |
| | |
| | | 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.*; |
| | |
| | | @Data |
| | | @Entity |
| | | @Table(name = "experiment_and_site") |
| | | @Where(clause = "delete_status = 0") |
| | | public class ExperimentAndSite { |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | |
| | | 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; |
| | |
| | | @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; |
| | | |
对比新文件 |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | @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; |
| | | |
| | |
| | | * 填报人 |
| | | */ |
| | | 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) |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | private String assessPerson; |
| | | |
| | | /** |
| | | * 暂存保存:1-保存;2-暂存 |
| | | */ |
| | | private Byte stagingTag; |
| | | |
| | | private List<ExperimentAndTypeDTO> types; |
| | | |
| | | private List<ExperimentAndSiteDTO> sites; |
| | | |
对比新文件 |
| | |
| | | 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); |
| | | } |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | |
| | | 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); |
对比新文件 |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.jpa.domain.Specification; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | @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(),"请选择实验负责人!"); |
| | | } |
| | |
| | | } |
| | | 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); |
| | |
| | | |
| | | 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(),"请填写实验负责人手机号!"); |
| | | } |
| | |
| | | } |
| | | 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()); |
| | |
| | | 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 |
| | |
| | | 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()+'%')); |
| | | } |
| | |
| | | ); |
| | | 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]))); |
| | |
| | | |
| | | import com.gkhy.labRiskManage.domain.basic.entity.BasicTip; |
| | | import lombok.Data; |
| | | import org.hibernate.annotations.Where; |
| | | |
| | | import javax.persistence.*; |
| | | import java.math.BigDecimal; |
| | |
| | | @Data |
| | | @Entity |
| | | @Table(name = "risk_assess_plan") |
| | | @Where(clause = "delete_status = 0") |
| | | public class RiskAssessPlan implements Serializable { |
| | | private static final long serialVersionUID = -44756780317221858L; |
| | | |
| | |
| | | /** |
| | | * 实验风险单元 - 查询 by code |
| | | */ |
| | | @Query(value = "select t from RiskUnit t where t.riskCode = :riskCode and t.deleteStatus = 0") |
| | | RiskUnit getUnitByCode(String riskCode); |
| | | @Query(value = "select t from RiskUnit t where t.riskCode = :riskCode and t.experimentId = :experimentId and t.deleteStatus = 0") |
| | | RiskUnit getUnitByCode(String riskCode,Long experimentId); |
| | | /** |
| | | * 风险单元 - 查询 by id |
| | | */ |
| | |
| | | package com.gkhy.labRiskManage.domain.riskReport.service.impl; |
| | | |
| | | import com.gkhy.labRiskManage.api.controller.basic.dto.respDto.OldRiskAssessResDTO; |
| | | import com.gkhy.labRiskManage.api.controller.experiment.dto.req.ExperimentAndPersonInsertReqBO; |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto.ReportReqBO; |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto.ReportExperimentSiteQueryRespDTO; |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto.ReportPersonQueryRespDTO; |
| | |
| | | import com.gkhy.labRiskManage.domain.account.model.dto.UserInfoDomainDTO; |
| | | import com.gkhy.labRiskManage.domain.account.service.UserDomainService; |
| | | import com.gkhy.labRiskManage.domain.basic.entity.BasicRiskUnitType; |
| | | import com.gkhy.labRiskManage.domain.basic.entity.OldRiskAssess; |
| | | import com.gkhy.labRiskManage.domain.basic.model.dto.SiteQueryDTO; |
| | | import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentPersonService; |
| | | import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentSiteService; |
| | | import com.gkhy.labRiskManage.domain.basic.service.BasicRiskUnitTypeService; |
| | | import com.gkhy.labRiskManage.domain.basic.service.OldRiskAssessService; |
| | | import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndSite; |
| | | import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAssessLog; |
| | | import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentInfo; |
| | |
| | | import com.gkhy.labRiskManage.domain.experiment.enums.ExperimentRectifyStatusEnum; |
| | | import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentInfoDTO; |
| | | import com.gkhy.labRiskManage.domain.experiment.service.ExperimentAndSiteService; |
| | | import com.gkhy.labRiskManage.domain.experiment.service.ExperimentAndTypeService; |
| | | import com.gkhy.labRiskManage.domain.experiment.service.ExperimentAssessLogService; |
| | | import com.gkhy.labRiskManage.domain.experiment.service.ExperimentInfoService; |
| | | import com.gkhy.labRiskManage.domain.riskReport.entity.*; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.persistence.criteria.CriteriaBuilder; |
| | | import javax.persistence.criteria.CriteriaQuery; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | |
| | | private RiskAssessPlanEvaluateMesService mesService; |
| | | @Autowired |
| | | private RiskAssessPlanEvaluateRsService rsService; |
| | | |
| | | @Autowired |
| | | private ExperimentAndTypeService experimentAndTypeService; |
| | | |
| | | @Autowired |
| | | private OldRiskAssessService oldRiskAssessService; |
| | | |
| | | |
| | | /** |
| | |
| | | List<ReportAppQueryDTO> reportAppQueryDTOS = BeanCopyUtils.copyBeanList(reportQueryDTOS, ReportAppQueryDTO.class); |
| | | |
| | | List<UserInfoDomainDTO> userList = userDomainService.getUserList(); |
| | | |
| | | |
| | | for (ReportAppQueryDTO reportQueryDTO : reportAppQueryDTOS) { |
| | | //获取审批人员 |
| | | List<ReportPersonQueryRespDTO> personByReportId = reportPersonService.listPersonByReportId(reportQueryDTO.getId()); |
| | |
| | | //获取评估计划 |
| | | List<AssessPlanQueryDTO> assessPlanByExperimentId = assessPlanService.getAssessPlanByExperimentId(reportQueryDTO.getExperimentId()); |
| | | reportQueryDTO.setEvaluateTime(experimentById.getCreateTime()); |
| | | if (!ObjectUtils.isEmpty(experimentById.getProcess())){ |
| | | reportQueryDTO.setProcess(experimentById.getProcess()); |
| | | } |
| | | |
| | | |
| | | if (!ObjectUtils.isEmpty(assessPlanByExperimentId)){ |
| | | for (AssessPlanQueryDTO assessPlan : assessPlanByExperimentId) { |
| | |
| | | } |
| | | if (!ObjectUtils.isEmpty(siteByReportId)){ |
| | | reportQueryDTO.setExperimentSite(BeanCopyUtils.copyBeanList(siteByReportId, ReportExperimentSiteQueryRespDTO.class)); |
| | | if (queryBO.getExperimentId() != null){ |
| | | List<ReportExperimentSiteQueryRespDTO> experimentSite = reportQueryDTO.getExperimentSite(); |
| | | List<String> collect = experimentSite.stream().map(ReportExperimentSiteQueryRespDTO::getSiteName).collect(Collectors.toList()); |
| | | List<OldRiskAssessResDTO> oldRiskAssessListByRegion = oldRiskAssessService.getOldRiskAssessListByRegion(collect); |
| | | if (!ObjectUtils.isEmpty(oldRiskAssessListByRegion)){ |
| | | |
| | | reportQueryDTO.setOldRiskAssess(oldRiskAssessListByRegion); |
| | | } |
| | | reportQueryDTO.setExperimentAndType(experimentAndTypeService.getByExperimentId(reportQueryDTO.getExperimentId())); |
| | | } |
| | | } |
| | | reportQueryDTO.setExperimentCode(experimentById.getExperimentCode()); |
| | | |
| | |
| | | reportQueryDTO.setUpdateByUserName(userInfo.getRealName()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | searchResult.setData(reportAppQueryDTOS); |
| | |
| | | return searchResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 风险评估报告 - 生成报告信息 |
| | | */ |
| | |
| | | reportById.setAssessPerson(reportUpdateBO.getAssessPerson()); |
| | | reportById.setAssessLevel(reportUpdateBO.getAssessLevel()); |
| | | reportById.setDescription(reportUpdateBO.getDescription()); |
| | | if(!ObjectUtils.isEmpty(reportUpdateBO.getSafeRiskAnalysis())){ |
| | | reportById.setSafeRiskAnalysis(reportUpdateBO.getSafeRiskAnalysis()); |
| | | } |
| | | reportById.setUpdateTime(LocalDateTime.now()); |
| | | reportById.setUpdateByUserId(currentUserId); |
| | | |
| | |
| | | * 风险评估报告 - 报告审核 - 新 - 单次审核 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int reportNew(Long currentUserId, ReportReqBO reportReqBO) { |
| | | |
| | | if (currentUserId < 0){ |
| | |
| | | // 检查是否是实验管理者 |
| | | int roleTag = 0; |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | roleTag = 1; |
| | | } |
| | | } |
| | | if (roleTag ==0 ){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权添加实验评估计划"); |
| | | } |
| | | //20241107修改注释 |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | // if (roleTag ==0 ){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权添加实验评估计划"); |
| | | // } |
| | | if (ObjectUtils.isEmpty(user)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | } |
| | |
| | | // 检查是否是实验管理者 |
| | | int roleTag = 0; |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | roleTag = 1; |
| | | } |
| | | } |
| | | if (roleTag ==0 ){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权修改实验评估计划"); |
| | | } |
| | | //20241107修改注释 |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | // if (roleTag ==0 ){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权修改实验评估计划"); |
| | | // } |
| | | //参数校验 |
| | | if (ObjectUtils.isEmpty(updateParam)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要求改的参数为空"); |
| | |
| | | // 检查是否是实验管理者 |
| | | int roleTag = 0; |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | roleTag = 1; |
| | | } |
| | | } |
| | | if (roleTag ==0 ){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权删除实验评估计划"); |
| | | } |
| | | //20241107注释 |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | // if (roleTag ==0 ){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权删除实验评估计划"); |
| | | // } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | |
| | | if (ObjectUtils.isEmpty(insertParam.getRiskCode())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元编号不能为空"); |
| | | } |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(insertParam.getRiskCode()); |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(insertParam.getRiskCode(), insertParam.getExperimentId()); |
| | | if (!ObjectUtils.isEmpty(unitByCode)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "编号已被使用"); |
| | | } |
| | |
| | | if (ObjectUtils.isEmpty(updateParam.getRiskCode())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元编号不能为空"); |
| | | } |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(updateParam.getRiskCode()); |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(updateParam.getRiskCode(),updateParam.getExperimentId()); |
| | | if (!ObjectUtils.isEmpty(unitByCode) && !updateParam.getId().equals(unitByCode.getId())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "编号已被使用"); |
| | | } |
| | |
| | | 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: |
| | |
| | | application: |
| | | name: labRiskManage |
| | | profiles: |
| | | active: dev |
| | | # active: gslab |
| | | active: online-uat |
| | |
| | | # 命令重试发送时间间隔,单位:毫秒 |
| | | 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 |
| | | # # 发布和订阅连接池大小 |