|
@@ -28,6 +28,7 @@ import org.springblade.business.feign.OperationLogClient;
|
|
|
import org.springblade.business.mapper.EntrustInfoMapper;
|
|
|
import org.springblade.business.service.IEntrustInfoService;
|
|
|
import org.springblade.business.service.IInformationQueryService;
|
|
|
+import org.springblade.business.service.ITrialNumberRuleService;
|
|
|
import org.springblade.business.vo.EntrustDataInfoVO;
|
|
|
import org.springblade.business.vo.EntrustInfoVO;
|
|
|
import org.springblade.business.vo.LoadDataInfoVO;
|
|
@@ -68,6 +69,7 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
|
|
|
private final EntrustInfoMapper entrustInfoMapper;
|
|
|
private final IInformationQueryService informationQueryService;
|
|
|
private final OperationLogClient operationLogClient;
|
|
|
+ private final ITrialNumberRuleService trialNumberRuleService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<EntrustInfoVO> selectEntrustInfoPage(IPage<EntrustInfoVO> page, EntrustInfoVO entrustInfo) {
|
|
@@ -122,22 +124,22 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
|
|
|
}
|
|
|
String sampleId = "";
|
|
|
String contractId = "";
|
|
|
- String sqlNodeName="select node_name, node_type from m_wbs_tree_private where p_key_id="+dataInfo.getString("nodeId");
|
|
|
+ String sqlNodeName="select node_name, node_type from m_wbs_tree_private where p_key_id="+dataInfo.getString("nodeId");
|
|
|
Map<String, Object> wbsTreePrivateMap = jdbcTemplate.queryForMap(sqlNodeName);
|
|
|
String nodeName = wbsTreePrivateMap.get("node_name").toString();
|
|
|
String nodeType = wbsTreePrivateMap.get("node_type").toString();
|
|
|
- if(!"51".equals(nodeType) && !nodeName.equals("回弹法检测混凝土抗压强度")&&!nodeName.equals("路基压实度")&&!nodeName.equals("地基承载力")&&!nodeName.equals("路基路面弯沉")&&!nodeName.equals("锚杆")&&!nodeName.equals("喷射混凝土厚度")){
|
|
|
- // 创建 委托单信息
|
|
|
- if(!dataInfo.containsKey("sampleId")){
|
|
|
- return R.fail("取样信息为sampleId不存在");
|
|
|
- }else{
|
|
|
- sampleId = dataInfo.getString("sampleId");
|
|
|
- }
|
|
|
- }else {
|
|
|
- if(dataInfo.containsKey("sampleId")){
|
|
|
- sampleId = dataInfo.getString("sampleId");
|
|
|
- }
|
|
|
- }
|
|
|
+ if(!"51".equals(nodeType)){
|
|
|
+ // 创建 委托单信息
|
|
|
+ if(!dataInfo.containsKey("sampleId")){
|
|
|
+ return R.fail("取样信息为sampleId不存在");
|
|
|
+ }else{
|
|
|
+ sampleId = dataInfo.getString("sampleId");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(dataInfo.containsKey("sampleId")){
|
|
|
+ sampleId = dataInfo.getString("sampleId");
|
|
|
+ }
|
|
|
+ }
|
|
|
if(!dataInfo.containsKey("contractId")){
|
|
|
return R.fail("取样信息为contractId不存在");
|
|
|
}else{
|
|
@@ -146,24 +148,26 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
|
|
|
|
|
|
String nodeErTreeId = dataInfo.getString("nodeErTreeId");
|
|
|
|
|
|
- EntrustInfo entrustInfo=new EntrustInfo();
|
|
|
+ EntrustInfo entrustInfo=new EntrustInfo();
|
|
|
// 保存数据文件
|
|
|
- if(!dataInfo.containsKey("sampleId")){
|
|
|
- entrustInfo.setSampleStatus("0");
|
|
|
- }else {
|
|
|
- if(!"51".equals(nodeType) && !nodeName.equals("回弹法检测混凝土抗压强度")&&!nodeName.equals("路基压实度")&&!nodeName.equals("地基承载力")&&!nodeName.equals("路基路面弯沉")&&!nodeName.equals("锚杆")){
|
|
|
- entrustInfo = baseMapper.selectOne(Wrappers.<EntrustInfo>query().lambda().eq(EntrustInfo::getSampleId, sampleId).eq(EntrustInfo::getContractId,contractId));
|
|
|
- }else {
|
|
|
- entrustInfo = baseMapper.selectOne(Wrappers.<EntrustInfo>query().lambda().eq(EntrustInfo::getId,dataInfo.get("id")).eq(EntrustInfo::getContractId,contractId));
|
|
|
- }
|
|
|
- if(entrustInfo==null && Func.isEmpty(entrustInfo)){
|
|
|
- entrustInfo = new EntrustInfo();
|
|
|
- //委托单未上报不进入样品流转 状态设置为0
|
|
|
- entrustInfo.setSampleStatus("0");
|
|
|
- }
|
|
|
- }
|
|
|
+ if(!dataInfo.containsKey("sampleId")){
|
|
|
+ entrustInfo.setSampleStatus("0");
|
|
|
+ }else {
|
|
|
+ if(!"51".equals(nodeType)){
|
|
|
+ if (sampleId != null && !sampleId.isEmpty() && !"0".equals(sampleId)) {
|
|
|
+ entrustInfo = baseMapper.selectOne(Wrappers.<EntrustInfo>query().lambda().eq(EntrustInfo::getSampleId, sampleId).eq(EntrustInfo::getContractId,contractId));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ entrustInfo = baseMapper.selectOne(Wrappers.<EntrustInfo>query().lambda().eq(EntrustInfo::getId,dataInfo.get("id")).eq(EntrustInfo::getContractId,contractId));
|
|
|
+ }
|
|
|
+ if(entrustInfo==null && Func.isEmpty(entrustInfo)){
|
|
|
+ entrustInfo = new EntrustInfo();
|
|
|
+ //委托单未上报不进入样品流转 状态设置为0
|
|
|
+ entrustInfo.setSampleStatus("0");
|
|
|
+ }
|
|
|
+ }
|
|
|
//WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.getNodeByPrimaryKeyId(nodeErTreeId);
|
|
|
- WbsTreePrivate wbsTreePrivate=jdbcTemplate.query("select * from m_wbs_tree_private where p_key_id="+nodeErTreeId+" and status=1",new BeanPropertyRowMapper<>(WbsTreePrivate.class)).get(0);
|
|
|
+ WbsTreePrivate wbsTreePrivate=jdbcTemplate.query("select * from m_wbs_tree_private where p_key_id="+nodeErTreeId+" and status=1",new BeanPropertyRowMapper<>(WbsTreePrivate.class)).get(0);
|
|
|
String sql ="select * from m_wbs_form_element where is_deleted = 0 and dynamic_dict in(500,501,502) and f_id="+wbsTreePrivate.getInitTableId();
|
|
|
List<Map<String, Object>> wbsFormElements = jdbcTemplate.queryForList(sql);
|
|
|
|
|
@@ -188,23 +192,43 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- entrustInfo.setNodeId(dataInfo.get("nodeId").toString());
|
|
|
+ entrustInfo.setNodeId(dataInfo.get("nodeId").toString());
|
|
|
entrustInfo.setEntrustName(wbsTreePrivate.getNodeName());
|
|
|
- if(dataInfo.containsKey("id")){
|
|
|
- entrustInfo.setId(Long.parseLong(dataInfo.get("id").toString()));
|
|
|
- }
|
|
|
- this.saveOrUpdate(entrustInfo);
|
|
|
+ if(dataInfo.containsKey("id")){
|
|
|
+ entrustInfo.setId(Long.parseLong(dataInfo.get("id").toString()));
|
|
|
+ }
|
|
|
+ if(!dataInfo.containsKey("id")){
|
|
|
+ boolean b =true;
|
|
|
+ if(StringUtils.isNotEmpty(entrustInfo.getEntrustNo())){
|
|
|
+ trialNumberRuleService.checkTrialNumberIsExist(entrustInfo.getEntrustNo(), 3,Long.parseLong(entrustInfo.getContractId()));
|
|
|
+ }
|
|
|
+ if(!b){
|
|
|
+ throw new ServiceException("委托单编号已存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.saveOrUpdate(entrustInfo);
|
|
|
+ String autoIncrementNumber=dataInfo.get("autoIncrementNumber")==null?"":dataInfo.get("autoIncrementNumber").toString();
|
|
|
+ String trialAutoNumber=dataInfo.get("trialNumber")==null?"":dataInfo.get("trialNumber").toString();
|
|
|
+ String entrustNo=entrustInfo.getEntrustNo()==null?"":entrustInfo.getEntrustNo();
|
|
|
+ if(StringUtils.isNotEmpty(autoIncrementNumber)){
|
|
|
+ if(trialAutoNumber.equals(entrustNo)){
|
|
|
+ trialNumberRuleService.checkSave(Long.parseLong(entrustInfo.getContractId()), 3, entrustInfo.getId(), autoIncrementNumber);
|
|
|
+ }
|
|
|
+ //bladeRedis.del("trialAutoNumber:" + entrustInfo.getContractId() + ":" + 3 + ":" + entrustInfo.getId() + ":" + "lock:" + autoIncrementNumber);
|
|
|
+ }
|
|
|
dataInfo.put("groupId",entrustInfo.getId());
|
|
|
dataInfo.put("pkeyId", dataInfo.getString("nodeErTreeId"));
|
|
|
- if(StringUtils.isEmpty(entrustInfo.getEntrustNo())){
|
|
|
- entrustInfo.setEntrustNo("");
|
|
|
- }
|
|
|
- if(StringUtils.isEmpty(entrustInfo.getEntrustName())){
|
|
|
- entrustInfo.setEntrustName("");
|
|
|
- }
|
|
|
- dataInfo.put("entrustInfoName",entrustInfo.getEntrustNo()+entrustInfo.getEntrustName());
|
|
|
- String pdfUrl = excelTabClient.saveEntrustTabData(dataInfo);
|
|
|
- return R.data(200,pdfUrl,"操作成功");
|
|
|
+ if(StringUtils.isEmpty(entrustInfo.getEntrustNo())){
|
|
|
+ entrustInfo.setEntrustNo("");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(entrustInfo.getEntrustName())){
|
|
|
+ entrustInfo.setEntrustName("");
|
|
|
+ }
|
|
|
+ dataInfo.put("entrustInfoName",entrustInfo.getEntrustNo()+entrustInfo.getEntrustName());
|
|
|
+ dataInfo.remove("autoIncrementNumber");
|
|
|
+ dataInfo.remove("trialNumber");
|
|
|
+ String pdfUrl = excelTabClient.saveEntrustTabData(dataInfo);
|
|
|
+ return R.data(200,pdfUrl,"操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|