app试验管理
This commit is contained in:
parent
dc4e603a41
commit
b0bea87aeb
|
|
@ -0,0 +1,113 @@
|
|||
package com.bonus.aqgqj.app.controller;
|
||||
|
||||
import com.bonus.aqgqj.annotation.DecryptAndVerify;
|
||||
import com.bonus.aqgqj.annotation.LogAnnotation;
|
||||
import com.bonus.aqgqj.app.entity.ExperimentalAppVo;
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.app.service.ExperimentalAppService;
|
||||
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo;
|
||||
import com.bonus.aqgqj.basis.entity.vo.TestVo;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @description app试验管理
|
||||
* @author hay
|
||||
* @date 2024/8/5 16:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/experimental/")
|
||||
@Slf4j
|
||||
public class ExperimentalAppController {
|
||||
|
||||
@Resource(name = "ExperimentalAppService")
|
||||
private ExperimentalAppService service;
|
||||
|
||||
@PostMapping(value = "getList")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "app试验管理", operation = "查询列表", operDesc = "业务级事件", operType = "查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimental:query')" )
|
||||
public ServerResponse getList(EncryptedReq<ParamsDto> data) {
|
||||
try {
|
||||
List<ExperimentalAppVo> list = service.getList(data.getData());
|
||||
return ServerResponse.createSuccess(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping(value = "getDetailList")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "查询试验详情列表", operDesc = "业务级事件", operType = "查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:query')")
|
||||
public ServerResponse getDetailList(EncryptedReq<ParamsDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
List<ExperimentalDetailVo> list = service.getDetailList(data.getData());
|
||||
PageInfo<ExperimentalDetailVo> 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<ParamsDto> data) {
|
||||
return service.getTestBasicInfo(data.getData());
|
||||
}
|
||||
|
||||
@PostMapping(value = "addTestData")
|
||||
@DecryptAndVerify(decryptedClass = TestVo.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "新增试验数据", operDesc = "业务级事件", operType = "新增")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:add')")
|
||||
public ServerResponse addTestData(EncryptedReq<TestVo> data) {
|
||||
return service.addTestData(data.getData());
|
||||
}
|
||||
|
||||
@PostMapping(value = "editTestData")
|
||||
@DecryptAndVerify(decryptedClass = TestVo.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "修改试验数据", operDesc = "业务级事件", operType = "修改")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:edit')")
|
||||
public ServerResponse editTestData(EncryptedReq<TestVo> data) {
|
||||
return service.editTestData(data.getData());
|
||||
}
|
||||
|
||||
@PostMapping(value = "delTestData")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "删除试验数据", operDesc = "业务级事件", operType = "删除")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:del')")
|
||||
public ServerResponse delTestData(EncryptedReq<ParamsDto> data) {
|
||||
return service.delTestData(data.getData());
|
||||
}
|
||||
|
||||
@PostMapping(value = "viewTestData")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
public ServerResponse viewTestData(EncryptedReq<ParamsDto> data) {
|
||||
return service.viewTestData(data.getData());
|
||||
}
|
||||
|
||||
@PostMapping(value = "commitCheckTestData")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验管理", operation = "提交审查数据", operDesc = "业务级事件", operType = "提交审查")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:commitCheck')")
|
||||
public ServerResponse commitCheckTestData(EncryptedReq<ParamsDto> data) {
|
||||
return service.commitCheckTestData(data.getData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,409 @@
|
|||
package com.bonus.aqgqj.app.dao;
|
||||
|
||||
import com.bonus.aqgqj.app.entity.ExperimentalAppVo;
|
||||
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
|
||||
import com.bonus.aqgqj.basis.entity.vo.*;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description app试验管理
|
||||
* @author hay
|
||||
* @date 2024/8/5 16:34
|
||||
*/
|
||||
@Repository(value = "ExperimentalAppMapper")
|
||||
public interface ExperimentalAppMapper {
|
||||
/**
|
||||
* 试验列表
|
||||
*
|
||||
* @param dto
|
||||
* @return List<ExperimentalAppVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 12:32
|
||||
*/
|
||||
public List<ExperimentalAppVo> getList(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 试验详情列表
|
||||
*
|
||||
* @param dto
|
||||
* @return List<ExperimentalDetailVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 13:27
|
||||
*/
|
||||
List<ExperimentalDetailVo> getDetailList(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 查询试验模板数据、基础数据
|
||||
*
|
||||
* @param dto
|
||||
* @return TestVo
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 14:23
|
||||
*/
|
||||
TestVo getTestBasicInfo(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 添加试验信息
|
||||
*
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 16:13
|
||||
*/
|
||||
void addExper(TestVo vo);
|
||||
|
||||
/**
|
||||
* 添加试验依据信息数据
|
||||
*
|
||||
* @param basisVos
|
||||
* @param experId
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 17:05
|
||||
*/
|
||||
void addConfigBasis(@Param("list") List<ExperBasisVo> basisVos, @Param("experId") Long experId);
|
||||
|
||||
/**
|
||||
* 查询收样设备-根据设备类型
|
||||
*
|
||||
* @param dto
|
||||
* @return List<SampleDeviceVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 17:01
|
||||
*/
|
||||
List<SampleDeviceVo> getSampleDeviceVos(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 添加试验项信息
|
||||
*
|
||||
* @param configItemsVo
|
||||
* @param experId
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 17:21
|
||||
*/
|
||||
void addExperItems(@Param("params") ConfigItemsVo configItemsVo, @Param("experId") Long experId);
|
||||
|
||||
/**
|
||||
* 添加试验项内容
|
||||
*
|
||||
* @param configItemVo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 17:28
|
||||
*/
|
||||
void addExperItem(@Param("params") ConfigItemVo configItemVo, @Param("experId") Long experId);
|
||||
|
||||
/**
|
||||
* 添加试验样品设备表
|
||||
*
|
||||
* @param experDevVo
|
||||
* @param experId
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 17:58
|
||||
*/
|
||||
void addExperDev(@Param("params") ExperDevVo experDevVo, @Param("experId") Long experId);
|
||||
|
||||
/**
|
||||
* 添加设备试验项信息
|
||||
*
|
||||
* @param experDevItemsVo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 18:19
|
||||
*/
|
||||
void addExperDevItems(ExperDevItemsVo experDevItemsVo);
|
||||
|
||||
/**
|
||||
* 添加设备试验项数据
|
||||
*
|
||||
* @param experDevItemVos
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 19:48
|
||||
*/
|
||||
void addExperDevItem(List<ExperDevItemVo> experDevItemVos);
|
||||
|
||||
/**
|
||||
* 试验数据详情
|
||||
*
|
||||
* @param dto
|
||||
* @return TestVo
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 22:53
|
||||
*/
|
||||
TestVo viewTestData(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 添加试验设备数据
|
||||
*
|
||||
* @param deviceVos
|
||||
* @param experId
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 23:12
|
||||
*/
|
||||
void addExperConfigDev(@Param("list") List<ConfigDevVo> deviceVos, @Param("experId") Long experId);
|
||||
|
||||
/**
|
||||
* 试验依据信息
|
||||
*
|
||||
* @param dto
|
||||
* @return List<ExperBasisVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 23:19
|
||||
*/
|
||||
List<ExperBasisVo> getConfigBasis(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 试验设备信息
|
||||
*
|
||||
* @param dto
|
||||
* @return List<ConfigDevVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 23:22
|
||||
*/
|
||||
List<ConfigDevVo> getExperConfigDevs(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 试验项信息
|
||||
*
|
||||
* @param dto
|
||||
* @return List<ConfigItemsVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 23:27
|
||||
*/
|
||||
List<ConfigItemsVo> getExperItems(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 试验项内容信息
|
||||
*
|
||||
* @param id
|
||||
* @return List<ConfigItemVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 23:33
|
||||
*/
|
||||
List<ConfigItemVo> getExperItem(Long id);
|
||||
|
||||
/**
|
||||
* 试验样品设备
|
||||
*
|
||||
* @param dto
|
||||
* @return List<ExperDevVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 23:37
|
||||
*/
|
||||
List<ExperDevVo> getExperDev(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 修改试验信息数据
|
||||
*
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:02
|
||||
*/
|
||||
void updateExper(TestVo vo);
|
||||
|
||||
/**
|
||||
* 获取试验样品设备ID
|
||||
*
|
||||
* @param id
|
||||
* @return List<Long>
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:18
|
||||
*/
|
||||
List<Long> getExperDevIds(Long id);
|
||||
|
||||
/**
|
||||
* 获取设备试验项信息ID
|
||||
*
|
||||
* @param list
|
||||
* @return List<Long>
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:18
|
||||
*/
|
||||
List<Long> getExperDevItems(List<Long> list);
|
||||
|
||||
/**
|
||||
* 删除试验依据
|
||||
*
|
||||
* @param id
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:24
|
||||
*/
|
||||
void delConfigBasis(Long id);
|
||||
|
||||
/**
|
||||
* 删除试验设备
|
||||
*
|
||||
* @param id
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:24
|
||||
*/
|
||||
void delExperConfigDev(Long id);
|
||||
|
||||
/**
|
||||
* 删除试验样品设备
|
||||
*
|
||||
* @param id
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:24
|
||||
*/
|
||||
void delExperDev(Long id);
|
||||
|
||||
/**
|
||||
* 删除设备试验项信息
|
||||
*
|
||||
* @param list
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:24
|
||||
*/
|
||||
void delExperDevItems(List<Long> list);
|
||||
|
||||
/**
|
||||
* 删除设备试验项数据
|
||||
*
|
||||
* @param list
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:24
|
||||
*/
|
||||
void delExperDevItem(List<Long> list);
|
||||
|
||||
/**
|
||||
* 删除试验信息
|
||||
*
|
||||
* @param id
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:32
|
||||
*/
|
||||
void delExper(Long id);
|
||||
|
||||
/**
|
||||
* 查询试验项ID
|
||||
*
|
||||
* @param id
|
||||
* @return List<Long>
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:34
|
||||
*/
|
||||
List<Long> getExperItemsIds(Long id);
|
||||
|
||||
/**
|
||||
* 删除试验项
|
||||
*
|
||||
* @param id
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:36
|
||||
*/
|
||||
void delExperItems(Long id);
|
||||
|
||||
/**
|
||||
* 删除试验项内容
|
||||
*
|
||||
* @param experItemsIds
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 0:36
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 判断提交数据中是否存在流程数据或者存在待试验项
|
||||
*
|
||||
* @param list
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 15:24
|
||||
*/
|
||||
int isNotEditData(List<Long> list);
|
||||
|
||||
/**
|
||||
* 更新收样表中的状态为待审阅
|
||||
*
|
||||
* @param list
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 15:33
|
||||
*/
|
||||
void updateSampleStatus(List<Long> list);
|
||||
|
||||
/**
|
||||
* 更新试验表中数据为待审阅
|
||||
*
|
||||
* @param list
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 15:33
|
||||
*/
|
||||
void updateExperStatus(List<Long> list);
|
||||
|
||||
/**
|
||||
* 获取收样中的试验项是否全部填写
|
||||
*
|
||||
* @param sampleId
|
||||
* @return List<Integer>
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 16:09
|
||||
*/
|
||||
List<Integer> isAllExper(Long sampleId);
|
||||
|
||||
/**
|
||||
* 更新收样表中的状态为待提交
|
||||
*
|
||||
* @param id
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 16:24
|
||||
*/
|
||||
void editSampleStatus(Long id);
|
||||
|
||||
/**
|
||||
* 获取记录编号
|
||||
* @param testVo
|
||||
* @return List<Integer>
|
||||
* @author cwchen
|
||||
* @date 2024/7/28 15:52
|
||||
*/
|
||||
List<Long> getRecordNum(TestVo testVo);
|
||||
|
||||
/**
|
||||
* 更新总结
|
||||
* @param vo
|
||||
*/
|
||||
void updateExperMony(TestVo vo);
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.aqgqj.app.entity;
|
||||
|
||||
import com.bonus.aqgqj.utils.UserUtil;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @className:ExperimentalVo
|
||||
* @author:cwchen
|
||||
* @date:2024-07-20-12:19
|
||||
* @version:1.0
|
||||
* @description:试验管理-vo
|
||||
*/
|
||||
@Data
|
||||
public class ExperimentalAppVo {
|
||||
|
||||
/**
|
||||
* 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 dispatchTime;
|
||||
|
||||
/**
|
||||
* 试验班组
|
||||
*/
|
||||
private String teamName;
|
||||
|
||||
private String audtiStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 批次编号
|
||||
*/
|
||||
private String batchCode;
|
||||
|
||||
|
||||
/**
|
||||
* 试验时间
|
||||
*/
|
||||
private String experTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleCode = UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getRoleCode() : "";
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.bonus.aqgqj.app.service;
|
||||
|
||||
import com.bonus.aqgqj.app.entity.ExperimentalAppVo;
|
||||
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo;
|
||||
import com.bonus.aqgqj.basis.entity.vo.TestVo;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description app试验管理
|
||||
* @author hay
|
||||
* @date 2024/8/5 16:33
|
||||
*/
|
||||
public interface ExperimentalAppService {
|
||||
/**
|
||||
* 试验列表
|
||||
*
|
||||
* @param data
|
||||
* @return List<ExperimentalAppVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 12:31
|
||||
*/
|
||||
List<ExperimentalAppVo> getList(ParamsDto data);
|
||||
|
||||
/**
|
||||
* 试验详情列表
|
||||
*
|
||||
* @param data
|
||||
* @return List<ExperimentalDetailVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 13:26
|
||||
*/
|
||||
List<ExperimentalDetailVo> getDetailList(ParamsDto data);
|
||||
|
||||
/**
|
||||
* 查询试验模板数据、基础数据
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 14:12
|
||||
*/
|
||||
ServerResponse getTestBasicInfo(ParamsDto data);
|
||||
|
||||
/**
|
||||
* 新增试验数据
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 15:42
|
||||
*/
|
||||
ServerResponse addTestData(TestVo data);
|
||||
|
||||
/**
|
||||
* 修改试验数据
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 20:06
|
||||
*/
|
||||
ServerResponse editTestData(TestVo data);
|
||||
|
||||
/**
|
||||
* 删除试验数据
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 20:06
|
||||
*/
|
||||
ServerResponse delTestData(ParamsDto data);
|
||||
|
||||
/**
|
||||
* 试验数据详情
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 20:06
|
||||
*/
|
||||
ServerResponse viewTestData(ParamsDto data);
|
||||
|
||||
/**
|
||||
* 试验管理-提交审查
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2024/7/22 14:25
|
||||
*/
|
||||
ServerResponse commitCheckTestData(ParamsDto data);
|
||||
}
|
||||
|
|
@ -0,0 +1,621 @@
|
|||
package com.bonus.aqgqj.app.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.aqgqj.advice.ValidatorsUtils;
|
||||
import com.bonus.aqgqj.app.dao.ExperimentalAppMapper;
|
||||
import com.bonus.aqgqj.app.entity.ExperimentalAppVo;
|
||||
import com.bonus.aqgqj.app.service.ExperimentalAppService;
|
||||
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.DateTimeHelper;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
import com.bonus.aqgqj.utils.SystemUtils;
|
||||
import com.bonus.aqgqj.webResult.Constants;
|
||||
import com.bonus.aqgqj.webResult.HttpStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @description app试验管理
|
||||
* @author hay
|
||||
* @date 2024/8/5 16:34
|
||||
*/
|
||||
@Service(value = "ExperimentalAppService")
|
||||
@Slf4j
|
||||
public class ExperimentalAppServiceImpl implements ExperimentalAppService {
|
||||
|
||||
@Resource(name = "ExperimentalAppMapper")
|
||||
private ExperimentalAppMapper mapper;
|
||||
|
||||
@Resource(name = "ExperimentStandardMapper")
|
||||
private ExperimentStandardMapper standardMapper;
|
||||
|
||||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
@Override
|
||||
public List<ExperimentalAppVo> getList(ParamsDto dto) {
|
||||
List<ExperimentalAppVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getList(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExperimentalDetailVo> getDetailList(ParamsDto dto) {
|
||||
List<ExperimentalDetailVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getDetailList(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (ExperimentalDetailVo detailVo : list) {
|
||||
// 样品试验结果、样品数量、送样总数
|
||||
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);
|
||||
}
|
||||
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 {
|
||||
if (dto.getId() == null || StringUtils.isEmpty(dto.getDevTypeCode())) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数完整");
|
||||
}
|
||||
// 查询收样基本信息
|
||||
vo = mapper.getTestBasicInfo(dto);
|
||||
if (vo.getConfigId() == null) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "未配置该设备类型的试验标准,请先配置");
|
||||
}
|
||||
// 查询收样设备、试验配置依据、试验主要设备、试验项信息
|
||||
List<SampleDeviceVo> sampleDeviceVos = mapper.getSampleDeviceVos(dto);
|
||||
List<ExperBasisVo> basisVos = standardMapper.getExperBasis(vo.getConfigId());
|
||||
List<ConfigMainDevVo> mainDevVos = standardMapper.getConfigMainDev(vo.getConfigId());
|
||||
List<ConfigItemsVo> configItemsVos = standardMapper.getConfigItems(vo.getConfigId());
|
||||
for (ConfigItemsVo configItemsVo : configItemsVos) {
|
||||
List<ConfigItemVo> configItemVos = standardMapper.getConfiItem(configItemsVo.getId());
|
||||
configItemsVo.setItemList(configItemVos);
|
||||
}
|
||||
vo.setSampleDeviceVos(sampleDeviceVos);
|
||||
vo.setBasisVos(basisVos);
|
||||
vo.setMainDeviceVos(mainDevVos);
|
||||
vo.setConfigItemsVos(configItemsVos);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createSuccess(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse addTestData(TestVo vo) {
|
||||
try {
|
||||
if (!SystemUtils.isExperimentalTeam()) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "非试验班组,无法添加试验数据");
|
||||
}
|
||||
// 整体数据校验数据
|
||||
String validResult = validatorsUtils.valid(vo, TestVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, validResult);
|
||||
}
|
||||
if (!validatorsDate(vo)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "下次试验日期不能早于试验日期");
|
||||
}
|
||||
String result = validatorsParams(vo.getParamsData());
|
||||
if (StringUtils.isNotBlank(result)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result);
|
||||
}
|
||||
TestVo testVo = handleConfigItem(vo);
|
||||
if (testVo == null) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数异常");
|
||||
}
|
||||
// 试验主要设备、试验依据、试验项校验
|
||||
String result2 = singleValidators(testVo);
|
||||
if (StringUtils.isNotBlank(result2)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result2);
|
||||
}
|
||||
BigDecimal allMony = new BigDecimal("0");
|
||||
// 添加试验信息数据
|
||||
mapper.addExper(vo);
|
||||
// 添加试验依据信息数据
|
||||
mapper.addConfigBasis(vo.getBasisVos(), vo.getId());
|
||||
for (int i = 0; i < vo.getExperDevVos().size(); i++) {
|
||||
ExperDevVo experDevVo = vo.getExperDevVos().get(i);
|
||||
experDevVo.setIsHg(setHgData(experDevVo.getDevData()));
|
||||
BigDecimal bigDecimal = new BigDecimal("0");
|
||||
if (i == 0) {
|
||||
for (ConfigItemsVo configItemsVo : vo.getConfigItemsVos()) {
|
||||
// 添加试验项数据
|
||||
mapper.addExperItems(configItemsVo, vo.getId());
|
||||
BigDecimal amount = new BigDecimal(configItemsVo.getAmount());
|
||||
bigDecimal=bigDecimal.add(amount);
|
||||
// 添加试验项内容数据
|
||||
for (ConfigItemVo configItemVo : configItemsVo.getItemList()) {
|
||||
mapper.addExperItem(configItemVo, configItemsVo.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//计算设备总金额
|
||||
experDevVo.setExperAmount(bigDecimal.toString());
|
||||
BigDecimal amount= new BigDecimal(experDevVo.getAmount());
|
||||
allMony=allMony.add(bigDecimal).add(amount);
|
||||
mapper.addExperDev(experDevVo, vo.getId());
|
||||
List<ExperDevItemsVo> experDevItemsVos = setExperDevItemsList(vo.getExperDevVos().get(i), vo);
|
||||
for (ExperDevItemsVo experDevItemsVo : experDevItemsVos) {
|
||||
// 添加设备试验项信息
|
||||
mapper.addExperDevItems(experDevItemsVo);
|
||||
List<ExperDevItemVo> experDevItemVos = setExperDevItemList(vo.getExperDevVos().get(i), vo, experDevItemsVo);
|
||||
// 添加设备试验项数据
|
||||
mapper.addExperDevItem(experDevItemVos);
|
||||
}
|
||||
}
|
||||
// 获取收样中的试验项是否全部填写
|
||||
List<Integer> resultList = mapper.isAllExper(vo.getSampleId());
|
||||
if (Objects.equals(resultList.get(0), resultList.get(1))) {
|
||||
// 更新收样表中的状态为待提交
|
||||
mapper.editSampleStatus(vo.getSampleId());
|
||||
}
|
||||
|
||||
vo.setAllMoney(allMony.toString());
|
||||
mapper.updateExperMony(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "操作失败");
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse editTestData(TestVo vo) {
|
||||
try {
|
||||
if (vo.getId() == null) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数不完整");
|
||||
}
|
||||
if (!SystemUtils.isExperimentalTeam()) {
|
||||
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);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, validResult);
|
||||
}
|
||||
if (!validatorsDate(vo)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "下次试验日期不能早于试验日期");
|
||||
}
|
||||
String result = validatorsParams(vo.getParamsData());
|
||||
if (StringUtils.isNotBlank(result)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result);
|
||||
}
|
||||
TestVo testVo = handleConfigItem(vo);
|
||||
if (testVo == null) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数异常");
|
||||
}
|
||||
// 试验主要设备、试验依据、试验项校验
|
||||
String result2 = singleValidators(testVo);
|
||||
if (StringUtils.isNotBlank(result2)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result2);
|
||||
}
|
||||
//论实验全部金额
|
||||
BigDecimal allMony= new BigDecimal("0");
|
||||
//获取试验项金额
|
||||
BigDecimal bigDecimal = new BigDecimal("0");
|
||||
for (ConfigItemsVo configItemsVo : vo.getConfigItemsVos()) {
|
||||
// 添加试验项数据
|
||||
BigDecimal amount = new BigDecimal(configItemsVo.getAmount());
|
||||
bigDecimal=bigDecimal.add(amount);
|
||||
}
|
||||
// 删除试验依据、试验样品设备、设备试验项信息、设备试验项数据
|
||||
List<Long> experDevIds = mapper.getExperDevIds(vo.getId());
|
||||
List<Long> experDevItemsIds = mapper.getExperDevItems(experDevIds);
|
||||
mapper.delConfigBasis(vo.getId());
|
||||
mapper.delExperDev(vo.getId());
|
||||
if (CollectionUtils.isNotEmpty(experDevIds)) {
|
||||
mapper.delExperDevItems(experDevIds);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(experDevItemsIds)) {
|
||||
mapper.delExperDevItem(experDevItemsIds);
|
||||
}
|
||||
// 修改试验信息数据
|
||||
mapper.updateExper(vo);
|
||||
// 添加试验依据信息数据
|
||||
mapper.addConfigBasis(vo.getBasisVos(), vo.getId());
|
||||
for (int i = 0; i < vo.getExperDevVos().size(); i++) {
|
||||
ExperDevVo experDevVo = vo.getExperDevVos().get(i);
|
||||
experDevVo.setIsHg(setHgData(experDevVo.getDevData()));
|
||||
// 添加试验样品数据
|
||||
BigDecimal amount= new BigDecimal(experDevVo.getAmount());
|
||||
allMony=allMony.add(bigDecimal).add(amount);
|
||||
experDevVo.setExperAmount(bigDecimal.toString());
|
||||
mapper.addExperDev(experDevVo, vo.getId());
|
||||
List<ExperDevItemsVo> experDevItemsVos = setExperDevItemsList(vo.getExperDevVos().get(i), vo);
|
||||
for (ExperDevItemsVo experDevItemsVo : experDevItemsVos) {
|
||||
|
||||
mapper.addExperDevItems(experDevItemsVo);
|
||||
List<ExperDevItemVo> experDevItemVos = setExperDevItemList(vo.getExperDevVos().get(i), vo, experDevItemsVo);
|
||||
// 添加设备试验项数据
|
||||
mapper.addExperDevItem(experDevItemVos);
|
||||
}
|
||||
}
|
||||
vo.setAllMoney(allMony.toString());
|
||||
mapper.updateExperMony(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "操作失败");
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse delTestData(ParamsDto dto) {
|
||||
try {
|
||||
// 删除试验依据、试验样品设备、设备试验项信息、设备试验项数据、试验项、试验项内容、试验信息
|
||||
List<Long> experDevIds = mapper.getExperDevIds(dto.getId());
|
||||
List<Long> experDevItemsIds = mapper.getExperDevItems(experDevIds);
|
||||
List<Long> experItemsIds = mapper.getExperItemsIds(dto.getId());
|
||||
mapper.delConfigBasis(dto.getId());
|
||||
mapper.delExperDev(dto.getId());
|
||||
mapper.delExperDevItems(experDevIds);
|
||||
mapper.delExperDevItem(experDevItemsIds);
|
||||
mapper.delExperItems(dto.getId());
|
||||
mapper.delExperItem(experItemsIds);
|
||||
mapper.delExper(dto.getId());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "操作失败");
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse viewTestData(ParamsDto dto) {
|
||||
TestVo testVo = new TestVo();
|
||||
try {
|
||||
if (dto.getId() == null) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "请求参数不完整");
|
||||
}
|
||||
// 试验数据详情
|
||||
testVo = mapper.viewTestData(dto);
|
||||
List<Long> numList = mapper.getRecordNum(testVo);
|
||||
int recordNum = 0;
|
||||
for (int i = 0; i < numList.size(); i++) {
|
||||
if (Objects.equals(testVo.getId(), numList.get(i))) {
|
||||
recordNum = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
testVo.setRecordNum(testVo.getExperTime().replace("-", "") + setRecordNum(recordNum));
|
||||
//试验依据信息、试验项、试验项目信息、试验样品设备
|
||||
ConfigMainDevVo configMainDevVo = new ConfigMainDevVo();
|
||||
configMainDevVo.setExperDevName(testVo.getExperDev());
|
||||
configMainDevVo.setExperDevModule(testVo.getExperModule());
|
||||
configMainDevVo.setExperDevCode(testVo.getExperCode());
|
||||
configMainDevVo.setDevContractDate(testVo.getCheckTime());
|
||||
List<ConfigMainDevVo> configMainDevVos = new ArrayList<>();
|
||||
configMainDevVos.add(configMainDevVo);
|
||||
List<ExperBasisVo> experBasisVos = mapper.getConfigBasis(dto);
|
||||
List<ConfigItemsVo> configItemsVos = mapper.getExperItems(dto);
|
||||
for (ConfigItemsVo configItemsVo : configItemsVos) {
|
||||
List<ConfigItemVo> configItemVos = mapper.getExperItem(configItemsVo.getId());
|
||||
configItemsVo.setItemList(configItemVos);
|
||||
}
|
||||
List<ExperDevVo> experDevVos = mapper.getExperDev(dto);
|
||||
testVo.setMainDeviceVos(configMainDevVos);
|
||||
testVo.setBasisVos(experBasisVos);
|
||||
testVo.setConfigItemsVos(configItemsVos);
|
||||
testVo.setExperDevVos(experDevVos);
|
||||
return ServerResponse.createSuccess(testVo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createSuccess(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse commitCheckTestData(ParamsDto dto) {
|
||||
try {
|
||||
// 判断是否提交空数据
|
||||
if (dto.getIds() == null || dto.getIds().length == 0) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "未提交审查数据");
|
||||
}
|
||||
if (!SystemUtils.isExperimentalTeam()) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "非试验班组,无法提交审查数据");
|
||||
}
|
||||
// 判断提交数据中是否存在流程数据或者存在待试验项
|
||||
List<Long> list = Arrays.asList(dto.getIds());
|
||||
int result = mapper.isNotEditData(list);
|
||||
if (result > 0) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "提交数据中存在待试验项或处于审核流程或已试验结束");
|
||||
}
|
||||
// 更新收样表中的状态为待审阅
|
||||
mapper.updateSampleStatus(list);
|
||||
// 更新试验表中数据为待审阅
|
||||
mapper.updateExperStatus(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "操作失败");
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证参数是否为空
|
||||
*
|
||||
* @param value
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/7/18 17:22
|
||||
*/
|
||||
public String validatorsParams(String value) {
|
||||
try {
|
||||
// 试验配置项、试验依据、主要试验设备、样品设备验证数据是否为空
|
||||
JSONObject obj = JSONObject.parseObject(value);
|
||||
JSONArray itemsList = obj.getJSONArray("items");
|
||||
JSONArray yjList = obj.getJSONArray("yjList");
|
||||
JSONArray mainDevList = obj.getJSONArray("mainDevList");
|
||||
JSONArray experDevList = obj.getJSONArray("experDevList");
|
||||
if (CollectionUtils.isEmpty(mainDevList)) {
|
||||
return Constants.ERROR_2;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(yjList)) {
|
||||
return Constants.ERROR_3;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(itemsList)) {
|
||||
return Constants.ERROR_4;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(experDevList)) {
|
||||
return Constants.ERROR_6;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return Constants.ERROR_5;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理试验项、试验项内容、试验依据、试验设备、主要试验设备、样品设备试验数据 数据
|
||||
*
|
||||
* @param vo
|
||||
* @return List<ConfigItemsVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/18 16:43
|
||||
*/
|
||||
public TestVo handleConfigItem(TestVo vo) {
|
||||
try {
|
||||
JSONObject obj = JSONObject.parseObject(vo.getParamsData());
|
||||
JSONArray yjList = obj.getJSONArray("yjList");
|
||||
JSONArray mainDevList = obj.getJSONArray("mainDevList");
|
||||
JSONArray itemsList = obj.getJSONArray("items");
|
||||
JSONArray experDevList = obj.getJSONArray("experDevList");
|
||||
List<ExperBasisVo> basisVos = yjList.toJavaList(ExperBasisVo.class);
|
||||
List<ConfigMainDevVo> mainDeviceVos = mainDevList.toJavaList(ConfigMainDevVo.class);
|
||||
List<ConfigItemsVo> configItemsVos = itemsList.toJavaList(ConfigItemsVo.class);
|
||||
List<ExperDevVo> experDevVos = experDevList.toJavaList(ExperDevVo.class);
|
||||
for (ConfigItemsVo configItemsVo : configItemsVos) {
|
||||
JSONArray itemArr = JSONObject.parseArray(configItemsVo.getItem());
|
||||
List<ConfigItemVo> configItemVos = itemArr.toJavaList(ConfigItemVo.class);
|
||||
configItemsVo.setItemList(configItemVos);
|
||||
}
|
||||
for (ConfigMainDevVo mainDeviceVo : mainDeviceVos) {
|
||||
vo.setExperDev(mainDeviceVo.getExperDevName());
|
||||
vo.setExperModule(mainDeviceVo.getExperDevModule());
|
||||
vo.setExperCode(mainDeviceVo.getExperDevCode());
|
||||
vo.setCheckTime(mainDeviceVo.getDevContractDate());
|
||||
}
|
||||
vo.setBasisVos(basisVos);
|
||||
vo.setMainDeviceVos(mainDeviceVos);
|
||||
vo.setConfigItemsVos(configItemsVos);
|
||||
vo.setExperDevVos(experDevVos);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return null;
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 试验项、试验项内容、试验依据、试验设备、主要试验设备数据校验
|
||||
*
|
||||
* @param vo
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/7/18 19:17
|
||||
*/
|
||||
public String singleValidators(TestVo vo) {
|
||||
List<ConfigMainDevVo> mainDeviceVos = vo.getMainDeviceVos();
|
||||
List<ExperBasisVo> basisVos = vo.getBasisVos();
|
||||
List<ConfigItemsVo> configItemsVos = vo.getConfigItemsVos();
|
||||
List<ExperDevVo> experDevVos = vo.getExperDevVos();
|
||||
for (ConfigMainDevVo mainDeviceVo : mainDeviceVos) {
|
||||
String validResult = validatorsUtils.valid(mainDeviceVo, ConfigMainDevVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return validResult;
|
||||
}
|
||||
}
|
||||
for (ExperBasisVo basisVo : basisVos) {
|
||||
String validResult = validatorsUtils.valid(basisVo, ExperBasisVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return validResult;
|
||||
}
|
||||
}
|
||||
for (ConfigItemsVo configItemsVo : configItemsVos) {
|
||||
String validResult = validatorsUtils.valid(configItemsVo, ConfigItemsVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return validResult;
|
||||
}
|
||||
for (ConfigItemVo configItemVo : configItemsVo.getItemList()) {
|
||||
String validResult2 = validatorsUtils.valid(configItemVo, ConfigItemVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult2)) {
|
||||
return validResult2;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ExperDevVo experDevVo : experDevVos) {
|
||||
String validResult = validatorsUtils.valid(experDevVo, ExperDevVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return validResult;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验试验时间和下次试验时间
|
||||
*
|
||||
* @param vo
|
||||
* @return boolean
|
||||
* @author cwchen
|
||||
* @date 2024/7/20 16:56
|
||||
*/
|
||||
public boolean validatorsDate(TestVo vo) {
|
||||
long time = DateTimeHelper.getTimeStampConverter(vo.getExperTime(), Constants.FORMAT_STR);
|
||||
long time2 = DateTimeHelper.getTimeStampConverter(vo.getNextExperTime(), Constants.FORMAT_STR);
|
||||
if (time2 < time) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理设备试验项数据
|
||||
*
|
||||
* @param experDevVo
|
||||
* @param vo
|
||||
* @return List<ExperDevItemsVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 19:17
|
||||
*/
|
||||
public List<ExperDevItemsVo> setExperDevItemsList(ExperDevVo experDevVo, TestVo vo) {
|
||||
List<ExperDevItemsVo> experDevItemsList = new ArrayList<>();
|
||||
for (int i = 0; i < vo.getConfigItemsVos().size(); i++) {
|
||||
ConfigItemsVo configItemsVo = vo.getConfigItemsVos().get(i);
|
||||
ExperDevItemsVo experDevItems = new ExperDevItemsVo();
|
||||
experDevItems.setItemsId(configItemsVo.getId());
|
||||
experDevItems.setDevId(experDevVo.getId());
|
||||
experDevItems.setItemsName(configItemsVo.getExperTypeName());
|
||||
experDevItems.setValSort(configItemsVo.getItemsSort());
|
||||
experDevItemsList.add(experDevItems);
|
||||
}
|
||||
return experDevItemsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理设备试验项内容数据
|
||||
*
|
||||
* @param experDevVo
|
||||
* @param vo
|
||||
* @return List<ExperDevItemVo>
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 19:17
|
||||
*/
|
||||
public List<ExperDevItemVo> setExperDevItemList(ExperDevVo experDevVo, TestVo vo, ExperDevItemsVo experDevItemsVo) {
|
||||
List<ExperDevItemVo> experDevItemList = new ArrayList<>();
|
||||
int index = 0;
|
||||
for (int i = 0; i < vo.getConfigItemsVos().size(); i++) {
|
||||
ConfigItemsVo configItemsVo = vo.getConfigItemsVos().get(i);
|
||||
List<ExperDevItemVo> experDevItemVos = new ArrayList<>();
|
||||
for (int j = 0; j < configItemsVo.getItemList().size(); j++) {
|
||||
ConfigItemVo configItemVo = configItemsVo.getItemList().get(j);
|
||||
ExperDevItemVo experDevItemVo = new ExperDevItemVo();
|
||||
experDevItemVo.setItemsId(configItemsVo.getId());
|
||||
experDevItemVo.setItemId(configItemVo.getId());
|
||||
experDevItemVo.setDevId(experDevItemsVo.getId());
|
||||
experDevItemVo.setItemName(configItemVo.getItemName());
|
||||
index = i * configItemsVo.getItemList().size() + j;
|
||||
String val = getVal(experDevVo, index);
|
||||
experDevItemVo.setItemVal(val);
|
||||
experDevItemList.add(experDevItemVo);
|
||||
}
|
||||
}
|
||||
return experDevItemList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备试验项内容数据
|
||||
*
|
||||
* @param experDevVo
|
||||
* @param index
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/7/21 19:30
|
||||
*/
|
||||
public String getVal(ExperDevVo experDevVo, int index) {
|
||||
try {
|
||||
String devData = experDevVo.getDevData();
|
||||
JSONArray jsonArray = JSONObject.parseArray(devData);
|
||||
String data = (String) jsonArray.get(index);
|
||||
return data;
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置试验设备数据是否合格
|
||||
*
|
||||
* @param value
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/7/23 15:25
|
||||
*/
|
||||
public String setHgData(String value) {
|
||||
if (value.contains(Constants.ERROR_RESULT) ||
|
||||
value.contains(Constants.ERROR_RESULT2)
|
||||
) {
|
||||
return "1";
|
||||
} else {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置记录编号
|
||||
* @param number
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/7/28 16:00
|
||||
*/
|
||||
public String setRecordNum(int number) {
|
||||
String formattedNumber = String.format("%05d", number);
|
||||
return formattedNumber;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,546 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.aqgqj.app.dao.ExperimentalAppMapper">
|
||||
<!--添加试验信息-->
|
||||
<insert id="addExper" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tb_exper
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sampleId != null">sample_id,</if>
|
||||
<if test="devTypeCode != null and devTypeCode != ''">dev_type_code,</if>
|
||||
<if test="devTypeName != null and devTypeName != ''">dev_type_name,</if>
|
||||
<if test="sampleQuantity != null">dev_num,</if>
|
||||
<if test="devModule != null and devModule!=''">dev_module,</if>
|
||||
<if test="sampleDate != null and sampleDate!=''">sample_date,</if>
|
||||
<if test="experTime != null and experTime!=''">exper_time,</if>
|
||||
<if test="nextExperTime != null and nextExperTime!=''">next_exper_time,</if>
|
||||
<if test="customId != null">submit_unit,</if>
|
||||
<if test="experLocal != null and experLocal!=''">submit_location,</if>
|
||||
<if test="experDev != null and experDev!=''">exper_dev,</if>
|
||||
<if test="experModule != null and experModule!=''">exper_module,</if>
|
||||
<if test="experCode != null and experCode!=''">exper_code,</if>
|
||||
<if test="checkTime != null and checkTime!=''">check_time,</if>
|
||||
<if test="experStand != null and experStand!=''">exper_stand,</if>
|
||||
<if test="experConclu != null and experConclu!=''">exper_conclu,</if>
|
||||
<if test="remarsk != null and remarsk!=''">remarsk,</if>
|
||||
audit_status,
|
||||
create_time,
|
||||
create_user,
|
||||
update_time,
|
||||
update_user,
|
||||
del_flag,
|
||||
status,
|
||||
id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sampleId != null">#{sampleId},</if>
|
||||
<if test="devTypeCode != null and devTypeCode != ''">#{devTypeCode},</if>
|
||||
<if test="devTypeName != null and devTypeName != ''">#{devTypeName},</if>
|
||||
<if test="sampleQuantity != null">#{sampleQuantity},</if>
|
||||
<if test="devModule != null and devModule!=''">#{devModule},</if>
|
||||
<if test="sampleDate != null and sampleDate!=''">#{sampleDate},</if>
|
||||
<if test="experTime != null and experTime!=''">#{experTime},</if>
|
||||
<if test="nextExperTime != null and nextExperTime!=''">#{nextExperTime},</if>
|
||||
<if test="customId != null">#{customId},</if>
|
||||
<if test="experLocal != null and experLocal!=''">#{experLocal},</if>
|
||||
<if test="experDev != null and experDev!=''">#{experDev},</if>
|
||||
<if test="experModule != null and experModule!=''">#{experModule},</if>
|
||||
<if test="experCode != null and experCode!=''">#{experCode},</if>
|
||||
<if test="checkTime != null and checkTime!=''">#{checkTime},</if>
|
||||
<if test="experStand != null and experStand!=''">#{experStand},</if>
|
||||
<if test="experConclu != null and experConclu!=''">#{experConclu},</if>
|
||||
<if test="remarsk != null and remarsk!=''">#{remarsk},</if>
|
||||
#{auditStatus},
|
||||
#{createTime},
|
||||
#{createUser},
|
||||
#{updateTime},
|
||||
#{updateUser},
|
||||
0,
|
||||
#{status},
|
||||
null
|
||||
</trim>
|
||||
</insert>
|
||||
<!--添加试验依据信息数据-->
|
||||
<insert id="addConfigBasis">
|
||||
INSERT INTO tb_config_basis(id,exper_id,exper_basis_name) VALUES
|
||||
<foreach collection="list" separator="," item="item">
|
||||
(
|
||||
null,#{experId},#{item.basisName}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--添加试验项信息-->
|
||||
<insert id="addExperItems" useGeneratedKeys="true" keyProperty="params.id">
|
||||
INSERT INTO tb_exper_items
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="experId != null">exper_id,</if>
|
||||
<if test="params.experTypeCode != null and params.experTypeCode != ''">exper_type_code,</if>
|
||||
<if test="params.experTypeName != null and params.experTypeName != ''">exper_type_name,</if>
|
||||
<if test="params.experNum != null">exper_num,</if>
|
||||
<if test="params.itemsSort != null">items_sort,</if>
|
||||
<if test="params.amount != null and params.amount!=''">amount,</if>
|
||||
id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="experId != null">#{experId},</if>
|
||||
<if test="params.experTypeCode != null and params.experTypeCode != ''">#{params.experTypeCode},</if>
|
||||
<if test="params.experTypeName != null and params.experTypeName != ''">#{params.experTypeName},</if>
|
||||
<if test="params.experNum != null">#{params.experNum},</if>
|
||||
<if test="params.itemsSort != null">#{params.itemsSort},</if>
|
||||
<if test="params.amount != null and params.amount!=''">#{params.amount},</if>
|
||||
null
|
||||
</trim>
|
||||
</insert>
|
||||
<!--添加试验项内容-->
|
||||
<insert id="addExperItem" useGeneratedKeys="true" keyProperty="params.id">
|
||||
INSERT INTO tb_exper_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="experId != null">items_id,</if>
|
||||
<if test="params.itemNum != null">item_sort,</if>
|
||||
<if test="params.itemName != null and params.itemName != ''">item_name,</if>
|
||||
id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="experId != null">#{experId},</if>
|
||||
<if test="params.itemNum != null">#{params.itemNum},</if>
|
||||
<if test="params.itemName != null and params.itemName != ''">#{params.itemName},</if>
|
||||
null
|
||||
</trim>
|
||||
</insert>
|
||||
<!--添加试验样品设备-->
|
||||
<insert id="addExperDev" useGeneratedKeys="true" keyProperty="params.id">
|
||||
INSERT INTO tb_exper_dev
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="experId != null">exper_id,</if>
|
||||
<if test="params.devCode != null and params.devCode!=''">dev_code,</if>
|
||||
<if test="params.manufacturer != null and params.manufacturer != ''">manufacturer,</if>
|
||||
<if test="params.manufactureDate != null and params.manufactureDate != ''">manufacture_date,</if>
|
||||
<if test="params.devModule != null and params.devModule != ''">dev_module,</if>
|
||||
<if test="params.devStatus != null and params.devStatus != ''">dev_status,</if>
|
||||
<if test="params.devData != null and params.devData != ''">dev_data,</if>
|
||||
<if test="params.amount != null and params.amount != ''">amount,</if>
|
||||
<if test="params.remarks != null and params.remarks != ''">remarks,</if>
|
||||
<if test="params.devId != null">dev_id,</if>
|
||||
<if test="params.isHg != null and params.isHg != ''">is_hg,</if>
|
||||
<if test="params.departmentId != null">department_id,</if>
|
||||
<if test="params.experAmount != null">exper_amount,</if>
|
||||
id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="experId != null">#{experId},</if>
|
||||
<if test="params.devCode != null and params.devCode!=''">#{params.devCode},</if>
|
||||
<if test="params.manufacturer != null and params.manufacturer != ''">#{params.manufacturer},</if>
|
||||
<if test="params.manufactureDate != null and params.manufactureDate != ''">#{params.manufactureDate},</if>
|
||||
<if test="params.devModule != null and params.devModule != ''">#{params.devModule},</if>
|
||||
<if test="params.devStatus != null and params.devStatus != ''">#{params.devStatus},</if>
|
||||
<if test="params.devData != null and params.devData != ''">#{params.devData},</if>
|
||||
<if test="params.amount != null and params.amount != ''">#{params.amount},</if>
|
||||
<if test="params.remarks != null and params.remarks != ''">#{params.remarks},</if>
|
||||
<if test="params.devId != null">#{params.devId},</if>
|
||||
<if test="params.isHg != null and params.isHg != ''">#{params.isHg},</if>
|
||||
<if test="params.departmentId != null">#{params.departmentId},</if>
|
||||
<if test="params.experAmount != null">#{params.experAmount},</if>
|
||||
null
|
||||
</trim>
|
||||
</insert>
|
||||
<!--添加设备试验项信息-->
|
||||
<insert id="addExperDevItems" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tb_exper_dev_items
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="devId != null">dev_id,</if>
|
||||
<if test="itemsId != null">items_id,</if>
|
||||
<if test="itemsName != null and itemsName != ''">items_name,</if>
|
||||
<if test="valSort != null">val_sort,</if>
|
||||
id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="devId != null">#{devId},</if>
|
||||
<if test="itemsId != null">#{itemsId},</if>
|
||||
<if test="itemsName != null and itemsName != ''">#{itemsName},</if>
|
||||
<if test="valSort != null">#{valSort},</if>
|
||||
null
|
||||
</trim>
|
||||
</insert>
|
||||
<!--添加设备试验项数据-->
|
||||
<insert id="addExperDevItem">
|
||||
INSERT INTO tb_exper_dev_item (id,items_id,item_id,dev_id,item_name,item_val) VALUES
|
||||
<foreach collection="experDevItemVos" separator="," item="item">
|
||||
(
|
||||
null,#{item.itemsId},#{item.itemId},#{item.devId},#{item.itemName},#{item.itemVal}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--添加试验设备数据-->
|
||||
<insert id="addExperConfigDev">
|
||||
INSERT INTO tb_exper_config_dev(id,dev_type_code,dev_type_name,exper_id,dev_name,dev_id) VALUES
|
||||
<foreach collection="list" separator="," item="item">
|
||||
(
|
||||
null,#{item.devTypeCode},#{item.devTypeName},#{experId},#{item.devName},#{item.devId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--修改试验信息数据-->
|
||||
<update id="updateExper">
|
||||
UPDATE tb_exper SET dev_type_code = #{devTypeCode},dev_type_name = #{devTypeName},dev_num = #{sampleQuantity},
|
||||
dev_module = #{devModule},sample_date = #{sampleDate},exper_time = #{experTime},next_exper_time = #{nextExperTime},
|
||||
submit_unit = #{customId},submit_location = #{experLocal},exper_dev = #{experDev},exper_module = #{experModule},
|
||||
exper_code = #{experCode},check_time = #{checkTime},update_time = #{updateTime},update_user = #{updateUser},exper_stand = #{experStand},
|
||||
exper_conclu = #{experConclu},remarsk = #{remarsk} WHERE id = #{id}
|
||||
</update>
|
||||
<!--更新收样表中的状态为待审阅-->
|
||||
<update id="updateSampleStatus">
|
||||
UPDATE tb_sample SET audti_status = 0,process_status = 1,remarks = null
|
||||
WHERE id IN
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!--更新试验表中数据为待审阅-->
|
||||
<update id="updateExperStatus">
|
||||
UPDATE tb_exper SET status = 1,audit_status = 0,audit_user_name = null,audit_time = null,audit_remakr = null
|
||||
WHERE sample_id IN
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!--更新收样表中的状态为待提交-->
|
||||
<update id="editSampleStatus">
|
||||
UPDATE tb_sample SET process_status = 0 WHERE id = #{id}
|
||||
</update>
|
||||
<update id="updateExperMony">
|
||||
UPDATE tb_exper SET amount = #{allMoney} WHERE id = #{id}
|
||||
</update>
|
||||
<!--删除试验依据-->
|
||||
<delete id="delConfigBasis">
|
||||
DELETE FROM tb_config_basis WHERE exper_id = #{id}
|
||||
</delete>
|
||||
<!--删除试验设备-->
|
||||
<delete id="delExperConfigDev">
|
||||
DELETE FROM tb_exper_config_dev WHERE exper_id = #{id}
|
||||
</delete>
|
||||
<!--删除试验样品设备-->
|
||||
<delete id="delExperDev">
|
||||
DELETE FROM tb_exper_dev WHERE exper_id = #{id}
|
||||
</delete>
|
||||
<!--删除设备试验项信息-->
|
||||
<delete id="delExperDevItems">
|
||||
DELETE FROM tb_exper_dev_items
|
||||
WHERE dev_id IN
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
<!--删除设备试验项数据-->
|
||||
<delete id="delExperDevItem">
|
||||
DELETE FROM tb_exper_dev_item
|
||||
WHERE dev_id IN
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
<!--删除试验信息-->
|
||||
<delete id="delExper">
|
||||
UPDATE tb_exper SET del_flag = 1 WHERE id = #{id}
|
||||
</delete>
|
||||
<!--删除试验项-->
|
||||
<delete id="delExperItems">
|
||||
DELETE FROM tb_exper_items WHERE exper_id = #{id}
|
||||
</delete>
|
||||
<!--删除试验项内容-->
|
||||
<delete id="delExperItem">
|
||||
DELETE FROM tb_exper_item WHERE items_id IN
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!--试验列表-->
|
||||
<select id="getList" resultType="com.bonus.aqgqj.app.entity.ExperimentalAppVo">
|
||||
SELECT
|
||||
ts.id,
|
||||
tc.custom_name as customName,
|
||||
ts.dispatch_time as dispatchTime,
|
||||
ts.batch_code as batchCode,
|
||||
tsd.sampleDev,
|
||||
IFNULL(tsd.num,0) AS customNum,
|
||||
tt.team_name AS teamName
|
||||
FROM
|
||||
tb_sample ts
|
||||
LEFT JOIN tb_custom tc on tc.id=ts.custom_id and tc.del_flag=0
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
sample_id,
|
||||
COUNT(sample_id) AS num,
|
||||
ANY_VALUE(GROUP_CONCAT(DISTINCT dev_type_name)) AS sampleDev
|
||||
FROM
|
||||
tb_sample_device
|
||||
WHERE
|
||||
del_falg=0
|
||||
GROUP BY sample_id
|
||||
) tsd on tsd.sample_id =ts.id
|
||||
LEFT JOIN tb_team tt ON ts.team_id = tt.id AND tt.del_flag = 0
|
||||
WHERE
|
||||
ts.del_flag=0
|
||||
and ts.team_id is not null
|
||||
<if test="keyWord != null and keyWord!=''">
|
||||
AND (
|
||||
tc.custom_name LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
ts.batch_code LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
tt.team_name LIKE CONCAT('%',#{keyWord},'%')
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="devTypeCode != null and devTypeCode!=''">
|
||||
AND tsd.sampleDev LIKE CONCAT('%',#{devTypeCode},'%')
|
||||
</if>
|
||||
/*试验班组成员-待试验/待提交/审阅不通过/审核不通过/审批不通过*/
|
||||
<if test="roleCode == 'experimentalTeamMember' and teamId != null">
|
||||
AND ts.team_id = #{teamId} AND (
|
||||
(ts.process_status IS NULL AND audti_status = 0) OR
|
||||
(ts.process_status = 0 AND audti_status = 0) OR
|
||||
(ts.process_status = 1 AND audti_status = 2) OR
|
||||
(ts.process_status = 2 AND audti_status = 2) OR
|
||||
(ts.process_status = 3 AND audti_status = 2)
|
||||
)
|
||||
</if>
|
||||
<if test="roleCode == 'administrators'">
|
||||
AND (
|
||||
(ts.process_status IS NULL AND audti_status = 0) OR
|
||||
(ts.process_status = 0 AND audti_status = 0) OR
|
||||
(ts.process_status = 1 AND audti_status = 2) OR
|
||||
(ts.process_status = 2 AND audti_status = 2) OR
|
||||
(ts.process_status = 3 AND audti_status = 2)
|
||||
)
|
||||
</if>
|
||||
/*不是试验班组-成员或者管理员,无权限查看数据*/
|
||||
<if test="roleCode != 'experimentalTeamMember' and roleCode != 'administrators'">
|
||||
AND ts.team_id = -1
|
||||
</if>
|
||||
<if test="roleCode == 'experimentalTeamMember' and teamId == null">
|
||||
AND ts.team_id = -1
|
||||
</if>
|
||||
</select>
|
||||
<!--试验详情列表-->
|
||||
<select id="getDetailList" resultType="com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo">
|
||||
SELECT * FROM (
|
||||
SELECT ANY_VALUE(tsd.sample_id) AS sampleId,
|
||||
ANY_VALUE(tsd.dev_type_name) AS devTypeName,
|
||||
tsd.dev_type_code AS devTypeCode,
|
||||
ANY_VALUE(te.id) AS experId,
|
||||
COUNT(tsd.dev_type_code) AS sampleNum,
|
||||
ANY_VALUE(te.audit_remakr) AS causeOfRejection,
|
||||
ANY_VALUE(su2.user_name) AS experimenter,
|
||||
ANY_VALUE(DATE_FORMAT(te.update_time, '%Y-%m-%d')) AS testTime,
|
||||
CASE WHEN ANY_VALUE(te.status) = 0 AND ANY_VALUE(te.audit_status) = 0 THEN '待提交'
|
||||
WHEN ANY_VALUE(te.status) = 1 AND ANY_VALUE(te.audit_status) = 0 AND ANY_VALUE(te.is_er) IS NULL THEN '待审阅'
|
||||
WHEN ANY_VALUE(te.status) = 1 AND ANY_VALUE(te.audit_status) = 0 AND ANY_VALUE(te.is_er) = '1' THEN '待重新审阅'
|
||||
WHEN ANY_VALUE(te.status) = 1 AND ANY_VALUE(te.audit_status) = 2 THEN '审阅不通过'
|
||||
WHEN ANY_VALUE(te.status) = 2 AND ANY_VALUE(te.audit_status) = 0 THEN '待审核'
|
||||
WHEN ANY_VALUE(te.status) = 2 AND ANY_VALUE(te.audit_status) = 3 THEN '审核不通过'
|
||||
WHEN ANY_VALUE(te.status) = 3 AND ANY_VALUE(te.audit_status) = 0 THEN '待审批'
|
||||
WHEN ANY_VALUE(te.status) = 3 AND ANY_VALUE(te.audit_status) = 4 THEN '审批不通过'
|
||||
WHEN ANY_VALUE(te.status) = 4 AND ANY_VALUE(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
|
||||
LEFT JOIN sys_user su2 ON te.update_user = su2.id AND su2.del_flag = 0
|
||||
WHERE tsd.sample_id = #{id} AND tsd.del_falg = 0
|
||||
<if test="devTypeCode != null and devTypeCode!=''">
|
||||
AND INSTR(tsd.dev_type_code,#{devTypeCode})
|
||||
</if>
|
||||
GROUP BY tsd.dev_type_code
|
||||
)a
|
||||
ORDER BY FIELD(a.status, '审阅不通过','审核不通过','审批不通过','待提交','待审阅','待重新审阅','待审核','待审批','试验完成') ,a.testTime DESC
|
||||
</select>
|
||||
<!--查询试验模板数据、基础数据-->
|
||||
<select id="getTestBasicInfo" resultType="com.bonus.aqgqj.basis.entity.vo.TestVo">
|
||||
SELECT DATE_FORMAT(ts.sample_date, '%Y-%m-%d') AS sampleDate,
|
||||
custom_id AS customId,
|
||||
custom_name AS customName,
|
||||
a.id AS configId,
|
||||
a.dev_type_code AS devTypeCode,
|
||||
a.dev_type_name AS devTypeName,
|
||||
a.dev_module AS devModule,
|
||||
a.exper_local_code AS experLocalCode,
|
||||
a.exper_local AS experLocal,
|
||||
ts.id AS sampleId
|
||||
FROM tb_sample ts
|
||||
LEFT JOIN (
|
||||
SELECT tsd.dev_type_code,
|
||||
ANY_VALUE(tsc.dev_type_name) AS dev_type_name,
|
||||
ANY_VALUE(tsc.dev_module) AS dev_module,
|
||||
ANY_VALUE(tsc.exper_local_code) AS exper_local_code,
|
||||
ANY_VALUE(tsc.exper_local) AS exper_local,
|
||||
ANY_VALUE(tsc.id) AS id,
|
||||
ANY_VALUE(tsd.sample_id) AS sample_id
|
||||
FROM tb_sample_device tsd
|
||||
LEFT JOIN tb_exper_config tsc ON tsc.dev_type_code = tsd.dev_type_code AND tsc.del_flag = 0
|
||||
WHERE tsd.sample_id = #{id} AND tsd.del_falg = 0 AND tsd.dev_type_code = #{devTypeCode}
|
||||
GROUP BY tsd.dev_type_code
|
||||
) a ON a.sample_id = ts.id
|
||||
WHERE ts.id = #{id} AND del_flag = 0
|
||||
</select>
|
||||
<!--查询收样设备-根据设备类型-->
|
||||
<select id="getSampleDeviceVos" resultType="com.bonus.aqgqj.basis.entity.vo.SampleDeviceVo">
|
||||
SELECT id,
|
||||
dev_code AS devCode,
|
||||
dev_module AS devModule,
|
||||
dev_type_code AS devTypeCode,
|
||||
dev_type_name AS devTypeName,
|
||||
department_id AS departmentId
|
||||
FROM tb_sample_device
|
||||
WHERE sample_id = #{id}
|
||||
AND dev_type_code = #{devTypeCode}
|
||||
AND del_falg = 0
|
||||
</select>
|
||||
<!--试验数据详情-->
|
||||
<select id="viewTestData" resultType="com.bonus.aqgqj.basis.entity.vo.TestVo">
|
||||
SELECT te.id,
|
||||
te.sample_id AS sampleId,
|
||||
te.dev_type_code AS devTypeCode,
|
||||
te.dev_type_name AS devTypeName,
|
||||
te.dev_num AS sampleQuantity,
|
||||
te.dev_module AS devModule,
|
||||
te.sample_date AS sampleDate,
|
||||
DATE_FORMAT(te.exper_time, '%Y-%m-%d') AS experTime,
|
||||
DATE_FORMAT(te.next_exper_time, '%Y-%m-%d') AS nextExperTime,
|
||||
te.submit_unit AS customId,
|
||||
tc.custom_name AS customName,
|
||||
te.submit_location AS experLocal,
|
||||
te.exper_dev AS experDev,
|
||||
te.exper_module AS experModule,
|
||||
te.exper_code AS experCode,
|
||||
DATE_FORMAT(te.check_time, '%Y-%m-%d') AS checkTime,
|
||||
te.exper_stand AS experStand,
|
||||
te.exper_conclu AS experConclu,
|
||||
te.remarsk AS remarsk,
|
||||
su.user_name AS experUserName,
|
||||
te.audit_user_name AS auditUserName
|
||||
FROM tb_exper te
|
||||
LEFT JOIN tb_custom tc ON te.submit_unit = tc.id AND tc.del_flag = 0
|
||||
LEFT JOIN sys_user su ON te.update_user = su.id AND su.del_flag = 0
|
||||
WHERE te.id = #{id}
|
||||
</select>
|
||||
<!--试验依据信息-->
|
||||
<select id="getConfigBasis" resultType="com.bonus.aqgqj.basis.entity.vo.ExperBasisVo">
|
||||
SELECT id,
|
||||
exper_id AS configId,
|
||||
exper_basis_name AS basisName
|
||||
FROM tb_config_basis WHERE exper_id = #{id}
|
||||
</select>
|
||||
<!--试验设备信息-->
|
||||
<select id="getExperConfigDevs" resultType="com.bonus.aqgqj.basis.entity.vo.ConfigDevVo">
|
||||
SELECT id,
|
||||
dev_type_code AS devTypeCode,
|
||||
dev_type_name AS devTypeName,
|
||||
exper_id AS configId,
|
||||
dev_name AS devName,
|
||||
dev_id AS devId
|
||||
FROM tb_exper_config_dev
|
||||
WHERE exper_id = #{id}
|
||||
</select>
|
||||
<!--试验项信息-->
|
||||
<select id="getExperItems" resultType="com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo">
|
||||
SELECT id,
|
||||
exper_type_code AS experTypeCode,
|
||||
exper_type_name AS experTypeName,
|
||||
exper_num AS experNum,
|
||||
items_sort AS itemsSort,
|
||||
amount
|
||||
FROM tb_exper_items
|
||||
WHERE exper_id = #{id}
|
||||
ORDER BY items_sort
|
||||
</select>
|
||||
<!--试验项内容信息-->
|
||||
<select id="getExperItem" resultType="com.bonus.aqgqj.basis.entity.vo.ConfigItemVo">
|
||||
SELECT id,
|
||||
items_id AS itemId,
|
||||
item_sort AS itemNum,
|
||||
item_name AS itemName
|
||||
FROM tb_exper_item
|
||||
WHERE items_id = #{id}
|
||||
ORDER BY item_sort
|
||||
</select>
|
||||
<!--试验样品设备-->
|
||||
<select id="getExperDev" resultType="com.bonus.aqgqj.basis.entity.vo.ExperDevVo">
|
||||
SELECT id,
|
||||
exper_id AS experId,
|
||||
dev_code AS devCode,
|
||||
manufacturer,
|
||||
manufacture_date AS manufactureDate,
|
||||
dev_module AS devModule,
|
||||
dev_status AS devStatus,
|
||||
dev_data AS devData,
|
||||
amount,
|
||||
remarks,
|
||||
department_id AS departmentId,
|
||||
dev_id AS devId
|
||||
FROM tb_exper_dev
|
||||
WHERE exper_id = #{id}
|
||||
ORDER BY id
|
||||
</select>
|
||||
<!--获取试验样品设备ID-->
|
||||
<select id="getExperDevIds" resultType="java.lang.Long">
|
||||
SELECT id FROM tb_exper_dev WHERE exper_id = #{id}
|
||||
</select>
|
||||
<!--获取试验样品设备ID-->
|
||||
<select id="getExperDevItems" resultType="java.lang.Long">
|
||||
SELECT id FROM tb_exper_dev_items WHERE dev_id IN
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!--查询试验项ID-->
|
||||
<select id="getExperItemsIds" resultType="java.lang.Long">
|
||||
SELECT id FROM tb_exper_items WHERE exper_id = #{id}
|
||||
</select>
|
||||
<!--查询试验设备数量-->
|
||||
<select id="getExperDevItemsNum" resultType="java.util.Map">
|
||||
SELECT dev_code AS devCode,
|
||||
case is_hg WHEN '1' THEN '不合格'
|
||||
WHEN '0' THEN '合格'
|
||||
ELSE '不合格' END 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 = 1 AND audit_status = 0) OR
|
||||
(status = 2 AND audit_status = 0) OR
|
||||
(status = 3 AND audit_status = 0) OR
|
||||
(status = 4 AND audit_status = 1)
|
||||
)
|
||||
</select>
|
||||
<!--判断提交数据中是否存在流程数据或者存在待试验项-->
|
||||
<select id="isNotEditData" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM tb_sample
|
||||
WHERE id IN
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND del_flag = 0
|
||||
AND (
|
||||
(process_status IS NULL) OR
|
||||
(audti_status = 0 AND process_status = 1) OR
|
||||
(audti_status = 0 AND process_status = 2) OR
|
||||
(audti_status = 0 AND process_status = 3) OR
|
||||
(audti_status = 1 AND process_status = 4)
|
||||
)
|
||||
</select>
|
||||
<!--获取收样中的试验项是否全部填写-->
|
||||
<select id="isAllExper" resultType="java.lang.Integer">
|
||||
SELECT COUNT(DISTINCT dev_type_code)
|
||||
FROM tb_sample_device
|
||||
WHERE sample_id = #{sampleId} AND del_falg = 0
|
||||
UNION ALL
|
||||
SELECT COUNT(*) FROM tb_exper WHERE sample_id = #{sampleId} AND status = 0 AND audit_status = 0 AND del_flag = 0
|
||||
</select>
|
||||
<!--获取记录编号-->
|
||||
<select id="getRecordNum" resultType="java.lang.Long">
|
||||
SELECT id FROM tb_exper WHERE (id = #{id} OR DATE_FORMAT(exper_time, '%Y-%m-%d') = #{experTime}) AND del_flag = 0 ORDER BY id
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue