|
@@ -25,8 +25,6 @@ import java.util.Objects;
|
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_FLOW_MSG_REFER)
|
|
|
public class FlowMsgReferReportController {
|
|
|
|
|
|
- public static final String TOTAL = "total";
|
|
|
-
|
|
|
public static final String READ_TOTAL = "readTotal";
|
|
|
|
|
|
public static final String UN_READ_TOTAL = "unReadTotal";
|
|
@@ -41,7 +39,7 @@ public class FlowMsgReferReportController {
|
|
|
@ApiOperation(value = "大区经理查阅统计")
|
|
|
@RequestMapping(value = "/area_manager/report", method = RequestMethod.POST)
|
|
|
@ApiResponses({ @ApiResponse(code = 200, message = "流程查阅提醒报表", response = FlowMsgReferReportBean.class) })
|
|
|
- public Result areaManagerCountReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
+ public Result areaManagerReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
return ResultUtil.ok(
|
|
|
this.calculateRate(flowMsgReferReportService.FlowMsgReport(serviceId, MessageTypeEnum.OFFICE_SOP)));
|
|
|
}
|
|
@@ -49,8 +47,7 @@ public class FlowMsgReferReportController {
|
|
|
@ApiOperation(value = "区域协调人查阅统计")
|
|
|
@RequestMapping(value = "/regional_coordinator/report", method = RequestMethod.POST)
|
|
|
@ApiResponses({ @ApiResponse(code = 200, message = "流程查阅提醒报表", response = FlowMsgReferReportBean.class) })
|
|
|
- public Result regionalCoordinatorCountReport(
|
|
|
- @ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
+ public Result regionalCoordinatorReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
return ResultUtil.ok(
|
|
|
this.calculateRate(flowMsgReferReportService.FlowMsgReport(serviceId, MessageTypeEnum.CLOUD_MARK_SOP)));
|
|
|
}
|
|
@@ -62,19 +59,20 @@ public class FlowMsgReferReportController {
|
|
|
* @return
|
|
|
*/
|
|
|
protected Map<String, Object> calculateRate(List<FlowMsgReferReportBean> flowMsgReferReportBeanList) {
|
|
|
- Integer sum = flowMsgReferReportBeanList.stream().mapToInt(s -> s.getSum()).sum();
|
|
|
- Integer readMsgSum = flowMsgReferReportBeanList.stream().mapToInt(s -> s.getReadMsg()).sum();
|
|
|
- Integer unReadMsgSum = flowMsgReferReportBeanList.stream().mapToInt(s -> s.getUnReadMsg()).sum();
|
|
|
- BigDecimal readRate = new BigDecimal(readMsgSum);
|
|
|
- BigDecimal unReadRate = new BigDecimal(unReadMsgSum);
|
|
|
- if (Objects.nonNull(sum) && sum.intValue() > 0) {
|
|
|
- readRate = readRate.divide(new BigDecimal(sum), 2, BigDecimal.ROUND_HALF_UP).multiply(SystemConstant.RATE)
|
|
|
+ Integer total = flowMsgReferReportBeanList.stream().mapToInt(s -> s.getSum()).sum();
|
|
|
+ Integer readMsgTotal = flowMsgReferReportBeanList.stream().mapToInt(s -> s.getReadMsg()).sum();
|
|
|
+ Integer unReadMsgTotal = flowMsgReferReportBeanList.stream().mapToInt(s -> s.getUnReadMsg()).sum();
|
|
|
+ BigDecimal readRate = new BigDecimal(readMsgTotal);
|
|
|
+ BigDecimal unReadRate = new BigDecimal(unReadMsgTotal);
|
|
|
+ if (Objects.nonNull(total) && total.intValue() > 0) {
|
|
|
+ readRate = readRate.divide(new BigDecimal(total), 2, BigDecimal.ROUND_HALF_UP).multiply(SystemConstant.RATE)
|
|
|
.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- unReadRate = unReadRate.divide(new BigDecimal(sum), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
+ unReadRate = unReadRate.divide(new BigDecimal(total), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(SystemConstant.RATE).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
- return new ImmutableMap.Builder<String, Object>().put(TOTAL, sum).put(READ_TOTAL, readMsgSum)
|
|
|
- .put(UN_READ_TOTAL, unReadMsgSum).put(READ_RATE, readRate).put(UN_READ_RATE, unReadRate)
|
|
|
- .put(ResourceSecurityReportController.RECORDS, flowMsgReferReportBeanList).build();
|
|
|
+ return new ImmutableMap.Builder<String, Object>().put(ResourceSecurityReportController.TOTAL, total)
|
|
|
+ .put(READ_TOTAL, readMsgTotal).put(UN_READ_TOTAL, unReadMsgTotal).put(READ_RATE, readRate)
|
|
|
+ .put(UN_READ_RATE, unReadRate).put(ResourceSecurityReportController.RECORDS, flowMsgReferReportBeanList)
|
|
|
+ .build();
|
|
|
}
|
|
|
}
|