|
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.validation.constraints.Max;
|
|
import javax.validation.constraints.Max;
|
|
import javax.validation.constraints.Min;
|
|
import javax.validation.constraints.Min;
|
|
|
|
+import java.text.DecimalFormat;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -109,7 +110,7 @@ public class ServiceAnalyseController {
|
|
public Result role(
|
|
public Result role(
|
|
@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
|
|
@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
|
|
@ApiParam(value = "供应商", required = true) @RequestParam Long supplierId) {
|
|
@ApiParam(value = "供应商", required = true) @RequestParam Long supplierId) {
|
|
- List<Map<String, Object>> list = serviceAnalyseService.supplierRole(serviceUnitId,supplierId);
|
|
|
|
|
|
+ List<Map<String, Object>> list = serviceAnalyseService.supplierRole(serviceUnitId, supplierId);
|
|
return ResultUtil.ok(list);
|
|
return ResultUtil.ok(list);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -138,7 +139,7 @@ public class ServiceAnalyseController {
|
|
map.put("projectRoleQuota", serviceAnalyseService.findCrmAllocationSubTotal(serviceUnitId, regionId, null));
|
|
map.put("projectRoleQuota", serviceAnalyseService.findCrmAllocationSubTotal(serviceUnitId, regionId, null));
|
|
List<UserArchivesAllocationResult> crmAllocation = serviceAnalyseService.findCrmAllocation(serviceUnitId, regionId, supplierId);
|
|
List<UserArchivesAllocationResult> crmAllocation = serviceAnalyseService.findCrmAllocation(serviceUnitId, regionId, supplierId);
|
|
map.put("projectWait", crmAllocation.stream().filter(e -> e.getDistributed() < e.getQuota()).count());
|
|
map.put("projectWait", crmAllocation.stream().filter(e -> e.getDistributed() < e.getQuota()).count());
|
|
- map.put("regionCities", crmAllocation.stream().filter(e->e.getCity()!=null).collect(Collectors.groupingBy(UserArchivesAllocationResult::getCity)).size());
|
|
|
|
|
|
+ map.put("regionCities", crmAllocation.stream().filter(e -> e.getCity() != null).collect(Collectors.groupingBy(UserArchivesAllocationResult::getCity)).size());
|
|
return ResultUtil.ok(map);
|
|
return ResultUtil.ok(map);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -147,10 +148,19 @@ public class ServiceAnalyseController {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "项目调配完成进度")
|
|
@ApiOperation(value = "项目调配完成进度")
|
|
@RequestMapping(value = "/project/allocation", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/project/allocation", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "项目调配完成进度", response = Long.class)})
|
|
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "项目调配完成进度", response = Double.class)})
|
|
public Result allocation(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId) {
|
|
public Result allocation(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId) {
|
|
List<UserArchivesAllocationResult> crmAllocation = serviceAnalyseService.findCrmAllocation(serviceUnitId, null, null);
|
|
List<UserArchivesAllocationResult> crmAllocation = serviceAnalyseService.findCrmAllocation(serviceUnitId, null, null);
|
|
- return ResultUtil.ok(crmAllocation.isEmpty() ? 0 : crmAllocation.stream().filter(e -> e.getUnDistributed()<=0).count() / crmAllocation.size());
|
|
|
|
|
|
+
|
|
|
|
+ double result = crmAllocation.isEmpty() ? 0.00 : (double) crmAllocation.stream().filter(e -> e.getUnDistributed() > 0).count() / crmAllocation.size();
|
|
|
|
+// 创建DecimalFormat对象,指定保留两位小数
|
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#0.00");
|
|
|
|
+// 使用DecimalFormat格式化浮点数结果,得到字符串形式的结果
|
|
|
|
+ String formattedResult = decimalFormat.format(result);
|
|
|
|
+// 输出格式化后的结果
|
|
|
|
+ System.out.println(formattedResult);
|
|
|
|
+ return ResultUtil.success(formattedResult);
|
|
|
|
+// return ResultUtil.ok(crmAllocation.isEmpty() ? 0.00 : crmAllocation.stream().filter(e -> e.getUnDistributed()<=0).count() / crmAllocation.size());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -158,12 +168,19 @@ public class ServiceAnalyseController {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "人员配额完成进度")
|
|
@ApiOperation(value = "人员配额完成进度")
|
|
@RequestMapping(value = "/personnel/quota", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/personnel/quota", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "人员配额完成进度", response = Long.class)})
|
|
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "人员配额完成进度", response = Double.class)})
|
|
public Result quota(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId) {
|
|
public Result quota(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId) {
|
|
List<UserArchivesAllocationResult> list = serviceAnalyseService.findCrmAllocation(serviceUnitId, null, null);
|
|
List<UserArchivesAllocationResult> list = serviceAnalyseService.findCrmAllocation(serviceUnitId, null, null);
|
|
int quota = list.stream().mapToInt(UserArchivesAllocationResult::getQuota).sum();
|
|
int quota = list.stream().mapToInt(UserArchivesAllocationResult::getQuota).sum();
|
|
int distributed = list.stream().mapToInt(UserArchivesAllocationResult::getDistributed).sum();
|
|
int distributed = list.stream().mapToInt(UserArchivesAllocationResult::getDistributed).sum();
|
|
- return ResultUtil.ok(quota == 0 ? 0 : distributed / quota);
|
|
|
|
|
|
+ double result = quota == 0 ? 0 : (double) distributed / quota;
|
|
|
|
+// 创建DecimalFormat对象,指定保留两位小数
|
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#0.00");
|
|
|
|
+// 使用DecimalFormat格式化浮点数结果,得到字符串形式的结果
|
|
|
|
+ String formattedResult = decimalFormat.format(result);
|
|
|
|
+// 输出格式化后的结果
|
|
|
|
+ System.out.println(formattedResult);
|
|
|
|
+ return ResultUtil.success(formattedResult);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|