Procházet zdrojové kódy

财务报销 功能优化

zhaoxian před 2 roky
rodič
revize
116728a340

+ 56 - 35
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.service.ISysDepartService;
 import cn.com.ctop.common.module.service.ISysUserService;
 import cn.com.ctop.common.module.service.IUserCompanyService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseApply;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseProject;
 import cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyMapper;
@@ -54,6 +55,9 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
     @Autowired
     private ISysUserService sysUserService;
 
+    @Autowired
+    private KuaishouReportDailyAccountMapper dailyAccountMapper;
+
     @Override
     public Result<Object> queryPageList(ReimburseApply reimburseApply, Integer pageNo, Integer pageSize) {
         PageHelper.startPage(pageNo, pageSize);
@@ -159,55 +163,72 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             return Result.ok();
         } else {
             ReimburseApply entity = this.getById(apply.getId());
-            //获取下次审核人信息
-            String leader = getLeader(entity.getLeaderId());
-            if (Check.isNull(leader)) {
-                return Result.error("编辑失败,userId:" + entity.getLeaderId() + ",未查询到下一级的审核人员,请联系管理员");
-            }
-            //审核人 操作流程:↓↓↓
             //状态 1待审核、2审核通过、3审核拒绝、4审核中、5部分拒绝
             String status = data.getString("status");
-            if ("4".equals(status)) {
-                if ("1".equals(entity.getFinalStatus())) {
-                    //发送 财务审核
-                    isFinancialReview = true;
-                    apply.setLeaderId("");
-                } else if (loginId.equals(leader)) {
-                    //登录人和待审核人一样,则是部门最后审核人
-                    apply.setFinalStatus("1");
-                    //是否是福利费用,是则发送审核 到指定审核人;否则 发送到财务
-                    String welfareUser = checkWelfare(projects);
-                    if (!Check.isNull(welfareUser)) {
-                        apply.setLeaderId(welfareUser);
-                        sender = welfareUser;
+            String leader = null;
+            if ("1".equals(entity.getFinalStatus())) {
+                if ("4".equals(status)) {
+                    //判断是否是 财务人员
+                    String roleCode = dailyAccountMapper.getRoleCodeByUserId(entity.getLeaderId());
+                    if ("financialReview".equals(roleCode)) {
+                        apply.setStatus("2");
                     } else {
                         //发送 财务审核
                         isFinancialReview = true;
                         apply.setLeaderId("");
                     }
-                } else {
-                    sender = leader;
-                    apply.setLeaderId(leader);
+                } else if ("3".equals(status) || "5".equals(status)) {
+                    apply.setLeaderId("");
+                    apply.setFinalStatus("0");
+                    sender = apply.getUserId();
+                }
+            } else {
+                //获取下次审核人信息
+                leader = getLeader(entity.getLeaderId());
+                if (Check.isNull(leader)) {
+                    return Result.error("编辑失败,userId:" + entity.getLeaderId() + ",未查询到下一级的审核人员,请联系管理员");
+                }
+                //审核人 操作流程:↓↓↓
+                if ("4".equals(status)) {
+                    if (loginId.equals(leader)) {
+                        //登录人和待审核人一样,则是部门最后审核人
+                        apply.setFinalStatus("1");
+                        //是否是福利费用,是则发送审核 到指定审核人;否则 发送到财务
+                        String welfareUser = checkWelfare(projects);
+                        if (!Check.isNull(welfareUser)) {
+                            apply.setLeaderId(welfareUser);
+                            sender = welfareUser;
+                        } else {
+                            //发送 财务审核
+                            isFinancialReview = true;
+                            apply.setLeaderId("");
+                        }
+                    } else {
+                        sender = leader;
+                        apply.setLeaderId(leader);
+                    }
+                } else if ("3".equals(status) || "5".equals(status)) {
+                    apply.setLeaderId("");
+                    apply.setFinalStatus("0");
+                    sender = apply.getUserId();
                 }
-            } else if ("3".equals(status) || "5".equals(status)) {
-                apply.setLeaderId("");
-                sender = apply.getUserId();
             }
             this.updateById(apply);
             if (!Check.isNull(sender)) {
                 baseMapper.insertRel(sender, apply.getId());
+                //流程到财务审核
+                if (isFinancialReview) {
+                    //财务审核roleId : 32825ea6b43cb61bffa09bf05ad69cf2
+                    List<SysUser> users = sysUserService.getUserListByRoleId("32825ea6b43cb61bffa09bf05ad69cf2");
+                    for (SysUser user : users) {
+                        sendMsg(user.getId(), type, id, msg);
+                    }
+                } else {
+                    sendMsg(sender, type, id, msg);
+                }
             }
         }
-        //流程到财务审核
-        if (isFinancialReview) {
-            //财务审核roleId : 32825ea6b43cb61bffa09bf05ad69cf2
-            List<SysUser> users = sysUserService.getUserListByRoleId("32825ea6b43cb61bffa09bf05ad69cf2");
-            for (SysUser user : users) {
-                sendMsg(user.getId(), type, id, msg);
-            }
-        } else {
-            sendMsg(sender, type, id, msg);
-        }
+
         return Result.ok();
     }