|
@@ -0,0 +1,123 @@
|
|
|
+package com.ruoyi.project.common.controller;
|
|
|
+
|
|
|
+import com.ruoyi.framework.web.controller.BaseController;
|
|
|
+import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
+import com.ruoyi.project.document.domain.TPlantproglist;
|
|
|
+import com.ruoyi.project.document.service.ITPlantproglistService;
|
|
|
+import com.ruoyi.project.ehs.domain.TEnvironapproval;
|
|
|
+import com.ruoyi.project.ehs.domain.TFireapproval;
|
|
|
+import com.ruoyi.project.ehs.domain.THealthapproval;
|
|
|
+import com.ruoyi.project.ehs.domain.TSafetyapproval;
|
|
|
+import com.ruoyi.project.ehs.service.ITEnvironapprovalService;
|
|
|
+import com.ruoyi.project.ehs.service.ITFireapprovalService;
|
|
|
+import com.ruoyi.project.ehs.service.ITHealthapprovalService;
|
|
|
+import com.ruoyi.project.ehs.service.ITSafetyapprovalService;
|
|
|
+import com.ruoyi.project.training.domain.TTraining;
|
|
|
+import com.ruoyi.project.training.service.ITTrainingService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/cbps/home")
|
|
|
+public class CBPSHomeDataController extends BaseController {
|
|
|
+ @Autowired
|
|
|
+ private ITSafetyapprovalService tSafetyapprovalService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITFireapprovalService tFireapprovalService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITEnvironapprovalService tEnvironapprovalService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITHealthapprovalService tHealthapprovalService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPlantproglistService tPlantproglistService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITTrainingService tTrainingService;
|
|
|
+
|
|
|
+ @GetMapping("/countNum")
|
|
|
+ public AjaxResult getCountNum() {
|
|
|
+ List<TSafetyapproval> safeList = tSafetyapprovalService.selectTSafetyapprovalList(new TSafetyapproval());
|
|
|
+ List<TFireapproval> fireList = tFireapprovalService.selectTFireapprovalList(new TFireapproval());
|
|
|
+ List<TEnvironapproval> envList = tEnvironapprovalService.selectTEnvironapprovalList(new TEnvironapproval());
|
|
|
+ List<THealthapproval> healthList = tHealthapprovalService.selectTHealthapprovalList(new THealthapproval());
|
|
|
+ HashMap<String, Integer> result = new HashMap<>();
|
|
|
+ result.put("safeNum", safeList.size());
|
|
|
+ result.put("fireNum", fireList.size());
|
|
|
+ result.put("envNum", envList.size());
|
|
|
+ result.put("healthNum", healthList.size());
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/procedureCount")
|
|
|
+ public AjaxResult procedureCount() {
|
|
|
+ TPlantproglist tPlantproglist = new TPlantproglist();
|
|
|
+ HashMap<String, Object> result = new HashMap<>();
|
|
|
+ tPlantproglist.setItem(2L);
|
|
|
+ List<TPlantproglist> list = tPlantproglistService.selectTPlantproglistList(tPlantproglist);
|
|
|
+ result.put("appNum", list.size());
|
|
|
+ result.put("app", "程序总汇");
|
|
|
+
|
|
|
+ tPlantproglist.setItem(3L);
|
|
|
+ list = tPlantproglistService.selectTPlantproglistList(tPlantproglist);
|
|
|
+ result.put("fingerpostNum", list.size());
|
|
|
+ result.put("fingerpost", "指南总汇");
|
|
|
+
|
|
|
+ tPlantproglist.setItem(4L);
|
|
|
+ list = tPlantproglistService.selectTPlantproglistList(tPlantproglist);
|
|
|
+ result.put("guideNum", list.size());
|
|
|
+ result.put("guide", "指导书总汇");
|
|
|
+
|
|
|
+ tPlantproglist.setItem(5L);
|
|
|
+ list = tPlantproglistService.selectTPlantproglistList(tPlantproglist);
|
|
|
+ result.put("fileNum", list.size());
|
|
|
+ result.put("file", "附件总汇");
|
|
|
+
|
|
|
+ tPlantproglist.setItem(1L);
|
|
|
+ list = tPlantproglistService.selectTPlantproglistList(tPlantproglist);
|
|
|
+ result.put("excelNum", list.size());
|
|
|
+ result.put("excel", "表格总汇");
|
|
|
+
|
|
|
+ tPlantproglist.setItem(6L);
|
|
|
+ list = tPlantproglistService.selectTPlantproglistList(tPlantproglist);
|
|
|
+ result.put("trainNum", list.size());
|
|
|
+ result.put("train", "培训材料");
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/trainCount")
|
|
|
+ public AjaxResult getTrainCount() {
|
|
|
+ TTraining tTraining = new TTraining();
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ tTraining.setYear(String.valueOf(cal.get(Calendar.YEAR)));
|
|
|
+ return AjaxResult.success(tTrainingService.countTTraining(tTraining));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getLine")
|
|
|
+ public AjaxResult getLine() {
|
|
|
+
|
|
|
+ TPlantproglist tPlantproglist = new TPlantproglist();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM");
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ Map<String, List<TPlantproglist>> result = new HashMap<>();
|
|
|
+ List<TPlantproglist> nextEdits = new ArrayList<>();
|
|
|
+ List<TPlantproglist> nextReviews = new ArrayList<>();
|
|
|
+ for (int i = 1; i < 8; i++) {
|
|
|
+ tPlantproglist.setStartDate(sdf.format(cal.getTime()));
|
|
|
+ cal.add(Calendar.MONTH, 1);
|
|
|
+ nextEdits.addAll(tPlantproglistService.countNextEditDate(tPlantproglist));
|
|
|
+ nextReviews.addAll(tPlantproglistService.countNextReviewDate(tPlantproglist));
|
|
|
+ }
|
|
|
+ result.put("nextEdit", nextEdits);
|
|
|
+ result.put("nextReview",nextReviews);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+}
|