Browse Source

报销开发

anderx 2 years ago
parent
commit
47d8e3ab5e

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

@@ -29,12 +29,13 @@
     <result column="liquidation_status" jdbcType="INTEGER" property="liquidationStatus" />
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="check_no" jdbcType="VARCHAR" property="checkNo" />
+    <result column="expense_main" jdbcType="INTEGER" property="expenseMain" />
   </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
+    target_type, liquidation_status, remarks, check_no, expense_main
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -55,7 +56,8 @@
       user_names, release_start, release_end,
       duration, examine_name, settlement_amount,
       debit_id, target_type, liquidation_status,
-      remarks, check_no)
+      remarks, check_no, expense_main
+      )
     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},
@@ -64,7 +66,8 @@
       #{userNames,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP},
       #{duration,jdbcType=DOUBLE}, #{examineName,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
       #{debitId,jdbcType=INTEGER}, #{targetType,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER},
-      #{remarks,jdbcType=VARCHAR}, #{checkNo,jdbcType=VARCHAR})
+      #{remarks,jdbcType=VARCHAR}, #{checkNo,jdbcType=VARCHAR}, #{expenseMain,jdbcType=INTEGER}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
     insert into expense_account
@@ -147,6 +150,9 @@
       <if test="checkNo != null">
         check_no,
       </if>
+      <if test="expenseMain != null">
+        expense_main,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="prid != null">
@@ -227,6 +233,9 @@
       <if test="checkNo != null">
         #{checkNo,jdbcType=VARCHAR},
       </if>
+      <if test="expenseMain != null">
+        #{expenseMain,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
@@ -310,6 +319,9 @@
       <if test="checkNo != null">
         check_no = #{checkNo,jdbcType=VARCHAR},
       </if>
+      <if test="expenseMain != null">
+        expense_main = #{expenseMain,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -340,7 +352,8 @@
       target_type = #{targetType,jdbcType=INTEGER},
       liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
       remarks = #{remarks,jdbcType=VARCHAR},
-      check_no = #{checkNo,jdbcType=VARCHAR}
+      check_no = #{checkNo,jdbcType=VARCHAR},
+      expense_main = #{expenseMain,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
 

+ 14 - 1
src/main/java/com/goafanti/common/model/ExpenseAccount.java

@@ -42,7 +42,7 @@ public class ExpenseAccount implements Serializable {
     private String typeOther;
 
     /**
-     * 状态 0=草稿,1=审核中,2=完成,3=驳回
+     * 状态 0=草稿,1=审核中,2=完成,3=驳回 ,4=撤销
      */
     private Integer status;
 
@@ -141,6 +141,11 @@ public class ExpenseAccount implements Serializable {
      */
     private String checkNo;
 
+    /**
+     * 0=子表,1=主表
+     */
+    private Integer expenseMain;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -358,4 +363,12 @@ public class ExpenseAccount implements Serializable {
     public void setCheckNo(String checkNo) {
         this.checkNo = checkNo;
     }
+
+    public Integer getExpenseMain() {
+        return expenseMain;
+    }
+
+    public void setExpenseMain(Integer expenseMain) {
+        this.expenseMain = expenseMain;
+    }
 }

+ 6 - 6
src/main/java/com/goafanti/expenseAccount/bo/MainExpenseAccount.java

@@ -21,8 +21,8 @@ public class MainExpenseAccount  {
     private String name;
     private String bank;
     private String accounts;
-    private String status;
-    private String processStatus;
+    private Integer status;
+    private Integer processStatus;
 
     public List<OutExpenseAccount> getSonList() {
         return sonList;
@@ -104,19 +104,19 @@ public class MainExpenseAccount  {
         this.eaaid = eaaid;
     }
 
-    public String getStatus() {
+    public Integer getStatus() {
         return status;
     }
 
-    public void setStatus(String status) {
+    public void setStatus(Integer status) {
         this.status = status;
     }
 
-    public String getProcessStatus() {
+    public Integer getProcessStatus() {
         return processStatus;
     }
 
-    public void setProcessStatus(String processStatus) {
+    public void setProcessStatus(Integer processStatus) {
         this.processStatus = processStatus;
     }
 

+ 14 - 8
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -714,6 +714,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             count.set(count.get().add(e.getTotalAmount()));
         });
         in.setTotalAmount(count.get());
+        in.setExpenseMain(1);
         expenseAccountMapper.insertSelective(in);
         expenseAccounts.stream().forEach(e -> {
             ExpenseRelationship er=new ExpenseRelationship();
@@ -738,15 +739,20 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             throw new BusinessException("主项目已发起,不可修改!");
         }
         ExpenseAccount update =new ExpenseAccount();
+        if (in.getStatus()==1){
+            if (in.getOrderNo()!=null)update.setOrderNo(in.getOrderNo());
+            if (in.getPayDep()!=null)update.setPayDep(in.getPayDep());
+            if (in.getApplyDep()!=null)update.setApplyDep(in.getApplyDep());
+            if (in.getRemarks()!=null)update.setRemarks(in.getRemarks());
+            if (in.getEaaid()!=null)update.setEaaid(in.getEaaid());
+            update.setProcessStatus(1);
+            addExpenseAccountExamine(in.getId());
+        }else if (in.getStatus()==4){
+            expenseAccountMapper.updateByMainId(in.getId(),0);
+        }
+        update.setStatus(in.getStatus());
         update.setId(in.getId());
-        if (in.getOrderNo()!=null)update.setOrderNo(in.getOrderNo());
-        if (in.getPayDep()!=null)update.setPayDep(in.getPayDep());
-        if (in.getApplyDep()!=null)update.setApplyDep(in.getApplyDep());
-        if (in.getRemarks()!=null)update.setRemarks(in.getRemarks());
-        if (in.getEaaid()!=null)update.setEaaid(in.getEaaid());
-        update.setStatus(1);
-        update.setProcessStatus(1);
-        addExpenseAccountExamine(in.getId());
+
         return expenseAccountMapper.updateByPrimaryKeySelective(update);
     }