Commit 09b4416d by lijingjing

添加大屏接口(analysis\hmhj);

parent 2dab42c3
......@@ -199,27 +199,37 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
/**
* 转换自动大写编号
* 处理下样品编号(大小写,空格)
*
* @param sample
*/
private void toSampleCodeUpperCase(EntrustSample sample) {
private void sampleCodeHandler(EntrustSample sample) {
String code = sample.getCode(), firstCode = sample.getFirstCode(),
secondCode = sample.getSecondCode(), thirdCode = sample.getThirdCode();
if (StringUtils.isNotBlank(code)) {
sample.setCode(code.toUpperCase());
sample.setCode(code.trim().toUpperCase());
}
if (StringUtils.isNotBlank(firstCode)) {
sample.setFirstCode(firstCode.toUpperCase());
sample.setFirstCode(firstCode.trim().toUpperCase());
}
if (StringUtils.isNotBlank(secondCode)) {
sample.setFirstCode(secondCode.toUpperCase());
sample.setFirstCode(secondCode.trim().toUpperCase());
}
if (StringUtils.isNotBlank(thirdCode)) {
sample.setFirstCode(thirdCode.toUpperCase());
sample.setFirstCode(thirdCode.trim().toUpperCase());
}
}
/**
* 处理槽号空格
*
* @param sample
*/
private void sampleSlotNoHandler(EntrustSample sample) {
String slotNo = null == sample.getSlotNo() ? "" : sample.getSlotNo();
sample.setSlotNo(slotNo.trim());
}
public void initSampleCode(Entrust entrust, EntrustSample sample) {
// 如果合同编号不为空,样品编号不为空,一级编号不为空,则不进行编号生成
if (null != sample.getContractSampleId() && StringUtils.isNotBlank(sample.getCode()) && StringUtils.isNotBlank(sample.getFirstCode())) {
......@@ -411,8 +421,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
sample.setThirdCode(thirdCode);
}
}
// 自动大写
toSampleCodeUpperCase(sample);
}
private String getSampleThirdCode(EntrustSample sample) {
......@@ -492,7 +500,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
EntrustSample sample = sampleDTO.convert(EntrustSample.class);
sample.setEntrustId(entrust.getId());
toSampleCodeUpperCase(sample);
sampleSlotNoHandler(sample);
// 只有在提交时,才初始化样品编号
if (isSubmit) {
// 判断是否样品为空时,需要考虑是否进场物资
......@@ -502,10 +510,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
handleSampleCode(entrust, sample);
}
if (StringUtils.isNotBlank(sample.getCode())) {
sample.setCode(sample.getCode().trim());
sample.setCode(sample.getCode().trim().toUpperCase());
RestAssert.fail(entrustSampleService.isRepeatSampleCode(sample), String.format("样品编号【%s】重复!", sample.getCode()));
}
}
// 处理下编号
sampleCodeHandler(sample);
judgeSampleFields(sample, isSubmit);
sample.setId(IdWorker.getId());
sample.setOrderBy(incNum);
......@@ -722,7 +732,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
EntrustSample sample = dto.convert(EntrustSample.class);
sample.setEntrustId(entrustId);
sample.setOrderBy(incNum);
toSampleCodeUpperCase(sample);
sampleSlotNoHandler(sample);
incNum += 10;
boolean isInsert = false;
// 如果室新增的样品
......@@ -735,10 +745,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
handleSampleCode(entrust, sample);
}
if (StringUtils.isNotBlank(sample.getCode())) {
sample.setCode(sample.getCode().trim());
sample.setCode(sample.getCode().trim().toUpperCase());
RestAssert.fail(entrustSampleService.isRepeatSampleCode(sample), String.format("样品编号【%s】重复!", sample.getCode()));
}
}
// 对样品编号处理
sampleCodeHandler(sample);
if (isInsert) {
saveSampleList.add(sample);
......@@ -1662,9 +1674,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
RestAssert.fail(CollectionUtils.isEmpty(sampleList), String.format("委托编号为的【%s】样品为空!", entrust.getCode()));
// 若存在任何一个样品的编号为空,那么需要自动生成其编号
for (EntrustSample sample : sampleList) {
sampleSlotNoHandler(sample);
if (StringUtils.isBlank(sample.getCode()) || Objects.nonNull(sample.getSamplingId())) {
handleSampleCode(entrust, sample);
}
// 额外处理样品编号空格,大写
sampleCodeHandler(sample);
RestAssert.fail(entrustSampleService.isRepeatSampleCode(sample), String.format("样品编号【%s】重复!", sample.getCode()));
}
entrustSampleService.updateBatchById(sampleList);
......
......@@ -254,9 +254,19 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
}
private void handleSamesChainTimeRange(RangeStatsQueryDTO queryDTO) {
RestAssert.fail(Objects.isNull(queryDTO.getQueryDate()), "查询日期不能为空!");
Date queryDate = queryDTO.getQueryDate();
// 固定日期
boolean isFixDate = Objects.nonNull(queryDate);
// 范围日期
boolean isRangeDate = Objects.nonNull(queryDTO.getTimeS()) && Objects.nonNull(queryDTO.getTimeE());
if (isFixDate) {
queryDTO.setLastYearTime(DateUtils.addYears(queryDTO.getQueryDate(), -1));
queryDTO.setPrevTime(DateUtils.addMonths(queryDTO.getQueryDate(), -1));
} else if (isRangeDate) {
handleTimeRange(queryDTO);
}
RestAssert.fail(!(isFixDate || isRangeDate), "查询日期不能为空!");
}
/**
......
......@@ -294,21 +294,45 @@
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0
AND s.type = 0
<if test="null != vo.queryDate">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.timeS">
AND e.entrust_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND e.entrust_time &lt;= #{vo.timeE}
</if>
) a,
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0
AND s.type = 0
<if test="null != vo.lastYearTime">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.lastYearTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.lastYearTimeS">
AND e.entrust_time >= #{vo.lastYearTimeS}
</if>
<if test="null != vo.lastYearTimeE">
AND e.entrust_time &lt;= #{vo.lastYearTimeE}
</if>
) b,
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0
AND s.type = 0
<if test="null != vo.prevTime">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.prevTimeS">
AND e.entrust_time >= #{vo.prevTimeS}
</if>
<if test="null != vo.prevTimeE">
AND e.entrust_time &lt;= #{vo.prevTimeE}
</if>
) c
</select>
......@@ -356,21 +380,45 @@
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0
AND s.type = 0
<if test="null != vo.queryDate">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.timeS">
AND e.entrust_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND e.entrust_time &lt;= #{vo.timeE}
</if>
) a,
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0
AND s.type = 0
<if test="null != vo.lastYearTime">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.lastYearTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.lastYearTimeS">
AND e.entrust_time >= #{vo.lastYearTimeS}
</if>
<if test="null != vo.lastYearTimeE">
AND e.entrust_time &lt;= #{vo.lastYearTimeE}
</if>
) b,
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0
AND s.type = 0
<if test="null != vo.prevTime">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.prevTimeS">
AND e.entrust_time >= #{vo.prevTimeS}
</if>
<if test="null != vo.prevTimeE">
AND e.entrust_time &lt;= #{vo.prevTimeE}
</if>
) c
</select>
......@@ -389,7 +437,15 @@
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0
AND s.type = 0
<if test="null != vo.queryDate">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.timeS">
AND e.entrust_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND e.entrust_time &lt;= #{vo.timeE}
</if>
) a,
(SELECT count(i.id) "total"
FROM entrust_sample_item i
......@@ -397,7 +453,15 @@
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0
AND s.type = 0
<if test="null != vo.lastYearTime">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.lastYearTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.lastYearTimeS">
AND e.entrust_time >= #{vo.lastYearTimeS}
</if>
<if test="null != vo.lastYearTimeE">
AND e.entrust_time &lt;= #{vo.lastYearTimeE}
</if>
) b,
(SELECT count(i.id) "total"
FROM entrust_sample_item i
......@@ -405,7 +469,15 @@
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0
AND s.type = 0
<if test="null != vo.prevTime">
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.prevTimeS">
AND e.entrust_time >= #{vo.prevTimeS}
</if>
<if test="null != vo.prevTimeE">
AND e.entrust_time &lt;= #{vo.prevTimeE}
</if>
) c
</select>
......@@ -469,19 +541,43 @@
FROM entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0
WHERE e.deleted = 0
<if test="null != vo.queryDate">
AND to_char(r.report_check_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.timeS">
AND r.report_check_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND r.report_check_time &lt;= #{vo.timeE}
</if>
) a,
(SELECT count(r.id) "total"
FROM entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0
WHERE e.deleted = 0
<if test="null != vo.lastYearTime">
AND to_char(r.report_check_time, 'yyyy-MM') = to_char(#{vo.lastYearTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.lastYearTimeS">
AND r.report_check_time >= #{vo.lastYearTimeS}
</if>
<if test="null != vo.lastYearTimeE">
AND r.report_check_time &lt;= #{vo.lastYearTimeE}
</if>
) b,
(SELECT count(r.id) "total"
FROM entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0
WHERE e.deleted = 0
<if test="null != vo.prevTime">
AND to_char(r.report_check_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
</if>
<if test="null != vo.prevTimeS">
AND r.report_check_time >= #{vo.prevTimeS}
</if>
<if test="null != vo.prevTimeE">
AND r.report_check_time &lt;= #{vo.prevTimeE}
</if>
) c
</select>
<!--报告发放量统计C-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment