|
@@ -26,12 +26,19 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
|
-@RequestMapping(value = "inspectManage", produces = "application/json")
|
|
|
|
|
|
|
+@RequestMapping(value = "assessResultManage", produces = "application/json")
|
|
|
public class AssessResultManageController {
|
|
public class AssessResultManageController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AssessResultService assessResultService;
|
|
private AssessResultService assessResultService;
|
|
|
|
|
|
|
|
- @PostMapping("/assess/page")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核结果分页查询
|
|
|
|
|
+ * @param pageSize 每页数量
|
|
|
|
|
+ * @param currentPage 当前页
|
|
|
|
|
+ * @param searchBean 查询条件
|
|
|
|
|
+ * @return 考核结果分页数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getAssessPage")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean assessPage(int pageSize, int currentPage, BuAssessResultSearchBean searchBean) {
|
|
public ResultBean assessPage(int pageSize, int currentPage, BuAssessResultSearchBean searchBean) {
|
|
|
PageControlData page = buildPage(pageSize, currentPage);
|
|
PageControlData page = buildPage(pageSize, currentPage);
|
|
@@ -39,7 +46,14 @@ public class AssessResultManageController {
|
|
|
return getPageResult(page, list);
|
|
return getPageResult(page, list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/rankPage")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核排名分页查询
|
|
|
|
|
+ * @param pageSize 每页数量
|
|
|
|
|
+ * @param currentPage 当前页
|
|
|
|
|
+ * @param searchBean 查询条件
|
|
|
|
|
+ * @return 考核排名分页数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getAssessRankPage")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean assessRankPage(int pageSize, int currentPage, BuAssessResultSearchBean searchBean) {
|
|
public ResultBean assessRankPage(int pageSize, int currentPage, BuAssessResultSearchBean searchBean) {
|
|
|
PageControlData page = buildPage(pageSize, currentPage);
|
|
PageControlData page = buildPage(pageSize, currentPage);
|
|
@@ -47,7 +61,15 @@ public class AssessResultManageController {
|
|
|
return getPageResult(page, list);
|
|
return getPageResult(page, list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/detail")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核结果详情(支持按ID或按门店+周期查询)
|
|
|
|
|
+ * @param id 考核结果ID
|
|
|
|
|
+ * @param storeId 门店ID
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @param periodCode 周期编码
|
|
|
|
|
+ * @return 考核结果详情
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getAssessDetail")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean assessDetail(Long id, Long storeId, Integer periodType, String periodCode) {
|
|
public ResultBean assessDetail(Long id, Long storeId, Integer periodType, String periodCode) {
|
|
|
BuAssessResult result;
|
|
BuAssessResult result;
|
|
@@ -61,7 +83,13 @@ public class AssessResultManageController {
|
|
|
return objectResult(result);
|
|
return objectResult(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/trend")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 门店考核趋势查询
|
|
|
|
|
+ * @param storeIds 门店ID集合
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @return 门店考核趋势列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getAssessTrend")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean assessTrend(@RequestParam("storeIds") List<Long> storeIds, @RequestParam(value = "periodType", required = false) Integer periodType) {
|
|
public ResultBean assessTrend(@RequestParam("storeIds") List<Long> storeIds, @RequestParam(value = "periodType", required = false) Integer periodType) {
|
|
|
if (storeIds == null || storeIds.isEmpty()) {
|
|
if (storeIds == null || storeIds.isEmpty()) {
|
|
@@ -71,7 +99,12 @@ public class AssessResultManageController {
|
|
|
return listResult(trend);
|
|
return listResult(trend);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/update")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更新考核结果
|
|
|
|
|
+ * @param assessResult 考核结果信息
|
|
|
|
|
+ * @return 更新结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/updateAssess")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean updateAssessResult(BuAssessResult assessResult) {
|
|
public ResultBean updateAssessResult(BuAssessResult assessResult) {
|
|
|
ResultBean bean = new ResultBean();
|
|
ResultBean bean = new ResultBean();
|
|
@@ -85,7 +118,12 @@ public class AssessResultManageController {
|
|
|
return bean;
|
|
return bean;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/delete")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除考核结果
|
|
|
|
|
+ * @param id 考核结果ID
|
|
|
|
|
+ * @return 删除结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/deleteAssess")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean deleteAssessResult(Long id) {
|
|
public ResultBean deleteAssessResult(Long id) {
|
|
|
ResultBean bean = new ResultBean();
|
|
ResultBean bean = new ResultBean();
|
|
@@ -99,7 +137,15 @@ public class AssessResultManageController {
|
|
|
return bean;
|
|
return bean;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/trigger")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核汇总(手动汇总:按周期内任务生成考核记录并立即计算得分/等级/排名)
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @param periodCode 周期编码
|
|
|
|
|
+ * @param periodStartDate 周期开始日期(yyyy-MM-dd)
|
|
|
|
|
+ * @param periodEndDate 周期结束日期(yyyy-MM-dd)
|
|
|
|
|
+ * @return 汇总结果,obj为参与汇总的门店数
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/triggerAssess")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean triggerAssess(Integer periodType, String periodCode,
|
|
public ResultBean triggerAssess(Integer periodType, String periodCode,
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date periodStartDate,
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date periodStartDate,
|
|
@@ -107,11 +153,29 @@ public class AssessResultManageController {
|
|
|
if (periodType == null || periodCode == null || periodStartDate == null || periodEndDate == null) {
|
|
if (periodType == null || periodCode == null || periodStartDate == null || periodEndDate == null) {
|
|
|
return paramError();
|
|
return paramError();
|
|
|
}
|
|
}
|
|
|
- int count = assessResultService.triggerAssess(periodType, periodCode, periodStartDate, periodEndDate);
|
|
|
|
|
- return statusResult(count > 0 ? 1 : 0, "考核初始化完成,共初始化 " + count + " 条记录");
|
|
|
|
|
|
|
+ ResultBean bean = new ResultBean();
|
|
|
|
|
+ int storeCount = assessResultService.triggerAssess(periodType, periodCode, periodStartDate, periodEndDate);
|
|
|
|
|
+ if (storeCount > 0) {
|
|
|
|
|
+ bean.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
|
|
+ bean.getRtnBean().setRtnMsg("考核汇总完成,共汇总 " + storeCount + " 家门店");
|
|
|
|
|
+ bean.setObj(storeCount);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bean.getRtnBean().setRtnCode(ReturnCode.FAILED);
|
|
|
|
|
+ bean.getRtnBean().setRtnMsg("该周期内没有可汇总的巡检任务数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ return bean;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/summarize")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核数据汇总(按门店+周期计算巡检分/自动分/综合分/等级)
|
|
|
|
|
+ * @param storeId 门店ID
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @param periodCode 周期编码
|
|
|
|
|
+ * @param startDate 开始日期(yyyy-MM-dd)
|
|
|
|
|
+ * @param endDate 结束日期(yyyy-MM-dd)
|
|
|
|
|
+ * @return 汇总结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/summarizeAssess")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean summarizeAssessResult(Long storeId, Integer periodType, String periodCode,
|
|
public ResultBean summarizeAssessResult(Long storeId, Integer periodType, String periodCode,
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
|
|
@@ -124,7 +188,13 @@ public class AssessResultManageController {
|
|
|
startDate, endDate), "考核汇总完成");
|
|
startDate, endDate), "考核汇总完成");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/rank")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核排名更新(按综合分重新计算排名)
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @param periodCode 周期编码
|
|
|
|
|
+ * @return 更新结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/updateAssessRank")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean updateAssessRank(Integer periodType, String periodCode) {
|
|
public ResultBean updateAssessRank(Integer periodType, String periodCode) {
|
|
|
if (periodType == null || periodCode == null) {
|
|
if (periodType == null || periodCode == null) {
|
|
@@ -133,7 +203,13 @@ public class AssessResultManageController {
|
|
|
return statusResult(assessResultService.updateAssessRank(periodType, periodCode), "排名更新完成");
|
|
return statusResult(assessResultService.updateAssessRank(periodType, periodCode), "排名更新完成");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/export")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核报告数据导出(返回JSON数据,供页面预览)
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @param periodCode 周期编码
|
|
|
|
|
+ * @return 考核报告数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/exportAssessReport")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean exportAssessReport(Integer periodType, String periodCode) {
|
|
public ResultBean exportAssessReport(Integer periodType, String periodCode) {
|
|
|
if (periodType == null || periodCode == null) {
|
|
if (periodType == null || periodCode == null) {
|
|
@@ -146,7 +222,13 @@ public class AssessResultManageController {
|
|
|
return objectResult(report);
|
|
return objectResult(report);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/levelDistribution")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核等级分布查询
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @param periodCode 周期编码
|
|
|
|
|
+ * @return 等级分布列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getLevelDistribution")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean getLevelDistribution(Integer periodType, String periodCode) {
|
|
public ResultBean getLevelDistribution(Integer periodType, String periodCode) {
|
|
|
if (periodType == null || periodCode == null) {
|
|
if (periodType == null || periodCode == null) {
|
|
@@ -155,7 +237,14 @@ public class AssessResultManageController {
|
|
|
return listResult(assessResultService.getLevelDistribution(periodType, periodCode));
|
|
return listResult(assessResultService.getLevelDistribution(periodType, periodCode));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/assess/exportExcel")
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 考核排名Excel导出(直接写出xlsx文件流)
|
|
|
|
|
+ * @param response HTTP响应
|
|
|
|
|
+ * @param periodType 周期类型(1周度 2月度)
|
|
|
|
|
+ * @param periodCode 周期编码
|
|
|
|
|
+ * @throws Exception 导出异常
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/exportAssessExcel")
|
|
|
@AuthToken(type = "admin")
|
|
@AuthToken(type = "admin")
|
|
|
public void exportAssessExcel(HttpServletResponse response, Integer periodType, String periodCode) throws Exception {
|
|
public void exportAssessExcel(HttpServletResponse response, Integer periodType, String periodCode) throws Exception {
|
|
|
if (periodType == null || periodCode == null) {
|
|
if (periodType == null || periodCode == null) {
|