|
@@ -1,6 +1,9 @@
|
|
|
package com.ruoyi.web.controller.rc;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.BigInteger;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
@@ -59,6 +62,110 @@ public class TAuditController extends BaseController
|
|
|
@Autowired
|
|
|
private ITProgressService tProgressService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询首页柱状图数据
|
|
|
+ */
|
|
|
+ @GetMapping("/bar")
|
|
|
+ public AjaxResult getBar() {
|
|
|
+ TAudit audit = new TAudit();
|
|
|
+ audit.setDeptId(getLoginUser().getDeptId().toString());
|
|
|
+ TAudit latest = tAuditService.selectTAuditLatest(audit);
|
|
|
+ if(latest != null) {
|
|
|
+ HashMap<String, String> map = new HashMap<String, String>();
|
|
|
+ int code0Count = 0;
|
|
|
+ int code1Count = 0;
|
|
|
+ int code2Count = 0;
|
|
|
+ int code3Count = 0;
|
|
|
+ int code4Count = 0;
|
|
|
+ int code5Count = 0;
|
|
|
+ int code6Count = 0;
|
|
|
+ int code7Count = 0;
|
|
|
+ int code8Count = 0;
|
|
|
+ int code9Count = 0;
|
|
|
+ int code0CompleteCount = 0;
|
|
|
+ int code1CompleteCount = 0;
|
|
|
+ int code2CompleteCount = 0;
|
|
|
+ int code3CompleteCount = 0;
|
|
|
+ int code4CompleteCount = 0;
|
|
|
+ int code5CompleteCount = 0;
|
|
|
+ int code6CompleteCount = 0;
|
|
|
+ int code7CompleteCount = 0;
|
|
|
+ int code8CompleteCount = 0;
|
|
|
+ int code9CompleteCount = 0;
|
|
|
+ BigDecimal code0CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code1CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code2CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code3CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code4CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code5CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code6CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code7CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code8CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ BigDecimal code9CompleteProgress = new BigDecimal(BigInteger.ZERO);
|
|
|
+ Long auditId = latest.getId();
|
|
|
+ TChapter chapter = new TChapter();
|
|
|
+ chapter.setAuditId(auditId);
|
|
|
+ List<TChapter> tChapters = tChapterService.selectTChapterList(chapter);
|
|
|
+ for (TChapter tChapter : tChapters) {
|
|
|
+ String code = tChapter.getCode();
|
|
|
+ char firstChar = code.charAt(0);
|
|
|
+ TQuestionnaire questionnaire = new TQuestionnaire();
|
|
|
+ questionnaire.setChapterId(tChapter.getId());
|
|
|
+ List<TQuestionnaire> tQuestionnaires = tQuestionnaireService.selectTQuestionnaireList(questionnaire);
|
|
|
+ for (TQuestionnaire tQuestionnaire : tQuestionnaires) {
|
|
|
+ boolean flag = "1".equals(tQuestionnaire.getCompletionStatus());
|
|
|
+ switch (firstChar) {
|
|
|
+ case '0': code0Count++; if (flag) {code0CompleteCount++;} break;
|
|
|
+ case '1': code1Count++; if (flag) {code1CompleteCount++;} break;
|
|
|
+ case '2': code2Count++; if (flag) {code2CompleteCount++;} break;
|
|
|
+ case '3': code3Count++; if (flag) {code3CompleteCount++;} break;
|
|
|
+ case '4': code4Count++; if (flag) {code4CompleteCount++;} break;
|
|
|
+ case '5': code5Count++; if (flag) {code5CompleteCount++;} break;
|
|
|
+ case '6': code6Count++; if (flag) {code6CompleteCount++;} break;
|
|
|
+ case '7': code7Count++; if (flag) {code7CompleteCount++;} break;
|
|
|
+ case '8': code8Count++; if (flag) {code8CompleteCount++;} break;
|
|
|
+ case '9': code9Count++; if (flag) {code9CompleteCount++;} break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (code0Count != 0) {code0CompleteProgress = new BigDecimal(code0CompleteCount).divide(new BigDecimal(code0Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code1Count != 0) {code1CompleteProgress = new BigDecimal(code1CompleteCount).divide(new BigDecimal(code1Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code2Count != 0) {code2CompleteProgress = new BigDecimal(code2CompleteCount).divide(new BigDecimal(code2Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code3Count != 0) {code3CompleteProgress = new BigDecimal(code3CompleteCount).divide(new BigDecimal(code3Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code4Count != 0) {code4CompleteProgress = new BigDecimal(code4CompleteCount).divide(new BigDecimal(code4Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code5Count != 0) {code5CompleteProgress = new BigDecimal(code5CompleteCount).divide(new BigDecimal(code5Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code6Count != 0) {code6CompleteProgress = new BigDecimal(code6CompleteCount).divide(new BigDecimal(code6Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code7Count != 0) {code7CompleteProgress = new BigDecimal(code7CompleteCount).divide(new BigDecimal(code7Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code8Count != 0) {code8CompleteProgress = new BigDecimal(code8CompleteCount).divide(new BigDecimal(code8Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+ if (code9Count != 0) {code9CompleteProgress = new BigDecimal(code9CompleteCount).divide(new BigDecimal(code9Count), 4, BigDecimal.ROUND_HALF_UP);}
|
|
|
+
|
|
|
+ map.put("code0", code0CompleteProgress.toString());
|
|
|
+ map.put("code1", code1CompleteProgress.toString());
|
|
|
+ map.put("code2", code2CompleteProgress.toString());
|
|
|
+ map.put("code3", code3CompleteProgress.toString());
|
|
|
+ map.put("code4", code4CompleteProgress.toString());
|
|
|
+ map.put("code5", code5CompleteProgress.toString());
|
|
|
+ map.put("code6", code6CompleteProgress.toString());
|
|
|
+ map.put("code7", code7CompleteProgress.toString());
|
|
|
+ map.put("code8", code8CompleteProgress.toString());
|
|
|
+ map.put("code9", code9CompleteProgress.toString());
|
|
|
+
|
|
|
+ return success(map);
|
|
|
+ } else {
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询首页饼图数据
|
|
|
+ */
|
|
|
+ @GetMapping("/pie")
|
|
|
+ public AjaxResult getPie() {
|
|
|
+
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询当前登录用户所在部门最近一次审计记录
|
|
|
*/
|