ソースを参照

报销帐号列表修改

anderx 2 年 前
コミット
bc78987bcd
共有1 個のファイルを変更した11 個の追加7 個の削除を含む
  1. 11 7
      src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

+ 11 - 7
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -156,11 +156,17 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         ExpenseAccount useEa = expenseAccountMapper.selectByPrimaryKey(in.getId());
         ExpenseAccount newEa=new ExpenseAccount();
         newEa.setId(useEa.getId());
-        if (useEa.getStatus()!=1)throw new BusinessException("审核状态错误");
+        if (useEa.getStatus()==0)throw new BusinessException("审核状态错误");
         if (useEa.getProcessStatus()!=in.getProcessStatus())throw new BusinessException("审核流程错误");
+        Integer status=1;
         //审核通知 获取发送人
+        addExamineExpenseAccountLog(in, useEa, newEa, status);
+        expenseAccountMapper.updateByPrimaryKeySelective(newEa);
+        return 1;
+    }
+
+    private void addExamineExpenseAccountLog(InputExpenseAccount in, ExpenseAccount useEa, ExpenseAccount newEa, Integer status) {
         List<Admin> aids=new ArrayList<>();
-        Integer status=1;
         StringBuffer str=new StringBuffer();
         str=str.append("您有报销需要审核,请查看并审核。");
         AdminListBo admin = adminMapper.getDeptNameByAid(useEa.getAid());
@@ -185,17 +191,15 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             newEa.setProcessStatus(EAProcessStatus.DSZSH.getCode());
         }else if (useEa.getProcessStatus()== EAProcessStatus.DSZSH.getCode()){
             //获取负责人
-            status=2;
+            status =2;
             aids.add(adminMapper.selectByPrimaryKey(admin.getId()));
             newEa.setStatus(status);
             str=new StringBuffer("您的报销审核已通过,请注意查看。");
         }
-        addLogAndNoticeAndEmail(in,useEa,status,str.toString(),admin.getName(),aids);
-        expenseAccountMapper.updateByPrimaryKeySelective(newEa);
-        return 1;
+        addLogAndNoticeAndEmail(in,  status,str.toString(),admin.getName(),aids);
     }
 
-    private void addLogAndNoticeAndEmail(InputExpenseAccount in, ExpenseAccount useEa, Integer status, String str,String aname, List<Admin> aids) {
+    private void addLogAndNoticeAndEmail(InputExpenseAccount in, Integer status, String str,String aname, List<Admin> aids) {
 
         Date date= new Date();
         Integer noticeStatus=NoticeStatus.EXPENSE_NOTICE.getCode();