Browse Source

报销开发

anderx 2 years ago
parent
commit
d93f77bb5a

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

@@ -23,11 +23,12 @@
     <result column="open_bank_address" jdbcType="VARCHAR" property="openBankAddress" />
     <result column="lend_id" jdbcType="INTEGER" property="lendId" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
   </resultMap>
   <sql id="Base_Column_List">
     id, eaid, `type`, start_time, end_time, start_district, end_district, amount, vehicle,
     vehicle_other, remarks, agree_time, pay_type, invoice_type, invoice_no, payer_name,
-    open_bank, bank_accounts, open_bank_address, lend_id, create_time
+    open_bank, bank_accounts, open_bank_address, lend_id, create_time, real_amount
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -46,14 +47,16 @@
       remarks, agree_time, pay_type,
       invoice_type, invoice_no, payer_name,
       open_bank, bank_accounts, open_bank_address,
-      lend_id, create_time)
+      lend_id, create_time, real_amount
+      )
     values (#{eaid,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
       #{endTime,jdbcType=TIMESTAMP}, #{startDistrict,jdbcType=VARCHAR}, #{endDistrict,jdbcType=VARCHAR},
       #{amount,jdbcType=DECIMAL}, #{vehicle,jdbcType=INTEGER}, #{vehicleOther,jdbcType=VARCHAR},
       #{remarks,jdbcType=VARCHAR}, #{agreeTime,jdbcType=TIMESTAMP}, #{payType,jdbcType=INTEGER},
       #{invoiceType,jdbcType=INTEGER}, #{invoiceNo,jdbcType=VARCHAR}, #{payerName,jdbcType=VARCHAR},
       #{openBank,jdbcType=VARCHAR}, #{bankAccounts,jdbcType=VARCHAR}, #{openBankAddress,jdbcType=VARCHAR},
-      #{lendId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
+      #{lendId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{realAmount,jdbcType=DECIMAL}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccountDetails" useGeneratedKeys="true">
     insert into expense_account_details
@@ -118,6 +121,9 @@
       <if test="createTime != null">
         create_time,
       </if>
+      <if test="realAmount != null">
+        real_amount,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="eaid != null">
@@ -180,6 +186,9 @@
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="realAmount != null">
+        #{realAmount,jdbcType=DECIMAL},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccountDetails">
@@ -245,6 +254,9 @@
       <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="realAmount != null">
+        real_amount = #{realAmount,jdbcType=DECIMAL},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -269,7 +281,8 @@
       bank_accounts = #{bankAccounts,jdbcType=VARCHAR},
       open_bank_address = #{openBankAddress,jdbcType=VARCHAR},
       lend_id = #{lendId,jdbcType=INTEGER},
-      create_time = #{createTime,jdbcType=TIMESTAMP}
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      real_amount = #{realAmount,jdbcType=DECIMAL}
     where id = #{id,jdbcType=INTEGER}
   </update>
 

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

@@ -386,17 +386,19 @@
 
 
   <select id="selectExpenseAccountList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountBo">
-    select a.id,a.total_amount totalAmount,a.`type`,a.process_status processStatus,a.status,a.examine_name examineName,a.type_other typeOther,
-    a.attachment_url attachmentUrl,a.target_type targetType , e.contract_no contractNo,tm.buyer_name buyerName ,a.check_no checkNo,
+    select a.id,a.total_amount totalAmount,a.`type`,a.process_status processStatus,a.type_other typeOther,
+    a.attachment_url attachmentUrl,a.target_type targetType , e.contract_no contractNo,tm.buyer_name buyerName ,
     <if test="processStatus ==1">
       eae.type eaeType,
     </if>
+      mea.status  ,mea.examine_name examineName,mea.check_no checkNo,
     f.name depName,d2.name financeName, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,a.aname,
     b.name appDepName, c.name payDepName
     from expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
     left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
     left join t_order_mid tm on a.order_no =tm.order_no left join department f on d.department_id =f.id
-    left join admin d2 on f.finance_id =d2.id
+    left join admin d2 on f.finance_id =d2.id left join expense_relationship er on a.id=er.ea_id
+      left join expense_account mea on  er.id=mea.id
     <if test="processStatus ==1">
     inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
       where auditor= #{auditor} group by eaid) eae on a.id=eae.eaid
@@ -450,6 +452,9 @@
     <if test="payDep != null">
       and a.pay_dep = #{payDep}
     </if>
+    <if test="expenseMain != null">
+       #{expenseMain}
+    </if>
     order by a.status,a.create_time desc
     <if test="page_sql !=null">
       ${page_sql}
@@ -514,6 +519,9 @@
     <if test="payDep != null">
       and a.pay_dep = #{payDep}
     </if>
+    <if test="expenseMain != null">
+      and a.expense_main = #{expenseMain}
+    </if>
   </select>
 
   <select id="selectExpenseAccountTotalAmount" resultType="java.lang.Integer">
@@ -574,6 +582,9 @@
     <if test="payDep != null">
       and a.pay_dep = #{payDep}
     </if>
+    <if test="expenseMain != null">
+      and a.expense_main = #{expenseMain}
+    </if>
   </select>
 
 
@@ -664,7 +675,7 @@
     select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,
            dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,eap.name ,eap.bank ,eap.accounts ,b.status,b.process_status,
            c.id sonId,c.total_amount sonAmount,c.`type` ,c.type_other ,c.user_names ,c.release_start ,c.release_end ,
-           d.id detId,d.`type` detType,d.amount ,d.start_district ,d.end_district
+           d.id detId,d.`type` detType,d.amount,d.real_amount realAmount ,d.start_district ,d.end_district
     from expense_relationship a
            left join expense_account b on a.id =b.id
            left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id

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

@@ -111,6 +111,11 @@ public class ExpenseAccountDetails implements Serializable {
      */
     private Date createTime;
 
+    /**
+     * 真实金额
+     */
+    private BigDecimal realAmount;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -280,4 +285,12 @@ public class ExpenseAccountDetails implements Serializable {
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    public BigDecimal getRealAmount() {
+        return realAmount;
+    }
+
+    public void setRealAmount(BigDecimal realAmount) {
+        this.realAmount = realAmount;
+    }
 }

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

@@ -19,17 +19,17 @@ public class InputPageListBo {
     private String applyDep;
     private String payDep;
     private String checkNo;
-    private String expenseType;
+    private String expenseMain;
 
     private Integer pageNo;
     private Integer pageSize;
 
-    public String getExpenseType() {
-        return expenseType;
+    public String getExpenseMain() {
+        return expenseMain;
     }
 
-    public void setExpenseType(String expenseType) {
-        this.expenseType = expenseType;
+    public void setExpenseMain(String expenseMain) {
+        this.expenseMain = expenseMain;
     }
 
     public String getCheckNo() {

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

@@ -7,9 +7,19 @@ public class SonExpenseAccountDetails {
     private Integer id;
     private Integer type;
     private BigDecimal amount;
+    private BigDecimal realAmount;
     private String  startDistrict;
     private String  endDistrict;
 
+
+    public BigDecimal getRealAmount() {
+        return realAmount;
+    }
+
+    public void setRealAmount(BigDecimal realAmount) {
+        this.realAmount = realAmount;
+    }
+
     public Integer getId() {
         return id;
     }

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

@@ -81,7 +81,7 @@ public class ExpenseAccountController extends CertifyApiController {
     }
 
     /**
-     * 报销列表
+     * 报销列表,子报销列表
      * @param in
      * @return
      */

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

@@ -93,9 +93,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
 
     /**
      * 新增报销审核流程
-     * @param id 报销编号
      */
-    private void addExpenseAccountExamine(Integer id) {
+    private void addExpenseAccountExamine(Integer id,ExpenseAccount ea) {
         List<ExpenseAccountExamine> list=new ArrayList<>();
         String aid = TokenManager.getAdminId();
         Admin admin = adminMapper.selectByPrimaryKey(aid);
@@ -104,14 +103,20 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 //新增一级
                 ExpenseAccountExamine eae=new ExpenseAccountExamine(id,i);
                 AdminNoticeBo a = adminMapper.selectMyAndSuperBySuperId(aid);
+                String examineId=null;
+                String examineName=null;
                 if (a.getSuperId()!=null){
-                    eae.setAuditor(a.getSuperId());
-                    eae.setAuditorname(a.getSuperName());
+                    examineId=a.getSuperId();
+                    examineName=a.getSuperName();
                 }else {
-                    eae.setAuditor(a.getId());
-                    eae.setAuditorname(a.getName());
+                    examineId=a.getId();
+                    examineName=a.getName();
                 }
+                eae.setAuditor(examineId);
+                eae.setAuditorname(examineName);
+                ea.setExamineName(examineName);
                 if (eae.getAuditor().equals(aid))eae.setStatus(1);
+
                 else  eae.setStatus(0);
                 list.add(eae);
             }else if (i==2){
@@ -720,7 +725,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             if (in.getRemarks()!=null)update.setRemarks(in.getRemarks());
             if (in.getEaaid()!=null)update.setEaaid(in.getEaaid());
             update.setProcessStatus(1);
-            addExpenseAccountExamine(in.getId());
+            addExpenseAccountExamine(in.getId(),update);
         }else if (in.getStatus()==4){
             expenseAccountMapper.updateByMainId(in.getId(),0);
         }
@@ -866,7 +871,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         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.getExpenseType()!=null)param.put("expenseType",in.getExpenseType());
+        //固定传0查看子列表
+        if (in.getExpenseMain()!=null)param.put("expenseMain",0);
     }
 
     /**