shc 2 роки тому
батько
коміт
b91aca1922

+ 7 - 1
hnqz-visual/hnqz-daemon-quartz/pom.xml

@@ -123,8 +123,14 @@
 			<version>5.2.7.RELEASE</version>
 			<scope>compile</scope>
 		</dependency>
+      <dependency>
+        <groupId>com.sun.mail</groupId>
+        <artifactId>javax.mail</artifactId>
+        <version>1.6.2</version>
+        <scope>compile</scope>
+      </dependency>
 
-	</dependencies>
+    </dependencies>
 
 	<build>
 		<plugins>

+ 43 - 0
hnqz-visual/hnqz-daemon-quartz/src/main/java/com/qunzhixinxi/hnqz/daemon/quartz/mapper/SysUserMapper.java

@@ -0,0 +1,43 @@
+/*
+ *
+ *      Copyright (c) 2018-2025, hnqz All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the pig4cloud.com developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: hnqz
+ *
+ */
+
+package com.qunzhixinxi.hnqz.daemon.quartz.mapper;
+
+import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
+import com.qunzhixinxi.hnqz.common.data.datascope.DataScopeMapper;
+import org.apache.ibatis.annotations.MapKey;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 用户表 Mapper 接口
+ * </p>
+ *
+ * @author hnqz
+ * @since 2017-10-29
+ */
+@Mapper
+public interface SysUserMapper extends DataScopeMapper<SysUser> {
+
+	@MapKey(value = "user_id")
+	List<Map<String, Object>> listUserCertFailure();
+}

+ 76 - 2
hnqz-visual/hnqz-daemon-quartz/src/main/java/com/qunzhixinxi/hnqz/daemon/quartz/task/SpringBeanTaskDemo.java

@@ -20,6 +20,7 @@ package com.qunzhixinxi.hnqz.daemon.quartz.task;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.qunzhixinxi.hnqz.daemon.quartz.constants.HnqzQuartzEnum;
@@ -32,21 +33,30 @@ import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SingleEnterpriseSettleSameAmoun
 import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SingleMemberSettleAmountOverrunInSeveralMonthsMapper;
 import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SingleMemberSettleSameAmountInSeveralMonthsMapper;
 import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SingleMemberWithoutSuchTaskTypesInSeveralMonthsMapper;
+import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SysUserMapper;
 import com.qunzhixinxi.hnqz.daemon.quartz.service.*;
 import com.qunzhixinxi.hnqz.daemon.quartz.zhuqu.ZhuaquTest;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.MimeMessageHelper;
 import org.springframework.stereotype.Component;
 
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
 import java.time.temporal.TemporalAdjusters;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * @author 郑健楠
@@ -58,6 +68,8 @@ public class SpringBeanTaskDemo {
 	private final WmScorePackageStatusService wmScorePackageStatusService;
 	private final WmScorePackageSettleNoteService scorePackageSettleNoteService;
 	private final WmScorePackageService wmScorePackageService;
+	private final SysUserMapper sysUserMapper;
+	private final JavaMailSender sender;
 	private final ZhuaquTest zhuaquTest;
 	private final WmTaskTypeService wmTaskTypeService;
 	private final WmTaskService wmTaskService;
@@ -334,11 +346,11 @@ public class SpringBeanTaskDemo {
 
 			result.forEach(e -> {
 				SingleMemberWithoutSuchTaskTypesInSeveralMonths singleMemberWithoutSuchTaskTypesInSeveralMonths
-						= BeanUtil.mapToBean(e, SingleMemberWithoutSuchTaskTypesInSeveralMonths.class,true, new CopyOptions());
+						= BeanUtil.mapToBean(e, SingleMemberWithoutSuchTaskTypesInSeveralMonths.class, true, new CopyOptions());
 
 				List<WmTask> list = wmTaskService.list(Wrappers.<WmTask>lambdaQuery().eq(WmTask::getScorePackageId, e.get(singleMemberWithoutSuchTaskTypesInSeveralMonths.getPackageId())).orderByDesc(WmTask::getCreateTime));
 
-				if (CollUtil.isNotEmpty(list)){
+				if (CollUtil.isNotEmpty(list)) {
 					singleMemberWithoutSuchTaskTypesInSeveralMonths.setFirstTaskTime(list.get(0).getCreateTime());
 				}
 				singleMemberWithoutSuchTaskTypesInSeveralMonths.setPeriod(period);
@@ -354,4 +366,66 @@ public class SpringBeanTaskDemo {
 	}
 
 
+	@SneakyThrows
+	public String pushUserCertFailure(String para) {
+
+		String[] re = {"qutong@yaoyi.net"};
+
+		log.info("pushUserCertFailure:{},输入参数{}", LocalDateTime.now(), para);
+
+		List<Map<String, Object>> stringObjectMap = sysUserMapper.listUserCertFailure();
+		if (CollUtil.isNotEmpty(stringObjectMap)) {
+
+			StringBuilder text = new StringBuilder("<table style=\"width:100%\">\n" +
+					"    <tr>\n" +
+					"        <th>ID</th>\n" +
+					"        <th>姓名</th>\n" +
+					"        <th>账号</th>\n" +
+					"        <th>所属企业</th>\n" +
+					"        <th>结算平台</th>\n" +
+					"        <th>税源地</th>\n" +
+					"        <th>认证表述</th>\n" +
+					"        <th>认证状态</th>\n" +
+					"        <th>发起状态</th>\n" +
+					"        <th>上次回信信息</th>\n" +
+					"        <th>是否有手签</th>\n" +
+					"        <th>是否有e证通认证结果</th>\n" +
+					"        <th>用户操作认证时间</th>\n" +
+					"    </tr>");
+
+			stringObjectMap.forEach(e -> {
+				text.append("<tr>");
+				e.forEach((k, v) -> {
+					text.append("<td>").append(v).append("</td>");
+				});
+				text.append("</tr>");
+			});
+
+
+			text.append("</table>");
+			Arrays.stream(re).forEach(reciver -> {
+				MimeMessage mail = sender.createMimeMessage();
+				try {
+
+					MimeMessageHelper helper = new MimeMessageHelper(mail, true);
+
+					helper.setFrom("yaoyi_report@yaoyi.net");
+					helper.setTo(re);
+
+					helper.setSubject("零工平台人员认证未完成信息汇总(" + DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now().minusDays(1L)) + ")");
+
+
+					helper.setText(text.toString());
+
+					sender.send(mail);
+				} catch (MessagingException ex) {
+					log.error("邮件发送失败");
+				}
+			});
+
+
+		}
+
+		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
+	}
 }

+ 85 - 0
hnqz-visual/hnqz-daemon-quartz/src/main/resources/mapper/SysUserMapper.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~
+  ~      Copyright (c) 2018-2025, hnqz All rights reserved.
+  ~
+  ~  Redistribution and use in source and binary forms, with or without
+  ~  modification, are permitted provided that the following conditions are met:
+  ~
+  ~ Redistributions of source code must retain the above copyright notice,
+  ~  this list of conditions and the following disclaimer.
+  ~  Redistributions in binary form must reproduce the above copyright
+  ~  notice, this list of conditions and the following disclaimer in the
+  ~  documentation and/or other materials provided with the distribution.
+  ~  Neither the name of the pig4cloud.com developer nor the names of its
+  ~  contributors may be used to endorse or promote products derived from
+  ~  this software without specific prior written permission.
+  ~  Author: hnqz
+  ~
+  -->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qunzhixinxi.hnqz.daemon.quartz.mapper.SysUserMapper">
+
+	<select id="listUserCertFailure" resultType="map">
+		SELECT sys_user.user_id                                          AS `ID`,
+			   sys_user.realname                                         AS `姓名`,
+			   sys_user.username                                         AS `账号`,
+			   sys_dept.name                                             AS `所属企业`,
+			   (CASE sys_user_sub.gig_type
+					WHEN 0 THEN '人力家'
+					WHEN 1 THEN '税邦云'
+					WHEN 2 THEN '阿拉丁'
+					WHEN 3 THEN '3 '
+				   END)                                                  AS `结算平台`,
+			   (CASE sys_user_sub.subject_location
+					WHEN 'REN_LI_JIA' THEN '人力家'
+					WHEN 'LUO_SHU_YUN' THEN '税邦云'
+					WHEN 'FEI_YI' THEN '阿拉丁'
+					WHEN 'JIN_YUAN' THEN '金园数科'
+					WHEN 'XIN_TAI_ZI' THEN '薪泰梓'
+				   END)                                                  AS '税源地',
+				IF(
+								sys_user_sub.gig_type = 1 AND sys_user_sub.cert_status = 15, ' 认证成功 ',
+								IF(sys_user_sub.gig_type = 0 AND sys_user_sub.cert_status = 1, ' 认证成功 ',
+								   IF(sys_user_sub.gig_type = 2 AND sys_user_sub.cert_status = 1, ' 认证成功 ',
+									  ' 未完成 '
+									   )))                                AS `认证表述`,
+			   sys_user_sub.cert_status                                  AS `认证状态`,
+			   (CASE sys_user_sub.callback_status
+					WHEN 0 THEN '有结果'
+					WHEN 1 THEN '进行中'
+					WHEN 2 THEN '未发起' END)                               AS `发起状态`,
+			   sys_user_sub.cert_remark                                  AS `上次回信信息`,
+			   IF(CHAR_LENGTH(sys_user_sub.agreement_url) > 0, '有', '无') AS `手签`,
+			   IF(etoken.num = 1, ' 有 ', ' 无 ')                          AS `E证通认证`,
+			   sys_user_sub.update_time                                  AS `用户认证时间`
+		FROM sys_user_sub
+				 LEFT JOIN sys_user ON sys_user_sub.user_id = sys_user.user_id
+				 LEFT JOIN sys_dept ON sys_user.dept_id = sys_dept.dept_id
+				 LEFT JOIN (SELECT user_id,
+								   sub_type,
+								   settle_amount,
+								   MAX(notify_time) AS lastest_time
+							FROM wm_score_package_settle_note
+							WHERE settle_note_status = 1
+							GROUP BY user_id, sub_type
+		) AS tmp1 ON tmp1.user_id = sys_user_sub.user_id AND tmp1.sub_type = sys_user_sub.gig_type
+				 LEFT JOIN (SELECT user_id, COUNT(1) AS num
+							FROM sys_user_ext_record
+							WHERE del_flag = 0
+							GROUP BY user_id) AS etoken
+						   ON etoken.user_id = sys_user.user_id
+		WHERE sys_user.del_flag = 0
+		  AND sys_user.lock_flag = 0
+		  AND (
+				(sys_user_sub.gig_type = 1 AND sys_user_sub.cert_status NOT IN (10, 15))
+				OR (sys_user_sub.gig_type = 0 AND sys_user_sub.cert_status NOT IN (0, 1))
+				OR (sys_user_sub.gig_type = 2 AND sys_user_sub.cert_status NOT IN (1))
+			)
+		  AND sys_dept.dept_id NOT IN (1611890563)
+		  AND sys_user_sub.update_time > '2022-08-01 00:00:00'
+		ORDER BY sys_user_sub.create_time
+				DESC
+	</select>
+</mapper>