diff --git a/chushang-common/chushang-common-log/pom.xml b/chushang-common/chushang-common-log/pom.xml
index d8c28e9..b67b2d5 100644
--- a/chushang-common/chushang-common-log/pom.xml
+++ b/chushang-common/chushang-common-log/pom.xml
@@ -24,6 +24,10 @@
com.chushang
chushang-common-security
+
+ com.chushang
+ chushang-common-mq
+
diff --git a/chushang-common/chushang-common-log/src/main/java/com/chushang/common/log/aspect/SysLogAspect.java b/chushang-common/chushang-common-log/src/main/java/com/chushang/common/log/aspect/SysLogAspect.java
index ea322b0..9fcc554 100644
--- a/chushang-common/chushang-common-log/src/main/java/com/chushang/common/log/aspect/SysLogAspect.java
+++ b/chushang-common/chushang-common-log/src/main/java/com/chushang/common/log/aspect/SysLogAspect.java
@@ -22,6 +22,7 @@ import com.chushang.common.core.constant.ServiceConstant;
import com.chushang.common.log.entity.SysLogEntity;
import com.chushang.common.log.enums.BusinessType;
import com.chushang.common.log.enums.LogTypeEnum;
+import com.chushang.common.mq.produce.MqProduceService;
import com.chushang.security.utils.SecurityUtils;
import com.chushang.security.entity.vo.LoginUser;
import lombok.RequiredArgsConstructor;
@@ -59,6 +60,7 @@ import java.util.stream.Collectors;
public class SysLogAspect {
final RedissonClient redissonClient;
+ private final MqProduceService mqProduceService;
@Pointcut("@annotation(com.chushang.common.log.annotation.SysLog)")
public void logPointCut() {
@@ -177,8 +179,9 @@ public class SysLogAspect {
assert syslog != null;
// if (null != ex){
// 入队列, 方便在system 统一查询
- RList list = redissonClient.getList(ServiceConstant.QUEUE_NAME);
- list.add(sysLogEntity);
+// RList list = redissonClient.getList(ServiceConstant.QUEUE_NAME);
+// list.add(sysLogEntity);
+ mqProduceService.send( ServiceConstant.QUEUE_NAME, sysLogEntity);
//// sysLogService.save(sysLogEntity);
// }else {
// log.info("log {}", JSONObject.toJSONString(sysLogEntity));
diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/vo/CountTaskVO.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/vo/CountVO.java
similarity index 66%
rename from chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/vo/CountTaskVO.java
rename to chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/vo/CountVO.java
index 56a2497..c19d1b0 100644
--- a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/vo/CountTaskVO.java
+++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/vo/CountVO.java
@@ -3,10 +3,10 @@ package com.chushang.inspection.project.vo;
import lombok.Data;
@Data
-public class CountTaskVO {
+public class CountVO {
private Long projectId;
- private int totalTask;
+ private int total;
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/WrkProjectController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/WrkProjectController.java
index d45570c..6f6950a 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/WrkProjectController.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/WrkProjectController.java
@@ -156,7 +156,7 @@ public class WrkProjectController {
* 项目数据 展示
*/
@GetMapping(value = "/project/data")
- @RequiresPermissions("inspection:project:info")
+// @RequiresPermissions("inspection:project:info")
public AjaxResult projectData(ProjectQuery projectQuery)
{
return AjaxResult.success(projectService.projectData(projectQuery));
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/mapper/PollingTaskMapper.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/mapper/PollingTaskMapper.java
index 67dca52..55443a5 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/mapper/PollingTaskMapper.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/mapper/PollingTaskMapper.java
@@ -4,9 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chushang.common.core.util.StringUtils;
import com.chushang.inspection.project.po.PollingTask;
-import com.chushang.inspection.project.vo.CountTaskVO;
+import com.chushang.inspection.project.vo.CountVO;
import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Set;
@@ -26,5 +25,5 @@ public interface PollingTaskMapper extends BaseMapper {
// 此处为null
return pollingTask.getSearchIndex();
}
- List countByProjectIds(@Param("projectIds") Set projectIds);
+ List countByProjectIds(@Param("projectIds") Set projectIds);
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/PollingTaskService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/PollingTaskService.java
index e1242f0..1a65273 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/PollingTaskService.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/PollingTaskService.java
@@ -1,5 +1,6 @@
package com.chushang.inspection.project.service;
+import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.common.mybatis.page.CommonParam;
@@ -7,14 +8,15 @@ import com.chushang.inspection.project.dto.TaskDTO;
import com.chushang.inspection.project.dto.TaskExcelDTO;
import com.chushang.inspection.project.dto.TaskQuery;
import com.chushang.inspection.project.po.PollingTask;
-import com.chushang.inspection.project.po.Template;
import com.chushang.inspection.project.vo.ConfigVO;
-import com.chushang.inspection.project.vo.CountTaskVO;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.project.vo.TaskVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
/**
* @auther: zhao
@@ -46,6 +48,18 @@ public interface PollingTaskService extends IService{
return ObjectUtil.isNotEmpty(task) ? task.getName() : "";
}
- List countByProjectIds(Set projectIds);
+ List countByProjectIds(Set projectIds);
+
+ default Map countByProjectIdsMap(Set projectIds){
+ List countVOS = countByProjectIds(projectIds);
+ if (CollectionUtil.isNotEmpty(countVOS)){
+ return countVOS.stream().collect(Collectors.toMap(
+ CountVO::getProjectId,
+ CountVO::getTotal,
+ Integer::sum
+ ));
+ }
+ return Map.of();
+ }
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/WrkProjectService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/WrkProjectService.java
index 97d1e1a..de603a5 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/WrkProjectService.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/WrkProjectService.java
@@ -1,7 +1,6 @@
package com.chushang.inspection.project.service;
import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -14,13 +13,10 @@ import com.chushang.common.mybatis.utils.WrapperUtils;
import com.chushang.datascope.annotation.DataScope;
import com.chushang.inspection.project.dto.ContractDTO;
import com.chushang.inspection.project.dto.ProjectDTO;
-import com.chushang.inspection.project.po.PollingTask;
-import com.chushang.inspection.project.po.WrkAudit;
import com.chushang.inspection.project.po.WrkProjectContract;
import com.chushang.inspection.project.query.ProjectQuery;
-import com.chushang.inspection.project.vo.CountTaskVO;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.project.vo.ProjectVO;
-import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.service.StoreService;
import com.chushang.inspection.terminal.service.TerminalService;
import com.chushang.inspection.work.service.WrkInfoService;
@@ -265,7 +261,6 @@ public class WrkProjectService extends ServiceImpl
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
sql
);
-
List recordList = page.getRecords();
List list = BeanUtil.copyToList(recordList, ProjectVO.class);
Set deptIds = list.stream().map(ProjectVO::getDeptId).collect(Collectors.toSet());
@@ -273,24 +268,26 @@ public class WrkProjectService extends ServiceImpl
= remoteDeptService.getDeptNameByIds(deptIds, SecurityConstants.INNER);
Set projectIds = list.stream().map(ProjectVO::getProjectId).collect(Collectors.toSet());
// 任务总数
- List totalTaskMap = taskService.countByProjectIds(projectIds);
- List taskList = taskService.list(new LambdaQueryWrapper()
- .in(PollingTask::getProjectId, projectIds));
- if (CollectionUtil.isNotEmpty(taskList)){
- Set taskIds = taskList.stream().map(PollingTask::getId).collect(Collectors.toSet());
- // 商户总数
- List storeList = storeService.list(new LambdaQueryWrapper()
- .in(Store::getLowerTaskId, taskIds));
-
- Map> storeMap
- = storeList.stream().collect(Collectors.groupingBy(Store::getLowerTaskId));
- // 商户id
- Set storeIds = storeList.stream().map(Store::getStoreId).collect(Collectors.toSet());
-
-
- }
-
+ Map totalTaskMap = taskService.countByProjectIdsMap(projectIds);
+ // 商户总数
+ Map totalStoreMap = storeService.countByProjectIdsMap(projectIds);
+ // 终端总数
+ Map totalTerminalMap = terminalService.countByProjectIdsMap(projectIds);
+ // 巡检工单总数
+ Map countInsMap = wrkInfoService.countByProjectIdsMap(projectIds, Set.of(5, 21));
+ // 工单总数
+ Map countWrkMap = wrkInfoService.countByProjectIdsMap(projectIds, Set.of());
+ list.forEach(p->{
+ Long deptId = p.getDeptId();
+ Long projectId = p.getProjectId();
+ p.setDeptName(deptNameMap.get(deptId));
+ p.setTotalWrk(countWrkMap.getOrDefault(projectId, 0));
+ p.setTotalIns(countInsMap.getOrDefault(projectId, 0));
+ p.setTotalTerminal(totalTerminalMap.getOrDefault(projectId, 0));
+ p.setTotalStore(totalStoreMap.getOrDefault(projectId, 0));
+ p.setTotalTask(totalTaskMap.getOrDefault(projectId, 0));
+ });
return new PageResult(list,page.getTotal(),page.getSize(),page.getCurrent());
}
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/PollingTaskServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/PollingTaskServiceImpl.java
index 1b4549a..fc7d20e 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/PollingTaskServiceImpl.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/PollingTaskServiceImpl.java
@@ -27,7 +27,7 @@ import com.chushang.inspection.project.dto.TaskDTO;
import com.chushang.inspection.project.dto.TaskExcelDTO;
import com.chushang.inspection.project.dto.TaskQuery;
import com.chushang.inspection.project.vo.ConfigVO;
-import com.chushang.inspection.project.vo.CountTaskVO;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.project.vo.TaskVO;
import com.chushang.inspection.project.service.PollingTaskService;
import com.chushang.security.utils.SecurityUtils;
@@ -248,7 +248,7 @@ public class PollingTaskServiceImpl extends ServiceImpl countByProjectIds(Set projectIds) {
+ public List countByProjectIds(Set projectIds) {
return baseMapper.countByProjectIds(projectIds);
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/StoreMapper.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/StoreMapper.java
index 5340730..c2e0307 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/StoreMapper.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/StoreMapper.java
@@ -3,12 +3,14 @@ package com.chushang.inspection.terminal.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chushang.datascope.annotation.DataScope;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.query.StoreQuery;
import com.chushang.inspection.terminal.vo.StoreVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
+import java.util.Set;
/**
* @auther: zhao
@@ -19,4 +21,7 @@ public interface StoreMapper extends BaseMapper {
@DataScope(deptAlias = "s")
List pageList(@Param("query") StoreQuery query,
Page page);
+
+ List countByProjectIds(@Param("projectIds") Set projectIds);
+
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/TerminalMapper.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/TerminalMapper.java
index 218a053..a881937 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/TerminalMapper.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/TerminalMapper.java
@@ -3,6 +3,7 @@ package com.chushang.inspection.terminal.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chushang.datascope.annotation.DataScope;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.project.vo.TerminalAppVO;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.po.Terminal;
@@ -15,6 +16,7 @@ import com.chushang.inspection.work.query.DispatchQuery;
import org.apache.ibatis.annotations.Param;
import java.util.List;
+import java.util.Set;
/**
* @auther: zhao
@@ -30,4 +32,5 @@ public interface TerminalMapper extends BaseMapper {
@DataScope(deptAlias = "t")
List getStoreByTasKIdOrIds(@Param("query") DispatchQuery query);
+ List countByProjectIds(@Param("projectIds") Set projectIds);
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/StoreService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/StoreService.java
index 86bd0ac..c473742 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/StoreService.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/StoreService.java
@@ -1,13 +1,20 @@
package com.chushang.inspection.terminal.service;
+import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.common.mybatis.utils.PageResult;
import com.chushang.inspection.project.po.Template;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.query.StoreQuery;
import com.chushang.inspection.work.dto.WrkIcbcJsReceive;
import org.springframework.web.multipart.MultipartFile;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
/**
* @auther: zhao
* @date: 2024/6/21 16:39
@@ -20,4 +27,17 @@ public interface StoreService extends IService{
void upload(MultipartFile file, Long taskId);
Store save(WrkIcbcJsReceive dto);
+
+ List countByProjectIds(Set projectIds);
+ default Map countByProjectIdsMap(Set projectIds){
+ List countVOS = countByProjectIds(projectIds);
+ if (CollectionUtil.isNotEmpty(countVOS)){
+ return countVOS.stream().collect(Collectors.toMap(
+ CountVO::getProjectId,
+ CountVO::getTotal,
+ Integer::sum
+ ));
+ }
+ return Map.of();
+ }
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/TerminalService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/TerminalService.java
index 0c2d267..2b550c2 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/TerminalService.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/TerminalService.java
@@ -1,8 +1,10 @@
package com.chushang.inspection.terminal.service;
+import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.common.mybatis.utils.PageResult;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.project.vo.TerminalApp;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.po.Terminal;
@@ -14,6 +16,8 @@ import com.chushang.inspection.work.query.DispatchQuery;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
/**
* @auther: zhao
@@ -62,4 +66,18 @@ public interface TerminalService extends IService{
JSONObject getTerMap(Long terminalId);
+
+ List countByProjectIds(Set projectIds);
+
+ default Map countByProjectIdsMap(Set projectIds){
+ List countVOS = countByProjectIds(projectIds);
+ if (CollectionUtil.isNotEmpty(countVOS)){
+ return countVOS.stream().collect(Collectors.toMap(
+ CountVO::getProjectId,
+ CountVO::getTotal,
+ Integer::sum
+ ));
+ }
+ return Map.of();
+ }
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/StoreServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/StoreServiceImpl.java
index e4091e0..24eadc9 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/StoreServiceImpl.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/StoreServiceImpl.java
@@ -16,6 +16,7 @@ import com.chushang.inspection.project.po.PollingTask;
import com.chushang.inspection.project.po.Template;
import com.chushang.inspection.project.service.PollingTaskService;
import com.chushang.inspection.project.service.TbTemplateService;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.query.StoreQuery;
import com.chushang.inspection.terminal.service.StoreService;
@@ -83,4 +84,9 @@ public class StoreServiceImpl extends ServiceImpl implements
return store;
}
+ @Override
+ public List countByProjectIds(Set projectIds) {
+ return baseMapper.countByProjectIds(projectIds);
+ }
+
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/TerminalServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/TerminalServiceImpl.java
index 8e57cce..629d0dd 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/TerminalServiceImpl.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/TerminalServiceImpl.java
@@ -15,6 +15,7 @@ import com.chushang.common.mybatis.enums.Operator;
import com.chushang.common.mybatis.page.CommonParam;
import com.chushang.common.mybatis.utils.PageResult;
import com.chushang.common.mybatis.utils.WrapperUtils;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.project.vo.TerminalApp;
import com.chushang.inspection.project.vo.TerminalAppVO;
import com.chushang.inspection.terminal.po.Store;
@@ -148,6 +149,11 @@ public class TerminalServiceImpl extends ServiceImpl i
return JSONObject.of("terminal", getById(terminalId), "terminalIns", terminalInsService.getById(terminalId));
}
+ @Override
+ public List countByProjectIds(Set projectIds) {
+ return baseMapper.countByProjectIds(projectIds);
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public long updateTerminalAndStore(TerminalQuery query) {
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java
index b78b094..ec7dfe0 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java
@@ -222,7 +222,7 @@ public class WrkInfoController {
* 提交 工单
*/
@PostMapping("/submit")
- @RequiresPermissions("wrk:submit")
+ @RequiresPermissions("wrk:info:submit")
@SysLog(value = "工单提交", businessType = BusinessType.INSERT)
public AjaxResult submit(@Validated @RequestBody WrkInfoDTO info) {
wrkInfoService.submit(info);
@@ -241,5 +241,11 @@ public class WrkInfoController {
return AjaxResult.success();
}
+ @GetMapping(value = "/data")
+ @RequiresPermissions("wrk:info:dispatch")
+ public AjaxResult wrkData(){
+ return AjaxResult.success();
+ }
+
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/mapper/WrkInfoMapper.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/mapper/WrkInfoMapper.java
index ad6d6b6..9aefe50 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/mapper/WrkInfoMapper.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/mapper/WrkInfoMapper.java
@@ -3,6 +3,7 @@ package com.chushang.inspection.work.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chushang.datascope.annotation.DataScope;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.work.po.WrkInfo;
import com.chushang.inspection.work.query.ReviewedQuery;
import com.chushang.inspection.work.query.WrkAppQuery;
@@ -11,6 +12,7 @@ import com.chushang.inspection.work.vo.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
+import java.util.Set;
/**
* @auther: zhao
@@ -32,4 +34,7 @@ public interface WrkInfoMapper extends BaseMapper {
@DataScope(deptAlias = "i")
List exportDispatchPage(@Param("query") WrkInfoQuery query);
+
+ List countByProjectIds(@Param("projectIds") Set projectIds,
+ @Param("wrkTypes") Set wrkTypes);
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java
index 8e0e9ad..0eab1fe 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java
@@ -1,7 +1,9 @@
package com.chushang.inspection.work.service;
+import cn.hutool.core.collection.CollectionUtil;
import com.chushang.common.mybatis.utils.PageResult;
import com.chushang.inspection.project.dto.AuditDTO;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.po.Terminal;
import com.chushang.inspection.terminal.po.TerminalIns;
@@ -16,6 +18,9 @@ import com.chushang.inspection.work.vo.WrkInfoDetailsVO;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
/**
* @auther: zhao
@@ -46,4 +51,17 @@ public interface WrkInfoService extends IService {
Long dispatch(WrkInfo wrkInfo, Store store, Terminal terminal, TerminalIns terminalIns);
+ List countByProjectIds(Set projectIds, Set wrkType);
+
+ default Map countByProjectIdsMap(Set projectIds, Set wrkType){
+ List countVOS = countByProjectIds(projectIds, wrkType);
+ if (CollectionUtil.isNotEmpty(countVOS)){
+ return countVOS.stream().collect(Collectors.toMap(
+ CountVO::getProjectId,
+ CountVO::getTotal,
+ Integer::sum
+ ));
+ }
+ return Map.of();
+ }
}
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java
index 76ae46f..af04995 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java
@@ -33,6 +33,7 @@ import com.chushang.inspection.project.dto.AuditDTO;
import com.chushang.inspection.project.po.InspectionData;
import com.chushang.inspection.project.service.InspectionDataService;
import com.chushang.inspection.project.service.PollingTaskService;
+import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.terminal.po.FiveStore;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.po.Terminal;
@@ -647,6 +648,11 @@ public class WrkInfoServiceImpl extends ServiceImpl impl
return wrkInfo.getWrkId();
}
+ @Override
+ public List countByProjectIds(Set projectIds, Set wrkType) {
+ return baseMapper.countByProjectIds(projectIds, wrkType);
+ }
+
/**
* 计算经纬度 偏差
*/
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/PollingTaskMapper.xml b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/PollingTaskMapper.xml
index 59f1d4f..8dae167 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/PollingTaskMapper.xml
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/PollingTaskMapper.xml
@@ -2,8 +2,8 @@
-
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml
index 35f7748..75e40ce 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml
@@ -237,4 +237,17 @@
+
+
+ SELECT COUNT(*) AS total, t.project_id AS projectId
+ FROM st_terminal t
+ where t.del_state = 0
+
+ AND t.project_id IN
+
+ #{projectId}
+
+
+ GROUP BY t.project_id
+
diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml
index 1adf492..47e37e3 100644
--- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml
+++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml
@@ -249,4 +249,23 @@
LEFT JOIN wrk_info_terminal_ins_record itir ON i.wrk_id = itir.wrk_id
WHERE i.del_state = 0
+
+
+ SELECT COUNT(*) AS total, wi.project_id AS projectId
+ FROM wrk_info wi
+ where wi.del_state = 0
+
+ AND wi.project_id IN
+
+ #{projectId}
+
+
+
+ AND wi.work_type IN
+
+ #{wrkType}
+
+
+ GROUP BY wi.project_id
+
diff --git a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/component/LogRedisComponent.java b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/component/LogRedisComponent.java
index 81e5fd0..575c37b 100644
--- a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/component/LogRedisComponent.java
+++ b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/component/LogRedisComponent.java
@@ -1,83 +1,83 @@
-package com.chushang.system.component;
-
-import com.chushang.common.core.constant.ServiceConstant;
-import com.chushang.common.log.entity.SysLogEntity;
-import com.chushang.system.service.SysLogService;
-import lombok.extern.slf4j.Slf4j;
-import org.redisson.api.RQueue;
-import org.redisson.api.RedissonClient;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import java.util.List;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @auther: zhao
- * @date: 2024/4/12 17:09
- */
-@Slf4j
-@Component
-public class LogRedisComponent {
-
- private final SysLogService logService;
- private final RedissonClient redissonClient;
- public LogRedisComponent(SysLogService logService, RedissonClient redissonClient){
- log.info("构造器执行");
- this.logService = logService;
- this.redissonClient = redissonClient;
- }
- private final ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1);
- @PostConstruct
- public void redisStart() {
- log.info("线程执行");
- Thread startLogQueueThread = startLogQueueThread();
- scheduledThreadPoolExecutor.scheduleWithFixedDelay(()->{
- Thread runLog = startLogQueueThread;
- try {
- boolean runLogThreadAlive = runLog.isAlive();
- if (!runLogThreadAlive) {
- throw new NullPointerException("runLogThread alive false");
- }
- } catch (Exception ex) {
- System.out.println("logQueueThread 重启线程");
- runLog = startLogQueueThread();
- }
- }, 10 ,30, TimeUnit.SECONDS);
- log.info("RedisLogQueueCollect is starting!");
- }
-
- private Thread startLogQueueThread() {
- Thread logQueueThread = new Thread(this::logQueueThread);
- logQueueThread.start();
- return logQueueThread;
- }
-
- private void logQueueThread()
- {
- while (true) {
- if (log.isDebugEnabled()){
- log.debug("读取redis 数据");
- }
- try {
- try {
- // 每1000 毫秒从 redis 获取一遍 入队数据
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- log.error("", e);
- Thread.currentThread().interrupt();
- }
- if (!redissonClient.isShutdown()){
- RQueue list = redissonClient.getQueue(ServiceConstant.QUEUE_NAME);
- List reqList = list.poll(5000);
- logService.saveBatch(reqList);
- }else {
- if (log.isDebugEnabled()) log.debug(" Redisson is shutdown");
- }
- } catch (RuntimeException e) {
- log.error("logQueueThread error, 并重启线程!", e);
- }
- }
- }
-}
+//package com.chushang.system.component;
+//
+//import com.chushang.common.core.constant.ServiceConstant;
+//import com.chushang.common.log.entity.SysLogEntity;
+//import com.chushang.system.service.SysLogService;
+//import lombok.extern.slf4j.Slf4j;
+//import org.redisson.api.RQueue;
+//import org.redisson.api.RedissonClient;
+//import org.springframework.stereotype.Component;
+//
+//import javax.annotation.PostConstruct;
+//import java.util.List;
+//import java.util.concurrent.ScheduledThreadPoolExecutor;
+//import java.util.concurrent.TimeUnit;
+//
+///**
+// * @auther: zhao
+// * @date: 2024/4/12 17:09
+// */
+//@Slf4j
+//@Component
+//public class LogRedisComponent {
+//
+// private final SysLogService logService;
+// private final RedissonClient redissonClient;
+// public LogRedisComponent(SysLogService logService, RedissonClient redissonClient){
+// log.info("构造器执行");
+// this.logService = logService;
+// this.redissonClient = redissonClient;
+// }
+// private final ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1);
+// @PostConstruct
+// public void redisStart() {
+// log.info("线程执行");
+// Thread startLogQueueThread = startLogQueueThread();
+// scheduledThreadPoolExecutor.scheduleWithFixedDelay(()->{
+// Thread runLog = startLogQueueThread;
+// try {
+// boolean runLogThreadAlive = runLog.isAlive();
+// if (!runLogThreadAlive) {
+// throw new NullPointerException("runLogThread alive false");
+// }
+// } catch (Exception ex) {
+// System.out.println("logQueueThread 重启线程");
+// runLog = startLogQueueThread();
+// }
+// }, 10 ,30, TimeUnit.SECONDS);
+// log.info("RedisLogQueueCollect is starting!");
+// }
+//
+// private Thread startLogQueueThread() {
+// Thread logQueueThread = new Thread(this::logQueueThread);
+// logQueueThread.start();
+// return logQueueThread;
+// }
+//
+// private void logQueueThread()
+// {
+// while (true) {
+// if (log.isDebugEnabled()){
+// log.debug("读取redis 数据");
+// }
+// try {
+// try {
+// // 每1000 毫秒从 redis 获取一遍 入队数据
+// Thread.sleep(1000);
+// } catch (InterruptedException e) {
+// log.error("", e);
+// Thread.currentThread().interrupt();
+// }
+// if (!redissonClient.isShutdown()){
+// RQueue list = redissonClient.getQueue(ServiceConstant.QUEUE_NAME);
+// List reqList = list.poll(5000);
+// logService.saveBatch(reqList);
+// }else {
+// if (log.isDebugEnabled()) log.debug(" Redisson is shutdown");
+// }
+// } catch (RuntimeException e) {
+// log.error("logQueueThread error, 并重启线程!", e);
+// }
+// }
+// }
+//}
diff --git a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/consumer/LogConsumerService.java b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/consumer/LogConsumerService.java
new file mode 100644
index 0000000..5a63f12
--- /dev/null
+++ b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/consumer/LogConsumerService.java
@@ -0,0 +1,45 @@
+package com.chushang.system.consumer;
+
+import com.alibaba.fastjson2.JSON;
+import com.chushang.common.core.constant.SecurityConstants;
+import com.chushang.common.core.constant.ServiceConstant;
+import com.chushang.common.core.context.SecurityContextHolder;
+import com.chushang.common.core.util.SpringUtils;
+import com.chushang.common.core.web.AjaxResult;
+import com.chushang.common.core.web.Result;
+import com.chushang.common.log.entity.SysLogEntity;
+import com.chushang.system.service.SysLogService;
+import com.chushang.task.entity.TaskInfo;
+import com.chushang.task.entity.dto.UpdateTaskDTO;
+import com.chushang.task.enums.TaskStatusEnum;
+import com.chushang.task.enums.TaskTypeEnum;
+import com.chushang.task.feign.RemoteTaskService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+import org.apache.rocketmq.spring.core.RocketMQListener;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.lang.reflect.Method;
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+/**
+ * @auther: zhao
+ * @date: 2024/6/12 16:59
+ */
+@Slf4j
+@Component
+@RocketMQMessageListener(topic = ServiceConstant.QUEUE_NAME, consumerGroup = ServiceConstant.SYSTEM_CONSUMER_GROUP)
+public class LogConsumerService implements RocketMQListener {
+ @Resource
+ private SysLogService logService;
+ /**
+ * 执行 下发的 后台任务
+ */
+ @Override
+ public void onMessage(SysLogEntity logEntity) {
+ log.info("消费日志 {}", JSON.toJSONString(logEntity));
+ logService.save(logEntity);
+ }
+}
diff --git a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java
index f087a46..e29e0f6 100644
--- a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java
+++ b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java
@@ -31,6 +31,7 @@ public class RemoteDeptController implements RemoteDeptService {
@GetMapping(value = "/getDeptNameByIds")
@InnerAuth
public Map getDeptNameByIds(@RequestParam Set deptIds, String source) {
+ if (CollectionUtil.isEmpty(deptIds)) return Map.of();
List sysDepts = deptService.listByIds(deptIds);
if (CollectionUtil.isNotEmpty(sysDepts)){
return sysDepts.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));