|
@@ -1,61 +1,61 @@
|
|
|
-package org.fouram.job;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import org.fouram.core.plugin.weixin.cp.util.WXCpMessageUtil;
|
|
|
-import org.fouram.core.util.LoggerUtil;
|
|
|
-import org.fouram.core.util.Tools;
|
|
|
-import org.fouram.entity.SapMessageUser;
|
|
|
-import org.fouram.entity.SapUser;
|
|
|
-import org.fouram.enums.UploadHrEmpUserEnum;
|
|
|
-import org.fouram.service.SapMessageUserService;
|
|
|
-import org.fouram.service.SapUserService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-@Service
|
|
|
-public class MessageSchedule {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SapUserService sapUserService;
|
|
|
- @Autowired
|
|
|
- private SapMessageUserService sapMessageUserService;
|
|
|
-
|
|
|
- public void taskBiz() throws Exception {
|
|
|
- try {
|
|
|
- List<SapMessageUser> messageUsers = sapMessageUserService.selectList(null);
|
|
|
- if (messageUsers.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- // 入职
|
|
|
- List<SapUser> sapUsers = sapUserService.selectNotSendEntryMessageList();
|
|
|
- StringBuffer messageContent = null;
|
|
|
- for (SapUser sapUser : sapUsers) {
|
|
|
- messageContent = new StringBuffer();
|
|
|
- messageContent.append("有一个新员工入职,待同步企业微信").append("\n").append("员工姓名:").append(sapUser.getName())
|
|
|
- .append("\n").append("手机号:").append(sapUser.getFormatMobile()).append("\n").append("邮箱:")
|
|
|
- .append(sapUser.getRealEmail()).append("\n")
|
|
|
- .append("<a href=\"https://studybom.suggest.vip/#/userSync/list\">立即同步</a>");
|
|
|
- sapUserService.sendEntryMessage(messageContent.toString(), sapUser, messageUsers);
|
|
|
-
|
|
|
- sapUserService.uploadMasHrEmpUserInfo(sapUser, UploadHrEmpUserEnum.ENTRY.getCode());
|
|
|
- }
|
|
|
- // 离职
|
|
|
- sapUsers = sapUserService.selectNotSendLeaveMessageList();
|
|
|
- messageContent = null;
|
|
|
- for (SapUser sapUser : sapUsers) {
|
|
|
- messageContent = new StringBuffer();
|
|
|
- messageContent.append("有一个新员工离职,待同步企业微信").append("\n").append("员工姓名:").append(sapUser.getName())
|
|
|
- .append("\n").append("手机号:").append(sapUser.getFormatMobile()).append("\n").append("邮箱:")
|
|
|
- .append(sapUser.getRealEmail()).append("\n")
|
|
|
- .append("<a href=\"https://studybom.suggest.vip/#/userSync/list\">立即同步</a>");
|
|
|
- sapUserService.sendLeaveMessage(messageContent.toString(), sapUser, messageUsers);
|
|
|
-
|
|
|
- sapUserService.uploadMasHrEmpUserInfo(sapUser, UploadHrEmpUserEnum.LEAVE.getCode());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- WXCpMessageUtil.sendAdminError(Tools.getExceptionAllInfo(e));
|
|
|
- LoggerUtil.error(e);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+package org.fouram.job;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.fouram.core.plugin.weixin.cp.util.WXCpMessageUtil;
|
|
|
+import org.fouram.core.util.LoggerUtil;
|
|
|
+import org.fouram.core.util.Tools;
|
|
|
+import org.fouram.entity.SapMessageUser;
|
|
|
+import org.fouram.entity.SapUser;
|
|
|
+import org.fouram.enums.UploadHrEmpUserEnum;
|
|
|
+import org.fouram.service.SapMessageUserService;
|
|
|
+import org.fouram.service.SapUserService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class MessageSchedule {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SapUserService sapUserService;
|
|
|
+ @Autowired
|
|
|
+ private SapMessageUserService sapMessageUserService;
|
|
|
+
|
|
|
+ public void taskBiz() throws Exception {
|
|
|
+ try {
|
|
|
+ List<SapMessageUser> messageUsers = sapMessageUserService.selectList(null);
|
|
|
+ if (messageUsers.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 入职
|
|
|
+ List<SapUser> sapUsers = sapUserService.selectNotSendEntryMessageList();
|
|
|
+ StringBuffer messageContent = null;
|
|
|
+ for (SapUser sapUser : sapUsers) {
|
|
|
+ messageContent = new StringBuffer();
|
|
|
+ messageContent.append("有一个新员工入职,待同步企业微信").append("\n").append("员工姓名:").append(sapUser.getName())
|
|
|
+ .append("\n").append("手机号:").append(sapUser.getFormatMobile()).append("\n").append("邮箱:")
|
|
|
+ .append(sapUser.getRealEmail()).append("\n")
|
|
|
+ .append("<a href=\"https://studybom.suggest.vip/#/userSync/list\">立即同步</a>");
|
|
|
+ sapUserService.sendEntryMessage(messageContent.toString(), sapUser, messageUsers);
|
|
|
+
|
|
|
+ sapUserService.uploadMasEmpUserDetailInfo(sapUser, UploadHrEmpUserEnum.ENTRY.getCode());
|
|
|
+ }
|
|
|
+ // 离职
|
|
|
+ sapUsers = sapUserService.selectNotSendLeaveMessageList();
|
|
|
+ messageContent = null;
|
|
|
+ for (SapUser sapUser : sapUsers) {
|
|
|
+ messageContent = new StringBuffer();
|
|
|
+ messageContent.append("有一个新员工离职,待同步企业微信").append("\n").append("员工姓名:").append(sapUser.getName())
|
|
|
+ .append("\n").append("手机号:").append(sapUser.getFormatMobile()).append("\n").append("邮箱:")
|
|
|
+ .append(sapUser.getRealEmail()).append("\n")
|
|
|
+ .append("<a href=\"https://studybom.suggest.vip/#/userSync/list\">立即同步</a>");
|
|
|
+ sapUserService.sendLeaveMessage(messageContent.toString(), sapUser, messageUsers);
|
|
|
+
|
|
|
+ sapUserService.uploadMasEmpUserDetailInfo(sapUser, UploadHrEmpUserEnum.LEAVE.getCode());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ WXCpMessageUtil.sendAdminError(Tools.getExceptionAllInfo(e));
|
|
|
+ LoggerUtil.error(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|