Merge branch 'test' of https://git.will-way.cn/zgty/zt-qms into test

This commit is contained in:
2025-11-19 17:04:28 +08:00
9 changed files with 116 additions and 31 deletions

View File

@@ -64,14 +64,14 @@ public class BusinessSampleDispatchController implements BusinessControllerMarke
return success(true); return success(true);
} }
@PutMapping("/addOrRemoveSample") @PostMapping("/addOrRemoveSample")
@Operation(summary = "增加或移除样品") @Operation(summary = "增加或移除样品")
public CommonResult<Boolean> addOrRemoveSample(@Valid @RequestBody BusinessSampleDispatchSaveReqVO updateReqVO) { public CommonResult<Boolean> addOrRemoveSample(@Valid @RequestBody BusinessSampleDispatchSaveReqVO updateReqVO) {
businessSampleDispatchService.addOrRemoveSample(updateReqVO); businessSampleDispatchService.addOrRemoveSample(updateReqVO);
return success(true); return success(true);
} }
@PutMapping("/addBySampleCode") @PostMapping("/addBySampleCode")
@Operation(summary = "增加或移除样品") @Operation(summary = "增加或移除样品")
public CommonResult<Boolean> addBySampleCode(HttpServletRequest request) { public CommonResult<Boolean> addBySampleCode(HttpServletRequest request) {
String id = request.getParameter("id"); String id = request.getParameter("id");

View File

@@ -35,17 +35,15 @@ public interface BusinessSubSampleMapper extends BaseMapperX<BusinessSubSampleDO
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, BusinessSubSampleDO::getConfigSubSampleId) .leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, BusinessSubSampleDO::getConfigSubSampleId)
.leftJoin(DictionaryBusinessDO.class, DictionaryBusinessDO::getId, BusinessSubSampleDO::getDictionaryBusinessId) .leftJoin(DictionaryBusinessDO.class, DictionaryBusinessDO::getId, BusinessSubSampleDO::getDictionaryBusinessId)
//库位 //库位
// .leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, BusinessSubSampleDO::getConfigWarehouseLocationInfomationId, w->{ .leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, BusinessSubSampleDO::getConfigWarehouseLocationInfomationId)
// w.eq(ConfigWarehouseLocationDO::getWarehouseType, QmsWarehouseLocationConstant.WAREHOUSE_TYPE_SAMPLE); //仓库
// }) .leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId)
// //仓库
// .leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId)
.selectAll(BusinessSubSampleDO.class) .selectAll(BusinessSubSampleDO.class)
.selectAs(DictionaryBusinessDO::getName, BusinessSubSampleExtendRespVO::getDictionaryBusinessName) .selectAs(DictionaryBusinessDO::getName, BusinessSubSampleExtendRespVO::getDictionaryBusinessName)
.selectAs(ConfigSubSampleDO::getIsPrint, BusinessSubSampleExtendRespVO::getIsPrint) .selectAs(ConfigSubSampleDO::getIsPrint, BusinessSubSampleExtendRespVO::getIsPrint)
.selectAs(ConfigSubSampleDO::getPrintTemplate, BusinessSubSampleExtendRespVO::getPrintTemplate) .selectAs(ConfigSubSampleDO::getPrintTemplate, BusinessSubSampleExtendRespVO::getPrintTemplate)
// .selectAs(ConfigWarehouseLocationDO::getCode, BusinessSubSampleExtendRespVO::getWarehouseLocationCode) .selectAs(ConfigWarehouseLocationDO::getCode, BusinessSubSampleExtendRespVO::getWarehouseLocationCode)
// .selectAs(ConfigWarehouseLocationParDO::getName, BusinessSubSampleExtendRespVO::getWarehouseName) .selectAs(ConfigWarehouseLocationParDO::getName, BusinessSubSampleExtendRespVO::getWarehouseName)
.eqIfPresent(BusinessSubSampleDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId()) .eqIfPresent(BusinessSubSampleDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId())
.eqIfPresent(BusinessSubSampleDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId()) .eqIfPresent(BusinessSubSampleDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId())
.eqIfPresent(BusinessSubSampleDO::getConfigSubSampleId, reqVO.getConfigSubSampleId()) .eqIfPresent(BusinessSubSampleDO::getConfigSubSampleId, reqVO.getConfigSubSampleId())
@@ -83,7 +81,7 @@ public interface BusinessSubSampleMapper extends BaseMapperX<BusinessSubSampleDO
.eqIfPresent(BusinessSubSampleDO::getUpdateCount, reqVO.getUpdateCount()) .eqIfPresent(BusinessSubSampleDO::getUpdateCount, reqVO.getUpdateCount())
.eqIfPresent(BusinessSubSampleDO::getRemark, reqVO.getRemark()) .eqIfPresent(BusinessSubSampleDO::getRemark, reqVO.getRemark())
.eqIfPresent(BusinessSubSampleDO::getUpSampleRecordId, reqVO.getUpSampleRecordId()) .eqIfPresent(BusinessSubSampleDO::getUpSampleRecordId, reqVO.getUpSampleRecordId())
// .likeIfPresent(ConfigWarehouseLocationDO::getCode, reqVO.getWarehouseLocationCode()) .likeIfPresent(ConfigWarehouseLocationDO::getCode, reqVO.getWarehouseLocationCode())
.orderByDesc(BusinessSubSampleDO::getSampleFlowNodeTime).orderByAsc(BusinessSubSampleDO::getSampleCode)); .orderByDesc(BusinessSubSampleDO::getSampleFlowNodeTime).orderByAsc(BusinessSubSampleDO::getSampleCode));
} }

View File

@@ -78,6 +78,7 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
if(typeDO == null){ if(typeDO == null){
return error(REPORT_DOCUMENT_TYPE_NOT_EXISTS, "报告类型不存在,请刷新后重试"); return error(REPORT_DOCUMENT_TYPE_NOT_EXISTS, "报告类型不存在,请刷新后重试");
} }
vo.setDocumentTitle(typeDO.getName());
vo.setFlowKey(typeDO.getFlowKey()); vo.setFlowKey(typeDO.getFlowKey());
vo.setDocumentType(typeDO.getDocumentType()); vo.setDocumentType(typeDO.getDocumentType());
vo.setConfigReportTypeId(typeDO.getConfigReportTypeId()); vo.setConfigReportTypeId(typeDO.getConfigReportTypeId());
@@ -244,8 +245,8 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
@Operation(summary = "获得检测报告业务分页") @Operation(summary = "获得检测报告业务分页")
//@PreAuthorize("@ss.hasPermission('qms:report-document-main:query')") //@PreAuthorize("@ss.hasPermission('qms:report-document-main:query')")
public CommonResult<PageResult<ReportDocumentMainRespVO>> getReportDocumentMainPage(@Valid ReportDocumentMainPageReqVO pageReqVO) { public CommonResult<PageResult<ReportDocumentMainRespVO>> getReportDocumentMainPage(@Valid ReportDocumentMainPageReqVO pageReqVO) {
PageResult<ReportDocumentMainDO> pageResult = reportDocumentMainService.getReportDocumentMainPage(pageReqVO); PageResult<ReportDocumentMainRespVO> pageResult = reportDocumentMainService.getReportDocumentMainPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ReportDocumentMainRespVO.class)); return success(pageResult);
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@@ -255,10 +256,9 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
public void exportReportDocumentMainExcel(@Valid ReportDocumentMainPageReqVO pageReqVO, public void exportReportDocumentMainExcel(@Valid ReportDocumentMainPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ReportDocumentMainDO> list = reportDocumentMainService.getReportDocumentMainPage(pageReqVO).getList(); List<ReportDocumentMainRespVO> list = reportDocumentMainService.getReportDocumentMainPage(pageReqVO).getList();
// 导出 Excel // 导出 Excel
ExcelUtils.write(response, "检测报告业务.xls", "数据", ReportDocumentMainRespVO.class, ExcelUtils.write(response, "检测报告业务.xls", "数据", ReportDocumentMainRespVO.class, list);
BeanUtils.toBean(list, ReportDocumentMainRespVO.class));
} }
} }

View File

@@ -113,4 +113,10 @@ public class ReportDocumentMainRespVO {
@Schema(description = "表单设计器模板id") @Schema(description = "表单设计器模板id")
@ExcelProperty("表单设计器模板id") @ExcelProperty("表单设计器模板id")
private Long dataTemplateId; private Long dataTemplateId;
//==============================扩展字段=======================================
@Schema(description = "记录数")
@ExcelProperty("记录数")
private Long detailDataCount;
} }

View File

@@ -3,7 +3,9 @@ package com.zt.plat.module.qms.business.reportdoc.dal.mapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.business.reportdoc.controller.vo.*; import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentDataDO;
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO; import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@@ -21,10 +23,13 @@ import java.util.List;
public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMainDO> { public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMainDO> {
default PageResult<ReportDocumentMainDO> selectPage(ReportDocumentMainPageReqVO reqVO) { default PageResult<ReportDocumentMainRespVO> selectPage(ReportDocumentMainPageReqVO reqVO) {
String flowStatus = reqVO.getFlowStatus(); String flowStatus = reqVO.getFlowStatus();
LambdaQueryWrapperX<ReportDocumentMainDO> wrapper = new LambdaQueryWrapperX<>(); MPJLambdaWrapperX<ReportDocumentMainDO> wrapper = new MPJLambdaWrapperX<>();
wrapper.selectSub(ReportDocumentDataDO.class, s->
s.selectCount(ReportDocumentDataDO::getMainId).eq(ReportDocumentDataDO::getMainId, ReportDocumentMainDO::getId), ReportDocumentMainRespVO::getDetailDataCount);
wrapper.selectAll(ReportDocumentMainDO.class);
wrapper.ne(ReportDocumentMainDO::getCancelFlag, -1); //-1为临时数据 wrapper.ne(ReportDocumentMainDO::getCancelFlag, -1); //-1为临时数据
wrapper.eqIfPresent(ReportDocumentMainDO::getFlowInstanceId, reqVO.getFlowInstanceId()); wrapper.eqIfPresent(ReportDocumentMainDO::getFlowInstanceId, reqVO.getFlowInstanceId());
wrapper.eqIfPresent(ReportDocumentMainDO::getReportDocumentTypeId, reqVO.getReportDocumentTypeId()); wrapper.eqIfPresent(ReportDocumentMainDO::getReportDocumentTypeId, reqVO.getReportDocumentTypeId());
@@ -49,7 +54,7 @@ public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMain
wrapper.betweenIfPresent(ReportDocumentMainDO::getCreateTime, reqVO.getCreateTime()); wrapper.betweenIfPresent(ReportDocumentMainDO::getCreateTime, reqVO.getCreateTime());
wrapper.eqIfPresent(ReportDocumentMainDO::getRemark, reqVO.getRemark()); wrapper.eqIfPresent(ReportDocumentMainDO::getRemark, reqVO.getRemark());
wrapper.orderByDesc(ReportDocumentMainDO::getId); wrapper.orderByDesc(ReportDocumentMainDO::getId);
return selectPage(reqVO, wrapper); return selectJoinPage(reqVO, ReportDocumentMainRespVO.class, wrapper);
} }
} }

View File

@@ -22,6 +22,7 @@ public interface ReportDocumentDataService {
CommonResult<List<JSONObject>> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig); CommonResult<List<JSONObject>> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig);
CommonResult<List<ReportDocumentDataDO>> listByMainDataId(Long mainDataId); CommonResult<List<ReportDocumentDataDO>> listByMainDataId(Long mainDataId);
CommonResult<Long> countMainDataId(Long mainDataId);
CommonResult<String> removeByMainIdAndDetailIds(Long mainDataId, List<Long> detailIds); CommonResult<String> removeByMainIdAndDetailIds(Long mainDataId, List<Long> detailIds);

View File

@@ -50,7 +50,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
private final String name_code_code = "code"; private final String name_code_code = "code";
private final String name_code_split = "split"; private final String name_code_split = "split";
private final String rangeKey = "minLimitValue"; private final String rangeKey = "minLimitValue";
private final String emptyText = "以下为空白";
/* /*
@@ -113,17 +113,20 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
Integer dynamicColCount = 3; Integer dynamicColCount = 3;
Integer fixedColCount = 3; Integer fixedColCount = 3;
Integer maxRowCount = 3; Integer maxRowCount = 3;
String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量 String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量
String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量 String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量
String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数 String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数
String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示 String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示
String hasRemark = jsonObject.getString("hasRemark"); //是否有备注 String hasRemark = jsonObject.getString("hasRemark"); //是否有备注
String hasRange = jsonObject.getString("hasRange"); //是否有检出限 String hasRange = jsonObject.getString("hasRange"); //是否有检出限
String verticalFlag = jsonObject.getString("verticalFlag"); //vertical-纵表, 否则为横表 String verticalFlag = jsonObject.getString("verticalFlag"); //vertical-纵表, 否则为横表
String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项则以检测项作为数据Key
if("1".equals(verticalFlag)){ if("1".equals(verticalFlag)){
return assembleVerticalData(fieldList, dataList, customConfig); return assembleVerticalData(fieldList, dataList, customConfig);
} }
if(!ObjectUtils.isEmpty(fixedFields)){
return assembleFixedFieldsData(fieldList, dataList, customConfig);
}
if(!ObjectUtils.isEmpty(dynamicColCountStr)) dynamicColCount = Integer.parseInt(dynamicColCountStr); if(!ObjectUtils.isEmpty(dynamicColCountStr)) dynamicColCount = Integer.parseInt(dynamicColCountStr);
if(!ObjectUtils.isEmpty(fixedColCountStr)) fixedColCount = Integer.parseInt(fixedColCountStr); if(!ObjectUtils.isEmpty(fixedColCountStr)) fixedColCount = Integer.parseInt(fixedColCountStr);
@@ -261,13 +264,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
//==============以下为空白================= //==============以下为空白=================
//实际使用行数小于总行数,显示“”以下为空白“ //实际使用行数小于总行数,显示“”以下为空白“
if(dataIndex < maxRowCount){ if(dataLength < maxRowCount){
String colKey = colPrefix + "01"; String colKey = colPrefix + "01";
t = new JSONObject(); t = new JSONObject();
t.put(colKey, "以下为空白"); t.put(colKey, emptyText);
int rowIndex = (dataLength + emptyRowCount) * (rowAssist) + 2; int rowIndex = (dataLength + emptyRowCount) * (rowAssist) + 2;
if(rowAssist == 1) if(rowAssist == 1)
rowIndex = dataLength + emptyRowCount; rowIndex = dataLength + emptyRowCount;
if(rowCountOneSample == 1)
rowIndex = dataLength + 2;
rowList.set(rowIndex, t.clone()); rowList.set(rowIndex, t.clone());
} }
//前面的计数是从1开始移除第一个元素 //前面的计数是从1开始移除第一个元素
@@ -371,6 +376,68 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
return sb.append(num).toString(); return sb.append(num).toString();
} }
/**
* 组装固定检测项的数据以检测项作为数据Key
* */
private List<JSONObject> assembleFixedFieldsData(List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
JSONObject jsonObject = JSONObject.parseObject(customConfig);
Integer maxRowCount = 3;
String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数
String hasRemark = jsonObject.getString("hasRemark"); //是否有备注
String hasRange = jsonObject.getString("hasRange"); //是否有检出限
String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项则以检测项作为数据Key
JSONArray fixedFieldsArray = JSONArray.parseArray(fixedFields);
if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr);
List<JSONObject> rowList = new ArrayList<>();
for(ReportDocumentDataDO dataDO : dataList) {
JSONObject t = new JSONObject();
String documentContent = dataDO.getDocumentContent();
String externalContent = dataDO.getExternalContent();
JSONObject s = JSONObject.parseObject(documentContent);
JSONObject e = new JSONObject();
if (!ObjectUtils.isEmpty(externalContent)) {
e = JSONObject.parseObject(externalContent);
}
String remark = e.getString("remark");
String sampleName = dataDO.getSampleName();
String sampleCode = dataDO.getSampleCode();
String sampleNameCode = sampleName + " " + sampleCode;
t.put("sampleNameCode", sampleNameCode);
t.put("sampleName", sampleName);
t.put("sampleCode", sampleCode);
for(ConfigReportFieldDO fieldDO : fieldList){
String fieldName = fieldDO.getFieldName();
String field = fieldDO.getField();
for(int i=0;i<fixedFieldsArray.size();i++){
String fieldKey = fixedFieldsArray.getString(i);
if(!fieldName.equals(fieldKey))
continue;
JSONObject fieldObj = s.getJSONObject( field);
String fieldValue = "";
String mathSymbol = "";
if(fieldObj != null){
fieldValue = fieldObj.getString("fieldValue");
mathSymbol = fieldObj.getString("mathSymbol");
}
if(!ObjectUtils.isEmpty(mathSymbol) && !"=".equals(mathSymbol))
fieldValue = mathSymbol + fieldValue;
t.put(fieldName, fieldValue);
}
}
rowList.add(t);
}
if(rowList.size() < maxRowCount){
JSONObject t = new JSONObject();
t.put("sampleNameCode", emptyText);
t.put("sampleName", emptyText);
t.put("sampleCode", emptyText);
rowList.add( t);
}
return rowList;
}
/** /**
* 组装纵表数据 * 组装纵表数据
* 第1列固定为元素 第2列方法检出限%);第三列开始为各个样品 * 第1列固定为元素 第2列方法检出限%);第三列开始为各个样品
@@ -463,6 +530,14 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
return CommonResult.success(list); return CommonResult.success(list);
} }
@Override
public CommonResult<Long> countMainDataId(Long mainDataId) {
QueryWrapper<ReportDocumentDataDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("MAIN_ID", mainDataId);
queryWrapper.orderByAsc("ID");
return CommonResult.success(reportDocumentDataMapper.selectCount(queryWrapper));
}
@Override @Override
public CommonResult<String> removeByMainIdAndDetailIds(Long mainDataId, List<Long> detailIds) { public CommonResult<String> removeByMainIdAndDetailIds(Long mainDataId, List<Long> detailIds) {
QueryWrapper<ReportDocumentDataDO> queryWrapper = new QueryWrapper<>(); QueryWrapper<ReportDocumentDataDO> queryWrapper = new QueryWrapper<>();

View File

@@ -77,7 +77,7 @@ public interface ReportDocumentMainService {
* @param pageReqVO 分页查询 * @param pageReqVO 分页查询
* @return 检测报告业务分页 * @return 检测报告业务分页
*/ */
PageResult<ReportDocumentMainDO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO); PageResult<ReportDocumentMainRespVO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO);
//发起流程 //发起流程
CommonResult<ReportDocumentMainRespVO> createProcessInstance(ReportDocumentMainSaveReqVO entity); CommonResult<ReportDocumentMainRespVO> createProcessInstance(ReportDocumentMainSaveReqVO entity);

View File

@@ -262,7 +262,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
} }
@Override @Override
public PageResult<ReportDocumentMainDO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO) { public PageResult<ReportDocumentMainRespVO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO) {
return reportDocumentMainMapper.selectPage(pageReqVO); return reportDocumentMainMapper.selectPage(pageReqVO);
} }