Merge branch 'test' of https://git.will-way.cn/zgty/zt-qms into test
This commit is contained in:
@@ -64,14 +64,14 @@ public class BusinessSampleDispatchController implements BusinessControllerMarke
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/addOrRemoveSample")
|
||||
@PostMapping("/addOrRemoveSample")
|
||||
@Operation(summary = "增加或移除样品")
|
||||
public CommonResult<Boolean> addOrRemoveSample(@Valid @RequestBody BusinessSampleDispatchSaveReqVO updateReqVO) {
|
||||
businessSampleDispatchService.addOrRemoveSample(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/addBySampleCode")
|
||||
@PostMapping("/addBySampleCode")
|
||||
@Operation(summary = "增加或移除样品")
|
||||
public CommonResult<Boolean> addBySampleCode(HttpServletRequest request) {
|
||||
String id = request.getParameter("id");
|
||||
|
||||
@@ -35,17 +35,15 @@ public interface BusinessSubSampleMapper extends BaseMapperX<BusinessSubSampleDO
|
||||
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, BusinessSubSampleDO::getConfigSubSampleId)
|
||||
.leftJoin(DictionaryBusinessDO.class, DictionaryBusinessDO::getId, BusinessSubSampleDO::getDictionaryBusinessId)
|
||||
//库位
|
||||
// .leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, BusinessSubSampleDO::getConfigWarehouseLocationInfomationId, w->{
|
||||
// w.eq(ConfigWarehouseLocationDO::getWarehouseType, QmsWarehouseLocationConstant.WAREHOUSE_TYPE_SAMPLE);
|
||||
// })
|
||||
// //仓库
|
||||
// .leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId)
|
||||
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, BusinessSubSampleDO::getConfigWarehouseLocationInfomationId)
|
||||
//仓库
|
||||
.leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId)
|
||||
.selectAll(BusinessSubSampleDO.class)
|
||||
.selectAs(DictionaryBusinessDO::getName, BusinessSubSampleExtendRespVO::getDictionaryBusinessName)
|
||||
.selectAs(ConfigSubSampleDO::getIsPrint, BusinessSubSampleExtendRespVO::getIsPrint)
|
||||
.selectAs(ConfigSubSampleDO::getPrintTemplate, BusinessSubSampleExtendRespVO::getPrintTemplate)
|
||||
// .selectAs(ConfigWarehouseLocationDO::getCode, BusinessSubSampleExtendRespVO::getWarehouseLocationCode)
|
||||
// .selectAs(ConfigWarehouseLocationParDO::getName, BusinessSubSampleExtendRespVO::getWarehouseName)
|
||||
.selectAs(ConfigWarehouseLocationDO::getCode, BusinessSubSampleExtendRespVO::getWarehouseLocationCode)
|
||||
.selectAs(ConfigWarehouseLocationParDO::getName, BusinessSubSampleExtendRespVO::getWarehouseName)
|
||||
.eqIfPresent(BusinessSubSampleDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId())
|
||||
.eqIfPresent(BusinessSubSampleDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId())
|
||||
.eqIfPresent(BusinessSubSampleDO::getConfigSubSampleId, reqVO.getConfigSubSampleId())
|
||||
@@ -83,7 +81,7 @@ public interface BusinessSubSampleMapper extends BaseMapperX<BusinessSubSampleDO
|
||||
.eqIfPresent(BusinessSubSampleDO::getUpdateCount, reqVO.getUpdateCount())
|
||||
.eqIfPresent(BusinessSubSampleDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(BusinessSubSampleDO::getUpSampleRecordId, reqVO.getUpSampleRecordId())
|
||||
// .likeIfPresent(ConfigWarehouseLocationDO::getCode, reqVO.getWarehouseLocationCode())
|
||||
.likeIfPresent(ConfigWarehouseLocationDO::getCode, reqVO.getWarehouseLocationCode())
|
||||
.orderByDesc(BusinessSubSampleDO::getSampleFlowNodeTime).orderByAsc(BusinessSubSampleDO::getSampleCode));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
if(typeDO == null){
|
||||
return error(REPORT_DOCUMENT_TYPE_NOT_EXISTS, "报告类型不存在,请刷新后重试");
|
||||
}
|
||||
vo.setDocumentTitle(typeDO.getName());
|
||||
vo.setFlowKey(typeDO.getFlowKey());
|
||||
vo.setDocumentType(typeDO.getDocumentType());
|
||||
vo.setConfigReportTypeId(typeDO.getConfigReportTypeId());
|
||||
@@ -244,8 +245,8 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
@Operation(summary = "获得检测报告业务分页")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:report-document-main:query')")
|
||||
public CommonResult<PageResult<ReportDocumentMainRespVO>> getReportDocumentMainPage(@Valid ReportDocumentMainPageReqVO pageReqVO) {
|
||||
PageResult<ReportDocumentMainDO> pageResult = reportDocumentMainService.getReportDocumentMainPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ReportDocumentMainRespVO.class));
|
||||
PageResult<ReportDocumentMainRespVO> pageResult = reportDocumentMainService.getReportDocumentMainPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -255,10 +256,9 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
public void exportReportDocumentMainExcel(@Valid ReportDocumentMainPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ReportDocumentMainDO> list = reportDocumentMainService.getReportDocumentMainPage(pageReqVO).getList();
|
||||
List<ReportDocumentMainRespVO> list = reportDocumentMainService.getReportDocumentMainPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "检测报告业务.xls", "数据", ReportDocumentMainRespVO.class,
|
||||
BeanUtils.toBean(list, ReportDocumentMainRespVO.class));
|
||||
ExcelUtils.write(response, "检测报告业务.xls", "数据", ReportDocumentMainRespVO.class, list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -113,4 +113,10 @@ public class ReportDocumentMainRespVO {
|
||||
@Schema(description = "表单设计器模板id")
|
||||
@ExcelProperty("表单设计器模板id")
|
||||
private Long dataTemplateId;
|
||||
|
||||
//==============================扩展字段=======================================
|
||||
@Schema(description = "记录数")
|
||||
@ExcelProperty("记录数")
|
||||
private Long detailDataCount;
|
||||
|
||||
}
|
||||
@@ -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.mybatis.core.mapper.BaseMapperX;
|
||||
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.dal.dataobject.ReportDocumentDataDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -21,10 +23,13 @@ import java.util.List;
|
||||
public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMainDO> {
|
||||
|
||||
|
||||
default PageResult<ReportDocumentMainDO> selectPage(ReportDocumentMainPageReqVO reqVO) {
|
||||
default PageResult<ReportDocumentMainRespVO> selectPage(ReportDocumentMainPageReqVO reqVO) {
|
||||
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.eqIfPresent(ReportDocumentMainDO::getFlowInstanceId, reqVO.getFlowInstanceId());
|
||||
wrapper.eqIfPresent(ReportDocumentMainDO::getReportDocumentTypeId, reqVO.getReportDocumentTypeId());
|
||||
@@ -49,7 +54,7 @@ public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMain
|
||||
wrapper.betweenIfPresent(ReportDocumentMainDO::getCreateTime, reqVO.getCreateTime());
|
||||
wrapper.eqIfPresent(ReportDocumentMainDO::getRemark, reqVO.getRemark());
|
||||
wrapper.orderByDesc(ReportDocumentMainDO::getId);
|
||||
return selectPage(reqVO, wrapper);
|
||||
return selectJoinPage(reqVO, ReportDocumentMainRespVO.class, wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public interface ReportDocumentDataService {
|
||||
CommonResult<List<JSONObject>> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig);
|
||||
|
||||
CommonResult<List<ReportDocumentDataDO>> listByMainDataId(Long mainDataId);
|
||||
CommonResult<Long> countMainDataId(Long mainDataId);
|
||||
CommonResult<String> removeByMainIdAndDetailIds(Long mainDataId, List<Long> detailIds);
|
||||
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
private final String name_code_code = "code";
|
||||
private final String name_code_split = "split";
|
||||
private final String rangeKey = "minLimitValue";
|
||||
|
||||
private final String emptyText = "以下为空白";
|
||||
|
||||
|
||||
/*
|
||||
@@ -120,10 +120,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
String hasRemark = jsonObject.getString("hasRemark"); //是否有备注
|
||||
String hasRange = jsonObject.getString("hasRange"); //是否有检出限
|
||||
String verticalFlag = jsonObject.getString("verticalFlag"); //vertical-纵表, 否则为横表
|
||||
String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项,则以检测项作为数据Key
|
||||
if("1".equals(verticalFlag)){
|
||||
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(fixedColCountStr)) fixedColCount = Integer.parseInt(fixedColCountStr);
|
||||
|
||||
@@ -261,13 +264,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
|
||||
//==============以下为空白=================
|
||||
//实际使用行数小于总行数,显示“”以下为空白“
|
||||
if(dataIndex < maxRowCount){
|
||||
if(dataLength < maxRowCount){
|
||||
String colKey = colPrefix + "01";
|
||||
t = new JSONObject();
|
||||
t.put(colKey, "以下为空白");
|
||||
t.put(colKey, emptyText);
|
||||
int rowIndex = (dataLength + emptyRowCount) * (rowAssist) + 2;
|
||||
if(rowAssist == 1)
|
||||
rowIndex = dataLength + emptyRowCount;
|
||||
if(rowCountOneSample == 1)
|
||||
rowIndex = dataLength + 2;
|
||||
rowList.set(rowIndex, t.clone());
|
||||
}
|
||||
//前面的计数是从1开始,移除第一个元素
|
||||
@@ -371,6 +376,68 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
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列:方法检出限(%);第三列开始为各个样品
|
||||
@@ -463,6 +530,14 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
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
|
||||
public CommonResult<String> removeByMainIdAndDetailIds(Long mainDataId, List<Long> detailIds) {
|
||||
QueryWrapper<ReportDocumentDataDO> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
@@ -77,7 +77,7 @@ public interface ReportDocumentMainService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 检测报告业务分页
|
||||
*/
|
||||
PageResult<ReportDocumentMainDO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO);
|
||||
PageResult<ReportDocumentMainRespVO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO);
|
||||
|
||||
//发起流程
|
||||
CommonResult<ReportDocumentMainRespVO> createProcessInstance(ReportDocumentMainSaveReqVO entity);
|
||||
|
||||
@@ -262,7 +262,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ReportDocumentMainDO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO) {
|
||||
public PageResult<ReportDocumentMainRespVO> getReportDocumentMainPage(ReportDocumentMainPageReqVO pageReqVO) {
|
||||
return reportDocumentMainMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user