Commit 497e10d1 by lijingjing

大屏接口月份跨年修改;

parent eddc4c47
...@@ -63,7 +63,8 @@ public class DateKit { ...@@ -63,7 +63,8 @@ public class DateKit {
} }
List<String> monthList = new ArrayList<>(); List<String> monthList = new ArrayList<>();
Period diff = Period.between(start, end); Period diff = Period.between(start, end);
for (int i = 0; i < diff.getMonths(); i++) { int months = diff.getYears() * 12 + diff.getMonths();
for (int i = 0; i < months; i++) {
monthList.add(getYearMonth(start.plusMonths(i))); monthList.add(getYearMonth(start.plusMonths(i)));
} }
return monthList; return monthList;
......
...@@ -123,8 +123,8 @@ public class StatisticsController extends ServiceController { ...@@ -123,8 +123,8 @@ public class StatisticsController extends ServiceController {
@ApiOperation("获取外检完成量数据") @ApiOperation("获取外检完成量数据")
@Login(action = Action.Skip) @Login(action = Action.Skip)
@PostMapping("/out_test_finish_quantity") @PostMapping("/out_test_finish_quantity")
public RestResult<Statistics> getOutTestFinishQuantity(QueryDTO queryDTO) { public RestResult<Statistics> getOutTestItemFinishQuantity(QueryDTO queryDTO) {
return success(statsService.getOutTestFinishQuantity(queryDTO)); return success(statsService.getOutTestItemFinishQuantity(queryDTO));
} }
@ApiOperation("外检项目数量统计") @ApiOperation("外检项目数量统计")
...@@ -141,6 +141,13 @@ public class StatisticsController extends ServiceController { ...@@ -141,6 +141,13 @@ public class StatisticsController extends ServiceController {
return success(statsService.getWorkloadQuantity(queryDTO)); return success(statsService.getWorkloadQuantity(queryDTO));
} }
@ApiOperation("验收工作量统计")
@Login(action = Action.Skip)
@PostMapping("/accept_workload_quantity")
public RestResult<Statistics> getAcceptWorkloadQuantity(RangeStatsQueryDTO queryDTO) {
return success(statsService.getAcceptWorkloadQuantity(queryDTO));
}
@ApiOperation("本周验收合格情况") @ApiOperation("本周验收合格情况")
@Login(action = Action.Skip) @Login(action = Action.Skip)
@PostMapping("/cur_week_acceptance_qualified") @PostMapping("/cur_week_acceptance_qualified")
......
...@@ -21,13 +21,13 @@ public interface StatisticsMapper extends BatchMapper<Statistics> { ...@@ -21,13 +21,13 @@ public interface StatisticsMapper extends BatchMapper<Statistics> {
Integer selectAlBrandLowFeStats(@Param("vo") QueryDTO dto); Integer selectAlBrandLowFeStats(@Param("vo") QueryDTO dto);
@SqlParser(filter = true) @SqlParser(filter = true)
Statistics selectOutTestFinishQuantity(@Param("vo") QueryDTO queryDTO); Statistics selectOutTestItemFinishQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
List<Statistics> selectCurWeekCarbonBlocks(@Param("vo") QueryDTO queryDTO); List<Statistics> selectCurWeekCarbonBlocks(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
List<Statistics> selectAcceptanceQualifiedByDate (@Param("vo") QueryDTO queryDTO); List<Statistics> selectAcceptanceQualifiedByDate(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
Statistics selectAcceptanceQualifiedByTimeFrame(@Param("vo") QueryDTO queryDTO); Statistics selectAcceptanceQualifiedByTimeFrame(@Param("vo") QueryDTO queryDTO);
...@@ -105,8 +105,11 @@ public interface StatisticsMapper extends BatchMapper<Statistics> { ...@@ -105,8 +105,11 @@ public interface StatisticsMapper extends BatchMapper<Statistics> {
List<Map<String, Object>> selectDetectedTasksQuantity(@Param("vo") QueryDTO queryDTO); List<Map<String, Object>> selectDetectedTasksQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
Map<String,Object> selectRawMaterialStageQuantity(@Param("vo") QueryDTO queryDTO); Map<String, Object> selectRawMaterialStageQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
Map<String, Object> selectProcessSampleStageQuantity(@Param("vo") QueryDTO queryDTO); Map<String, Object> selectProcessSampleStageQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true)
Statistics selectAcceptWorkloadQuantity(@Param("vo") RangeStatsQueryDTO queryDTO);
} }
...@@ -41,7 +41,7 @@ public interface IStatisticsService extends IBaseService<Statistics> { ...@@ -41,7 +41,7 @@ public interface IStatisticsService extends IBaseService<Statistics> {
Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO); Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO);
Statistics getOutTestFinishQuantity(QueryDTO queryDTO); Statistics getOutTestItemFinishQuantity(QueryDTO queryDTO);
List<Statistics> getOutTestItemQuantity(QueryDTO queryDTO); List<Statistics> getOutTestItemQuantity(QueryDTO queryDTO);
...@@ -80,4 +80,6 @@ public interface IStatisticsService extends IBaseService<Statistics> { ...@@ -80,4 +80,6 @@ public interface IStatisticsService extends IBaseService<Statistics> {
List<Map<String, Object>> getAssayMaterialQuantity(QueryDTO queryDTO); List<Map<String, Object>> getAssayMaterialQuantity(QueryDTO queryDTO);
Map<String, Object> getProcessSampleStageQuantity(QueryDTO queryDTO); Map<String, Object> getProcessSampleStageQuantity(QueryDTO queryDTO);
Statistics getAcceptWorkloadQuantity(RangeStatsQueryDTO queryDTO);
} }
...@@ -51,6 +51,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -51,6 +51,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
private List<Statistics> handleMonthData(QueryDTO queryDTO, List<Statistics> statistics) { private List<Statistics> handleMonthData(QueryDTO queryDTO, List<Statistics> statistics) {
List<String> months = DateKit.monthStrBetweenTwoDates(DateKit.date2Local(queryDTO.getTimeS()), DateKit.date2Local(queryDTO.getTimeE())); List<String> months = DateKit.monthStrBetweenTwoDates(DateKit.date2Local(queryDTO.getTimeS()), DateKit.date2Local(queryDTO.getTimeE()));
String lastYearMonth = com.patzn.cloud.commons.toolkit.DateUtils.toStrByFormatStr(queryDTO.getTimeE(), "yyyy-MM");
// 处理最后月份
if (CollectionUtils.isNotEmpty(months) && !months.contains(lastYearMonth)) {
months.add(lastYearMonth);
}
List<Statistics> statsList = new ArrayList<>(); List<Statistics> statsList = new ArrayList<>();
if (CollectionUtils.isEmpty(statistics)) { if (CollectionUtils.isEmpty(statistics)) {
statistics = months.stream().map(t -> new Statistics().setOccurDate(t).setDoneNum(0)).collect(Collectors.toList()); statistics = months.stream().map(t -> new Statistics().setOccurDate(t).setDoneNum(0)).collect(Collectors.toList());
...@@ -182,7 +187,7 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -182,7 +187,7 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
@Override @Override
public List<Statistics> getSamplingQuantity(RangeStatsQueryDTO queryDTO) { public List<Statistics> getSamplingQuantity(RangeStatsQueryDTO queryDTO) {
handleQueryTimeRange(queryDTO); handleSamesChainTimeRange(queryDTO);
return baseMapper.selectSamplingQuantity(queryDTO); return baseMapper.selectSamplingQuantity(queryDTO);
} }
...@@ -239,6 +244,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -239,6 +244,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
} }
@Override @Override
public Statistics getAcceptWorkloadQuantity(RangeStatsQueryDTO queryDTO) {
return baseMapper.selectAcceptWorkloadQuantity(queryDTO);
}
@Override
public Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO) { public Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO) {
handleSamesChainTimeRange(queryDTO); handleSamesChainTimeRange(queryDTO);
return baseMapper.selectItemSamesChainQuantity(queryDTO); return baseMapper.selectItemSamesChainQuantity(queryDTO);
...@@ -246,10 +256,8 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -246,10 +256,8 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
private void handleSamesChainTimeRange(RangeStatsQueryDTO queryDTO) { private void handleSamesChainTimeRange(RangeStatsQueryDTO queryDTO) {
RestAssert.fail(Objects.isNull(queryDTO.getQueryDate()), "查询日期不能为空!"); RestAssert.fail(Objects.isNull(queryDTO.getQueryDate()), "查询日期不能为空!");
String queryDateStr = com.patzn.cloud.commons.toolkit.DateUtils.toYearMonthDay(queryDTO.getQueryDate()); queryDTO.setLastYearTime(DateUtils.addYears(queryDTO.getQueryDate(), -1));
queryDTO.setTimeS(com.patzn.cloud.commons.toolkit.DateUtils.getYearMonthStart(queryDateStr)); queryDTO.setPrevTime(DateUtils.addMonths(queryDTO.getQueryDate(), -1));
queryDTO.setTimeE(com.patzn.cloud.commons.toolkit.DateUtils.getYearMonthEnd(queryDateStr));
handleTimeRange(queryDTO);
} }
/** /**
...@@ -260,15 +268,14 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -260,15 +268,14 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
private void handleTimeRange(RangeStatsQueryDTO queryDTO) { private void handleTimeRange(RangeStatsQueryDTO queryDTO) {
queryDTO.setLastYearTimeS(DateUtils.addYears(queryDTO.getTimeS(), -1)); queryDTO.setLastYearTimeS(DateUtils.addYears(queryDTO.getTimeS(), -1));
queryDTO.setLastYearTimeE(DateUtils.addYears(queryDTO.getTimeE(), -1)); queryDTO.setLastYearTimeE(DateUtils.addYears(queryDTO.getTimeE(), -1));
Integer days = DateKit.daysBetweenTwoDates(queryDTO.getTimeS(), queryDTO.getTimeE()) + 2; queryDTO.setPrevTimeS(DateUtils.addMonths(queryDTO.getTimeS(), -1));
queryDTO.setPrevTimeS(DateUtils.addDays(queryDTO.getTimeS(), -days)); queryDTO.setPrevTimeE(DateUtils.addMonths(queryDTO.getTimeE(), -1));
queryDTO.setPrevTimeE(queryDTO.getTimeS());
} }
@Override @Override
public Statistics getOutTestFinishQuantity(QueryDTO queryDTO) { public Statistics getOutTestItemFinishQuantity(QueryDTO queryDTO) {
handleQueryTime(queryDTO); handleQueryTime(queryDTO);
return baseMapper.selectOutTestFinishQuantity(queryDTO); return baseMapper.selectOutTestItemFinishQuantity(queryDTO);
} }
@Override @Override
......
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