Переглянути джерело

Merge remote-tracking branch 'origin/release-201830-wangcz' into release-201830-wangcz

shenjj 7 роки тому
батько
коміт
7b453d7ac0

+ 9 - 1
src/main/java/com/uas/platform/b2c/common/base/service/impl/RestSmsServiceImpl.java

@@ -6,6 +6,8 @@ import com.uas.message.common.domain.SimpleMessage;
 import com.uas.message.sms.domain.SmsLog;
 import com.uas.message.sms.service.SmsService;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
+import com.uas.platform.b2c.fa.settlement.service.ExchangeRateService;
+import com.uas.platform.b2c.trade.util.BoundedExecutor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
@@ -20,6 +22,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 基于RestTemplate实现的短信息发送接口
@@ -31,6 +35,8 @@ public class RestSmsServiceImpl implements SmsService {
 
     private RestTemplate restTemplate;
 
+    private final BoundedExecutor executor;
+
     /**
      * 短信服务主机地址
      */
@@ -48,8 +54,10 @@ public class RestSmsServiceImpl implements SmsService {
     private static final String SMS_SEND_MANY_URL = "sms/send/o2m";
 
     @Autowired
-    public RestSmsServiceImpl(RestTemplate restTemplate) {
+    public RestSmsServiceImpl(RestTemplate restTemplate, ExchangeRateService exchangeRateService) {
         this.restTemplate = restTemplate;
+        ExecutorService executorService = Executors.newCachedThreadPool();
+        executor = new BoundedExecutor(executorService, 1600);
     }
 
     @Override

+ 6 - 1
src/main/java/com/uas/platform/b2c/core/constant/ReleaseStatus.java

@@ -73,7 +73,12 @@ public enum ReleaseStatus {
 	/**
 	 * {@code 115  产品库已存在}
 	 */
-	had_exists(115, "产品库已存在");
+	had_exists(115, "产品库已存在"),
+
+	/**
+	 * {@code 116  个人物料库已存在}
+	 */
+	personal_had_exists(116, "个人物料库已存在");
 
 	/**
 	 * @param value

+ 0 - 1
src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceServiceImpl.java

@@ -1243,7 +1243,6 @@ public class InvoiceServiceImpl implements InvoiceService {
             CriterionExpression[] expressions = new CriterionExpression[2];
             expressions[0] = PredicateUtils.like("invoiceid", keyword, true);
             expressions[1] = PredicateUtils.like("sellername", keyword, true);
-
             LogicalExpression logicalExpression = PredicateUtils.or(expressions);
             info.expression(logicalExpression);
         }

+ 12 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ReleaseProductByBatchDao.java

@@ -37,9 +37,11 @@ public interface ReleaseProductByBatchDao
      *
 	 * @param relbatchid 批号
 	 * @param releaseCode 匹配状态(不等于)
+     * @param publisherUu 发布者UU
 	 * @return List<ReleaseProductByBatch>
 	 */
-	List<ReleaseProductByBatch> findByRelbatchidAndReleaseCodeNot(String relbatchid, Integer releaseCode);
+    @Query("select r from ReleaseProductByBatch r where r.publisherUu =:publisherUu and r.relbatchid =:relbatchid and r.releaseCode not in :releaseCode")
+    List<ReleaseProductByBatch> findByRelbatchidAndReleaseCodeNot(@Param("publisherUu") Long publisherUu, @Param("relbatchid") String relbatchid, @Param("releaseCode") List<Integer> releaseCode);
 
 	@Query("select r from ReleaseProductByBatch r where r.publisherUu =:publisherUu and r.relbatchid =:relbatchid and r.releaseCode in :failCodes")
 	List<ReleaseProductByBatch> findByPublisherUuAndRelbatchidAndFailCode(@Param("publisherUu") Long publisherUu, @Param("relbatchid") String relbatchid, @Param("failCodes") List<Integer> failCodes);
@@ -129,4 +131,13 @@ public interface ReleaseProductByBatchDao
      */
     @Procedure(procedureName = "PRODUCT_RELEASE_BATCH_PUBLISH")
     String callPublishByBatch(Long enuu, String enterName, String batchid);
+
+    /**
+     * 批量上架个人物料验证数据信息是否重复
+     * @param batch 本批次代码
+     * @param enuu 公司enuu
+     * @param useruu 个人UU
+     */
+    @Procedure(procedureName = "PRODUCT_RELEASE_PERSON_EXIST_VALID")
+    void callReleasePersonExistValidProcedure(String batch, Long enuu, Long useruu);
 }

+ 0 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -406,7 +406,6 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		}
 	}
 
-
 	/**
 	 * 调用存储过程
 	 * @param enUU 企业的enUU

+ 1 - 1
src/main/java/com/uas/platform/b2c/trade/order/controller/PurchaseProductController.java

@@ -115,7 +115,7 @@ public class PurchaseProductController {
         if (loading == null || !Boolean.valueOf(loading.toString())) {
             session.setAttribute("load-error-ing", true);
         }
-        modelAndView.addObject("data", releaseProductByBatchService.findFailureReleaseProductByBatch(batch));
+        modelAndView.addObject("data", purchaseProductService.findFailureReleaseProductByBatch(batch));
         String url = "classpath:jxls-tpl/trade/releaseByBatchError-person";
         modelAndView.setView(new JxlsExcelView(url, "导出失败的个人物料-优软商城"));
         LOGGER.log("买家物料", "以Excel形式导出失败的个人物料");

+ 11 - 0
src/main/java/com/uas/platform/b2c/trade/order/service/PurchaseProductService.java

@@ -1,8 +1,11 @@
 package com.uas.platform.b2c.trade.order.service;
 
+import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import org.apache.poi.ss.usermodel.Workbook;
 
+import java.util.List;
+
 /**
  * 买家中心物料相关
  *
@@ -20,4 +23,12 @@ public interface PurchaseProductService {
      * @see ResultMap
      */
     ResultMap releasePersonalProductByExcel(Workbook workbook, Integer ignoreImport);
+
+    /**
+     * 通过批号查询导入失败的数据
+     *
+     * @param batch 批号
+     * @return List<ReleaseProductByBatch>
+     */
+    List<ReleaseProductByBatch> findFailureReleaseProductByBatch(String batch);
 }

+ 27 - 2
src/main/java/com/uas/platform/b2c/trade/order/service/impl/PurchaseProductServiceImpl.java

@@ -29,6 +29,7 @@ import org.springframework.ui.ModelMap;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -69,6 +70,12 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
      */
     private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(PurchaseProductServiceImpl.class);
 
+    /**
+     * 不需要传入的状态码
+     */
+    private final static List<Integer> failCode = Arrays.asList(ReleaseStatus.lack_info.value(),
+            ReleaseStatus.personal_had_exists.value());
+
     /**
      * 通过excel批量导入个人物料
      *
@@ -84,6 +91,10 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
         if (sheet.getRow(0) == null) {
             return ResultMap.error(new IllegalOperatorException("表格模板不正确!请重新下载最新模板"));
         }
+        int headNum = sheet.getRow(0).getPhysicalNumberOfCells();
+        if (headNum != UploadConstant.TOTAL_COLUMN_PERSON && headNum != UploadConstant.MAX_TOTAL_COLUMN_PERSON) {
+            return ResultMap.error(new IllegalOperatorException("表格模板不正确!请重新下载最新模板"));
+        }
         int rowNum = SheetUtil.getSheetLastNum(sheet, UploadConstant.MAX_TOTAL_COLUMN);
         // 表头占用行数
         int minExcelNumber = 2;
@@ -134,13 +145,16 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
             Long enUU = SystemSession.getUser().getEnterprise().getUu();
             // 验证数据信息是否重复
             releaseProductByBatchDao.callReleaseExistValidProcedure(batch, enUU);
+            // 验证数是否存在个人物料库
+            Long userUU = SystemSession.getUser().getUserUU();
+            releaseProductByBatchDao.callReleasePersonExistValidProcedure(batch, enUU, userUU);
             ModelMap modelMap = new ModelMap();
             // 处理上传数据
             assignmentProductInfo(enUU, modelMap, batch);
             // 验证成功后进行绑定处理
             Integer assignNumber = 0;
             // 去重后的数据
-            List<ReleaseProductByBatch> uniqueBatchList = releaseProductByBatchDao.findByRelbatchidAndReleaseCodeNot(batch, ReleaseStatus.lack_info.value());
+            List<ReleaseProductByBatch> uniqueBatchList = releaseProductByBatchDao.findByRelbatchidAndReleaseCodeNot(userUU, batch, failCode);
             if (!CollectionUtils.isEmpty(uniqueBatchList)) {
                 assignNumber = assignBatch(uniqueBatchList);
             }
@@ -153,6 +167,17 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
         return ResultMap.success();
     }
 
+    /**
+     * 通过批号查询导入失败的数据
+     *
+     * @param batch 批号
+     * @return List<ReleaseProductByBatch>
+     */
+    @Override
+    public List<ReleaseProductByBatch> findFailureReleaseProductByBatch(String batch) {
+        return releaseProductByBatchDao.findByPublisherUuAndRelbatchidAndFailCode(SystemSession.getUser().getUserUU(), batch, failCode);
+    }
+
     /**
      * 初始化赋值
      *
@@ -272,7 +297,7 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
             params.put("data", data);
             HttpUtil.Response res = null;
             try {
-                res = HttpUtil.sendPostRequest(productServiceIp + "/productuser/coverToUserByIds", params);
+                res = HttpUtil.sendPostRequest("http://10.1.51.24" + "/productuser/coverToUserByIds", params);
                 return Integer.valueOf(res.getResponseText());
             } catch (Exception e) {
                 String resultCode = null != res ? String.valueOf(res.getStatusCode()) : "access error";

+ 4 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/order_detail_ctrl.js

@@ -27,6 +27,7 @@ define(['app/app'], function(app) {
 	          } else {
               $scope.orderStatus = false
 	          }
+              $scope.order.status = data.data.status;
             var _data = data.data.invoiceDetails
             var _details = $scope.order.orderDetails
 			  $scope.order.logistics = data.data.logistics
@@ -57,7 +58,9 @@ define(['app/app'], function(app) {
                 $scope.logisticsInfo = eval ("(" + response.traces + ")");
                 if($scope.logisticsInfo.length > 0) {
                   $scope.hasInfo = true;
-                }
+                } else {
+                    $scope.hasInfo = false;
+				}
               }
             }, function(err){
               toaster.pop('info', err.data);

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/product_upload_ctrl.js

@@ -508,7 +508,7 @@ define([ 'app/app' ], function(app) {
             intervalId= setInterval(function () {
                 getDownLoadStatus();
             }, 500);
-        }else {
+        } else {
             if(!$scope.result || !$scope.result.batch) {
                 toaster.pop('info', '提示', '您没有上传信息');
             }else if(!$scope.result.filter) {

+ 6 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js

@@ -37,6 +37,7 @@ define(['app/app'], function(app) {
                 {invoiceid: enIdFilter($scope.ChooseItem)}, {},
                 function (data) {
                     var params = {};
+                    $scope.purchase.status = data.status;
                     var _data = data.invoiceDetails;
                     var _details = $scope.purchase.purchaseDetails;
                     $scope.purchase.logistics = data.logistics;
@@ -66,7 +67,9 @@ define(['app/app'], function(app) {
                             $scope.logisticsInfo = eval ("(" + response.traces + ")");
                             if($scope.logisticsInfo.length != 0) {
                                 $scope.hasInfo = true;
-                            }
+                            } else {
+                                $scope.hasInfo = false;
+							}
                         }
                     }, function(err){
                         toaster.pop('info', err.data);
@@ -479,6 +482,8 @@ define(['app/app'], function(app) {
 							$scope.logisticsInfo = eval ("(" + response.traces + ")");
 							if($scope.logisticsInfo.length !=0){
 								$scope.hasInfo = true;
+							} else {
+                                $scope.hasInfo = false;
 							}
 						}
 					}, function(){

+ 6 - 14
src/main/webapp/resources/view/usercenter/forstore/product_upload.html

@@ -616,21 +616,13 @@
                                 <a href="javascript:void(0)" ng-click="upload()" ng-disabled="!batch.myFiles[0]" class="blue-bg" style="margin-left: 18px;">确认上传</a>
                             </div>
                             <!--批量删除操作-->
-                           <!-- <div class="check fr">
-                                <a  ng-click="">批量操作</a>
-                                <span class="check-btn">
-                                    <label class="check-active">
-                                        <input type="checkbox" id="AllChoose"/>
-                                        <label for="AllChoose"></label>
-                                        <span>全选</span>
-                                    </label>
-                                    <a href="#">删除</a>
-                                    <a href="#">取消</a>
-                                    <a href="#">确定</a>
-                                </span>
-                            </div>-->
                         </div>
-                        <div class="txt-info" ng-if="result && result.total != 0 && !hadImport">成功导入 <span ng-bind="result.success + result.failure">600</span> 个产品(其中标准产品 <span ng-bind="result.success">200</span> 个,非标产品 <span ng-bind="result.failure">400</span> 个)<b class="success-hidden" ng-if="result.filter != 0">,下载 <a ng-click="downloadExcel()">导入失败产品</a></b></div>
+                        <div class="txt-info" ng-if="result && result.total != 0 && !hadImport">
+                            成功导入 <span ng-bind="result.assignSuccess">600</span> 个产品
+                            <!--(其中标准产品
+                            <span ng-bind="result.success">200</span> 个,非标产品
+                            <span ng-bind="result.failure">400</span> 个)-->
+                            <b class="success-hidden" ng-if="result.assignFailure != 0">,下载 <a ng-click="downloadExcel()">导入失败产品</a></b></div>
                         <div ng-show="$$productOn.tab == 'bathOn' && isPcbStore">
                             <table ng-table="relTableParams" class="public-tab table">
                                 <thead>