Browse Source

代码修复处理

anderx 10 months ago
parent
commit
3f848f83f3

+ 24 - 29
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -146,8 +146,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             if (i==1){
                 if (a.getExpenseSuperExamine()==1){
                     //新增一级
-                    String examineId=null;
-                    String examineName=null;
+                    String examineId;
+                    String examineName;
                     //正常用上级,没有的情况下就是自己
                     if (a.getSuperId()!=null){
                         examineId=a.getSuperId();
@@ -171,7 +171,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 }
                     eae.setAuditor(dep.getManagerId());
                     eae.setAuditorname(dep.getManagerName());
-            }else if (i==3){
+            }else {
                 if (StringUtils.isBlank(dep.getExpenseFinanceName()))throw new BusinessException("报销部门财务审核人不存在。");
                 eae.setAuditor(dep.getExpenseFinanceId());
                 eae.setAuditorname(dep.getExpenseFinanceName());
@@ -259,17 +259,17 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         examineByprocess(in,admin,dep,configDetailsList);
         List<ExpenseAccountExamine> list=expenseAccountExamineMapper.selectByEaidAndProcessStatus(in.getId(), in.getProcessStatus());
         List<Admin> aids=new ArrayList<>();
-        StringBuffer aname =new StringBuffer();
+        StringBuilder aname =new StringBuilder();
         for (ExpenseAccountExamine e : list) {
-            if (e.getProcessStatus()==in.getProcessStatus()&&e.getStatus()==0){
+            if (Objects.equals(e.getProcessStatus(), in.getProcessStatus()) &&e.getStatus()==0){
                 Admin ad = adminMapper.queryById(e.getAuditor());
                 aids.add(ad);
-                aname=aname.append(ad.getName()).append(",");
+                aname.append(ad.getName()).append(",");
             }
         }
         in.setExamineName(aname.substring(0,aname.length()-1));
-        StringBuffer str=new StringBuffer().append("编号[").append(in.getCheckNo()).append("]需要审核").append(",请查看并审核。");
-        addNoticeAndEmail(in,  EAProcessStatus.SJSH.getCode(),str.toString(), admin.getName(),aids);
+        String str = "编号[" + in.getCheckNo() + "]需要审核" + ",请查看并审核。";
+        addNoticeAndEmail(in,  EAProcessStatus.SJSH.getCode(), str, admin.getName(),aids);
     }
 
     @Override
@@ -299,7 +299,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             //如果以前没有选择借支,修改报销和借支数据
             if (useEA.getDebitId()==null){
                 pushExpenseAccountDebit(in);
-            }else if (useEA.getDebitId()!=in.getDebitId()) {
+            }else if (!Objects.equals(useEA.getDebitId(), in.getDebitId())) {
                 //如果是修改编号
                 pushExpenseAccountDebit(in);
                 //并且要处理原编号的问题
@@ -411,8 +411,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     @Override
     public Object getDepDetails(Integer id) {
         OutExpenseAccount outExpenseAccount = expenseAccountMapper.selectByid(id);
-        OrganizationListOut organizationListOut = departmentMapper.selectAllById(outExpenseAccount.getApplyDep());
-        return organizationListOut;
+        return departmentMapper.selectAllById(outExpenseAccount.getApplyDep());
     }
 
     @Override
@@ -437,7 +436,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         }
         if (StringUtils.isNotEmpty(typeOther)){
             MainExpenseAccount mainExpenseAccount = expenseAccountMapper.selectbySonId(id);
-            StringBuffer types=new StringBuffer();
+            StringBuilder types=new StringBuilder();
             for (SonExpenseAccount e : mainExpenseAccount.getSonList()) {
                 if (e.getType()!=0){
                     types.append(EATypes.getDescByCode(e.getType()));
@@ -590,7 +589,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                     }
 
                     map.put(5,e.getContractNo());
-                    map.put(7,getExpenseSecondaryType(e,det));
+                    map.put(7,getExpenseSecondaryType(e));
                     map.put(8,getBigDecimalZeros(det.getAmount()));
                     map.put(9,getBigDecimalZeros(det.getRealAmount()));
                     map.put(10,e.getPlan());
@@ -646,12 +645,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         return e.getOrderNo()+"\n"+applyDepName;
     }
 
-    private String getExpenseSecondaryType(SonExpenseAccount e,SonExpenseAccountDetails det) {
-        if (e.getType()==1){
-            if (det.getType()==1){
-                //交通工具待完善
-            }
-        }
+    private String getExpenseSecondaryType(SonExpenseAccount e) {
+        //交通工具待完善
         if (e.getSecondaryType()==0){
             return EAsecondaryTypes.getDescByCode(e.getSecondaryType())+"("+e.getSecondaryTypeOther()+")";
         }
@@ -887,7 +882,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 }
             }
         }else if (newEa.getStatus()==1){
-            if (newEa.getProcessStatus()==EAProcessStatus.BMFZRSH.getCode()){
+            if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.BMFZRSH.getCode())){
                 pushFinanceCount(admin.getDepFinance(),useEa.getCreateTime(),0);
                 //处理金额修改
                 if(in.getRealList()!=null){
@@ -910,11 +905,11 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                         }
                     }
                 }
-            }else if (newEa.getProcessStatus()==EAProcessStatus.CWSH.getCode()){
+            }else if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.CWSH.getCode())){
                 pushFinanceCount(admin.getDepFinance(),useEa.getCreateTime(),1);
             }
         }else if (newEa.getStatus()==3){
-            if (useEa.getProcessStatus()==EAProcessStatus.BMFZRSH.getCode()){
+            if (Objects.equals(useEa.getProcessStatus(), EAProcessStatus.BMFZRSH.getCode())){
                 pushFinanceCount(admin.getDepFinance(),useEa.getCreateTime(),2);
             }else if (newEa.getProcessStatus()>EAProcessStatus.CWSH.getCode()){
                 pushFinanceCount(admin.getDepFinance(),useEa.getCreateTime(),3);
@@ -953,19 +948,19 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
 
     private void addExamineExpenseAccountLog(AdminListBo admin,InputExpenseAccount in, ExpenseAccount useEa, ExpenseAccount newEa) {
         List<Admin> aids=new ArrayList<>();
-        StringBuffer str=new StringBuffer();
+        StringBuilder str=new StringBuilder();
         Integer status=in.getStatus();
         if (status==1){
             //审核处理审核表
             expenseAccountExamineMapper.updateStatusByEaidAndAid(in.getId(),TokenManager.getAdminId(),1,0);
-            str=str.append("编号[").append(in.getCheckNo()).append("]需要审核").append(",请查看并审核。");
+            str.append("编号[").append(in.getCheckNo()).append("]需要审核").append(",请查看并审核。");
             newEa.setAid(useEa.getAid());
             newEa.setCreateTime(useEa.getCreateTime());
             newEa.setApplyDep(useEa.getApplyDep());
             //在跳入董事长审核的时候非特批直接跳过,原则上下个流程不可再跳过
             OrganizationListOut dep = departmentMapper.selectAllById(newEa.getApplyDep());
             List<ExpenseConfigDetails>  configDetailsList = expenseConfigDetailsMapper.selectByDepId(newEa.getApplyDep());
-            if(useEa.getProcessStatus()==EAProcessStatus.CNSH.getCode()){
+            if(Objects.equals(useEa.getProcessStatus(), EAProcessStatus.CNSH.getCode())){
                 expenseAccountExamineMapper.updateStatusByEaidAndAid(in.getId(),TokenManager.getAdminId(),1,1);
                 boolean expenseExamine = pushExpenseExamine(configDetailsList, newEa,  EAProcessStatus.CNSH.getCode());
                 if (expenseExamine){
@@ -1010,7 +1005,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 //流程的推动
                 examineByprocess(newEa,admin,dep,configDetailsList);
                 //推动到出纳如果设置无需则完成不设置下个人,否则就要设置
-                if (newEa.getProcessStatus()==EAProcessStatus.CNSH.getCode()){
+                if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.CNSH.getCode())){
                     if(dep.getCashierExamine()==1){
                         pushExamineName(newEa, aids);
                     }else {
@@ -1032,7 +1027,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             newEa.setProcessStatus(0);
             str.setLength(0);
             addExpenseAccountLog(in.getId(),newEa.getStatus(),useEa.getProcessStatus(),TokenManager.getAdminId(),in.getReason());
-            str=str.append("您的报销审核已驳回,报销编号[").append(in.getCheckNo()).append("],请注意查看。");
+            str.append("您的报销审核已驳回,报销编号[").append(in.getCheckNo()).append("],请注意查看。");
         }
         if (newEa.getStatus()==null)newEa.setStatus(1);
         addNoticeAndEmail(in,  status,str.toString(),admin.getName(),aids);
@@ -1042,10 +1037,10 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         List<ExpenseAccountExamine> list=expenseAccountExamineMapper.selectByEaidAndProcessStatus(newEa.getId(), newEa.getProcessStatus());
         StringBuffer aname =new StringBuffer();
         for (ExpenseAccountExamine e : list) {
-            if (e.getProcessStatus()== newEa.getProcessStatus()&&e.getStatus()==0){
+            if (Objects.equals(e.getProcessStatus(), newEa.getProcessStatus()) &&e.getStatus()==0){
                 Admin ad=adminMapper.queryById(e.getAuditor());
                 aids.add(ad);
-                aname=aname.append(ad.getName()).append(",");
+                aname.append(ad.getName()).append(",");
             }
         }
         newEa.setExamineName(aname.substring(0,aname.length()-1));