Browse Source

feat: 应付对账供应商和应收对账客户返回数据增加 本月已付和本月未付数据返回

hejq 7 years ago
parent
commit
72cdcbfe35

+ 3 - 3
src/main/java/com/uas/platform/b2b/controller/SaleOrderController.java

@@ -1150,9 +1150,9 @@ public class SaleOrderController {
 		// 建索引时,将不处于已结案状态,但是货物全部交接完毕的单,end值设为了2
 		list.add((short) 2);
 		ModelMap map = new ModelMap();
-        map.put("pu_end", new MultiValue(list, true));
-        map.put("pu_status", (short) Status.UNAUDIT.value());
-        pageParams.setNotEqualFilters(map);
+		map.put("pu_end", new MultiValue(list, true));
+		map.put("pu_status", (short) Status.UNAUDIT.value());
+		pageParams.setNotEqualFilters(map);
         pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
         pageParams.getFilters().put("pu_enuu", SystemSession.getUser().getEnterprise().getUu());
 		return searchService.searchPurchaseWaitingOrderIds(keyword, pageParams);

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

@@ -218,6 +218,8 @@ public class Vendor implements Serializable {
     /**
      * 本月应收(前端传入指定月份)
      */
+	@Transient
+    private List<ApCheckAmount> thisMonthCount;
     @Transient
     private List<ApCheckAmount> thisMonthCount;
 

+ 88 - 0
src/main/java/com/uas/platform/b2b/model/util/ApCheckeAllCountSqls.java

@@ -0,0 +1,88 @@
+package com.uas.platform.b2b.model.util;
+
+
+/**
+ * 未对账总额sql查询语句
+ *
+ * @author hejq
+ * @date 2018-12-04 9:48
+ */
+public class ApCheckeTodoCountSqls {
+
+    /**
+     * 货款调账未对账金额查询语句
+     */
+    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 aa_enuu = ? and aa_custuu = ? and coalesce(aa_thischeckqty, 0) <> 0 " +
+        "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 count, aa_currency as currency \n" +
+        "from purc$apbilladjustment where aa_enuu = ? and aa_custuu = ? and aa_date between ? and ? and coalesce(aa_thischeckqty, 0) <> 0" +
+        "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 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";
+
+    /**
+     * 客户采购验收单未对账金额查询语句
+     */
+    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";
+
+    /**
+     * 客户采购验退单未对账金额查询语句
+     */
+    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 pr_venduu = ? and pr_enuu = ? and pri_qty > abs(coalesce(pri_ycheckqty, 0)) 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 count, pr_currency as currency \n" +
+        "from `purc$return` left join `purc$returnitem` on pr_id = pri_prid " +
+        "where pr_venduu = ? and pr_enuu = ? and pr_date between ? and ? and pri_qty > abs(coalesce(pri_ycheckqty, 0)) 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 count, ma_currency as currency " +
+        " from make$accept " +
+        "join make$acceptitem on ma_id = mai_paid " +
+        "where ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 and  mai_qty > coalesce(mai_ycheckqty, 0) group by ma_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 ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 and ma_date between ? and ? and mai_qty > coalesce(mai_ycheckqty, 0) group by ma_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 mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 and mri_qty > abs(coalesce(mri_ycheckqty, 0)) group by mr_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 mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 and mr_date between ? and ? and mri_qty > abs(coalesce(mri_ycheckqty, 0)) " +
+        "group by mr_currency";
+}

+ 88 - 0
src/main/java/com/uas/platform/b2b/model/util/ApCheckeDoneCountSqls.java

@@ -0,0 +1,88 @@
+package com.uas.platform.b2b.model.util;
+
+
+/**
+ * 未对账总额sql查询语句
+ *
+ * @author hejq
+ * @date 2018-12-04 9:48
+ */
+public class ApCheckeTodoCountSqls {
+
+    /**
+     * 货款调账未对账金额查询语句
+     */
+    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 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 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";
+
+    /**
+     * 客户采购验收单未对账金额查询语句
+     */
+    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";
+
+    /**
+     * 客户采购验退单未对账金额查询语句
+     */
+    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 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 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";
+
+    /**
+     * 客户委外验收单未对账金额查询语句
+     */
+    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";
+
+    /**
+     * 客户委外验退单未对账金额查询语句
+     */
+    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";
+
+    /**
+     * 客户委外验退单未对账金额查询语句
+     */
+    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 ? " +
+        "group by mr_currency";
+}

+ 88 - 0
src/main/java/com/uas/platform/b2b/model/util/ApCheckeTodoCountSqls.java

@@ -0,0 +1,88 @@
+package com.uas.platform.b2b.model.util;
+
+
+/**
+ * 未对账总额sql查询语句
+ *
+ * @author hejq
+ * @date 2018-12-04 9:48
+ */
+public class UnCheckedCountSqls {
+
+    /**
+     * 货款调账未对账金额查询语句
+     */
+    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 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 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";
+
+    /**
+     * 客户采购验收单未对账金额查询语句
+     */
+    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";
+
+    /**
+     * 客户采购验退单未对账金额查询语句
+     */
+    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 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 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";
+
+    /**
+     * 客户委外验收单未对账金额查询语句
+     */
+    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";
+
+    /**
+     * 客户委外验退单未对账金额查询语句
+     */
+    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";
+
+    /**
+     * 客户委外验退单未对账金额查询语句
+     */
+    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 ? " +
+        "group by mr_currency";
+}

+ 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 ? " +

+ 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);
-    }
 }

+ 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));
     }
 }