소스 검색

咨询师我的项目列表逻辑修改

anderx 2 년 전
부모
커밋
ce1ef0e46a

+ 10 - 15
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -806,6 +806,10 @@
     left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
     left join t_order_new o on b.order_no =o.order_no left join expense_account c on a.ea_id =c.id
     left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
+    <if test="roleType == 1">
+    inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
+    where auditor= #{aid} group by eaid) eae on b.id=eae.eaid
+    </if>
     <include refid="ExpenseMainSql"/>
       order by if(b.status=3,-1,b.status)  ,b.create_time desc
     ${page_sql}
@@ -823,12 +827,11 @@
     </if>
     <if test="roleType == 1">
       <if test="listStatus ==0">
-        and b.process_status =1
+        and b.process_status =eae.type
       </if>
       <if test="listStatus ==1">
-        and b.process_status &gt; 1
+        and b.process_status &gt; eae.type
       </if>
-      and ad.superior_id= #{aid}
     </if>
     <if test="roleType == 2">
       <if test="listStatus ==0">
@@ -839,18 +842,6 @@
       </if>
       and adDep.finance_id = #{aid}
     </if>
-    <if test="roleType == 3">
-      <if test="listStatus ==0">
-        and b.process_status =3
-      </if>
-      <if test="listStatus ==1">
-        and b.process_status &gt; 3
-      </if>
-      and ad.department_id in
-      <foreach collection="deps" item="dep" open="(" close=")" separator=",">
-        #{dep}
-      </foreach>
-    </if>
     <if test="roleType == 4">
       <if test="listStatus ==0">
         and b.process_status =4 and b.status=1
@@ -868,6 +859,10 @@
     from expense_account b
     left join admin ad on b.aid=ad.id
     left join department adDep on ad .department_id=adDep.id
+    <if test="roleType == 1">
+      inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
+      where auditor= #{aid} group by eaid) eae on b.id=eae.eaid
+    </if>
     <include refid="ExpenseMainSql"/>
   </select>
 

+ 8 - 12
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -742,14 +742,12 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     public MainExpenseAccount mainExpense(Integer id) {
         MainExpenseAccount res = expenseAccountMapper.selectByMainId(id);
         res.setExamine(0);
-        if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)&&(res.getProcessStatus()==1)){
-            res.setExamine(1);
-        }else if (TokenManager.hasRole(AFTConstants.FINANCE)&&(res.getProcessStatus()==2)){
-            res.setExamine(1);
-        }else if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)&&(res.getProcessStatus()==3)){
-            res.setExamine(1);
-        }else if (TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)&&(res.getProcessStatus()==4)){
-            res.setExamine(1);
+        List<ExpenseAccountExamine> expenseAccountExamines = expenseAccountExamineMapper.selectByEaidAndProcessStatus(id, res.getProcessStatus());
+        for (ExpenseAccountExamine e : expenseAccountExamines) {
+            if (e.getAuditor().equals(TokenManager.getAdminId())){
+                res.setExamine(1);
+                break;
+            }
         }
         if (res.getAid().equals(TokenManager.getAdminId())){
             res.setExamine(2);
@@ -799,11 +797,9 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         if (in.getListStatus()!=null) params.put("listStatus",in.getListStatus());
         //1-3s是不同人的审核
         if (in.getProcessStatus()!=null&&in.getProcessStatus()==1){
-            if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
-                in.setProcessStatus(3);
-            }else if (TokenManager.hasRole(AFTConstants.FINANCE)){
+             if (TokenManager.hasRole(AFTConstants.FINANCE)){
                 in.setProcessStatus(2);
-            }else if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)){
+            }else if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)||TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
                 in.setProcessStatus(1);
             }else if (TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)||TokenManager.hasRole(AFTConstants.APPROVAL_DECISION_ASSISTANT)){
                 in.setProcessStatus(4);