소스 검색

财务复审修改开发

anderx 2 년 전
부모
커밋
8a087e204a

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

@@ -863,7 +863,10 @@
       left join department adDep on ad.department_id=adDep.id
     <if test="roleType > 0">
       inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
-      where auditor= #{aid} and status=0 group by eaid) eae on b.id=eae.eaid
+      where auditor= #{aid}
+      <if test="listStatus ==0"> and status=0 </if>
+      <if test="listStatus ==1"> and status=1 </if>
+      group by eaid) eae on b.id=eae.eaid
     </if>
     <if test="username !=null">
       left join expense_relationship er on er.id=b.id
@@ -928,9 +931,12 @@
     left join expense_account ea2 on ea2.id=er.ea_id
   </if>
     left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
-    <if test="roleType == 1">
+    <if test="roleType > 0">
       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
+      where auditor= #{aid}
+      <if test="listStatus ==0"> and status=0 </if>
+      <if test="listStatus ==1"> and status=1 </if>
+      group by eaid) eae on b.id=eae.eaid
     </if>
     <include refid="ExpenseMainSql"/>
   </select>

+ 107 - 44
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -490,9 +490,9 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             //审核处理审核表
             expenseAccountExamineMapper.updateStatusByEaidAndAid(in.getId(),TokenManager.getAdminId(),1);
             str=str.append("编号[").append(in.getCheckNo()).append("]需要审核").append(",请查看并审核。");
-
             newEa.setAid(useEa.getAid());
             newEa.setCreateTime(useEa.getCreateTime());
+            newEa.setApplyDep(useEa.getApplyDep());
             if(useEa.getProcessStatus()==EAProcessStatus.CNSH.getCode()){
                 //完成后的流程
                 status =2;
@@ -504,15 +504,24 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 newEa.setProcessStatus(useEa.getProcessStatus()+1);
                 if (newEa.getApproval()==null)newEa.setApproval(useEa.getApproval());
                 List<ExpenseAccountExamine> list=examineByprocess(newEa,admin);
-                StringBuffer aname =new StringBuffer();
-                for (ExpenseAccountExamine e : list) {
-                    if (e.getProcessStatus()==newEa.getProcessStatus()&&e.getStatus()==0){
-                        Admin ad=adminMapper.selectByPrimaryKey(e.getAuditor());
-                        aids.add(ad);
-                        aname=aname.append(ad.getName()).append(",");
+                //未设置推送到完成
+                if (newEa.getProcessStatus()==8 && newEa.getStatus()==2){
+                    //完成后的流程
+                    status =2;
+                    aids.add(adminMapper.selectByPrimaryKey(admin.getId()));
+                    newEa.setStatus(status);
+                    newEa.setExamineName("");
+                }else {
+                    StringBuffer aname =new StringBuffer();
+                    for (ExpenseAccountExamine e : list) {
+                        if (e.getProcessStatus()==newEa.getProcessStatus()&&e.getStatus()==0){
+                            Admin ad=adminMapper.selectByPrimaryKey(e.getAuditor());
+                            aids.add(ad);
+                            aname=aname.append(ad.getName()).append(",");
+                        }
                     }
+                    newEa.setExamineName(aname.substring(0,aname.length()-1));
                 }
-                newEa.setExamineName(aname.substring(0,aname.length()-1));
             }
         }else {
             aids.add(adminMapper.selectByPrimaryKey(admin.getId()));
@@ -593,6 +602,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             }
             //如果当前审核人已经审核,则跳过当前审核
             if (flag){
+                newEa.setProcessStatus(newEa.getProcessStatus()+1);
                 String str=String.format("重复审核人跳过[%s]。",EAProcessStatus.getDesc(newEa.getProcessStatus()));
                 Date date=new Date();
                 date.setTime(date.getTime()+1000l);
@@ -604,6 +614,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 examineByprocess(newEa,admin,dep,list);
             }
         }else {
+            String str=null;
             boolean flag2= false;
             Date date2=new Date();
             date2.setTime(date2.getTime()+1000l);
@@ -612,52 +623,76 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 //财务复审财务复审
                 if (dep.getExpenseRetrialFinanceExamine()==0){
                     flag2=true;
-                    tip="部门未设置财务复审,跳过此流程";
+                    tip=EAProcessStatus.CWFS.getDesc();
                 }else {
-                    List<ExpenseConfigDetails> collect = list.stream().filter(e -> e.getType() == 1).collect(Collectors.toList());
-                    int count = 0;
-                    examineList.clear();
-                    for (ExpenseConfigDetails e : collect) {
-                        ExpenseAccountExamine eae=new ExpenseAccountExamine(newEa.getId(),EAProcessStatus.CWFS.getCode());
-                        eae.setAuditor(e.getAid());
-                        eae.setAuditorname(e.getAdminName());
-                        Integer i = expenseAccountExamineMapper.selectYesByParam(newEa.getId(), e.getAid());
-                        if (i>0||e.getAid().equals(TokenManager.getAdminId())) {
-                            eae.setStatus(1);
-                            count++;
+                    boolean expenseExamine = pushExpenseExamine(list, newEa, examineList, EAProcessStatus.CWFS.getCode());
+                    if (expenseExamine){
+                        flag2=true;
+                        str=String.format("[%s]通过审核,步入下个流程",EAProcessStatus.CWGGLYSH.getDesc());
+                    }
+                }
+            }else if (newEa.getProcessStatus()==EAProcessStatus.DSZSH.getCode()){
+                if (dep.getCeoExamine()==1){
+                    if (newEa.getApproval()!=1){
+                        flag2=true;
+                        tip="特批(财务选择)";
+                    }else {
+                        boolean expenseExamine = pushExpenseExamine(list, newEa, examineList, EAProcessStatus.CWFS.getCode());
+                        if (expenseExamine){
+                            flag2=true;
+                            str=String.format("[%s]通过审核,步入下个流程",EAProcessStatus.CWGGLYSH.getDesc());
                         }
-                        examineList.add(eae);
                     }
-                    if (count==collect.size()){
+                }else {
+                    flag2=true;
+                    tip="特批(部门设置)";
+                }
+
+            }else if (newEa.getProcessStatus()==EAProcessStatus.CWGGLYSH.getCode()){
+                if (dep.getExpenseRetrialFinanceExamine()==0){
+                    flag2=true;
+                    tip=EAProcessStatus.CWGGLYSH.getDesc();
+                }else {
+                    boolean expenseExamine = pushExpenseExamine(list, newEa, examineList, EAProcessStatus.CWFS.getCode());
+                    if (expenseExamine){
                         flag2=true;
-                        tip="财务复审全部通过审核,步入下个流程";
+                        str=String.format("[%s]通过审核,步入下个流程",EAProcessStatus.CWGGLYSH.getDesc());
                     }
                 }
-            }else if (newEa.getProcessStatus()==EAProcessStatus.DSZSH.getCode()){
-                if (newEa.getApproval()!=1){
-                    newEa.setProcessStatus(newEa.getProcessStatus()+1);
+            }else if (newEa.getProcessStatus()==EAProcessStatus.GSFSSH.getCode()){
+                if (dep.getExpenseRetrialFinanceExamine()==0){
                     flag2=true;
-                    tip="特批(财务选择)";
+                    tip=EAProcessStatus.GSFSSH.getDesc();
+                }else {
+                    boolean expenseExamine = pushExpenseExamine(list, newEa, examineList, EAProcessStatus.GSFSSH.getCode());
+                    if (expenseExamine){
+                        flag2=true;
+                        str=String.format("[%s]通过审核,步入下个流程",EAProcessStatus.GSFSSH.getDesc());
+                    }
+                }
+            }else if (newEa.getProcessStatus()==EAProcessStatus.CNSH.getCode()){
+                if (dep.getExpenseRetrialFinanceExamine()==0){
+                    flag2=true;
+                    tip=EAProcessStatus.CNSH.getDesc();
+                }else {
+                    boolean expenseExamine = pushExpenseExamine(list, newEa, examineList, EAProcessStatus.CNSH.getCode());
+                    if (expenseExamine){
+                        flag2=true;
+                        str=String.format("[%s]通过审核,步入下个流程",EAProcessStatus.CNSH.getDesc());
+                    }
                 }
-            }else {
-                newEa.setProcessStatus(newEa.getProcessStatus()+1);
-                flag2=true;
-                tip=EAProcessStatus.DSZSH.getDesc();
-            }
-            if (newEa.getProcessStatus()==EAProcessStatus.CWGGLYSH.getCode()){
-                newEa.setProcessStatus(newEa.getProcessStatus()+1);
-                flag2=true;
-                tip=EAProcessStatus.CWGGLYSH.getDesc();
-            }
-            if (newEa.getProcessStatus()==EAProcessStatus.GSFSSH.getCode()){
-                newEa.setProcessStatus(newEa.getProcessStatus()+1);
-                flag2=true;
-                tip=EAProcessStatus.GSFSSH.getDesc();
             }
             if (flag2){
-                addExpenseAccountLog(newEa.getId(),1,newEa.getProcessStatus(),"1",String.format("未设置[%s]审核,跳过此流程",tip),date2);
-                newEa.setProcessStatus(newEa.getProcessStatus()+1);
-                examineByprocess(newEa,admin,dep,list);
+                if (newEa.getProcessStatus()<EAProcessStatus.CNSH.getCode()){
+                    if (str==null)str=String.format("未设置[%s]审核,跳过此流程",tip);
+                    addExpenseAccountLog(newEa.getId(),1,newEa.getProcessStatus(),"1",str,date2);
+                    newEa.setProcessStatus(newEa.getProcessStatus()+1);
+                    examineByprocess(newEa,admin,dep,list);
+                }else {
+                    newEa.setProcessStatus(newEa.getProcessStatus());
+                    newEa.setStatus(2);
+                }
+
             }
         }
 
@@ -666,6 +701,34 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         return examineList;
     }
 
+    private boolean pushExpenseExamine(List<ExpenseConfigDetails> list, ExpenseAccount newEa, List<ExpenseAccountExamine> examineList, Integer status) {
+        int configDetails=0;
+        if (status==EAProcessStatus.CWFS.getCode())configDetails=1;
+        if (status==EAProcessStatus.DSZSH.getCode())configDetails=2;
+        if (status==EAProcessStatus.CWGGLYSH.getCode())configDetails=3;
+        if (status==EAProcessStatus.GSFSSH.getCode())configDetails=4;
+        if (status==EAProcessStatus.CNSH.getCode())configDetails=5;
+        int finalConfigDetails = configDetails;
+        List<ExpenseConfigDetails> collect = list.stream().filter(e -> e.getType() == finalConfigDetails).collect(Collectors.toList());
+        int count = 0;
+        examineList.clear();
+        for (ExpenseConfigDetails e : collect) {
+            ExpenseAccountExamine eae=new ExpenseAccountExamine(newEa.getId(),status);
+            eae.setAuditor(e.getAid());
+            eae.setAuditorname(e.getAdminName());
+            Integer i = expenseAccountExamineMapper.selectYesByParam(newEa.getId(), e.getAid());
+            if (i>0||e.getAid().equals(TokenManager.getAdminId())) {
+                eae.setStatus(1);
+                count++;
+            }
+            examineList.add(eae);
+        }
+        if (count==collect.size()){
+            return true;
+        }
+        return false;
+    }
+
     private void addNoticeAndEmail(ExpenseAccount in, Integer status, String str,String aname, List<Admin> aids) {
         Date date= new Date();
 

+ 1 - 1
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseConfigServiceImpl.java

@@ -19,7 +19,7 @@ public class ExpenseConfigServiceImpl implements ExpenseConfigService {
     @Override
     public Object addDeTails(ExpenseConfigDetails details) {
         expenseConfigDetailsMapper.insertSelective(details);
-        return 1;
+        return details;
     }
 
     @Override