ccjgmwz 3 年之前
父節點
當前提交
3de6129ab2

+ 1 - 1
winsea-haixin-platform-backend/src/main/resources/application-prod.yml

@@ -43,7 +43,7 @@ jasypt:
     password: yilaingyiyun
 logging:
   level:
-    root: INFO
+    root: Debug
   path: E:/winsea_platform6.0/logs
 oss:
   access:

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/NewNoticeTaskController.java

@@ -3,7 +3,7 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.winsea.svc.notice.command.NoticeCommand.NoticeBusinessTypeNumber;
 import com.winsea.svc.notice.entity.NoticeTaskInfo;
-import com.winsea.svc.notice.service.INoticeTaskService;
+
 import java.util.List;
 
 import com.yh.saas.plugin.yiliangyiyun.service.INewNoticeTaskService;

+ 25 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/NewNoticeTaskMapper.java

@@ -0,0 +1,25 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.winsea.svc.notice.entity.NoticeTaskInfo;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 任务消息 Mapper 接口
+ * </p>
+ *
+ * @author Gdc
+ * @since 2021-10-08
+ */
+public interface NewNoticeTaskMapper extends BaseMapper<NoticeTaskInfo> {
+    /**
+     * 获取任务列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<NoticeTaskInfo> getTaskList(Map<String, Object> pageView);
+}

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/INewNoticeTaskService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.service.IService;
 import com.winsea.svc.notice.command.NoticeCommand.NoticeBusinessTypeNumber;
 import com.winsea.svc.notice.entity.NoticeTaskInfo;
 import com.winsea.svc.notice.entity.NoticeTaskInfo.NoticeTaskStatus;
+
 import java.util.List;
 
 public interface INewNoticeTaskService extends IService<NoticeTaskInfo> {

+ 67 - 48
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/NewNoticeTaskServiceImpl.java

@@ -10,15 +10,14 @@ import com.baomidou.mybatisplus.plugins.Page;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.toolkit.StringUtils;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import com.winsea.svc.base.base.entity.CommonStaffRole;
+import com.winsea.svc.base.base.entity.CommonStaffVessel;
 import com.winsea.svc.base.base.service.ICommonStaffRoleService;
 import com.winsea.svc.base.base.service.ICommonStaffVesselService;
 import com.winsea.svc.base.base.util.MessagePusherUtils;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
 import com.winsea.svc.notice.command.NoticeCommand.NoticeBusinessTypeNumber;
 import com.winsea.svc.notice.entity.NoticeBusinessConstantInfo;
-import com.winsea.svc.notice.entity.NoticeBusinessResourceInfo;
 import com.winsea.svc.notice.entity.NoticeTaskInfo;
 import com.winsea.svc.notice.entity.NoticeTaskInfo.NoticeTaskPushStatus;
 import com.winsea.svc.notice.entity.NoticeTaskInfo.NoticeTaskStatus;
@@ -28,22 +27,15 @@ import com.winsea.svc.notice.exception.NoticeException;
 import com.winsea.svc.notice.mapper.NoticeTaskMapper;
 import com.winsea.svc.notice.service.INoticeBusinessConstantService;
 import com.winsea.svc.notice.service.INoticeBusinessResourceService;
-import com.winsea.svc.notice.service.INoticeTaskService;
 import com.winsea.svc.notice.service.INoticeTimePushService;
-import com.winsea.svc.notice.service.INoticeUtilService;
 import com.yh.saas.common.support.util.BeanUtils;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.common.support.util.query.QueryUtils;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+
+import java.util.*;
 import java.util.stream.Collectors;
 
+import com.yh.saas.plugin.yiliangyiyun.mapper.NewNoticeTaskMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.INewNoticeTaskService;
 import com.yh.saas.plugin.yiliangyiyun.service.INewNoticeUtilService;
 import org.apache.commons.collections.CollectionUtils;
@@ -66,6 +58,8 @@ public class NewNoticeTaskServiceImpl extends ServiceImpl<NoticeTaskMapper, Noti
     @Autowired
     private INoticeTimePushService notificationTimePushService;
     @Autowired
+    private NewNoticeTaskMapper newNoticeTaskMapper;
+    @Autowired
     private INewNoticeUtilService noticeUtilService;
     private Set<String> businessCodes;
     @Value("${taskmsg.isPushed:true}")
@@ -87,43 +81,68 @@ public class NewNoticeTaskServiceImpl extends ServiceImpl<NoticeTaskMapper, Noti
             noticeTask.setNoticeTaskStatus(NoticeTaskStatus.TO_BE_PROCESSED);
         }
 
-        Wrapper<NoticeTaskInfo> noticeTaskWrapper = this.getCurrentUserNoticeTaskWrapper(noticeTask);
-        noticeTaskWrapper.orderDesc(Sets.newHashSet(new String[]{"create_date"}));
-        noticeTaskWrapper.groupBy("business_code");
-        noticeTaskWrapper.groupBy("DATE_FORMAT(create_date,'%Y-%m-%d')");
-//        noticeTaskWrapper.and("group by DATE_FORMAT(create_date,'%Y-%m-%d')");
-        Page<NoticeTaskInfo> noticeTaskInfoPage = this.selectPage(noticeTask.getQueryPage(), noticeTaskWrapper);
-        List<NoticeTaskInfo> taskInfos = noticeTaskInfoPage.getRecords();
-        List<NoticeTaskInfo> newTaskInfos = new ArrayList();
-        this.filterResource(taskInfos, newTaskInfos);
-
-        noticeTaskInfoPage.setRecords(newTaskInfos);
-        if (noticeTask.getPageSize() > taskInfos.size()) {
-            int sum = (int)noticeTaskInfoPage.getTotal();
-            int pageSize = noticeTask.getPageSize();
-
-            for(int i = 1; i < (new BigDecimal(sum)).divide(new BigDecimal(pageSize)).intValue() + 1; ++i) {
-                noticeTask.setCurrentPage(noticeTask.getCurrentPage() + 1);
-                Page<NoticeTaskInfo> taskInfoPage = this.selectPage(noticeTask.getQueryPage(), noticeTaskWrapper);
-                if (!CollectionUtils.isEmpty(taskInfoPage.getRecords())) {
-                    Iterator var10 = taskInfoPage.getRecords().iterator();
-
-                    while(var10.hasNext()) {
-                        NoticeTaskInfo noticeTaskInfo = (NoticeTaskInfo)var10.next();
-                        List<NoticeBusinessResourceInfo> noticeBusinessResourceInfos = this.businessResourceService.findNoticeBusinessResourceInfos(noticeTaskInfo.getBusinessCode());
-                        List<String> noticeResource = (List)noticeBusinessResourceInfos.stream().map(NoticeBusinessResourceInfo::getResourceId).collect(Collectors.toList());
-                        List<String> resourceIds = AuthSecurityUtils.getUserResources(AuthSecurityUtils.getCurrentUserId());
-                        if (resourceIds.containsAll(noticeResource)) {
-                            noticeTaskInfo.setMessageTitle(this.businessConstantService.findBusinessCodeInfo(noticeTaskInfo.getBusinessCode()).getReceiptName());
-                            taskInfos.add(noticeTaskInfo);
-                            if (taskInfos.size() >= pageSize) {
-                                return noticeTaskInfoPage;
-                            }
-                        }
-                    }
-                }
-            }
+        //2022-02-22 程长江 start
+
+        String staffId = AuthSecurityUtils.getCurrentUserId();
+        List<CommonStaffVessel> staffVessels = this.staffVesselService.findStaffVessel(AuthSecurityUtils.getCurrentUserId());
+        Map<String, List<CommonStaffVessel>> map = (Map)staffVessels.stream().collect(Collectors.groupingBy(CommonStaffVessel::getRoleId));
+        Set<String> roleIds = map.keySet();
+        Iterator var9 = roleIds.iterator();
+        String roleIdParam = "'";
+        while(var9.hasNext()) {
+           String roleId = (String)var9.next();
+           roleIdParam += roleId +"',";
         }
+        roleIdParam = roleIdParam.substring(0,roleIdParam.length() -1 );
+        staffId = "'" + staffId + "'";
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("roleId", roleIdParam);
+        pageView.put("staffId", staffId);
+        List<NoticeTaskInfo> list = newNoticeTaskMapper.getTaskList(pageView);
+        Page<NoticeTaskInfo> noticeTaskInfoPage = new Page<>();
+        noticeTaskInfoPage.setRecords(list);
+        noticeTaskInfoPage.setTotal(list.size());
+        //2022-02-22 程长江 end
+
+//        Wrapper<NoticeTaskInfo> noticeTaskWrapper = this.getCurrentUserNoticeTaskWrapper(noticeTask);
+//        noticeTaskWrapper.orderDesc(Sets.newHashSet(new String[]{"create_date"}));
+//        noticeTaskWrapper.groupBy("business_code");
+//        noticeTaskWrapper.groupBy("DATE_FORMAT(create_date,'%Y-%m-%d')");
+//        noticeTaskWrapper.and("group by DATE_FORMAT(create_date,'%Y-%m-%d')");
+//        Page<NoticeTaskInfo> noticeTaskInfoPage = this.selectPage(noticeTask.getQueryPage(), noticeTaskWrapper);
+//        List<NoticeTaskInfo> taskInfos = noticeTaskInfoPage.getRecords();
+//        List<NoticeTaskInfo> newTaskInfos = new ArrayList();
+//        this.filterResource(taskInfos, newTaskInfos);
+
+//        noticeTaskInfoPage.setRecords(newTaskInfos);
+//        Page<NoticeTaskInfo> noticeTaskInfoPage = this.selectPage(noticeTask.getQueryPage(), noticeTaskWrapper);
+//        noticeTaskInfoPage.setRecords(list);
+//        if (noticeTask.getPageSize() > taskInfos.size()) {
+//            int sum = (int)noticeTaskInfoPage.getTotal();
+//            int pageSize = noticeTask.getPageSize();
+//
+//            for(int i = 1; i < (new BigDecimal(sum)).divide(new BigDecimal(pageSize)).intValue() + 1; ++i) {
+//                noticeTask.setCurrentPage(noticeTask.getCurrentPage() + 1);
+//                Page<NoticeTaskInfo> taskInfoPage = this.selectPage(noticeTask.getQueryPage(), noticeTaskWrapper);
+//                if (!CollectionUtils.isEmpty(taskInfoPage.getRecords())) {
+//                    Iterator var10 = taskInfoPage.getRecords().iterator();
+//
+//                    while(var10.hasNext()) {
+//                        NoticeTaskInfo noticeTaskInfo = (NoticeTaskInfo)var10.next();
+//                        List<NoticeBusinessResourceInfo> noticeBusinessResourceInfos = this.businessResourceService.findNoticeBusinessResourceInfos(noticeTaskInfo.getBusinessCode());
+//                        List<String> noticeResource = (List)noticeBusinessResourceInfos.stream().map(NoticeBusinessResourceInfo::getResourceId).collect(Collectors.toList());
+//                        List<String> resourceIds = AuthSecurityUtils.getUserResources(AuthSecurityUtils.getCurrentUserId());
+//                        if (resourceIds.containsAll(noticeResource)) {
+//                            noticeTaskInfo.setMessageTitle(this.businessConstantService.findBusinessCodeInfo(noticeTaskInfo.getBusinessCode()).getReceiptName());
+//                            taskInfos.add(noticeTaskInfo);
+//                            if (taskInfos.size() >= pageSize) {
+//                                return noticeTaskInfoPage;
+//                            }
+//                        }
+//                    }
+//                }
+//            }
+//        }
 
         noticeTaskInfoPage.getRecords().forEach((noticeTaskInfox) -> {
             String messageTitle = null;

+ 105 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/NewNoticeTaskMapper.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.NewNoticeTaskMapper">
+
+    <select id="getTaskList" parameterType="Map"
+            resultType="com.winsea.svc.notice.entity.NoticeTaskInfo">
+            SELECT
+                *
+            FROM
+                (
+                SELECT
+                    a.id AS id,
+                    a.notice_task_status AS noticeTaskStatus,
+                    a.business_type AS businessType,
+                    a.comp_id AS compId,
+                    a.overdue_date AS overdueDate,
+                    a.overdue_date_flag AS overdueDateFlag,
+                    a.notice_task_push_status AS noticeTaskPushStatus,
+                    a.business_id AS businessId,
+                    a.business_code AS businessCode,
+                    a.message_title AS messageTitle,
+                    a.message_content AS messageContent,
+                    a.accept_id AS acceptId,
+                    a.accept_type AS acceptType,
+                    a.vessel_id AS vesselId,
+                    a.create_date AS createDate,
+                    a.create_user_id AS createUserId,
+                    a.update_date AS updateDate,
+                    a.update_user_id AS updateUserId,
+                    a.update_flag AS updateFlag,
+                    a.delete_flag AS deleteFlag
+                FROM
+                    notice_task_info a
+                WHERE
+                    a.delete_flag = 0
+                    AND a.business_type != 'PAYMENT'
+                    AND a.notice_task_status IN ( 'TO_BE_PROCESSED', 'RETURN', 'TO_BE_REPAIRED' )
+                    AND (
+                        1 = 1
+                        AND ( a.accept_type = "All" )
+                        OR (
+                            a.accept_id IN ( ${staffId} )
+                            AND a.accept_type = "STAFF"
+                            AND 1 = 1
+                        AND ( a.vessel_id IN ( "e88a798337c14cd7b8e0dfe7f9efdf5a" ) OR a.vessel_id IS NULL ))
+                        OR (
+                            a.accept_id IN ( ${roleId} )
+                            AND a.accept_type = "ROLE"
+                            AND 1 = 1
+                        AND ( a.vessel_id IN ( "e88a798337c14cd7b8e0dfe7f9efdf5a" ) OR a.vessel_id IS NULL )))
+                GROUP BY
+                    a.business_code,
+                    DATE_FORMAT( a.create_date, '%Y-%m-%d' ) UNION ALL
+                SELECT
+                    a.id AS id,
+                    a.notice_task_status AS noticeTaskStatus,
+                    a.business_type AS businessType,
+                    a.comp_id AS compId,
+                    a.overdue_date AS overdueDate,
+                    a.overdue_date_flag AS overdueDateFlag,
+                    a.notice_task_push_status AS noticeTaskPushStatus,
+                    a.business_id AS businessId,
+                    a.business_code AS businessCode,
+                    a.message_title AS messageTitle,
+                    a.message_content AS messageContent,
+                    a.accept_id AS acceptId,
+                    a.accept_type AS acceptType,
+                    p.warehouse_name AS vesselId,
+                    a.create_date AS createDate,
+                    a.create_user_id AS createUserId,
+                    a.update_date AS updateDate,
+                    a.update_user_id AS updateUserId,
+                    a.update_flag AS updateFlag,
+                    a.delete_flag AS deleteFlag
+                FROM
+                    notice_task_info a
+                    LEFT JOIN payment_management p ON p.id = a.business_id
+                    AND p.delete_flag = 0
+                    AND p.comp_id = a.comp_id
+                WHERE
+                    a.delete_flag = 0
+                    AND a.business_type = 'PAYMENT'
+                    AND a.notice_task_status IN ( 'TO_BE_PROCESSED', 'RETURN', 'TO_BE_REPAIRED' )
+                    AND (
+                        1 = 1
+                        AND ( a.accept_type = "All" )
+                        OR (
+                            a.accept_id IN ( ${staffId} )
+                            AND a.accept_type = "STAFF"
+                            AND 1 = 1
+                        AND ( a.vessel_id IN ( "e88a798337c14cd7b8e0dfe7f9efdf5a" ) OR a.vessel_id IS NULL ))
+                        OR (
+                            a.accept_id IN ( ${roleId} )
+                            AND a.accept_type = "ROLE"
+                            AND 1 = 1
+                        AND ( a.vessel_id IN ( "e88a798337c14cd7b8e0dfe7f9efdf5a" ) OR a.vessel_id IS NULL )))
+                GROUP BY
+                    a.business_code,
+                    DATE_FORMAT( a.create_date, '%Y-%m-%d' ),
+                    p.warehouse_name
+                ) c
+            ORDER BY
+                c.createDate DESC
+    </select>
+</mapper>