Sfoglia il codice sorgente

feat: 更新对账金额小数保留方法

hejq 7 anni fa
parent
commit
c548a013d5

+ 7 - 7
src/main/java/com/uas/platform/b2b/model/ErpProdIo.java

@@ -1,6 +1,6 @@
 package com.uas.platform.b2b.model;
 
-import com.uas.platform.b2b.publicapi.model.TradeCount;
+import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -21,12 +21,12 @@ public class ErpProdIo {
     /**
      * 本月应收(前端传入指定月份)
      */
-    private List<TradeCount> thisMonthCount;
+    private List<ApCheckAmount> thisMonthCount;
 
     /**
      * 应收总额
      */
-    private List<TradeCount> totalCount;
+    private List<ApCheckAmount> totalCount;
 
     /**
      * 供应商名称
@@ -41,19 +41,19 @@ public class ErpProdIo {
         this.details = details;
     }
 
-    public List<TradeCount> getThisMonthCount() {
+    public List<ApCheckAmount> getThisMonthCount() {
         return thisMonthCount;
     }
 
-    public void setThisMonthCount(List<TradeCount> thisMonthCount) {
+    public void setThisMonthCount(List<ApCheckAmount> thisMonthCount) {
         this.thisMonthCount = thisMonthCount;
     }
 
-    public List<TradeCount> getTotalCount() {
+    public List<ApCheckAmount> getTotalCount() {
         return totalCount;
     }
 
-    public void setTotalCount(List<TradeCount> totalCount) {
+    public void setTotalCount(List<ApCheckAmount> totalCount) {
         this.totalCount = totalCount;
     }
 

+ 7 - 7
src/main/java/com/uas/platform/b2b/model/Vendor.java

@@ -2,7 +2,7 @@ package com.uas.platform.b2b.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import com.uas.platform.b2b.erp.model.InquiryVendorInfo;
-import com.uas.platform.b2b.publicapi.model.TradeCount;
+import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
 import com.uas.platform.core.persistence.Logger;
 import com.uas.platform.core.persistence.OtherUserUU;
 import com.uas.platform.core.persistence.StatusColumn;
@@ -219,13 +219,13 @@ public class Vendor implements Serializable {
      * 本月应收(前端传入指定月份)
      */
 	@Transient
-    private List<TradeCount> thisMonthCount;
+    private List<ApCheckAmount> thisMonthCount;
 
     /**
      * 应收总额
      */
 	@Transient
-    private List<TradeCount> totalCount;
+    private List<ApCheckAmount> totalCount;
 
 	public Long getId() {
 		return id;
@@ -440,19 +440,19 @@ public class Vendor implements Serializable {
         this.saleContacts = saleContacts;
     }
 
-    public List<TradeCount> getThisMonthCount() {
+    public List<ApCheckAmount> getThisMonthCount() {
         return thisMonthCount;
     }
 
-    public void setThisMonthCount(List<TradeCount> thisMonthCount) {
+    public void setThisMonthCount(List<ApCheckAmount> thisMonthCount) {
         this.thisMonthCount = thisMonthCount;
     }
 
-    public List<TradeCount> getTotalCount() {
+    public List<ApCheckAmount> getTotalCount() {
         return totalCount;
     }
 
-    public void setTotalCount(List<TradeCount> totalCount) {
+    public void setTotalCount(List<ApCheckAmount> totalCount) {
         this.totalCount = totalCount;
     }
 

+ 10 - 10
src/main/java/com/uas/platform/b2b/model/util/UnCheckedCountSqls.java

@@ -12,21 +12,21 @@ public class UnCheckedCountSqls {
     /**
      * 货款调账未对账金额查询语句
      */
-    public static final String ADJUSTMENT_COUNT_SQL = "select coalesce(sum((aa_qty - coalesce(aa_ycheckqty, 0)) * aa_orderprice), 0) as amount, aa_currency as currency \n" +
+    public static final String ADJUSTMENT_COUNT_SQL = "select coalesce(sum((aa_qty - coalesce(aa_ycheckqty, 0)) * aa_orderprice), 0) as count, aa_currency as currency \n" +
         "from purc$apbilladjustment where coalesce(aa_thischeckqty, 0) <> 0 and aa_enuu = ? and aa_custuu = ? " +
         "group by aa_currency";
 
     /**
      * 当月货款调账未对账金额查询语句
      */
-    public static final String THISMONTH_ADJUSTMENT_COUNT_SQL = "select coalesce(sum((aa_qty - coalesce(aa_ycheckqty, 0)) * aa_orderprice), 0) as amount, aa_currency as currency \n" +
+    public static final String THISMONTH_ADJUSTMENT_COUNT_SQL = "select coalesce(sum((aa_qty - coalesce(aa_ycheckqty, 0)) * aa_orderprice), 0) as count, aa_currency as currency \n" +
         "from purc$apbilladjustment where coalesce(aa_thischeckqty, 0) <> 0 and aa_enuu = ? and aa_custuu = ? and aa_date between ? and ?" +
         "group by aa_currency";
 
     /**
      * 客户采购验收单未对账金额查询语句
      */
-    public static final String SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as amount, pa_currency as currency \n" +
+    public static final String SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as count, pa_currency as currency \n" +
         "from purc$accept left join `purc$acceptitem` on pai_paid = pa_id " +
         "where pa_venduu = ? and pa_enuu = ? and pai_qty > coalesce(pai_ycheckqty, 0) and pai_orderprice <> 0 " +
         "group by pa_currency";
@@ -34,7 +34,7 @@ public class UnCheckedCountSqls {
     /**
      * 客户采购验收单未对账金额查询语句
      */
-    public static final String THISMONTH_SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as amount, pa_currency as currency \n" +
+    public static final String THISMONTH_SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as count, pa_currency as currency \n" +
         "from purc$accept left join `purc$acceptitem` on pai_paid = pa_id " +
         "where pa_venduu = ? and pa_enuu = ? and pai_qty > coalesce(pai_ycheckqty, 0) and pai_orderprice <> 0 and pa_date between ? and ?" +
         "group by pa_currency";
@@ -42,21 +42,21 @@ public class UnCheckedCountSqls {
     /**
      * 客户采购验退单未对账金额查询语句
      */
-    public static final String SALE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice), 0) as amount, pr_currency as currency \n" +
+    public static final String SALE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice), 0) as count, pr_currency as currency \n" +
         "from `purc$return` left join `purc$returnitem` on pr_id = pri_prid " +
         "where pri_qty > abs(coalesce(pri_ycheckqty, 0)) and pr_venduu = ? and pr_enuu = ? group by pr_currency";
 
     /**
      * 客户采购验退单未对账金额查询语句
      */
-    public static final String THISMONTH_SALE_RETURN_COUNT_SQL = "select sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice) as amount, pr_currency as currency \n" +
+    public static final String THISMONTH_SALE_RETURN_COUNT_SQL = "select sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice) as count, pr_currency as currency \n" +
         "from `purc$return` left join `purc$returnitem` on pr_id = pri_prid " +
         "where pri_qty > abs(coalesce(pri_ycheckqty, 0)) and pr_venduu = ? and pr_enuu = ? and pr_date between ? and ? group by pr_currency";
 
     /**
      * 客户委外验收单未对账金额查询语句
      */
-    public static final String MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as amount, ma_currency as currency " +
+    public static final String MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as count, ma_currency as currency " +
         " from make$accept " +
         "join make$acceptitem on ma_id = mai_paid " +
         "where mai_qty > coalesce(mai_ycheckqty, 0) and ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 group by ma_currency";
@@ -64,7 +64,7 @@ public class UnCheckedCountSqls {
     /**
      * 客户委外验收单未对账金额查询语句
      */
-    public static final String THISMONTH_MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as amount,ma_currency as currency " +
+    public static final String THISMONTH_MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as count, ma_currency as currency " +
         " from make$accept " +
         "join make$acceptitem on ma_id = mai_paid " +
         "where mai_qty > coalesce(mai_ycheckqty, 0) and ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 and ma_date between ? and ? group by ma_currency";
@@ -72,7 +72,7 @@ public class UnCheckedCountSqls {
     /**
      * 客户委外验退单未对账金额查询语句
      */
-    public static final String MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as amount,mr_currency as currency " +
+    public static final String MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as count,mr_currency as currency " +
         " from make$return " +
         "join make$returnitem on mr_id =  mri_paid " +
         "where mri_qty > abs(coalesce(mri_ycheckqty, 0)) and mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 group by mr_currency";
@@ -80,7 +80,7 @@ public class UnCheckedCountSqls {
     /**
      * 客户委外验退单未对账金额查询语句
      */
-    public static final String THISMONTH_MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as amount, mr_currency as currency " +
+    public static final String THISMONTH_MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as count, mr_currency as currency " +
         " from make$return " +
         "join make$returnitem on mr_id =  mri_paid " +
         "where mri_qty > abs(coalesce(mri_ycheckqty, 0)) and mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 and mr_date between ? and ? " +

+ 65 - 0
src/main/java/com/uas/platform/b2b/publicapi/model/ApCheckAmount.java

@@ -0,0 +1,65 @@
+package com.uas.platform.b2b.publicapi.model;
+
+
+/**
+ * 对账金额
+ *
+ * @author hejq
+ * @date 2018-12-14 23:21
+ */
+public class ApCheckAmount {
+
+    /**
+     * 币别
+     */
+    private String currency;
+
+    /**
+     * 金额(字符串: 防止科学计数法)
+     */
+    private String amount;
+
+    /**
+     * 金额
+     */
+    private Double count;
+
+    public String getCurrency() {
+        return currency;
+    }
+
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+
+    public String getAmount() {
+        return amount;
+    }
+
+    public void setAmount(String amount) {
+        this.amount = amount;
+    }
+
+    public Double getCount() {
+        return count;
+    }
+
+    public void setCount(Double count) {
+        this.count = count;
+    }
+
+    /**
+     * 通过币别,总额获取交易额
+     *
+     * @param currency 币别
+     * @param amount 总额
+     */
+    public ApCheckAmount(String currency, Double amount) {
+        this.currency = currency;
+        java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
+        nf.setGroupingUsed(false);
+        this.amount = nf.format(amount);
+    }
+
+    public ApCheckAmount() {}
+}

+ 0 - 10
src/main/java/com/uas/platform/b2b/publicapi/model/TradeCount.java

@@ -111,14 +111,4 @@ public class TradeCount implements Serializable {
 
     }
 
-    /**
-     * 通过币别,总额获取交易额
-     *
-     * @param currency 币别
-     * @param amount 总额
-     */
-    public TradeCount(String currency, Double amount) {
-        this.currency = currency;
-        this.amount = new BigDecimal(amount);
-    }
 }

+ 3 - 2
src/main/java/com/uas/platform/b2b/service/PurchaseApCheckService.java

@@ -6,6 +6,7 @@ import com.uas.platform.b2b.model.PurchaseApCheckItem;
 import com.uas.platform.b2b.model.PurchaseApCheckTodo;
 import com.uas.platform.b2b.model.SearchFilter;
 import com.uas.platform.b2b.model.Vendor;
+import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
 import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
@@ -151,7 +152,7 @@ public interface PurchaseApCheckService {
      * @param customerUU 客户企业UU
      * @return 统计结果
      */
-    List<TradeCount> getDueTrade(Long enUU, Long customerUU);
+    List<ApCheckAmount> getDueTrade(Long enUU, Long customerUU);
 
     /**
      * 获取指定月份应收金额
@@ -163,5 +164,5 @@ public interface PurchaseApCheckService {
      * @param endDate 截止时间
      * @return 统计结果
      */
-    List<TradeCount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate);
+    List<ApCheckAmount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate);
 }

+ 3 - 4
src/main/java/com/uas/platform/b2b/service/impl/ErpProdIODetailServiceImpl.java

@@ -10,9 +10,8 @@ import com.uas.platform.b2b.model.ApcheckKeyWord;
 import com.uas.platform.b2b.model.DateFilter;
 import com.uas.platform.b2b.model.ErpProdIODetail;
 import com.uas.platform.b2b.model.ErpProdIo;
-import com.uas.platform.b2b.model.SearchFilter;
 import com.uas.platform.b2b.model.Vendor;
-import com.uas.platform.b2b.publicapi.model.TradeCount;
+import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
 import com.uas.platform.b2b.service.ErpProdIODetailService;
 import com.uas.platform.b2b.service.PurchaseApCheckService;
 import com.uas.platform.b2b.support.CollectionUtil;
@@ -86,7 +85,7 @@ public class ErpProdIODetailServiceImpl implements ErpProdIODetailService {
         erpProdIo.setDetails(details);
         // 应收总额
        if (null != keyword.getCustomerUU()) {
-           List<TradeCount> totalTrades = apCheckService.getDueTrade(enUU, keyword.getCustomerUU());
+           List<ApCheckAmount> totalTrades = apCheckService.getDueTrade(enUU, keyword.getCustomerUU());
            List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(keyword.getCustomerUU(), enUU);
            if (!CollectionUtil.isEmpty(totalTrades)) {
                erpProdIo.setTotalCount(totalTrades);
@@ -98,7 +97,7 @@ public class ErpProdIODetailServiceImpl implements ErpProdIODetailService {
                }
            }
            // 本月应收
-           List<TradeCount> thisMonthTrades = apCheckService.getThisMonthTrade(enUU, keyword.getCustomerUU(), checkDate, fromDate, endDate);
+           List<ApCheckAmount> thisMonthTrades = apCheckService.getThisMonthTrade(enUU, keyword.getCustomerUU(), checkDate, fromDate, endDate);
            erpProdIo.setThisMonthCount(thisMonthTrades);
        }
 		return erpProdIo;

+ 5 - 4
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApBillServiceImpl.java

@@ -19,6 +19,7 @@ import com.uas.platform.b2b.model.PurchaseApBillItem;
 import com.uas.platform.b2b.model.SearchFilter;
 import com.uas.platform.b2b.model.Vendor;
 import com.uas.platform.b2b.ps.ProductUtils;
+import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
 import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.b2b.search.SearchService;
 import com.uas.platform.b2b.service.ErpProdIODetailService;
@@ -233,11 +234,11 @@ public class PurchaseApBillServiceImpl implements PurchaseApBillService {
                 .forEach(customer -> {
                     Long vendorUU = customer.getVendEnUU();
                     if (!com.uas.ps.core.util.StringUtils.isEmpty(customer.getTotalCountString())) {
-                        List<TradeCount> tradeCounts = JSON.parseArray(customer.getTotalCountString(), TradeCount.class);
+                        List<ApCheckAmount> tradeCounts = JSON.parseArray(customer.getTotalCountString(), ApCheckAmount.class);
                         customer.setTotalCount(tradeCounts);
                     }
                     // 本月应收
-                    List<TradeCount> thisMonthTrades = purchaseApCheckService.getThisMonthTrade(vendorUU, enUU, checkDate, fromDate, endDate);
+                    List<ApCheckAmount> thisMonthTrades = purchaseApCheckService.getThisMonthTrade(vendorUU, enUU, checkDate, fromDate, endDate);
                     customer.setThisMonthCount(thisMonthTrades);
                 });
         }
@@ -312,7 +313,7 @@ public class PurchaseApBillServiceImpl implements PurchaseApBillService {
         erpProdIo.setDetails(details);
         // 应收总额
         if (null != searchKeyWord.getVendorUU()) {
-            List<TradeCount> totalTrades = purchaseApCheckService.getDueTrade(searchKeyWord.getVendorUU(), enUU);
+            List<ApCheckAmount> totalTrades = purchaseApCheckService.getDueTrade(searchKeyWord.getVendorUU(), enUU);
             List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(enUU, searchKeyWord.getVendorUU());
             erpProdIo.setVendorName(vendors.get(0).getVendorEnterprise().getEnName());
             if (!CollectionUtil.isEmpty(totalTrades)) {
@@ -325,7 +326,7 @@ public class PurchaseApBillServiceImpl implements PurchaseApBillService {
                 }
             }
             // 本月应收
-            List<TradeCount> thisMonthTrades = purchaseApCheckService.getThisMonthTrade(searchKeyWord.getVendorUU(), enUU, checkDate, fromDate, endDate);
+            List<ApCheckAmount> thisMonthTrades = purchaseApCheckService.getThisMonthTrade(searchKeyWord.getVendorUU(), enUU, checkDate, fromDate, endDate);
             erpProdIo.setThisMonthCount(thisMonthTrades);
         }
         return erpProdIo;

+ 37 - 36
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -25,6 +25,7 @@ import com.uas.platform.b2b.model.SearchFilter;
 import com.uas.platform.b2b.model.SourceForApcheck;
 import com.uas.platform.b2b.model.Vendor;
 import com.uas.platform.b2b.model.util.UnCheckedCountSqls;
+import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
 import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.b2b.search.SearchService;
 import com.uas.platform.b2b.service.OrderRedDotService;
@@ -528,11 +529,11 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
                 .forEach(customer -> {
                     Long customerUU = customer.getMyEnUU();
                     if (!StringUtils.isEmpty(customer.getTotalCountString())) {
-                        List<TradeCount> tradeCounts = JSON.parseArray(customer.getTotalCountString(), TradeCount.class);
+                        List<ApCheckAmount> tradeCounts = JSON.parseArray(customer.getTotalCountString(), ApCheckAmount.class);
                         customer.setTotalCount(tradeCounts);
                     }
                     // 本月应收
-                    List<TradeCount> thisMonthTrades = getThisMonthTrade(enUU, customerUU, checkDate, fromDate, endDate);
+                    List<ApCheckAmount> thisMonthTrades = getThisMonthTrade(enUU, customerUU, checkDate, fromDate, endDate);
                     customer.setThisMonthCount(thisMonthTrades);
                 });
         }
@@ -588,7 +589,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
      * @return 统计结果
      */
     @Override
-    public List<TradeCount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate) {
+    public List<ApCheckAmount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate) {
         String sqlFromDate;
         String sqlEndDate;
         /*
@@ -616,49 +617,49 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
         } else {
             throw new IllegalOperatorException("请选择对账时间");
         }
-        List<TradeCount> totalTrades = new ArrayList<>();
+        List<ApCheckAmount> totalTrades = new ArrayList<>();
         ThreadUtils
             // 货款调账
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_ADJUSTMENT_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_ADJUSTMENT_COUNT_SQL, ApCheckAmount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
                 totalTrades.addAll(trades);
             })
             // 采购验收
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_SALE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_SALE_ACCEPT_COUNT_SQL, ApCheckAmount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
                 totalTrades.addAll(trades);
             })
             // 采购验退
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_SALE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_SALE_RETURN_COUNT_SQL, ApCheckAmount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
                 totalTrades.addAll(trades);
             })
             // 委外验收
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_MAKE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_MAKE_ACCEPT_COUNT_SQL, ApCheckAmount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
                 totalTrades.addAll(trades);
             })
             // 委外验退
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_MAKE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_MAKE_RETURN_COUNT_SQL, ApCheckAmount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
                 totalTrades.addAll(trades);
             })
             .run();
-        Double rmbCount = totalTrades.stream().filter(tradeCount -> RMB.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
-            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
-        Double usdCount = totalTrades.stream().filter(tradeCount -> USD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
-            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
-        Double hkdCount = totalTrades.stream().filter(tradeCount -> HKD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
-            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
-        List<TradeCount> resultCounts = new ArrayList<>();
+        Double rmbCount = totalTrades.stream().filter(tradeCount -> RMB.equals(tradeCount.getCurrency()))
+            .mapToDouble(ApCheckAmount::getCount).sum();
+        Double usdCount = totalTrades.stream().filter(tradeCount -> USD.equals(tradeCount.getCurrency()))
+            .mapToDouble(ApCheckAmount::getCount).sum();
+        Double hkdCount = totalTrades.stream().filter(tradeCount -> HKD.equals(tradeCount.getCurrency()))
+            .mapToDouble(ApCheckAmount::getCount).sum();
+        List<ApCheckAmount> resultCounts = new ArrayList<>();
         if (rmbCount > 0) {
-            resultCounts.add(new TradeCount(RMB, DecimalUtils.decimalPoint(rmbCount, 2)));
+            resultCounts.add(new ApCheckAmount(RMB, DecimalUtils.decimalPoint(rmbCount, 2)));
         }
         if (usdCount > 0) {
-            resultCounts.add(new TradeCount(USD, DecimalUtils.decimalPoint(usdCount, 2)));
+            resultCounts.add(new ApCheckAmount(USD, DecimalUtils.decimalPoint(usdCount, 2)));
         }
         if (hkdCount > 0) {
-            resultCounts.add(new TradeCount(HKD, DecimalUtils.decimalPoint(hkdCount, 2)));
+            resultCounts.add(new ApCheckAmount(HKD, DecimalUtils.decimalPoint(hkdCount, 2)));
         }
         return resultCounts;
     }
@@ -671,50 +672,50 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
      * @return 统计结果
      */
     @Override
-    public List<TradeCount> getDueTrade(Long enUU, Long customerUU) {
-        List<TradeCount> totalTrades = new ArrayList<>();
+    public List<ApCheckAmount> getDueTrade(Long enUU, Long customerUU) {
+        List<ApCheckAmount> totalTrades = new ArrayList<>();
         ThreadUtils
             // 货款调账
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.ADJUSTMENT_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.ADJUSTMENT_COUNT_SQL, ApCheckAmount.class, enUU, customerUU);
                 totalTrades.addAll(trades);
             })
             // 采购验收
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.SALE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.SALE_ACCEPT_COUNT_SQL, ApCheckAmount.class, enUU, customerUU);
                 totalTrades.addAll(trades);
             })
             // 采购验退
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.SALE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.SALE_RETURN_COUNT_SQL, ApCheckAmount.class, enUU, customerUU);
                 totalTrades.addAll(trades);
             })
             // 委外验收
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.MAKE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.MAKE_ACCEPT_COUNT_SQL, ApCheckAmount.class, enUU, customerUU);
                 totalTrades.addAll(trades);
             })
             // 委外验退
             .task(() -> {
-                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.MAKE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                List<ApCheckAmount> trades = commonDao.query(UnCheckedCountSqls.MAKE_RETURN_COUNT_SQL, ApCheckAmount.class, enUU, customerUU);
                 totalTrades.addAll(trades);
             })
             .run();
-        Double rmbCount = totalTrades.stream().filter(tradeCount -> RMB.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
-            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
-        Double usdCount = totalTrades.stream().filter(tradeCount -> USD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
-            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
-        Double hkdCount = totalTrades.stream().filter(tradeCount -> HKD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
-            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
-        List<TradeCount> resultCounts = new ArrayList<>();
+        Double rmbCount = totalTrades.stream().filter(tradeCount -> RMB.equals(tradeCount.getCurrency()))
+            .mapToDouble(ApCheckAmount::getCount).sum();
+        Double usdCount = totalTrades.stream().filter(tradeCount -> USD.equals(tradeCount.getCurrency()))
+            .mapToDouble(ApCheckAmount::getCount).sum();
+        Double hkdCount = totalTrades.stream().filter(tradeCount -> HKD.equals(tradeCount.getCurrency()))
+            .mapToDouble(ApCheckAmount::getCount).sum();
+        List<ApCheckAmount> resultCounts = new ArrayList<>();
         if (rmbCount > 0) {
-            resultCounts.add(new TradeCount(RMB, DecimalUtils.decimalPoint(rmbCount, 2)));
+            resultCounts.add(new ApCheckAmount(RMB, DecimalUtils.decimalPoint(rmbCount, 2)));
         }
         if (usdCount > 0) {
-            resultCounts.add(new TradeCount(USD, DecimalUtils.decimalPoint(usdCount, 2)));
+            resultCounts.add(new ApCheckAmount(USD, DecimalUtils.decimalPoint(usdCount, 2)));
         }
         if (hkdCount > 0) {
-            resultCounts.add(new TradeCount(HKD, DecimalUtils.decimalPoint(hkdCount, 2)));
+            resultCounts.add(new ApCheckAmount(HKD, DecimalUtils.decimalPoint(hkdCount, 2)));
         }
         return resultCounts;
     }

+ 20 - 5
src/main/java/com/uas/platform/b2b/support/DecimalUtils.java

@@ -3,8 +3,8 @@ package com.uas.platform.b2b.support;
 import com.uas.platform.core.exception.IllegalOperatorException;
 
 import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.text.DecimalFormat;
+import java.text.NumberFormat;
 
 /**
  * 平台数据小数点处理方式
@@ -25,8 +25,10 @@ public class DecimalUtils {
      */
     public static double decimalPoint(Double oldValue, Integer digit) {
         if (null != oldValue) {
-            BigDecimal decimal = new BigDecimal(oldValue);
-            return decimal.setScale(digit, BigDecimal.ROUND_HALF_UP).doubleValue();
+            String str = "#.###############";
+            String digitStr = str.substring(0, (2 + digit));
+            DecimalFormat decimalFormat = new java.text.DecimalFormat(digitStr);
+            return Double.valueOf(decimalFormat.format(oldValue));
         }
         return 0.00;
     }
@@ -41,7 +43,20 @@ public class DecimalUtils {
         if (fraction == null || fraction < 0) {
             throw new IllegalOperatorException("您传入的需要保留的有效位数是" + fraction + ",请核对信息");
         }
-        BigDecimal bigDecimal = new BigDecimal(String.valueOf(value));
-        return bigDecimal.setScale(fraction, RoundingMode.HALF_UP).doubleValue();
+        NumberFormat numberFormat = NumberFormat.getInstance();
+        numberFormat.setMaximumFractionDigits(fraction);
+        numberFormat.setGroupingUsed(false);
+        BigDecimal bigDecimal = new BigDecimal(numberFormat.format(value));
+        return bigDecimal.setScale(fraction, BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
+
+    private static Double formatDouble(double d, Integer fraction) {
+        NumberFormat nf = NumberFormat.getInstance();
+        //设置保留多少位小数
+        nf.setMaximumFractionDigits(fraction);
+        // 取消科学计数法
+        nf.setGroupingUsed(false);
+        //返回结果
+        return Double.valueOf(nf.format(d));
     }
 }

+ 2 - 1
src/main/java/com/uas/platform/b2b/task/ApCheckTask.java

@@ -5,6 +5,7 @@ import com.uas.platform.b2b.dao.CommonDao;
 import com.uas.platform.b2b.dao.CommunalLogDao;
 import com.uas.platform.b2b.erp.model.VendorInfo;
 import com.uas.platform.b2b.model.CommunalLog;
+import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
 import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.b2b.service.PurchaseApCheckService;
 import com.uas.platform.b2b.support.CollectionUtil;
@@ -52,7 +53,7 @@ public class ApCheckTask {
         if (!CollectionUtil.isEmpty(vendorList)) {
             final int[] size = {0};
             vendorList.forEach(vendorInfo -> {
-                List<TradeCount> tradeCounts = apCheckService.getDueTrade(vendorInfo.getVenduu(), vendorInfo.getCustuu());
+                List<ApCheckAmount> tradeCounts = apCheckService.getDueTrade(vendorInfo.getVenduu(), vendorInfo.getCustuu());
                 String tradeString;
                 if (!CollectionUtil.isEmpty(tradeCounts)) {
                     tradeString = JSON.toJSONString(tradeCounts);