|
@@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.rc.domain.*;
|
|
|
+import com.ruoyi.rc.mapper.TAuditMapper;
|
|
|
import com.ruoyi.rc.service.*;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -65,16 +66,49 @@ public class TAuditController extends BaseController
|
|
|
@Autowired
|
|
|
private ITOpenItemService itOpenItemService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TAuditMapper tAuditMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上级领导页面:查询首页顶部四个方框数据
|
|
|
+ */
|
|
|
+ @GetMapping("/homeData")
|
|
|
+ public AjaxResult getHomeData() {
|
|
|
+ HashMap map = new HashMap();
|
|
|
+
|
|
|
+ // 当前登录用户所在部门最近一次审计记录
|
|
|
+ TAudit audit = new TAudit();
|
|
|
+ audit.setDeptId(getLoginUser().getDeptId().toString());
|
|
|
+ TAudit latest = tAuditService.selectTAuditLatest(audit);
|
|
|
+ if (latest != null) {
|
|
|
+ Long auditId = latest.getId();
|
|
|
+
|
|
|
+ int homeData1 = tAuditMapper.selectHomeData1();
|
|
|
+ BigDecimal homeData2 = tAuditMapper.selectHomeData2();
|
|
|
+ int homeData3 = tAuditMapper.selectHomeData3(auditId);
|
|
|
+ int homeData4 = tAuditMapper.selectHomeData4(auditId);
|
|
|
+
|
|
|
+ map.put("homeData1", homeData1);
|
|
|
+ map.put("homeData2", homeData2);
|
|
|
+ map.put("homeData3", homeData3);
|
|
|
+ map.put("homeData4", homeData4);
|
|
|
+
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
- * 查询首页柱状图数据
|
|
|
+ * 普通员工页面:查询首页柱状图数据
|
|
|
*/
|
|
|
@GetMapping("/bar")
|
|
|
public AjaxResult getBar() {
|
|
|
TAudit audit = new TAudit();
|
|
|
audit.setDeptId(getLoginUser().getDeptId().toString());
|
|
|
TAudit latest = tAuditService.selectTAuditLatest(audit);
|
|
|
+ HashMap<String, String> map = new HashMap<String, String>();
|
|
|
if(latest != null) {
|
|
|
- HashMap<String, String> map = new HashMap<String, String>();
|
|
|
int code0Count = 0;
|
|
|
int code1Count = 0;
|
|
|
int code2Count = 0;
|
|
@@ -151,14 +185,23 @@ public class TAuditController extends BaseController
|
|
|
map.put("code7", code7CompleteProgress.toString());
|
|
|
map.put("code8", code8CompleteProgress.toString());
|
|
|
map.put("code9", code9CompleteProgress.toString());
|
|
|
- return success(map);
|
|
|
} else {
|
|
|
- return success();
|
|
|
+ map.put("code0", "0");
|
|
|
+ map.put("code1", "0");
|
|
|
+ map.put("code2", "0");
|
|
|
+ map.put("code3", "0");
|
|
|
+ map.put("code4", "0");
|
|
|
+ map.put("code5", "0");
|
|
|
+ map.put("code6", "0");
|
|
|
+ map.put("code7", "0");
|
|
|
+ map.put("code8", "0");
|
|
|
+ map.put("code9", "0");
|
|
|
}
|
|
|
+ return success(map);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询首页饼图数据
|
|
|
+ * 普通员工页面:查询首页饼图数据
|
|
|
*/
|
|
|
@GetMapping("/pie")
|
|
|
public AjaxResult getPie() {
|
|
@@ -168,29 +211,32 @@ public class TAuditController extends BaseController
|
|
|
TAudit audit = new TAudit();
|
|
|
audit.setDeptId(getLoginUser().getDeptId().toString());
|
|
|
TAudit latest = tAuditService.selectTAuditLatest(audit);
|
|
|
- Long auditId = latest.getId();
|
|
|
- TChapter chapter = new TChapter();
|
|
|
- chapter.setAuditId(auditId);
|
|
|
- List<TChapter> tChapters = tChapterService.selectTChapterList(chapter);
|
|
|
- for (TChapter tChapter : tChapters) {
|
|
|
- TQuestionnaire questionnaire = new TQuestionnaire();
|
|
|
- questionnaire.setChapterId(tChapter.getId());
|
|
|
- List<TQuestionnaire> tQuestionnaires = tQuestionnaireService.selectTQuestionnaireList(questionnaire);
|
|
|
- for (TQuestionnaire tQuestionnaire : tQuestionnaires) {
|
|
|
- TOpenItem openItem = new TOpenItem();
|
|
|
- openItem.setQuestionnaireId(tQuestionnaire.getId());
|
|
|
- List<TOpenItem> tOpenItems = itOpenItemService.selectTOpenItemList(openItem);
|
|
|
- for (TOpenItem tOpenItem : tOpenItems) {
|
|
|
- count++;
|
|
|
- String status = tOpenItem.getStatus();
|
|
|
- if ("4".equals(status)) {
|
|
|
- completeCount++;
|
|
|
+ if (latest != null) {
|
|
|
+ Long auditId = latest.getId();
|
|
|
+ TChapter chapter = new TChapter();
|
|
|
+ chapter.setAuditId(auditId);
|
|
|
+ List<TChapter> tChapters = tChapterService.selectTChapterList(chapter);
|
|
|
+ for (TChapter tChapter : tChapters) {
|
|
|
+ TQuestionnaire questionnaire = new TQuestionnaire();
|
|
|
+ questionnaire.setChapterId(tChapter.getId());
|
|
|
+ List<TQuestionnaire> tQuestionnaires = tQuestionnaireService.selectTQuestionnaireList(questionnaire);
|
|
|
+ for (TQuestionnaire tQuestionnaire : tQuestionnaires) {
|
|
|
+ TOpenItem openItem = new TOpenItem();
|
|
|
+ openItem.setQuestionnaireId(tQuestionnaire.getId());
|
|
|
+ List<TOpenItem> tOpenItems = itOpenItemService.selectTOpenItemList(openItem);
|
|
|
+ for (TOpenItem tOpenItem : tOpenItems) {
|
|
|
+ count++;
|
|
|
+ String status = tOpenItem.getStatus();
|
|
|
+ if ("4".equals(status)) {
|
|
|
+ completeCount++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if (count != 0) {
|
|
|
- progress = new BigDecimal(completeCount).divide(new BigDecimal(count), 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ if (count != 0) {
|
|
|
+ progress = new BigDecimal(completeCount).divide(new BigDecimal(count), 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return success(progress);
|
|
|
}
|