Просмотр исходного кода

feat: 增加对账总额数据

hejq 7 лет назад
Родитель
Сommit
2fa2adfa7a

+ 7 - 1
db/ddl.sql

@@ -87,4 +87,10 @@ insert into sale$distribute (pd_distribute, pd_istransfer, pd_useruu, pd_vdid)
 and not exists (select 1 from sale$distribute where ve_id = pd_vdid);
 and not exists (select 1 from sale$distribute where ve_id = pd_vdid);
 
 
 update `sale$distribute` set pd_useruu = 1000004274 where pd_useruu = 2000012807 and
 update `sale$distribute` set pd_useruu = 1000004274 where pd_useruu = 2000012807 and
-pd_vdid in (select ve_id from `purc$vendors` where ve_myenuu = 10042875);
+pd_vdid in (select ve_id from `purc$vendors` where ve_myenuu = 10042875);
+
+-- date: 2018-12-25 9:10
+-- author: hejq
+-- content: 供应商客户关系表增加对账总额字段
+alter table `purc$vendors`
+  add column apcheck_count VARCHAR(200) default '' comment '对账总额(已对账和未对账之和)';

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

@@ -179,6 +179,12 @@ public class Vendor implements Serializable {
 	@Column(name = "todo_apchek_count")
 	@Column(name = "todo_apchek_count")
     private String totalCountString;
     private String totalCountString;
 
 
+    /**
+     * 对账总额
+     */
+	@Column(name = "apcheck_count")
+    private String countString;
+
     /**
     /**
      * 最近一次对账时间
      * 最近一次对账时间
      */
      */
@@ -239,6 +245,12 @@ public class Vendor implements Serializable {
 	@Transient
 	@Transient
     private List<ApCheckAmount> totalCount;
     private List<ApCheckAmount> totalCount;
 
 
+    /**
+     * 对账总额
+     */
+	@Transient
+    private List<ApCheckAmount> apCheckAmounts;
+
 	public Long getId() {
 	public Long getId() {
 		return id;
 		return id;
 	}
 	}
@@ -492,6 +504,22 @@ public class Vendor implements Serializable {
         this.totalCountString = totalCountString;
         this.totalCountString = totalCountString;
     }
     }
 
 
+    public String getCountString() {
+        return countString;
+    }
+
+    public void setCountString(String countString) {
+        this.countString = countString;
+    }
+
+    public List<ApCheckAmount> getApCheckAmounts() {
+        return apCheckAmounts;
+    }
+
+    public void setApCheckAmounts(List<ApCheckAmount> apCheckAmounts) {
+        this.apCheckAmounts = apCheckAmounts;
+    }
+
     public InquiryVendorInfo covert() {
     public InquiryVendorInfo covert() {
 		InquiryVendorInfo info = new InquiryVendorInfo();
 		InquiryVendorInfo info = new InquiryVendorInfo();
 		info.setB2b_id(this.id);
 		info.setB2b_id(this.id);

+ 23 - 5
src/main/java/com/uas/platform/b2b/service/PurchaseApCheckService.java

@@ -61,23 +61,26 @@ public interface PurchaseApCheckService {
 	/**
 	/**
 	 * 根据ID获取生成的应收对账单
 	 * 根据ID获取生成的应收对账单
 	 * 
 	 * 
-	 * @param id
-	 * @return
+	 * @param id 单据id
+	 * @return 对账数据
 	 */
 	 */
     PurchaseApCheck findById(Long id);
     PurchaseApCheck findById(Long id);
 
 
 	/**
 	/**
 	 * 根据来源表的ID更新来源单据已转数
 	 * 根据来源表的ID更新来源单据已转数
+     * @param list 单据数据
 	 */
 	 */
     void updateYCheckQty(List<HashMap<String, Object>> list);
     void updateYCheckQty(List<HashMap<String, Object>> list);
 
 
 	/**
 	/**
 	 * 删除新生成的应收对账单
 	 * 删除新生成的应收对账单
+     * @param id 单据id
 	 */
 	 */
     void deleteApCheck(Long id);
     void deleteApCheck(Long id);
 
 
 	/**
 	/**
 	 * 提交生成的应收对账单
 	 * 提交生成的应收对账单
+     * @param id  单据id
 	 */
 	 */
     boolean updateApCheckStatus(Long id);
     boolean updateApCheckStatus(Long id);
 
 
@@ -97,6 +100,7 @@ public interface PurchaseApCheckService {
 	 * @param pageInfo
 	 * @param pageInfo
 	 * @param keyword
 	 * @param keyword
 	 *            查找关键字
 	 *            查找关键字
+     * @param searchFilter 过滤条件
 	 * @return
 	 * @return
 	 */
 	 */
     Page<PurchaseApCheckTodo> findTodoByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
     Page<PurchaseApCheckTodo> findTodoByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
@@ -107,6 +111,7 @@ public interface PurchaseApCheckService {
 	 * @param pageInfo
 	 * @param pageInfo
 	 * @param keyword
 	 * @param keyword
 	 *            查找关键字
 	 *            查找关键字
+     * @param searchFilter 过滤条件
 	 * @return
 	 * @return
 	 */
 	 */
     Page<PurchaseApCheckDone> findDoneByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
     Page<PurchaseApCheckDone> findDoneByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
@@ -121,9 +126,9 @@ public interface PurchaseApCheckService {
 	/**
 	/**
 	 * 通过sourceTable和sourceId判断是否存在未对账的单据
 	 * 通过sourceTable和sourceId判断是否存在未对账的单据
 	 * 
 	 * 
-	 * @param sourceTable
-	 * @param sourceId
-	 * @return
+	 * @param sourceTable 来源记录表
+	 * @param sourceId 来源id
+	 * @return 对账明细
 	 */
 	 */
     List<PurchaseApCheckItem> findBySourceTableAndSourceId(String sourceTable, Long sourceId);
     List<PurchaseApCheckItem> findBySourceTableAndSourceId(String sourceTable, Long sourceId);
 
 
@@ -143,6 +148,7 @@ public interface PurchaseApCheckService {
      * @param fromDate 开始时间
      * @param fromDate 开始时间
      * @param endDate 截止时间
      * @param endDate 截止时间
      * @return 搜索结果
      * @return 搜索结果
+     * @throws InterruptedException
      */
      */
     SPage<Vendor> getCustomerInfo(PageParams params, String keyword, String checkDate,  Long fromDate, Long endDate) throws InterruptedException;
     SPage<Vendor> getCustomerInfo(PageParams params, String keyword, String checkDate,  Long fromDate, Long endDate) throws InterruptedException;
 
 
@@ -152,9 +158,20 @@ public interface PurchaseApCheckService {
      * @param enUU 企业UU
      * @param enUU 企业UU
      * @param customerUU 客户企业UU
      * @param customerUU 客户企业UU
      * @return 统计结果
      * @return 统计结果
+     * @throws InterruptedException 中断异常
      */
      */
     List<ApCheckAmount> getDueTrade(Long enUU, Long customerUU) throws InterruptedException;
     List<ApCheckAmount> getDueTrade(Long enUU, Long customerUU) throws InterruptedException;
 
 
+    /**
+     * 获取总的对账金额
+     *
+     * @param vendorUU 供应商UU
+     * @param customerUU 客户UU
+     * @return 统计结果
+     * @throws InterruptedException 中断异常
+     */
+    List<ApCheckAmount> getAllApCheckAmount(Long vendorUU, Long customerUU) throws InterruptedException;
+
     /**
     /**
      * 获取指定月份应收金额(总额)
      * 获取指定月份应收金额(总额)
      *
      *
@@ -164,6 +181,7 @@ public interface PurchaseApCheckService {
      * @param fromDate 开始时间
      * @param fromDate 开始时间
      * @param endDate 截止时间
      * @param endDate 截止时间
      * @return 统计结果
      * @return 统计结果
+     * @throws InterruptedException 中断异常
      */
      */
     List<ApCheckAmount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate) throws InterruptedException;
     List<ApCheckAmount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate) throws InterruptedException;
 
 

+ 45 - 0
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -838,4 +838,49 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
         threadsSignal.await();
         threadsSignal.await();
         return groupCountByCurrency(totalTrades);
         return groupCountByCurrency(totalTrades);
     }
     }
+
+    /**
+     * 获取总的对账金额
+     *
+     * @param vendorUU   供应商UU
+     * @param customerUU 客户UU
+     * @return 统计结果
+     */
+    @Override
+    public List<ApCheckAmount> getAllApCheckAmount(Long vendorUU, Long customerUU) throws InterruptedException {
+        List<ApCheckAmount> totalTrades = new ArrayList<>();
+        final CountDownLatch threadsSignal = new CountDownLatch(5);
+        // 货款调账
+        executor.submitTask(() -> {
+            List<ApCheckAmount> trades = commonDao.query(ApCheckAllCountSqls.ADJUSTMENT_COUNT_SQL, ApCheckAmount.class, vendorUU, customerUU);
+            totalTrades.addAll(trades);
+            threadsSignal.countDown();
+        });
+        // 采购验收
+        executor.submitTask(() -> {
+            List<ApCheckAmount> trades = commonDao.query(ApCheckAllCountSqls.SALE_ACCEPT_COUNT_SQL, ApCheckAmount.class, vendorUU, customerUU);
+            totalTrades.addAll(trades);
+            threadsSignal.countDown();
+        });
+        // 采购验退
+        executor.submitTask(() -> {
+            List<ApCheckAmount> trades = commonDao.query(ApCheckAllCountSqls.SALE_RETURN_COUNT_SQL, ApCheckAmount.class, vendorUU, customerUU);
+            totalTrades.addAll(trades);
+            threadsSignal.countDown();
+        });
+        // 委外验收
+        executor.submitTask(() -> {
+            List<ApCheckAmount> trades = commonDao.query(ApCheckAllCountSqls.MAKE_ACCEPT_COUNT_SQL, ApCheckAmount.class, vendorUU, customerUU);
+            totalTrades.addAll(trades);
+            threadsSignal.countDown();
+        });
+        // 委外验退
+        executor.submitTask(() -> {
+            List<ApCheckAmount> trades = commonDao.query(ApCheckAllCountSqls.MAKE_RETURN_COUNT_SQL, ApCheckAmount.class, vendorUU, customerUU);
+            totalTrades.addAll(trades);
+            threadsSignal.countDown();
+        });
+        threadsSignal.await();
+        return groupCountByCurrency(totalTrades);
+    }
 }
 }