From bf02fb12956f2b46427b86ab8ce767accd88fe7c Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Sat, 20 Jul 2024 15:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E9=AA=8C=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ExperimentalController.java | 69 ++++++++ .../aqgqj/basis/dao/ExperimentalMapper.java | 48 ++++++ .../aqgqj/basis/entity/dto/ParamsDto.java | 16 ++ .../basis/entity/vo/ExperimentalDetailVo.java | 68 ++++++++ .../aqgqj/basis/entity/vo/ExperimentalVo.java | 65 +++++++ .../bonus/aqgqj/basis/entity/vo/TestVo.java | 162 ++++++++++++++++++ .../basis/service/ExperimentalService.java | 46 +++++ .../service/impl/ExperimentalServiceImpl.java | 89 ++++++++++ .../basis/ExperimentStandardMapper.xml | 2 +- .../mappers/basis/ExperimentalMapper.xml | 77 +++++++++ 10 files changed, 641 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/bonus/aqgqj/basis/controller/ExperimentalController.java create mode 100644 src/main/java/com/bonus/aqgqj/basis/dao/ExperimentalMapper.java create mode 100644 src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalDetailVo.java create mode 100644 src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalVo.java create mode 100644 src/main/java/com/bonus/aqgqj/basis/entity/vo/TestVo.java create mode 100644 src/main/java/com/bonus/aqgqj/basis/service/ExperimentalService.java create mode 100644 src/main/java/com/bonus/aqgqj/basis/service/impl/ExperimentalServiceImpl.java create mode 100644 src/main/resources/mappers/basis/ExperimentalMapper.xml diff --git a/src/main/java/com/bonus/aqgqj/basis/controller/ExperimentalController.java b/src/main/java/com/bonus/aqgqj/basis/controller/ExperimentalController.java new file mode 100644 index 0000000..48e6d58 --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/controller/ExperimentalController.java @@ -0,0 +1,69 @@ +package com.bonus.aqgqj.basis.controller; + +import com.bonus.aqgqj.annotation.DecryptAndVerify; +import com.bonus.aqgqj.annotation.LogAnnotation; +import com.bonus.aqgqj.basis.entity.dto.ParamsDto; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo; +import com.bonus.aqgqj.basis.service.ExperimentalService; +import com.bonus.aqgqj.system.vo.EncryptedReq; +import com.bonus.aqgqj.utils.ServerResponse; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @className:ExperimentalController + * @author:cwchen + * @date:2024-07-20-12:07 + * @version:1.0 + * @description:试验管理-controller + */ +@RestController +@RequestMapping("/experimental/") +@Slf4j +public class ExperimentalController { + + @Resource(name = "ExperimentalService") + private ExperimentalService service; + + @PostMapping(value = "getList") + @DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理 + @LogAnnotation(operModul = "试验管理", operation = "查询列表", operDesc = "系统级事件", operType = "查询") +// @PreAuthorize("@pms.hasPermission('sys:experimental:query')" ) + public ServerResponse getList(EncryptedReq data) { + PageHelper.startPage(data.getData().getPage(), data.getData().getLimit()); + List list = service.getList(data.getData()); + PageInfo pageInfo = new PageInfo<>(list); + return ServerResponse.createSuccessPage(pageInfo, data.getData().getPage(), data.getData().getLimit()); + } + + @PostMapping(value = "getDetailList") + @DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理 + @LogAnnotation(operModul = "试验管理", operation = "查询试验详情列表", operDesc = "系统级事件", operType = "查询") + public ServerResponse getDetailList(EncryptedReq data) { + PageHelper.startPage(data.getData().getPage(), data.getData().getLimit()); + List list = service.getDetailList(data.getData()); + PageInfo pageInfo = new PageInfo<>(list); + return ServerResponse.createSuccessPage(pageInfo, data.getData().getPage(), data.getData().getLimit()); + } + + /** + * 查询试验模板数据、基础数据 + * @param data + * @return ServerResponse + * @author cwchen + * @date 2024/7/20 14:12 + */ + @PostMapping(value = "getTestBasicInfo") + @DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理 + public ServerResponse getTestBasicInfo(EncryptedReq data) { + return service.getTestBasicInfo(data.getData()); + } +} diff --git a/src/main/java/com/bonus/aqgqj/basis/dao/ExperimentalMapper.java b/src/main/java/com/bonus/aqgqj/basis/dao/ExperimentalMapper.java new file mode 100644 index 0000000..47cf11c --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/dao/ExperimentalMapper.java @@ -0,0 +1,48 @@ +package com.bonus.aqgqj.basis.dao; + +import com.bonus.aqgqj.basis.entity.dto.ParamsDto; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo; +import com.bonus.aqgqj.basis.entity.vo.TestVo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @className:ExperimentalMapper + * @author:cwchen + * @date:2024-07-20-12:10 + * @version:1.0 + * @description:试验管理-mapper + */ +@Repository(value = "ExperimentalMapper") +public interface ExperimentalMapper { + /** + * 试验列表 + * + * @param dto + * @return List + * @author cwchen + * @date 2024/7/20 12:32 + */ + public List getList(ParamsDto dto); + + /** + * 试验详情列表 + * + * @param dto + * @return List + * @author cwchen + * @date 2024/7/20 13:27 + */ + List getDetailList(ParamsDto dto); + + /** + * 查询试验模板数据、基础数据 + * @param dto + * @return TestVo + * @author cwchen + * @date 2024/7/20 14:23 + */ + TestVo getTestBasicInfo(ParamsDto dto); +} diff --git a/src/main/java/com/bonus/aqgqj/basis/entity/dto/ParamsDto.java b/src/main/java/com/bonus/aqgqj/basis/entity/dto/ParamsDto.java index 6a5d622..5cf672e 100644 --- a/src/main/java/com/bonus/aqgqj/basis/entity/dto/ParamsDto.java +++ b/src/main/java/com/bonus/aqgqj/basis/entity/dto/ParamsDto.java @@ -21,4 +21,20 @@ public class ParamsDto extends PageEntity { * 设备类型 */ private String devTypeCode; + + /** + * 收样人 + */ + private String sampleUserName; + + /** + * 收样时间 + */ + private String sampleDate; + + /** + * 关键字 + */ + private String keyWord; + } diff --git a/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalDetailVo.java b/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalDetailVo.java new file mode 100644 index 0000000..2caf44a --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalDetailVo.java @@ -0,0 +1,68 @@ +package com.bonus.aqgqj.basis.entity.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @className:ExperimentalVo + * @author:cwchen + * @date:2024-07-20-12:19 + * @version:1.0 + * @description:试验详情-vo + */ +@Data +public class ExperimentalDetailVo { + + /** + * 收样信息表id + */ + private Long sampleId; + /** + * 样品类型 + */ + private String devTypeName; + /** + * 样品类型编码 + */ + private String devTypeCode; + /** + * 规格型号 + */ + private String devModule; + /** + * 样品数量 + */ + private Integer sampleQuantity = 0; + + /** + * 样品List + */ + private List sampleList; + + /** + * 驳回原因 + */ + private String causeOfRejection; + + /** + * 状态 + */ + private String status; + + /** + * 样品 + */ + @Data + public static class Sample { + /** + * 设备编号 + */ + private String devCode; + /** + * 试验结果 + */ + private String testResult; + } + +} diff --git a/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalVo.java b/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalVo.java new file mode 100644 index 0000000..8f5f6a6 --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperimentalVo.java @@ -0,0 +1,65 @@ +package com.bonus.aqgqj.basis.entity.vo; + +import lombok.Data; + +/** + * @className:ExperimentalVo + * @author:cwchen + * @date:2024-07-20-12:19 + * @version:1.0 + * @description:试验管理-vo + */ +@Data +public class ExperimentalVo { + + /** + * id + */ + private Long id; + /** + * 送样单位 + */ + private String customName; + /** + * 送样时间 + */ + private String sampleTime; + /** + * 送样设备 + */ + private String sampleDev; + /** + * 送样数量 + */ + private Integer customNum; + /** + * 收样人 + */ + private String sampleUserName; + /** + * 收样时间 + */ + private String sampleDate; + /** + * 派工人 + */ + private String dispatchUserName; + ; + /** + * 试验班组 + */ + private String teamName; + /** + * 审核状态 0 待审核 1审核通过 2审核不通过 + */ + private String audtiStatus; + + /** + * 流程状态 0.待试验 1.待审阅 2.待审核 3.待审批 4.试验结束 5.待重新审阅 + */ + private String processStatus; + /** + * 备注 + */ + private String remarks; +} diff --git a/src/main/java/com/bonus/aqgqj/basis/entity/vo/TestVo.java b/src/main/java/com/bonus/aqgqj/basis/entity/vo/TestVo.java new file mode 100644 index 0000000..fede4be --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/entity/vo/TestVo.java @@ -0,0 +1,162 @@ +package com.bonus.aqgqj.basis.entity.vo; + +import com.bonus.aqgqj.utils.UserUtil; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.util.Date; +import java.util.List; + +/** + * @className:TestVo + * @author:cwchen + * @date:2024-07-20-14:15 + * @version:1.0 + * @description:试验-vo + */ +@Data +public class TestVo { + + /** + * id + */ + private Long id; + + /** + * 试验标准ID + */ + private Long configId; + + /** + * 收样日期 + */ + private String sampleDate; + /** + * 送检单位ID + */ + private Long submit_unit; + /** + * 送检单位名称 + */ + private String customName; + + /** + * 试验日期 + */ + private String experTime; + /** + * 下次试验日期 + */ + private String nextExperTime; + /** + * 设备类型编码 + */ + @NotBlank(message = "设备类型编码不能为空", groups = {Query.class}) + @Length(max = 32, message = "设备类型字符长度不能超过32", groups = {Query.class}) + private String devTypeCode; + /** + * 设备类型名称 + */ + @NotBlank(message = "设备类型名称不能为空", groups = {Query.class}) + @Length(max = 64, message = "设备类型名称字符长度不能超过64", groups = {Query.class}) + private String devTypeName; + /** + * 设备规格型号 + */ + @NotBlank(message = "设备规格型号不能为空", groups = {Query.class}) + @Length(max = 128, message = "设备规格型号字符长度不能超过128", groups = {Query.class}) + private String devModule; + /** + * 实验地点编码 + */ + private String experLocalCode; + /** + * 实验地点 + */ + @NotBlank(message = "实验地点不能为空", groups = {Query.class}) + @Length(max = 128, message = "实验地点字符长度不能超过128", groups = {Query.class}) + private String experLocal; + /** + * 删除状态 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Integer delFlag = 0; + /** + * 创建人 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Long createUser = UserUtil.getLoginUser().getId(); + /** + * 创建时间 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime = new Date(); + /** + * 修改人 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Long updateUser = UserUtil.getLoginUser().getId(); + /** + * 修改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Date updateTime = new Date(); + + /** + * 试验标准 + */ + @NotBlank(message = "试验标准不能为空", groups = {Query.class}) + @Length(max = 256, message = "试验标准字符长度不能超过256", groups = {Query.class}) + private String experStand; + /** + * 试验结论 + */ + @NotBlank(message = "试验结论不能为空", groups = {Query.class}) + @Length(max = 256, message = "试验结论字符长度不能超过256", groups = {Query.class}) + private String experConclu; + + /** + * 备注 + */ + @NotBlank(message = "备注不能为空", groups = {Query.class}) + @Length(max = 256, message = "备注字符长度不能超过256", groups = {Query.class}) + private String remarsk; + + /** + * 主要试验设备、设备、试验依据、试验项等数据 + */ + @NotBlank(message = "参数不能为空", groups = {Query.class}) + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String paramsData; + + /** + * 试验依据 + */ + private List basisVos; + + /** + * 试验设备 + */ + private List deviceVos; + + /** + * 试验主要设备 + */ + private List mainDeviceVos; + + /** + * 试验项 + */ + private List configItemsVos; + + /** + * 查询条件限制 + */ + public interface Query { + } +} diff --git a/src/main/java/com/bonus/aqgqj/basis/service/ExperimentalService.java b/src/main/java/com/bonus/aqgqj/basis/service/ExperimentalService.java new file mode 100644 index 0000000..17462a6 --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/service/ExperimentalService.java @@ -0,0 +1,46 @@ +package com.bonus.aqgqj.basis.service; + +import com.bonus.aqgqj.basis.entity.dto.ParamsDto; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo; +import com.bonus.aqgqj.utils.ServerResponse; + +import java.util.List; + +/** + * @className:ExperimentalService + * @author:cwchen + * @date:2024-07-20-12:09 + * @version:1.0 + * @description:试验管理-service + */ +public interface ExperimentalService { + /** + * 试验列表 + * + * @param data + * @return List + * @author cwchen + * @date 2024/7/20 12:31 + */ + List getList(ParamsDto data); + + /** + * 试验详情列表 + * + * @param data + * @return List + * @author cwchen + * @date 2024/7/20 13:26 + */ + List getDetailList(ParamsDto data); + + /** + * 查询试验模板数据、基础数据 + * @param data + * @return ServerResponse + * @author cwchen + * @date 2024/7/20 14:12 + */ + ServerResponse getTestBasicInfo(ParamsDto data); +} diff --git a/src/main/java/com/bonus/aqgqj/basis/service/impl/ExperimentalServiceImpl.java b/src/main/java/com/bonus/aqgqj/basis/service/impl/ExperimentalServiceImpl.java new file mode 100644 index 0000000..da54bc9 --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/service/impl/ExperimentalServiceImpl.java @@ -0,0 +1,89 @@ +package com.bonus.aqgqj.basis.service.impl; + +import com.bonus.aqgqj.basis.dao.ExperimentStandardMapper; +import com.bonus.aqgqj.basis.dao.ExperimentalMapper; +import com.bonus.aqgqj.basis.entity.dto.ParamsDto; +import com.bonus.aqgqj.basis.entity.vo.*; +import com.bonus.aqgqj.basis.service.ExperimentalService; +import com.bonus.aqgqj.utils.ServerResponse; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * @className:ExperimentalServiceImpl + * @author:cwchen + * @date:2024-07-20-12:09 + * @version:1.0 + * @description:试验管理-serviceImpl + */ +@Service(value = "ExperimentalService") +@Slf4j +public class ExperimentalServiceImpl implements ExperimentalService { + + @Resource(name = "ExperimentalMapper") + private ExperimentalMapper mapper; + + @Resource(name = "ExperimentStandardMapper") + private ExperimentStandardMapper standardMapper; + + @Override + public List getList(ParamsDto dto) { + List list = new ArrayList<>(); + try { + list = mapper.getList(dto); + } catch (Exception e) { + log.error(e.toString(), e); + } + return list; + } + + @Override + public List getDetailList(ParamsDto dto) { + List list = new ArrayList<>(); + try { + list = mapper.getDetailList(dto); + if (CollectionUtils.isNotEmpty(list)) { + for (ExperimentalDetailVo detailVo : list) { + // 样品试验结果、样品数量 + List sampleList = new ArrayList<>(); + detailVo.setSampleList(sampleList); + detailVo.setSampleQuantity(sampleList.size()); + } + } + } catch (Exception e) { + log.error(e.toString(), e); + } + return list; + } + + @Override + public ServerResponse getTestBasicInfo(ParamsDto dto) { + TestVo vo = new TestVo(); + try { + // 查询收样基本信息 + vo = mapper.getTestBasicInfo(dto); + // 查询试验配置依据、试验设备、试验主要设备、试验项信息 + List basisVos= standardMapper.getExperBasis(vo.getConfigId()); + List deviceVos = standardMapper.getConfigDev(vo.getConfigId()); + List mainDevVos = standardMapper.getConfigMainDev(vo.getConfigId()); + List configItemsVos = standardMapper.getConfigItems(vo.getConfigId()); + for (ConfigItemsVo configItemsVo : configItemsVos) { + List configItemVos = standardMapper.getConfiItem(configItemsVo.getId()); + configItemsVo.setItemList(configItemVos); + } + vo.setBasisVos(basisVos); + vo.setDeviceVos(deviceVos); + vo.setMainDeviceVos(mainDevVos); + vo.setConfigItemsVos(configItemsVos); + } catch (Exception e) { + log.error(e.toString(), e); + } + return ServerResponse.createSuccess(vo); + } +} diff --git a/src/main/resources/mappers/basis/ExperimentStandardMapper.xml b/src/main/resources/mappers/basis/ExperimentStandardMapper.xml index 582dce3..454c9f8 100644 --- a/src/main/resources/mappers/basis/ExperimentStandardMapper.xml +++ b/src/main/resources/mappers/basis/ExperimentStandardMapper.xml @@ -226,7 +226,7 @@ + SELECT ts.id, + tc.custom_name AS customName, + DATE_FORMAT(ts.sample_time, '%Y-%m-%d') AS sampleTime, + IFNULL(tsd.num,0) AS customNum, + tsd.sampleDev, + su.user_name AS sampleUserName, + su2.user_name AS dispatchUserName, + DATE_FORMAT(ts.sample_date, '%Y-%m-%d') AS sampleDate, + tt.team_name AS teamName, + ts.audti_status AS audtiStatus, + ts.process_status AS processStatus, + ts.remarks + FROM tb_sample ts + LEFT JOIN tb_custom tc ON ts.custom_id = tc.id + LEFT JOIN sys_user su ON ts.create_user = su.id AND su.del_flag = 0 + LEFT JOIN sys_user su2 ON ts.update_user = su2.id AND su2.del_flag = 0 + LEFT JOIN tb_team tt ON ts.team_id = tt.id AND tt.del_flag = 0 + LEFT JOIN ( + SELECT sample_id,COUNT(sample_id) AS num,GROUP_CONCAT(DISTINCT dev_type_name) AS sampleDev,GROUP_CONCAT(DISTINCT dev_type_code) AS sampleDevCode + FROM tb_sample_device + WHERE del_falg = 0 + GROUP BY sample_id + ) tsd ON tsd.sample_id = ts.id + WHERE ts.del_flag = 0 AND process_status IN (0,5) + + AND ( + INSTR(tt.team_name,#{keyWord}) > 0 OR + INSTR(su2.user_name,#{keyWord}) > 0 + ) + + + AND INSTR(su.user_name,#{sampleUserName}) > 0 + + + AND DATE_FORMAT(ts.sample_date, '%Y-%m-%d') = #{sampleDate} + + + AND INSTR(tsd.sampleDevCode,#{devTypeCode}) + + ORDER BY dispatch_time ASC + + + + + +