Browse Source

修改审核逻辑

anderx 2 years ago
parent
commit
99617ab4d0

+ 7 - 3
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -362,14 +362,16 @@
     left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
     left join t_order_mid tm on a.order_no =tm.order_no left join department f on d.department_id =f.id
     left join admin d2 on f.finance_id =d2.id
+    <if test="processStatus ==1">
     inner join expense_account_examine eae on a.id=eae.eaid
+    </if>
     where 1=1
     <if test="processStatus ==0">
     and a.aid= #{aid}
     </if>
     <if test="processStatus ==1">
       and a.process_status>0
-      and a.process_status =eae.`type`
+      and a.process_status >=eae.`type`
       and eae.auditor = #{aid}
     </if>
     <if test="status != null">
@@ -404,14 +406,16 @@
     from expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
     left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
     left join t_order_mid tm on a.order_no =tm.order_no
-    inner join expense_account_examine eae on a.id=eae.eaid
+    <if test="processStatus ==1">
+      inner join expense_account_examine eae on a.id=eae.eaid
+    </if>
     where 1=1
     <if test="processStatus ==0">
       and a.aid= #{aid}
     </if>
     <if test="processStatus ==1">
       and a.process_status>0
-      and a.process_status =eae.`type`
+      and a.process_status >=eae.`type`
       and eae.auditor = #{aid}
     </if>
     <if test="status != null">

+ 3 - 15
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -355,6 +355,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         AdminListBo admin = adminMapper.getDeptNameByAid(useEa.getAid());
         if (status==1){
             str=str.append("您有报销需要审核,").append("报销编号[").append(in.getId()).append("]").append(",请查看并审核。");
+            newEa.setProcessStatus(in.getProcessStatus());
             pushExamineProcess(newEa);
             if(useEa.getProcessStatus()== EAProcessStatus.FQ.getCode()){
                 //获取上级
@@ -434,7 +435,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
 
     private void addLogAndNoticeAndEmail(InputExpenseAccount in, Integer status, String str,String aname, List<Admin> aids) {
         Date date= new Date();
-        addExpenseAccountLog(in.getId(),status,null,in.getReason());
+        if (status!=1)addExpenseAccountLog(in.getId(),status,null,in.getReason());
         Integer noticeStatus=NoticeStatus.EXPENSE_NOTICE.getCode();
         if (status==2){
             noticeStatus=NoticeStatus.EXPENSE_COMPLETE.getCode();
@@ -508,20 +509,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             param.put("endTime",in.getEndTime()+" 23:59:59");
         }
         if (in.getStatus()!=null)param.put("status",in.getStatus());
-        if (in.getProcessStatus()!=null){
-            Integer processStatus=in.getProcessStatus();
-            //默认自己 设置上级,判断管理员与总裁等顶级审核
-            if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
-                processStatus=3;
-                List<String> list = departmentService.selectMyDeps();
-                param.put("deps",list);
-            }else if (TokenManager.hasRole(AFTConstants.FINANCE)){
-                processStatus=2;
-            }else if (checkShiroCED()){
-                processStatus=4;
-            }
-                param.put("processStatus",processStatus);
-        }else {
+        if (in.getProcessStatus()==null){
             param.put("processStatus",0);
         }
         if (in.getContractNo()!=null)param.put("contractNo",in.getContractNo());