sqg 3 lat temu
rodzic
commit
3cf56c81a2

+ 61 - 13
sc-service/src/main/java/com/huyi/service/common/flowable/controller/FlowableController.java

@@ -25,10 +25,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.lang.reflect.InvocationTargetException;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * 审批流程
@@ -492,6 +490,11 @@ public class  FlowableController extends BaseController
                                      @RequestParam("companyId") String companyId,
                                      @RequestParam("state") String state,
                                      @RequestParam("reason") String reason) throws Exception {
+        //获取当前操作员
+        LoginUser userNow = tokenService.getLoginUser();
+        String userNowId = String.valueOf(userNow.getSysUser().getUserId());
+        SysUser sysNowUser = iSysUserService.getById(userNowId);
+        String userNowName = sysNowUser.getNickName();
         //核心企业融信开立审批
         if("1000000000".equals(menuId)){
             ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
@@ -501,14 +504,30 @@ public class  FlowableController extends BaseController
                 zcFinanceInf.setZfiId(id);
                 //核心企业融资状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
                 zcFinanceInf.setZfiCoreStatus("02");
-            }else if("recall".equals(state)){
+            } else if("recall".equals(state)){
                 //融信主键
                 zcFinanceInf.setZfiId(id);
                 //核心企业融资状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
                 zcFinanceInf.setZfiCoreStatus("02");
             }
-            //TODO 发起人最终结果【拒绝】消息通知
             zcFinanceInfService.updateById(zcFinanceInf);
+            //根据Id查询实体类
+            ZcFinanceInf financeInf = zcFinanceInfService.getById(id);
+            //核心企业Id
+            String zfiCoreId = financeInf.getZfiCoreId();
+            //融信编号
+            String zfiNumber = financeInf.getZfiNumber();
+            //发起人
+            Long userId = Long.valueOf(financeInf.getCreateBy());
+            SysUser sysUser = iSysUserService.getById(userId);
+            String userName = sysUser.getNickName();
+            //发起时间
+            Date date = financeInf.getCreateTime();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            String dateTime = sdf.format(date);
+            //发起人最终结果【拒绝】消息通知
+            String title = "【审批拒绝】由"+ userName +"于"+ dateTime +"发起的:融信"+ zfiNumber +"审批"+ userNowName +"被拒绝,拒绝的理由为:"+reason;
+            remoteSystemService.sendNotice(zfiCoreId, id, title,"01","01","","0", userId.toString(),"", null, null);
             //核心企业确权审批
         }else if("1000000007".equals(menuId)){
             ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
@@ -516,16 +535,45 @@ public class  FlowableController extends BaseController
             if("delete".equals(state)){
                 //融信主键
                 zcFinanceInf.setZfiId(id);
-                //核心企业审批状态改为拒绝
+                //核心企业审批状态改为审批拒绝
+                zcFinanceInf.setZfiCoreStatus("02");
+            }else if("recall".equals(state)){
+                //融信主键
+                zcFinanceInf.setZfiId(id);
+                //核心企业审批状态改为审批拒绝
                 zcFinanceInf.setZfiCoreStatus("02");
             }
-//            else if("recall".equals(state)){
-//                zcFinanceInf.setZfiId(id);
-//                zcFinanceInf.setZfiStatus("03");
-//            }
-            //TODO 核心企业经办人最终结果【拒绝】消息通知
-            //TODO  核心企业经办人生成确权待办
             zcFinanceInfService.updateById(zcFinanceInf);
+            //根据主键获取实体
+            ZcFinanceInf financeInf = zcFinanceInfService.getById(id);
+            //核心企业Id
+            String zfiCoreId = financeInf.getZfiCoreId();
+            //融信编号
+            String zfiNumber = financeInf.getZfiNumber();
+            //发起人
+            Long userId = Long.valueOf(financeInf.getCreateBy());
+            SysUser sysUser = iSysUserService.getById(userId);
+            String userName = sysUser.getNickName();
+            //发起时间
+            Date date = financeInf.getCreateTime();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            String dateTime = sdf.format(date);
+            //获取核心企业经办人
+            LambdaQueryWrapper<SysUserCompanyRel> queryWrapper = new LambdaQueryWrapper<>();
+            //核心企业Id
+            queryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,zfiCoreId);
+            //是否为经办人(1:是)
+            queryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
+            List<SysUserCompanyRel> list = iSysUserCompanyRelService.findSysUserCompanyRels(queryWrapper);
+            Long user = null;
+            if(list.size() > 0){
+                user = list.get(0).getSucrUserId();
+            }
+            String title = "【审批拒绝】由"+ userName +"于"+ dateTime +"发起的:融信"+ zfiNumber +"审批"+ userNowName +"被拒绝,拒绝的理由为:"+reason;
+            remoteSystemService.sendNotice(zfiCoreId, id,title,"01","01","","0", user.toString(),"", null, null);
+            //确权待办
+            remoteSystemService.sendNotice(zfiCoreId, id,"确权审批融信编号为" + zfiNumber + "的资料审批待确权",
+                    "00",null,"02","0", user.toString(), null, null, null);
         }
         //融资企业融信申请拒绝
         else if("1000000002".equals(menuId)){