|
|
@@ -39,6 +39,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import jdk.nashorn.internal.ir.annotations.Immutable;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@@ -96,6 +97,9 @@ public class IotReportOrderController {
|
|
|
List<AllOrderResp> maintains = iotMaintainMapper.selectStatusNumber(pageReqVO);
|
|
|
List<AllOrderResp> inspects = iotInspectOrderMapper.selectStatusNumber(pageReqVO);
|
|
|
List<AllOrderResp> operations = iotOpeationFillMapper.selectStatusNumber(pageReqVO);
|
|
|
+ Long wxTotal = maintains.stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ Long xjTotal = inspects.stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ Long yxTotal = operations.stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
// 保养
|
|
|
List<AllOrderResp> workOrders = iotMainWorkOrderMapper.selectStatusNumber(pageReqVO);
|
|
|
// 保养工单总数量
|
|
|
@@ -107,6 +111,22 @@ public class IotReportOrderController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ Long hbWxNum = 0L;
|
|
|
+ Long hbXjNum = 0L;
|
|
|
+ Long hbYxNum = 0L;
|
|
|
+ Long tbWxNum = 0L;
|
|
|
+ Long tbXjNum = 0L;
|
|
|
+ Long tbYxNum = 0L;
|
|
|
+ LocalDateTime lastYearStart = pageReqVO.getCreateTime()[0].minusYears(1);
|
|
|
+ LocalDateTime lastYearEnd = pageReqVO.getCreateTime()[1].minusYears(1);
|
|
|
+ LocalDateTime[] createTime = pageReqVO.getCreateTime();
|
|
|
+ createTime[0] = lastYearStart;
|
|
|
+ createTime[1] = lastYearEnd;
|
|
|
+ pageReqVO.setCreateTime(createTime);
|
|
|
+ hbWxNum = iotMaintainMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ hbXjNum = iotInspectOrderMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ hbYxNum = iotOpeationFillMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+
|
|
|
Long tbByNum = 0l;
|
|
|
Long hbByNum = 0l;
|
|
|
// 日报
|
|
|
@@ -162,6 +182,9 @@ public class IotReportOrderController {
|
|
|
if ("year".equals(pageReqVO.getTimeType())){
|
|
|
// 保养 年 无同比环比数据
|
|
|
hbByNum = hbByNum==null ? 0l : hbByNum;
|
|
|
+ tbWxNum = hbWxNum == null?0L:hbWxNum;
|
|
|
+ tbXjNum = hbXjNum == null?0L:hbXjNum;
|
|
|
+ tbYxNum = hbYxNum == null?0L:hbYxNum;
|
|
|
} else if ("month".equals(pageReqVO.getTimeType())){
|
|
|
LocalDateTime lastMonthStart = startTime.minusMonths(1);
|
|
|
LocalDateTime lastMonthEnd = endTime.minusMonths(1);
|
|
|
@@ -169,6 +192,10 @@ public class IotReportOrderController {
|
|
|
monthTime[0] = lastMonthStart;
|
|
|
monthTime[1] = lastMonthEnd;
|
|
|
pageReqVO.setCreateTime(monthTime);
|
|
|
+ tbWxNum = iotMaintainMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ tbXjNum = iotInspectOrderMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ tbYxNum = iotOpeationFillMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+
|
|
|
List<AllOrderResp> monthWorkOrders = iotMainWorkOrderMapper.selectStatusNumber(pageReqVO);
|
|
|
if (CollUtil.isNotEmpty(monthWorkOrders)) {
|
|
|
for (AllOrderResp order : monthWorkOrders) {
|
|
|
@@ -206,6 +233,10 @@ public class IotReportOrderController {
|
|
|
dayTime[0] = lastDayStart;
|
|
|
dayTime[1] = lastDayEnd;
|
|
|
pageReqVO.setCreateTime(dayTime);
|
|
|
+ tbWxNum = iotMaintainMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ tbXjNum = iotInspectOrderMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+ tbYxNum = iotOpeationFillMapper.selectStatusNumber(pageReqVO).stream().mapToLong(AllOrderResp::getNum).sum();
|
|
|
+
|
|
|
List<AllOrderResp> dayWorkOrders = iotMainWorkOrderMapper.selectStatusNumber(pageReqVO);
|
|
|
if (CollUtil.isNotEmpty(dayWorkOrders)) {
|
|
|
for (AllOrderResp order : dayWorkOrders) {
|
|
|
@@ -237,6 +268,26 @@ public class IotReportOrderController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Map<String, Object> wxMap = new HashMap<>();
|
|
|
+ wxMap.put("total", wxTotal);
|
|
|
+ wxMap.put("hb", (hbWxNum==null || hbWxNum==0l) ? hbWxNum :
|
|
|
+ ((new BigDecimal(wxTotal).subtract(new BigDecimal(hbWxNum))).divide(new BigDecimal(hbWxNum),2, RoundingMode.HALF_UP)));
|
|
|
+ wxMap.put("tb", (tbWxNum==null || tbWxNum==0l) ? tbWxNum :
|
|
|
+ ((new BigDecimal(wxTotal).subtract(new BigDecimal(tbWxNum))).divide(new BigDecimal(tbWxNum),2, RoundingMode.HALF_UP)));
|
|
|
+ Map<String, Object> xjMap = new HashMap<>();
|
|
|
+ xjMap.put("total", xjTotal);
|
|
|
+ xjMap.put("hb", (hbXjNum==null || hbXjNum==0l) ? hbXjNum :
|
|
|
+ ((new BigDecimal(xjTotal).subtract(new BigDecimal(hbXjNum))).divide(new BigDecimal(hbXjNum),2, RoundingMode.HALF_UP)));
|
|
|
+ xjMap.put("tb", (tbXjNum==null || tbXjNum==0l) ? tbXjNum :
|
|
|
+ ((new BigDecimal(xjTotal).subtract(new BigDecimal(tbXjNum))).divide(new BigDecimal(tbXjNum),2, RoundingMode.HALF_UP)));
|
|
|
+
|
|
|
+ Map<String, Object> yxMap = new HashMap<>();
|
|
|
+ yxMap.put("total", yxTotal);
|
|
|
+ yxMap.put("hb", (hbYxNum==null || hbYxNum==0l) ? hbYxNum :
|
|
|
+ ((new BigDecimal(yxTotal).subtract(new BigDecimal(hbYxNum))).divide(new BigDecimal(hbYxNum),2, RoundingMode.HALF_UP)));
|
|
|
+ yxMap.put("tb", (tbYxNum==null || tbYxNum==0l) ? tbYxNum :
|
|
|
+ ((new BigDecimal(yxTotal).subtract(new BigDecimal(tbYxNum))).divide(new BigDecimal(tbYxNum),2, RoundingMode.HALF_UP)));
|
|
|
+
|
|
|
Map<String, Object> byMap = new HashMap<>();
|
|
|
byMap.put("total", byNum);
|
|
|
byMap.put("hb", (hbByNum==null || hbByNum==0l) ? hbByNum :
|
|
|
@@ -251,7 +302,8 @@ public class IotReportOrderController {
|
|
|
rbMap.put("tb", (tbRbNum==null || tbRbNum==0l) ? tbRbNum :
|
|
|
((new BigDecimal(rbNum).subtract(new BigDecimal(tbRbNum))).divide(new BigDecimal(tbRbNum),2, RoundingMode.HALF_UP)));
|
|
|
|
|
|
- return CommonResult.success(ImmutableMap.of("wx", maintains, "xj", inspects, "yx", operations, "by", workOrders, "rb", reports));
|
|
|
+ return CommonResult.success(ImmutableMap.of("wx", ImmutableMap.of("total", wxMap,"status",maintains), "xj", ImmutableMap.of("total", xjMap, "status", inspects),
|
|
|
+ "yx", ImmutableMap.of("total",yxMap, "status",operations), "by", ImmutableMap.of("total", byMap,"status",workOrders), "rb", ImmutableMap.of("total", rbMap,"status", reports)));
|
|
|
}
|
|
|
|
|
|
|