Browse Source

费用统计BUG修改

anderx 2 years ago
parent
commit
3a374b3e5c

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

@@ -678,7 +678,7 @@
     select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,b.real_amount,b.type_other ,b.aid,
            date_format(b.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.examine_name, 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` sonType,c.type_other sonTypeOther,c.user_names ,c.release_start ,c.release_end ,
+           c.id sonId,c.total_amount sonAmount,c.settlement_amount sonSettlementAmount,c.`type` sonType,c.type_other sonTypeOther,c.user_names ,c.release_start ,c.release_end ,
            c.district_name districtName,c.user_names userNames,c.secondary_type ,c.secondary_type_other,c.attachment_url,
            c.duration,pr.plan,pro.contract_no sonContractNo,c.real_amount sonRealAmount,
            d.id detId,d.`type` detType,d.amount,d.real_amount detRealAmount ,d.start_district ,d.end_district,d.vehicle,d.vehicle_other,
@@ -727,6 +727,7 @@
   <resultMap id="SonExpenseAccountMap" type="com.goafanti.expenseAccount.bo.SonExpenseAccount">
     <id column="sonId" jdbcType="INTEGER" property="id" />
     <result column="sonAmount" jdbcType="DECIMAL" property="totalAmount" />
+    <result column="sonSettlementAmount" jdbcType="DECIMAL" property="settlementAmount" />
     <result column="sonRealAmount" jdbcType="DECIMAL" property="realAmount" />
     <result column="sonType" jdbcType="INTEGER" property="type" />
     <result column="sonTypeOther" jdbcType="VARCHAR" property="typeOther" />
@@ -803,8 +804,8 @@
     select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no ,b.aname,b.apply_dep,b.pay_dep,
     date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.status,b.process_status,b.examine_name,
     dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,
-    c.id sonId,c.total_amount sonAmount,c.`type` sonType,c.type_other sonTypeOTher,c.user_names ,c.release_start ,c.release_end,
-    c.attachment_url attachmentUrl,c.secondary_type,c.secondary_type_other
+    c.id sonId,c.total_amount sonAmount,c.settlement_amount sonSettlementAmount,c.`type` sonType,c.type_other sonTypeOTher,
+    c.user_names ,c.release_start ,c.release_end, c.attachment_url attachmentUrl,c.secondary_type,c.secondary_type_other
     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

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

@@ -34,6 +34,8 @@ public class MainExpenseAccount  {
      */
     private Integer examine;
 
+    private List<SonExpenseAccount> sonList;
+
     public String getTypeOther() {
         return typeOther;
     }
@@ -66,7 +68,7 @@ public class MainExpenseAccount  {
         this.realAmount = realAmount;
     }
 
-    private List<OutExpenseAccount> sonList;
+
 
     public String getAid() {
         return aid;
@@ -84,11 +86,11 @@ public class MainExpenseAccount  {
         this.createTimeStr = createTimeStr;
     }
 
-    public List<OutExpenseAccount> getSonList() {
+    public List<SonExpenseAccount> getSonList() {
         return sonList;
     }
 
-    public void setSonList(List<OutExpenseAccount> sonList) {
+    public void setSonList(List<SonExpenseAccount> sonList) {
         this.sonList = sonList;
     }
 

+ 18 - 0
src/main/java/com/goafanti/expenseAccount/bo/SonExpenseAccount.java

@@ -6,6 +6,8 @@ import java.util.List;
 public class SonExpenseAccount {
     private Integer id;
     private BigDecimal totalAmount;
+    private BigDecimal settlementAmount;
+    private BigDecimal sumAmount;
     private BigDecimal realAmount;
     private Integer type;
     private String typeOther;
@@ -21,6 +23,22 @@ public class SonExpenseAccount {
     private String contractNo;
     private List<SonExpenseAccountDetails> detList;
 
+    public BigDecimal getSumAmount() {
+        return sumAmount;
+    }
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = sumAmount;
+    }
+
+    public BigDecimal getSettlementAmount() {
+        return settlementAmount;
+    }
+
+    public void setSettlementAmount(BigDecimal settlementAmount) {
+        this.settlementAmount = settlementAmount;
+    }
+
     public BigDecimal getRealAmount() {
         return realAmount;
     }

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

@@ -709,7 +709,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         BigDecimal count = new BigDecimal(0);
         List<String> typeList = new ArrayList<String>();
         for (ExpenseAccount e : list) {
-            count=count.add(e.getTotalAmount());
+            count=count.add(e.getTotalAmount().divide(e.getSettlementAmount()));
             StringBuffer types=new StringBuffer();
             if (e.getType()!=0){
                 types=types.append(EATypes.getDescByCode(e.getType()));
@@ -745,6 +745,9 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     public MainExpenseAccount mainExpense(Integer id) {
         MainExpenseAccount res = expenseAccountMapper.selectByMainId(id);
         res.setExamine(0);
+        for (SonExpenseAccount son : res.getSonList()) {
+            son.setSumAmount(son.getTotalAmount().subtract(son.getSettlementAmount()));
+        }
         List<ExpenseAccountExamine> expenseAccountExamines = expenseAccountExamineMapper.selectByEaidAndProcessStatus(id, res.getProcessStatus());
         for (ExpenseAccountExamine e : expenseAccountExamines) {
             if (e.getAuditor().equals(TokenManager.getAdminId())){
@@ -825,7 +828,16 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 params.put("deps",departmentService.selectMyDeps());
             }
         }
-        return findPage("ExpenseMainList","ExpenseMainCount",params,in.getPageNo(),in.getPageSize());
+        Pagination<?> page = findPage("ExpenseMainList", "ExpenseMainCount", params, in.getPageNo(), in.getPageSize());
+        List<MainExpenseAccount> list = (List<MainExpenseAccount>) page.getList();
+        for (MainExpenseAccount e : list) {
+            if (e.getSonList()!=null){
+                for (SonExpenseAccount son : e.getSonList()) {
+                    son.setSumAmount(son.getTotalAmount().subtract(son.getSettlementAmount()));
+                }
+            }
+        }
+        return page;
     }
 
     @Override