Browse Source

审核报销完成时处理抵扣问题

anderx 2 years ago
parent
commit
02ded990f2

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

@@ -25,11 +25,13 @@
     <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
     <result column="settlement_amount" jdbcType="DECIMAL" property="settlementAmount" />
     <result column="debit_id" jdbcType="INTEGER" property="debitId" />
+    <result column="target_type" jdbcType="INTEGER" property="targetType" />
   </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
+    release_start, release_end, duration, examine_name, settlement_amount, debit_id,
+    target_type
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -49,7 +51,7 @@
       eaaid, create_time, district_name,
       user_names, release_start, release_end,
       duration, examine_name, settlement_amount,
-      debit_id)
+      debit_id, target_type)
     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},
@@ -57,7 +59,7 @@
       #{eaaid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{districtName,jdbcType=VARCHAR},
       #{userNames,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP},
       #{duration,jdbcType=DOUBLE}, #{examineName,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
-      #{debitId,jdbcType=INTEGER})
+      #{debitId,jdbcType=INTEGER}, #{targetType,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
     insert into expense_account
@@ -128,6 +130,9 @@
       <if test="debitId != null">
         debit_id,
       </if>
+      <if test="targetType != null">
+        target_type,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="prid != null">
@@ -196,6 +201,9 @@
       <if test="debitId != null">
         #{debitId,jdbcType=INTEGER},
       </if>
+      <if test="targetType != null">
+        #{targetType,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
@@ -267,6 +275,9 @@
       <if test="debitId != null">
         debit_id = #{debitId,jdbcType=INTEGER},
       </if>
+      <if test="targetType != null">
+        target_type = #{targetType,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -293,7 +304,8 @@
       duration = #{duration,jdbcType=DOUBLE},
       examine_name = #{examineName,jdbcType=VARCHAR},
       settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
-      debit_id = #{debitId,jdbcType=INTEGER}
+      debit_id = #{debitId,jdbcType=INTEGER},
+      target_type = #{targetType,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
 

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

@@ -121,6 +121,11 @@ public class ExpenseAccount implements Serializable {
      */
     private Integer debitId;
 
+    /**
+     * 目标分类 0=固定费用,1=报销到订单
+     */
+    private Integer targetType;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -306,4 +311,12 @@ public class ExpenseAccount implements Serializable {
     public void setDebitId(Integer debitId) {
         this.debitId = debitId;
     }
+
+    public Integer getTargetType() {
+        return targetType;
+    }
+
+    public void setTargetType(Integer targetType) {
+        this.targetType = targetType;
+    }
 }

+ 10 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -65,6 +65,11 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         }
         Integer eaaid = expenseAccountPrivateMapper.selectByaidDefault(in.getAid());
         in.setEaaid(eaaid);
+        if (in.getOrderNo()==null){
+            in.setTargetType(0);
+        }else {
+            in.setTargetType(1);
+        }
         expenseAccountMapper.insertSelective(in);
         addExpenseAccountLogAndNoticEmail(in,0,"创建报销");
         return in.getId();
@@ -121,6 +126,11 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         }else if (useEA.getStatus()==3){
             addExpenseAccountLogAndNoticEmail(in,4,"修改并发起审核");
         }
+        if (in.getOrderNo()==null){
+            in.setTargetType(0);
+        }else {
+            in.setTargetType(1);
+        }
         return expenseAccountMapper.updateByPrimaryKeySelective(in);
     }