Browse Source

新审核流程开发

anderx 2 years ago
parent
commit
f5c3fb818d

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

@@ -34,13 +34,14 @@
     <result column="secondary_type" jdbcType="INTEGER" property="secondaryType" />
     <result column="secondary_type_other" jdbcType="VARCHAR" property="secondaryTypeOther" />
     <result column="amount" jdbcType="DECIMAL" property="amount" />
+    <result column="approval" jdbcType="INTEGER" property="approval" />
   </resultMap>
   <sql id="Base_Column_List">
     id, prid, order_no, aid, aname, `type`, type_other, `status`, process_status, total_amount,
     attachment_url, apply_dep, pay_dep, eaaid, create_time, district_name, user_names,
     release_start, release_end, duration, examine_name, settlement_amount, debit_id,
     target_type, liquidation_status, remarks, check_no, expense_main, real_amount, secondary_type,
-    secondary_type_other, amount
+    secondary_type_other, amount, approval
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -63,7 +64,7 @@
       debit_id, target_type, liquidation_status,
       remarks, check_no, expense_main,
       real_amount, secondary_type, secondary_type_other,
-      amount)
+      amount, approval)
     values (#{prid,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
       #{aname,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{typeOther,jdbcType=VARCHAR},
       #{status,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL},
@@ -74,7 +75,7 @@
       #{debitId,jdbcType=INTEGER}, #{targetType,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER},
       #{remarks,jdbcType=VARCHAR}, #{checkNo,jdbcType=VARCHAR}, #{expenseMain,jdbcType=INTEGER},
       #{realAmount,jdbcType=DECIMAL}, #{secondaryType,jdbcType=INTEGER}, #{secondaryTypeOther,jdbcType=VARCHAR},
-      #{amount,jdbcType=DECIMAL})
+      #{amount,jdbcType=DECIMAL}, #{approval,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
     insert into expense_account
@@ -172,6 +173,9 @@
       <if test="amount != null">
         amount,
       </if>
+      <if test="approval != null">
+        approval,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="prid != null">
@@ -267,6 +271,9 @@
       <if test="amount != null">
         #{amount,jdbcType=DECIMAL},
       </if>
+      <if test="approval != null">
+        #{approval,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
@@ -365,6 +372,9 @@
       <if test="amount != null">
         amount = #{amount,jdbcType=DECIMAL},
       </if>
+      <if test="approval != null">
+        approval = #{approval,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -400,7 +410,8 @@
       real_amount = #{realAmount,jdbcType=DECIMAL},
       secondary_type = #{secondaryType,jdbcType=INTEGER},
       secondary_type_other = #{secondaryTypeOther,jdbcType=VARCHAR},
-      amount = #{amount,jdbcType=DECIMAL}
+      amount = #{amount,jdbcType=DECIMAL},
+      approval = #{approval,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
 

+ 13 - 0
src/main/java/com/goafanti/common/model/ExpenseAccount.java

@@ -166,6 +166,11 @@ public class ExpenseAccount implements Serializable {
      */
     private BigDecimal amount;
 
+    /**
+     * 特批状态 0-非特批 ,1-特批
+     */
+    private Integer approval;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -423,4 +428,12 @@ public class ExpenseAccount implements Serializable {
     public void setAmount(BigDecimal amount) {
         this.amount = amount;
     }
+
+    public Integer getApproval() {
+        return approval;
+    }
+
+    public void setApproval(Integer approval) {
+        this.approval = approval;
+    }
 }

+ 46 - 4
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -135,11 +135,32 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             }else if (i==4){
                 eae.setAuditor(dep.getExpenseRetrialFinanceId());
                 eae.setAuditorname(dep.getExpenseRetrialFinanceName());
+            }else if (i==6){
+                List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.FINANCE_ADMIN);
+                for (Admin admin : admins) {
+                    eae.setAuditor(admin.getId());
+                    eae.setAuditorname(admin.getName());
+                }
+            }else if (i==7){
+                List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.VICE_CEO);
+                for (Admin admin : admins) {
+                    eae.setAuditor(admin.getId());
+                    eae.setAuditorname(admin.getName());
+                }
+            }else if (i==8){
+                List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.FINANCE_ADMIN);
+                for (Admin admin : admins) {
+                    eae.setAuditor(admin.getId());
+                    eae.setAuditorname(admin.getName());
+                }
             }
-            if (eae.getAuditor().equals(aid))eae.setStatus(1);
-            else  eae.setStatus(0);
-            list.add(eae);
 
+
+            if (i!=5){
+                if (eae.getAuditor().equals(aid))eae.setStatus(1);
+                else  eae.setStatus(0);
+                list.add(eae);
+            }
         }
         expenseAccountExamineMapper.insertBatch(list);
     }
@@ -359,6 +380,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         ExpenseAccount useEa = expenseAccountMapper.selectByPrimaryKey(in.getId());
         ExpenseAccount newEa=new ExpenseAccount();
         newEa.setId(useEa.getId());
+        newEa.setApproval(in.getApproval());
         in.setCheckNo(useEa.getCheckNo());
         in.setProcessStatus(useEa.getProcessStatus());
         //审核通知 获取发送人
@@ -471,13 +493,14 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         List<Admin> aids=new ArrayList<>();
         StringBuffer str=new StringBuffer();
         Integer status=in.getStatus();
-
         if (status==1){
             str=str.append("编号[").append(in.getCheckNo()).append("]需要审核").append(",请查看并审核。");
             //新的流程是当前流程+1
             newEa.setProcessStatus(useEa.getProcessStatus()+1);
             newEa.setAid(useEa.getAid());
             newEa.setCreateTime(useEa.getCreateTime());
+            //添加后续流程
+            addExpenseAccountExamineFollow(in);
             List<ExpenseAccountExamine> list=examineByprocess(newEa,admin);
             if(newEa.getProcessStatus()==4){
                 //完成后的流程
@@ -522,6 +545,25 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         addNoticeAndEmail(in,  status,str.toString(),admin.getName(),aids);
     }
 
+    private void addExpenseAccountExamineFollow(InputExpenseAccount in) {
+        Date date = new Date();
+        if (in.getApproval()==1){
+            List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.APPROVAL_DECISION);
+            List<ExpenseAccountExamine> list=new ArrayList<>();
+            for (Admin admin:admins){
+            ExpenseAccountExamine eae=new ExpenseAccountExamine(in.getId(),5);
+                eae.setEaid(in.getId());
+                eae.setCreateTime(date);
+                eae.setStatus(0);
+                eae.setAuditor(admin.getId());
+                eae.setAuditorname(admin.getName());
+                list.add(eae);
+            }
+            expenseAccountExamineMapper.insertBatch(list);
+        }
+
+    }
+
     /**
      *
      * @param aid

+ 5 - 5
src/main/resources/props/config_local.properties

@@ -1,12 +1,12 @@
 dev.name=local
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #jdbc.url=jdbc\:mysql://localhost:3306/aft20221026?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.username=root
-#jdbc.password=123456
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
-jdbc.password=aftdev
+jdbc.password=123456
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20