|
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
@Api(tags = "质量监控分析Controller")
|
|
@@ -46,8 +47,30 @@ public class QualityAnalyseReportController {
|
|
|
@RequestMapping(value = "/area_manager/report", method = RequestMethod.POST)
|
|
|
@ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
|
|
|
public Result areaManagerReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
- List<QualityAnalyseReportBean> qualityAnalyseReportBeanList = qualityAnalyseReportService.areaQualityReport(
|
|
|
- serviceId);
|
|
|
+ return ResultUtil.ok(this.calculateRate(qualityAnalyseReportService.areaQualityReport(serviceId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "人力商质量问题统计")
|
|
|
+ @RequestMapping(value = "/human_supplier/report", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
|
|
|
+ public Result humanSupplierReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
+ return ResultUtil.ok(this.calculateRate(qualityAnalyseReportService.humanSupplierQualityReport(serviceId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "质量问题原因分类")
|
|
|
+ @RequestMapping(value = "/type/report", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
|
|
|
+ public Result typeReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算比率
|
|
|
+ *
|
|
|
+ * @param qualityAnalyseReportBeanList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected Map<String, Object> calculateRate(List<QualityAnalyseReportBean> qualityAnalyseReportBeanList) {
|
|
|
Integer total = qualityAnalyseReportBeanList.stream().mapToInt(s -> s.getSum()).sum();
|
|
|
Integer influenceDegreeATotal = qualityAnalyseReportBeanList.stream().mapToInt(s -> s.getInfluenceDegreeA())
|
|
|
.sum();
|
|
@@ -72,30 +95,15 @@ public class QualityAnalyseReportController {
|
|
|
influenceDegreeDRateTotal = influenceDegreeDRateTotal.divide(new BigDecimal(total), 2,
|
|
|
BigDecimal.ROUND_HALF_UP).multiply(SystemConstant.RATE).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
- return ResultUtil.ok(
|
|
|
- new ImmutableMap.Builder<String, Object>().put(ResourceSecurityReportController.TOTAL, total)
|
|
|
- .put(IN_FLUENCE_DEGREE_A_TOTAL, influenceDegreeATotal)
|
|
|
- .put(IN_FLUENCE_DEGREE_B_TOTAL, influenceDegreeBTotal)
|
|
|
- .put(IN_FLUENCE_DEGREE_C_TOTAL, influenceDegreeCTotal)
|
|
|
- .put(IN_FLUENCE_DEGREE_D_TOTAL, influenceDegreeDTotal)
|
|
|
- .put(IN_FLUENCE_DEGREE_A_RATE_TOTAL, influenceDegreeARateTotal)
|
|
|
- .put(IN_FLUENCE_DEGREE_B_RATE_TOTAL, influenceDegreeBRateTotal)
|
|
|
- .put(IN_FLUENCE_DEGREE_C_RATE_TOTAL, influenceDegreeCRateTotal)
|
|
|
- .put(IN_FLUENCE_DEGREE_D_RATE_TOTAL, influenceDegreeDRateTotal)
|
|
|
- .put(ResourceSecurityReportController.RECORDS, qualityAnalyseReportBeanList).build());
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "人力商质量问题统计")
|
|
|
- @RequestMapping(value = "/human_supplier/report", method = RequestMethod.POST)
|
|
|
- @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
|
|
|
- public Result humanSupplierReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
- return ResultUtil.ok();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "质量问题原因分类")
|
|
|
- @RequestMapping(value = "/type/report", method = RequestMethod.POST)
|
|
|
- @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
|
|
|
- public Result typeReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
|
|
|
- return ResultUtil.ok();
|
|
|
+ return new ImmutableMap.Builder<String, Object>().put(ResourceSecurityReportController.TOTAL, total)
|
|
|
+ .put(IN_FLUENCE_DEGREE_A_TOTAL, influenceDegreeATotal)
|
|
|
+ .put(IN_FLUENCE_DEGREE_B_TOTAL, influenceDegreeBTotal)
|
|
|
+ .put(IN_FLUENCE_DEGREE_C_TOTAL, influenceDegreeCTotal)
|
|
|
+ .put(IN_FLUENCE_DEGREE_D_TOTAL, influenceDegreeDTotal)
|
|
|
+ .put(IN_FLUENCE_DEGREE_A_RATE_TOTAL, influenceDegreeARateTotal)
|
|
|
+ .put(IN_FLUENCE_DEGREE_B_RATE_TOTAL, influenceDegreeBRateTotal)
|
|
|
+ .put(IN_FLUENCE_DEGREE_C_RATE_TOTAL, influenceDegreeCRateTotal)
|
|
|
+ .put(IN_FLUENCE_DEGREE_D_RATE_TOTAL, influenceDegreeDRateTotal)
|
|
|
+ .put(ResourceSecurityReportController.RECORDS, qualityAnalyseReportBeanList).build();
|
|
|
}
|
|
|
}
|