feat:报告数据算法逻辑调整
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.business.bus.dal.dataobject;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -113,4 +114,16 @@ public class BusinessAssayReportDataDO extends BusinessBaseDO {
|
||||
//样品类型key
|
||||
@TableField(exist = false)
|
||||
private String sampleTypeKey;
|
||||
|
||||
//委托样品名称
|
||||
@TableField(exist = false)
|
||||
private String entrustSampleName;
|
||||
|
||||
//委托样品编号
|
||||
@TableField(exist = false)
|
||||
private String entrustSampleCode;
|
||||
|
||||
//委托明细排序
|
||||
@TableField(exist = false)
|
||||
private Integer entrustDetailSort;
|
||||
}
|
||||
@@ -19,6 +19,8 @@ import com.zt.plat.framework.common.pojo.PageParam;
|
||||
*/
|
||||
public interface BusinessSampleEntrustRegistrationService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建委检登记业务
|
||||
*
|
||||
@@ -56,6 +58,8 @@ public interface BusinessSampleEntrustRegistrationService {
|
||||
*/
|
||||
BusinessSampleEntrustRegistrationDO getBusinessSampleEntrustRegistration(Long id);
|
||||
|
||||
List<BusinessSampleEntrustRegistrationDO> listByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得委检登记业务分页
|
||||
*
|
||||
|
||||
@@ -89,6 +89,11 @@ public class BusinessSampleEntrustRegistrationServiceImpl implements BusinessSam
|
||||
return businessSampleEntrustRegistrationMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BusinessSampleEntrustRegistrationDO> listByIds(List<Long> ids) {
|
||||
return businessSampleEntrustRegistrationMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BusinessSampleEntrustRegistrationExtendRespVO> getBusinessSampleEntrustRegistrationPage(BusinessSampleEntrustRegistrationPageReqVO pageReqVO) {
|
||||
return businessSampleEntrustRegistrationMapper.selectPage(pageReqVO);
|
||||
|
||||
@@ -189,58 +189,32 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
|
||||
//处理抬头数据
|
||||
|
||||
if("true".equals(editFlag)){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String formData = vo.getFormData();
|
||||
JSONObject formDataJson = new JSONObject();
|
||||
if(!ObjectUtils.isEmpty(formData))
|
||||
formDataJson = JSONObject.parseObject(formData);
|
||||
List<ReportDocumentDataDO> dataList = reportDocumentDataService.listByMainDataId(id).getData();
|
||||
ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(reportDocumentMain.getReportDocumentTypeId());
|
||||
String customConfig = typeDO.getCustomConfig();
|
||||
String defaultConclusion = "";
|
||||
if(!ObjectUtils.isEmpty(customConfig)){
|
||||
JSONObject config = JSONObject.parseObject(customConfig);
|
||||
defaultConclusion = config.getString("defaultConclusion");
|
||||
}
|
||||
formDataJson.put("conclusion", defaultConclusion);
|
||||
if(!dataList.isEmpty())
|
||||
formDataJson.put("sampleName", dataList.get(0).getSampleName());
|
||||
//处理检测标准
|
||||
String standard = assembleStandard(dataList);
|
||||
formDataJson.put("standard", standard);
|
||||
formDataJson.put("reportTime", sdf.format(new Date()));
|
||||
vo.setFormData(formDataJson.toJSONString());
|
||||
// ReportDocumentMainSaveReqVO updateVO = new ReportDocumentMainSaveReqVO();
|
||||
// updateVO.setId(reportDocumentMain.getId());
|
||||
// updateVO.setFormData(formDataJson.toJSONString());
|
||||
// reportDocumentMainService.updateReportDocumentMain(updateVO);
|
||||
}
|
||||
// if("true".equals(editFlag)){
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// String formData = vo.getFormData();
|
||||
// JSONObject formDataJson = new JSONObject();
|
||||
// if(!ObjectUtils.isEmpty(formData))
|
||||
// formDataJson = JSONObject.parseObject(formData);
|
||||
// List<ReportDocumentDataDO> dataList = reportDocumentDataService.listByMainDataId(id).getData();
|
||||
// ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(reportDocumentMain.getReportDocumentTypeId());
|
||||
// String customConfig = typeDO.getCustomConfig();
|
||||
// String defaultConclusion = "";
|
||||
// if(!ObjectUtils.isEmpty(customConfig)){
|
||||
// JSONObject config = JSONObject.parseObject(customConfig);
|
||||
// defaultConclusion = config.getString("defaultConclusion");
|
||||
// }
|
||||
// formDataJson.put("conclusion", defaultConclusion);
|
||||
// if(!dataList.isEmpty())
|
||||
// formDataJson.put("sampleName", dataList.get(0).getSampleName());
|
||||
// //处理检测标准
|
||||
// String standard = assembleStandard(dataList);
|
||||
// formDataJson.put("standard", standard);
|
||||
// formDataJson.put("reportTime", sdf.format(new Date()));
|
||||
// vo.setFormData(formDataJson.toJSONString());
|
||||
// }
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
private String assembleStandard(List<ReportDocumentDataDO> dataList){
|
||||
|
||||
Set<String> standardSet = new HashSet<>();
|
||||
for(ReportDocumentDataDO data : dataList){
|
||||
String content = data.getDocumentContent();
|
||||
if(ObjectUtils.isEmpty( content))
|
||||
continue;
|
||||
JSONObject json = JSONObject.parseObject(content);
|
||||
for(String key : json.keySet()){
|
||||
JSONObject obj = json.getJSONObject(key);
|
||||
String methodName = obj.getString("methodName");
|
||||
if(ObjectUtils.isEmpty(methodName))
|
||||
continue;
|
||||
standardSet.add(methodName);
|
||||
}
|
||||
}
|
||||
if(standardSet.isEmpty())
|
||||
return "";
|
||||
return String.join(",", standardSet);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检测报告业务分页")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:report-document-main:query')")
|
||||
|
||||
@@ -46,4 +46,13 @@ public class ReportDocumentDataPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "样品类型key")
|
||||
private String sampleTypeKey;
|
||||
|
||||
@Schema(description = "委托样品名称")
|
||||
private String entrustSampleName;
|
||||
|
||||
@Schema(description = "委托样品编号")
|
||||
private String entrustSampleCode;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -60,6 +60,18 @@ public class ReportDocumentDataRespVO {
|
||||
@ExcelProperty("样品类型key")
|
||||
private String sampleTypeKey;
|
||||
|
||||
@Schema(description = "委托样品名称")
|
||||
@ExcelProperty("委托样品名称")
|
||||
private String entrustSampleName;
|
||||
|
||||
@Schema(description = "委托样品编号")
|
||||
@ExcelProperty("委托样品编号")
|
||||
private String entrustSampleCode;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
//==================扩展字段===========
|
||||
|
||||
@Schema(description = "样品创建时间")
|
||||
|
||||
@@ -43,4 +43,13 @@ public class ReportDocumentDataSaveReqVO {
|
||||
@Schema(description = "样品类型key")
|
||||
private String sampleTypeKey;
|
||||
|
||||
@Schema(description = "委托样品名称")
|
||||
private String entrustSampleName;
|
||||
|
||||
@Schema(description = "委托样品编号")
|
||||
private String entrustSampleCode;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -79,6 +79,22 @@ public class ReportDocumentDataDO extends BusinessBaseDO {
|
||||
@TableField("SMP_TP_KY")
|
||||
private String sampleTypeKey;
|
||||
|
||||
/**
|
||||
* 委托样品名称
|
||||
*/
|
||||
@TableField("ENTT_SMP_NAME")
|
||||
private String entrustSampleName;
|
||||
/**
|
||||
* 委托样品编号
|
||||
*/
|
||||
@TableField("ENTT_SMP_CD")
|
||||
private String entrustSampleCode;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("SRT")
|
||||
private Integer sort;
|
||||
//==================扩展字段===========
|
||||
|
||||
//样品创建时间
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,8 @@ public interface ReportDocumentMainCorrelationService {
|
||||
|
||||
void deleteByMainId(Long mainId);
|
||||
|
||||
void insertBatch(List<ReportDocumentMainCorrelationDO> list);
|
||||
|
||||
/**
|
||||
* 创建检测报告关系表
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user