diff --git a/src/main/java/com/bonus/aqgqj/app/controller/ExperimentalAppController.java b/src/main/java/com/bonus/aqgqj/app/controller/ExperimentalAppController.java index 44201f2..2d2b98a 100644 --- a/src/main/java/com/bonus/aqgqj/app/controller/ExperimentalAppController.java +++ b/src/main/java/com/bonus/aqgqj/app/controller/ExperimentalAppController.java @@ -86,15 +86,15 @@ public class ExperimentalAppController { public ServerResponse addTestData(EncryptedReq data) { return service.addTestData(data.getData()); } -// -// @PostMapping(value = "editTestData") -// @DecryptAndVerify(decryptedClass = TestAppVo.class)//加解密统一管理 -// @LogAnnotation(operModul = "试验详情管理", operation = "修改试验数据", operDesc = "业务级事件", operType = "修改") -// // @PreAuthorize("@pms.hasPermission('sys:experimentalTest:edit')") -// public ServerResponse editTestData(EncryptedReq data) { -// return service.editTestData(data.getData()); -// } -// + + @PostMapping(value = "editTestData") + @DecryptAndVerify(decryptedClass = TestAppVo.class)//加解密统一管理 + @LogAnnotation(operModul = "试验详情管理", operation = "修改试验数据", operDesc = "业务级事件", operType = "修改") + // @PreAuthorize("@pms.hasPermission('sys:experimentalTest:edit')") + public ServerResponse editTestData(EncryptedReq data) { + return service.editTestData(data.getData()); + } + // @PostMapping(value = "delTestData") // @DecryptAndVerify(decryptedClass = ParamsAppDto.class)//加解密统一管理 // @LogAnnotation(operModul = "试验详情管理", operation = "删除试验数据", operDesc = "业务级事件", operType = "删除") diff --git a/src/main/java/com/bonus/aqgqj/app/controller/PrimaryDataAppController.java b/src/main/java/com/bonus/aqgqj/app/controller/PrimaryDataAppController.java index e7e7d77..66fd53c 100644 --- a/src/main/java/com/bonus/aqgqj/app/controller/PrimaryDataAppController.java +++ b/src/main/java/com/bonus/aqgqj/app/controller/PrimaryDataAppController.java @@ -109,8 +109,8 @@ public class PrimaryDataAppController { } @PostMapping(value = "exportOriginalRecordExcel") - @DecryptAndVerify(decryptedClass = ParamsDto.class) // 加解密统一管理 - public ResponseEntity exportExcel(HttpServletRequest request, HttpServletResponse response, EncryptedReq dto) { + @DecryptAndVerify(decryptedClass = ParamsDto.class) + public ServerResponse exportExcel(EncryptedReq dto) { try { ServerResponse serverResponse = primaryDataAppService.viewTestData(dto.getData()); TestVo vo = (TestVo) serverResponse.getData(); @@ -164,10 +164,10 @@ public class PrimaryDataAppController { // 将字节数组编码为 Base64 字符串 String base64Excel = Base64.getEncoder().encodeToString(excelBytes); // 返回 Base64 字符串 - return ResponseEntity.ok(base64Excel); + return ServerResponse.createSuccess(base64Excel); } catch (Exception e) { log.error("excel文档导出错误-异常信息", e); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("导出错误"); + return ServerResponse.createErroe("查看失败"); } } @@ -183,7 +183,7 @@ public class PrimaryDataAppController { * @date 2024/7/28 17:30 */ @PostMapping(value = "downLoadExcelZip") - @DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理 + @DecryptAndVerify(decryptedClass = ParamsDto.class) public void downLoadExcelZip(HttpServletRequest request, HttpServletResponse response, EncryptedReq dto) { List fileList = new ArrayList(); List fileNameList = new ArrayList(); diff --git a/src/main/java/com/bonus/aqgqj/app/controller/TestReportManageAppController.java b/src/main/java/com/bonus/aqgqj/app/controller/TestReportManageAppController.java new file mode 100644 index 0000000..69af094 --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/app/controller/TestReportManageAppController.java @@ -0,0 +1,265 @@ +package com.bonus.aqgqj.app.controller; + +import com.bonus.aqgqj.annotation.DecryptAndVerify; +import com.bonus.aqgqj.annotation.LogAnnotation; +import com.bonus.aqgqj.app.entity.TestReportManageAppVo; +import com.bonus.aqgqj.app.service.TestReportManageAppService; +import com.bonus.aqgqj.basis.entity.dto.ParamsDto; +import com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo; +import com.bonus.aqgqj.basis.entity.vo.ExperDevVo; +import com.bonus.aqgqj.basis.entity.vo.TestVo; +import com.bonus.aqgqj.system.vo.EncryptedReq; +import com.bonus.aqgqj.utils.DateTimeHelper; +import com.bonus.aqgqj.utils.ExcelStyleUtil; +import com.bonus.aqgqj.utils.ServerResponse; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import freemarker.template.Configuration; +import freemarker.template.Template; +import io.swagger.annotations.Api; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.util.Base64; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * 检测报告管理 + * @author hay + */ +@Api(tags = "检测报告管理") +@RestController +@RequestMapping("/app/testReport/") +public class TestReportManageAppController { + + private static final Logger log = LoggerFactory.getLogger("adminLogger"); + + @Autowired + private TestReportManageAppService service; + + @PostMapping(value = "getList") + @DecryptAndVerify(decryptedClass = TestReportManageAppVo.class) + @LogAnnotation(operModul = "检测报告管理-检测报告管理", operation = "查询用列表", operDesc = "业务级事件",operType="查询") +// @PreAuthorize("@pms.hasPermission('sys:testReport:query')" ) + public ServerResponse listUsers(EncryptedReq data) { + PageHelper.startPage(data.getData().getPage(), data.getData().getLimit()); + try { + List list = service.list(data.getData()); + PageInfo pageInfo = new PageInfo<>(list); + return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit()); + } catch (Exception e) { + log.error(e.toString(),e); + } + return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit()); + } + + @PostMapping(value = "getDetailsList") + @DecryptAndVerify(decryptedClass = TestReportManageAppVo.class) + @LogAnnotation(operModul = "检测报告管理-检测报告管理详情", operation = "查询用列表", operDesc = "业务级事件",operType="查询") +// @PreAuthorize("@pms.hasPermission('sys:testReport:query')" ) + public ServerResponse getDetailsList(EncryptedReq data) { + PageHelper.startPage(data.getData().getPage(), data.getData().getLimit()); + try { + List list = service.getDetailsList(data.getData()); + PageInfo pageInfo = new PageInfo<>(list); + return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit()); + } catch (Exception e) { + log.error(e.toString(),e); + } + return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit()); + } + + + @PostMapping(value = "all") + @LogAnnotation(operModul = "检测报告管理", operation = "查询所有工器具", operDesc = "业务级事件",operType="查询") + public ServerResponse getAll() { + try { + List list = service.listTools(); + return ServerResponse.createSuccess(list); + }catch (Exception e){ + log.error(e.toString(),e); + } + return ServerResponse.createErroe("操作失败"); + } + + @PostMapping(value = "allCustomName") + @LogAnnotation(operModul = "检测报告管理", operation = "查询所有单位", operDesc = "业务级事件",operType="查询") + public ServerResponse getAllCustomName() { + try { + List list = service.getAllCustomName(); + return ServerResponse.createSuccess(list); + }catch (Exception e){ + log.error(e.toString(),e); + } + return ServerResponse.createErroe("操作失败"); + } + + @PostMapping(value = "getTeamSelected") + @LogAnnotation(operModul = "检测报告管理", operation = "查询所有班组", operDesc = "业务级事件",operType="查询") + public ServerResponse getToolsSelected() { + try { + List list = service.getTeamSelected(); + return ServerResponse.createSuccess(list); + }catch (Exception e){ + log.error(e.toString(),e); + } + return ServerResponse.createErroe("操作失败"); + } + + @PostMapping(value = "viewTestData") + @DecryptAndVerify(decryptedClass = TestReportManageAppVo.class) + @LogAnnotation(operModul = "检测报告管理", operation = "试验数据详情", operDesc = "业务级事件", operType = "查询") + public ServerResponse viewTestData(EncryptedReq data) { + return service.viewTestData(data.getData()); + } + + /** + * 下载合格证--word + */ + @GetMapping("/downloadReport") + public void downloadReport(HttpServletRequest request, HttpServletResponse response){ + // 处理请求参数 + TestReportManageAppVo vo = new TestReportManageAppVo(); + vo.setId(Integer.valueOf(request.getParameter("id"))); + vo.setDepartmentId(Integer.valueOf(request.getParameter("departmentId"))); + vo.setSampleTools(request.getParameter("sampleTools")); + vo.setIsHg(request.getParameter("isHg")); + TestReportManageAppVo bean = service.downloadCertificateList(vo); + // 准备数据 + Map map = new HashMap<>(); + map.put("submitLocation", isNull(bean.getSubmitLocation())); + map.put("sampleTools", isNull(bean.getSampleTools())); + map.put("devModule", isNull(bean.getDevModule())); + map.put("devCode", isNull(bean.getDevCode())); + map.put("experTime", isNull(bean.getExperTime())); + map.put("nextExperTime", isNull(bean.getNextExperTime())); + map.put("experUser", isNull(bean.getExperUser())); + map.put("isHg", isNull(bean.getIsHg())); + map.put("customName", isNull(bean.getCustomName())); + + Configuration cfg = new Configuration(Configuration.getVersion()); + cfg.setClassForTemplateLoading(this.getClass(), "/temple"); + + File tempFile = null; + OutputStream out = null; + FileInputStream fis = null; + + try { + // 设置响应头 + response.setCharacterEncoding("utf-8"); + response.setContentType("application/msword"); + response.setHeader("Content-Disposition", "attachment;filename=" + .concat(String.valueOf(URLEncoder.encode("合格证" + DateTimeHelper.getNowDMS() + ".doc", "UTF-8")))); + + // 创建临时文件 + tempFile = createDoc(map, cfg.getTemplate("certificate.ftl")); + + // 读取文件并写入响应 + fis = new FileInputStream(tempFile); + out = response.getOutputStream(); + byte[] buffer = new byte[512]; + int bytesToRead; + while ((bytesToRead = fis.read(buffer)) != -1) { + out.write(buffer, 0, bytesToRead); + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + // 释放资源 + try { + if (fis != null) { + fis.close(); + } + if (out != null) { + out.flush(); + out.close(); + } + // 删除临时文件 + if (tempFile != null && tempFile.exists()) { + tempFile.delete(); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + + /** + * 创建临时word文件 + */ + private File createDoc(Map map, Template template) { + File f = null; + try { + // 创建临时文件 + f = File.createTempFile("certificate_", ".doc"); + Writer w = new OutputStreamWriter(new FileOutputStream(f), "utf-8"); + template.process(map, w); + w.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + return f; + } + + /** + * 判断字符串是否为空或者null,如果是则返回'',否则返回原字符串 + */ + public static String isNull(String str) { + if (str == null || "".equals(str)) { + return ""; + } + return str; + } + + + /** + * 一级页面--检测报告打包下载 + */ + @GetMapping("/download") + public ResponseEntity downloadFile(HttpServletRequest request) { + File tempZipFile = null; + try { + // Return the ZIP file + return service.downloadFile(request, tempZipFile); + } catch (IOException e) { + e.printStackTrace(); + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + }finally { + // Ensure the temporary file is deleted if not already done + if (tempZipFile != null && tempZipFile.exists()) { + tempZipFile.delete(); + } + } + } + + + + /** + * 检测报告附页Excel文件生成,转base64 + */ + @PostMapping(value = "testReportExcelBase64") + @DecryptAndVerify(decryptedClass = TestReportManageAppVo.class) + public ServerResponse testReportExcelBase64(EncryptedReq bean) { + return service.testReportExcelBase64(bean.getData()); + } + +} diff --git a/src/main/java/com/bonus/aqgqj/app/dao/ExamineAppMapper.java b/src/main/java/com/bonus/aqgqj/app/dao/ExamineAppMapper.java index 585892a..98e269c 100644 --- a/src/main/java/com/bonus/aqgqj/app/dao/ExamineAppMapper.java +++ b/src/main/java/com/bonus/aqgqj/app/dao/ExamineAppMapper.java @@ -109,4 +109,12 @@ public interface ExamineAppMapper { * @date 2024/7/30 18:50 */ String getExperIsErValue(@Param("type") int type,@Param("id") Long id); + + /** + * 根据sampleId查询试验id + * @param id + * @param audtiStatus + * @return + */ + List getDetailIdBySampleId(@Param("id") Long id,@Param("audtiStatus") String audtiStatus); } diff --git a/src/main/java/com/bonus/aqgqj/app/dao/ExperimentalAppMapper.java b/src/main/java/com/bonus/aqgqj/app/dao/ExperimentalAppMapper.java index 1811595..36f883c 100644 --- a/src/main/java/com/bonus/aqgqj/app/dao/ExperimentalAppMapper.java +++ b/src/main/java/com/bonus/aqgqj/app/dao/ExperimentalAppMapper.java @@ -169,7 +169,7 @@ public interface ExperimentalAppMapper { * @author cwchen * @date 2024/7/21 19:48 */ - void addExperDevItem(List experDevItemVos); + void addExperDevItem(List experDevItemVos); /** * 试验数据详情 @@ -242,46 +242,46 @@ public interface ExperimentalAppMapper { */ List getExperDev(ParamsAppDto dto); -// /** -// * 修改试验信息数据 -// * -// * @param vo -// * @return void -// * @author cwchen -// * @date 2024/7/22 0:02 -// */ -// void updateExper(TestAppVo vo); -// -// /** -// * 获取试验样品设备ID -// * -// * @param id -// * @return List -// * @author cwchen -// * @date 2024/7/22 0:18 -// */ -// List getExperDevIds(Long id); -// -// /** -// * 获取设备试验项信息ID -// * -// * @param list -// * @return List -// * @author cwchen -// * @date 2024/7/22 0:18 -// */ -// List getExperDevItems(List list); -// -// /** -// * 删除试验依据 -// * -// * @param id -// * @return void -// * @author cwchen -// * @date 2024/7/22 0:24 -// */ -// void delConfigBasis(Long id); -// + /** + * 修改试验信息数据 + * + * @param vo + * @return void + * @author cwchen + * @date 2024/7/22 0:02 + */ + void updateExper(TestAppVo vo); + + /** + * 获取试验样品设备ID + * + * @param id + * @return List + * @author cwchen + * @date 2024/7/22 0:18 + */ + List getExperDevIds(Long id); + + /** + * 获取设备试验项信息ID + * + * @param list + * @return List + * @author cwchen + * @date 2024/7/22 0:18 + */ + List getExperDevItems(List list); + + /** + * 删除试验依据 + * + * @param id + * @return void + * @author cwchen + * @date 2024/7/22 0:24 + */ + void delConfigBasis(Long id); + // /** // * 删除试验设备 // * @@ -291,37 +291,37 @@ public interface ExperimentalAppMapper { // * @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 list); -// -// /** -// * 删除设备试验项数据 -// * -// * @param list -// * @return void -// * @author cwchen -// * @date 2024/7/22 0:24 -// */ -// void delExperDevItem(List list); -// + + /** + * 删除试验样品设备 + * + * @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 list); + + /** + * 删除设备试验项数据 + * + * @param list + * @return void + * @author cwchen + * @date 2024/7/22 0:24 + */ + void delExperDevItem(List list); + // /** // * 删除试验信息 // * @@ -372,16 +372,16 @@ public interface ExperimentalAppMapper { // */ // @MapKey("id") // List> getExperDevItemsNum(Long experId); -// -// /** -// * 判断是否处于审核流程中的数据 -// * -// * @param id -// * @return int -// * @author cwchen -// * @date 2024/7/22 14:13 -// */ -// int isCheck(Long id); + + /** + * 判断是否处于审核流程中的数据 + * + * @param id + * @return int + * @author cwchen + * @date 2024/7/22 14:13 + */ + int isCheck(Long id); /** * 判断提交数据中是否存在流程数据或者存在待试验项 @@ -396,12 +396,12 @@ public interface ExperimentalAppMapper { /** * 更新收样表中的状态为待审阅 * - * @param list + * @param id * @return void * @author cwchen * @date 2024/7/22 15:33 */ - void updateSampleStatus(List list); + void updateSampleStatus(Long id); /** * 更新试验表中数据为待审阅 @@ -447,4 +447,11 @@ public interface ExperimentalAppMapper { * @param vo */ void updateExperMony(TestAppVo vo); + + /** + * 获取是否全部提交审阅 + * @param id + * @return int + */ + int isAllSubmit(Long id); } diff --git a/src/main/java/com/bonus/aqgqj/app/dao/TestReportManageAppDao.java b/src/main/java/com/bonus/aqgqj/app/dao/TestReportManageAppDao.java new file mode 100644 index 0000000..6286deb --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/app/dao/TestReportManageAppDao.java @@ -0,0 +1,129 @@ +package com.bonus.aqgqj.app.dao; + +import com.bonus.aqgqj.app.entity.TestReportManageAppVo; +import com.bonus.aqgqj.basis.entity.vo.ConfigItemVo; +import com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo; +import com.bonus.aqgqj.basis.entity.vo.ExperBasisVo; +import com.bonus.aqgqj.basis.entity.vo.ExperDevVo; +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * @author hay + */ +@Mapper +public interface TestReportManageAppDao { + + /** + * 查询列表 + * @param bean + * @return + */ + List list(TestReportManageAppVo bean); + + /** + * 获取工器具 + * @param id + * @return + */ + String getSampleTools(Integer id); + + /** + * 获取详情列表 + * @param data + * @return + */ + List getDetailsList(TestReportManageAppVo data); + + /** + * 获取工器具 + * @return + */ + List listTools(); + + /** + * 获取所有单位名称 + * @return + */ + List getAllCustomName(); + + /** + * 获取设备编码 + * @param nowDate + * @return + */ + String selectCustomerCode(String nowDate); + + /** + * 获取班组 + * @return + */ + List getTeamSelected(); + + /** + * 获取当前年月 报告编号 + * @param nowDate + * @return + */ + String getReportCode(String nowDate); + + /** + * 修改报告编号 + * @param dto + * @return + */ + int updateReportCode(TestReportManageAppVo dto); + + /** + * 获取设备编号与结果 + * @param dto + * @return + */ + @MapKey("devCode") + List> getExperDevItems(TestReportManageAppVo dto); + + /** + * 试验项信息 + * @param dto + * @return + */ + List getExperItems(TestReportManageAppVo dto); + + /** + * 试验项内容信息 + * @param id + * @return + */ + List getExperItem(Long id); + + /** + * 试验样品设备 + * @param dto + * @return + */ + List getExperDev(TestReportManageAppVo dto); + + /** + * 试验依据信息 + * @param dto + * @return + */ + List getConfigBasis(TestReportManageAppVo dto); + + /** + * 获取试验信息 + * @param dto + * @return + */ + TestReportManageAppVo getTestData(TestReportManageAppVo dto); + + /** + * 获取证书列表 + * @param data + * @return + */ + TestReportManageAppVo downloadCertificateList(TestReportManageAppVo data); +} diff --git a/src/main/java/com/bonus/aqgqj/app/entity/ExperDevAppVo.java b/src/main/java/com/bonus/aqgqj/app/entity/ExperDevAppVo.java index 38ed2f5..54b9a68 100644 --- a/src/main/java/com/bonus/aqgqj/app/entity/ExperDevAppVo.java +++ b/src/main/java/com/bonus/aqgqj/app/entity/ExperDevAppVo.java @@ -25,6 +25,8 @@ public class ExperDevAppVo { @NotNull(message = "收样设备id不能为空", groups = {Query.class}) private Long devId; + private String devTypeName; + /**客户自编号*/ @NotBlank(message = "客户自编号不能为空", groups = {Query.class}) @Length(max = 32, message = "编号字符长度不能超过32", groups = {Query.class}) diff --git a/src/main/java/com/bonus/aqgqj/app/entity/ExperDevItemAppVo.java b/src/main/java/com/bonus/aqgqj/app/entity/ExperDevItemAppVo.java new file mode 100644 index 0000000..ef8e25b --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/app/entity/ExperDevItemAppVo.java @@ -0,0 +1,27 @@ +package com.bonus.aqgqj.app.entity; + +import lombok.Data; + +/** + * @className:ExperDevItemVo + * @author:cwchen + * @date:2024-07-21-19:03 + * @version:1.0 + * @description:设备试验项内容数据-vo + */ +@Data +public class ExperDevItemAppVo { + + /**id*/ + private Long id; + /**试验项id*/ + private Long itemsId; + /**试验内容id*/ + private Long itemId; + /**实验设备id*/ + private Long devId; + /** 试验项目名称*/ + private String itemName; + /**试验项值*/ + private String itemVal; +} diff --git a/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalAppVo.java b/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalAppVo.java index 02fc818..fb2fe52 100644 --- a/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalAppVo.java +++ b/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalAppVo.java @@ -17,6 +17,12 @@ public class ExperimentalAppVo { * id */ private Long id; + + /** + * 试验id + */ + private String ids; + /** * 送样单位 */ diff --git a/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalDetailAppVo.java b/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalDetailAppVo.java index 2f2608e..c743c27 100644 --- a/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalDetailAppVo.java +++ b/src/main/java/com/bonus/aqgqj/app/entity/ExperimentalDetailAppVo.java @@ -62,9 +62,24 @@ public class ExperimentalDetailAppVo { private String causeOfRejection; /** - * 状态 + * 状态 默认0 (实验完成)待提交 1 待审阅 2 待审核 3 待审批 4 审批通过 */ - private String status; + private Integer status; + + /** + * 审核状态 0 待审核 1审核通过 2 审阅不通过 3审核不同过 4审批未通过 + */ + private Integer auditStatus; + + /** + * 是否二次审阅 null:不是 1.是 + */ + private Integer isEr; + + /** + * 状态结果 待提交、待审阅、待重新审阅…… + */ + private String statusResult; /** * 试验人员 diff --git a/src/main/java/com/bonus/aqgqj/app/entity/TestReportManageAppVo.java b/src/main/java/com/bonus/aqgqj/app/entity/TestReportManageAppVo.java new file mode 100644 index 0000000..02a01c7 --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/app/entity/TestReportManageAppVo.java @@ -0,0 +1,235 @@ +package com.bonus.aqgqj.app.entity; + +import com.bonus.aqgqj.base.entity.PageEntity; +import com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo; +import com.bonus.aqgqj.basis.entity.vo.ExperBasisVo; +import com.bonus.aqgqj.basis.entity.vo.ExperDevVo; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo; +import lombok.Data; + +import java.util.List; + +/** + * 工器具个体管理 + * @author hay + */ +@Data +public class TestReportManageAppVo extends PageEntity { + + private static final long serialVersionUID = -6525908145032868837L; + + private Integer id; + + private String ids; + + /** + * 名称 + */ + private String name; + + /** + * 送样单位id + */ + private Integer customId; + + /** + * 送样单位 + */ + private String customName; + + /** + * 送样部门id + */ + private Integer departmentId; + + /** + * 送样部门 + */ + private String sampleDepartment; + + /** + * 送样人 + */ + private String sampleUser; + + /** + * 送样时间 + */ + private String sampleTime; + + /** + * 送样设备id + */ + private Integer sampleToolsId; + + /** + * 送样设备 + */ + private String sampleTools; + + /** + * 收样人 + */ + private String collectSamplesUser; + + /** + * 收样时间 + */ + private String collectSamplesTime; + + /** + * 班组Id + */ + private Integer teamId; + + /** + * 班组 + */ + private String teamName; + + /** + * 设备编号 (手填/扫码) + */ + private String devCode; + + /** + * 设备类型编码 + */ + private String devTypeCode; + + /** + * 客户自编号(设备编码--自动生成) + */ + private String customerCode; + + /** + * 生产厂家 + */ + private String factoryName; + + /** + * 生产日期 + */ + private String manufactureDate; + + /** + * 设备规格 + */ + private String devModule; + + /** + * 试验日期 + */ + private String experTime; + + /** + * 下次试验日期 + */ + private String nextExperTime; + + /** + * 试验人员 + */ + private String experUser; + + /** + * 试验结论 + */ + private String experConclu; + + /** + * 关键字 + */ + private String keyWord; + + private String paramsList; + + /** + * 创建人 + */ + private Integer createBy; + + /** + * 试验项内容数量 + */ + private Integer experItemNum; + + /** + * 样品数量 + */ + private Integer devNum; + + /** + * 报告编号 + */ + private String reportCode; + + /** + * 是否合格 + */ + private String isHg; + + /** + * 检测时间 + */ + private String detectionTime; + + private List sampleList; + + /** + * 开始时间 + */ + private String startTime; + + /** + * 结束时间 + */ + private String endTime; + + /** + * 备注 + */ + private String remarks; + + /** + * 试验标准 + */ + private String experStand; + + /** + * 检测设备 + */ + private String devTypeName; + + /** + * 技术要求 + */ + private String technicalRequirements; + + /** + * 试验依据 + */ + private List basisVos; + + /** + * 试验项 + */ + private List configItemsVos; + + /** + * 试验样品设备list + */ + private List experDevVos; + + /** + * 实验地点 + */ + private String submitLocation; + + /** + * 生成时间 + */ + private String createTime; + + +} diff --git a/src/main/java/com/bonus/aqgqj/app/service/ExperimentalAppService.java b/src/main/java/com/bonus/aqgqj/app/service/ExperimentalAppService.java index 25ebd65..3f404bb 100644 --- a/src/main/java/com/bonus/aqgqj/app/service/ExperimentalAppService.java +++ b/src/main/java/com/bonus/aqgqj/app/service/ExperimentalAppService.java @@ -53,17 +53,17 @@ public interface ExperimentalAppService { * @date 2024/7/20 15:42 */ ServerResponse addTestData(TestAppVo data); -// -// /** -// * 修改试验数据 -// * -// * @param data -// * @return ServerResponse -// * @author cwchen -// * @date 2024/7/21 20:06 -// */ -// ServerResponse editTestData(TestAppVo data); -// + + /** + * 修改试验数据 + * + * @param data + * @return ServerResponse + * @author cwchen + * @date 2024/7/21 20:06 + */ + ServerResponse editTestData(TestAppVo data); + // /** // * 删除试验数据 // * diff --git a/src/main/java/com/bonus/aqgqj/app/service/TestReportManageAppService.java b/src/main/java/com/bonus/aqgqj/app/service/TestReportManageAppService.java new file mode 100644 index 0000000..e57e7ae --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/app/service/TestReportManageAppService.java @@ -0,0 +1,86 @@ +package com.bonus.aqgqj.app.service; + +import com.bonus.aqgqj.app.entity.TestReportManageAppVo; +import com.bonus.aqgqj.utils.ServerResponse; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.ResponseEntity; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.IOException; +import java.util.List; + +/** + * 检测报告管理 + * @author hay + */ +public interface TestReportManageAppService { + /** + * 查询列表 + * @param bean + * @return + */ + List list(TestReportManageAppVo bean); + + /** + * 详情列表 + * @param data + * @return + */ + List getDetailsList(TestReportManageAppVo data); + + /** + * 工器具列表 + * @return + */ + List listTools(); + + /** + * 单位列表 + * @return + */ + List getAllCustomName(); + + /** + * 获取所有班组数据 + * @return + */ + List getTeamSelected(); + + /** + * 试验数据详情 + * @param data + * @return + */ + ServerResponse viewTestData(TestReportManageAppVo data); + + /** + * 合格证下载 + * @param data + * @return + */ + TestReportManageAppVo downloadCertificateList(TestReportManageAppVo data); + + /** + * 检测报告下载 + * @param data + * @return + */ + ServerResponse download(TestReportManageAppVo data); + + /** + * 检测报告下载 + * @param request + * @param tempZipFile + * @throws IOException + * @return + */ + ResponseEntity downloadFile(HttpServletRequest request, File tempZipFile) throws IOException; + + /** + * 检测报告附页Excel文件生成,转base64 + * @param data + * @return + */ + ServerResponse testReportExcelBase64(TestReportManageAppVo data); +} diff --git a/src/main/java/com/bonus/aqgqj/app/service/impl/ExamineAppServiceImpl.java b/src/main/java/com/bonus/aqgqj/app/service/impl/ExamineAppServiceImpl.java index bf252f8..968c260 100644 --- a/src/main/java/com/bonus/aqgqj/app/service/impl/ExamineAppServiceImpl.java +++ b/src/main/java/com/bonus/aqgqj/app/service/impl/ExamineAppServiceImpl.java @@ -52,6 +52,17 @@ public class ExamineAppServiceImpl implements ExamineAppService { List list = new ArrayList<>(); try { list = mapper.getList(dto); + if (list.size() > 0) { + //查询详情里需要审核的id + for (int i = 0; i < list.size(); i++) { + ExperimentalAppVo experimentalAppVo = list.get(i); + if ("待重新审阅".equals(experimentalAppVo.getAudtiStatus())) { + experimentalAppVo.setAudtiStatus("待审阅"); + } + List list1 = mapper.getDetailIdBySampleId(experimentalAppVo.getId(),experimentalAppVo.getAudtiStatus()); + list.get(i).setIds(list1.get(0).getIds()); + } + } } catch (Exception e) { log.error(e.toString(), e); } diff --git a/src/main/java/com/bonus/aqgqj/app/service/impl/ExperimentalAppServiceImpl.java b/src/main/java/com/bonus/aqgqj/app/service/impl/ExperimentalAppServiceImpl.java index 1ba65a8..8bb5a13 100644 --- a/src/main/java/com/bonus/aqgqj/app/service/impl/ExperimentalAppServiceImpl.java +++ b/src/main/java/com/bonus/aqgqj/app/service/impl/ExperimentalAppServiceImpl.java @@ -171,7 +171,7 @@ public class ExperimentalAppServiceImpl implements ExperimentalAppService { for (ExperDevItemsAppVo experDevItemsVo : experDevItemsVos) { // 添加设备试验项信息 mapper.addExperDevItems(experDevItemsVo); - List experDevItemVos = setExperDevItemList(vo.getExperDevVos().get(i), vo, experDevItemsVo); + List experDevItemVos = setExperDevItemList(vo.getExperDevVos().get(i), vo, experDevItemsVo); // 添加设备试验项数据 mapper.addExperDevItem(experDevItemVos); } @@ -193,94 +193,94 @@ public class ExperimentalAppServiceImpl implements ExperimentalAppService { return ServerResponse.createBySuccessMsg("操作成功"); } -// -// @Override -// @Transactional(rollbackFor = Exception.class) -// public ServerResponse editTestData(TestAppVo 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, TestAppVo.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); -// } -// TestAppVo testAppVo = handleConfigItem(vo); -// if (testAppVo == null) { -// return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数异常"); -// } -// // 试验主要设备、试验依据、试验项校验 -// String result2 = singleValidators(testAppVo); -// 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 experDevIds = mapper.getExperDevIds(vo.getId()); -// List 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 experDevItemsVos = setExperDevItemsList(vo.getExperDevVos().get(i), vo); -// for (ExperDevItemsVo experDevItemsVo : experDevItemsVos) { -// -// mapper.addExperDevItems(experDevItemsVo); -// List 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 editTestData(TestAppVo 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, TestAppVo.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); + } + TestAppVo testAppVo = handleConfigItem(vo); + if (testAppVo == null) { + return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数异常"); + } + // 试验主要设备、试验依据、试验项校验 + String result2 = singleValidators(testAppVo); + if (StringUtils.isNotBlank(result2)) { + return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result2); + } + //论实验全部金额 + BigDecimal allMony= new BigDecimal("0"); + //获取试验项金额 + BigDecimal bigDecimal = new BigDecimal("0"); + for (ConfigItemsAppVo configItemsVo : vo.getConfigItemsVos()) { + // 添加试验项数据 + BigDecimal amount = new BigDecimal(configItemsVo.getAmount()); + bigDecimal=bigDecimal.add(amount); + } + // 删除试验依据、试验样品设备、设备试验项信息、设备试验项数据 + List experDevIds = mapper.getExperDevIds(vo.getId()); + List 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++) { + ExperDevAppVo 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 experDevItemsVos = setExperDevItemsList(vo.getExperDevVos().get(i), vo); + for (ExperDevItemsAppVo experDevItemsVo : experDevItemsVos) { + + mapper.addExperDevItems(experDevItemsVo); + List 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(ParamsAppDto dto) { @@ -352,23 +352,38 @@ public class ExperimentalAppServiceImpl implements ExperimentalAppService { @Transactional(rollbackFor = Exception.class) public ServerResponse commitCheckTestData(ParamsAppDto dto) { try { - // 判断是否提交空数据 - if (dto.getIds() == null || dto.getIds().length == 0) { + if (dto.getId() == null || dto.getIds() == null || dto.getIds().length == 0) { return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "未提交审查数据"); } if (!SystemUtils.isExperimentalTeam()) { return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "非试验班组,无法提交审查数据"); } - // 判断提交数据中是否存在流程数据或者存在待试验项 List list = Arrays.asList(dto.getIds()); - int result = mapper.isNotEditData(list); - if (result > 0) { - return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "提交数据中存在待试验项或处于审核流程或已试验结束"); - } - // 更新收样表中的状态为待审阅 - mapper.updateSampleStatus(list); - // 更新试验表中数据为待审阅 + //先更新tb_exper表中数据为待审阅 mapper.updateExperStatus(list); + //在查询tb_exper中是否全部为待审阅 + int res = mapper.isAllSubmit(dto.getId()); + if (res<=0){ + //如果全部为待审阅,更新收样表中的状态为待审阅 + mapper.updateSampleStatus(dto.getId()); + } +// // 判断是否提交空数据 +// if (dto.getIds() == null || dto.getIds().length == 0) { +// return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "未提交审查数据"); +// } +// if (!SystemUtils.isExperimentalTeam()) { +// return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "非试验班组,无法提交审查数据"); +// } +// // 判断提交数据中是否存在流程数据或者存在待试验项 +// List 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(); @@ -548,15 +563,15 @@ public class ExperimentalAppServiceImpl implements ExperimentalAppService { * @author cwchen * @date 2024/7/21 19:17 */ - public List setExperDevItemList(ExperDevAppVo experDevVo, TestAppVo vo, ExperDevItemsAppVo experDevItemsVo) { - List experDevItemList = new ArrayList<>(); + public List setExperDevItemList(ExperDevAppVo experDevVo, TestAppVo vo, ExperDevItemsAppVo experDevItemsVo) { + List experDevItemList = new ArrayList<>(); int index = 0; for (int i = 0; i < vo.getConfigItemsVos().size(); i++) { ConfigItemsAppVo configItemsVo = vo.getConfigItemsVos().get(i); - List experDevItemVos = new ArrayList<>(); + List experDevItemVos = new ArrayList<>(); for (int j = 0; j < configItemsVo.getItemList().size(); j++) { ConfigItemAppVo configItemVo = configItemsVo.getItemList().get(j); - ExperDevItemVo experDevItemVo = new ExperDevItemVo(); + ExperDevItemAppVo experDevItemVo = new ExperDevItemAppVo(); experDevItemVo.setItemsId(configItemsVo.getId()); experDevItemVo.setItemId(configItemVo.getId()); experDevItemVo.setDevId(experDevItemsVo.getId()); diff --git a/src/main/java/com/bonus/aqgqj/app/service/impl/TestReportManageAppServiceImpl.java b/src/main/java/com/bonus/aqgqj/app/service/impl/TestReportManageAppServiceImpl.java new file mode 100644 index 0000000..d104cb6 --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/app/service/impl/TestReportManageAppServiceImpl.java @@ -0,0 +1,682 @@ +package com.bonus.aqgqj.app.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.bonus.aqgqj.app.dao.TestReportManageAppDao; +import com.bonus.aqgqj.app.entity.TestReportManageAppVo; +import com.bonus.aqgqj.app.service.TestReportManageAppService; +import com.bonus.aqgqj.basis.entity.vo.*; +import com.bonus.aqgqj.basis.service.TestReportManageService; +import com.bonus.aqgqj.utils.DateTimeHelper; +import com.bonus.aqgqj.utils.ListHelper; +import com.bonus.aqgqj.utils.ServerResponse; +import com.bonus.aqgqj.utils.StringHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** +* @description 检测报告管理 +* @author hay +*/ +@Slf4j +@Service +public class TestReportManageAppServiceImpl implements TestReportManageAppService { + + + @Resource + private TestReportManageAppDao testReportManageAppDao; + + /** + * 查询列表 + * @param bean + * @return + */ + @Override + public List list(TestReportManageAppVo bean) { + List list = testReportManageAppDao.list(bean); + return list; + } + + /** + * 查询详情列表 + * @param data + * @return + */ + @Override + public List getDetailsList(TestReportManageAppVo data) { + List list = testReportManageAppDao.getDetailsList(data); + //如果没有报告编号,需要生成报告编号 + for (TestReportManageAppVo dto : list){ + //将每条数据下的设备编号,试验结果加进去 + List sampleList = new ArrayList<>(); + List> mapList = testReportManageAppDao.getExperDevItems(dto); + JSONArray jsonArray = new JSONArray(); + jsonArray.addAll(mapList); + sampleList = jsonArray.toJavaList(ExperimentalDetailVo.Sample.class); + dto.setSampleList(sampleList); + if (StringHelper.isEmpty(dto.getReportCode())){ + //生成报告编号 + String reportCode = generateReportCode(dto); + dto.setReportCode(reportCode); + } + } + return list; + } + + /** + * 生成报告编号 + * 报告编号生成规则:ML/BG-YYYY-MMNNN-DD-QQ + *  ML/BG:明丽/报告 + *  YYYY:年份(4位数字),表示报告生成的年份 + *  MM:月份(2位数字),表示报告生成的月份 + *  NNN:报告序号,每个月从001开始,递增生成。每月的序号重新计数。 + *  DD:部门的随机排序(2位数字),每个部门内部的随机编号 + *  QQ:数量(2位数字),表示报告中设备的数量 + * @param dto + * @return + */ + private String generateReportCode(TestReportManageAppVo dto) { + //获取当前年 yyyy + String nowYear = DateTimeHelper.getNowYear(); + //获取当前月 MM + String nowMonth = DateTimeHelper.getNowMonths(); + //查询当前年月的序号 + String code = testReportManageAppDao.getReportCode(nowYear+"-"+nowMonth); + if (StringHelper.isNotEmpty(code)){ + int num = Integer.parseInt(code); + num++; + code = "ML/BG-"+nowYear+"-"+nowMonth+String.format("%03d",num)+"-00-"+String.format("%02d",dto.getDevNum()); + + }else { + code = "ML/BG-"+nowYear+"-"+nowMonth+"001"+"-00-"+String.format("%02d",dto.getDevNum()); + } + //将生成的报告编号保存到数据库 + dto.setReportCode(code); + int res = testReportManageAppDao.updateReportCode(dto); + return code; + } + + @Override + public List listTools() { + List list = testReportManageAppDao.listTools(); + return list; + } + + /** + * 查询所有单位列表 + * @return + */ + @Override + public List getAllCustomName() { + return testReportManageAppDao.getAllCustomName(); + } + + /** + * 查询所有班组 + * @return + */ + @Override + public List getTeamSelected() { + return testReportManageAppDao.getTeamSelected(); + } + @Override + public ServerResponse viewTestData(TestReportManageAppVo dto) { + TestReportManageAppVo testVo = new TestReportManageAppVo(); + try { + testVo= testReportManageAppDao.getTestData(dto); + List experBasisVos = testReportManageAppDao.getConfigBasis(dto); + List configItemsVos = testReportManageAppDao.getExperItems(dto); + for (ConfigItemsVo configItemsVo : configItemsVos) { + List configItemVos = testReportManageAppDao.getExperItem(configItemsVo.getId()); + configItemsVo.setItemList(configItemVos); + } + List experDevVos = testReportManageAppDao.getExperDev(dto); + testVo.setBasisVos(experBasisVos); + testVo.setConfigItemsVos(configItemsVos); + testVo.setExperDevVos(experDevVos); + return ServerResponse.createSuccess(testVo); + } catch (Exception e) { + e.printStackTrace(); + return ServerResponse.createSuccess(""); + } + } + + @Override + public TestReportManageAppVo downloadCertificateList(TestReportManageAppVo data) { + return testReportManageAppDao.downloadCertificateList(data); + } + + @Override + public ServerResponse download(TestReportManageAppVo data) { + //根据选择的id获取详情数据 + TestReportManageAppVo bean = new TestReportManageAppVo(); + bean.setId(data.getId()); + List list = getDetailsList(bean); + //查询详情里所有数据的检测报告 + for (TestReportManageAppVo dto : list){ + //根据试验id、设备类型、是否合格、部门id来查询每个检测报告 + ServerResponse serverResponse = viewTestData(dto); + if (serverResponse.isSuccess()){ + File zipFile = new File("检测报告_"+DateTimeHelper.getNowDMS()+".zip"); + try (FileOutputStream fos = new FileOutputStream(zipFile); + ZipOutputStream zos = new ZipOutputStream(fos)) { + TestReportManageAppVo testVo = (TestReportManageAppVo) serverResponse.getData(); + //将数据传给检测报告生成的方法 + try { + generateReport(testVo,zos); + } catch (Exception e){ + e.printStackTrace(); + } + }catch (IOException e){ + e.printStackTrace(); + } + } + } + return null; + } + + @Override + public ResponseEntity downloadFile(HttpServletRequest request, File tempZipFile) throws IOException { + String ids = request.getParameter("ids"); + if (StringHelper.isNotEmpty(ids)) { + String fileNames="检测报告_" + DateTimeHelper.getNowDMS(); + tempZipFile = File.createTempFile(fileNames, ".zip"); + tempZipFile.deleteOnExit(); + try (FileOutputStream fos = new FileOutputStream(tempZipFile); + ZipOutputStream zos = new ZipOutputStream(fos)) { + //拆分用逗号分隔的数据 + String[] idsArray = ids.split(","); + for (String id : idsArray) { + TestReportManageAppVo dto = new TestReportManageAppVo(); + dto.setId(Integer.parseInt(id)); + //查询每条数据里面的详细数据 + List list = getDetailsList(dto); + //查询详情里所有数据的检测报告 + for (TestReportManageAppVo dtos : list) { + //根据试验id、设备类型、是否合格、部门id来查询每个检测报告 + ServerResponse serverResponse = viewTestData(dtos); + if (serverResponse.isSuccess()) { + TestReportManageAppVo testVo = (TestReportManageAppVo) serverResponse.getData(); + log.info("sj--->{}", testVo); + //生成检测报告 + generateReport(testVo, zos); + } + + } + } + } + HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + fileNames+".zip"); + return new ResponseEntity<>(new FileSystemResource(tempZipFile), headers, HttpStatus.OK); + } + return null; + } + + /** + * 检测报告附页Excel文件生成,转base64 + */ + @Override + public ServerResponse testReportExcelBase64(TestReportManageAppVo data) { + //根据试验id、设备类型、是否合格、部门id来查询检测报告 + ServerResponse serverResponse = viewTestData(data); + if (serverResponse.isSuccess()) { + TestReportManageAppVo testVo = (TestReportManageAppVo) serverResponse.getData(); + //将数据传给检测报告生成的方法 + try { + String base64Excel = generateReport(testVo,null); + // 返回 Base64 字符串 + return ServerResponse.createSuccess(base64Excel); + } catch (Exception e) { + e.printStackTrace(); + } + } + return ServerResponse.createErroe("查看失败"); + } + + /** + * 生成检测报告 + */ + public String generateReport(TestReportManageAppVo bean,ZipOutputStream zos) throws IOException { + //先计算出总共有多少列和动态生成的有多少列 + //总列数 + int totalNum = 0; + //动态生成的列数 + int trendsNum = 0; + //获取所有检测项目 + List configItemsVos = bean.getConfigItemsVos(); + for (ConfigItemsVo configItemsVo : configItemsVos){ + List itemList = configItemsVo.getItemList(); + trendsNum += itemList.size(); + } + List basisVos = bean.getBasisVos(); + String yj=""; + for (int i = 0; i < basisVos.size(); i++){ + yj+=(i + 1)+"、"+basisVos.get(i).getBasisName() + "\n"; + } + totalNum = trendsNum + 6; + List devList=bean.getExperDevVos(); + + + + XSSFWorkbook workbook = new XSSFWorkbook(); + Sheet sheet = workbook.createSheet("检测报告"); + + + // 创建样式 + XSSFCellStyle style = workbook.createCellStyle(); + style.setBorderTop(BorderStyle.THIN); + style.setBorderBottom(BorderStyle.THIN); + style.setBorderLeft(BorderStyle.THIN); + style.setBorderRight(BorderStyle.THIN); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + + // 设置每列的宽度为20个字符的宽度 + int widthInCharacters = 15; + int columnCount = totalNum; + + for (int i = 0; i < columnCount; i++) { + // 1/256字符的宽度单位 + sheet.setColumnWidth(i, widthInCharacters * 256); + } + + //第一行 + Row row1 = sheet.createRow(0); + //单元格-创建第一个头 + Cell cell11 = row1.createCell(0); + cell11.setCellValue(bean.getSampleTools()+"检测报告附页"); + //合并全部列 + addMergedRegion(0,0,0,totalNum-1,sheet); + // 应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(0, 0, 0, totalNum-1), style); + cell11.setCellStyle(style); + + + //第二行 + Row row2 = sheet.createRow(1); + Cell cell21 = row2.createCell(0); + cell21.setCellValue("报告编号"); + cell21.setCellStyle(style); + //计算占用行数 + int num21=(totalNum-4)/2; + Cell cell22 = row2.createCell(1); + addMergedRegion(1,1,1,num21,sheet); + // 应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(1, 1, 1, num21), style); + cell22.setCellValue(bean.getReportCode()); + cell22.setCellStyle(style); + + Cell cell23 = row2.createCell(num21+1); + cell23.setCellValue("收样日期"); + cell23.setCellStyle(style); + + Cell cell24 = row2.createCell(num21+2); + cell24.setCellValue(bean.getCollectSamplesTime()); + addMergedRegion(1,1,num21+2,totalNum-3,sheet); + // 应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(1,1,num21+2,totalNum-3), style); + cell24.setCellStyle(style); + + Cell cell25 = row2.createCell(totalNum-2); + cell25.setCellValue("样品数量"); + cell25.setCellStyle(style); + + Cell cell26= row2.createCell(totalNum-1); + cell26.setCellValue(bean.getDevNum()); + cell26.setCellStyle(style); + + + //第三行 + Row row3 = sheet.createRow(2); + Cell cell31 = row3.createCell(0); + cell31.setCellValue("检测设备"); + cell31.setCellStyle(style); + + Cell cell32 = row3.createCell(1); + cell32.setCellValue(bean.getDevTypeName()); + cell32.setCellStyle(style); + addMergedRegion(2,2,1,totalNum-1,sheet); + // 应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(2,2,1,totalNum-1), style); + + + + //第四行 + Row row4= sheet.createRow(3); + + Cell cell41 = row4.createCell(0); + cell41.setCellValue("检测依据"); + cell41.setCellStyle(style); + + Cell cell42 = row4.createCell(1); + cell42.setCellValue(yj); + cell42.setCellStyle(style); + addMergedRegion(3,3,1,totalNum-1,sheet); + // 应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(3,3,1,totalNum-1), style); + + //第5行 //第六行 + Row row5= sheet.createRow(4); + Row row6= sheet.createRow(5); + //第五行//第六号合并 + Cell cell51 = row5.createCell(0); + cell51.setCellValue("序号"); + cell51.setCellStyle(style); + addMergedRegion(4,5,0,0,sheet); + // 应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(4,5,0,0), style); + + Cell cell52 = row5.createCell(1); + cell52.setCellValue("样品编号"); + cell52.setCellStyle(style); + addMergedRegion(4,5,1,1,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(4,5,1,1), style); + Cell cell53 = row5.createCell(2); + cell53.setCellValue("样品信息"); + cell53.setCellStyle(style); + addMergedRegion(4,4,2,5,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(4,4,2,5), style); + //第六行固定数据 + Cell cell62= row6.createCell(2); + cell62.setCellStyle(style); + cell62.setCellValue("客户自编号"); + Cell cell63 = row6.createCell(3); + cell63.setCellStyle(style); + cell63.setCellValue("生成厂家"); + Cell cell64 = row6.createCell(4); + cell64.setCellStyle(style); + cell64.setCellValue("生产日期"); + Cell cell65 = row6.createCell(5); + cell65.setCellStyle(style); + cell65.setCellValue("规格型号"); + + //第五第六号非固定数据 + AtomicInteger num= new AtomicInteger(5); + AtomicInteger rowNums= new AtomicInteger(5); + configItemsVos.forEach(vo->{ + List childList=vo.getItemList(); + int rowNum=childList.size(); + num.set(num.get() + 1); + Cell cell54 = row5.createCell(num.get()); + cell54.setCellValue(vo.getExperTypeName()); + cell54.setCellStyle(style); + addMergedRegion(4,4,num.get(),num.get()+rowNum-1,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(4,4,num.get(),num.get()+rowNum-1), style); + num.addAndGet(rowNum-1); + childList.forEach(child->{ + rowNums.set(rowNums.get() + 1); + Cell cell4 = row6.createCell(rowNums.get()); + cell4.setCellStyle(style); + cell4.setCellValue(child.getItemName()); + }); + }); + + AtomicInteger row = new AtomicInteger(5); + AtomicInteger cellNum = new AtomicInteger(0); + AtomicInteger serialNumber = new AtomicInteger(1); // 用于追踪序号 + + if (ListHelper.isNotEmpty(devList)) { + devList.forEach(dev -> { + row.set(row.get() + 1); + cellNum.set(0); // 每次处理新行时重置 cellNum + + Row row7 = sheet.createRow(row.get()); + + // 创建序号列 + Cell row71 = row7.createCell(cellNum.get()); + row71.setCellValue(serialNumber.get()); // 设置序号 + row71.setCellStyle(style); + cellNum.set(cellNum.get() + 1); + + // 更新序号 + serialNumber.set(serialNumber.get() + 1); + + // 处理其他列 + Cell row72 = row7.createCell(cellNum.get()); + row72.setCellValue(dev.getCustomerCode()); + row72.setCellStyle(style); + cellNum.set(cellNum.get() + 1); + + Cell row73 = row7.createCell(cellNum.get()); + row73.setCellValue(dev.getDevCode()); + row73.setCellStyle(style); + cellNum.set(cellNum.get() + 1); + + Cell row74 = row7.createCell(cellNum.get()); + row74.setCellValue(dev.getManufacturer()); + row74.setCellStyle(style); + cellNum.set(cellNum.get() + 1); + + Cell row75 = row7.createCell(cellNum.get()); + row75.setCellValue(dev.getManufactureDate()); + row75.setCellStyle(style); + cellNum.set(cellNum.get() + 1); + + Cell row76 = row7.createCell(cellNum.get()); + row76.setCellValue(dev.getDevModule()); + row76.setCellStyle(style); + cellNum.set(cellNum.get() + 1); + + String val = dev.getDevData(); + JSONArray jsonArray = JSON.parseArray(val); + + jsonArray.forEach(json -> { + Cell row77 = row7.createCell(cellNum.get()); + row77.setCellValue(json.toString()); + row77.setCellStyle(style); + cellNum.set(cellNum.get() + 1); + }); + }); + } + // + row.set(row.get() + 1); + Row row8= sheet.createRow(row.get()); + Cell cell81 = row8.createCell(0); + cell81.setCellValue("技术要求"); + cell81.setCellStyle(style); + + Cell cell82 = row8.createCell(1); + cell82.setCellValue(bean.getExperStand()); + cell82.setCellStyle(style); + addMergedRegion(row.get(),row.get(),1,totalNum-1,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(row.get(),row.get(),1,totalNum-1), style); + + + row.set(row.get() + 1); + Row row9= sheet.createRow(row.get()); + + Cell cell91 = row9.createCell(0); + cell91.setCellValue("检测结论"); + cell91.setCellStyle(style); + + Cell cell92 = row9.createCell(1); + cell92.setCellValue(bean.getExperConclu()); + cell92.setCellStyle(style); + addMergedRegion(row.get(),row.get(),1,totalNum-1,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(row.get(),row.get(),1,totalNum-1), style); + + + row.set(row.get() + 1); + Row row10= sheet.createRow(row.get()); + + Cell cell101 = row10.createCell(0); + cell101.setCellValue("备注"); + cell101.setCellStyle(style); + + Cell cell102 = row10.createCell(1); + cell102.setCellValue(bean.getRemarks()); + cell102.setCellStyle(style); + addMergedRegion(row.get(),row.get(),1,totalNum-1,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(row.get(),row.get(),1,totalNum-1), style); + + + row.set(row.get() + 1); + Row row11= sheet.createRow(row.get()); + + Cell cell111 = row11.createCell(0); + cell111.setCellValue("检测日期"); + cell111.setCellStyle(style); + + Cell cell112 = row11.createCell(1); + cell112.setCellValue(bean.getExperTime()); + cell112.setCellStyle(style); + int num112=(totalNum-2)/2; + addMergedRegion(row.get(),row.get(),1,num112,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(row.get(),row.get(),1,num112), style); + + Cell cell113 = row11.createCell(num112+1); + cell113.setCellValue("下次检测日期"); + cell113.setCellStyle(style); + + Cell cell114= row11.createCell(num112+2); + cell114.setCellValue(bean.getNextExperTime()); + cell114.setCellStyle(style); + addMergedRegion(row.get(),row.get(),num112+2,totalNum-1,sheet); + //应用边框到合并区域 + applyBordersToMergedRegion(sheet, new CellRangeAddress(row.get(),row.get(),num112+2,totalNum-1), style); + + + if (zos!=null){ + // 保存到 ZIP 文件 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + workbook.write(baos); + if (StringHelper.isNotEmpty(bean.getReportCode())){ + //将字符串中“ML/BG-”去除 + bean.setReportCode(bean.getReportCode().replace("ML/BG-","")); + } + ZipEntry entry = new ZipEntry("检测报告_" + bean.getReportCode() + "_"+DateTimeHelper.getNowDMS()+".xlsx"); + zos.putNextEntry(entry); + zos.write(baos.toByteArray()); + zos.closeEntry(); + workbook.close(); + return null; + }else { + // 将 Excel 文档写入字节数组 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + workbook.write(baos); + baos.close(); + byte[] excelBytes = baos.toByteArray(); + + // 将字节数组编码为 Base64 字符串 + String base64Excel = Base64.getEncoder().encodeToString(excelBytes); + // 返回 Base64 字符串 + return base64Excel; + } + } + + /** + * 单元格样式--居中 + */ + public static XSSFCellStyle centerStyle(XSSFWorkbook workbook){ + XSSFCellStyle commonStyle = workbook.createCellStyle(); + commonStyle.setBorderTop(BorderStyle.THIN); + commonStyle.setBorderBottom(BorderStyle.THIN); + commonStyle.setBorderLeft(BorderStyle.THIN); + commonStyle.setBorderRight(BorderStyle.THIN); + // 左右居中 + commonStyle.setAlignment(HorizontalAlignment.CENTER); + // 上下居中 + commonStyle.setVerticalAlignment(VerticalAlignment.CENTER); + commonStyle.setLocked(true); + // 自动换行 + commonStyle.setWrapText(false); + return commonStyle; + } + + /** 应用边框到合并区域 + * + * @param sheet + * @param range + * @param style + */ + // 应用边框到合并区域 + private static void applyBordersToMergedRegion(Sheet sheet, CellRangeAddress range, CellStyle style) { + int firstRow = range.getFirstRow(); + int lastRow = range.getLastRow(); + int firstCol = range.getFirstColumn(); + int lastCol = range.getLastColumn(); + + // 遍历合并区域的所有单元格,并设置边框 + for (int row = firstRow; row <= lastRow; row++) { + Row xssfRow = sheet.getRow(row); + if (xssfRow == null) { + xssfRow = sheet.createRow(row); + } + for (int col = firstCol; col <= lastCol; col++) { + Cell cell = xssfRow.getCell(col); + if (cell == null) { + cell = xssfRow.createCell(col); + } + cell.setCellStyle(style); + } + } + } + + /** + * 合并单元格 + * @param startRow 开始行 + * @param endRow 结束行 + * @param startCol 开始列 + * @param endCol 结束列 + * @param sheet 创建的sheet页 + */ + public static void addMergedRegion(int startRow,int endRow,int startCol,int endCol,Sheet sheet){ + CellRangeAddress cra = new CellRangeAddress(startRow,endRow,startCol,endCol); + sheet.addMergedRegion(cra); + } + + /** + * 设备编号--自动生成 + * 生成规则:YYMMDDNNNN + * YYMMDD:年月日 + * NNNN: 当天收样的流水号,采用四位数字,从0001开始,每天重新计数 + */ + private String customerCodeRule() { + String nowDate = DateTimeHelper.getNowYMD(); + //查询本日收样流水号 + String customerCode = testReportManageAppDao.selectCustomerCode(nowDate); + if (StringHelper.isNotEmpty(customerCode)) { + // 将字符串转换为整数 + int num = Integer.parseInt(customerCode); + // 执行加一操作 + num++; + // 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0 + customerCode = String.format("%04d", num); + } else { + customerCode = "0001"; + } + String code = nowDate + customerCode; + return code; + } + + +} diff --git a/src/main/resources/mappers/app/ExamineAppMapper.xml b/src/main/resources/mappers/app/ExamineAppMapper.xml index dc8cc12..9f8acd1 100644 --- a/src/main/resources/mappers/app/ExamineAppMapper.xml +++ b/src/main/resources/mappers/app/ExamineAppMapper.xml @@ -85,12 +85,16 @@ AND process_status IN (1,2,3) AND audti_status = 0 + GROUP BY ts.id ORDER BY FIELD(audtiStatus, '待审阅','待重新审阅','待审核','待审批') DESC,ts.sample_date DESC @@ -146,13 +150,13 @@ UNION ALL SELECT COUNT(*) FROM tb_exper WHERE sample_id = #{sampleId} AND del_flag = 0 - AND status = 2 AND audit_status = 0 + AND status >1 - AND status = 3 AND audit_status = 0 + AND status > 2 - AND status = 4 AND audit_status = 1 + AND status >3 UNION ALL SELECT COUNT(*) FROM tb_exper WHERE sample_id = #{sampleId} AND del_flag = 0 @@ -175,4 +179,33 @@ SELECT is_er FROM tb_sample WHERE id = #{id} + diff --git a/src/main/resources/mappers/app/ExperimentalAppMapper.xml b/src/main/resources/mappers/app/ExperimentalAppMapper.xml index 582ee1d..7b7133c 100644 --- a/src/main/resources/mappers/app/ExperimentalAppMapper.xml +++ b/src/main/resources/mappers/app/ExperimentalAppMapper.xml @@ -190,15 +190,12 @@ UPDATE tb_sample SET audti_status = 0,process_status = 1,remarks = null - WHERE id IN - - #{item} - + WHERE id =#{id} UPDATE tb_exper SET status = 1,audit_status = 0,audit_user_name = null,audit_time = null,audit_remakr = null - WHERE sample_id IN + WHERE id IN #{item} @@ -322,9 +319,11 @@ @@ -470,21 +470,23 @@ + diff --git a/src/main/resources/mappers/app/SelectAppMapper.xml b/src/main/resources/mappers/app/SelectAppMapper.xml index 36e9582..ed0d1d2 100644 --- a/src/main/resources/mappers/app/SelectAppMapper.xml +++ b/src/main/resources/mappers/app/SelectAppMapper.xml @@ -44,7 +44,9 @@ and dept_id = 1 + SELECT + aa.sample_id as id, + tc.custom_name as customName, + DATE_FORMAT(aa.update_time, '%Y-%m-%d') as createTime, + aa.sampleTools, + aa.devNum, + tt.team_name as teamName + FROM + ( + SELECT + te.sample_id, + MAX(te.update_time) as update_time, + GROUP_CONCAT( DISTINCT te.dev_type_name SEPARATOR '、' ) AS sampleTools, + SUM(te.dev_num) as devNum + FROM + tb_exper te + WHERE + te.del_flag = 0 + and `status`=4 + and audit_status=1 + + and te.dev_type_name like concat('%',#{sampleTools}, '%') + + GROUP BY + sample_id + ) aa + LEFT JOIN tb_sample ts on aa.sample_id=ts.id and ts.del_flag=0 + LEFT JOIN tb_custom tc on tc.id=ts.custom_id and tc.del_flag=0 + LEFT JOIN tb_team tt on tt.id=ts.team_id and tt.del_flag=0 + where 1=1 + + AND ( + tc.custom_name like concat('%', #{keyWord}, '%') OR + tt.team_name like concat('%', #{keyWord}, '%') + ) + + + AND ( + DATE_FORMAT(aa.update_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime} + ) + + + + + + + + + + + + + + + + + \ No newline at end of file