Browse Source

数据大屏, bug修改

master
DX 1 month ago
parent
commit
ac38f21655
  1. 20
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/BigViewDataController.java
  2. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/NameCountVO.java
  3. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/StatusCountVO.java
  4. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/bigviewdata/BigViewDataMapper.java
  5. 21
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java
  6. 27
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskExecJob.java
  7. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataService.java
  8. 24
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataServiceImpl.java
  9. 18
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java
  10. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  11. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java
  12. 12
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/bigviewdata/BigViewDataMapper.xml

20
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/BigViewDataController.java

@ -40,32 +40,32 @@ public class BigViewDataController {
@GetMapping("/getLeftSecond") @GetMapping("/getLeftSecond")
@Operation(summary = "大屏左二数据") @Operation(summary = "大屏左二数据")
public BigViewEnterpriseCountGroup getLeftSecond(HomeSelectVO homeSelectVO) { public CommonResult<BigViewEnterpriseCountGroup> getLeftSecond(HomeSelectVO homeSelectVO) {
return bigViewDataService.getLeftSecond(homeSelectVO); return success(bigViewDataService.getLeftSecond(homeSelectVO));
} }
@GetMapping("/getLeftThird") @GetMapping("/getLeftThird")
@Operation(summary = "大屏左三数据") @Operation(summary = "大屏左三数据")
public List<HomeGroupCountVO> getLeftThird(HomeSelectVO homeSelectVO) { public CommonResult<List<HomeGroupCountVO>> getLeftThird(HomeSelectVO homeSelectVO) {
return bigViewDataService.getLeftThird(homeSelectVO); return success(bigViewDataService.getLeftThird(homeSelectVO));
} }
@GetMapping("/getRightFist") @GetMapping("/getRightFist")
@Operation(summary = "大屏右一数据") @Operation(summary = "大屏右一数据")
public List<HomeGroupCountVO> getRightFist(HomeSelectVO homeSelectVO) { public CommonResult<List<HomeGroupCountVO>> getRightFist(HomeSelectVO homeSelectVO) {
return bigViewDataService.getRightFist(homeSelectVO); return success(bigViewDataService.getRightFist(homeSelectVO));
} }
@GetMapping("/getRightSecond") @GetMapping("/getRightSecond")
@Operation(summary = "大屏右二数据") @Operation(summary = "大屏右二数据")
public List<StatusCountVO> getRightSecond(HomeSelectVO homeSelectVO) { public CommonResult<List<NameCountVO>> getRightSecond(HomeSelectVO homeSelectVO) {
return bigViewDataService.getRightSecond(homeSelectVO); return success(bigViewDataService.getRightSecond(homeSelectVO));
} }
@GetMapping("/getRightThird") @GetMapping("/getRightThird")
@Operation(summary = "大屏右三数据") @Operation(summary = "大屏右三数据")
public List<HomeGroupCountVO> getRightThird(HomeSelectVO homeSelectVO) { public CommonResult<List<HomeGroupCountVO>> getRightThird(HomeSelectVO homeSelectVO) {
return bigViewDataService.getRightThird(homeSelectVO); return success(bigViewDataService.getRightThird(homeSelectVO));
} }
} }

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/NameCountVO.java

@ -5,5 +5,5 @@ import lombok.Data;
@Data @Data
public class NameCountVO { public class NameCountVO {
private String name; private String name;
private Integer count; private Integer value;
} }

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/StatusCountVO.java

@ -5,5 +5,6 @@ import lombok.Data;
@Data @Data
public class StatusCountVO { public class StatusCountVO {
private Integer status; private Integer status;
private Integer count; private Integer value;
private String name;
} }

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/bigviewdata/BigViewDataMapper.java

@ -17,7 +17,7 @@ public interface BigViewDataMapper {
/* /*
执法记录状态统计 执法记录状态统计
*/ */
List<StatusCountVO> selectStatusCount(HomeSelectVO homeSelectVO); List<NameCountVO> selectStatusCount(HomeSelectVO homeSelectVO);
/* /*
根据任务类型分组 根据任务类型分组

21
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.system.job;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
import cn.iocoder.yudao.module.system.api.social.SocialClientApi; import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxaSubscribeMessageSendReqDTO; import cn.iocoder.yudao.module.system.api.social.dto.SocialWxaSubscribeMessageSendReqDTO;
import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsCorrectionVO; import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsCorrectionVO;
@ -21,6 +23,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -40,6 +43,8 @@ public class InspectionsSendStartMessageJob implements JobHandler {
EnterpriseService enterpriseService; EnterpriseService enterpriseService;
@Resource @Resource
EnterpriseInspectionsService enterpriseInspectionsService; EnterpriseInspectionsService enterpriseInspectionsService;
@Resource
NotifyMessageSendApi notifyMessageSendApi;
@Override @Override
public String execute(String param) throws Exception { public String execute(String param) throws Exception {
@ -49,8 +54,24 @@ public class InspectionsSendStartMessageJob implements JobHandler {
if (enterpriseInspectionsCorrectionVOS != null && enterpriseInspectionsCorrectionVOS.size() > 0) { if (enterpriseInspectionsCorrectionVOS != null && enterpriseInspectionsCorrectionVOS.size() > 0) {
for (final EnterpriseInspectionsCorrectionVO item : enterpriseInspectionsCorrectionVOS) { for (final EnterpriseInspectionsCorrectionVO item : enterpriseInspectionsCorrectionVOS) {
final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(item.getInspectionsId()); final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(item.getInspectionsId());
//站内信发送通知
if (inspectionsLogNew != null && inspectionsLogNew.getStatus() == 3) { if (inspectionsLogNew != null && inspectionsLogNew.getStatus() == 3) {
//站内信发送通知
final EnterpriseDO enterprise = enterpriseService.getEnterprise(item.getEnterpriseId()); final EnterpriseDO enterprise = enterpriseService.getEnterprise(item.getEnterpriseId());
//站内信发送通知
NotifySendSingleToUserReqDTO notifyMessage = new NotifySendSingleToUserReqDTO();
notifyMessage.setUserId(Long.valueOf(item.getCreator()));
notifyMessage.setTemplateCode("correction_time");
Map<String, Object> templateParams = new HashMap<>();
templateParams.put("title", enterpriseService.getEnterprise(item.getEnterpriseId()).getEnterprisesName());
templateParams.put("correctionTime", inspectionsLogNew.getCorrectionTime());
notifyMessage.setTemplateParams(templateParams);
notifyMessageSendApi.sendSingleMessageToAdmin(notifyMessage);
num ++ ; num ++ ;
try { try {
SocialWxaSubscribeMessageSendReqDTO reqDTO = new SocialWxaSubscribeMessageSendReqDTO(); SocialWxaSubscribeMessageSendReqDTO reqDTO = new SocialWxaSubscribeMessageSendReqDTO();

27
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskExecJob.java

@ -1,27 +0,0 @@
package cn.iocoder.yudao.module.system.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class TaskExecJob implements JobHandler {
/**
* 执行任务
*
* @param param 参数
* @return 结果
* @throws Exception 异常
*/
@Resource
private TaskInfoService taskInfoService;
@Override
public String execute(String param) throws Exception {
final Long taskId = Long.valueOf(param);
taskInfoService.sendTask(taskId);
return "";
}
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataService.java

@ -17,7 +17,7 @@ public interface BigViewDataService {
List<HomeGroupCountVO> getRightFist(HomeSelectVO homeSelectVO); List<HomeGroupCountVO> getRightFist(HomeSelectVO homeSelectVO);
List<StatusCountVO> getRightSecond(HomeSelectVO homeSelectVO); List<NameCountVO> getRightSecond(HomeSelectVO homeSelectVO);
List<HomeGroupCountVO> getRightThird(HomeSelectVO homeSelectVO); List<HomeGroupCountVO> getRightThird(HomeSelectVO homeSelectVO);

24
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataServiceImpl.java

@ -33,7 +33,7 @@ public class BigViewDataServiceImpl implements BigViewDataService {
List<Integer> countList = new ArrayList<>(); List<Integer> countList = new ArrayList<>();
if (nameCountVOS != null) { if (nameCountVOS != null) {
nameCountVOS.forEach(item->{ nameCountVOS.forEach(item->{
countList.add(item.getCount()); countList.add(item.getValue());
}); });
} }
final Integer count = countList.stream().reduce(Integer::sum).orElse(0); final Integer count = countList.stream().reduce(Integer::sum).orElse(0);
@ -53,8 +53,26 @@ public class BigViewDataServiceImpl implements BigViewDataService {
} }
@Override @Override
public List<StatusCountVO> getRightSecond(HomeSelectVO homeSelectVO) { public List<NameCountVO> getRightSecond(HomeSelectVO homeSelectVO) {
return bigViewDataMapper.selectStatusCount(homeSelectVO);
final List<NameCountVO> statusCountVOS = bigViewDataMapper.selectStatusCount(homeSelectVO);
if (statusCountVOS != null && statusCountVOS.size() > 0) {
statusCountVOS.forEach(item->{
switch (item.getName()) {
case "1":
item.setName("已签到");
break;
case "2":
item.setName("已通过");
break;
case "3":
item.setName("整改中");
break;
}
});
}
return statusCountVOS;
} }
@Override @Override

18
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java

@ -221,6 +221,24 @@ public class EnterpriseServiceImpl implements EnterpriseService {
@Override @Override
public PageResult<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { public PageResult<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) {
//根据角色显示不同
/*
管理员局长查全部
检查员查自己的
队长 查本部门
*/
Long loginUserId = getLoginUserId();
final AdminUserDO user1 = adminUserService.getUser(loginUserId);
if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) {
//全部
} else if (user1.getPostIds().contains(4l)) {
//本部门
pageReqVO.setDepartmentId(user1.getDeptId());
} else if (user1.getPostIds().contains(5l)) {
//自己
pageReqVO.setUserId(loginUserId);
}
final PageResult<EnterpriseDO> enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); final PageResult<EnterpriseDO> enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO);

10
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java

@ -257,9 +257,11 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
} }
//查询企业标签 //查询企业标签
final List<TagLibraryDO> tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterpriseDO.getId()); final TagLibraryDO tagLibrary = tagLibraryService.getTagLibrary(taskInfoDO.getTaskType());
if (tagLibraryDOS != null) { if (tagLibrary != null) {
item.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); List<String> list = new ArrayList<>();
list.add(tagLibrary.getTagName());
item.setTagList(list);
} }
item.setEnterpriseName(enterpriseDO.getEnterprisesName()); item.setEnterpriseName(enterpriseDO.getEnterprisesName());
item.setEnterpriseAddress(enterpriseDO.getAddress()); item.setEnterpriseAddress(enterpriseDO.getAddress());
@ -301,10 +303,10 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
if (item.getUserId() != null) { if (item.getUserId() != null) {
final Long userId = Long.valueOf(item.getUserId()); final Long userId = Long.valueOf(item.getUserId());
final AdminUserDO user = adminUserService.getUser(userId); final AdminUserDO user = adminUserService.getUser(userId);
item.setInspectName(user.getRealName());
if (user == null) { if (user == null) {
throw exception(USER_NOT_EXISTS); throw exception(USER_NOT_EXISTS);
} }
item.setInspectName(user.getRealName());
} }
} }

1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

@ -101,7 +101,6 @@ public class TaskInfoServiceImpl implements TaskInfoService {
}); });
} }
//添加企业范围 //添加企业范围
if (!createReqVO.getEnterpriseIds().isEmpty() && createReqVO.getEnterpriseIds().size() > 0) { if (!createReqVO.getEnterpriseIds().isEmpty() && createReqVO.getEnterpriseIds().size() > 0) {
List<EnterpriseInspectionsDO> list = new ArrayList<>(); List<EnterpriseInspectionsDO> list = new ArrayList<>();

12
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/bigviewdata/BigViewDataMapper.xml

@ -14,7 +14,7 @@
resultType="cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.NameCountVO"> resultType="cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.NameCountVO">
select select
sd.name as name, sd.name as name,
count(e.id) as count count(e.id) as value
from from
enterprises e enterprises e
left join system_dept sd on e.department_id = sd.id left join system_dept sd on e.department_id = sd.id
@ -22,10 +22,10 @@
e.department_id e.department_id
</select> </select>
<select id="selectStatusCount" <select id="selectStatusCount"
resultType="cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.StatusCountVO"> resultType="cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.NameCountVO">
SELECT SELECT
status, status as name,
COUNT(*) AS count COUNT(*) AS value
FROM ( FROM (
SELECT il.* SELECT il.*
FROM inspections_log il FROM inspections_log il
@ -36,14 +36,14 @@
) AS latest ) AS latest
ON il.inspections_id = latest.inspections_id ON il.inspections_id = latest.inspections_id
AND il.create_time = latest.max_create_time AND il.create_time = latest.max_create_time
) AS latest_records ) AS latest_records where status != 0
GROUP BY status; GROUP BY status;
</select> </select>
<select id="selectTaskTypeGroupCount" <select id="selectTaskTypeGroupCount"
resultType="cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.NameCountVO"> resultType="cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.NameCountVO">
select select
tl.tag_name as name, tl.tag_name as name,
count(tl.id) as count count(tl.id) as value
from from
task_info t task_info t
left join tag_library tl on tl.id = t.task_type left join tag_library tl on tl.id = t.task_type

Loading…
Cancel
Save