Kaynağa Gözat

fix 待办流程提醒

tjf 8 ay önce
ebeveyn
işleme
9dd6f35a82

+ 72 - 31
ruoyi-system/src/main/java/com/ruoyi/system/service/conference/impl/SysUserConferenceServiceImpl.java

@@ -137,8 +137,8 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
         loanApplication.setReviewTime(sysUserConference.getConferenceTime());
         loanApplication.setReviewSchedule(FOR);
         loanApplicationMapper.updateLoanApplication(loanApplication);
-        
-        redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber()+"tp",FOR);
+
+        redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber() + "tp", FOR);
 
         //查询参会人员的字典值
         List<SysDictData> data = dictTypeService.selectDictDataByType("conference_role");
@@ -150,7 +150,7 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
         Random random = new Random();
         while (num < 5) {
             int randomNumber = random.nextInt(userList.size() - 1);
-            if(intList.size()>0 && intList.contains(randomNumber)){
+            if (intList.size() > 0 && intList.contains(randomNumber)) {
                 continue;
             }
             SysUser sysUser = userList.get(randomNumber);
@@ -179,19 +179,19 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
                 waitRemind.setRemindTime(DateUtils.getNowDate());
                 waitRemind.setRemindType("12");
                 waitRemind.setReadUserId(sysUser.getUserId().toString());
-                waitRemind.setRemindContent("您有一个评审会议需参加,会议时间:"+sysUserConference.getConferenceTime()+",会议主题:【"+loanApplication.getEnterpriseName()+"】评审会");
+                waitRemind.setRemindContent("您有一个评审会议需参加,会议时间:" + sysUserConference.getConferenceTime() + ",会议主题:【" + loanApplication.getEnterpriseName() + "】评审会");
                 waitRemindMapper.insertWaitRemind(waitRemind);
                 num++;
                 intList.add(randomNumber);
 
                 //发极光推送
                 SysUser user = sysUserService.selectUserById(sysUser.getUserId());
-                if(StringUtils.isNotEmpty(user.getJgId())){
+                if (StringUtils.isNotEmpty(user.getJgId())) {
                     String notificationTitle = "消息通知";
                     String msgTitle = "评审会议";
-                    String msgContent = "您有一个评审会议需参加,会议时间:"+sysUserConference.getConferenceTime()+",会议主题:【"+loanApplication.getEnterpriseName()+"】评审会";
+                    String msgContent = "您有一个评审会议需参加,会议时间:" + sysUserConference.getConferenceTime() + ",会议主题:【" + loanApplication.getEnterpriseName() + "】评审会";
                     String jPushVO = "";
-                    JPushToolUtil.sendToRegistrationId(notificationTitle,msgTitle,msgContent,jPushVO,user.getJgId());
+                    JPushToolUtil.sendToRegistrationId(notificationTitle, msgTitle, msgContent, jPushVO, user.getJgId());
                 }
             }
         }
@@ -201,22 +201,21 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
     @Override
     public AjaxResult timeTist(SysUserConference sysUserConference) {
         List<SysUserConference> sysUserConferences = sysUserConferenceMapper.selectSysUserConferenceList(sysUserConference);
-        List<Map<String,Object>> listMap = new ArrayList<>();
-        if(sysUserConferences==null || sysUserConferences.size()<=0){
+        List<Map<String, Object>> listMap = new ArrayList<>();
+        if (sysUserConferences == null || sysUserConferences.size() <= 0) {
             return AjaxResult.success(listMap);
         }
-        Map<String,List<SysUserConference>> map = sysUserConferences.stream().collect(Collectors.groupingBy(SysUserConference::getConferenceTime));
+        Map<String, List<SysUserConference>> map = sysUserConferences.stream().collect(Collectors.groupingBy(SysUserConference::getConferenceTime));
 
         //根据时间进行升序排序
         Map<String, List<SysUserConference>> result = new LinkedHashMap<>();
         map.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByKey())).forEachOrdered(x -> result.put(x.getKey(), x.getValue()));
 
 
-
         for (Map.Entry<String, List<SysUserConference>> entry : result.entrySet()) {
-            Map<String,Object> resultMap = new HashMap<>();
-            resultMap.put("conferenceTime",entry.getKey());
-            resultMap.put("children",entry.getValue());
+            Map<String, Object> resultMap = new HashMap<>();
+            resultMap.put("conferenceTime", entry.getKey());
+            resultMap.put("children", entry.getValue());
             listMap.add(resultMap);
         }
         return AjaxResult.success(listMap);
@@ -232,7 +231,7 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
     @Transactional
     public AjaxResult vote(SysUserConference sysUserConference) {
         //将状态改为投票中
-        redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber()+"tp",ONE);
+        redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber() + "tp", ONE);
         SysUser user = SecurityUtils.getLoginUser().getUser();
         //查询所有人员的投票结果
         List<SysUserConference> sysUserConferences = sysUserConferenceMapper.selectSysUserConferenceList(sysUserConference);
@@ -241,19 +240,19 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
         //是否重复投票
         Boolean bn = false;
         for (SysUserConference userConference : sysUserConferences) {
-            if(user.getUserId().equals(userConference.getUserId())){
+            if (user.getUserId().equals(userConference.getUserId())) {
                 bo = true;
-                if(StringUtils.isNotEmpty(userConference.getVotingResult())){
+                if (StringUtils.isNotEmpty(userConference.getVotingResult())) {
                     bn = true;
                 }
                 break;
             }
         }
         //为 false 时表示不在
-        if(!bo){
+        if (!bo) {
             return AjaxResult.error("不是当前项目投票人员,投票失败");
         }
-        if(bn){
+        if (bn) {
             return AjaxResult.error("请勿重复投票");
         }
 
@@ -263,23 +262,23 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
         //除了本人外是否全部投票
         //不同意人数
         int bty = 0;
-        if("N".equals(sysUserConference.getVotingResult())){
+        if ("N".equals(sysUserConference.getVotingResult())) {
             bty++;
         }
         for (SysUserConference userConference : sysUserConferences) {
             //是否有人未投票
-            if(!userConference.getUserId().equals(user.getUserId()) && StringUtils.isEmpty(userConference.getVotingResult())){
+            if (!userConference.getUserId().equals(user.getUserId()) && StringUtils.isEmpty(userConference.getVotingResult())) {
                 //有人未投票就直接返回结果
                 return AjaxResult.success("成功");
             }
             //排除掉本人
-            if(!userConference.getUserId().equals(user.getUserId()) && StringUtils.isNotEmpty(userConference.getVotingResult()) && "N".equals(userConference.getVotingResult())){
+            if (!userConference.getUserId().equals(user.getUserId()) && StringUtils.isNotEmpty(userConference.getVotingResult()) && "N".equals(userConference.getVotingResult())) {
                 bty++;
             }
 
         }
-        redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber()+"tp",TWO);
-        if(bty>=2){
+        redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber() + "tp", TWO);
+        if (bty >= 2) {
             //修改主表信息 未通过
             LoanApplication loanApplication = new LoanApplication();
             loanApplication.setAuditType(FOR);
@@ -304,27 +303,27 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
         //判断所有人的金额是否一样
         //最后一个投票人员
         String je = sysUserConference.getLineGuarantee();
-        if("N".equals(sysUserConference.getVotingResult())){
+        if ("N".equals(sysUserConference.getVotingResult())) {
             for (SysUserConference userConference : sysUserConferences) {
-                if(StringUtils.isNotEmpty(userConference.getLineGuarantee())){
+                if (StringUtils.isNotEmpty(userConference.getLineGuarantee())) {
                     je = userConference.getLineGuarantee();
                 }
             }
         }
         Boolean bl = true;
         for (SysUserConference userConference : sysUserConferences) {
-            if(!userConference.getUserId().equals(user.getUserId()) && !je.equals(userConference.getLineGuarantee())){
+            if (!userConference.getUserId().equals(user.getUserId()) && !je.equals(userConference.getLineGuarantee())) {
                 bl = false;
                 break;
             }
         }
         //不一样
-        if(!bl){
-            redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber()+"tp",THR);
+        if (!bl) {
+            redisCache.setCacheObject(sysUserConference.getLoanApplicationNumber() + "tp", THR);
             return AjaxResult.success("成功,投票金额不同,请通知管理员重新发起投票");
         }
 
-        if(bty<2){
+        if (bty < 2) {
             //修改主表信息 通过
             LoanApplication loanApplication = new LoanApplication();
             loanApplication.setAuditType(ONE);
@@ -334,6 +333,48 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
             loanApplication.setActuallyAmount(Double.parseDouble(je));
             loanApplication.setLoanApplicationId(sysUserConference.getLoanApplicationId());
             loanApplicationMapper.updateLoanApplication(loanApplication);
+            //查询信息
+            List<Long> userIdList = new ArrayList<>();
+            List<WaitRemind> waitRemindList = new ArrayList<>();
+            LoanApplication loanApplicationOld = loanApplicationMapper.selectLoanApplicationByLoanApplicationId(sysUserConference.getLoanApplicationId());
+            //发送待办消息
+            //删除所有待办事项
+            WaitRemind waitRemindDelete = new WaitRemind();
+            waitRemindDelete.setLoanApplicationId(loanApplication.getLoanApplicationId());
+            waitRemindMapper.deleteWaitRemindByLoanApplicationIdOnly(waitRemindDelete);
+            //给A发送待办消息
+            WaitRemind waitRemind = new WaitRemind();
+            waitRemind.setLoanApplicationId(loanApplicationOld.getLoanApplicationId());
+            waitRemind.setLoanApplicationNumber(loanApplicationOld.getLoanApplicationNumber());
+            String enterpriseName = loanApplicationOld.getEnterpriseName();
+            waitRemind.setRemindTitle("您有一条【" + enterpriseName + "】的审核信息待办");
+            waitRemind.setRemindContent(enterpriseName + "有一条贷款申请需及时处理");
+            waitRemind.setRemindTime(DateUtils.getNowDate());
+            //如果退到 A角色审核 B角色审核 风险审核还需要插入待办提醒
+            waitRemind.setRemindType(loanApplication.getAuditSchedule());
+            //给A角色发送待办提醒
+            waitRemind.setReadUserId(loanApplicationOld.getaUserId().toString());
+            waitRemindList.add(waitRemind);
+            userIdList.add(loanApplicationOld.getaUserId());
+
+            //插入待办事项
+            waitRemindMapper.batchWaitRemind(waitRemindList);
+            //发极光推送id
+            List<SysUser> sysUsers = sysUserService.selectUserListByIdList(userIdList);
+            if (sysUsers != null && sysUsers.size() > 0) {
+                String notificationTitle = "消息通知";
+                String msgTitle = "撤销信息";
+                String msgContent = loanApplication.getEnterpriseName() + "的信息进行了撤销";
+                String jPushVO = "";
+                List<String> listS = sysUsers.stream().map(SysUser::getJgId).collect(Collectors.toList());
+                listS.removeAll(Collections.singleton(null));
+                if (listS != null && listS.size() > 0) {
+                    String[] registrationId = listS.toArray(new String[listS.size()]);
+                    JPushToolUtil.sendToRegistrationId(notificationTitle, msgTitle, msgContent, jPushVO, registrationId);
+                }
+            }
+
+
             // todo 通过 业务流程表插入数据
             //业务审核意见
             ReviewComments reviewComments = new ReviewComments();
@@ -354,7 +395,7 @@ public class SysUserConferenceServiceImpl implements ISysUserConferenceService {
     @Transactional
     public AjaxResult again(SysUserConference sysUserConference) {
         //删除投票状态
-        redisCache.deleteObject(sysUserConference.getLoanApplicationNumber()+"tp");
+        redisCache.deleteObject(sysUserConference.getLoanApplicationNumber() + "tp");
         //查询最新的投票人员
         //查询贷款表信息
         LoanApplication loanApplication = loanApplicationMapper.selectLoanApplicationByLoanApplicationId(sysUserConference.getLoanApplicationId());