|
|
@@ -17,13 +17,25 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
+/**
|
|
|
+ * I02
|
|
|
+ * 巡检计划配置管理Controller。
|
|
|
+ */
|
|
|
@RestController
|
|
|
@RequestMapping(value = "inspectManage", produces = "application/json")
|
|
|
public class InspectPlanManageController {
|
|
|
@Autowired
|
|
|
private InspectPlanService inspectPlanService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 巡检计划分页查询
|
|
|
+ * @param pageSize
|
|
|
+ * @param currentPage
|
|
|
+ * @param searchBean
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/page")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean planPage(int pageSize, int currentPage, BuInspectPlanSearchBean searchBean) {
|
|
|
@@ -31,13 +43,21 @@ public class InspectPlanManageController {
|
|
|
List<?> list = inspectPlanService.getPlanPage(page, searchBean);
|
|
|
return getPageResult(page, list);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划详情
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/detail")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean planDetail(Long id) {
|
|
|
return objectResult(id == null ? null : inspectPlanService.getPlanDetail(id));
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划关联指标详情
|
|
|
+ * @param planId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/indicators")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean planIndicators(Long planId) {
|
|
|
@@ -46,7 +66,11 @@ public class InspectPlanManageController {
|
|
|
}
|
|
|
return listResult(inspectPlanService.getPlanIndicators(planId));
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划关联门店详情
|
|
|
+ * @param planId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/stores")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean planStores(Long planId) {
|
|
|
@@ -55,7 +79,11 @@ public class InspectPlanManageController {
|
|
|
}
|
|
|
return listResult(inspectPlanService.getPlanStores(planId));
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划新增/更新
|
|
|
+ * @param plan
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/save")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean savePlan(com.sapit.common.entity.inspect.BuInspectPlan plan) {
|
|
|
@@ -70,7 +98,11 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg(plan.getPlanId() == null ? "新增完成" : "保存完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划更新
|
|
|
+ * @param plan
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/update")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean updatePlan(com.sapit.common.entity.inspect.BuInspectPlan plan) {
|
|
|
@@ -85,7 +117,11 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg("更新完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划删除
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/delete")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean deletePlan(Long id) {
|
|
|
@@ -99,16 +135,35 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg("删除完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划发布
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/publish")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean publishPlan(Long id) {
|
|
|
+ ResultBean bean = new ResultBean();
|
|
|
if (id == null) {
|
|
|
- return paramError();
|
|
|
+ bean.getRtnBean().setRtnCode(ReturnCode.PARAM_WRONG);
|
|
|
+ bean.getRtnBean().setRtnMsg("参数错误");
|
|
|
+ return bean;
|
|
|
}
|
|
|
- return statusResult(inspectPlanService.publish(id), "发布完成");
|
|
|
+ Map<String, Object> result = inspectPlanService.publish(id);
|
|
|
+ if (Boolean.TRUE.equals(result.get("success"))) {
|
|
|
+ bean.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
+ bean.getRtnBean().setRtnMsg("发布完成");
|
|
|
+ } else {
|
|
|
+ bean.getRtnBean().setRtnCode(ReturnCode.FAILED);
|
|
|
+ bean.getRtnBean().setRtnMsg(String.valueOf(result.get("reason")));
|
|
|
+ }
|
|
|
+ return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划暂停
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/pause")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean pausePlan(Long id) {
|
|
|
@@ -117,7 +172,11 @@ public class InspectPlanManageController {
|
|
|
}
|
|
|
return statusResult(inspectPlanService.changeStatus(id, 2), "暂停完成");
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检计划结束
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/plan/finish")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean finishPlan(Long id) {
|
|
|
@@ -126,7 +185,13 @@ public class InspectPlanManageController {
|
|
|
}
|
|
|
return statusResult(inspectPlanService.finish(id), "结束完成");
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标分页查询
|
|
|
+ * @param pageSize 每页数量
|
|
|
+ * @param currentPage 当前页
|
|
|
+ * @param searchBean 查询条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planIndicator/page")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean planIndicatorPage(int pageSize, int currentPage, BuInspectPlanIndicatorSearchBean searchBean) {
|
|
|
@@ -134,7 +199,11 @@ public class InspectPlanManageController {
|
|
|
List<?> list = inspectPlanService.getPlanIndicatorPage(page, searchBean);
|
|
|
return getPageResult(page, list);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标新增/更新
|
|
|
+ * @param planIndicator
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planIndicator/save")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean savePlanIndicator(BuInspectPlanIndicator planIndicator) {
|
|
|
@@ -148,7 +217,11 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg(planIndicator.getPlanIndicatorId() == null ? "新增完成" : "保存完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标更新
|
|
|
+ * @param planIndicator
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planIndicator/update")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean updatePlanIndicator(BuInspectPlanIndicator planIndicator) {
|
|
|
@@ -162,7 +235,11 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg("更新完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标删除
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planIndicator/delete")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean deletePlanIndicator(Long id) {
|
|
|
@@ -176,7 +253,13 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg("删除完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标分页查询
|
|
|
+ * @param pageSize 每页数量
|
|
|
+ * @param currentPage 当前页
|
|
|
+ * @param searchBean 查询条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planStore/page")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean planStorePage(int pageSize, int currentPage, BuInspectPlanStoreSearchBean searchBean) {
|
|
|
@@ -184,7 +267,11 @@ public class InspectPlanManageController {
|
|
|
List<?> list = inspectPlanService.getPlanStorePage(page, searchBean);
|
|
|
return getPageResult(page, list);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标新增/更新
|
|
|
+ * @param planStore
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planStore/save")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean savePlanStore(BuInspectPlanStore planStore) {
|
|
|
@@ -198,7 +285,11 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg(planStore.getPlanStoreId() == null ? "新增完成" : "保存完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标更新
|
|
|
+ * @param planStore
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planStore/update")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean updatePlanStore(BuInspectPlanStore planStore) {
|
|
|
@@ -212,7 +303,11 @@ public class InspectPlanManageController {
|
|
|
bean.getRtnBean().setRtnMsg("更新完成");
|
|
|
return bean;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 巡检指标删除
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/planStore/delete")
|
|
|
@AuthToken(type = "admin")
|
|
|
public ResultBean deletePlanStore(Long id) {
|