Browse Source

Merge remote-tracking branch 'origin/feature-201846-hejq' into feature-201846-hejq

shenjunjie 7 years ago
parent
commit
fd1322cad3

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

@@ -121,9 +121,7 @@ public class SaleApCheckController {
 	public ModelMap cancelApCheck(Long id) {
 		boolean result = purchaseApCheckService.cancelApcheck(id);
 		logger.log("应收对账单", "作废应收对账单", result ? "成功" : "失败", "", id);
-		ModelMap map = new ModelMap();
-		map.put("result", result);
-		return map;
+		return new ModelMap("result", result);
 	}
 
 	/**

+ 18 - 0
src/main/java/com/uas/platform/b2b/service/PurchaseApCheckService.java

@@ -236,4 +236,22 @@ public interface PurchaseApCheckService {
      * @param endDate 截止时间
      */
     void countApCheck(Vendor customer, String checkDate, Long fromDate, Long endDate);
+
+    /**
+     * 通过供应UU和客户UU更新对账数据
+     * @param vendorUU 供应商UU
+     * @param customerUU 客户UU
+     * @param vendorId 供应商客户关系表id
+     */
+    void updateTodoApCheckCount(Long vendorUU, Long customerUU, Long vendorId);
+
+    /**
+     * 更细对账数据sql语句
+     *
+     * @param vendorUU 供应商UU
+     * @param customerUU 客户UU
+     * @param vendorId 供应商客户关系id
+     * @return sql
+     */
+    String updateApCheckCountSql(Long vendorUU, Long customerUU, Long vendorId);
 }

+ 72 - 2
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -5,6 +5,7 @@ import com.uas.platform.b2b.constant.StringConstant;
 import com.uas.platform.b2b.core.util.BoundedExecutor;
 import com.uas.platform.b2b.core.util.ContextUtils;
 import com.uas.platform.b2b.dao.CommonDao;
+import com.uas.platform.b2b.dao.CommunalLogDao;
 import com.uas.platform.b2b.dao.EnterpriseDao;
 import com.uas.platform.b2b.dao.PurchaseApCheckDao;
 import com.uas.platform.b2b.dao.PurchaseApCheckDoneDao;
@@ -12,6 +13,7 @@ import com.uas.platform.b2b.dao.PurchaseApCheckItemDao;
 import com.uas.platform.b2b.dao.PurchaseApCheckTodoDao;
 import com.uas.platform.b2b.dao.VendorDao;
 import com.uas.platform.b2b.event.PurchaseApCheckReplyReleaseEvent;
+import com.uas.platform.b2b.model.CommunalLog;
 import com.uas.platform.b2b.model.DateFilter;
 import com.uas.platform.b2b.model.Enterprise;
 import com.uas.platform.b2b.model.OrderRedDotAll;
@@ -31,8 +33,10 @@ import com.uas.platform.b2b.service.ErpProdIODetailService;
 import com.uas.platform.b2b.service.OrderRedDotService;
 import com.uas.platform.b2b.service.PurchaseApCheckService;
 import com.uas.platform.b2b.service.UserService;
+import com.uas.platform.b2b.support.CollectionUtil;
 import com.uas.platform.b2b.support.DecimalUtils;
 import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.b2b.task.ApCheckTask;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
@@ -81,6 +85,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
     private final EnterpriseDao enterpriseDao;
     private final UserService userService;
     private final VendorDao vendorDao;
+    private final CommunalLogDao communalLogDao;
     @Autowired
     private ErpProdIODetailService erpProdIODetailService;
 
@@ -105,7 +110,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
     public PurchaseApCheckServiceImpl(PurchaseApCheckDao purchaseApCheckDao, PurchaseApCheckTodoDao purchaseApCheckTodoDao,
                                       PurchaseApCheckDoneDao purchaseApCheckDoneDao, PurchaseApCheckItemDao purchaseApCheckItemDao,
                                       CommonDao commonDao, OrderRedDotService redDotService, EnterpriseDao enterpriseDao,
-                                      UserService userService, VendorDao vendorDao) {
+                                      UserService userService, VendorDao vendorDao, CommunalLogDao communalLogDao) {
         this.purchaseApCheckDao = purchaseApCheckDao;
         this.redDotService = redDotService;
         this.purchaseApCheckTodoDao = purchaseApCheckTodoDao;
@@ -115,6 +120,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
         this.enterpriseDao = enterpriseDao;
         this.userService = userService;
         this.vendorDao = vendorDao;
+        this.communalLogDao = communalLogDao;
         ExecutorService executorService = Executors.newCachedThreadPool();
         executor = new BoundedExecutor(executorService, 1600);
     }
@@ -211,7 +217,6 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
                         System.out.println("生成对账单批量更新来源数据失败: " + e.getMessage());
                         throw new IllegalOperatorException("保存失败!");
                     }
-                    return true;
                 }
 			}
 			check.setCheckStatus("已作废");
@@ -839,6 +844,71 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
         return groupCountByCurrency(totalTrades);
     }
 
+    /**
+     * 通过供应UU和客户UU更新对账数据
+     *
+     * @param vendorUU   供应商UU
+     * @param customerUU 客户UU
+     * @param vendorId   供应商客户关系表id
+     */
+    @Override
+    public void updateTodoApCheckCount(Long vendorUU, Long customerUU, Long vendorId) {
+        String sql = updateApCheckCountSql(vendorUU, customerUU, vendorId);
+        if (!StringUtils.isEmpty(sql)) {
+            try {
+                commonDao.getJdbcTemplate().update(sql);
+            } catch (RuntimeException e) {
+                CommunalLog log = new CommunalLog();
+                log.setTitle("更新客户关系表对账数据--更新失败");
+                log.setMessage("id: " + vendorId);
+                log.setTime(System.currentTimeMillis());
+                communalLogDao.save(log);
+            }
+            CommunalLog log = new CommunalLog();
+            log.setTitle("作废应收对账单供应商关系对账数据");
+            log.setMessage("id: " + vendorId);
+            log.setTime(System.currentTimeMillis());
+            communalLogDao.save(log);
+        }
+    }
+
+    /**
+     * 更细对账数据sql语句
+     *
+     * @param vendorUU   供应商UU
+     * @param customerUU 客户UU
+     * @param vendorId   供应商客户关系id
+     * @return sql
+     */
+    @Override
+    public String updateApCheckCountSql(Long vendorUU, Long customerUU, Long vendorId) {
+        Vendor vendor = null;
+        if (null == vendorId) {
+            List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(customerUU, vendorUU);
+            if (!CollectionUtils.isEmpty(vendors)) {
+                vendor = vendors.get(0);
+            }
+        } else {
+            vendor = vendorDao.findOne(vendorId);
+        }
+        if (null != vendor) {
+            List<ApCheckAmount> tradeCounts = null;
+            try {
+                tradeCounts = getDueTrade(vendor.getVendEnUU(), vendor.getMyEnUU());
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            String tradeString;
+            if (!CollectionUtil.isEmpty(tradeCounts)) {
+                tradeString = JSON.toJSONString(tradeCounts);
+            } else {
+                tradeString = "";
+            }
+            return String.format(ApCheckTask.UPDATE_COUNT_SQL, tradeString, vendor.getId());
+        }
+        return null;
+    }
+
     /**
      * 获取总的对账金额
      *

+ 14 - 23
src/main/java/com/uas/platform/b2b/task/ApCheckTask.java

@@ -1,18 +1,19 @@
 package com.uas.platform.b2b.task;
 
-import com.alibaba.fastjson.JSON;
 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;
+import com.uas.platform.core.exception.IllegalOperatorException;
+import com.uas.ps.core.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -51,32 +52,22 @@ public class ApCheckTask {
     public void updateCount() {
         List<VendorInfo> vendorList = commonDao.query(TODO_CUSTOMER_SQL, VendorInfo.class);
         if (!CollectionUtil.isEmpty(vendorList)) {
+            List<String> sqlList = new ArrayList<>();
             final int[] size = {0};
             vendorList.forEach(vendorInfo -> {
-                List<ApCheckAmount> tradeCounts = null;
-                try {
-                    tradeCounts = apCheckService.getDueTrade(vendorInfo.getVenduu(), vendorInfo.getCustuu());
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-                String tradeString;
-                if (!CollectionUtil.isEmpty(tradeCounts)) {
-                    tradeString = JSON.toJSONString(tradeCounts);
-                } else {
-                    tradeString = "";
+                String sql = apCheckService.updateApCheckCountSql(vendorInfo.getVenduu(), vendorInfo.getCustuu(), vendorInfo.getId());
+                if (!StringUtils.isEmpty(sql)) {
+                    sqlList.add(sql);
+                    size[0]++;
                 }
+            });
+            if (!CollectionUtils.isEmpty(sqlList)) {
                 try {
-                    String sql = String.format(UPDATE_COUNT_SQL, tradeString, vendorInfo.getId());
-                    commonDao.getJdbcTemplate().update(sql);
-                    size[0]++;
+                    commonDao.getJdbcTemplate().batchUpdate(sqlList.toArray(new String[sqlList.size()]));
                 } catch (RuntimeException e) {
-                    CommunalLog log = new CommunalLog();
-                    log.setTitle("更新客户关系表对账数据--更新失败");
-                    log.setMessage("id: " + vendorInfo.getId());
-                    log.setTime(System.currentTimeMillis());
-                    communalLogDao.save(log);
+                    throw new IllegalOperatorException("更新失败-> " + e.getMessage());
                 }
-            });
+            }
             CommunalLog log = new CommunalLog();
             log.setTitle("更新客户关系表对账数据");
             log.setMessage("最小id: " + vendorList.get(0).getId() + ";数量: " + size[0]);

BIN
src/main/resources/jxls-tpl/fa/faApCheck.xls


+ 1 - 1
src/main/webapp/resources/css/index.css

@@ -4704,7 +4704,7 @@ input[required]:invalid, input:focus:invalid, textarea[required]:invalid, textar
 	margin: 0 12px;
 }
 .ng-table-pager .pagination>li .page-record span input{
-	width: 25px;
+	width: 40px;
 	height: 25px;
 	border: #b8b8b8 1px solid;
 	margin: 0 5px;

+ 4 - 4
src/main/webapp/resources/js/index/app.js

@@ -11188,8 +11188,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }
             });
             if ($scope.apCheckCondition.$open) {
-                $scope.fromDate = $scope.apCheckCondition.dateFrom ? $scope.apCheckCondition.dateFrom.getTime() : null;
-                $scope.endDate = $scope.apCheckCondition.dateTo ? $scope.apCheckCondition.dateTo.getTime() : null;
+                $scope.apCheck.beginDate = $scope.apCheckCondition.dateFrom ? $scope.apCheckCondition.dateFrom.getTime() : null;
+                $scope.apCheck.endDate = $scope.apCheckCondition.dateTo ? $scope.apCheckCondition.dateTo.getTime() : null;
             } else {
                 var _isShowApcheckList = $scope.thisMouth + '-01'
                 var _time1 = _isShowApcheckList
@@ -11202,9 +11202,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 // 获取筛选时间的开始时间为对账的开始时间
                 var _time2 = _isShowApcheckList
                 _time2 = _time2.replace(/-/g, '/')
-                $scope.fromDate = new Date(_time2).getTime()
+                $scope.apCheck.beginDate = new Date(_time2).getTime()
                 // 获取筛选的截止时间为对账的截止时间
-                $scope.endDate = _d.getTime()
+                $scope.apCheck.endDate = _d.getTime()
             }
 
             //获取筛选时间的开始时间为对账的开始时间

+ 24 - 3
src/main/webapp/resources/tpl/index/fa/apCheck.html

@@ -138,10 +138,29 @@
 	</div>
 	<div class="pub-com_head">
 		<span>应收对账单</span>
-		<div class="p-right">
+		<!--<div class="p-right">-->
 			<!--<a class="text-simple append" ui-sref="fa.apCheckList" title="新增对账单" ng-hide="showNotCheck"><i class="fa fa-plus-square fa-fw"></i>新增对账单</a>&nbsp;&nbsp;&nbsp;-->
-			<a href="#" ng-click="exportXls()" ng-hide="active === 'all'"
-			   target="_self" title="导出Excel表格" class="blue f14"><i class="fa fa-file-text fa-fw"></i>导出</a>
+			<!--<a href="#" ng-click="exportXls()" ng-hide="active === 'all'" target="_self" title="导出Excel表格" class="blue f14"><i class="fa fa-file-text fa-fw"></i>导出</a>-->
+		<!--</div>-->
+		<div class="p-right" ng-show="active === 'all'">
+			<div class="btn-group btn-group-sm"  style="    float: right;
+    font-size: 14px;
+    cursor: pointer;
+    text-align: right;
+    height: 28px;
+    line-height: 27px;
+    margin-right: 20px;
+    color: #fff;
+    border: 1px solid #fff;
+    margin-top: 3px;
+    padding: 0 5px;"  ng-click="setActive()">查看对账记录
+				<!--<b class="new-dot" ng-if="unread.cancelled > 0">{{unread.cancelled > 99 ? '99+' : unread.cancelled}}</b>-->
+			</div>
+		</div>
+		<div class="p-right" ng-show="active !== 'all'">
+			<div class="btn-group btn-group-sm"  style="float: right;font-size: 14px;cursor: pointer;text-align: right;height: 40px;line-height: 40px; margin-right: 20px;;color: #fff;"  ng-click="setActive('all')">
+				<img src="static/img/vendor/images/backIcon.png" width="20"/>返回
+			</div>
 		</div>
 		<div class="btn-group btn-group-sm"  style="float: right;font-size: 14px;cursor: pointer;text-align: right;height: 40px;line-height: 40px; margin-right: 20px;;color: #fff;" ng-hide="!showNotCheck" ng-click="hideshowNotCheck()">
 			<img src="static/img/vendor/images/backIcon.png" width="20"/>返回
@@ -713,6 +732,7 @@
 						<th width="70">采购单</th>
 						<th width="60">发货单</th>
 						<th width="60">验收单</th>
+						<th width="70">物料编号</th>
 						<th width="70">物料名称</th>
 						<th width="70">规格型号</th>
 						<!--<th width="60">发货单</th>-->
@@ -745,6 +765,7 @@
 						<td width="70">{{::check.ordercode}}</td>
 							<td width="60">{{::check.sendcode}}</td>
 							<td width="60">{{::check.inoutno}}</td>
+							<td width="70">{{::check.prodcode}}</td>
 						<td width="70" title="{{check.prodtitle}}">
 							<div style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.prodtitle}}</div>
 						</td>

+ 26 - 2
src/main/webapp/resources/tpl/index/fa/arCheck.html

@@ -140,8 +140,28 @@
 		<span>应付对账单</span>
 		<div class="p-right">
 			<!--<a class="text-simple append" ui-sref="fa.apCheckList" title="新增对账单" ng-hide="showNotCheck"><i class="fa fa-plus-square fa-fw"></i>新增对账单</a>&nbsp;&nbsp;&nbsp;-->
-			<a href="#" ng-click="exportXls()" ng-hide="active === 'all'"
-			   target="_self" title="导出Excel表格" class="blue f14"><i class="fa fa-file-text fa-fw"></i>导出</a>
+			<!--<a href="#" ng-click="exportXls()" ng-hide="active === 'all'"-->
+			   <!--target="_self" title="导出Excel表格" class="blue f14"><i class="fa fa-file-text fa-fw"></i>导出</a>-->
+		</div>
+		<div class="p-right" ng-show="active === 'all'">
+			<div class="btn-group btn-group-sm"  style="    float: right;
+    font-size: 14px;
+    cursor: pointer;
+    text-align: right;
+    height: 28px;
+    line-height: 27px;
+    margin-right: 20px;
+    color: #fff;
+    border: 1px solid #fff;
+    margin-top: 3px;
+    padding: 0 5px;"  ng-click="setActive()">查看对账记录
+				<!--<b class="new-dot" ng-if="unread.cancelled > 0">{{unread.cancelled > 99 ? '99+' : unread.cancelled}}</b>-->
+			</div>
+		</div>
+		<div class="p-right" ng-show="active !== 'all'">
+			<div class="btn-group btn-group-sm"  style="float: right;font-size: 14px;cursor: pointer;text-align: right;height: 40px;line-height: 40px; margin-right: 20px;;color: #fff;"  ng-click="setActive('all')">
+				<img src="static/img/vendor/images/backIcon.png" width="20"/>返回
+			</div>
 		</div>
 		<div class="btn-group btn-group-sm"  style="float: right;font-size: 14px;cursor: pointer;text-align: right;height: 40px;line-height: 40px; margin-right: 20px;;color: #fff;" ng-hide="!showNotCheck" ng-click="hideshowNotCheck()">
 			<img src="static/img/vendor/images/backIcon.png" width="20"/>返回
@@ -624,6 +644,7 @@
 						<th width="70">采购单</th>
 						<th width="60">发货单</th>
 						<th width="60">验收单</th>
+						<th width="70">物料编号</th>
 						<th width="70">物料名称</th>
 						<th width="70">规格型号</th>
 						<th width="55">发货数量</th>
@@ -643,6 +664,9 @@
 						<td width="70">{{::check.ordercode}}</td>
 						<td width="60">{{::check.sendcode}}</td>
 						<td width="60">{{::check.inoutno}}</td>
+						<td width="70" title="{{check.prodcode}}">
+							{{::check.prodcode}}
+						</td>
 						<td width="70" title="{{check.prodtitle}}">
 							<div style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.prodtitle}}</div>
 						</td>