|
|
@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -72,6 +73,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
SewageJobIdentificationMaterialMapper sewageJobIdentificationMaterialMapper; |
|
|
|
SewageJobIdentificationMaterialMapper sewageJobIdentificationMaterialMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 取新的任务号 |
|
|
|
* 取新的任务号 |
|
|
|
* 前缀为 WS, 加4位 年份, 加1位季度, 加 2 位序号 |
|
|
|
* 前缀为 WS, 加4位 年份, 加1位季度, 加 2 位序号 |
|
|
@ -111,8 +113,8 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String getNewSampleNo(String IdentificationMaterialNo, int sampleSerialNumber) { |
|
|
|
public String getNewSampleNo(String IdentificationMaterialNo, int sampleSerialNumber) { |
|
|
|
String pureIMNo = StrUtil.removePrefixIgnoreCase(IdentificationMaterialNo, CommonConstants.CODE_PREFIX_IDENTIFICATION_MATERIAL); // 去掉司法鉴定委托检材的前缀 JC
|
|
|
|
String pureIMNo = StrUtil.removePrefixIgnoreCase(IdentificationMaterialNo, CommonConstants.CODE_PREFIX_IDENTIFICATION_MATERIAL); // 去掉司法鉴定委托检材的前缀 JC
|
|
|
|
pureIMNo = StrUtil.removePrefixIgnoreCase(pureIMNo, CommonConstants.CODE_PREFIX_SEWAGE_IDENTIFICATION_MATERIAL); // 去掉污水任务检材的前缀 WJ
|
|
|
|
pureIMNo = StrUtil.removePrefixIgnoreCase(pureIMNo, CommonConstants.CODE_PREFIX_SEWAGE_IDENTIFICATION_MATERIAL); // 去掉污水任务检材的前缀 WJ
|
|
|
|
|
|
|
|
|
|
|
|
String prefix = CommonConstants.CODE_PREFIX_SAMPLE + pureIMNo; |
|
|
|
String prefix = CommonConstants.CODE_PREFIX_SAMPLE + pureIMNo; |
|
|
|
String newCode = prefix + String.format("%d", sampleSerialNumber); |
|
|
|
String newCode = prefix + String.format("%d", sampleSerialNumber); |
|
|
@ -447,8 +449,8 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
//如果进水口=1,那么规则就是年份+月份+污水厂编号+A/B
|
|
|
|
//如果进水口=1,那么规则就是年份+月份+污水厂编号+A/B
|
|
|
|
if (sewageTreatmentPlant.getWaterInletCount() <= 1) { |
|
|
|
if (sewageTreatmentPlant.getWaterInletCount() <= 1) { |
|
|
|
String No1 = sewageJob.getJobYear() + getQuarterNumber(sewageJob.getJobSeason()) + sewageTreatmentPlant.getNumber(); |
|
|
|
String No1 = sewageJob.getJobYear() + getQuarterNumber(sewageJob.getJobSeason()) + sewageTreatmentPlant.getNumber(); |
|
|
|
// 2024-4-15 现在送检只会送检一份工作日与节假日的混合样本了
|
|
|
|
// 2024-4-15 现在送检只会送检一份工作日与节假日的混合样本了
|
|
|
|
// String No2 = sewageJob.getJobYear() + getQuarterNumber(sewageJob.getJobSeason()) + sewageTreatmentPlant.getNumber() + "B";
|
|
|
|
// String No2 = sewageJob.getJobYear() + getQuarterNumber(sewageJob.getJobSeason()) + sewageTreatmentPlant.getNumber() + "B";
|
|
|
|
SewageMaterialVo eg1 = getSewageMaterialVo(sewageTreatmentPlant, No1, "混合样本"); |
|
|
|
SewageMaterialVo eg1 = getSewageMaterialVo(sewageTreatmentPlant, No1, "混合样本"); |
|
|
|
eg1.setMaterialType("1"); |
|
|
|
eg1.setMaterialType("1"); |
|
|
|
// SewageMaterialVo eg2 = getSewageMaterialVo(sewageTreatmentPlant, No2, "节假日样本");
|
|
|
|
// SewageMaterialVo eg2 = getSewageMaterialVo(sewageTreatmentPlant, No2, "节假日样本");
|
|
|
@ -783,6 +785,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询各个状态下的检材数量 |
|
|
|
* 查询各个状态下的检材数量 |
|
|
|
|
|
|
|
* |
|
|
|
* @param orgId |
|
|
|
* @param orgId |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -837,6 +840,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 受理系统统计已受理的污水检材数量 |
|
|
|
* 受理系统统计已受理的污水检材数量 |
|
|
|
|
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -869,6 +873,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据任务状态 统计不同状态下的任务数量 |
|
|
|
* 根据任务状态 统计不同状态下的任务数量 |
|
|
|
|
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -901,7 +906,6 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
* 根据污水检材创建样本 |
|
|
|
* 根据污水检材创建样本 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param sewageJobIdentificationMaterial |
|
|
|
* @param sewageJobIdentificationMaterial |
|
|
|
* |
|
|
|
|
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -909,7 +913,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
|
|
|
|
|
|
|
|
//污水的编号重新生成,逻辑发生改变,现在一个检材就对应一个样本 8-31
|
|
|
|
//污水的编号重新生成,逻辑发生改变,现在一个检材就对应一个样本 8-31
|
|
|
|
|
|
|
|
|
|
|
|
List<Sample> sampleList=new ArrayList<Sample>(); |
|
|
|
List<Sample> sampleList = new ArrayList<Sample>(); |
|
|
|
List<DrugLite> candidateDrugs = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_CANDIDATE_DRUGS), DrugLite.class); |
|
|
|
List<DrugLite> candidateDrugs = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_CANDIDATE_DRUGS), DrugLite.class); |
|
|
|
List<IMAdditionalProperty> additionalProperties = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_ADDITIONAL_PROPERTIES), IMAdditionalProperty.class); |
|
|
|
List<IMAdditionalProperty> additionalProperties = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_ADDITIONAL_PROPERTIES), IMAdditionalProperty.class); |
|
|
|
BigDecimal quantity = new BigDecimal(Double.parseDouble(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_QUANTITY))); |
|
|
|
BigDecimal quantity = new BigDecimal(Double.parseDouble(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_QUANTITY))); |
|
|
@ -937,7 +941,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
sample1.setStorageMethod(sewageJobIdentificationMaterial.getStorageMethod()); |
|
|
|
sample1.setStorageMethod(sewageJobIdentificationMaterial.getStorageMethod()); |
|
|
|
sample1.setAcceptTime(sewageJobIdentificationMaterial.getAcceptTime()); |
|
|
|
sample1.setAcceptTime(sewageJobIdentificationMaterial.getAcceptTime()); |
|
|
|
|
|
|
|
|
|
|
|
sample1.setSampleType(sewageJobIdentificationMaterial.getSampleType().equals("1")?"A":"B");//设置类型
|
|
|
|
sample1.setSampleType(sewageJobIdentificationMaterial.getSampleType().equals("1") ? "A" : "B");//设置类型
|
|
|
|
sample1.setSewageJobId(sewageJobIdentificationMaterial.getJobId()); //设置任务ID
|
|
|
|
sample1.setSewageJobId(sewageJobIdentificationMaterial.getJobId()); //设置任务ID
|
|
|
|
sample1.setHolder(dlpUserId); |
|
|
|
sample1.setHolder(dlpUserId); |
|
|
|
sample1.setOrgId(sewageJobIdentificationMaterial.getDeliverOrgId()); |
|
|
|
sample1.setOrgId(sewageJobIdentificationMaterial.getDeliverOrgId()); |
|
|
@ -952,7 +956,6 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
* 根据污水检材创建样本 |
|
|
|
* 根据污水检材创建样本 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param sewageJobIdentificationMaterialList |
|
|
|
* @param sewageJobIdentificationMaterialList |
|
|
|
* |
|
|
|
|
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -960,7 +963,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
|
|
|
|
|
|
|
|
//污水的编号重新生成,逻辑发生改变,现在一个检材就对应一个样本 8-31
|
|
|
|
//污水的编号重新生成,逻辑发生改变,现在一个检材就对应一个样本 8-31
|
|
|
|
|
|
|
|
|
|
|
|
List<Sample> sampleList=new ArrayList<Sample>(); |
|
|
|
List<Sample> sampleList = new ArrayList<Sample>(); |
|
|
|
|
|
|
|
|
|
|
|
List<DrugLite> candidateDrugs = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_CANDIDATE_DRUGS), DrugLite.class); |
|
|
|
List<DrugLite> candidateDrugs = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_CANDIDATE_DRUGS), DrugLite.class); |
|
|
|
List<IMAdditionalProperty> additionalProperties = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_ADDITIONAL_PROPERTIES), IMAdditionalProperty.class); |
|
|
|
List<IMAdditionalProperty> additionalProperties = JSON.parseArray(AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_SEWAGE_JOB_IDENTIFICATION_MATERIAL_ADDITIONAL_PROPERTIES), IMAdditionalProperty.class); |
|
|
@ -993,7 +996,7 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
sample1.setStorageMethod(sewageJobIdentificationMaterial.getStorageMethod()); |
|
|
|
sample1.setStorageMethod(sewageJobIdentificationMaterial.getStorageMethod()); |
|
|
|
sample1.setAcceptTime(sewageJobIdentificationMaterial.getAcceptTime()); |
|
|
|
sample1.setAcceptTime(sewageJobIdentificationMaterial.getAcceptTime()); |
|
|
|
|
|
|
|
|
|
|
|
sample1.setSampleType(sewageJobIdentificationMaterial.getSampleType().equals("1")?"A":"B");//设置类型
|
|
|
|
sample1.setSampleType(sewageJobIdentificationMaterial.getSampleType().equals("1") ? "A" : "B");//设置类型
|
|
|
|
sample1.setSewageJobId(sewageJobIdentificationMaterial.getJobId()); //设置任务ID
|
|
|
|
sample1.setSewageJobId(sewageJobIdentificationMaterial.getJobId()); //设置任务ID
|
|
|
|
sample1.setHolder(dlpUserId); |
|
|
|
sample1.setHolder(dlpUserId); |
|
|
|
sample1.setOrgId(sewageJobIdentificationMaterial.getDeliverOrgId()); |
|
|
|
sample1.setOrgId(sewageJobIdentificationMaterial.getDeliverOrgId()); |
|
|
@ -1005,4 +1008,69 @@ public class SewageJobServiceImpl extends ServiceImpl<SewageJobMapper, SewageJob |
|
|
|
return sampleList; |
|
|
|
return sampleList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Page<SewageJob> getPage(Page page) { |
|
|
|
|
|
|
|
Page paged = this.page(page, Wrappers |
|
|
|
|
|
|
|
.<SewageJob>lambdaQuery() |
|
|
|
|
|
|
|
.orderByDesc(SewageJob::getJobYear) |
|
|
|
|
|
|
|
.orderByAsc(SewageJob::getJobSeason)); |
|
|
|
|
|
|
|
List<SewageJob> list = paged.getRecords(); |
|
|
|
|
|
|
|
list.forEach(job -> { |
|
|
|
|
|
|
|
job.setComments( |
|
|
|
|
|
|
|
sewageJobIdentificationMaterialService.lambdaQuery() |
|
|
|
|
|
|
|
.eq(SewageJobIdentificationMaterial::getJobId, job.getId()) |
|
|
|
|
|
|
|
.eq(SewageJobIdentificationMaterial::getStatus, 1) |
|
|
|
|
|
|
|
.count().toString()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return paged; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public SewageJob createJob(Integer year, Integer season) { |
|
|
|
|
|
|
|
boolean exists = this.lambdaQuery() |
|
|
|
|
|
|
|
.eq(SewageJob::getJobYear, year) |
|
|
|
|
|
|
|
.eq(SewageJob::getJobSeason, season) |
|
|
|
|
|
|
|
.exists(); |
|
|
|
|
|
|
|
if (exists) { |
|
|
|
|
|
|
|
throw new RuntimeException("任务已存在"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SewageJob job = new SewageJob(); |
|
|
|
|
|
|
|
int month = (season - 1) * 3 + 1; // 季度对应的第一个月 (1,4,7,10)
|
|
|
|
|
|
|
|
LocalDate startDate = LocalDate.of(year, month, 1); |
|
|
|
|
|
|
|
// 计算本季度的结束日期
|
|
|
|
|
|
|
|
LocalDate endDate = startDate.plusMonths(3).minusDays(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
job.setJobYear(year); |
|
|
|
|
|
|
|
job.setJobSeason(season); |
|
|
|
|
|
|
|
job.setName(year + "年第" + season + "季度污水监测任务"); |
|
|
|
|
|
|
|
job.setJobNo(this.getNewJobNo(year, season)); |
|
|
|
|
|
|
|
job.setStatus(1); |
|
|
|
|
|
|
|
job.setDescription("贵阳市" + year + "年第" + season + "季度污水监测任务"); |
|
|
|
|
|
|
|
job.setLauncheOrgId("0"); |
|
|
|
|
|
|
|
job.setStartDate(startDate.atStartOfDay()); |
|
|
|
|
|
|
|
job.setExpirationDate(endDate.atStartOfDay()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean saved = this.save(job); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (saved) { |
|
|
|
|
|
|
|
System.out.println(">>> 创建成功:" + "year" + "年第" + season + "季度"); |
|
|
|
|
|
|
|
return job; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
System.out.println(">>> 创建失败:" + "year" + "年第" + season + "季度"); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean removeJob(String jobId) { |
|
|
|
|
|
|
|
boolean exists = sewageJobIdentificationMaterialService.lambdaQuery() |
|
|
|
|
|
|
|
.eq(SewageJobIdentificationMaterial::getJobId, jobId) |
|
|
|
|
|
|
|
.exists(); |
|
|
|
|
|
|
|
if (exists) { |
|
|
|
|
|
|
|
System.out.println(">>> 删除失败:" + "已有检材存在"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return this.removeById(jobId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|