anderx лет назад: 2
Родитель
Сommit
dfe9a11782

+ 14 - 25
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -447,11 +447,11 @@
     </if>
     where 1=1
       <if test="processStatus ==2">
-        and a.process_status>0
-        <if test="examineStatus ==0">
+        and a.process_status>=0
+        <if test="examineStatus ==1">
           and a.status=1
         </if>
-        <if test="examineStatus ==1">
+        <if test="examineStatus ==2">
           and a.status=2
         </if>
       </if>
@@ -473,8 +473,8 @@
     <if test="type != null">
       and a.type= #{type}
     </if>
-    <if test="checkNo != null">
-      and a.check_no like concat('%',#{checkNo},'%')
+    <if test="checkNo != null or username != null" >
+      and (a.check_no like concat('%',#{checkNo},'%') or tm.buyer_name  like concat('%',#{username},'%'))
     </if>
     <if test="startTime !=null and endTime !=null">
       and a.create_time between #{startTime} and #{endTime}
@@ -485,9 +485,7 @@
     <if test="contractNo != null">
       and e.contract_no = #{contractNo}
     </if>
-    <if test="username != null">
-      and tm.buyer_name  like concat('%',#{username},'%')
-    </if>
+
     <if test="applyDep != null">
       and a.apply_dep  = #{applyDep}
     </if>
@@ -518,11 +516,11 @@
     </if>
     where 1=1
     <if test="processStatus ==2">
-      and a.process_status>0
-      <if test="examineStatus ==0">
+      and a.process_status>=0
+      <if test="examineStatus ==1">
         and a.status=1
       </if>
-      <if test="examineStatus ==1">
+      <if test="examineStatus ==2">
         and a.status=2
       </if>
     </if>
@@ -544,8 +542,8 @@
     <if test="type != null">
       and a.type= #{type}
     </if>
-    <if test="checkNo != null">
-      and a.check_no like concat('%',#{checkNo},'%')
+    <if test="checkNo != null or username != null" >
+      and (a.check_no like concat('%',#{checkNo},'%') or tm.buyer_name  like concat('%',#{username},'%'))
     </if>
     <if test="startTime !=null and endTime !=null">
       and a.create_time between #{startTime} and #{endTime}
@@ -556,9 +554,6 @@
     <if test="contractNo != null">
       and e.contract_no = #{contractNo}
     </if>
-    <if test="username != null">
-      and tm.buyer_name  like concat('%',#{username},'%')
-    </if>
     <if test="applyDep != null">
       and a.apply_dep  = #{applyDep}
     </if>
@@ -584,11 +579,11 @@
     </if>
     where 1=1
     <if test="processStatus ==2">
-      and a.process_status>0
-      <if test="examineStatus ==0">
+      and a.process_status>=0
+      <if test="examineStatus ==1">
         and a.status=1
       </if>
-      <if test="examineStatus ==1">
+      <if test="examineStatus ==2">
         and a.status=2
       </if>
     </if>
@@ -610,9 +605,6 @@
     <if test="type != null">
       and a.type= #{type}
     </if>
-    <if test="checkNo != null">
-      and a.check_no like concat('%',#{checkNo},'%')
-    </if>
     <if test="startTime !=null and endTime !=null">
       and a.create_time between #{startTime} and #{endTime}
     </if>
@@ -622,9 +614,6 @@
     <if test="contractNo != null">
       and e.contract_no = #{contractNo}
     </if>
-    <if test="username != null">
-      and tm.buyer_name  like concat('%',#{username},'%')
-    </if>
     <if test="applyDep != null">
       and a.apply_dep  = #{applyDep}
     </if>

+ 3 - 0
src/main/java/com/goafanti/expenseAccount/bo/InputPageListBo.java

@@ -12,6 +12,9 @@ public class InputPageListBo {
 
     //同编号搜索、按客户名称搜索 、按部门/公司搜索 、按报销类型搜索、按报销公司部门/公司、按支付部门/公司搜索、按审核状态(财务审核中-不同人员针对的审核状态不一样、已完成)、报销时间(按报销的时间段进行搜索)
     private String contractNo;
+    /**
+     * @param username 报销编号和企业名称用这个字段
+     */
     private String username;
     private String depId;
     private String aid;

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

@@ -85,6 +85,12 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         }else {
             in.setTargetType(1);
         }
+        if (in.getAid()==null)in.setAid(TokenManager.getAdminId());
+        Admin admin = adminMapper.selectByPrimaryKey(in.getAid());
+        in.setAname(admin.getName());
+        in.setApplyDep(admin.getDepartmentId());
+        in.setPayDep(admin.getDepartmentId());
+
         expenseAccountMapper.insertSelective(in);
 
         return in.getId();
@@ -695,7 +701,9 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         List<ExpenseAccount> expenseAccounts = expenseAccountMapper.selectByIds(list);
         expenseAccounts.stream().forEach(e -> {
             if (e.getStatus()!=0){
-                throw new BusinessException(String.format("[%s]编号已经发起,不能重复发起",e.getId()));
+                throw new BusinessException(String.format("[%s]编号已经发起,不能重复发起。",e.getId()));
+            }else if (e.getTotalAmount().compareTo(new  BigDecimal(0))==0){
+                throw new BusinessException(String.format("[%s]编号金额为0,请完善修改后发起。",e.getId()));
             }
         });
         //设置付款部门和支付部门
@@ -895,11 +903,11 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         }
         if (in.getContractNo()!=null)param.put("contractNo",in.getContractNo());
         if (in.getDepId()!=null)param.put("depId",in.getDepId());
-        if (in.getUsername()!=null)param.put("username",in.getUsername());
         if (in.getApplyDep()!=null)param.put("applyDep",in.getApplyDep());
         if (in.getPayDep()!=null)param.put("payDep",in.getPayDep());
         if (in.getType()!=null)param.put("type",in.getType());
-        if (in.getCheckNo()!=null)param.put("checkNo",in.getCheckNo());
+        if (in.getUsername()!=null)param.put("username",in.getUsername());
+        if (in.getCheckNo()!=null)param.put("checkNo",in.getUsername());
         if (in.getSecondaryType()!=null)param.put("secondaryType",in.getSecondaryType());
         //固定传0查看子列表
         if (in.getExpenseMain()==null)in.setExpenseMain(0);