|
|
@@ -1,13 +1,18 @@
|
|
|
package com.ygtx.gxt.service.impl;
|
|
|
|
|
|
+import com.ygtx.common.constant.CacheConstants;
|
|
|
import com.ygtx.common.constant.Constants;
|
|
|
import com.ygtx.common.core.domain.entity.SysDept;
|
|
|
+import com.ygtx.common.core.redis.RedisCache;
|
|
|
import com.ygtx.common.utils.DateUtils;
|
|
|
import com.ygtx.common.utils.SecurityUtils;
|
|
|
import com.ygtx.common.utils.StringUtils;
|
|
|
import com.ygtx.common.utils.spring.SpringUtils;
|
|
|
+import com.ygtx.framework.web.service.SysPermissionService;
|
|
|
import com.ygtx.gxt.domain.*;
|
|
|
import com.ygtx.gxt.mapper.GxtOrderScoreMapper;
|
|
|
+import com.ygtx.gxt.mapper.GxtRepairOrderMapper;
|
|
|
+import com.ygtx.gxt.mapper.GxtWorkOrderMapper;
|
|
|
import com.ygtx.gxt.service.*;
|
|
|
import com.ygtx.system.mapper.SysDeptMapper;
|
|
|
import com.ygtx.system.service.ISysConfigService;
|
|
|
@@ -23,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 工单评分Service业务层处理
|
|
|
@@ -69,6 +75,18 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
@Autowired
|
|
|
private SysDeptMapper sysDeptMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysPermissionService permissionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GxtRepairOrderMapper gxtRepairOrderMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GxtWorkOrderMapper gxtWorkOrderMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询合并的工单列表(维修工单和维保工单)
|
|
|
*
|
|
|
@@ -1674,6 +1692,9 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
flow.setActionRemark("发起申诉:" + orderScoreInfo.getAppealReason());
|
|
|
repairOrderFlowService.insertGxtRepairOrderFlow(flow);
|
|
|
|
|
|
+ Long gxtCenterId = order.getGxtCenterId();
|
|
|
+ setRedisAppealNum(gxtCenterId);
|
|
|
+
|
|
|
return result;
|
|
|
} else if (orderScoreInfo.getOrderType() == 2) {
|
|
|
// 维保工单申诉
|
|
|
@@ -1705,6 +1726,9 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
flow.setActionRemark("发起申诉:" + orderScoreInfo.getAppealReason());
|
|
|
gxtWorkOrderFlowService.insertGxtWorkOrderFlow(flow);
|
|
|
|
|
|
+ Long gxtCenterId = order.getGxtCenterId();
|
|
|
+ setRedisAppealNum(gxtCenterId);
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
return 0;
|
|
|
@@ -2213,4 +2237,52 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
|
|
|
return filteredOrders;
|
|
|
}
|
|
|
+
|
|
|
+ private void setRedisAppealNum(Long deptId) {
|
|
|
+ SysUser sysUser = new SysUser();
|
|
|
+ sysUser.setDeptId(deptId);
|
|
|
+ List<SysUser> users = userMapper.selectUserList(sysUser);
|
|
|
+
|
|
|
+ // 过滤出属于目标部门且具有指定权限的用户
|
|
|
+ List<SysUser> targetUsers = users.stream()
|
|
|
+ .filter(user -> {
|
|
|
+ // 检查用户是否具有"gxt:orderScore:finalEvaluation"权限
|
|
|
+ Set<String> userPermissions = permissionService.getMenuPermission(user);
|
|
|
+ return SecurityUtils.hasPermi(userPermissions, "gxt:orderScore:finalEvaluation");
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ GxtRepairOrder gxtRepairOrder = new GxtRepairOrder();
|
|
|
+ gxtRepairOrder.setGxtCenterId(deptId);
|
|
|
+ gxtRepairOrder.setScoringStatus("appealing");
|
|
|
+ List<GxtRepairOrder> repairOrders = gxtRepairOrderMapper.selectGxtRepairOrderList(gxtRepairOrder);
|
|
|
+ // 过滤掉状态为"invalid"的工单
|
|
|
+ repairOrders = repairOrders.stream()
|
|
|
+ .filter(order -> !"invalid".equals(order.getWorkOrderStatus()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ GxtWorkOrder gxtWorkOrder = new GxtWorkOrder();
|
|
|
+ gxtWorkOrder.setGxtCenterId(deptId);
|
|
|
+ gxtWorkOrder.setScoringStatus("appealing");
|
|
|
+ List<GxtWorkOrder> workOrders = gxtWorkOrderMapper.selectGxtWorkOrderList(gxtWorkOrder);
|
|
|
+ // 过滤掉状态为"invalid"的工单
|
|
|
+ workOrders = workOrders.stream()
|
|
|
+ .filter(order -> !"invalid".equals(order.getWorkOrderStatus()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 循环这些用户,更新他们的待申诉数量
|
|
|
+ for (SysUser user : targetUsers) {
|
|
|
+ Long userId = user.getUserId();
|
|
|
+ int taskNum = 0;
|
|
|
+ if (repairOrders != null && !repairOrders.isEmpty()) {
|
|
|
+ taskNum = taskNum + repairOrders.size() ;
|
|
|
+ }
|
|
|
+ if (workOrders != null && !workOrders.isEmpty()) {
|
|
|
+ taskNum = taskNum + workOrders.size() ;
|
|
|
+ }
|
|
|
+ if(taskNum > 0){
|
|
|
+ redisCache.lPush(CacheConstants.NOTIFY_STORAGE_APPEAL_KEY, userId, taskNum + "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|