试验管理
This commit is contained in:
parent
dce789bbb0
commit
7630ed04c6
|
|
@ -2,10 +2,12 @@ package com.bonus.aqgqj.basis.dao;
|
||||||
|
|
||||||
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
|
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
|
||||||
import com.bonus.aqgqj.basis.entity.vo.*;
|
import com.bonus.aqgqj.basis.entity.vo.*;
|
||||||
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className:ExperimentalMapper
|
* @className:ExperimentalMapper
|
||||||
|
|
@ -312,10 +314,31 @@ public interface ExperimentalMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除试验项内容
|
* 删除试验项内容
|
||||||
|
*
|
||||||
* @param experItemsIds
|
* @param experItemsIds
|
||||||
* @return void
|
* @return void
|
||||||
* @author cwchen
|
* @author cwchen
|
||||||
* @date 2024/7/22 0:36
|
* @date 2024/7/22 0:36
|
||||||
*/
|
*/
|
||||||
void delExperItem(List<Long> experItemsIds);
|
void delExperItem(List<Long> experItemsIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试验设备数量
|
||||||
|
*
|
||||||
|
* @param experId
|
||||||
|
* @return List<Sample>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/7/22 10:58
|
||||||
|
*/
|
||||||
|
@MapKey("id")
|
||||||
|
List<Map<String, String>> getExperDevItemsNum(Long experId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否处于审核流程中的数据
|
||||||
|
* @param id
|
||||||
|
* @return int
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/7/22 14:13
|
||||||
|
*/
|
||||||
|
int isCheck(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class ExperDevVo {
|
||||||
private String devData;
|
private String devData;
|
||||||
/**额外超出的金额默认值0*/
|
/**额外超出的金额默认值0*/
|
||||||
@NotBlank(message = "金额不能为空", groups = {Query.class})
|
@NotBlank(message = "金额不能为空", groups = {Query.class})
|
||||||
@Pattern(regexp = "(0|\\d{1,8}(?:\\.\\d{1,2})?|\\d{9}(?:\\.\\d{0,2})?)", message = "金额格式不正确(0-100000000)", groups = {Query.class})
|
@Pattern(regexp = "(0|\\d{1,8}(?:\\.\\d{1,2})?|\\d{9}(?:\\.\\d{0,2})?)", message = "金额格式不正确(范围0-100000000并且最多保留两位小数)", groups = {Query.class})
|
||||||
private String amount;
|
private String amount;
|
||||||
/**备注*/
|
/**备注*/
|
||||||
@NotBlank(message = "备注不能为空", groups = {Query.class})
|
@NotBlank(message = "备注不能为空", groups = {Query.class})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.aqgqj.basis.entity.vo;
|
package com.bonus.aqgqj.basis.entity.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.apache.ibatis.type.Alias;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -18,6 +20,11 @@ public class ExperimentalDetailVo {
|
||||||
* 收样信息表id
|
* 收样信息表id
|
||||||
*/
|
*/
|
||||||
private Long sampleId;
|
private Long sampleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试验ID
|
||||||
|
*/
|
||||||
|
private Long experId;
|
||||||
/**
|
/**
|
||||||
* 样品类型
|
* 样品类型
|
||||||
*/
|
*/
|
||||||
|
|
@ -29,7 +36,13 @@ public class ExperimentalDetailVo {
|
||||||
/**
|
/**
|
||||||
* 规格型号
|
* 规格型号
|
||||||
*/
|
*/
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String devModule;
|
private String devModule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 送样数量
|
||||||
|
*/
|
||||||
|
private Integer sampleNum = 0;
|
||||||
/**
|
/**
|
||||||
* 样品数量
|
* 样品数量
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import com.bonus.aqgqj.webResult.Constants;
|
||||||
import com.bonus.aqgqj.webResult.HttpStatus;
|
import com.bonus.aqgqj.webResult.HttpStatus;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -24,6 +23,7 @@ import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className:ExperimentalServiceImpl
|
* @className:ExperimentalServiceImpl
|
||||||
|
|
@ -63,8 +63,23 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
||||||
list = mapper.getDetailList(dto);
|
list = mapper.getDetailList(dto);
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
for (ExperimentalDetailVo detailVo : list) {
|
for (ExperimentalDetailVo detailVo : list) {
|
||||||
// 样品试验结果、样品数量
|
// 样品试验结果、样品数量、送样总数
|
||||||
List<ExperimentalDetailVo.Sample> sampleList = new ArrayList<>();
|
List<ExperimentalDetailVo.Sample> sampleList = new ArrayList<>();
|
||||||
|
if(detailVo.getExperId()!=null){
|
||||||
|
List<Map<String,String>> mapList = mapper.getExperDevItemsNum(detailVo.getExperId());
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.addAll(mapList);
|
||||||
|
sampleList = jsonArray.toJavaList(ExperimentalDetailVo.Sample.class);
|
||||||
|
for (ExperimentalDetailVo.Sample sample : sampleList) {
|
||||||
|
if(sample.getTestResult().contains(Constants.ERROR_RESULT) ||
|
||||||
|
sample.getTestResult().contains(Constants.ERROR_RESULT2)
|
||||||
|
){
|
||||||
|
sample.setTestResult(Constants.ERROR_RESULT);
|
||||||
|
}else{
|
||||||
|
sample.setTestResult(Constants.SUCCESS_RESULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
detailVo.setSampleList(sampleList);
|
detailVo.setSampleList(sampleList);
|
||||||
detailVo.setSampleQuantity(sampleList.size());
|
detailVo.setSampleQuantity(sampleList.size());
|
||||||
}
|
}
|
||||||
|
|
@ -175,6 +190,11 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
||||||
if(vo.getId() == null){
|
if(vo.getId() == null){
|
||||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数不完整");
|
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数不完整");
|
||||||
}
|
}
|
||||||
|
// 处于审核流程中的数据无法进行修改
|
||||||
|
int isCheck = mapper.isCheck(vo.getId());
|
||||||
|
if(isCheck > 0){
|
||||||
|
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "处于审核流程中的数据无法进行修改");
|
||||||
|
}
|
||||||
// 整体数据校验数据
|
// 整体数据校验数据
|
||||||
String validResult = validatorsUtils.valid(vo, TestVo.Query.class);
|
String validResult = validatorsUtils.valid(vo, TestVo.Query.class);
|
||||||
if (StringUtils.isNotBlank(validResult)) {
|
if (StringUtils.isNotBlank(validResult)) {
|
||||||
|
|
@ -258,6 +278,9 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
||||||
public ServerResponse viewTestData(ParamsDto dto) {
|
public ServerResponse viewTestData(ParamsDto dto) {
|
||||||
TestVo testVo = new TestVo();
|
TestVo testVo = new TestVo();
|
||||||
try {
|
try {
|
||||||
|
if(dto.getId() == null){
|
||||||
|
return ServerResponse.createByErrorMsg(HttpStatus.ERROR,"请求参数不完整");
|
||||||
|
}
|
||||||
// 试验数据详情
|
// 试验数据详情
|
||||||
testVo = mapper.viewTestData(dto);
|
testVo = mapper.viewTestData(dto);
|
||||||
//试验依据信息、试验设备、试验项、试验项目信息、试验样品设备
|
//试验依据信息、试验设备、试验项、试验项目信息、试验样品设备
|
||||||
|
|
|
||||||
|
|
@ -140,5 +140,9 @@ public class Constants
|
||||||
public static final String ERROR_6 = "试验不能为空";
|
public static final String ERROR_6 = "试验不能为空";
|
||||||
public static final String FORMAT_STR = "yyyy-MM-dd";
|
public static final String FORMAT_STR = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
public static final String ERROR_RESULT = "不合格";
|
||||||
|
public static final String ERROR_RESULT2 = "不通过";
|
||||||
|
public static final String SUCCESS_RESULT = "合格";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -268,15 +268,29 @@
|
||||||
</select>
|
</select>
|
||||||
<!--试验详情列表-->
|
<!--试验详情列表-->
|
||||||
<select id="getDetailList" resultType="com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo">
|
<select id="getDetailList" resultType="com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo">
|
||||||
SELECT ANY_VALUE(sample_id) AS sampleId,
|
SELECT ANY_VALUE(tsd.sample_id) AS sampleId,
|
||||||
any_value(dev_type_name) AS devTypeName,
|
ANY_VALUE(tsd.dev_type_name) AS devTypeName,
|
||||||
dev_type_code AS devTypeCode
|
tsd.dev_type_code AS devTypeCode,
|
||||||
FROM tb_sample_device
|
ANY_VALUE(te.id) AS experId,
|
||||||
WHERE sample_id = #{id} AND del_falg = 0
|
COUNT(tsd.dev_type_code) AS sampleNum,
|
||||||
|
ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_remakr)) AS causeOfRejection,
|
||||||
|
CASE WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 0 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待提交'
|
||||||
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 1 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待审阅'
|
||||||
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 1 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 2 THEN '审阅不通过'
|
||||||
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 2 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待审核'
|
||||||
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 2 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 3 THEN '审核不通过'
|
||||||
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 3 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待审批'
|
||||||
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 3 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 4 THEN '审批不通过'
|
||||||
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 4 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 1 THEN '试验完成'
|
||||||
|
ELSE '待试验'
|
||||||
|
END AS status
|
||||||
|
FROM tb_sample_device tsd
|
||||||
|
LEFT JOIN tb_exper te ON tsd.sample_id = te.sample_id AND tsd.dev_type_code = te.dev_type_code AND te.del_flag = 0
|
||||||
|
WHERE tsd.sample_id = #{id} AND tsd.del_falg = 0
|
||||||
<if test="devTypeCode != null and devTypeCode!=''">
|
<if test="devTypeCode != null and devTypeCode!=''">
|
||||||
AND INSTR(dev_type_code,#{devTypeCode})
|
AND INSTR(tsd.dev_type_code,#{devTypeCode})
|
||||||
</if>
|
</if>
|
||||||
GROUP BY dev_type_code
|
GROUP BY tsd.dev_type_code
|
||||||
</select>
|
</select>
|
||||||
<!--查询试验模板数据、基础数据-->
|
<!--查询试验模板数据、基础数据-->
|
||||||
<select id="getTestBasicInfo" resultType="com.bonus.aqgqj.basis.entity.vo.TestVo">
|
<select id="getTestBasicInfo" resultType="com.bonus.aqgqj.basis.entity.vo.TestVo">
|
||||||
|
|
@ -394,6 +408,7 @@
|
||||||
remarks
|
remarks
|
||||||
FROM tb_exper_dev
|
FROM tb_exper_dev
|
||||||
WHERE exper_id = #{id}
|
WHERE exper_id = #{id}
|
||||||
|
ORDER BY id
|
||||||
</select>
|
</select>
|
||||||
<!--获取试验样品设备ID-->
|
<!--获取试验样品设备ID-->
|
||||||
<select id="getExperDevIds" resultType="java.lang.Long">
|
<select id="getExperDevIds" resultType="java.lang.Long">
|
||||||
|
|
@ -410,4 +425,22 @@
|
||||||
<select id="getExperItemsIds" resultType="java.lang.Long">
|
<select id="getExperItemsIds" resultType="java.lang.Long">
|
||||||
SELECT id FROM tb_exper_items WHERE exper_id = #{id}
|
SELECT id FROM tb_exper_items WHERE exper_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<!--查询试验设备数量-->
|
||||||
|
<select id="getExperDevItemsNum" resultType="java.util.Map">
|
||||||
|
SELECT dev_code AS devCode,
|
||||||
|
dev_data AS testResult
|
||||||
|
FROM tb_exper_dev
|
||||||
|
WHERE exper_id = #{experId}
|
||||||
|
</select>
|
||||||
|
<!--判断是否处于审核流程中的数据-->
|
||||||
|
<select id="isCheck" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM tb_exper
|
||||||
|
WHERE id = #{id} AND del_flag = 0 AND (
|
||||||
|
(status = 0 AND audit_status = 0) OR
|
||||||
|
(status = 1 AND audit_status = 2) OR
|
||||||
|
(status = 2 AND audit_status = 3) OR
|
||||||
|
(status = 3 AND audit_status = 4)
|
||||||
|
)
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue