sangwenwei vor 1 Jahr
Ursprung
Commit
d2c729f635

+ 1 - 1
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/feign/IUserApi.java

@@ -266,7 +266,7 @@ public interface IUserApi {
      * 获取嘉溢所有员工
      * @return
      */
-    @GetMapping("getJyUserList")
+    @GetMapping(value = BASE_URL + "/getJyUserList")
     String getJyUserList();
 }
 

+ 1 - 1
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/humanResources/mapper/StaffUserInfoMapper.java

@@ -29,6 +29,6 @@ public interface StaffUserInfoMapper extends BaseMapper<StaffUserInfo> {
     RegularApply findByApplyId(@Param("id")String id);
 
     void updateStatusByApplyId(@Param("id")String id, @Param("status")String status);
-
+    @InterceptorIgnore(tenantLine = "true")
     List<StaffUserInfoDTO> getList();
 }

+ 1 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/humanResources/mapper/xml/StaffUserInfoMapper.xml

@@ -203,6 +203,7 @@
             a.email,
             a.type,
             a.fund_number,
+            a.time_limit,
             (case when su1.login_flag = '0' then '冻结' when su1.login_flag = '1' then '正常' else '' end) as flagName,
             a.manager_office,
             so.name as officeName,

+ 3 - 1
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/feign/UserApiImpl.java

@@ -206,7 +206,9 @@ public class UserApiImpl implements IUserApi {
 
     @Override
     public String getJyUserList() {
-        return null;
+        List<UserDTO> list=userService.getJyUserList();
+        String s=JSON.toJSONString(list);
+        return s;
     }
 
 }

+ 4 - 1
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml

@@ -560,8 +560,11 @@ select DISTINCT a.id, a.company_id as "companyDTO.id", a.office_id as "officeDTO
 		a.remarks,
 		a.login_flag, a.photo, a.qr_code, a.sign,
 		a.create_by_id as "createBy.id", a.create_time, a.update_by_id as "updateBy.id",
-		a.update_time
+		a.update_time,
+		sp.code as "postDTO.code"
 		from sys_user a
+		left join sys_user_post sup on a.id = sup.user_id
+		left join sys_post sp on sp.id = sup.post_id
 		where a.tenant_id = "10006" and a.del_flag=0
     </select>
 

+ 77 - 74
jeeplus-modules/jeeplus-xxl-job-executor-sample/src/main/java/com/xxl/job/executor/service/jobhandler/SampleXxlJob.java

@@ -1,6 +1,7 @@
 package com.xxl.job.executor.service.jobhandler;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
@@ -15,6 +16,7 @@ import com.jeeplus.sys.service.dto.UserDTO;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.executor.feign.*;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -71,89 +73,90 @@ public class SampleXxlJob {
         List<StaffUserInfoDTO> staffUserInfoDTOS = JSON.parseObject(list, new TypeReference<List<StaffUserInfoDTO>>() {});
         for (StaffUserInfoDTO staffUserInfoDTO : staffUserInfoDTOS) {
             //根据所在部门获取部门主任
-            List<UserDTO> userDTOS = SpringUtil.getBean(IUserApi.class).findListByOfficeId(staffUserInfoDTO.getDepartment());
-            for (UserDTO userDTO : userDTOS) {
-                if (CollectionUtil.isNotEmpty(userDTO.getPostDTOList())){
-                    for (PostDTO postDTO : userDTO.getPostDTOList()) {
-                        if (postDTO.getCode().equals("bmzr")){
-                            //创建calendar对象
-                            Calendar instance = Calendar.getInstance();
-                            //获取员工试用期限后的日期
-                            instance.setTime(staffUserInfoDTO.getInTime());
-                            //根据试用期限往后推相应的时间
-                            instance.add(Calendar.MONTH,Integer.parseInt(staffUserInfoDTO.getTimeLimit()));
-                            //获取推送后的日期
-                            Date newDate = instance.getTime();
-                            //获取到当前日期
-                            Date beginDate = new Date();
-                            //计算时间只差
-                            int interval1 = Integer.parseInt(this.getInterval(beginDate, newDate));
-                            String taskName = null;
-                            String titleStr = null;
-                            //如果还剩三天则发送通知
-                            if (interval1<=3 && interval1 >=0) {
-                                taskName = "转正申请还未提交";
-                                titleStr = "距离转正申请提交还剩" + interval1 + "天,请尽快提交";
-                                Set<String> noticeUserSet = new HashSet<String>();
-
-                                String byIdForXXL = SpringUtil.getBean(IUserApi.class).getByIdForXXL(userDTO.getId());
-                                UserDTO createUser = JSON.parseObject(byIdForXXL, new TypeReference<UserDTO>() {});
-                                if(null != createUser && StringUtils.isNotBlank(createUser.getId())){
-                                    noticeUserSet.add(createUser.getId());
-                                }
+            String jyUserList = SpringUtil.getBean(IUserApi.class).getJyUserList();
+            List<UserDTO> dtoList = JSON.parseObject(jyUserList, new TypeReference<List<UserDTO>>() {});
+            for (UserDTO userDTO : dtoList) {
+                if (ObjectUtil.isNotEmpty(userDTO.getPostDTO())){
+                    if (userDTO.getPostDTO().getCode().equals("bmzr") && staffUserInfoDTO.getDepartment().equals(userDTO.getOfficeDTO().getId())){
+                        //创建时间格式化对象
+                        Calendar calendar = Calendar.getInstance();
+                        //获取员工入职时间
+                        calendar.setTime(staffUserInfoDTO.getInTime());
+                        //获取员工试用期限
+                        int months=Integer.parseInt(staffUserInfoDTO.getTimeLimit());
+                        calendar.add(Calendar.MONTH, months);
+                        //获取结束时间
+                        Date newDate=calendar.getTime();
+                        //获取到当前日期
+                        Date beginDate = new Date();
+                        //计算时间只差
+                        int interval1 = Integer.parseInt(this.getInterval(beginDate, newDate));
+                        String taskName = null;
+                        String titleStr = null;
+                        //如果还剩三天则发送通知
+                        if (interval1<=3 && interval1 >=0) {
+                            taskName = staffUserInfoDTO.getName()+"转正申请还未提交";
+                            titleStr = "距离"+staffUserInfoDTO.getName()+"转正申请提交还剩" + interval1 + "天,请尽快提交";
+                            Set<String> noticeUserSet = new HashSet<String>();
+
+                            String byIdForXXL = SpringUtil.getBean(IUserApi.class).getByIdForXXL(userDTO.getId());
+                            UserDTO createUser = JSON.parseObject(byIdForXXL, new TypeReference<UserDTO>() {});
+                            if(null != createUser && StringUtils.isNotBlank(createUser.getId())){
+                                noticeUserSet.add(createUser.getId());
+                            }
 
-                                List<String> noticeUserList = new ArrayList<String>(noticeUserSet);
-                                if(noticeUserList.size()>0) {
-                                    MyNoticeList myNotice = new MyNoticeList();
-                                    myNotice.setCreateById("1");
-                                    myNotice.setCreateTime(new Date());
-                                    myNotice.setUpdateById("1");
-                                    myNotice.setUpdateTime(new Date());
-                                    myNotice.setDelFlag(0);
-                                    //根据procInsId获取taskId
+                            List<String> noticeUserList = new ArrayList<String>(noticeUserSet);
+                            if(noticeUserList.size()>0) {
+                                MyNoticeList myNotice = new MyNoticeList();
+                                myNotice.setCreateById("1");
+                                myNotice.setCreateTime(new Date());
+                                myNotice.setUpdateById("1");
+                                myNotice.setUpdateTime(new Date());
+                                myNotice.setDelFlag(0);
+                                //根据procInsId获取taskId
 //                        String currentTask = SpringUtil.getBean(IFlowableApi.class).getTaskIdByprocInstId(jyAudit.getProjectProId());
-                                    myNotice.setTaskId("");
-                                    myNotice.setDefId("");
-                                    myNotice.setTitle(titleStr);
-                                    myNotice.setTaskName(taskName);
-                                    myNotice.setLink("结束");
-                                    myNotice.setType("0");
-                                    myNotice.setCreateUser("管理员");
-                                    myNotice.setCreateTime(new Date());
-                                    for (String noticeUserId : noticeUserList) {
-                                        myNotice.setNoticeId(noticeUserId);
-                                        myNotice.setNoticeName(createUser.getName());
-                                        //根据taskName和通知人 查询重复数量
-                                        String myNoticeInfo = JSON.toJSONString(myNotice);
-                                        Map<String, String> map = new HashMap();
+                                myNotice.setTaskId("");
+                                myNotice.setDefId("");
+                                myNotice.setTitle(titleStr);
+                                myNotice.setTaskName(taskName);
+                                myNotice.setLink("结束");
+                                myNotice.setType("0");
+                                myNotice.setCreateUser("管理员");
+                                myNotice.setCreateTime(new Date());
+                                for (String noticeUserId : noticeUserList) {
+                                    myNotice.setNoticeId(noticeUserId);
+                                    myNotice.setNoticeName(createUser.getName());
+                                    //根据taskName和通知人 查询重复数量
+                                    String myNoticeInfo = JSON.toJSONString(myNotice);
+                                    Map<String, String> map = new HashMap();
+                                    map.put("myNoticeInfo", myNoticeInfo);
+                                    String jsonInfo = SpringUtil.getBean(IFlowableApi.class).getRepetitionCountBymyNoticeTitle(map);
+                                    MyNoticeList repetitionCountBymyNotice = JSON.parseObject(jsonInfo, new TypeReference<MyNoticeList>() {
+                                    });
+
+                                    if (null == repetitionCountBymyNotice) {
+                                        // 生成id
+                                        String id = UUID.randomUUID().toString().replace("-", "");
+                                        myNotice.setId(id);
+                                        myNotice.setRepetitionCount(0);
+
+                                        myNoticeInfo = JSON.toJSONString(myNotice);
+                                        map.put("myNoticeInfo", myNoticeInfo);
+                                        SpringUtil.getBean(IFlowableApi.class).insertMyNotice(map);
+                                    } else {
+                                        myNotice.setId(repetitionCountBymyNotice.getId());
+                                        myNotice.setRepetitionCount(repetitionCountBymyNotice.getRepetitionCount() + 1);
+
+                                        myNoticeInfo = JSON.toJSONString(myNotice);
                                         map.put("myNoticeInfo", myNoticeInfo);
-                                        String jsonInfo = SpringUtil.getBean(IFlowableApi.class).getRepetitionCountBymyNoticeTitle(map);
-                                        MyNoticeList repetitionCountBymyNotice = JSON.parseObject(jsonInfo, new TypeReference<MyNoticeList>() {
-                                        });
-
-                                        if (null == repetitionCountBymyNotice) {
-                                            // 生成id
-                                            String id = UUID.randomUUID().toString().replace("-", "");
-                                            myNotice.setId(id);
-                                            myNotice.setRepetitionCount(0);
-
-                                            myNoticeInfo = JSON.toJSONString(myNotice);
-                                            map.put("myNoticeInfo", myNoticeInfo);
-                                            SpringUtil.getBean(IFlowableApi.class).insertMyNotice(map);
-                                        } else {
-                                            myNotice.setId(repetitionCountBymyNotice.getId());
-                                            myNotice.setRepetitionCount(repetitionCountBymyNotice.getRepetitionCount() + 1);
-
-                                            myNoticeInfo = JSON.toJSONString(myNotice);
-                                            map.put("myNoticeInfo", myNoticeInfo);
-                                            SpringUtil.getBean(IFlowableApi.class).updateMyNotice(map);
-                                        }
+                                        SpringUtil.getBean(IFlowableApi.class).updateMyNotice(map);
                                     }
                                 }
                             }
                         }
                     }
                 }
+
             }
         }