Browse Source

报销开发

anderx 2 years ago
parent
commit
8bfc86e8f0

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

@@ -30,12 +30,13 @@
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="check_no" jdbcType="VARCHAR" property="checkNo" />
     <result column="expense_main" jdbcType="INTEGER" property="expenseMain" />
+    <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
   </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
+    target_type, liquidation_status, remarks, check_no, expense_main, real_amount
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -56,8 +57,8 @@
       user_names, release_start, release_end,
       duration, examine_name, settlement_amount,
       debit_id, target_type, liquidation_status,
-      remarks, check_no, expense_main
-      )
+      remarks, check_no, expense_main,
+      real_amount)
     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},
@@ -66,8 +67,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}, #{expenseMain,jdbcType=INTEGER}
-      )
+      #{remarks,jdbcType=VARCHAR}, #{checkNo,jdbcType=VARCHAR}, #{expenseMain,jdbcType=INTEGER},
+      #{realAmount,jdbcType=DECIMAL})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
     insert into expense_account
@@ -153,6 +154,9 @@
       <if test="expenseMain != null">
         expense_main,
       </if>
+      <if test="realAmount != null">
+        real_amount,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="prid != null">
@@ -236,6 +240,9 @@
       <if test="expenseMain != null">
         #{expenseMain,jdbcType=INTEGER},
       </if>
+      <if test="realAmount != null">
+        #{realAmount,jdbcType=DECIMAL},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
@@ -322,6 +329,9 @@
       <if test="expenseMain != null">
         expense_main = #{expenseMain,jdbcType=INTEGER},
       </if>
+      <if test="realAmount != null">
+        real_amount = #{realAmount,jdbcType=DECIMAL},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -353,7 +363,8 @@
       liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
       remarks = #{remarks,jdbcType=VARCHAR},
       check_no = #{checkNo,jdbcType=VARCHAR},
-      expense_main = #{expenseMain,jdbcType=INTEGER}
+      expense_main = #{expenseMain,jdbcType=INTEGER},
+      real_amount = #{realAmount,jdbcType=DECIMAL}
     where id = #{id,jdbcType=INTEGER}
   </update>
 

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

@@ -146,6 +146,11 @@ public class ExpenseAccount implements Serializable {
      */
     private Integer expenseMain;
 
+    /**
+     * 真实金额
+     */
+    private BigDecimal realAmount;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -371,4 +376,12 @@ public class ExpenseAccount implements Serializable {
     public void setExpenseMain(Integer expenseMain) {
         this.expenseMain = expenseMain;
     }
+
+    public BigDecimal getRealAmount() {
+        return realAmount;
+    }
+
+    public void setRealAmount(BigDecimal realAmount) {
+        this.realAmount = realAmount;
+    }
 }

+ 10 - 0
src/main/java/com/goafanti/expenseAccount/bo/InputExpenseAccount.java

@@ -18,6 +18,16 @@ public class InputExpenseAccount extends ExpenseAccount {
 
     private Integer updateType;
 
+    private String  realList;
+
+    public String getRealList() {
+        return realList;
+    }
+
+    public void setRealList(String realList) {
+        this.realList = realList;
+    }
+
     public Integer getUpdateType() {
         return updateType;
     }

+ 4 - 0
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountController.java

@@ -1,5 +1,6 @@
 package com.goafanti.expenseAccount.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
@@ -16,7 +17,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/api/admin/expenseAccount")
@@ -199,6 +202,7 @@ public class ExpenseAccountController extends CertifyApiController {
             res.getError().add(buildError(ParamUtils.getParamMsg(in,param),ParamUtils.getParamName(in,param)));
             return res;
         }
+
         res.setData(expenseAccountService.updateExamine(in));
         return res;
     }

+ 23 - 2
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.expenseAccount.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.bo.AdminNoticeBo;
@@ -408,10 +409,30 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             }
 
 
-        }
-        if (newEa.getStatus()==1){
+        }else if (newEa.getStatus()==1){
             if (newEa.getProcessStatus()==EAProcessStatus.CWSH.getCode()){
                 pushFinanceCount(admin.getDepFinance(),useEa.getCreateTime(),0);
+                //处理金额修改
+                if(in.getRealList()!=null){
+                    List<Map> maps = JSONObject.parseArray(in.getRealList(), Map.class);
+                    for (Map map: maps) {
+                        Integer type= (Integer) map.get("type");
+                        Integer id= (Integer) map.get("id");
+                        BigDecimal amount= new BigDecimal(map.get("amount").toString());
+                        //type=1总计,type=2报销金额
+                        if(type==1){
+                            ExpenseAccount ea =new ExpenseAccount();
+                            ea.setId(id);
+                            ea.setRealAmount(amount);
+                            expenseAccountMapper.updateByPrimaryKeySelective(ea);
+                        }else if (type==2){
+                            ExpenseAccountDetails ead=new ExpenseAccountDetails();
+                            ead.setId(id);
+                            ead.setRealAmount(amount);
+                            expenseAccountDetailsMapper.updateByPrimaryKeySelective(ead);
+                        }
+                    }
+                }
             }else if (newEa.getProcessStatus()==EAProcessStatus.ZJLSH.getCode()){
                 pushFinanceCount(admin.getDepFinance(),useEa.getCreateTime(),1);
             }