zhangyuewww 2 år sedan
förälder
incheckning
3ac039b942

+ 14 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/CommonUserMapper.java

@@ -52,5 +52,18 @@ public interface CommonUserMapper extends BaseMapper<CommonUser> {
      * @return
      */
     List<NoticeTaskInfo> getListByConditionMy(Map<String, Object> pageView);
-
+    /**
+     * 根据条件查询未完成任务总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getTaskCountByCondition(Map<String, Object> pageView);
+    /**
+     * 根据条件查询未完成任务列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<NoticeTaskInfo> getTaskByCondition(Map<String, Object> pageView);
 }

+ 2 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CommonUserServiceImpl.java

@@ -840,6 +840,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
         pageView.put("roleId", AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getMajorRoleId());
         pageView.put("pageSize", noticeTask.getPageSize());
         pageView.put("currentPage", noticeTask.getCurrentPage());
+        pageView.put("searchKeyWord", noticeTask.getSearchKeyword());
 
         // 查询总数
         Integer dataCount = baseMapper.getCountByCondition(pageView);
@@ -868,6 +869,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
         pageView.put("roleId", AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getMajorRoleId());
         pageView.put("pageSize", noticeTask.getPageSize());
         pageView.put("currentPage", noticeTask.getCurrentPage());
+        pageView.put("searchKeyWord", noticeTask.getSearchKeyword());
 
         // 查询总数
         Integer dataCount = baseMapper.getCountByConditionMy(pageView);

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

@@ -36,16 +36,11 @@ 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.entity.CommonUser;
+import com.yh.saas.plugin.yiliangyiyun.mapper.CommonUserMapper;
 import com.yh.saas.plugin.yiliangyiyun.mapper.NewNoticeTaskMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.INewNoticeTaskService;
 import com.yh.saas.plugin.yiliangyiyun.service.INewNoticeUtilService;
@@ -70,15 +65,11 @@ public class NewNoticeTaskServiceImpl extends ServiceImpl<NoticeTaskMapper, Noti
     @SofaReference
     private ICommonStaffRoleService staffRoleService;
     @Autowired
-    private INoticeTimePushService notificationTimePushService;
-    @Autowired
-    private NewNoticeTaskMapper newNoticeTaskMapper;
+    private CommonUserMapper commonUserMapper;
     @Autowired
     private INewNoticeUtilService noticeUtilService;
     @Autowired
     private GeTuiUtils geTuiUtils;
-    @Autowired
-    private CommonStaffMapper commonStaffMapper;
     private Set<String> businessCodes;
     @Value("${taskmsg.isPushed:true}")
     private boolean isTaskmsgPushed;
@@ -126,11 +117,26 @@ public class NewNoticeTaskServiceImpl extends ServiceImpl<NoticeTaskMapper, Noti
 //        noticeTaskInfoPage.setTotal(list.size());
         //2022-02-22 程长江 end
 
-        Wrapper<NoticeTaskInfo> noticeTaskWrapper = this.getCurrentUserNoticeTaskWrapper(noticeTask);
-        noticeTaskWrapper.orderDesc(Sets.newHashSet(new String[]{"create_date"}));
+//        Wrapper<NoticeTaskInfo> noticeTaskWrapper = this.getCurrentUserNoticeTaskWrapper(noticeTask);
+//        noticeTaskWrapper.orderDesc(Sets.newHashSet(new String[]{"create_date"}));
 //        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);
+//        Page<NoticeTaskInfo> noticeTaskInfoPage = this.selectPage(noticeTask.getQueryPage(), noticeTaskWrapper);
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (noticeTask.getCurrentPage() - 1)
+                * noticeTask.getPageSize());
+        //  公司ID
+        pageView.put("pageSize", noticeTask.getPageSize());
+        pageView.put("currentPage", noticeTask.getCurrentPage());
+        pageView.put("searchKeyWord", noticeTask.getSearchKeyword());
+        pageView.put("noticeTaskStatus", noticeTask.getNoticeTaskStatus());
+        pageView.put("userId", AuthSecurityUtils.getCurrentUserId());
+        pageView.put("roleId", AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getMajorRoleId());
+        Integer dataCount = commonUserMapper.getTaskCountByCondition(pageView);
+        List<NoticeTaskInfo> dataList = commonUserMapper.getTaskByCondition(pageView);
+        Page<NoticeTaskInfo> noticeTaskInfoPage = new Page<>();
+        noticeTaskInfoPage.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        noticeTaskInfoPage.setTotal(dataCount == null ? 0 : dataCount);
         List<NoticeTaskInfo> taskInfos = noticeTaskInfoPage.getRecords();
         List<NoticeTaskInfo> newTaskInfos = new ArrayList();
         this.filterResource(taskInfos, newTaskInfos);
@@ -142,7 +148,10 @@ public class NewNoticeTaskServiceImpl extends ServiceImpl<NoticeTaskMapper, Noti
 
             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);
+                pageView.put("currentPage", noticeTask.getCurrentPage());
+                List<NoticeTaskInfo> dataList1 = commonUserMapper.getTaskByCondition(pageView);
+                Page<NoticeTaskInfo> taskInfoPage = new Page<>();
+                taskInfoPage.setRecords(dataList1 == null ? Lists.newArrayList() : dataList1);
                 if (!CollectionUtils.isEmpty(taskInfoPage.getRecords())) {
                     Iterator var10 = taskInfoPage.getRecords().iterator();
 

+ 101 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CommonUserMapper.xml

@@ -42,6 +42,10 @@
              	)
              	AND delete_flag = '1'
              	)
+			<if test="searchKeyWord != null and searchKeyWord != ''">
+				AND (lower(message_content) like lower(CONCAT('%',#{searchKeyWord},'%'))
+				OR lower(create_date) like lower(CONCAT('%',#{searchKeyWord},'%')))
+			</if>
           </select>
 
 
@@ -92,6 +96,10 @@
 		)
 		AND a.delete_flag = '1'
 		)
+		<if test="searchKeyWord != null and searchKeyWord != ''">
+			AND (lower(a.message_content) like lower(CONCAT('%',#{searchKeyWord},'%'))
+			OR lower(a.create_date) like lower(CONCAT('%',#{searchKeyWord},'%')))
+		</if>
 		GROUP BY
 		a.business_id,
 		a.business_code
@@ -110,6 +118,10 @@
              WHERE
              	1=1
              AND create_user_id = #{userId}
+			<if test="searchKeyWord != null and searchKeyWord != ''">
+				AND (lower(message_content) like lower(CONCAT('%',#{searchKeyWord},'%'))
+				OR lower(create_date) like lower(CONCAT('%',#{searchKeyWord},'%')))
+			</if>
           </select>
 
 
@@ -145,6 +157,95 @@
 		WHERE
 		1=1
 		AND a.create_user_id = #{userId}
+		<if test="searchKeyWord != null and searchKeyWord != ''">
+			AND (lower(a.message_content) like lower(CONCAT('%',#{searchKeyWord},'%'))
+			OR lower(a.create_date) like lower(CONCAT('%',#{searchKeyWord},'%')))
+		</if>
+		GROUP BY
+		a.business_id,
+		a.business_code
+		ORDER BY
+		a.create_date DESC
+		<if test="currentPage != null and currentPage != ''">
+			LIMIT ${startRecord}, ${pageSize}
+		</if>
+	</select>
+	<select id="getTaskCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+		SELECT
+		count(id)
+		FROM
+		notice_task_info
+		WHERE
+		delete_flag='0'
+		and notice_task_status = #{noticeTaskStatus}
+		AND (
+		1 = 1
+		AND ( accept_type = "All" )
+		OR (
+		accept_id IN ( #{userId} )
+		AND accept_type = "STAFF"
+		AND 1 = 1
+		)
+		OR (
+		accept_id IN ( #{roleId})
+		AND accept_type = "ROLE"
+		AND 1 = 1
+		)
+		AND delete_flag = '0'
+		)
+		<if test="searchKeyWord != null and searchKeyWord != ''">
+			AND (lower(message_content) like lower(CONCAT('%',#{searchKeyWord},'%'))
+			OR lower(create_date) like lower(CONCAT('%',#{searchKeyWord},'%')))
+		</if>
+	</select>
+	<select id="getTaskByCondition" parameterType="Map" resultType="com.winsea.svc.notice.entity.NoticeTaskInfo">
+		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,
+		b.business_type_desc 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
+		left join notice_business_constant_info b
+		on b.business_code = a.business_code
+		WHERE
+		a.delete_flag='0'
+		and a.notice_task_status = #{noticeTaskStatus}
+		AND (
+		1 = 1
+		AND ( a.accept_type = "All" )
+		OR (
+		a.accept_id IN ( #{userId} )
+		AND a.accept_type = "STAFF"
+		AND 1 = 1
+		)
+		OR (
+		a.accept_id IN ( #{roleId})
+		AND a.accept_type = "ROLE"
+		AND 1 = 1
+		)
+		AND a.delete_flag = '0'
+		)
+		<if test="searchKeyWord != null and searchKeyWord != ''">
+			AND (lower(a.message_content) like lower(CONCAT('%',#{searchKeyWord},'%'))
+			OR lower(a.create_date) like lower(CONCAT('%',#{searchKeyWord},'%')))
+		</if>
 		GROUP BY
 		a.business_id,
 		a.business_code