فهرست منبع

Merge remote-tracking branch 'origin/dev-mysql' into function-productModify-hulh-0312

# Conflicts:
#	src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js
#	src/main/webapp/resources/view/vendor/forstore/vendor_material.html
#	src/main/webapp/resources/view/vendor/forstore/vendor_onSale.html
dongbw 7 سال پیش
والد
کامیت
1b1508eff2
100فایلهای تغییر یافته به همراه4666 افزوده شده و 758 حذف شده
  1. BIN
      jpg
  2. BIN
      pdf
  3. 6 11
      pom.xml
  4. 103 0
      src/main/java/com/uas/platform/b2c/b2b/controller/ManageController.java
  5. 15 0
      src/main/java/com/uas/platform/b2c/b2b/dao/EnterpriseBaseInfoDao.java
  6. 105 0
      src/main/java/com/uas/platform/b2c/b2b/model/EnterpriseBaseInfo.java
  7. 22 0
      src/main/java/com/uas/platform/b2c/b2b/service/EnterpriseBaseInfoService.java
  8. 63 0
      src/main/java/com/uas/platform/b2c/b2b/service/impl/EnterpriseBaseInfoServiceImpl.java
  9. 50 3
      src/main/java/com/uas/platform/b2c/common/account/controller/EnterpriseController.java
  10. 20 10
      src/main/java/com/uas/platform/b2c/common/account/controller/SecurityController.java
  11. 71 1
      src/main/java/com/uas/platform/b2c/common/account/model/Enterprise.java
  12. 10 0
      src/main/java/com/uas/platform/b2c/common/account/model/UserInfo.java
  13. 20 0
      src/main/java/com/uas/platform/b2c/common/account/service/EnterpriseService.java
  14. 92 9
      src/main/java/com/uas/platform/b2c/common/account/service/impl/EnterpriseServiceImpl.java
  15. 37 6
      src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/EnterpriseServiceImpl.java
  16. 5 1
      src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/UserServiceImpl.java
  17. 183 0
      src/main/java/com/uas/platform/b2c/common/message/model/MessageModel.java
  18. 1 1
      src/main/java/com/uas/platform/b2c/common/search/controller/SearcherController.java
  19. 16 0
      src/main/java/com/uas/platform/b2c/common/search/model/SearchHistory.java
  20. 17 11
      src/main/java/com/uas/platform/b2c/common/search/service/impl/SearcherServiceImpl.java
  21. 28 0
      src/main/java/com/uas/platform/b2c/core/config/SysConf.java
  22. 5 0
      src/main/java/com/uas/platform/b2c/core/constant/SplitChar.java
  23. 11 1
      src/main/java/com/uas/platform/b2c/core/constant/Type.java
  24. 1 0
      src/main/java/com/uas/platform/b2c/core/support/mq/PushUtils.java
  25. 1 0
      src/main/java/com/uas/platform/b2c/core/utils/PinyinUtils.java
  26. 17 1
      src/main/java/com/uas/platform/b2c/core/utils/RegexConstant.java
  27. 3 3
      src/main/java/com/uas/platform/b2c/external/erp/commodity/service/impl/ProductDetailERPServiceImpl.java
  28. 1 1
      src/main/java/com/uas/platform/b2c/external/erp/product/service/impl/KindServiceImpl.java
  29. 37 0
      src/main/java/com/uas/platform/b2c/external/erp/product/service/impl/ProductServiceImpl.java
  30. 530 484
      src/main/java/com/uas/platform/b2c/external/erp/product/util/ModelConverter.java
  31. 1 1
      src/main/java/com/uas/platform/b2c/logistics/model/DistributionRule.java
  32. 4 1
      src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributionRuleServiceImpl.java
  33. 8 2
      src/main/java/com/uas/platform/b2c/prod/commodity/constant/StringConstant.java
  34. 51 0
      src/main/java/com/uas/platform/b2c/prod/commodity/controller/BackgroundRecordController.java
  35. 29 6
      src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsController.java
  36. 38 1
      src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsHistoryController.java
  37. 81 0
      src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsModifyInfoController.java
  38. 6 5
      src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java
  39. 24 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/BackgroundRecordDao.java
  40. 8 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/GoodsDao.java
  41. 9 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/GoodsHistoryDao.java
  42. 25 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/GoodsModifyInfoDao.java
  43. 13 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/ModifyInfoDao.java
  44. 2 2
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java
  45. 6 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductPersonDao.java
  46. 19 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductReplaceDao.java
  47. 24 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/TitleDao.java
  48. 11 0
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/V_ProductPrivateDao.java
  49. 101 0
      src/main/java/com/uas/platform/b2c/prod/commodity/model/BackgroundRecord.java
  50. 42 1
      src/main/java/com/uas/platform/b2c/prod/commodity/model/Goods.java
  51. 165 0
      src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsFilter.java
  52. 15 1
      src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsHistory.java
  53. 199 0
      src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsModifyInfo.java
  54. 122 0
      src/main/java/com/uas/platform/b2c/prod/commodity/model/ModifyInfo.java
  55. 4 2
      src/main/java/com/uas/platform/b2c/prod/commodity/model/Product.java
  56. 62 6
      src/main/java/com/uas/platform/b2c/prod/commodity/model/ProductReplace.java
  57. 2 2
      src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java
  58. 115 0
      src/main/java/com/uas/platform/b2c/prod/commodity/model/Title.java
  59. 48 0
      src/main/java/com/uas/platform/b2c/prod/commodity/model/V_ProductPrivate.java
  60. 27 0
      src/main/java/com/uas/platform/b2c/prod/commodity/service/BackgroundRecordService.java
  61. 18 0
      src/main/java/com/uas/platform/b2c/prod/commodity/service/GoodsHistoryService.java
  62. 54 0
      src/main/java/com/uas/platform/b2c/prod/commodity/service/GoodsModifyInfoService.java
  63. 20 4
      src/main/java/com/uas/platform/b2c/prod/commodity/service/GoodsService.java
  64. 1 1
      src/main/java/com/uas/platform/b2c/prod/commodity/service/ProductService.java
  65. 88 0
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/BackgroundRecordServiceImpl.java
  66. 42 0
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsHistoryServiceImpl.java
  67. 153 0
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsModifyInfoServiceImpl.java
  68. 377 40
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java
  69. 43 0
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductReplaceServiceImpl.java
  70. 14 5
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java
  71. 23 6
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java
  72. 54 0
      src/main/java/com/uas/platform/b2c/prod/commodity/status/ModifyInfoStatus.java
  73. 43 0
      src/main/java/com/uas/platform/b2c/prod/commodity/type/ModifyConstant.java
  74. 1 1
      src/main/java/com/uas/platform/b2c/prod/commodity/util/GoodsUtil.java
  75. 33 0
      src/main/java/com/uas/platform/b2c/prod/commodity/util/SetUtil.java
  76. 17 0
      src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentSubmitController.java
  77. 13 1
      src/main/java/com/uas/platform/b2c/prod/product/component/service/ComponentSubmitService.java
  78. 13 0
      src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentSubmitServiceImpl.java
  79. 4 4
      src/main/java/com/uas/platform/b2c/prod/store/api/StoreInController.java
  80. 19 1
      src/main/java/com/uas/platform/b2c/prod/store/controller/CommodityController.java
  81. 5 0
      src/main/java/com/uas/platform/b2c/prod/store/facade/CommodityFacade.java
  82. 16 0
      src/main/java/com/uas/platform/b2c/prod/store/facade/impl/CommodityFacadeImpl.java
  83. 2 2
      src/main/java/com/uas/platform/b2c/prod/store/facade/impl/StoreApplyFacadeImpl.java
  84. 31 10
      src/main/java/com/uas/platform/b2c/prod/store/facade/impl/StoreInFacadeImpl.java
  85. 41 1
      src/main/java/com/uas/platform/b2c/prod/store/model/EnterpriseSimple.java
  86. 5 0
      src/main/java/com/uas/platform/b2c/prod/store/service/CommodityService.java
  87. 15 4
      src/main/java/com/uas/platform/b2c/prod/store/service/StoreInService.java
  88. 5 0
      src/main/java/com/uas/platform/b2c/prod/store/service/impl/CommodityServiceImpl.java
  89. 1 0
      src/main/java/com/uas/platform/b2c/prod/store/service/impl/QualificationServiceImpl.java
  90. 1 0
      src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreApplyServiceImpl.java
  91. 97 35
      src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreInServiceImpl.java
  92. 10 0
      src/main/java/com/uas/platform/b2c/trade/order/dao/OrderDetailDao.java
  93. 15 0
      src/main/java/com/uas/platform/b2c/trade/seek/model/SeekPurchaseByBatch.java
  94. 163 70
      src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseBomServiceImpl.java
  95. 19 0
      src/main/java/com/uas/platform/b2c/trade/vendor/Readme.md
  96. 124 0
      src/main/java/com/uas/platform/b2c/trade/vendor/controller/VendorIntroductionController.java
  97. 21 0
      src/main/java/com/uas/platform/b2c/trade/vendor/dao/InviteVendorHistoryDao.java
  98. 107 0
      src/main/java/com/uas/platform/b2c/trade/vendor/model/InviteVendorHistory.java
  99. 204 0
      src/main/java/com/uas/platform/b2c/trade/vendor/model/VendorIntroduction.java
  100. 23 0
      src/main/java/com/uas/platform/b2c/trade/vendor/service/InviteVendorHistoryService.java


+ 6 - 11
pom.xml

@@ -73,11 +73,6 @@
 			<artifactId>b2c-erp-api</artifactId>
 			<version>0.0.2-SNAPSHOT</version>
 		</dependency>
-		<dependency>
-			<groupId>com.uas.api</groupId>
-			<artifactId>b2c-manage-api</artifactId>
-			<version>0.0.1</version>
-		</dependency>
 		<dependency>
 			<groupId>com.caucho</groupId>
 			<artifactId>hessian</artifactId>
@@ -408,12 +403,6 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
-
-        <dependency>
-            <groupId>net.sourceforge.pinyin4j</groupId>
-            <artifactId>pinyin4j</artifactId>
-			<version>1.1.0</version>
-        </dependency>
         <!-- security -->
 		<dependency>
 			<groupId>org.springframework.security</groupId>
@@ -474,6 +463,12 @@
 			<artifactId>ps-entity</artifactId>
 			<version>0.0.1-SNAPSHOT</version>
 		</dependency>
+		<dependency>
+			<groupId>net.sourceforge.pinyin4j</groupId>
+			<artifactId>pinyin4j</artifactId>
+			<version>1.1.0</version>
+		</dependency>
+
 		<!--Hutool POI工具类(对MS Office操作)-->
 		<!--<dependency>
 			<groupId>org.apache.poi</groupId>

+ 103 - 0
src/main/java/com/uas/platform/b2c/b2b/controller/ManageController.java

@@ -0,0 +1,103 @@
+package com.uas.platform.b2c.b2b.controller;
+
+import com.uas.platform.b2c.b2b.model.EnterpriseBaseInfo;
+import com.uas.platform.b2c.b2b.service.EnterpriseBaseInfoService;
+import com.uas.platform.b2c.common.base.model.AccessToken;
+import com.uas.platform.b2c.common.base.service.AccessTokenService;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.rmi.AccessException;
+import java.util.Arrays;
+
+/**
+ * b2b操作
+ *
+ * Created by hejq on 2018-04-20.
+ */
+@RequestMapping("/b2b/manage")
+@RestController
+public class ManageController {
+
+    @Autowired
+    private AccessTokenService accessTokenService;
+
+    @Autowired
+    private SysConf sysConf;
+
+    @Autowired
+    private EnterpriseBaseInfoService baseInfoService;
+
+    /**
+     * 操作日志
+     */
+    private UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+    /**
+     * 定义可以访问的公司
+     */
+    private static final Long[] ACCESS_ENUU = {1000001L, 10044948L, 10042291L, 10042875L, 10043923L, 10041166L};
+
+    /**
+     * 通过UU号进行跳转到平台
+     *
+     * @param response HttpServletResponse
+     * @param enUU uu号
+     * @throws IOException
+     */
+    @RequestMapping("/authed/redirect/{enUU}")
+    public void redirect(HttpServletResponse response, HttpServletRequest request, @PathVariable("enUU") long enUU)
+            throws IOException {
+        Object bindObj = enUU;
+        if (null == SystemSession.getUser() || null == SystemSession.getUser().getEnterprise()) {
+            throw new AccessException("请先登录");
+        }
+        if (!Arrays.asList(ACCESS_ENUU).contains(SystemSession.getUser().getEnterprise().getUu())) {
+            throw new AccessException("没有访问权限");
+        }
+        AccessToken token = accessTokenService.createNew(bindObj);
+        request.getSession().setAttribute("user", SystemSession.getUser());
+        StringBuffer redirectUrl = new StringBuffer();
+        String domain = sysConf.getB2bDomain();
+        if (StringUtils.hasText(domain)) {
+            // 防止使用同一个www.ubtob.com造成session冲突
+            redirectUrl.append("http://").append(enUU).append(".").append(domain);
+        } else {
+            redirectUrl.append(sysConf.getB2bUrl());
+        }
+        redirectUrl.append("?client_type=manage&access_token=").append(token.getId());
+        logger.log("管理员访问B2B", "通过商务平台后台访问B2B");
+        response.sendRedirect(redirectUrl.toString());
+    }
+
+    /**
+     * 分页查询B2B注册信息
+     *
+     * @param params 分页参数
+     * @param keyword 关键词
+     * @return
+     */
+    @RequestMapping(value = "/enterpriseList", method = RequestMethod.GET)
+    @ApiOperation(value = "分页获取平台所有注册企业信息", httpMethod = "GET")
+    public Page<EnterpriseBaseInfo> findEnterPageByStatus(@ApiParam(required = true, value = "分页参数") PageParams params, @ApiParam(required = true, value = "搜索字符串") String keyword) {
+        PageInfo info = new PageInfo(params);
+        logger.log("管理平台获取企业列表", "通过[" + keyword + "]获取企业信息");
+        return baseInfoService.findEnterPageByKeyword(info, keyword);
+    }
+}

+ 15 - 0
src/main/java/com/uas/platform/b2c/b2b/dao/EnterpriseBaseInfoDao.java

@@ -0,0 +1,15 @@
+package com.uas.platform.b2c.b2b.dao;
+
+import com.uas.platform.b2c.b2b.model.EnterpriseBaseInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 企业基本信息
+ *
+ * Created by hejq on 2018-04-20.
+ */
+@Repository
+public interface EnterpriseBaseInfoDao extends JpaRepository<EnterpriseBaseInfo, Long>, JpaSpecificationExecutor<EnterpriseBaseInfo> {
+}

+ 105 - 0
src/main/java/com/uas/platform/b2c/b2b/model/EnterpriseBaseInfo.java

@@ -0,0 +1,105 @@
+package com.uas.platform.b2c.b2b.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 企业信息基本信息
+ *
+ * Created by hejq on 2018-04-20.
+ */
+@Entity
+@Table(name = "sec$enterprises")
+public class EnterpriseBaseInfo implements Serializable {
+
+    /**
+     * 序列号
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 企业UU号
+     */
+    @Id
+    @Column(name = "en_uu")
+    private Long uu;
+
+    /**
+     * 公司名称
+     */
+    @Column(name = "en_name")
+    private String enName;
+
+    /**
+     * 注册地址
+     */
+    @Column(name = "en_address")
+    private String enAddress;
+
+    /**
+     * 商业登记证号
+     */
+    @Column(name = "en_businesscode")
+    private String enBussinessCode;
+
+    /**
+     * 注册时间
+     */
+    @Column(name = "en_time")
+    private Date enDate;
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
+    public String getEnName() {
+        return enName;
+    }
+
+    public void setEnName(String enName) {
+        this.enName = enName;
+    }
+
+    public String getEnAddress() {
+        return enAddress;
+    }
+
+    public void setEnAddress(String enAddress) {
+        this.enAddress = enAddress;
+    }
+
+    public String getEnBussinessCode() {
+        return enBussinessCode;
+    }
+
+    public void setEnBussinessCode(String enBussinessCode) {
+        this.enBussinessCode = enBussinessCode;
+    }
+
+    public Date getEnDate() {
+        return enDate;
+    }
+
+    public void setEnDate(Date enDate) {
+        this.enDate = enDate;
+    }
+
+    @Override
+    public String toString() {
+        return "EnterpriseBaseInfo{" +
+                "uu=" + uu +
+                ", enName='" + enName + '\'' +
+                ", enAddress='" + enAddress + '\'' +
+                ", enBussinessCode='" + enBussinessCode + '\'' +
+                ", enDate=" + enDate +
+                '}';
+    }
+}

+ 22 - 0
src/main/java/com/uas/platform/b2c/b2b/service/EnterpriseBaseInfoService.java

@@ -0,0 +1,22 @@
+package com.uas.platform.b2c.b2b.service;
+
+import com.uas.platform.b2c.b2b.model.EnterpriseBaseInfo;
+import com.uas.platform.core.model.PageInfo;
+import org.springframework.data.domain.Page;
+
+/**
+ * 企业基本信息操作接口
+ *
+ * Created by hejq on 2018-04-20.
+ */
+public interface EnterpriseBaseInfoService {
+
+    /**
+     * 分页查询企业信息
+     *
+     * @param info 分页参数
+     * @param keyword 关键字
+     * @return
+     */
+    Page<EnterpriseBaseInfo> findEnterPageByKeyword(PageInfo info, String keyword);
+}

+ 63 - 0
src/main/java/com/uas/platform/b2c/b2b/service/impl/EnterpriseBaseInfoServiceImpl.java

@@ -0,0 +1,63 @@
+package com.uas.platform.b2c.b2b.service.impl;
+
+import com.uas.platform.b2c.b2b.dao.EnterpriseBaseInfoDao;
+import com.uas.platform.b2c.b2b.model.EnterpriseBaseInfo;
+import com.uas.platform.b2c.b2b.service.EnterpriseBaseInfoService;
+import com.uas.platform.b2c.fa.payment.utils.StringUtils;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.persistence.criteria.PredicateUtils;
+import com.uas.platform.core.persistence.criteria.SimpleExpression;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+/**
+ * 企业基本信息操作实现
+ *
+ * Created by hejq on 2018-04-20.
+ */
+@Service
+public class EnterpriseBaseInfoServiceImpl implements EnterpriseBaseInfoService {
+
+    @Autowired
+    private EnterpriseBaseInfoDao baseInfoDao;
+
+    /**
+     * UU号正则表达式
+     */
+    static final String UU_REGEXP = "^\\d{4,}$";
+
+    /**
+     * 分页查询企业信息
+     *
+     * @param info    分页参数
+     * @param keyword 关键字
+     * @return
+     */
+    @Override
+    public Page<EnterpriseBaseInfo> findEnterPageByKeyword(final PageInfo info, String keyword) {
+        if (!StringUtils.isEmpty(keyword)) {
+            SimpleExpression name = PredicateUtils.like("enName", keyword, false);
+            if (keyword.matches(UU_REGEXP)) {
+                SimpleExpression enUU = PredicateUtils.eq("uu", keyword, false);
+                SimpleExpression[] expressions = new SimpleExpression[]{name, enUU};
+                info.expression(PredicateUtils.or(expressions));
+            } else {
+                SimpleExpression[] expressions = new SimpleExpression[]{name};
+                info.expression(PredicateUtils.or(expressions));
+            }
+        }
+        return baseInfoDao.findAll(new Specification<EnterpriseBaseInfo>() {
+            public Predicate toPredicate(Root<EnterpriseBaseInfo> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+                query.where(info.getPredicates(root, query, builder));
+                return null;
+            }
+        }, info);
+    }
+}

+ 50 - 3
src/main/java/com/uas/platform/b2c/common/account/controller/EnterpriseController.java

@@ -1,19 +1,22 @@
 package com.uas.platform.b2c.common.account.controller;
 
 import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.FormEnterprise;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.account.model.UserBaseInfo;
-import com.uas.platform.b2c.common.account.model.FormEnterprise;
 import com.uas.platform.b2c.common.account.service.EnterpriseService;
 import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.common.search.util.PageParams;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.fa.payment.utils.StringUtils;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.prod.store.service.StoreInService;
+import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.sso.core.Status;
 import com.uas.sso.entity.ApplyUserSpaceView;
 import com.uas.sso.entity.UserSpaceDetail;
 import com.uas.sso.entity.UserSpaceView;
-import com.uas.sso.entity.UserView;
 import com.uas.sso.support.Page;
 import com.uas.sso.util.AccountUtils;
 import org.apache.commons.collections.CollectionUtils;
@@ -81,7 +84,11 @@ public class EnterpriseController {
 	 * @return
 	 */
 	@RequestMapping(value = "/{enuu}/info", method = RequestMethod.POST)
-	public Enterprise updateEnterprise(@PathVariable Long enuu , @RequestBody Enterprise enterprise) {
+	public Enterprise updateEnterprise(@PathVariable Long enuu, @RequestBody Enterprise enterprise) {
+		Enterprise enterpriseInfo = enterpriseService.getEnterpriseInfo(enuu);
+		if (enterpriseInfo.getEnAdminuu() == null) {
+			throw new IllegalArgumentException("企业数据异常,管理员缺失!");
+		}
 		enterprise = enterpriseService.save(enterprise);
 		SystemSession.getUser().setCurrentEnterprise(enterprise.getUu());
 		return enterprise;
@@ -306,4 +313,44 @@ public class EnterpriseController {
 		}
 		return ResultMap.success(count);
 	}
+
+    @RequestMapping(value = "/findApplyToMall", method = RequestMethod.GET)
+    public Page<ApplyUserSpaceView> findApplyToMall(Long spaceUU, PageParams params, String keyword, Integer status) {
+        Page<ApplyUserSpaceView> applyAllToMall = null;
+	    try {
+            applyAllToMall = AccountUtils.findApplyAllToMall(spaceUU, params.getPage(), params.getSize(), status, keyword);
+        } catch (Exception e) {
+            throw new IllegalArgumentException("系统异常");
+        }
+        return applyAllToMall;
+    }
+
+    @RequestMapping(value = "/auditApply", method = RequestMethod.GET)
+    public String auditApply(Long userUU, Long id, Integer status) {
+	    String auditApply = null;
+        try {
+            // status == 1 时,申请通过
+            if (status == 1){
+                auditApply = AccountUtils.auditApply(userUU, id, Status.AGREE.getCode());
+            } else {
+                auditApply = AccountUtils.auditApply(userUU, id, Status.DISAGREE.getCode());
+            }
+        } catch (Exception e) {
+            throw new IllegalArgumentException("系统异常");
+        }
+        return auditApply;
+    }
+
+
+	/**
+	 * 返回企业电话号码和管理员电话号码;
+	 * @param enuu
+	 */
+	@RequestMapping(value = "/{enuu}/tels", method = RequestMethod.GET)
+	public ResultMap getEntelAndAdmintel(@PathVariable Long enuu){
+		if (enuu == null) {
+			throw new IllegalArgumentException("企业uu没有传值!");
+		}
+		return enterpriseService.getEntelAndAdmintel(enuu);
+	}
 }

+ 20 - 10
src/main/java/com/uas/platform/b2c/common/account/controller/SecurityController.java

@@ -349,11 +349,9 @@ public class SecurityController {
 	 * @param request
 	 * @param response
 	 */
-	@RequestMapping(value = "/newLogin/other")
+	@RequestMapping(value = "/newLogin/other", produces = {"application/javascript"})
 	@ResponseBody
 	public String afterCrossLogin(HttpServletRequest request, HttpServletResponse response, UserAccount userAccount, Integer maxage) {
-		String callback =request.getParameter("jsoncallback");
-		response.setContentType("text/html;charset=UTF-8");
 		if (userAccount != null && userAccount.getMobile() != null) {
 			SSOToken tk = new SSOToken();
 			tk.setUid(userAccount.getMobile());
@@ -388,7 +386,7 @@ public class SecurityController {
 					return "successCallback({success:'0'})";
 				}*/
 				user.setIp(AgentUtils.getIp(request));
-				request.getSession().setAttribute("user", user);
+				request.getSession().setAttribute("  user", user);
 				SystemSession.setUser(user);
 				log(request, user);
 			}
@@ -448,7 +446,7 @@ public class SecurityController {
 	 */
 	@RequestMapping(value = "/logout/crossBefore")
 	@ResponseBody
-	public ModelMap getCrossLogoutData(HttpServletRequest request, HttpServletResponse response) throws IOException {
+	public ModelMap getCrossLogoutData(HttpServletRequest request, HttpServletResponse response, String returnUrl) throws IOException {
 		SSOHelper.clearLogin(request, response);
 		ModelMap model = new ModelMap();
 		SSOConfig config = SSOHelper.getSSOService().getConfig();
@@ -459,7 +457,11 @@ public class SecurityController {
 		Object logoutUrl = null;
 		boolean cross = SSOHelper.isCrossDomain(request);
 		if (cross) {
-			logoutUrl = SSOHelper.getRedirectRefererLogoutUrl(request);
+            if (StringUtils.isEmpty(returnUrl)) {
+                logoutUrl = SSOHelper.getRedirectRefererLogoutUrl(request);
+            } else {
+                logoutUrl = SSOHelper.getRedirectLogoutUrl(request, returnUrl);
+            }
 		} else {
 			logoutUrl = SSOHelper.getRedirectLogoutUrl(request, String.valueOf(request.getSession().getAttribute("SSOReferer")));
 		}
@@ -498,7 +500,9 @@ public class SecurityController {
 							UserSpaceView userSpaceDetail = null;
 							try {
 								userSpaceDetail = AccountUtils.findByBusinessCode(tokenUser.getBusinessCode());
-							} catch (Exception e) { }
+							} catch (Exception e) {
+								e.printStackTrace();
+							}
 							if (null != userSpaceDetail) {
 								enterpriseService.update(userSpaceDetail);
 							}
@@ -528,7 +532,9 @@ public class SecurityController {
 							userLoginTime.setLoginTime(System.currentTimeMillis());
 							try {
 								userLoginTimeDao.save(userLoginTime);
-							}catch (Exception e){}
+							}catch (Exception e){
+								e.printStackTrace();
+							}
 							break;
 						}
 					}
@@ -569,7 +575,9 @@ public class SecurityController {
 							UserSpaceDetail userSpaceDetail = null;
 							try {
 								userSpaceDetail = com.uas.account.util.AccountUtils.findByBusinessCode(tokenUser.getSpaceUID());
-							} catch (Exception e) { }
+							} catch (Exception e) {
+								e.printStackTrace();
+							}
 							UserSpace userSpace = new UserSpace();
 							userSpace.setDialectUID(tokenUser.getSpaceDialectUID());
 							if (null != userSpaceDetail) {
@@ -601,7 +609,9 @@ public class SecurityController {
 							userLoginTime.setLoginTime(System.currentTimeMillis());
 							try {
 								userLoginTimeDao.save(userLoginTime);
-							}catch (Exception e){}
+							}catch (Exception e){
+								e.printStackTrace();
+							}
 							break;
 						}
 					}

+ 71 - 1
src/main/java/com/uas/platform/b2c/common/account/model/Enterprise.java

@@ -16,7 +16,10 @@ import java.util.Date;
  * @author yingp
  */
 @Entity
-@Table(name = "sec$enterprises")
+@Table(name = "sec$enterprises", indexes = {
+		@Index(name = "en_name_index", columnList = "en_name"),
+		@Index(name = "en_address_index", columnList = "en_address"),
+		@Index(name = "en_industry_index", columnList = "en_industry"), })
 @Cacheable
 @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2c.model.EnterpriseUas")
 public class Enterprise implements Serializable {
@@ -75,6 +78,21 @@ public class Enterprise implements Serializable {
 	 */
 	@Column(name = "en_fax")
 	private String enFax;
+	/**
+	 * 手机
+	 */
+	@Column(name = "en_phone")
+	private String enPhone;
+	/**
+	 * 微信
+	 */
+	@Column(name = "en_weixin")
+	private String enWeixin;
+	/**
+	 * QQ
+	 */
+	@Column(name = "en_qq")
+	private String enQQ;
 	/**
 	 * 公司邮箱
 	 */
@@ -156,6 +174,18 @@ public class Enterprise implements Serializable {
 	@Column(name = "en_accesssecret")
 	private String accessSecret;
 
+	/**
+	 * 企业认证状态;
+	 */
+	@Column(name = "en_validcode")
+	private Short enValidCode;
+
+	/**
+	 * 企业经营范围;
+	 */
+	@Column(name = "en_Businessscope",columnDefinition = "TEXT")
+	private String enBusinessScope;
+
 	@Transient
 	private Integer receiptStatus;
 
@@ -345,6 +375,38 @@ public class Enterprise implements Serializable {
 		this.receiptStatus = receiptStatus;
 	}
 
+	public Short getEnValidCode() {
+		return enValidCode;
+	}
+
+	public void setEnValidCode(Short enValidCode) {
+		this.enValidCode = enValidCode;
+	}
+
+	public String getEnPhone() {
+		return enPhone;
+	}
+
+	public void setEnPhone(String enPhone) {
+		this.enPhone = enPhone;
+	}
+
+	public String getEnWeixin() {
+		return enWeixin;
+	}
+
+	public void setEnWeixin(String enWeixin) {
+		this.enWeixin = enWeixin;
+	}
+
+	public String getEnQQ() {
+		return enQQ;
+	}
+
+	public void setEnQQ(String enQQ) {
+		this.enQQ = enQQ;
+	}
+
 	@Override
 	public int hashCode() {
 		final int prime = 31;
@@ -416,4 +478,12 @@ public class Enterprise implements Serializable {
 		return this.enMallVendorStatus != null && Status.ENABLED.value() == this.enMallVendorStatus;
 	}
 
+
+	public String getEnBusinessScope() {
+		return enBusinessScope;
+	}
+
+	public void setEnBusinessScope(String enBusinessScope) {
+		this.enBusinessScope = enBusinessScope;
+	}
 }

+ 10 - 0
src/main/java/com/uas/platform/b2c/common/account/model/UserInfo.java

@@ -38,6 +38,7 @@ public class UserInfo {
 			for (Enterprise enterprise : user.getEnterprises()) {
 				SimpleEnterpriseInfo simpleEnterpriseInfo= new SimpleEnterpriseInfo();
 				simpleEnterpriseInfo.setEnName(enterprise.getEnName());
+				simpleEnterpriseInfo.setEnValidCode(enterprise.getEnValidCode());
 				simpleEnterpriseInfo.setUu(enterprise.getUu());
 				simpleEnterpriseInfo.setIsVendor(enterprise.getEnMallVendorStatus());
 				simpleEnterpriseInfo.setEnBussinessCode(enterprise.getEnBussinessCode());
@@ -283,6 +284,7 @@ class SimpleEnterpriseInfo{
 	String enBussinessCode;
 	Long lastLoginTime;
 	Long enAdminuu;
+	Short enValidCode;
 
 	public SimpleEnterpriseInfo(){
 		this.setLastLoginTime(0L);
@@ -351,4 +353,12 @@ class SimpleEnterpriseInfo{
 	public void setEnAdminuu(Long enAdminuu) {
 		this.enAdminuu = enAdminuu;
 	}
+
+	public Short getEnValidCode() {
+		return enValidCode;
+	}
+
+	public void setEnValidCode(Short enValidCode) {
+		this.enValidCode = enValidCode;
+	}
 }

+ 20 - 0
src/main/java/com/uas/platform/b2c/common/account/service/EnterpriseService.java

@@ -5,6 +5,8 @@ import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.common.account.model.FormEnterprise;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.account.model.UserBaseInfo;
+import com.uas.platform.b2c.prod.store.model.EnterpriseSimple;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.trade.support.ResultMap;
 
 import java.util.List;
@@ -33,6 +35,9 @@ public interface EnterpriseService {
 	 * @return
 	 */
 	public Enterprise save(Enterprise enterprise);
+
+
+
 	/**
 	 * 根据注册地址确定币别
 	 * @return
@@ -71,4 +76,19 @@ public interface EnterpriseService {
 	Enterprise openVendor(Long enUU , boolean isRead , boolean isOpen);
 
 
+	/**
+	 * 根据传来的企业uu查找其entel和admin电话(验证营业执照)
+	 * @return 店铺信息
+	 */
+	ResultMap getEntelAndAdmintel(Long enUU);
+
+
+	/**
+	 * 企业和企业概要之间的转化;
+	 * @return 店铺信息
+	 */
+	EnterpriseSimple getNewEnterpriseSimple(Enterprise enterprise, StoreIn storeIn);
+
+
+
 }

+ 92 - 9
src/main/java/com/uas/platform/b2c/common/account/service/impl/EnterpriseServiceImpl.java

@@ -12,25 +12,26 @@ import com.uas.platform.b2c.common.account.service.EnterpriseService;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.logistics.dao.ReceiptDao;
 import com.uas.platform.b2c.logistics.model.Receipt;
-import com.uas.platform.b2c.trade.aftersale.model.ReturnFB2c;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.EnterpriseSimple;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.exception.SystemException;
 import com.uas.platform.core.model.Status;
-import com.uas.sso.entity.UserSpaceDetail;
 import com.uas.sso.entity.UserSpaceView;
 import com.uas.sso.entity.UserView;
 import com.uas.sso.util.AccountUtils;
 import org.apache.commons.collections.CollectionUtils;
-import org.hibernate.loader.custom.Return;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.stereotype.Service;
-import org.springframework.ui.ModelMap;
 import org.springframework.util.StringUtils;
 
-import java.lang.reflect.Array;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service
 public class EnterpriseServiceImpl implements EnterpriseService{
@@ -43,11 +44,13 @@ public class EnterpriseServiceImpl implements EnterpriseService{
 
 	@Autowired
 	private UserBaseInfoDao userBaseInfoDao;
+	@Autowired
+	private StoreInDao storeInDao;
+
 
-	
 	@Override
 	public Enterprise getEnterpriseInfo(Long uu) {
-		
+
 		return enterpriseDao.findByUu(uu);
 	}
 
@@ -113,9 +116,18 @@ public class EnterpriseServiceImpl implements EnterpriseService{
 		}
 	}
 
+
+
 	@Override
 	public Enterprise save(Enterprise enterprise) {
 		Enterprise existEnterprise = enterpriseDao.findOne(enterprise.getUu());
+		//更新店铺中的企业信息
+		List<StoreIn> storeIns = storeInDao.findByEnUU(enterprise.getUu());
+		for (StoreIn storeIn : storeIns) {
+			EnterpriseSimple newEnterprise = getNewEnterpriseSimple(enterprise, storeIn);
+			storeIn.setEnterprise(newEnterprise);
+			storeInDao.save(storeIn);
+		}
 		if (existEnterprise == null)
 			throw new IllegalArgumentException();
 		try {
@@ -126,6 +138,58 @@ public class EnterpriseServiceImpl implements EnterpriseService{
 		}
 		return enterpriseDao.save(enterprise);
 	}
+	@Override
+	public EnterpriseSimple getNewEnterpriseSimple(Enterprise enterprise, StoreIn storeIn) {
+		EnterpriseSimple newEnterprise;
+		newEnterprise = new EnterpriseSimple();
+		EnterpriseSimple enterpriseOld = storeIn.getEnterprise();
+		BeanUtils.copyProperties(enterpriseOld,newEnterprise);
+		if (enterpriseOld != null) {
+            if (enterprise.getEnName() !=null) {
+                newEnterprise.setEnName(enterprise.getEnName());
+            }
+            if (enterprise.getEnAddress() !=null) {
+                newEnterprise.setEnAddress(enterprise.getEnAddress());
+            }
+            if (enterprise.getEnFax() !=null) {
+                newEnterprise.setEnFax(enterprise.getEnFax());
+            }
+            if (enterprise.getEnTel() !=null) {
+                newEnterprise.setEnTel(enterprise.getEnTel());
+            }
+            if (enterprise.getEnType() !=null) {
+                newEnterprise.setEnType(enterprise.getEnType());
+            }
+            if (enterprise.getEnBussinessCode() !=null) {
+                newEnterprise.setEnBusinessCode(enterprise.getEnBussinessCode());
+            }
+            if (enterprise.getEnDate() !=null) {
+                newEnterprise.setEnDate(enterprise.getEnDate());
+            }
+            if (enterprise.getEnUrl() !=null) {
+                newEnterprise.setEnUrl(enterprise.getEnUrl());
+            }
+            if (enterprise.getEnLogoUrl() !=null) {
+                newEnterprise.setEnLogoUrl(enterprise.getEnLogoUrl());
+            }
+            if (enterprise.getEnEmail() !=null) {
+                newEnterprise.setEnLogoUrl(enterprise.getEnEmail());
+            }
+            if (enterprise.getEnPhone() !=null) {
+                newEnterprise.setEnLogoUrl(enterprise.getEnPhone());
+            }
+            if (enterprise.getEnWeixin() !=null) {
+                newEnterprise.setEnLogoUrl(enterprise.getEnWeixin());
+            }
+            if (enterprise.getEnQQ() !=null) {
+                newEnterprise.setEnLogoUrl(enterprise.getEnQQ());
+            }
+        } else {
+            newEnterprise = EnterpriseSimple.translateSimple(enterprise);
+        }
+		return newEnterprise;
+	}
+
 
 	private void postToAccountCenter(Enterprise enterprise) throws Exception {
 	/*	UserSpaceDetail detail = new UserSpaceDetail();
@@ -255,4 +319,23 @@ public class EnterpriseServiceImpl implements EnterpriseService{
 		Enterprise enterprise = enterpriseDao.save(existEnterprise);
 		return null;
 	}
+
+	@Override
+	public ResultMap getEntelAndAdmintel(Long enUU) {
+		ResultMap resultMap = new ResultMap();
+		HashMap<String, String> tels = new HashMap<>();
+		Enterprise enterprise = enterpriseDao.findOne(enUU);
+		if (enterprise != null && enterprise.getEnAdminuu() != null) {
+			UserBaseInfo userBaseInfo = userBaseInfoDao.findUserByUserUU(enterprise.getEnAdminuu());
+			if (!StringUtils.isEmpty(userBaseInfo.getUserTel())) {
+				tels.put("adminTel", userBaseInfo.getUserTel());
+			}
+		}
+		if (enterprise != null && !StringUtils.isEmpty(enterprise.getEnTel())) {
+			tels.put("entel", enterprise.getEnTel());
+			tels.put("enuu", enterprise.getUu()+"");
+		}
+		resultMap.setData(tels);
+		return resultMap;
+	}
 }

+ 37 - 6
src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/EnterpriseServiceImpl.java

@@ -9,6 +9,10 @@ import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.account.v2.service.EnterpriseService;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.fa.payment.utils.StringUtils;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.EnterpriseSimple;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.sso.entity.UserSpaceView;
 import org.apache.commons.collections.CollectionUtils;
@@ -27,8 +31,13 @@ public class EnterpriseServiceImpl implements EnterpriseService {
 	@Autowired
 	private EnterpriseDao enterpriseDao;
 
+    @Autowired
+	private com.uas.platform.b2c.common.account.service.EnterpriseService enterpriseService;
+
 	@Autowired
     private UserDao userDao;
+    @Autowired
+	private StoreInDao storeInDao;
 
     private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
 
@@ -52,12 +61,21 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         if (enterprise == null || enterprise.getUu() == null) {
             enterprise = new Enterprise();
         }
+        if (!StringUtils.isEmpty(userSpaceView.getAccessSecret())) {
+            enterprise.setAccessSecret(userSpaceView.getAccessSecret());
+        }
         enterprise.setEnAddress(userSpaceView.getRegAddress());
         //enterprise.setEnArea(userSpaceView.get());
         enterprise.setEnCorporation(userSpaceView.getCorporation());
         enterprise.setEnBussinessCode(userSpaceView.getBusinessCode());
-        enterprise.setEnFax(userSpaceView.getTelephone());
-        enterprise.setEnTel(userSpaceView.getTelephone());
+       // enterprise.setEnFax(userSpaceView.);
+        String enTel = enterprise.getEnTel();
+        if (enTel == null) {
+            enterprise.setEnTel(userSpaceView.getTelephone());
+            if (userSpaceView.getTelephone() == null) {
+                enterprise.setEnTel(userSpaceView.getAdmin().getMobile());
+            }
+        }
         //enterprise.setEnEmail(userSpaceView.get());
         //enterprise.setEnIndustry(userSpaceView.());
         enterprise.setEnName(userSpaceView.getSpaceName());
@@ -65,6 +83,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         enterprise.setUu(Long.valueOf(userSpaceView.getSpaceUU()));
         //Long userUU = admins.get(0).getUserUU();
         enterprise.setEnAdminuu(userSpaceView.getAdminUU());
+        enterprise.setEnValidCode(userSpaceView.getValidCode());
         Enterprise newEn = enterpriseDao.save(enterprise);
 
         User adminUser = null;
@@ -76,17 +95,27 @@ public class EnterpriseServiceImpl implements EnterpriseService {
                 adminUser = users.get(0);
             }
         }
-
         // 保存新注册企业与用户的关联关系
         if (adminUser != null) {
             adminUser.addEnterprise(newEn);
             userDao.save(adminUser);
         }
-
         if(oldenterprise != null && oldenterprise.getUu() != null) {
-            logger.log("更新企业信息", enterprise.getUu()+"time: " + sdf.format(new Date()), enterprise.getUu(), 0L);
+            try {
+                List<StoreIn> storeIns = storeInDao.findByEnUU(enterprise.getUu());
+                if (storeIns != null && storeIns.size() > 0) {
+                    StoreIn storeIn = storeIns.get(0);
+                    EnterpriseSimple newEnterpriseSimple = enterpriseService.getNewEnterpriseSimple(enterprise, storeIn);
+                    storeIn.setEnterprise(newEnterpriseSimple);
+                    storeIn.setStoreName(enterprise.getEnName());
+                    storeInDao.save(storeIn);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            logger.log("更新企业信息", enterprise.getUu()+"time: " + sdf.format(new Date()), enterprise.getEnAdminuu(), 0L);
         } else {
-            logger.log("新增企业信息", enterprise.getUu()+"time: " + sdf.format(new Date()), enterprise.getUu(), 0L);
+            logger.log("新增企业信息", enterprise.getUu()+"time: " + sdf.format(new Date()), enterprise.getEnAdminuu(), 0L);
         }
     }
 
@@ -153,4 +182,6 @@ public class EnterpriseServiceImpl implements EnterpriseService {
 
 
 
+
+
 }

+ 5 - 1
src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/UserServiceImpl.java

@@ -116,7 +116,11 @@ public class UserServiceImpl implements UserService {
         }
         String imId = user.getImId();
         if (!StringUtils.isEmpty(imId)) {
-            u.setUserIMId(Long.parseLong(imId.trim()));
+            try {
+                u.setUserIMId(Long.parseLong(imId.trim()));
+            } catch (NumberFormatException e) {
+                u.setUserIMId(null);
+            }
         }
         Short lock = user.getLock();
         if (lock != null && lock == 0) {

+ 183 - 0
src/main/java/com/uas/platform/b2c/common/message/model/MessageModel.java

@@ -0,0 +1,183 @@
+package com.uas.platform.b2c.common.message.model;
+
+/**
+ * 消息公共服务 - 消息实体
+ */
+public class MessageModel {
+    /**
+     * 消息类型
+     */
+    private String type;
+    /**
+     * 消息内容
+     */
+    private String content;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 来源id
+     */
+    private Long sourceId;
+    /**
+     * 消息接收者uu
+     */
+    private Long receiverUu;
+    /**
+     * 消息接收者企业uu
+     */
+    private Long receiverEnuu;
+    /**
+     * 消息发送者
+     */
+    private Long senderUu;
+    /**
+     * 消息发送者企业uu
+     */
+    private Long senderEnuu;
+    /**
+     * 来源应用
+     */
+    private String producerApp;
+    /**
+     * 消费类型(所有应用共享:"PUBLIC",单个应用独享:"SINGLE",多个应用共享:"MULTI")
+     */
+    private String consumerType;
+    /**
+     * 推送方式类型
+     * 邮件、短信、IM:"MAIL_AND_SM_AND_IM"
+     * 邮件、短信:"MAIL_AND_SM"
+     * 邮件、IM:"MAIL_AND_IM"
+     * 短信、IM:"SM_AND_IM"
+     * 邮件:"MAIL"
+     * 短信:"SM"
+     * IM:"IM"
+     * 不发送:"DONT_SEND"
+     */
+    private String smsType;
+    /**
+     * 邮件模板id
+     */
+    private String mailTemplate;
+    /**
+     * 短息模板id
+     */
+    private String smTemplate;
+    /**
+     * 接收应用(以","拼接应用名称)
+     */
+    private String consumerApp;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Long getReceiverUu() {
+        return receiverUu;
+    }
+
+    public void setReceiverUu(Long receiverUu) {
+        this.receiverUu = receiverUu;
+    }
+
+    public Long getReceiverEnuu() {
+        return receiverEnuu;
+    }
+
+    public void setReceiverEnuu(Long receiverEnuu) {
+        this.receiverEnuu = receiverEnuu;
+    }
+
+    public Long getSenderUu() {
+        return senderUu;
+    }
+
+    public void setSenderUu(Long senderUu) {
+        this.senderUu = senderUu;
+    }
+
+    public Long getSenderEnuu() {
+        return senderEnuu;
+    }
+
+    public void setSenderEnuu(Long senderEnuu) {
+        this.senderEnuu = senderEnuu;
+    }
+
+    public String getProducerApp() {
+        return producerApp;
+    }
+
+    public void setProducerApp(String producerApp) {
+        this.producerApp = producerApp;
+    }
+
+    public String getConsumerType() {
+        return consumerType;
+    }
+
+    public void setConsumerType(String consumerType) {
+        this.consumerType = consumerType;
+    }
+
+    public String getSmsType() {
+        return smsType;
+    }
+
+    public void setSmsType(String smsType) {
+        this.smsType = smsType;
+    }
+
+    public String getMailTemplate() {
+        return mailTemplate;
+    }
+
+    public void setMailTemplate(String mailTemplate) {
+        this.mailTemplate = mailTemplate;
+    }
+
+    public String getSmTemplate() {
+        return smTemplate;
+    }
+
+    public void setSmTemplate(String smTemplate) {
+        this.smTemplate = smTemplate;
+    }
+
+    public String getConsumerApp() {
+        return consumerApp;
+    }
+
+    public void setConsumerApp(String consumerApp) {
+        this.consumerApp = consumerApp;
+    }
+
+    public Long getSourceId() {
+        return sourceId;
+    }
+
+    public void setSourceId(Long sourceId) {
+        this.sourceId = sourceId;
+    }
+}

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/search/controller/SearcherController.java

@@ -345,7 +345,7 @@ public class SearcherController {
 		User user = (User)request.getSession().getAttribute("user");
 		SystemSession.setUser(user);
 		PageInfo pageInfo = new PageInfo(params);
-		Page<StoreIn> stores = storeService.pageStoresByTypesAndKeyword(pageInfo, types, keyword);
+		Page<StoreIn> stores = storeService.pageStoresByTypesAndKeyword(pageInfo, types, keyword, request);
 		List<Map<String, Object>> result = new ArrayList<>();
 		Map<String, Object> storesMap = new HashedMap();
 		storesMap.put("stores",stores);

+ 16 - 0
src/main/java/com/uas/platform/b2c/common/search/model/SearchHistory.java

@@ -12,6 +12,8 @@ import java.util.Date;
 @Table(name = "sec$searchHis")
 public class SearchHistory implements Serializable{
 
+    private static final long serialVersionUID = 1L;
+
     /**
      * ID
      */
@@ -44,6 +46,12 @@ public class SearchHistory implements Serializable{
     @Column(name = "searchtime")
     private Date searchTime;
 
+    /**
+     * 搜索内容类型
+     */
+    @Column(name = "type")
+    private String type;
+
     public Long getId() {
         return id;
     }
@@ -83,4 +91,12 @@ public class SearchHistory implements Serializable{
     public void setSearchTime(Date searchTime) {
         this.searchTime = searchTime;
     }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
 }

+ 17 - 11
src/main/java/com/uas/platform/b2c/common/search/service/impl/SearcherServiceImpl.java

@@ -2,12 +2,16 @@ package com.uas.platform.b2c.common.search.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.uas.platform.b2c.common.search.constant.SearchParam;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.search.dao.SearchHistoryDao;
 import com.uas.platform.b2c.common.search.model.SearchHistory;
 import com.uas.platform.b2c.common.search.rpc.service.SearchService;
 import com.uas.platform.b2c.common.search.service.SearcherService;
+import com.uas.platform.b2c.common.search.util.CollectField;
+import com.uas.platform.b2c.common.search.util.PageParams.FilterField;
+import com.uas.platform.b2c.common.search.util.SPage;
+import com.uas.platform.b2c.common.search.util.Sort;
+import com.uas.platform.b2c.core.constant.Type;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
@@ -16,17 +20,23 @@ import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentGoodsDao;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentInfoDao;
-import com.uas.platform.b2c.prod.product.component.modal.Component;
 import com.uas.platform.b2c.prod.product.component.modal.ComponentGoods;
 import com.uas.platform.b2c.prod.product.component.modal.ComponentInfo;
 import com.uas.platform.core.exception.SystemException;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import com.uas.search.exception.SearchException;
-import com.uas.platform.b2c.common.search.util.CollectField;
-import com.uas.platform.b2c.common.search.util.PageParams.FilterField;
-import com.uas.platform.b2c.common.search.util.SPage;
-import com.uas.platform.b2c.common.search.util.Sort;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,11 +49,6 @@ import org.springframework.ui.ModelMap;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-
 /**
  * 搜索索引
  *
@@ -198,6 +203,7 @@ public class SearcherServiceImpl implements SearcherService {
 				searchHistory.setSearchTime(new Date(System.currentTimeMillis()));
 				searchHistory.setUserUU(SystemSession.getUser().getUserUU());
 				searchHistory.setUserEnuu(SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
+                searchHistory.setType(Type.SEARCH_PRODUCT.name());
 				searchHistoryDao.save(searchHistory);
 				searchHistories = searchHistoryDao.findByUserUUAndUserEnuuOrderBySearchTimeDesc(SystemSession.getUser().getUserUU(),SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
 				if (searchHistories.size()>10){

+ 28 - 0
src/main/java/com/uas/platform/b2c/core/config/SysConf.java

@@ -154,6 +154,18 @@ public class SysConf {
 	@Value("#{sys.searchUrl}")
 	private String messageServiceIp;
 
+	/**
+	 * b2b域名
+	 */
+	@Value("#{sys.b2bDomain}")
+	private String b2bDomain;
+
+    /**
+     * b2b网址
+     */
+	@Value(("#{sys.b2b}"))
+    private String b2bUrl;
+
 	public Boolean getRebuildIndexesOnRefresh() {
 		return rebuildIndexesOnRefresh;
 	}
@@ -333,4 +345,20 @@ public class SysConf {
 	public void setYesGateway(String yesGateway) {
 		this.yesGateway = yesGateway;
 	}
+
+	public String getB2bDomain() {
+		return b2bDomain;
+	}
+
+	public void setB2bDomain(String b2bDomain) {
+		this.b2bDomain = b2bDomain;
+	}
+
+    public String getB2bUrl() {
+        return b2bUrl;
+    }
+
+    public void setB2bUrl(String b2bUrl) {
+        this.b2bUrl = b2bUrl;
+    }
 }

+ 5 - 0
src/main/java/com/uas/platform/b2c/core/constant/SplitChar.java

@@ -21,4 +21,9 @@ public class SplitChar {
 	 */
 	public static final String AND = "&";
 
+	/**
+	 * 字符  / 字符串
+	 */
+	public static final String SLASH = "/";
+
 }

+ 11 - 1
src/main/java/com/uas/platform/b2c/core/constant/Type.java

@@ -274,7 +274,17 @@ public enum Type {
 	/**
 	 * {@code 1668 企业销售出库 <b>企业销售出库</b>}
 	 */
-	STOCK_SELLER(1668, "销售出库");
+	STOCK_SELLER(1668, "销售出库"),
+
+	/**
+	 * {@code 1700 搜索店铺}
+	 */
+	SEARCH_STORE(1700, "搜索店铺"),
+
+	/**
+	 * {@code 1701 搜索产品}
+	 */
+	SEARCH_PRODUCT(1701, "搜索产品");
 
 	/**
 	 * @param value

+ 1 - 0
src/main/java/com/uas/platform/b2c/core/support/mq/PushUtils.java

@@ -69,6 +69,7 @@ public class PushUtils {
 			// 调用推送接口
 			Pusher.push(params);
 		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
 		}
 		// }
 		// }

+ 1 - 0
src/main/java/com/uas/platform/b2c/core/utils/PinyinUtils.java

@@ -5,6 +5,7 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
 import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
 import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
 
+
 /**
  * 拼音处理工具
  * Created by wangyc on 2017/3/22.

+ 17 - 1
src/main/java/com/uas/platform/b2c/core/utils/RegexConstant.java

@@ -20,6 +20,11 @@ public class RegexConstant {
      */
     public static final String NumberData = "^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$";
 
+    /**
+     * 仅包含数字
+     */
+    public static final String ONLY_NUMBER = "^[0-9]*$";
+
     /**
      * 整数的正则表达式
      */
@@ -33,7 +38,7 @@ public class RegexConstant {
     /**
      * 判断是否只包含数字,英文,英文特殊字符
      */
-    public static final String LetterAndDigitAndEnglishSpecialCharacter = "^[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~@#¥%……&*——+|_\\-A-Za-z0-9]+$";
+    public static final String LetterAndDigitAndEnglishSpecialCharacter = "^[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~@#¥%……&*——+|_\\- A-Za-z0-9]+$";
 
     /**
      * 验证字符串是否为数字
@@ -45,4 +50,15 @@ public class RegexConstant {
         Matcher matcher = numberPattern.matcher(str);
         return matcher.find();
     }
+
+    /**
+     * 判断字符串是否只有数字
+     * @param str
+     * @return
+     */
+    public static Boolean onlyHaveNumber(String str) {
+        Pattern numberPattern = Pattern.compile(ONLY_NUMBER);
+        Matcher matcher = numberPattern.matcher(str);
+        return matcher.find();
+    }
 }

+ 3 - 3
src/main/java/com/uas/platform/b2c/external/erp/commodity/service/impl/ProductDetailERPServiceImpl.java

@@ -118,7 +118,7 @@ public class ProductDetailERPServiceImpl implements ProductDetailERPService {
                             if (!CollectionUtils.isEmpty(goods)) {
                                 for (Goods good : goods) {
                                     if (Double.compare(subtractDecimal.doubleValue(), good.getReserve()) == 0) {// 差值等于此批次数量,直接下架此批次
-                                        goodsService.offShelfGoodsByProvider(good.getBatchCode(),true);
+                                        goodsService.offShelfGoodsByProvider(good.getBatchCode(), null, true);
                                         break;
                                     }
 
@@ -129,7 +129,7 @@ public class ProductDetailERPServiceImpl implements ProductDetailERPService {
                                         loggerInfo.info(SystemSession.getUser().getEnterprise().getEnName() + "更新库存: " + products.get(0).getProdNum() + ",self is" + good.getSelfSale());
                                         // 如果调整后的库存小于最小起订量直接下架
                                         if (good.getReserve() < good.getMinBuyQty()) {
-                                            goodsService.offShelfGoodsByProvider(good.getBatchCode(),true);
+                                            goodsService.offShelfGoodsByProvider(good.getBatchCode(), null, true);
                                         } else {
                                             goodsService.updateGoodsByERP(nowGood, good);
                                             goodsService.updateComponentTradeInfos(nowGood.getUuid());
@@ -138,7 +138,7 @@ public class ProductDetailERPServiceImpl implements ProductDetailERPService {
                                     }
 
                                     if (Double.compare(subtractDecimal.doubleValue(), good.getReserve()) > 0) {// 差值大于此批次数量,下架次批次,并继续下一批次调整
-                                        goodsService.offShelfGoodsByProvider(good.getBatchCode(),true);
+                                        goodsService.offShelfGoodsByProvider(good.getBatchCode(), null, true);
                                         subtractDecimal = subtractDecimal.subtract(BigDecimal.valueOf(good.getReserve()));
                                     }
                                 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/external/erp/product/service/impl/KindServiceImpl.java

@@ -109,7 +109,7 @@ public class KindServiceImpl implements KindService {
         return kindPropertyUas;
     }
 
-    @Override
+     @Override
     public Map<String, List<KindUas>> getParentsByKindCode(String kindCode) {
         Map<Long, Kind> maps = new HashMap<>();
         // 第一步是模糊查询所有的叶子节点

+ 37 - 0
src/main/java/com/uas/platform/b2c/external/erp/product/service/impl/ProductServiceImpl.java

@@ -0,0 +1,37 @@
+package com.uas.platform.b2c.external.erp.product.service.impl;
+
+
+import com.uas.api.b2c_erp.baisc.model.Product;
+import com.uas.api.b2c_erp.baisc.service.ProductService;
+import com.uas.platform.b2c.prod.commodity.dao.ProductDao;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ERP物料服务
+ *
+ * Created by hejq on 2018-05-14.
+ */
+public class ProductServiceImpl implements ProductService {
+
+    @Autowired
+    private ProductDao productDao;
+
+
+    /**
+     * 通过型号查询信息(测试方法)
+     *
+     * @param cmpCode 原厂型号
+     * @return
+     */
+    @Override
+    public List<Product> findByCmpCode(String cmpCode) {
+        List<Product> productList = new ArrayList<>();
+        List<com.uas.platform.b2c.prod.commodity.model.Product> products = productDao.findByCmpCode(cmpCode);
+        BeanUtils.copyProperties(products, productList, Product.class);
+        return productList;
+    }
+}

+ 530 - 484
src/main/java/com/uas/platform/b2c/external/erp/product/util/ModelConverter.java

@@ -4,13 +4,14 @@ import com.uas.api.b2c_erp.baisc.model.*;
 import com.uas.api.b2c_erp.operation.model.OperationInfoUas;
 import com.uas.api.b2c_erp.seller.model.GoodsSimpleUas;
 import com.uas.api.b2c_erp.seller.model.Prod;
+import com.uas.api.b2c_erp.seller.model.ProductReplaceErp;
 import com.uas.api.domain.IPage;
 import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.core.constant.Status;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.external.erp.product.model.OperationInfo;
 import com.uas.platform.b2c.prod.commodity.model.Product;
-import com.uas.platform.b2c.prod.commodity.model.ProductPrivate;
+import com.uas.platform.b2c.prod.commodity.model.ProductReplace;
 import com.uas.platform.b2c.prod.product.brand.modal.Brand;
 import com.uas.platform.b2c.prod.product.brand.modal.BrandInfo;
 import com.uas.platform.b2c.prod.product.brand.modal.BrandSubmit;
@@ -30,511 +31,556 @@ import java.util.*;
 
 /**
  * erp<==>商城对象转换类
+ *
  * @author suntg
  * @version 2017年8月2日19:48:50 wangyc 完善注释
  */
 public class ModelConverter {
 
-	/**
-	 * 将UAS品牌申请转换成brandSubmit
-	 * 
-	 * @param uas UAS品牌申请
-	 * @return 商城品牌申请
-	 */
-	public static BrandSubmit getBrandSubmit(BrandSubmitUas uas) {
-		BrandSubmit brandSubmit = new BrandSubmit();
-		brandSubmit.setId(uas.getId());
-		brandSubmit.setApplication(uas.getApplication());
-		brandSubmit.setAchievement(uas.getAchievement());
-		brandSubmit.setArea(uas.getArea());
-		brandSubmit.setBrief(uas.getBrief());
-		brandSubmit.setUrl(uas.getUrl());
-		brandSubmit.setLogoUrl(uas.getLogoUrl());
-		brandSubmit.setNameCn(uas.getNameCn());
-		brandSubmit.setNameEn(uas.getNameEn());
-		brandSubmit.setSeries(uas.getSeries());
-		brandSubmit.setVendor(uas.getVendor());
-		brandSubmit.setSource("来自接口");
-		brandSubmit.setImid(uas.getImid());
-		brandSubmit.setUuid(uas.getUuid());
-		brandSubmit.setVersion(uas.getVersion());
-		brandSubmit.setModifyenuu(uas.getModifyenuu());
-		brandSubmit.setModifyuu(uas.getModifyuu());
-		return brandSubmit;
-	}
+    /**
+     * 将UAS品牌申请转换成brandSubmit
+     *
+     * @param uas UAS品牌申请
+     * @return 商城品牌申请
+     */
+    public static BrandSubmit getBrandSubmit(BrandSubmitUas uas) {
+        BrandSubmit brandSubmit = new BrandSubmit();
+        brandSubmit.setId(uas.getId());
+        brandSubmit.setApplication(uas.getApplication());
+        brandSubmit.setAchievement(uas.getAchievement());
+        brandSubmit.setArea(uas.getArea());
+        brandSubmit.setBrief(uas.getBrief());
+        brandSubmit.setUrl(uas.getUrl());
+        brandSubmit.setLogoUrl(uas.getLogoUrl());
+        brandSubmit.setNameCn(uas.getNameCn());
+        brandSubmit.setNameEn(uas.getNameEn());
+        brandSubmit.setSeries(uas.getSeries());
+        brandSubmit.setVendor(uas.getVendor());
+        brandSubmit.setSource("来自接口");
+        brandSubmit.setImid(uas.getImid());
+        brandSubmit.setUuid(uas.getUuid());
+        brandSubmit.setVersion(uas.getVersion());
+        brandSubmit.setModifyenuu(uas.getModifyenuu());
+        brandSubmit.setModifyuu(uas.getModifyuu());
+        return brandSubmit;
+    }
 
-	/**
-	 * 属性值转换为uas属性申请
-	 * @param property 属性值
-	 * @return uas属性申请
-	 */
-	public static PropertySubmitUas convertUas(PropertyValue property) {
-		PropertySubmitUas uas = new PropertySubmitUas();
-		uas.setPropertyId(property.getPropertyid());
-		uas.setStringValue(property.getValue());
-		uas.setMax(property.getMax());
-		uas.setMin(property.getMin());
-		uas.setNumberic(property.getNumberic());
-		uas.setDetno(property.getDetno());
-		return uas;
-	}
+    /**
+     * 属性值转换为uas属性申请
+     *
+     * @param property 属性值
+     * @return uas属性申请
+     */
+    public static PropertySubmitUas convertUas(PropertyValue property) {
+        PropertySubmitUas uas = new PropertySubmitUas();
+        uas.setPropertyId(property.getPropertyid());
+        uas.setStringValue(property.getValue());
+        uas.setMax(property.getMax());
+        uas.setMin(property.getMin());
+        uas.setNumberic(property.getNumberic());
+        uas.setDetno(property.getDetno());
+        return uas;
+    }
 
-	/**
-	 * 品牌转换为uas品牌申请
-	 * @param brand 品牌
-	 * @return uas品牌申请
-	 */
-	public static BrandSubmitUas convertUas(Brand brand) {
-		BrandSubmitUas uas = new BrandSubmitUas();
-		uas.setId(brand.getId());
-		uas.setApplication(brand.getApplication());
-		uas.setAchievement(brand.getAchievement());
-		uas.setArea(brand.getArea());
-		uas.setBrief(brand.getBrief());
-		uas.setUrl(brand.getUrl());
-		uas.setLogoUrl(brand.getLogoUrl());
-		uas.setNameCn(brand.getNameCn());
-		uas.setNameEn(brand.getNameEn());
-		uas.setSeries(brand.getSeries());
-		uas.setUuid(brand.getUuid());
-		uas.setVendor(brand.getVendor());
-		uas.setVersion(brand.getVersion());
-		return uas;
-	}
+    /**
+     * 品牌转换为uas品牌申请
+     *
+     * @param brand 品牌
+     * @return uas品牌申请
+     */
+    public static BrandSubmitUas convertUas(Brand brand) {
+        BrandSubmitUas uas = new BrandSubmitUas();
+        uas.setId(brand.getId());
+        uas.setApplication(brand.getApplication());
+        uas.setAchievement(brand.getAchievement());
+        uas.setArea(brand.getArea());
+        uas.setBrief(brand.getBrief());
+        uas.setUrl(brand.getUrl());
+        uas.setLogoUrl(brand.getLogoUrl());
+        uas.setNameCn(brand.getNameCn());
+        uas.setNameEn(brand.getNameEn());
+        uas.setSeries(brand.getSeries());
+        uas.setUuid(brand.getUuid());
+        uas.setVendor(brand.getVendor());
+        uas.setVersion(brand.getVersion());
+        return uas;
+    }
 
-	/**
-	 * 器件信息转换为uas器件申请
-	 * @param component 器件信息
-	 * @return uas器件申请
-	 */
-	public static ComponentSubmitUas convertUas(Component component) {
-		ComponentSubmitUas uas = new ComponentSubmitUas();
-		uas.setUuid(component.getUuid());
-		uas.setAttach(component.getAttach());
-		uas.setUnit(component.getUnit());
-		uas.setWeight(component.getWeight());
-		uas.setCode(component.getCode());
-		uas.setBrandid(component.getBrandid());
-		uas.setKindid(component.getKindid());
-		uas.setDescription(component.getDescription());
-		uas.setImg(component.getImg());
-		uas.setPackaging(component.getEncapsulation());
-		uas.setVersion(component.getVersion());
-		uas.setBrandName(component.getBrand().getNameCn());
-		uas.setKindNameCn(component.getKind().getNameCn());
-		Set<PropertySubmitUas> uasProperties = new HashSet<PropertySubmitUas>();
-		for (PropertyValue property : component.getProperties()) {
-			PropertySubmitUas uasProperty = ModelConverter.convertUas(property);
-			uasProperties.add(uasProperty);
-		}
-		uas.setProperties(uasProperties);
-		return uas;
-	}
+    /**
+     * 器件信息转换为uas器件申请
+     *
+     * @param component 器件信息
+     * @return uas器件申请
+     */
+    public static ComponentSubmitUas convertUas(Component component) {
+        ComponentSubmitUas uas = new ComponentSubmitUas();
+        uas.setUuid(component.getUuid());
+        uas.setAttach(component.getAttach());
+        uas.setUnit(component.getUnit());
+        uas.setWeight(component.getWeight());
+        uas.setCode(component.getCode());
+        uas.setBrandid(component.getBrandid());
+        uas.setKindid(component.getKindid());
+        uas.setDescription(component.getDescription());
+        uas.setImg(component.getImg());
+        uas.setPackaging(component.getEncapsulation());
+        uas.setVersion(component.getVersion());
+        uas.setBrandName(component.getBrand().getNameCn());
+        uas.setKindNameCn(component.getKind().getNameCn());
+        Set<PropertySubmitUas> uasProperties = new HashSet<PropertySubmitUas>();
+        for (PropertyValue property : component.getProperties()) {
+            PropertySubmitUas uasProperty = ModelConverter.convertUas(property);
+            uasProperties.add(uasProperty);
+        }
+        uas.setProperties(uasProperties);
+        return uas;
+    }
 
-	/**
-	 * uas器件申请转换为商城器件申请
-	 * @param uas uas器件申请
-	 * @return 商城器件申请
-	 */
-	public static ComponentSubmit getComponentSubmit(ComponentSubmitUas uas) {
-		ComponentSubmit componentSubmit = new ComponentSubmit();
-		componentSubmit.setId(uas.getId());
-		componentSubmit.setCode(uas.getCode());
-		componentSubmit.setEncapsulation(uas.getPackaging());
-		componentSubmit.setKindid(uas.getKindid());
-		componentSubmit.setKindName(uas.getKindNameCn());
-		componentSubmit.setBrandid(uas.getBrandid());
-		componentSubmit.setBrandName(uas.getBrandName());
-		componentSubmit.setUuid(uas.getUuid());
-		componentSubmit.setVersion(uas.getVersion());
-		componentSubmit.setImg(uas.getImg());
-		componentSubmit.setDescription(uas.getDescription());
-		componentSubmit.setImid(uas.getImid());
-		componentSubmit.setWeight(uas.getWeight());
-		componentSubmit.setUnit(uas.getUnit());
-		componentSubmit.setAttach(uas.getAttach());
-		componentSubmit.setSource("来自接口");
-		componentSubmit.setModifyenuu(uas.getModifyenuu());
-		componentSubmit.setModifyuu(uas.getModifyuu());
-		Set<PropertySubmitUas> propertiesUas = uas.getProperties();
-		Set<PropertyValueSubmit> properties = new HashSet<PropertyValueSubmit>();
-		for (PropertySubmitUas propertyUas : propertiesUas) {
-			PropertyValueSubmit property = new PropertyValueSubmit();
-			property.setPropertyid(propertyUas.getPropertyId());
-			property.setDetno(propertyUas.getDetno());
-			property.setStringValue(propertyUas.getStringValue());
-			property.setNumberic(propertyUas.getNumberic());
-			property.setUnit(propertyUas.getUnit());
-			property.setMin(propertyUas.getMin());
-			property.setMax(propertyUas.getMax());
-			properties.add(property);
-		}
-		componentSubmit.setProperties(properties);
-		return componentSubmit;
-	}
+    /**
+     * uas器件申请转换为商城器件申请
+     *
+     * @param uas uas器件申请
+     * @return 商城器件申请
+     */
+    public static ComponentSubmit getComponentSubmit(ComponentSubmitUas uas) {
+        ComponentSubmit componentSubmit = new ComponentSubmit();
+        componentSubmit.setId(uas.getId());
+        componentSubmit.setCode(uas.getCode());
+        componentSubmit.setEncapsulation(uas.getPackaging());
+        componentSubmit.setKindid(uas.getKindid());
+        componentSubmit.setKindName(uas.getKindNameCn());
+        componentSubmit.setBrandid(uas.getBrandid());
+        componentSubmit.setBrandName(uas.getBrandName());
+        componentSubmit.setUuid(uas.getUuid());
+        componentSubmit.setVersion(uas.getVersion());
+        componentSubmit.setImg(uas.getImg());
+        componentSubmit.setDescription(uas.getDescription());
+        componentSubmit.setImid(uas.getImid());
+        componentSubmit.setWeight(uas.getWeight());
+        componentSubmit.setUnit(uas.getUnit());
+        componentSubmit.setAttach(uas.getAttach());
+        componentSubmit.setSource("来自接口");
+        componentSubmit.setModifyenuu(uas.getModifyenuu());
+        componentSubmit.setModifyuu(uas.getModifyuu());
+        Set<PropertySubmitUas> propertiesUas = uas.getProperties();
+        Set<PropertyValueSubmit> properties = new HashSet<PropertyValueSubmit>();
+        for (PropertySubmitUas propertyUas : propertiesUas) {
+            PropertyValueSubmit property = new PropertyValueSubmit();
+            property.setPropertyid(propertyUas.getPropertyId());
+            property.setDetno(propertyUas.getDetno());
+            property.setStringValue(propertyUas.getStringValue());
+            property.setNumberic(propertyUas.getNumberic());
+            property.setUnit(propertyUas.getUnit());
+            property.setMin(propertyUas.getMin());
+            property.setMax(propertyUas.getMax());
+            properties.add(property);
+        }
+        componentSubmit.setProperties(properties);
+        return componentSubmit;
+    }
 
-	/**
-	 * 商城器件申请转换为uas器件申请
-	 * @param componentSubmit 商城器件申请
-	 * @return uas器件申请
-	 */
-	public static ComponentSubmitUasInfo convertUasInfo(ComponentSubmit componentSubmit) {
-		ComponentSubmitUasInfo uas = new ComponentSubmitUasInfo();
-		uas.setId(componentSubmit.getId());
-		uas.setUuid(componentSubmit.getUuid());
-		uas.setCode(componentSubmit.getCode());
-		uas.setKindid(componentSubmit.getKindid());
-		uas.setBrandid(componentSubmit.getBrandid());
-		uas.setImg(componentSubmit.getImg());
-		uas.setStatus(componentSubmit.getStatus());
-		uas.setAuditOpinion(componentSubmit.getAuditOpinion());
-		return uas;
-	}
+    /**
+     * 商城器件申请转换为uas器件申请
+     *
+     * @param componentSubmit 商城器件申请
+     * @return uas器件申请
+     */
+    public static ComponentSubmitUasInfo convertUasInfo(ComponentSubmit componentSubmit) {
+        ComponentSubmitUasInfo uas = new ComponentSubmitUasInfo();
+        uas.setId(componentSubmit.getId());
+        uas.setUuid(componentSubmit.getUuid());
+        uas.setCode(componentSubmit.getCode());
+        uas.setKindid(componentSubmit.getKindid());
+        uas.setBrandid(componentSubmit.getBrandid());
+        uas.setImg(componentSubmit.getImg());
+        uas.setStatus(componentSubmit.getStatus());
+        uas.setAuditOpinion(componentSubmit.getAuditOpinion());
+        return uas;
+    }
 
-	/**
-	 * 商城器件申请转换为uas器件申请
-	 * @param componentSubmit 商城器件申请
-	 * @return uas器件申请
-	 */
-	public static ComponentSubmitUas convertUas(ComponentSubmit componentSubmit) {
-		ComponentSubmitUas uas = new ComponentSubmitUas();
-		uas.setId(componentSubmit.getId());
-		uas.setUuid(componentSubmit.getUuid());
-		uas.setStatus(componentSubmit.getStatus());
-		uas.setCode(componentSubmit.getCode());
-		uas.setVersion(componentSubmit.getVersion());
-		uas.setPackaging(componentSubmit.getEncapsulation());
-		uas.setBrandid(componentSubmit.getBrandid());
-		uas.setKindid(componentSubmit.getKindid());
-		uas.setImid(componentSubmit.getImid());
-		uas.setImg(componentSubmit.getImg());
-		uas.setWeight(componentSubmit.getWeight());
-		uas.setUnit(componentSubmit.getUnit());
-		uas.setAttach(componentSubmit.getAttach());
-		uas.setDescription(componentSubmit.getDescription());
-		uas.setModifyenuu(componentSubmit.getModifyenuu());
-		uas.setModifyuu(componentSubmit.getModifyuu());
-		Set<PropertySubmitUas> propertiesUas = new HashSet<PropertySubmitUas>();
-		for (PropertyValueSubmit property : componentSubmit.getProperties()) {
-			PropertySubmitUas propertyUas = new PropertySubmitUas();
-			propertyUas.setPropertyId(property.getPropertyid());
-			propertyUas.setDetno(property.getDetno());
-			propertyUas.setStringValue(property.getStringValue());
-			propertyUas.setPropertyName(property.getProperty().getLabelCn());
-			propertyUas.setNumberic(property.getNumberic());
-			propertyUas.setMin(property.getMin());
-			propertyUas.setMax(property.getMax());
-			propertyUas.setUnit(property.getUnit());
-			propertiesUas.add(propertyUas);
-		}
-		uas.setProperties(propertiesUas);
-		return uas;
-	}
+    /**
+     * 商城器件申请转换为uas器件申请
+     *
+     * @param componentSubmit 商城器件申请
+     * @return uas器件申请
+     */
+    public static ComponentSubmitUas convertUas(ComponentSubmit componentSubmit) {
+        ComponentSubmitUas uas = new ComponentSubmitUas();
+        uas.setId(componentSubmit.getId());
+        uas.setUuid(componentSubmit.getUuid());
+        uas.setStatus(componentSubmit.getStatus());
+        uas.setCode(componentSubmit.getCode());
+        uas.setVersion(componentSubmit.getVersion());
+        uas.setPackaging(componentSubmit.getEncapsulation());
+        uas.setBrandid(componentSubmit.getBrandid());
+        uas.setKindid(componentSubmit.getKindid());
+        uas.setImid(componentSubmit.getImid());
+        uas.setImg(componentSubmit.getImg());
+        uas.setWeight(componentSubmit.getWeight());
+        uas.setUnit(componentSubmit.getUnit());
+        uas.setAttach(componentSubmit.getAttach());
+        uas.setDescription(componentSubmit.getDescription());
+        uas.setModifyenuu(componentSubmit.getModifyenuu());
+        uas.setModifyuu(componentSubmit.getModifyuu());
+        Set<PropertySubmitUas> propertiesUas = new HashSet<PropertySubmitUas>();
+        for (PropertyValueSubmit property : componentSubmit.getProperties()) {
+            PropertySubmitUas propertyUas = new PropertySubmitUas();
+            propertyUas.setPropertyId(property.getPropertyid());
+            propertyUas.setDetno(property.getDetno());
+            propertyUas.setStringValue(property.getStringValue());
+            propertyUas.setPropertyName(property.getProperty().getLabelCn());
+            propertyUas.setNumberic(property.getNumberic());
+            propertyUas.setMin(property.getMin());
+            propertyUas.setMax(property.getMax());
+            propertyUas.setUnit(property.getUnit());
+            propertiesUas.add(propertyUas);
+        }
+        uas.setProperties(propertiesUas);
+        return uas;
+    }
 
-	/**
-	 * 将brandSubmit转换此UAS品牌申请
-	 * 
-	 * @param brandSubmit 商城品牌申请
-	 * @return uas品牌申请
-	 */
-	public static BrandSubmitUas convertUas(BrandSubmit brandSubmit) {
-		BrandSubmitUas uas = new BrandSubmitUas();
-		uas.setId(brandSubmit.getId());
-		uas.setUuid(brandSubmit.getUuid());
-		uas.setApplication(brandSubmit.getApplication());
-		uas.setAchievement(brandSubmit.getAchievement());
-		uas.setArea(brandSubmit.getArea());
-		uas.setBrief(brandSubmit.getBrief());
-		uas.setUrl(brandSubmit.getUrl());
-		uas.setLogoUrl(brandSubmit.getLogoUrl());
-		uas.setNameCn(brandSubmit.getNameCn());
-		uas.setNameEn(brandSubmit.getNameEn());
-		uas.setSeries(brandSubmit.getSeries());
-		uas.setVendor(brandSubmit.getVendor());
-		uas.setStatus(brandSubmit.getStatus());
-		uas.setAuditOpinion(brandSubmit.getAuditOpinion());
-		uas.setImid(brandSubmit.getImid());
-		uas.setUuid(brandSubmit.getUuid());
-		uas.setVersion(brandSubmit.getVersion());
-		uas.setModifyenuu(brandSubmit.getModifyenuu());
-		uas.setModifyuu(brandSubmit.getModifyuu());
-		return uas;
-	}
+    /**
+     * 将brandSubmit转换此UAS品牌申请
+     *
+     * @param brandSubmit 商城品牌申请
+     * @return uas品牌申请
+     */
+    public static BrandSubmitUas convertUas(BrandSubmit brandSubmit) {
+        BrandSubmitUas uas = new BrandSubmitUas();
+        uas.setId(brandSubmit.getId());
+        uas.setUuid(brandSubmit.getUuid());
+        uas.setApplication(brandSubmit.getApplication());
+        uas.setAchievement(brandSubmit.getAchievement());
+        uas.setArea(brandSubmit.getArea());
+        uas.setBrief(brandSubmit.getBrief());
+        uas.setUrl(brandSubmit.getUrl());
+        uas.setLogoUrl(brandSubmit.getLogoUrl());
+        uas.setNameCn(brandSubmit.getNameCn());
+        uas.setNameEn(brandSubmit.getNameEn());
+        uas.setSeries(brandSubmit.getSeries());
+        uas.setVendor(brandSubmit.getVendor());
+        uas.setStatus(brandSubmit.getStatus());
+        uas.setAuditOpinion(brandSubmit.getAuditOpinion());
+        uas.setImid(brandSubmit.getImid());
+        uas.setUuid(brandSubmit.getUuid());
+        uas.setVersion(brandSubmit.getVersion());
+        uas.setModifyenuu(brandSubmit.getModifyenuu());
+        uas.setModifyuu(brandSubmit.getModifyuu());
+        return uas;
+    }
 
-	/**
-	 * 商城品牌申请转换为uas简易品牌申请
-	 * @param brandSubmit 商城品牌
-	 * @return uas简易品牌申请
-	 */
-	public static BrandSubmitUasInfo covertUas(BrandSubmit brandSubmit) {
-		BrandSubmitUasInfo info = new BrandSubmitUasInfo();
-		info.setId(brandSubmit.getId());
-		info.setArea(brandSubmit.getArea());
-		info.setAuditOpinion(brandSubmit.getAuditOpinion());
-		info.setImid(brandSubmit.getImid());
-		info.setLogoUrl(brandSubmit.getLogoUrl());
-		info.setNameCn(brandSubmit.getNameCn());
-		info.setNameEn(brandSubmit.getNameEn());
-		info.setStatus(brandSubmit.getStatus());
-		info.setUuid(brandSubmit.getUuid());
-		info.setVendor(brandSubmit.getVendor());
-		return info;
-	}
+    /**
+     * 商城品牌申请转换为uas简易品牌申请
+     *
+     * @param brandSubmit 商城品牌
+     * @return uas简易品牌申请
+     */
+    public static BrandSubmitUasInfo covertUas(BrandSubmit brandSubmit) {
+        BrandSubmitUasInfo info = new BrandSubmitUasInfo();
+        info.setId(brandSubmit.getId());
+        info.setArea(brandSubmit.getArea());
+        info.setAuditOpinion(brandSubmit.getAuditOpinion());
+        info.setImid(brandSubmit.getImid());
+        info.setLogoUrl(brandSubmit.getLogoUrl());
+        info.setNameCn(brandSubmit.getNameCn());
+        info.setNameEn(brandSubmit.getNameEn());
+        info.setStatus(brandSubmit.getStatus());
+        info.setUuid(brandSubmit.getUuid());
+        info.setVendor(brandSubmit.getVendor());
+        return info;
+    }
 
-	/**
-	 * 商城产品批次信息转换为uas批次简易信息
-	 * @param simle  商城产品批次信息
-	 * @return uas批次简易信息
-	 */
-	public static GoodsSimpleUas convertUas(ComponentGoods simle) {
-		GoodsSimpleUas uas = new GoodsSimpleUas();
-		uas.setCode(simle.getCode());
-		uas.setUnit(simle.getUnit());
-		uas.setBatchCode(simle.getBatchCode());
-		uas.setMinBuyQty(simle.getMinBuyQty());
-		uas.setMinPackQty(simle.getMinPackQty());
-		uas.setOriginal(simle.getOriginal());
-		uas.setCurrencyName(simle.getCurrencyName());
-		uas.setQtyPrice(simle.getQtyPrice());
-		uas.setPackaging(simle.getPackaging());
-		uas.setProduceDate(simle.getProduceDate());
-		uas.setReserve(simle.getReserve());
-		uas.setB2cDeliveryHKMaxTime(simle.getB2cMaxDelivery());
-		uas.setB2cDeliveryHKMinTime(simle.getB2cMinDelivery());
-		uas.setB2cDeliveryDemMaxTime(simle.getB2cMaxDelivery());
-		uas.setB2cDeliveryDemMinTime(simle.getB2cMinDelivery());
-		uas.setSampleQty(simle.getSampleQty());
-		uas.setUuid(simle.getUuid());
-		return uas;
-	}
+    /**
+     * 商城产品批次信息转换为uas批次简易信息
+     *
+     * @param simle 商城产品批次信息
+     * @return uas批次简易信息
+     */
+    public static GoodsSimpleUas convertUas(ComponentGoods simle) {
+        GoodsSimpleUas uas = new GoodsSimpleUas();
+        uas.setCode(simle.getCode());
+        uas.setUnit(simle.getUnit());
+        uas.setBatchCode(simle.getBatchCode());
+        uas.setMinBuyQty(simle.getMinBuyQty());
+        uas.setMinPackQty(simle.getMinPackQty());
+        uas.setOriginal(simle.getOriginal());
+        uas.setCurrencyName(simle.getCurrencyName());
+        uas.setQtyPrice(simle.getQtyPrice());
+        uas.setPackaging(simle.getPackaging());
+        uas.setProduceDate(simle.getProduceDate());
+        uas.setReserve(simle.getReserve());
+        uas.setB2cDeliveryHKMaxTime(simle.getB2cMaxDelivery());
+        uas.setB2cDeliveryHKMinTime(simle.getB2cMinDelivery());
+        uas.setB2cDeliveryDemMaxTime(simle.getB2cMaxDelivery());
+        uas.setB2cDeliveryDemMinTime(simle.getB2cMinDelivery());
+        uas.setSampleQty(simle.getSampleQty());
+        uas.setUuid(simle.getUuid());
+        return uas;
+    }
 
-	/**
-	 * 商城类目转换为uas类目信息
-	 * @param kind 商城类目
-	 * @return uas类目信息
-	 */
-	public static KindUas convertUas(Kind kind) {
-		KindUas uas = new KindUas();
-		uas.setComponentPrefix(kind.getComponentPrefix());
-		uas.setComponentsuffix(kind.getComponentsuffix());
-		uas.setCount(kind.getCount());
-		uas.setDetno(kind.getDetno());
-		uas.setId(kind.getId());
-		uas.setIsLeaf(kind.getIsLeaf());
-		uas.setLevel(kind.getLevel());
-		uas.setNameCn(kind.getNameCn());
-		uas.setNameEn(kind.getNameEn());
-		uas.setParentid(kind.getParentid());
-		return uas;
-	}
+    /**
+     * 商城类目转换为uas类目信息
+     *
+     * @param kind 商城类目
+     * @return uas类目信息
+     */
+    public static KindUas convertUas(Kind kind) {
+        KindUas uas = new KindUas();
+        uas.setComponentPrefix(kind.getComponentPrefix());
+        uas.setComponentsuffix(kind.getComponentsuffix());
+        uas.setCount(kind.getCount());
+        uas.setDetno(kind.getDetno());
+        uas.setId(kind.getId());
+        uas.setIsLeaf(kind.getIsLeaf());
+        uas.setLevel(kind.getLevel());
+        uas.setNameCn(kind.getNameCn());
+        uas.setNameEn(kind.getNameEn());
+        uas.setParentid(kind.getParentid());
+        return uas;
+    }
 
-	/**
-	 * 商城器件简易信息转换为uas器件简易信息
-	 * @param info 商城器件简易信息
-	 * @return uas器件简易信息
-	 */
-	public static ComponentInfoUas convertUas(ComponentInfo info) {
-		ComponentInfoUas uas = new ComponentInfoUas();
-		uas.setAttach(info.getAttach());
-		uas.setBrandid(info.getBrandid());
-		uas.setCode(info.getCode());
-		uas.setInactionStockQty(info.getInactionStockQty());
-		// uas.setWastageQty(info.getWastageQty());
-		uas.setId(info.getId());
-		uas.setImg(info.getImg());
-		uas.setKindid(info.getKindid());
-		uas.setMaxDelivery(info.getMaxDelivery());
-		uas.setMinBuyQty(info.getMinBuyQty());
-		uas.setMinDelivery(info.getMinDelivery());
-		uas.setMinPrice(info.getMinPrice());
-		uas.setMaxPrice(info.getMaxPrice());
-		uas.setOrderNumber(info.getOrderNumber());
-		uas.setOrderQty(info.getOrderQty());
-		uas.setOriginalQty(info.getOriginalQty());
-		uas.setPackaging(info.getEncapsulation());
-		uas.setReserve(info.getReserve());
-		uas.setReserveType(info.getReserveType());
-		uas.setSampleQty(info.getSampleQty());
-		uas.setSpec(info.getEncapsulation());
-		uas.setUnit(info.getUnit());
-		uas.setUuid(info.getUuid());
-		uas.setVersion(info.getVersion());
-		uas.setWeight(info.getWeight());
-		if (info.getBrand() != null) {
-			uas.setBrand(convertUas(info.getBrand()));
-		}
-		return uas;
-	}
+    /**
+     * 商城器件简易信息转换为uas器件简易信息
+     *
+     * @param info 商城器件简易信息
+     * @return uas器件简易信息
+     */
+    public static ComponentInfoUas convertUas(ComponentInfo info) {
+        ComponentInfoUas uas = new ComponentInfoUas();
+        uas.setAttach(info.getAttach());
+        uas.setBrandid(info.getBrandid());
+        uas.setCode(info.getCode());
+        uas.setInactionStockQty(info.getInactionStockQty());
+        // uas.setWastageQty(info.getWastageQty());
+        uas.setId(info.getId());
+        uas.setImg(info.getImg());
+        uas.setKindid(info.getKindid());
+        uas.setMaxDelivery(info.getMaxDelivery());
+        uas.setMinBuyQty(info.getMinBuyQty());
+        uas.setMinDelivery(info.getMinDelivery());
+        uas.setMinPrice(info.getMinPrice());
+        uas.setMaxPrice(info.getMaxPrice());
+        uas.setOrderNumber(info.getOrderNumber());
+        uas.setOrderQty(info.getOrderQty());
+        uas.setOriginalQty(info.getOriginalQty());
+        uas.setPackaging(info.getEncapsulation());
+        uas.setReserve(info.getReserve());
+        uas.setReserveType(info.getReserveType());
+        uas.setSampleQty(info.getSampleQty());
+        uas.setSpec(info.getEncapsulation());
+        uas.setUnit(info.getUnit());
+        uas.setUuid(info.getUuid());
+        uas.setVersion(info.getVersion());
+        uas.setWeight(info.getWeight());
+        if (info.getBrand() != null) {
+            uas.setBrand(convertUas(info.getBrand()));
+        }
+        return uas;
+    }
 
-	/**
-	 * 商城品牌简易信息转换为uas品牌简易信息
-	 * @param info 商城品牌简易信息
-	 * @return uas品牌简易信息
-	 */
-	public static BrandInfoUas convertUas(BrandInfo info) {
-		BrandInfoUas uas = new BrandInfoUas();
-		uas.setId(info.getId());
-		uas.setLogoUrl(info.getLogoUrl());
-		uas.setNameCn(info.getNameCn());
-		uas.setNameEn(info.getNameEn());
-		uas.setUuid(info.getUuid());
-		uas.setVersion(info.getVersion());
-		uas.setVenodr(info.getVendor());
-		uas.setWeight(info.getWeight());
-		return uas;
-	}
+    /**
+     * 商城品牌简易信息转换为uas品牌简易信息
+     *
+     * @param info 商城品牌简易信息
+     * @return uas品牌简易信息
+     */
+    public static BrandInfoUas convertUas(BrandInfo info) {
+        BrandInfoUas uas = new BrandInfoUas();
+        uas.setId(info.getId());
+        uas.setLogoUrl(info.getLogoUrl());
+        uas.setNameCn(info.getNameCn());
+        uas.setNameEn(info.getNameEn());
+        uas.setUuid(info.getUuid());
+        uas.setVersion(info.getVersion());
+        uas.setVenodr(info.getVendor());
+        uas.setWeight(info.getWeight());
+        return uas;
+    }
 
-	/**
-	 * 分页转换
-	 * @param page
-	 * @param <T>
-	 * @return
-	 */
-	public static <T> IPage<T> convertPage(final Page<T> page) {
-		IPage<T> iPage = new IPage<>();
-		iPage.setContent(page.getContent());
-		iPage.setFirst(page.isFirst());
-		iPage.setLast(page.isLast());
-		iPage.setNumber(page.getNumber());
-		iPage.setNumberOfElements(page.getNumberOfElements());
-		iPage.setSize(page.getSize());
-		iPage.setTotalElements(page.getTotalElements());
-		return iPage;
-	}
+    /**
+     * 分页转换
+     *
+     * @param page
+     * @param <T>
+     * @return
+     */
+    public static <T> IPage<T> convertPage(final Page<T> page) {
+        IPage<T> iPage = new IPage<>();
+        iPage.setContent(page.getContent());
+        iPage.setFirst(page.isFirst());
+        iPage.setLast(page.isLast());
+        iPage.setNumber(page.getNumber());
+        iPage.setNumberOfElements(page.getNumberOfElements());
+        iPage.setSize(page.getSize());
+        iPage.setTotalElements(page.getTotalElements());
+        return iPage;
+    }
 
-	/**
-	 * 商城属性信息转换为uas属性信息
-	 * @param property 商城属性信息
-	 * @return uas属性信息
-	 */
-	public static PropertyUas convertUas(Property property) {
-		PropertyUas propertyUas = new PropertyUas();
-		propertyUas.setId(property.getId());
-		propertyUas.setLabelCn(property.getLabelCn());
-		propertyUas.setLabelEn(property.getLabelEn());
-		return propertyUas;
-	}
+    /**
+     * 商城属性信息转换为uas属性信息
+     *
+     * @param property 商城属性信息
+     * @return uas属性信息
+     */
+    public static PropertyUas convertUas(Property property) {
+        PropertyUas propertyUas = new PropertyUas();
+        propertyUas.setId(property.getId());
+        propertyUas.setLabelCn(property.getLabelCn());
+        propertyUas.setLabelEn(property.getLabelEn());
+        return propertyUas;
+    }
 
-	/**
-	 * 商城标准参数信息转换为uas标准参数信息
-	 * @param kindProperty 商城标准参数信息
-	 * @return uas标准参数信息
-	 */
-	public static KindPropertyUas convertUas(KindProperty kindProperty) {
-		KindPropertyUas kindPropertyUas = new KindPropertyUas();
-		kindPropertyUas.setId(kindProperty.getId());
-		kindPropertyUas.setDetno(kindProperty.getDetno());
-		kindPropertyUas.setKindId(kindProperty.getKindId());
-		kindPropertyUas.setPropertyId(kindProperty.getPropertyId());
-		kindPropertyUas.setType(kindProperty.getType());
-		kindPropertyUas.setUnit(kindProperty.getUnit());
-		kindPropertyUas.setProperty(convertUas(kindProperty.getProperty()));
-		// 所有可能值
-		if ("A".equals(kindProperty.getType()) && !CollectionUtils.isEmpty(kindProperty.getValues())) {
-			List<String> values = new ArrayList<String>();
-			int i = 0;
-			for (KindPropertyValues value : kindProperty.getValues()) {
-				i++;
-				if (i > 50)
-					break;
-				values.add(value.getValue());
-			}
-			kindPropertyUas.setValues(values);
-		}
-		// 所有单位
-		if (!CollectionUtils.isEmpty(kindProperty.getMultiUnits())) {
-			List<KindPropertyUnitUas> kindPropertyUnitUas = new ArrayList<KindPropertyUnitUas>();
-			for (KindPropertyUnit kindPropertyUnit : kindProperty.getMultiUnits()) {
-				kindPropertyUnitUas.add(convertUas(kindPropertyUnit));
-			}
-			kindPropertyUas.setMultiUnits(kindPropertyUnitUas);
-		}
-		// 所有可选项
-		if (!CollectionUtils.isEmpty(kindProperty.getOptions())) {
-			List<KindPropertyOptionUas> kindPropertyOptionUas = new ArrayList<KindPropertyOptionUas>();
-			for (KindPropertyOption kindPropertyOption : kindProperty.getOptions()) {
-				kindPropertyOptionUas.add(convertUas(kindPropertyOption));
-			}
-			kindPropertyUas.setOptions(kindPropertyOptionUas);
-		}
-		return kindPropertyUas;
-	}
+    /**
+     * 商城标准参数信息转换为uas标准参数信息
+     *
+     * @param kindProperty 商城标准参数信息
+     * @return uas标准参数信息
+     */
+    public static KindPropertyUas convertUas(KindProperty kindProperty) {
+        KindPropertyUas kindPropertyUas = new KindPropertyUas();
+        kindPropertyUas.setId(kindProperty.getId());
+        kindPropertyUas.setDetno(kindProperty.getDetno());
+        kindPropertyUas.setKindId(kindProperty.getKindId());
+        kindPropertyUas.setPropertyId(kindProperty.getPropertyId());
+        kindPropertyUas.setType(kindProperty.getType());
+        kindPropertyUas.setUnit(kindProperty.getUnit());
+        kindPropertyUas.setProperty(convertUas(kindProperty.getProperty()));
+        // 所有可能值
+        if ("A".equals(kindProperty.getType()) && !CollectionUtils.isEmpty(kindProperty.getValues())) {
+            List<String> values = new ArrayList<String>();
+            int i = 0;
+            for (KindPropertyValues value : kindProperty.getValues()) {
+                i++;
+                if (i > 50)
+                    break;
+                values.add(value.getValue());
+            }
+            kindPropertyUas.setValues(values);
+        }
+        // 所有单位
+        if (!CollectionUtils.isEmpty(kindProperty.getMultiUnits())) {
+            List<KindPropertyUnitUas> kindPropertyUnitUas = new ArrayList<KindPropertyUnitUas>();
+            for (KindPropertyUnit kindPropertyUnit : kindProperty.getMultiUnits()) {
+                kindPropertyUnitUas.add(convertUas(kindPropertyUnit));
+            }
+            kindPropertyUas.setMultiUnits(kindPropertyUnitUas);
+        }
+        // 所有可选项
+        if (!CollectionUtils.isEmpty(kindProperty.getOptions())) {
+            List<KindPropertyOptionUas> kindPropertyOptionUas = new ArrayList<KindPropertyOptionUas>();
+            for (KindPropertyOption kindPropertyOption : kindProperty.getOptions()) {
+                kindPropertyOptionUas.add(convertUas(kindPropertyOption));
+            }
+            kindPropertyUas.setOptions(kindPropertyOptionUas);
+        }
+        return kindPropertyUas;
+    }
 
-	/**
-	 * 商城标准参数单位转换为uas标准参数单位
-	 * @param kindPropertyUnit 商城标准参数单位
-	 * @return uas标准参数单位
-	 */
-	public static KindPropertyUnitUas convertUas(KindPropertyUnit kindPropertyUnit) {
-		KindPropertyUnitUas kindPropertyUnitUas = new KindPropertyUnitUas();
-		kindPropertyUnitUas.setId(kindPropertyUnit.getId());
-		kindPropertyUnitUas.setDetno(kindPropertyUnit.getNumber());
-		kindPropertyUnitUas.setUnit(kindPropertyUnit.getUnit());
-		kindPropertyUnitUas.setRadix(kindPropertyUnit.getRadix());
-		return kindPropertyUnitUas;
-	}
+    /**
+     * 商城标准参数单位转换为uas标准参数单位
+     *
+     * @param kindPropertyUnit 商城标准参数单位
+     * @return uas标准参数单位
+     */
+    public static KindPropertyUnitUas convertUas(KindPropertyUnit kindPropertyUnit) {
+        KindPropertyUnitUas kindPropertyUnitUas = new KindPropertyUnitUas();
+        kindPropertyUnitUas.setId(kindPropertyUnit.getId());
+        kindPropertyUnitUas.setDetno(kindPropertyUnit.getNumber());
+        kindPropertyUnitUas.setUnit(kindPropertyUnit.getUnit());
+        kindPropertyUnitUas.setRadix(kindPropertyUnit.getRadix());
+        return kindPropertyUnitUas;
+    }
 
-	/**
-	 * 商城标准参数选项转换为uas标准参数选项
-	 * @param kindPropertyOption 商城标准参数选项
-	 * @return uas标准参数选项
-	 */
-	public static KindPropertyOptionUas convertUas(KindPropertyOption kindPropertyOption) {
-		KindPropertyOptionUas kindPropertyOptionUas = new KindPropertyOptionUas();
-		kindPropertyOptionUas.setId(kindPropertyOption.getId());
-		kindPropertyOptionUas.setDetno(kindPropertyOption.getNumber());
-		kindPropertyOptionUas.setOption(kindPropertyOption.getOption());
-		return kindPropertyOptionUas;
-	}
+    /**
+     * 商城标准参数选项转换为uas标准参数选项
+     *
+     * @param kindPropertyOption 商城标准参数选项
+     * @return uas标准参数选项
+     */
+    public static KindPropertyOptionUas convertUas(KindPropertyOption kindPropertyOption) {
+        KindPropertyOptionUas kindPropertyOptionUas = new KindPropertyOptionUas();
+        kindPropertyOptionUas.setId(kindPropertyOption.getId());
+        kindPropertyOptionUas.setDetno(kindPropertyOption.getNumber());
+        kindPropertyOptionUas.setOption(kindPropertyOption.getOption());
+        return kindPropertyOptionUas;
+    }
 
-	/**
-	 * 商城业务消息转换为uas业务消息
-	 * 
-	 * @author hejq
-	 * @param operationInfo 商城业务消息
-	 * @return uas业务消息
-	 */
-	public static OperationInfoUas convertUas(OperationInfo operationInfo) {
-		OperationInfoUas operationInfoUas = new OperationInfoUas();
-		operationInfoUas.setB2cId(operationInfo.getB2cid());
-		operationInfoUas.setOperationRemark(operationInfo.getOperationRemark());
-		operationInfoUas.setOperationResult(operationInfo.getOperationResult());
-		operationInfoUas.setServiceCode(operationInfo.getServiceCode());
-		operationInfoUas.setUuid(operationInfo.getUuid());
-		return operationInfoUas;
-	}
+    /**
+     * 商城业务消息转换为uas业务消息
+     *
+     * @param operationInfo 商城业务消息
+     * @return uas业务消息
+     * @author hejq
+     */
+    public static OperationInfoUas convertUas(OperationInfo operationInfo) {
+        OperationInfoUas operationInfoUas = new OperationInfoUas();
+        operationInfoUas.setB2cId(operationInfo.getB2cid());
+        operationInfoUas.setOperationRemark(operationInfo.getOperationRemark());
+        operationInfoUas.setOperationResult(operationInfo.getOperationResult());
+        operationInfoUas.setServiceCode(operationInfo.getServiceCode());
+        operationInfoUas.setUuid(operationInfo.getUuid());
+        return operationInfoUas;
+    }
 
-	/**
-	 * 转为平台的产品
-	 *
-	 * @return
-	 */
-	public static Product convert(Prod prod) {
-		Product product = new Product();
-		product.setProdNum(prod.getPr_code());
-		product.setEnUU(SystemSession.getUser().getEnterprise().getUu());
-		product.setUserUU(SystemSession.getUser().getUserUU());
-		product.setProdName(prod.getPr_detail());
-		product.setSpec(prod.getPr_spec());
-		product.setUnit(prod.getPr_unit());
-		product.setSourceId(prod.getPr_id());
-		product.setBrand(prod.getPr_brand());
-		if (prod.getPr_orispeccode() != null) {
-			product.setCmpCode(prod.getPr_orispeccode());
-		} else {
-			product.setCmpCode(prod.getPr_spec());
-		}
-		int i = Constant.NO;
-		product.setStandard(i);// 默认设置为非标准,到平台做匹配更新
-		Enterprise enter = SystemSession.getUser().getEnterprise();
-		// erp上传的数据默认赋值给标准信息
-		product.setPbranden(product.getBrand());
-		product.setPbrand(product.getBrand());
-		product.setPcmpcode(product.getCmpCode());
-		product.setKind(product.getProdName());
-		product.setSourceApp("ERP");
-		product.setErpDate(new Date());
-		product.setB2cDownStatus(Status.NOT_UPLOAD.value());
-		return product;
-	}
+    /**
+     * 转为平台的产品
+     *
+     * @return
+     */
+    public static Product convert(Prod prod) {
+        Product product = new Product();
+        product.setProdNum(prod.getPr_code());
+        product.setEnUU(SystemSession.getUser().getEnterprise().getUu());
+        product.setUserUU(SystemSession.getUser().getUserUU());
+        product.setProdName(prod.getPr_detail());
+        product.setSpec(prod.getPr_spec());
+        product.setUnit(prod.getPr_unit());
+        product.setSourceId(prod.getPr_id());
+        product.setBrand(prod.getPr_brand());
+        if (prod.getPr_orispeccode() != null) {
+            product.setCmpCode(prod.getPr_orispeccode());
+        } else {
+            product.setCmpCode(prod.getPr_spec());
+        }
+        int i = Constant.NO;
+        product.setStandard(i);// 默认设置为非标准,到平台做匹配更新
+        Enterprise enter = SystemSession.getUser().getEnterprise();
+        // erp上传的数据默认赋值给标准信息
+        product.setPbranden(product.getBrand());
+        product.setPbrand(product.getBrand());
+        product.setPcmpcode(product.getCmpCode());
+        product.setKind(product.getProdName());
+        product.setSourceApp("ERP");
+        product.setErpDate(new Date());
+        product.setB2cDownStatus(Status.NOT_UPLOAD.value());
+        return product;
+    }
+
+    /**
+     * 替代料转换
+     * @param replace
+     * @return
+     */
+    public static ProductReplace convert(ProductReplaceErp replace) {
+        ProductReplace productReplace = new ProductReplace();
+        //设置ERPid
+        productReplace.setErpId(replace.getBPR_ID());
+        //设置替代关系状态
+        productReplace.setStatus(replace.getBPR_STATUSCODE());
+        //TODO 设置物料号
+        productReplace.setProductId(Long.parseLong(replace.getBPR_PRODCODE()));
+        //设置替代料号
+        productReplace.setReplaceId(replace.getBPR_REPCODE());
+        //设置原品牌
+        productReplace.setpBranden(replace.getBPR_PRODBRAND());
+        //设置替代品牌
+        productReplace.setPtrBranden(replace.getBPR_REPBAND());
+        //设置原型号
+        productReplace.setpCmpcode(replace.getBPR_PRODOSCODE());
+        //设置替代型号
+        productReplace.setpCmpcode(replace.getBPR_REPOSCODE());
+        //设置更新时间
+        productReplace.setTime(replace.getBPR_DATE());
+        return productReplace;
+    }
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/logistics/model/DistributionRule.java

@@ -89,7 +89,7 @@ public class DistributionRule {
 
 	/**
 	 * 计费方式
-	 * 1-统一规定运费,2-按总金额计算, 3-到付,到付设置为统一运费0
+	 * 1-统一规定运费,2-按总金额计算, 3-到付,到付设置为统一运费0, 4-包邮,到付设置为统一运费0
 	 */
 	@Column(name = "rule_fare_type")
 	private Short fareType;

+ 4 - 1
src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributionRuleServiceImpl.java

@@ -144,6 +144,9 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 				}
 			}
 		}
+		if (rule.getFareType() == 4) {
+			rule.setUniformPrice((double) 0);
+		}
 		distributionRuleDao.save(rule);
 		return ResultMap.success(null);
 	}
@@ -438,7 +441,7 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 	 */
 	public Double getFareOfRule(DistributionRule rule, Double price){
 		Double needFare = null;
-		if (rule.getFareType() == 1 || rule.getFareType() == 3){
+		if (rule.getFareType() == 1 || rule.getFareType() == 3 || rule.getFareType() == 4){
 			needFare = rule.getUniformPrice();
 		}else {
 			if (CollectionUtils.isEmpty(rule.getFares())){

+ 8 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/constant/StringConstant.java

@@ -1,11 +1,17 @@
 package com.uas.platform.b2c.prod.commodity.constant;
 
 /**
- *
- * @author yuj 2017-11-30 9:59
+ * 字符串常量
+ * @author hulh 2017年12月14日 11点22分
  */
 public class StringConstant {
 
+    public static final String CONSIGNMENT = "寄售";
+    public static final String SALE_SELF = "自营";
+    public static final String DEFAULT_IMG = "默认图片";
+    public static final String NEW_IMG = "新图片";
+    public static final String OLD_IMG = "旧图片";
+
     /**
      * 自定义标签
      */

+ 51 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/controller/BackgroundRecordController.java

@@ -0,0 +1,51 @@
+package com.uas.platform.b2c.prod.commodity.controller;
+
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.prod.commodity.model.Title;
+import com.uas.platform.b2c.prod.commodity.service.BackgroundRecordService;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Set;
+
+/**
+ * 表头记录的Controller层
+ *
+ * @author hulh 2017年12月14日 09点58分
+ */
+@RestController
+@RequestMapping(value = "/background/record")
+public class BackgroundRecordController {
+
+    @Autowired
+    private BackgroundRecordService recordService;
+
+    private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+    /**
+     * 根据useruu返回设置的表头信息
+     * @return
+     */
+    @RequestMapping(value = "/title", method = RequestMethod.GET)
+    public Set<Title> getTitleByUseruu() {
+        logger.log("超级后台", "获取表头信息,userUU : " + SystemSession.getUser().getUserUU());
+        return recordService.getTitleInfoByUseruu();
+    }
+
+    /**
+     * 更新表头信息
+     * @param titleSet 表头信息Set
+     * @return
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public ResultMap updateTitleInfo(@RequestBody Set<Title> titleSet) {
+        logger.log("超级后台", "更新表头信息,userUU : " + SystemSession.getUser().getUserUU());
+        return recordService.updateTitleInfo(titleSet);
+    }
+}

+ 29 - 6
src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsController.java

@@ -8,10 +8,7 @@ import com.uas.platform.b2c.core.support.view.JxlsExcelView;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.core.utils.StringUtilB2C;
 import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
-import com.uas.platform.b2c.prod.commodity.model.Goods;
-import com.uas.platform.b2c.prod.commodity.model.GoodsHistory;
-import com.uas.platform.b2c.prod.commodity.model.GoodsQtyPrice;
-import com.uas.platform.b2c.prod.commodity.model.GoodsSimple;
+import com.uas.platform.b2c.prod.commodity.model.*;
 import com.uas.platform.b2c.prod.commodity.service.GoodsHistoryService;
 import com.uas.platform.b2c.prod.commodity.service.GoodsService;
 import com.uas.platform.b2c.prod.product.component.modal.ComponentInfo;
@@ -471,13 +468,14 @@ public class GoodsController {
      * 卖家下架已上架商品
      *
      * @param batchCodes 待下架商品批次号
+	 * @param downMsg   下架原因
      * @return the result map
      */
     @RequestMapping(value = "/provider/off/shelf", method = RequestMethod.PUT)
-	public ResultMap offShelfGoodsByProvider(String batchCodes) {
+	public ResultMap offShelfGoodsByProvider(String batchCodes, String downMsg) {
 		assert logger != null;
 		logger.log("货品管理", "下架上架商品");
-		return goodsService.offShelfGoodsByProvider(batchCodes,false);
+		return goodsService.offShelfGoodsByProvider(batchCodes, downMsg, false);
 	}
 
     /**
@@ -814,4 +812,29 @@ public class GoodsController {
 	public String modifyData() {
 		return  goodsService.modifyData();
 	}
+
+	/**
+	 * 根据分页参数和过滤对象分页获取数据
+	 *
+	 * @param params 分页参数
+	 * @param goodsFilter 过滤对象
+	 * @return
+	 */
+	@RequestMapping(value = "/background/page", method = RequestMethod.POST)
+	public Page<Goods> getPageDataOfBackground(PageParams params, @RequestBody GoodsFilter goodsFilter) {
+		PageInfo info = new PageInfo(params);
+		logger.log("后台产品管理", "分页获取Goods信息");
+		return goodsService.getPageDataOfBackground(info, goodsFilter);
+	}
+
+	/**
+	 * 根据id返回一个Goods数据
+	 * @param goodsId
+	 * @return
+	 */
+	@RequestMapping(value = "/one", method = RequestMethod.GET)
+	public Goods getGoodsById(Long goodsId) {
+		logger.log("后台产品管理", "根据id: " + goodsId + "返回goods数据");
+		return goodsService.getGoodsById(goodsId);
+	}
 }

+ 38 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsHistoryController.java

@@ -1,22 +1,32 @@
 package com.uas.platform.b2c.prod.commodity.controller;
 
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.prod.commodity.model.GoodsHistory;
 import com.uas.platform.b2c.prod.commodity.service.GoodsHistoryService;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * Created by yujia on 2017/7/28.
  * @version 2017年8月3日11:32:31 yuj 增加注释
  */
 @RestController
-@RequestMapping(value = "/trade/goodsHitory")
+@RequestMapping(value = "/trade/goodsHistory")
 public class GoodsHistoryController {
 
     private final GoodsHistoryService goodsHistoryService;
 
+    private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
     /**
      * Instantiates a new Goods history controller.
      *
@@ -36,4 +46,31 @@ public class GoodsHistoryController {
     public ResultMap modifyGoodsHitory() {
         return goodsHistoryService.modifyGoodsHitory();
     }
+
+    /**
+     * 返回该批次号的上下架历史
+     *
+     * @param batchCode 批次号
+     * @return
+     */
+    @RequestMapping(value = "/data/batchCode", method = RequestMethod.GET)
+    public List<GoodsHistory> getDataByBatchCode(String batchCode) {
+        logger.log("获取上下架历史", "批次号" + batchCode);
+        return goodsHistoryService.findDataOfUpAndDown(batchCode);
+    }
+
+    /**
+     * 返回该批次号的上下架历史
+     *
+     * @param batchCode 批次号
+     * @return
+     */
+    @RequestMapping(value = "/page/batchCode", method = RequestMethod.GET)
+    public Page<GoodsHistory> getPageByBatchCode(PageParams params, String batchCode, Long startDate,
+                                                 Long endDate, String keyword) {
+        PageInfo info = new PageInfo(params);
+        logger.log("获取上下架历史", "批次号" + batchCode);
+        return goodsHistoryService.findPageByBatchCode(info, batchCode, startDate, endDate, keyword);
+    }
+
 }

+ 81 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsModifyInfoController.java

@@ -0,0 +1,81 @@
+package com.uas.platform.b2c.prod.commodity.controller;
+
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.prod.commodity.model.GoodsModifyInfo;
+import com.uas.platform.b2c.prod.commodity.model.ModifyInfo;
+import com.uas.platform.b2c.prod.commodity.service.GoodsModifyInfoService;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 商品修改记录Controller
+ * @author hulh 2017年12月14日 11点22分
+ */
+@RestController
+@RequestMapping("/goods/modifyInfo")
+public class GoodsModifyInfoController {
+
+    @Autowired
+    private GoodsModifyInfoService modifyInfoService;
+
+    /**
+     * 输出日志
+     */
+    private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+    /**
+     * 根据批次号分页获取该Goods的修改记录
+     * @param params
+     * @param batchCode
+     * @return
+     */
+    @RequestMapping(value = "/page", method = RequestMethod.GET)
+    public Page<GoodsModifyInfo> getPageDataByBatchCode(PageParams params, String batchCode, Long startDate,
+                                                        Long endDate, String keyword) {
+        logger.log("产品信息记录", "分页获取该批次" + batchCode + "的修改记录");
+        return modifyInfoService.getPageModifyRecord(params, batchCode, startDate, endDate, keyword);
+    }
+
+    /**
+     * 根据批次号分页获取该Goods指定类型的修改记录明细
+     * @param params
+     * @param batchCode
+     * @return
+     */
+    @RequestMapping(value = "/detail/page", method = RequestMethod.GET)
+    public Page<GoodsModifyInfo> getPageDetailByBatchCode(PageParams params, String batchCode, Long startDate,
+                                                          Long endDate, String keyword) {
+        logger.log("产品信息记录", "分页获取该批次" + batchCode + "的修改记录明细");
+        return modifyInfoService.getPageModifyDetail(params, batchCode, startDate, endDate, keyword);
+    }
+
+    /**
+     * 根据批次号返回修改的信息
+     * @param batchCode 批次号
+     * @return
+     */
+    @RequestMapping(value = "/batchCode", method = RequestMethod.GET)
+    public List<GoodsModifyInfo> getGoodsModifyByBatchCode(String batchCode) {
+        logger.log("产品信息记录", "获取该批次" + batchCode + "的修改记录");
+        return modifyInfoService.getModifyRecord(batchCode);
+    }
+
+    /**
+     * 根据批次号审核商品
+     * @param batchCode 批次号
+     * @param pass      审核状态
+     * @param message   错误描述
+     */
+    @RequestMapping(value = "/audit/goods", method = RequestMethod.PUT)
+    public void auditedGoods(String batchCode, Boolean pass, String message) {
+        logger.log("产品信息记录", "审核该批次" + batchCode + "的修改记录");
+        modifyInfoService.auditedGoods(batchCode, pass, message);
+    }
+}

+ 6 - 5
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java

@@ -10,6 +10,7 @@ import com.uas.platform.b2c.prod.commodity.model.*;
 import com.uas.platform.b2c.prod.commodity.service.GoodsService;
 import com.uas.platform.b2c.prod.commodity.service.ProductService;
 import com.uas.platform.b2c.prod.commodity.type.ProductConstant;
+import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
@@ -30,8 +31,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static com.alibaba.fastjson.JSON.parseArray;
-
 /**
  *  产品控制器
  *
@@ -100,8 +99,11 @@ public class ProductController {
 	 */
 	@RequestMapping(value = "/person", method = RequestMethod.POST)
 	ResultMap setAllProductsByPerson(@RequestBody String ids, Integer isAll, Integer isStardand) {
-		productService.setAllProductsByProductIds(ids,isAll,isStardand);
-		return ResultMap.success("success");
+		Integer count = productService.setAllProductsByProductIds(ids, isAll, isStardand);
+		if (count == 0) {
+			return new ResultMap(CodeType.SAVED, "个人产品库已存在产品");
+		}
+		return ResultMap.success(count);
 	}
 
 	/**
@@ -278,7 +280,6 @@ public class ProductController {
 		return productService.getProductCount(isPerson);
 	}
 
-
 	/**
 	 * 批量删除所有的非标的产品
 	 */

+ 24 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/BackgroundRecordDao.java

@@ -0,0 +1,24 @@
+package com.uas.platform.b2c.prod.commodity.dao;
+
+import com.uas.platform.b2c.prod.commodity.model.BackgroundRecord;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 表头记录的dao层
+ *
+ * @author hulh 2017年12月13日 10点03分
+ */
+@Repository
+public interface BackgroundRecordDao extends JpaSpecificationExecutor<BackgroundRecord>,
+        JpaRepository<BackgroundRecord, Long> {
+
+    /**
+     * 根据useruu获取表头记录信息
+     *
+     * @param useruu
+     * @return
+     */
+    BackgroundRecord findByUseruu(Long useruu);
+}

+ 8 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/GoodsDao.java

@@ -431,6 +431,14 @@ public interface GoodsDao extends JpaSpecificationExecutor<Goods>, JpaRepository
     @Query(value = "select distinct g.kindUuid from Goods g where g.storeid = :storeUuid and g.status=601 and g.kindUuid is not null")
 	Set<Long> findAllKindsByStoreUuid(@Param("storeUuid") String storeUuid);
 
+    /**
+     * 获取店铺的所有类目信息
+     *
+     * @return the set
+     */
+    @Query(value = "select distinct g.kindUuid from Goods g where g.kindUuid is not null")
+    Set<Long> findAllKinds();
+
     /**
      * 通过原厂型号获取全部店铺id
      *

+ 9 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/GoodsHistoryDao.java

@@ -33,6 +33,15 @@ public interface GoodsHistoryDao extends JpaSpecificationExecutor<GoodsHistory>,
      */
     List<GoodsHistory> findByBatchCode(String batch);
 
+    /**
+     *  根据批次号和类型返回数据
+     * @param batchCode 批次号
+     * @param typeList  类型泪列表
+     * @return
+     */
+    @Query(value = "select g from GoodsHistory g where g.batchCode = :batchCode and g.operateType in :typeList order by g.updateDate desc")
+    List<GoodsHistory> findByBatchCodeInType(@Param("batchCode") String batchCode, @Param("typeList") List<String> typeList);
+
     /**
      * 根据UUID和状态查找对应的历史货物信息
      *

+ 25 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/GoodsModifyInfoDao.java

@@ -0,0 +1,25 @@
+package com.uas.platform.b2c.prod.commodity.dao;
+
+import com.uas.platform.b2c.prod.commodity.model.GoodsModifyInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 商品修改dao层
+ * @author hulh
+ */
+@Repository
+public interface GoodsModifyInfoDao extends JpaSpecificationExecutor<GoodsModifyInfo>,
+        JpaRepository<GoodsModifyInfo, Long> {
+
+    /**
+     * 根据批次号返回修改记录
+     * @param batchCode 批次号
+     * @param status    审核状态
+     * @return
+     */
+    List<GoodsModifyInfo> findByBatchCodeAndStatus(String batchCode, Integer status);
+}

+ 13 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ModifyInfoDao.java

@@ -0,0 +1,13 @@
+package com.uas.platform.b2c.prod.commodity.dao;
+
+import com.uas.platform.b2c.prod.commodity.model.ModifyInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+ * 商品修改明细dao层
+ * @author hulh
+ */
+public interface ModifyInfoDao extends JpaSpecificationExecutor<ModifyInfo>,
+        JpaRepository<ModifyInfo, Long> {
+}

+ 2 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java

@@ -54,8 +54,8 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
      * @param standard the standard 标准状态
      * @return count by enuu and status
      */
-    @Query(value = "select count(1) from products p left join product$private pp on pp.pr_id = p.pr_id where " +
-            "p.pr_enuu=:enuu and p.pr_pcmpcode is not null and p.pr_pbranden is not null and p.pr_standard = :standard and pp.pr_b2cenabled = :enabled", nativeQuery = true)
+    @Query(value = "select count(1) from v$product$private pp where " +
+            "pp.pr_enuu=:enuu and pp.pr_pcmpcode is not null and pp.pr_pbranden is not null and pp.pr_standard = :standard and pp.pr_b2cenabled = :enabled", nativeQuery = true)
     Integer getCountByEnuuAndStatusAndEnabled(@Param("enuu") Long enuu, @Param("standard") Short standard, @Param("enabled") Integer enabled);
 
     /**

+ 6 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductPersonDao.java

@@ -40,4 +40,10 @@ public interface ProductPersonDao extends JpaRepository<ProductPerson, Long>, Jp
      */
     @Query("select p.productId from ProductPerson p where p.enuu = :enuu and p.userUU = :userUU")
     List<Long> findIdByEnuuAndUserUU(@Param("enuu") Long enuu, @Param("userUU") Long userUU);
+
+    /**
+     * 根据userUU查找物料信息
+     * @param userUU
+     */
+    List<ProductPerson> findByUserUU (Long userUU);
 }

+ 19 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductReplaceDao.java

@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.query.Param;
 
+import javax.persistence.ManyToOne;
 import javax.transaction.Transactional;
 import java.util.List;
 
@@ -20,4 +21,22 @@ public interface ProductReplaceDao extends JpaRepository<ProductReplace, Long>,
     @Transactional
     @Modifying
     void deleteByProductId(Long productId);
+
+    /**
+     * 查找表中是否已有该条erp传来的数据
+     * @param erpId
+     * @return
+     */
+    ProductReplace findByErpId(Long erpId);
+
+    /**
+     * 更新替代料替代关系
+     * @param erpId
+     * @param status
+     * @return
+     */
+    @Transactional
+    @Modifying
+    @Query(nativeQuery = true,value = "update product$replace set ptr_status = :status where ptr_erpid = :erpId")
+    void update(@Param("status")String status,@Param("erpId") Long erpId);
 }

+ 24 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/TitleDao.java

@@ -0,0 +1,24 @@
+package com.uas.platform.b2c.prod.commodity.dao;
+
+import com.uas.platform.b2c.prod.commodity.model.Title;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 表头信息的dao层
+ *
+ * @author hulh 2017年12月13日 10点03分
+ */
+@Repository
+public interface TitleDao extends JpaSpecificationExecutor<Title>,
+        JpaRepository<Title, Long> {
+
+    /**
+     * 删除指定表头记录下的表头信息
+     * @param recordid 表头记录id
+     */
+    @Modifying
+    void deleteByRecordid(Long recordid);
+}

+ 11 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/V_ProductPrivateDao.java

@@ -32,4 +32,15 @@ public interface V_ProductPrivateDao extends JpaRepository<V_ProductPrivate, Lon
      */
     @Query(value = "select p from V_ProductPrivate p where id in :idList")
     List<V_ProductPrivate> findProductInId(@Param("idList") List<Long> idList);
+
+    /**
+     * 获取供应商待售有效物料数量
+     *
+     * @param enuu     the enuu 企业enuu
+     * @return count by enuu and status
+     */
+    @Query(value = "select count(1) from v$product$private pp where " +
+            "pp.pr_enuu=:enuu and pp.pr_pcmpcode is not null and pp.pr_pbranden is not null and pp.pr_b2cenabled = :enabled", nativeQuery = true)
+    Integer getCountByEnuuAndEnabled(@Param("enuu") Long enuu, @Param("enabled") Integer enabled);
+
 }

+ 101 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/BackgroundRecord.java

@@ -0,0 +1,101 @@
+package com.uas.platform.b2c.prod.commodity.model;
+
+import javax.persistence.*;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * 超级后台表头记录类
+ * @author hulh 2017年12月13日 10点03分
+ */
+@Entity
+@Table(name = "background$record")
+public class BackgroundRecord {
+
+    /**
+     * 主键
+     */
+    @Id
+    @GeneratedValue
+    @Column(name = "re_id")
+    private Long id;
+
+    /**
+     * 账号userUU
+     */
+    @Column(name = "re_uu")
+    private Long useruu;
+
+    /**
+     * 店铺enuu
+     */
+    @Column(name = "re_enuu")
+    private Long enuu;
+
+    /**
+     * 表头信息Set
+     */
+    @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
+    @JoinColumn(name = "re_id")
+    private Set<Title> titleSet;
+
+    /**
+     * 表头信息创建时间
+     */
+    @Column(name = "re_create_time")
+    private Date createTime;
+
+    /**
+     * 表头信息更新时间
+     */
+    @Column(name = "re_update_time")
+    private Date updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getUseruu() {
+        return useruu;
+    }
+
+    public void setUseruu(Long useruu) {
+        this.useruu = useruu;
+    }
+
+    public Long getEnuu() {
+        return enuu;
+    }
+
+    public void setEnuu(Long enuu) {
+        this.enuu = enuu;
+    }
+
+    public Set<Title> getTitleSet() {
+        return titleSet;
+    }
+
+    public void setTitleSet(Set<Title> titleSet) {
+        this.titleSet = titleSet;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 42 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/model/Goods.java

@@ -288,6 +288,12 @@ public class Goods implements Serializable {
 	@Transient
 	private Integer restDays;
 
+	/**
+	 * 冻结数
+	 */
+	@Transient
+	private Integer frozen;
+
 	/**
 	 * 包装:托盘、管装、卷带
 	 */
@@ -509,6 +515,17 @@ public class Goods implements Serializable {
     @Column(name = "go_pronum")
     private String prodNum;
 
+	/**
+	 * 审核状态,未审核 0,已审核 1
+	 */
+	@Column(name = "go_audited")
+	private Short audited;
+
+	/**
+	 * 审核时间
+	 */
+	@Column(name = "go_audited_time")
+	private Date auditedTime;
 
 	@Transient
 	private String selfSale;
@@ -909,7 +926,15 @@ public class Goods implements Serializable {
 		return this;
 	}
 
-    public String getBranduuid() {
+	public Integer getFrozen() {
+		return frozen;
+	}
+
+	public void setFrozen(Integer frozen) {
+		this.frozen = frozen;
+	}
+
+	public String getBranduuid() {
         return branduuid;
     }
 
@@ -1577,6 +1602,22 @@ public class Goods implements Serializable {
 		return g;
 	}
 
+	public Short getAudited() {
+		return audited;
+	}
+
+	public void setAudited(Short audited) {
+		this.audited = audited;
+	}
+
+	public Date getAuditedTime() {
+		return auditedTime;
+	}
+
+	public void setAuditedTime(Date auditedTime) {
+		this.auditedTime = auditedTime;
+	}
+
 	/**
 	 * 产品转goods
 	 * @return

+ 165 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsFilter.java

@@ -0,0 +1,165 @@
+package com.uas.platform.b2c.prod.commodity.model;
+
+/**
+ * 超级后台产品管理过滤类,由于过滤属性太多
+ *
+ * @author hulh
+ */
+public class GoodsFilter {
+
+    /**
+     * 型号
+     */
+    private String code;
+
+    /**
+     * 品牌中文或英文名
+     */
+    private String brand;
+
+    /**
+     * 店铺名或店铺enuu
+     */
+    private String store;
+
+    /**
+     * 类目id,以-拼接
+     */
+    private String kindUuid;
+
+    /**
+     * 在售状态
+     */
+    private Integer saleStatus;
+
+    /**
+     * 在售数量
+     */
+    private Integer saleNum;
+
+    /**
+     * 币别
+     */
+    private String currency;
+
+    /**
+     * 销售方式,自营或寄售
+     */
+    private Boolean saleSelf;
+
+    /**
+     * 是否拆卖
+     */
+    private Boolean breakUp;
+
+    /**
+     * 产品类型,标准或非标
+     */
+    private Boolean standard;
+
+    /**
+     * 审核状态,未审核 0,已审核 1
+     */
+    private Short audited;
+
+    /**
+     * 是否有图片
+     */
+    private Boolean haveImg;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getStore() {
+        return store;
+    }
+
+    public void setStore(String store) {
+        this.store = store;
+    }
+
+    public String getKindUuid() {
+        return kindUuid;
+    }
+
+    public void setKindUuid(String kindUuid) {
+        this.kindUuid = kindUuid;
+    }
+
+    public String getCurrency() {
+        return currency;
+    }
+
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+
+    public Boolean getSaleSelf() {
+        return saleSelf;
+    }
+
+    public void setSaleSelf(Boolean saleSelf) {
+        this.saleSelf = saleSelf;
+    }
+
+    public Boolean getBreakUp() {
+        return breakUp;
+    }
+
+    public void setBreakUp(Boolean breakUp) {
+        this.breakUp = breakUp;
+    }
+
+    public Boolean getStandard() {
+        return standard;
+    }
+
+    public void setStandard(Boolean standard) {
+        this.standard = standard;
+    }
+
+    public Short getAudited() {
+        return audited;
+    }
+
+    public void setAudited(Short audited) {
+        this.audited = audited;
+    }
+
+    public Boolean getHaveImg() {
+        return haveImg;
+    }
+
+    public void setHaveImg(Boolean haveImg) {
+        this.haveImg = haveImg;
+    }
+
+    public Integer getSaleStatus() {
+        return saleStatus;
+    }
+
+    public void setSaleStatus(Integer saleStatus) {
+        this.saleStatus = saleStatus;
+    }
+
+    public Integer getSaleNum() {
+        return saleNum;
+    }
+
+    public void setSaleNum(Integer saleNum) {
+        this.saleNum = saleNum;
+    }
+}

+ 15 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsHistory.java

@@ -403,6 +403,12 @@ public class GoodsHistory {
 	@Column(name = "go_pronum")
 	private String prodNum;
 
+	/**
+	 * 下架原因
+	 */
+	@Column(name = "go_down_msg")
+	private String downMsg;
+
 	/**
 	 * 分段价格
 	 */
@@ -415,6 +421,7 @@ public class GoodsHistory {
 	@OneToOne(cascade = { CascadeType.REFRESH })
 	@JoinColumn(name = "log_operateuu", insertable = false, updatable = false)
 	private UserBaseInfo operater;
+
 	@Transient
 	private String enterpriseName;
 
@@ -1011,7 +1018,6 @@ public class GoodsHistory {
         this.batchCode = goods.getBatchCode();
         this.createdDate = goods.getCreatedDate();
         this.availableDays = goods.getAvailableDays();
-        this.updateDate = goods.getUpdateDate();
         this.minBuyQty = goods.getMinBuyQty();
         this.minPackQty = goods.getMinPackQty();
         this.publisherUU = goods.getPublisherUU();
@@ -1149,6 +1155,14 @@ public class GoodsHistory {
 		this.tag = tag;
 	}
 
+	public String getDownMsg() {
+		return downMsg;
+	}
+
+	public void setDownMsg(String downMsg) {
+		this.downMsg = downMsg;
+	}
+
 	public String getProdNum() {
 		return prodNum;
 	}

+ 199 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsModifyInfo.java

@@ -0,0 +1,199 @@
+package com.uas.platform.b2c.prod.commodity.model;
+
+import javax.persistence.*;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 商品修改记录类
+ * @author hulh 2017年12月14日 11点22分
+ */
+@Entity
+@Table(name = "trade$goods_modify")
+public class GoodsModifyInfo {
+
+    /**
+     * 主键
+     */
+    @Id
+    @GeneratedValue
+    @Column(name = "id")
+    private Long id;
+
+    /**
+     * 用户useruu
+     */
+    @Column(name = "mo_useruu")
+    private Long useruu;
+
+    /**
+     * 更新人
+     */
+    @Column(name = "mo_operate_name")
+    private String operateName;
+
+    /**
+     * 店铺enuu
+     */
+    @Column(name = "mo_enuu")
+    private Long enuu;
+
+    /**
+     * 商品批次号
+     */
+    @Column(name = "mo_batchcode")
+    private String batchCode;
+
+    /**
+     * 商品修改信息Set
+     */
+    @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
+    @JoinColumn(name = "mo_id")
+    private List<ModifyInfo> infoList;
+
+    /**
+     * 审核人
+     */
+    @Column(name = "mo_audited_name")
+    private String auditedName;
+
+    /**
+     * 更新时间
+     */
+    @Column(name = "mo_audited_time")
+    private Date auditedTime;
+
+    /**
+     * 更新时间
+     */
+    @Column(name = "mo_update_time")
+    private Date updateTime;
+
+    /**
+     * 审核状态  10:未审核 11:通过 12:不通过
+     */
+    @Column(name = "mo_status")
+    private Integer status;
+
+    /**
+     * 审核不通过信息
+     */
+    @Column(name = "mo_message")
+    private String message;
+
+    /**
+     * 基本信息数
+     */
+    @Transient
+    private int basicCount;
+
+    /**
+     * 销售信息数
+     */
+    @Transient
+    private int sellCount;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getUseruu() {
+        return useruu;
+    }
+
+    public void setUseruu(Long useruu) {
+        this.useruu = useruu;
+    }
+
+    public String getOperateName() {
+        return operateName;
+    }
+
+    public void setOperateName(String operateName) {
+        this.operateName = operateName;
+    }
+
+    public Long getEnuu() {
+        return enuu;
+    }
+
+    public void setEnuu(Long enuu) {
+        this.enuu = enuu;
+    }
+
+    public String getBatchCode() {
+        return batchCode;
+    }
+
+    public void setBatchCode(String batchCode) {
+        this.batchCode = batchCode;
+    }
+
+    public List<ModifyInfo> getInfoList() {
+        return infoList;
+    }
+
+    public void setInfoList(List<ModifyInfo> infoList) {
+        this.infoList = infoList;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getAuditedName() {
+        return auditedName;
+    }
+
+    public void setAuditedName(String auditedName) {
+        this.auditedName = auditedName;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public int getBasicCount() {
+        return basicCount;
+    }
+
+    public void setBasicCount(int basicCount) {
+        this.basicCount = basicCount;
+    }
+
+    public int getSellCount() {
+        return sellCount;
+    }
+
+    public void setSellCount(int sellCount) {
+        this.sellCount = sellCount;
+    }
+
+    public Date getAuditedTime() {
+        return auditedTime;
+    }
+
+    public void setAuditedTime(Date auditedTime) {
+        this.auditedTime = auditedTime;
+    }
+}

+ 122 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/ModifyInfo.java

@@ -0,0 +1,122 @@
+package com.uas.platform.b2c.prod.commodity.model;
+
+import javax.persistence.*;
+
+/**
+ * 商品修改明细类
+ * @author hulh 2017年12月14日 11点22分
+ */
+@Entity
+@Table(name = "trade$goods_modify_info")
+public class ModifyInfo {
+
+    /**
+     * 基本信息
+     */
+    public static final Short TYPE_BASIC = 1;
+
+    /**
+     * 销售信息
+     */
+    public static final Short TYPE_SALE = 2;
+
+    /**
+     * 主键
+     */
+    @Id
+    @GeneratedValue
+    @Column(name = "id")
+    private Long id;
+
+    /**
+     * 关联的商品修改id
+     */
+    @Column(name = "mo_id")
+    private Long modifyid;
+
+    /**
+     * 关联的商品批次号,方便查询
+     */
+    @Column(name = "mo_batch")
+    private String batchCode;
+
+    /**
+     * 修改的字段
+     */
+    @Column(name = "info_field")
+    private String modifyField;
+
+    /**
+     * 修改前信息
+     */
+    @Column(name = "info_before")
+    private String before;
+
+    /**
+     * 修改后信息
+     */
+    @Column(name = "info_after")
+    private String after;
+
+    /**
+     * 修改信息类型
+     */
+    @Column(name = "info_type")
+    private Short type;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getModifyid() {
+        return modifyid;
+    }
+
+    public void setModifyid(Long modifyid) {
+        this.modifyid = modifyid;
+    }
+
+    public String getModifyField() {
+        return modifyField;
+    }
+
+    public void setModifyField(String modifyField) {
+        this.modifyField = modifyField;
+    }
+
+    public String getBefore() {
+        return before;
+    }
+
+    public void setBefore(String before) {
+        this.before = before;
+    }
+
+    public String getAfter() {
+        return after;
+    }
+
+    public void setAfter(String after) {
+        this.after = after;
+    }
+
+    public Short getType() {
+        return type;
+    }
+
+    public void setType(Short type) {
+        this.type = type;
+    }
+
+    public String getBatchCode() {
+        return batchCode;
+    }
+
+    public void setBatchCode(String batchCode) {
+        this.batchCode = batchCode;
+    }
+}

+ 4 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/model/Product.java

@@ -16,8 +16,10 @@ import java.util.Set;
  */
 @Entity
 @Table(name = "products", indexes = {@Index(name = "products_code_index", columnList = "pr_code"),
-@Index(name = "products_enuu_index", columnList = "pr_enuu"),
-@Index(name = "products_enuu_code_index", columnList = "pr_code, pr_enuu", unique = true)})
+	@Index(name = "products_enuu_index", columnList = "pr_enuu"),
+	@Index(name = "products_cmpcode_index", columnList = "pr_cmpcode"),
+	@Index(name = "products_brand_index", columnList = "pr_brand"),
+	@Index(name = "products_enuu_code_index", columnList = "pr_code, pr_enuu", unique = true)})
 @Logger
 //@Cacheable
 //@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.Product")

+ 62 - 6
src/main/java/com/uas/platform/b2c/prod/commodity/model/ProductReplace.java

@@ -1,25 +1,43 @@
 package com.uas.platform.b2c.prod.commodity.model;
 
-import com.uas.platform.b2c.common.account.model.Role;
 import com.uas.platform.b2c.core.support.SystemSession;
-import org.apache.commons.collections.CollectionUtils;
 
 import javax.persistence.*;
+import java.io.Serializable;
 import java.util.Date;
-import java.util.Set;
 
 /**
  * 存贮商城替代物料
  */
 @Entity
 @Table(name = "product$replace")
-public class ProductReplace {
+public class ProductReplace implements Serializable{
 
     @Id
     @GeneratedValue
     @Column(name = "id")
     private Long id;
 
+    /**
+     * erp数据库主键id
+     */
+    @Column(name = "ptr_erpid")
+    private Long erpId;
+
+    /**
+     * 替代关系状态
+     * ON/OFF
+     */
+    @Column(name = "ptr_status")
+    private String status;
+
+    /**
+     * 下载状态
+     */
+    @Column(name="ptr_downstatus")
+    private String downStatus;
+
+
     /**
      * 用户uu
      */
@@ -32,14 +50,20 @@ public class ProductReplace {
     @Column(name = "ptr_prid")
     private Long productId;
 
+    /***
+     * 替代料号
+     */
+    @Column(name = "ptr_replaceid")
+    private String replaceId;
+
     /**
-     * 原型号型号(冗余p字段)
+     * 原型号型号
      */
     @Column(name = "p_cmpcode" ,length = 800)
     private String pCmpcode;
 
     /**
-     * 原品牌品牌(冗余p字段)
+     * 原品牌品牌
      */
     @Column(name = "p_pbranden")
     private String pBranden;
@@ -83,6 +107,14 @@ public class ProductReplace {
     @Column(name = "ptr_detno", nullable = false)
     private Short detno;
 
+    public String getReplaceId() {
+        return replaceId;
+    }
+
+    public void setReplaceId(String replaceId) {
+        this.replaceId = replaceId;
+    }
+
     public Long getId() {
         return id;
     }
@@ -91,6 +123,30 @@ public class ProductReplace {
         this.id = id;
     }
 
+    public Long getErpId() {
+        return erpId;
+    }
+
+    public void setErpId(Long erpId) {
+        this.erpId = erpId;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getDownStatus() {
+        return downStatus;
+    }
+
+    public void setDownStatus(String downStatus) {
+        this.downStatus = downStatus;
+    }
+
     public Long getUserUU() {
         return userUU;
     }

+ 2 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -44,7 +44,7 @@ public class ReleaseProductByBatch implements Serializable {
 
 	static {
 		String[] array = {"Bulk-散装", "Reel-卷装", "Tape/Reel-编带", "Tray-盘装",
-				"Tube-管装", "盒装", "袋装", "罐装", "瓶装", "桶装", "箱装"};
+				"Tube-管装", "盒装", "袋装", "罐装", "瓶装", "桶装", "箱装", "其他"};
 		PACKAGING_LIST = Arrays.asList(array);
 
 		String[] status = {"上架", "下架"};
@@ -573,7 +573,7 @@ public class ReleaseProductByBatch implements Serializable {
 
 	public void setCodeByExcel(Object value) {
 		if (!StringUtils.isEmpty(value)) {
-			String code = value.toString();
+			String code = value.toString().trim();
 			Matcher matcher = codePattern.matcher(code);
 			if (!matcher.find()) {
 				addErrmsg(ErrorInfoConstant.CODE_PATTERN_INFO.getInfo());

+ 115 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/Title.java

@@ -0,0 +1,115 @@
+package com.uas.platform.b2c.prod.commodity.model;
+
+import org.apache.commons.collections.CollectionUtils;
+
+import javax.persistence.*;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * 表头信息类
+ * @author hulh 2017年12月13日 10点03分
+ */
+@Entity
+@Table(name = "background$title")
+public class Title {
+
+    private static String[] nameArray = {"产品图片", "商家名称", "封装", "梯度", "单价", "交期(天)",
+            "在售状态", "在售数量", "库存总数", "销售方式"};
+    private static final Set<Title> defaultList = new HashSet<>();
+    static {
+        initDefaultList();
+    }
+
+    /**
+     * 主键
+     */
+    @Id
+    @GeneratedValue
+    @Column(name = "title_id")
+    private Long id;
+
+    /**
+     * 表头名
+     */
+    @Column(name = "title_name")
+    private String titleName;
+
+    /**
+     * 关联的后台记录主键
+     */
+    @Column(name = "re_id")
+    private Long recordid;
+
+    public Title() {
+
+    }
+
+    public Title(String titleName) {
+        this.titleName = titleName;
+    }
+
+    /**
+     * 初始化默认列表
+     */
+    private static void initDefaultList() {
+        if (CollectionUtils.isEmpty(defaultList)) {
+            synchronized (Title.class) {
+                if (CollectionUtils.isEmpty(defaultList)) {
+                    for (String name : nameArray) {
+                        Title title = new Title(name);
+                        defaultList.add(title);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 公有方法获取默认列表
+     * @return
+     */
+    public static Set<Title> getDefaultList(){
+        return defaultList;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Title title = (Title) o;
+
+        return titleName.equals(title.titleName);
+
+    }
+
+    @Override
+    public int hashCode() {
+        return titleName.hashCode();
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getTitleName() {
+        return titleName;
+    }
+
+    public void setTitleName(String titleName) {
+        this.titleName = titleName;
+    }
+
+    public Long getRecordid() {
+        return recordid;
+    }
+
+    public void setRecordid(Long recordid) {
+        this.recordid = recordid;
+    }
+}

+ 48 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/V_ProductPrivate.java

@@ -224,10 +224,28 @@ public class V_ProductPrivate implements Serializable {
      * b2c是否启用
      * 1 启用,
      * 0 未启用
+     * @date 2018年5月8日 17:16:07 dongbw 由于公共物料服务所有物料更新方法都顾及到b2c私有可用属性不好实现,返回去修改商城物料逻辑也很复杂
+     *       现在修改视图为b2cenabled字段为0是为0,非0时为1.
      */
     @Column(name = "pr_b2cenabled")
     private Integer b2cEnabled;
 
+    /**
+     * 是否可卖<br>
+     * 1. 可以卖 <br>
+     * 0. 不可
+     */
+    @Column(name = "pr_issale")
+    private Short isSale;
+
+    /**
+     * 是否可买<br>
+     * 1. 可以买<br>
+     * 0. 不可
+     */
+    @Column(name = "pr_ispurchase")
+    private Short isPurchase;
+
     /**
      * 产品建立时间
      */
@@ -254,6 +272,12 @@ public class V_ProductPrivate implements Serializable {
     @Transient
     private ProductDetail productDetail;
 
+    /**
+     * 判断是否已经加入个人产品库
+     */
+    @Transient
+    private Boolean isAddProductPerson;
+
     /**
      * goods表信息中存在多少条数据
      */
@@ -563,4 +587,28 @@ public class V_ProductPrivate implements Serializable {
     public void setBatchCount(Integer batchCount) {
         this.batchCount = batchCount;
     }
+
+    public Short getIsSale() {
+        return isSale;
+    }
+
+    public void setIsSale(Short isSale) {
+        this.isSale = isSale;
+    }
+
+    public Short getIsPurchase() {
+        return isPurchase;
+    }
+
+    public void setIsPurchase(Short isPurchase) {
+        this.isPurchase = isPurchase;
+    }
+
+    public Boolean getAddProductPerson() {
+        return isAddProductPerson;
+    }
+
+    public void setAddProductPerson(Boolean addProductPerson) {
+        isAddProductPerson = addProductPerson;
+    }
 }

+ 27 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/BackgroundRecordService.java

@@ -0,0 +1,27 @@
+package com.uas.platform.b2c.prod.commodity.service;
+
+import com.uas.platform.b2c.prod.commodity.model.Title;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import java.util.Set;
+
+/**
+ * 表头记录的Service层
+ *
+ * @author hulh 2017年12月13日 10点03分
+ */
+public interface BackgroundRecordService {
+
+    /**
+     * 更新表头信息,如果没发生改变则不更新
+     *
+     * @param titleList 表头list
+     * @return
+     */
+    ResultMap updateTitleInfo(Set<Title> titleList);
+
+    /**
+     * 返回当前用户的表头记录信息
+     * @return
+     */
+    Set<Title> getTitleInfoByUseruu();
+}

+ 18 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/GoodsHistoryService.java

@@ -100,4 +100,22 @@ public interface GoodsHistoryService {
      * @return
      */
     String compareGoodsHistory(GoodsHistory goodsHistory);
+
+    /**
+     * 返回该批次号的上下架历史
+     * @param batchCode 批次号
+     * @return
+     */
+    List<GoodsHistory> findDataOfUpAndDown(String batchCode);
+
+    /**
+     * 通过批次号获取批次变更记录(卖家)
+     *
+     * @param info      the info 一页数据
+     * @param batchCode the batch code 批次信息
+     * @return page
+     */
+    Page<GoodsHistory> findPageByBatchCode(final PageInfo info, String batchCode, Long startDate,
+                                           Long endDate, String keyword);
+
 }

+ 54 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/GoodsModifyInfoService.java

@@ -0,0 +1,54 @@
+package com.uas.platform.b2c.prod.commodity.service;
+
+import com.uas.platform.b2c.prod.commodity.model.GoodsModifyInfo;
+import com.uas.platform.b2c.prod.commodity.model.ModifyInfo;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.data.domain.Page;
+
+import java.util.List;
+
+/**
+ * 产品修改记录service类
+ * @author hulh
+ */
+public interface GoodsModifyInfoService {
+
+    /**
+     * 根据批次号分页获取该Goods指定类型的修改记录明细
+     * @param batchCode 批次号
+     * @param params    分页参数
+     * @param startDate 开始时间
+     * @param endDate   结束时间
+     * @param keyword   关键字
+     * @return
+     */
+    Page<GoodsModifyInfo> getPageModifyRecord(PageParams params, String batchCode, Long startDate,
+                                              Long endDate, String keyword);
+
+    /**
+     * 根据批次号分页获取该Goods指定类型的修改记录明细
+     * @param batchCode 批次号
+     * @param params    分页参数
+     * @param startDate 开始时间
+     * @param endDate   结束时间
+     * @param keyword   关键字
+     * @return
+     */
+    Page<GoodsModifyInfo> getPageModifyDetail(PageParams params, String batchCode, Long startDate,
+                                              Long endDate, String keyword);
+
+    /**
+     * 根据批次号获取该Goods的修改记录
+     * @param batchCode 批次号
+     * @return
+     */
+    List<GoodsModifyInfo> getModifyRecord(String batchCode);
+
+    /**
+     * 根据批次号审核商品
+     * @param batchCode 批次号
+     * @param pass      审核状态
+     * @param message   错误描述
+     */
+    void auditedGoods(String batchCode, Boolean pass, String message);
+}

+ 20 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/service/GoodsService.java

@@ -418,9 +418,10 @@ public interface GoodsService {
      * 卖家下架已上架商品
      *
      * @param batchCodes 待下架商品批次号
+     * @param downMsg   下架原因
      * @return the result map
      */
-    ResultMap offShelfGoodsByProvider(String batchCodes,Boolean isERP);
+    ResultMap offShelfGoodsByProvider(String batchCodes, String downMsg, Boolean isERP);
 
     /**
      * 分页获取批次信息
@@ -678,14 +679,22 @@ public interface GoodsService {
      * @param batchCode
      * @return
      */
-    void addVisitCount(String batchCode);
+    public void addVisitCount(String batchCode);
+
+    /**
+     * 根据分页参数和过滤对象分页获取数据
+     *
+     * @param info 分页参数
+     * @param goodsFilter 过滤对象
+     * @return
+     */
+    Page<Goods> getPageDataOfBackground(PageInfo info, GoodsFilter goodsFilter);
 
     /**
      * 根据productid
      * @param productid
      */
-    ResultMap getDeleteProductMessage(Long
-                                              productid);
+    ResultMap getDeleteProductMessage(Long productid);
 
     /**
      * 修正测试的数据
@@ -693,4 +702,11 @@ public interface GoodsService {
      * @return
      */
     String modifyData();
+
+    /**
+     * 根据id返回一个Goods数据
+     * @param id
+     * @return
+     */
+    Goods getGoodsById(Long id);
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/ProductService.java

@@ -40,7 +40,7 @@ public interface ProductService {
      * 绑定至个人产品库
      * @return all products
      */
-    boolean setAllProductsByProductIds(String ids, Integer isAll, Integer isStardand);
+    Integer setAllProductsByProductIds(String ids, Integer isAll, Integer isStardand);
 
     /**
      * 批量保存个人替代物料信息

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

@@ -0,0 +1,88 @@
+package com.uas.platform.b2c.prod.commodity.service.impl;
+
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.prod.commodity.dao.BackgroundRecordDao;
+import com.uas.platform.b2c.prod.commodity.dao.TitleDao;
+import com.uas.platform.b2c.prod.commodity.model.BackgroundRecord;
+import com.uas.platform.b2c.prod.commodity.model.Title;
+import com.uas.platform.b2c.prod.commodity.service.BackgroundRecordService;
+import com.uas.platform.b2c.prod.commodity.util.SetUtil;
+import com.uas.platform.b2c.trade.support.CodeType;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * 表头记录服务的实现层
+ *
+ * @author hulh 2017年12月13日 11点34分
+ */
+@Service
+public class BackgroundRecordServiceImpl implements BackgroundRecordService {
+
+    @Autowired
+    private BackgroundRecordDao backgroundRecordDao;
+
+    @Autowired
+    private TitleDao titleDao;
+
+    @Autowired
+    private SysConf sysConf;
+
+    /**
+     * 判断表头Set是否修改,未修改则不操作(返回false)
+     * 修改则进行保存操作,并刷新页面 (返回true)
+     *
+     * @param titleList 表头list
+     * @return
+     */
+    @Transactional
+    @Override
+    public ResultMap updateTitleInfo(Set<Title> titleList) {
+        Long userUU = SystemSession.getUser().getUserUU();
+        BackgroundRecord record = backgroundRecordDao.findByUseruu(userUU);
+        if (record == null) {
+            return new ResultMap(CodeType.NOT_COMPLETE_INFO, "对应表头记录丢失,刷新后重试");
+        }
+        Set<Title> beforeSet = record.getTitleSet();
+        // 判断表头信息是否修改
+        boolean isEquals = SetUtil.compareSet(beforeSet, titleList);
+        if (isEquals) {
+            return ResultMap.success(false);
+        }
+        titleDao.deleteByRecordid(record.getId());
+        record.setTitleSet(titleList);
+        backgroundRecordDao.save(record);
+        return ResultMap.success(true);
+    }
+
+    @Override
+    public Set<Title> getTitleInfoByUseruu() {
+        Long userUU = SystemSession.getUser().getUserUU();
+        BackgroundRecord record = backgroundRecordDao.findByUseruu(userUU);
+        if (record == null) {
+            record = createOneRecord();
+            return record.getTitleSet();
+        }
+        return record.getTitleSet();
+    }
+
+    /**
+     * 新建一个表头记录类
+     * @return
+     */
+    private BackgroundRecord createOneRecord() {
+        BackgroundRecord record = new BackgroundRecord();
+        record.setUseruu(SystemSession.getUser().getUserUU());
+        record.setEnuu(sysConf.getEnUU());
+        record.setCreateTime(new Date());
+        record.setUpdateTime(new Date());
+        record.setTitleSet(Title.getDefaultList());
+        return backgroundRecordDao.save(record);
+    }
+}

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

@@ -288,4 +288,46 @@ public class GoodsHistoryServiceImpl implements GoodsHistoryService {
 		}
 		return message;
 	}
+
+	@Override
+	public List<GoodsHistory> findDataOfUpAndDown(String batchCode) {
+		List<String> typeList = Arrays.asList("下架商品", "过期下架(存储过程下架)", "发布商品");
+		return goodsHistoryDao.findByBatchCodeInType(batchCode, typeList);
+	}
+
+	@Override
+	public Page<GoodsHistory> findPageByBatchCode(final PageInfo info, String batchCode, Long startDate,
+												  Long endDate, String keyword) {
+		Goods goods = goodsDao.findByBatchCode(batchCode);
+		if (goods == null) {
+			throw new IllegalOperatorException("批次:" + batchCode + "不存在");
+		}
+		if (startDate != null) {
+			info.expression(PredicateUtils.gte("operateDate", new Date(startDate), true));
+		}
+		if (endDate != null) {
+			info.expression(PredicateUtils.lte("operateDate", new Date(endDate), true));
+		}
+		if (StringUtils.hasText(keyword)) {
+			info.filter("operater.userName", keyword);
+		}
+
+		info.filter("batchCode", batchCode);
+
+		SimpleExpression[] simpArrs = new SimpleExpression[4];
+		simpArrs[0] = new SimpleExpression ("operateType", "上架", Operator.EQ);
+		simpArrs[1] = new SimpleExpression ("operateType", "发布商品", Operator.EQ);
+		simpArrs[2] = new SimpleExpression ("operateType", "下架商品", Operator.EQ);
+		simpArrs[3] = new SimpleExpression ("operateType", "批量下架公司产品", Operator.EQ);
+
+		LogicalExpression logical = new LogicalExpression(simpArrs, Operator.OR);
+		info.expression(logical);
+
+		return goodsHistoryDao.findAll(new Specification<GoodsHistory>() {
+			public Predicate toPredicate(Root<GoodsHistory> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+				query.where(info.getPredicates(root, query, builder));
+				return null;
+			}
+		}, info);
+	}
 }

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

@@ -0,0 +1,153 @@
+package com.uas.platform.b2c.prod.commodity.service.impl;
+
+import com.uas.platform.b2c.core.constant.ShortConstant;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
+import com.uas.platform.b2c.prod.commodity.dao.GoodsModifyInfoDao;
+import com.uas.platform.b2c.prod.commodity.dao.ModifyInfoDao;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
+import com.uas.platform.b2c.prod.commodity.model.GoodsModifyInfo;
+import com.uas.platform.b2c.prod.commodity.model.ModifyInfo;
+import com.uas.platform.b2c.prod.commodity.service.GoodsModifyInfoService;
+import com.uas.platform.b2c.prod.commodity.service.GoodsService;
+import com.uas.platform.b2c.prod.commodity.status.ModifyInfoStatus;
+import com.uas.platform.core.exception.IllegalOperatorException;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import com.uas.platform.core.persistence.criteria.PredicateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品修改记录impl层
+ * @author hulh
+ */
+@Service
+public class GoodsModifyInfoServiceImpl implements GoodsModifyInfoService {
+
+    @Autowired
+    private GoodsModifyInfoDao goodsModifyInfoDao;
+
+    @Autowired
+    private GoodsDao goodsDao;
+
+    @Autowired
+    private GoodsService goodsService;
+
+    @Autowired
+    private ModifyInfoDao modifyInfoDao;
+
+    @Override
+    public Page<GoodsModifyInfo> getPageModifyRecord(PageParams params, String batchCode, Long startDate,
+                                                     Long endDate, String keyword) {
+        final PageInfo info = new PageInfo(params);
+        info.expression(PredicateUtils.eq("batchCode", batchCode, true));
+        info.expression(PredicateUtils.ne("status", ModifyInfoStatus.TO_BE_AUDITED.getCode(), true));
+        if (startDate != null) {
+            info.expression(PredicateUtils.gte("updateTime", new Date(startDate), true));
+        }
+        if (endDate != null) {
+            info.expression(PredicateUtils.lte("updateTime", new Date(endDate), true));
+        }
+        if (StringUtils.hasText(keyword)) {
+            info.filter("operateName", keyword);
+        }
+        return goodsModifyInfoDao.findAll(new Specification<GoodsModifyInfo>() {
+            @Override
+            public Predicate toPredicate(Root<GoodsModifyInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
+                criteriaQuery.where(info.getPredicates(root, criteriaQuery, criteriaBuilder));
+                return null;
+            }
+        }, info);
+    }
+
+    @Override
+    public Page<GoodsModifyInfo> getPageModifyDetail(PageParams params, String batchCode, Long startDate,
+                                                     Long endDate, String keyword) {
+        final PageInfo info = new PageInfo(params);
+        info.expression(PredicateUtils.eq("batchCode", batchCode, true));
+        if (startDate != null) {
+            info.expression(PredicateUtils.gte("updateTime", new Date(startDate), true));
+        }
+        if (endDate != null) {
+            info.expression(PredicateUtils.lte("updateTime", new Date(endDate), true));
+        }
+        if (StringUtils.hasText(keyword)) {
+            info.filter("operateName", keyword);
+        }
+        Page<GoodsModifyInfo> page =  goodsModifyInfoDao.findAll(new Specification<GoodsModifyInfo>() {
+            @Override
+            public Predicate toPredicate(Root<GoodsModifyInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
+                criteriaQuery.where(info.getPredicates(root, criteriaQuery, criteriaBuilder));
+                return null;
+            }
+        }, info);
+        for (GoodsModifyInfo aModify : page.getContent()) {
+            int basicCount = 0;
+            int sellCount = 0;
+            for (ModifyInfo aInfo : aModify.getInfoList()) {
+                if (ModifyInfo.TYPE_BASIC.equals(aInfo.getType())) {
+                    basicCount++;
+                } else if (ModifyInfo.TYPE_SALE.equals(aInfo.getType())) {
+                    sellCount++;
+                }
+            }
+            aModify.setBasicCount(basicCount);
+            aModify.setSellCount(sellCount);
+        }
+        return page;
+    }
+
+    @Override
+    public List<GoodsModifyInfo> getModifyRecord(String batchCode) {
+        if (StringUtils.isEmpty(batchCode)) {
+            throw new IllegalOperatorException("批次号丢失");
+        }
+        return goodsModifyInfoDao.findByBatchCodeAndStatus(batchCode, ModifyInfoStatus.TO_BE_AUDITED.getCode());
+    }
+
+    @Override
+    public void auditedGoods(String batchCode, Boolean pass, String message) {
+        if (pass == null) {
+            throw new IllegalOperatorException("审核是否通过状态丢失");
+        }
+        if (!pass && StringUtils.isEmpty(message)) {
+            throw new IllegalOperatorException("不通过原因不能为空");
+        }
+        if (StringUtils.isEmpty(batchCode)) {
+            throw new IllegalOperatorException("批次号丢失");
+        }
+        Goods goods = goodsDao.findByBatchCode(batchCode);
+        if (goods == null) {
+            throw new IllegalOperatorException("批次号对应商品信息丢失");
+        }
+        List<GoodsModifyInfo> modifyInfoList = getModifyRecord(batchCode);
+        Integer status = pass ? ModifyInfoStatus.AUDITED_PASS.getCode() : ModifyInfoStatus.AUDITED_NOT_PASS.getCode();
+        for (GoodsModifyInfo modifyInfo : modifyInfoList) {
+            modifyInfo.setStatus(status);
+            if (ModifyInfoStatus.AUDITED_NOT_PASS.getCode().equals(status)) {
+                modifyInfo.setMessage(message);
+            }
+            modifyInfo.setAuditedTime(new Date());
+            modifyInfo.setAuditedName(SystemSession.getUser().getUserName());
+        }
+        goodsModifyInfoDao.save(modifyInfoList);
+        goods.setAudited(ShortConstant.YES_SHORT);
+        goods.setAuditedTime(new Date());
+        goodsDao.save(goods);
+        if (!pass) {
+            // 不通过下架该商品
+            goodsService.offShelfGoodsByProvider(goods.getBatchCode(), message, false);
+        }
+    }
+}

+ 377 - 40
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -12,12 +12,15 @@ import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
 import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.constant.ShortConstant;
 import com.uas.platform.b2c.core.constant.SplitChar;
 import com.uas.platform.b2c.core.constant.Status;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.DoubleArith;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.core.utils.NumberUtil;
+import com.uas.platform.b2c.core.utils.PatternUtil;
+import com.uas.platform.b2c.core.utils.RegexConstant;
 import com.uas.platform.b2c.external.erp.commodity.util.ModelConverter;
 import com.uas.platform.b2c.prod.commodity.constant.DoubleConstant;
 import com.uas.platform.b2c.prod.commodity.constant.IntegerConstant;
@@ -26,6 +29,8 @@ import com.uas.platform.b2c.prod.commodity.dao.*;
 import com.uas.platform.b2c.prod.commodity.model.*;
 import com.uas.platform.b2c.prod.commodity.model.GoodsHistory.OperateType;
 import com.uas.platform.b2c.prod.commodity.service.*;
+import com.uas.platform.b2c.prod.commodity.status.ModifyInfoStatus;
+import com.uas.platform.b2c.prod.commodity.type.ModifyConstant;
 import com.uas.platform.b2c.prod.commodity.util.GoodsUtil;
 import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
@@ -208,6 +213,9 @@ public class GoodsServiceImpl implements GoodsService {
     @Autowired
     private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
 
+    @Autowired
+    private GoodsModifyInfoDao goodsModifyInfoDao;
+
     private final Logger logger = Logger.getLogger(getClass());
 
     @Autowired
@@ -495,7 +503,7 @@ public class GoodsServiceImpl implements GoodsService {
 		}
 		goodsDao.modifyReserve(goods.getBatchCode(), goods.getUuid(), goods.getReserve(), goods.getStatus().intValue());
 		// 每次批次保存同时保存一遍历史信息
-		GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.DeductReserve.getPhrase(),false);
+		GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.DeductReserve.getPhrase(), false);
 		goodsHistoryService.save(goodsHistory);
 		// 更新器件属性的库存
 		updateComponentTradeInfos(goods.getUuid());
@@ -533,7 +541,7 @@ public class GoodsServiceImpl implements GoodsService {
 
             goodsDao.modifyReserve(goods.getBatchCode(), goods.getUuid(), goods.getReserve(), goods.getStatus().intValue());
             // 每次批次保存同时保存一遍历史信息
-            GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.ReleaseReserve.getPhrase(),false);
+            GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.ReleaseReserve.getPhrase(), false);
             goodsHistoryService.save(goodsHistory);
             // 更新器件属性的库存
             updateComponentTradeInfos(goods.getUuid());
@@ -719,7 +727,7 @@ public class GoodsServiceImpl implements GoodsService {
             return null;
         }
 //		updateGoodTransactional(goods);
-        GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(),false);
+        GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false);
         //仅保存商品信息,不上架
         if (goods.getId() == null || goods.getSold() == null) {
             goods.setSold(IntegerConstant.NO_INT);
@@ -783,7 +791,7 @@ public class GoodsServiceImpl implements GoodsService {
             if (resultMap.getCode() != CodeType.OK.code()) {
                 continue;
             }
-            GoodsHistory g = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(),false);
+            GoodsHistory g = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false);
             goodsHistorys.add(g);
             list.add(goods);
             if (goods.getUuid() != null) {
@@ -816,7 +824,7 @@ public class GoodsServiceImpl implements GoodsService {
             if (resultMap.getCode() != CodeType.OK.code()) {
                 continue;
             }
-            GoodsHistory g = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(),false);
+            GoodsHistory g = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false);
             goodsHistorys.add(g);
             list.add(goods);
             if (goods.getUuid() != null) {
@@ -1257,6 +1265,7 @@ public class GoodsServiceImpl implements GoodsService {
             pageInfo.expression(logical);
         }
         Page<Goods> pageGoods = goodsDao.findAll(new Specification<Goods>() {
+            @Override
             public Predicate toPredicate(Root<Goods> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
                 query.where(pageInfo.getPredicates(root, query, builder));
                 return null;
@@ -1350,11 +1359,209 @@ public class GoodsServiceImpl implements GoodsService {
                 return new ResultMap(CodeType.SAVED.code(), "该物料已存在(包装、日期、最小包装量、最小起订量、交期、单位、价格)相同的信息");
             }
         }
+        // 比较两个goods编辑信息
+        compareGoodsWithModify(nowGoods, goods);
         resultGoods = updateGoods(nowGoods, goods);
         updateComponentTradeInfos(nowGoods.getUuid());
         return ResultMap.success(resultGoods);
     }
 
+    /**
+     * 比较两个Goods,得出修改后的信息
+     * @param beforeGoods 原有的Goods
+     * @param afterGoods  修改的Goods
+     */
+    private void compareGoodsWithModify(Goods beforeGoods, Goods afterGoods) {
+        List<ModifyInfo> infoList = new ArrayList<>();
+        String beforeImg = beforeGoods.getImg();
+        String afterImg = afterGoods.getImg();
+        if (StringUtils.isEmpty(beforeImg) && StringUtils.hasText(afterImg)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_IMG.getPhrase());
+            info.setBefore(StringConstant.DEFAULT_IMG);
+            info.setAfter(StringConstant.NEW_IMG);
+            info.setType(ModifyInfo.TYPE_BASIC);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        if (StringUtils.hasText(beforeImg) && !beforeImg.equals(afterImg)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_IMG.getPhrase());
+            info.setBefore(StringConstant.OLD_IMG);
+            info.setAfter(StringConstant.NEW_IMG);
+            info.setType(ModifyInfo.TYPE_BASIC);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        String beforePackage = beforeGoods.getPackaging();
+        String afterPackage = afterGoods.getPackaging();
+        if (!beforePackage.equals(afterPackage)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_PACKAGE.getPhrase());
+            info.setBefore(beforePackage);
+            info.setAfter(afterPackage);
+            info.setType(ModifyInfo.TYPE_BASIC);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        String beforeProduce = beforeGoods.getProduceDate();
+        String afterProduce = afterGoods.getProduceDate();
+        if (!beforeProduce.equals(afterProduce)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_PRODUCE_DATE.getPhrase());
+            info.setBefore(beforeProduce);
+            info.setAfter(afterProduce);
+            info.setType(ModifyInfo.TYPE_BASIC);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        Boolean beforeBreak = beforeGoods.getBreakUp();
+        Boolean afterBreak = afterGoods.getBreakUp();
+        if (!beforeBreak.equals(afterBreak)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_BREAK_UP.getPhrase());
+            info.setBefore(beforeBreak.toString());
+            info.setAfter(afterBreak.toString());
+            info.setType(ModifyInfo.TYPE_SALE);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        Double beforeReserve = beforeGoods.getReserve();
+        Double afterReserve = afterGoods.getReserve();
+        if (!beforeReserve.equals(afterReserve)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_RESERVE.getPhrase());
+            info.setBefore(beforeReserve.toString());
+            info.setAfter(afterReserve.toString());
+//            info.setType(ModifyInfo.TYPE_SALE);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        Double beforePackQty = beforeGoods.getMinPackQty();
+        Double afterPackQty = afterGoods.getMinPackQty();
+        if (!beforePackQty.equals(afterPackQty)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_PACKAGE_QTY.getPhrase());
+            info.setBefore(beforePackQty.toString());
+            info.setAfter(afterPackQty.toString());
+            info.setType(ModifyInfo.TYPE_BASIC);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        Double beforeBuyQty = beforeGoods.getMinBuyQty();
+        Double afterBuyQty = afterGoods.getMinBuyQty();
+        if (!beforeBuyQty.equals(afterBuyQty)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_BUY_QTY.getPhrase());
+            info.setBefore(beforeBuyQty.toString());
+            info.setAfter(afterBuyQty.toString());
+            info.setType(ModifyInfo.TYPE_SALE);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        Short beforeMinDelivery = beforeGoods.getMinDelivery();
+        Short afterMinDelivery = afterGoods.getMinDelivery();
+        if (!beforeMinDelivery.equals(afterMinDelivery)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_MIN_DELIVERY.getPhrase());
+            info.setBefore(beforeMinDelivery.toString());
+            info.setAfter(afterMinDelivery.toString());
+            info.setType(ModifyInfo.TYPE_SALE);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        Short beforeMaxDelivery = beforeGoods.getMaxDelivery();
+        Short afterMaxDelivery = afterGoods.getMaxDelivery();
+        if (!beforeMaxDelivery.equals(afterMaxDelivery)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_MAX_DELIVERY.getPhrase());
+            info.setBefore(beforeMaxDelivery.toString());
+            info.setAfter(afterMaxDelivery.toString());
+            info.setType(ModifyInfo.TYPE_SALE);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        Integer beforeSale = sysConf.getStoreid().equals(beforeGoods.getStoreid()) ? IntegerConstant.B2C_SALE : IntegerConstant.SELF_SALE;
+        String beforeStore = beforeSale.toString();
+        String afterStore = afterGoods.getSelfSale();
+        if (!beforeStore.equals(afterStore)) {
+            ModifyInfo info = new ModifyInfo();
+            info.setModifyField(ModifyConstant.MODIFY_SALE_METHOD.getPhrase());
+            if (beforeStore.equals(IntegerConstant.B2C_SALE.toString())) {
+                info.setBefore(StringConstant.CONSIGNMENT);
+                info.setAfter(StringConstant.SALE_SELF);
+            } else {
+                info.setBefore(StringConstant.SALE_SELF);
+                info.setAfter(StringConstant.CONSIGNMENT);
+            }
+            info.setType(ModifyInfo.TYPE_SALE);
+            info.setBatchCode(beforeGoods.getBatchCode());
+            infoList.add(info);
+        }
+        if (beforeGoods.getCurrencyName().equals(afterGoods.getCurrencyName())) {
+            if (!GoodsUtil.compareWithQtyPrice(beforeGoods.getPrices(), afterGoods.getPrices(), beforeGoods.getCurrencyName())) {
+                // 生成分段数量修改记录
+                ModifyInfo qtyInfo = new ModifyInfo();
+                qtyInfo.setModifyField(ModifyConstant.MODIFY_QTY_NUMBER.getPhrase());
+                qtyInfo.setBefore(analyzeQtyNumber(beforeGoods.getPrices()));
+                qtyInfo.setAfter(analyzeQtyNumber(afterGoods.getPrices()));
+                qtyInfo.setType(ModifyInfo.TYPE_SALE);
+                qtyInfo.setBatchCode(beforeGoods.getBatchCode());
+                infoList.add(qtyInfo);
+                // 生成分段价格修改记录
+                ModifyInfo priceInfo = new ModifyInfo();
+                priceInfo.setModifyField(ModifyConstant.MODIFY_QTY_PRICE.getPhrase());
+                priceInfo.setBefore(analyzeQtyPrice(beforeGoods.getPrices()));
+                priceInfo.setAfter(analyzeQtyPrice(afterGoods.getPrices()));
+                priceInfo.setType(ModifyInfo.TYPE_SALE);
+                priceInfo.setBatchCode(beforeGoods.getBatchCode());
+                infoList.add(priceInfo);
+            }
+        }
+        if (!CollectionUtils.isEmpty(infoList)) {
+            beforeGoods.setAudited(ShortConstant.NO_SHORT);
+            GoodsModifyInfo modifyInfo = new GoodsModifyInfo();
+            modifyInfo.setEnuu(SystemSession.getUser().getEnterprise().getUu());
+            modifyInfo.setUseruu(SystemSession.getUser().getUserUU());
+            modifyInfo.setOperateName(SystemSession.getUser().getUserName());
+            modifyInfo.setBatchCode(beforeGoods.getBatchCode());
+            modifyInfo.setStatus(ModifyInfoStatus.TO_BE_AUDITED.getCode());
+            modifyInfo.setUpdateTime(new Date());
+            modifyInfo.setInfoList(infoList);
+            goodsModifyInfoDao.save(modifyInfo);
+        }
+    }
+
+    /**
+     * 分析分段价格获取数量字符串
+     * @param   qtyPriceList
+     * @return
+     */
+    private String analyzeQtyNumber(List<GoodsQtyPrice> qtyPriceList) {
+        StringBuilder builder = new StringBuilder();
+        for (GoodsQtyPrice qtyPrice : qtyPriceList) {
+            builder.append(SplitChar.SLASH);
+            builder.append(qtyPrice.getStart());
+        }
+        return builder.substring(1);
+    }
+
+    /**
+     * 分析分段价格获取价格字符串
+     * @param   qtyPriceList
+     * @return
+     */
+    private String analyzeQtyPrice(List<GoodsQtyPrice> qtyPriceList) {
+        StringBuilder builder = new StringBuilder();
+        Double price = null;
+        for (GoodsQtyPrice qtyPrice : qtyPriceList) {
+            builder.append(SplitChar.SLASH);
+            price = qtyPrice.getRMBPrice() != null ? qtyPrice.getRMBPrice() : qtyPrice.getUSDPrice();
+            builder.append(price);
+        }
+        return builder.substring(1);
+    }
+
     @Transactional
     @Override
     public ResultMap putOn(Long id) {
@@ -1383,7 +1590,7 @@ public class GoodsServiceImpl implements GoodsService {
                 return resultMap;
             }
             //	updateGoodTransactional(goods);
-            GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, OperateType.Publish.getPhrase(),false);
+            GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, OperateType.Publish.getPhrase(), false);
             Goods persistGoods = goodsDao.save(goods);
             goodsHistoryDao.save(goodsHistory);
             // TODO huxz 添加或修改商品价格信息
@@ -1397,7 +1604,6 @@ public class GoodsServiceImpl implements GoodsService {
         }
     }
 
-
     /**
      * 添加保存的产品信息
      * @param goods
@@ -1444,7 +1650,7 @@ public class GoodsServiceImpl implements GoodsService {
         }
         goods.setStatus(Status.NO_SHELVE.value());
         //	updateGoodTransactional(goods);
-        GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, OperateType.ADD_GOODS.getPhrase(),false);
+        GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, OperateType.ADD_GOODS.getPhrase(), false);
         Goods persistGoods = goodsDao.save(goods);
         if(product != null) {
             ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(product.getId());
@@ -1753,7 +1959,7 @@ public class GoodsServiceImpl implements GoodsService {
                     goodsDao.deleteByBatchCode(batchCode);
 
                     GoodsHistory goodsHist = goodsHistoryService.converTGoodsHist(goods,
-                            GoodsHistory.OperateType.Down.getPhrase(),false);
+                            GoodsHistory.OperateType.Down.getPhrase(), false);
                     goodsHist.setMessage(goodsHist.getMessage() + "该批次下架");
                     goodsHistoryService.save(goodsHist);
                     uuids.add(goods.getUuid());
@@ -1939,7 +2145,7 @@ public class GoodsServiceImpl implements GoodsService {
         } else {
             goods.setStatus(Status.UNAVAILABLE.value());
         }
-        GoodsHistory converTGoodsHist = goodsHistoryService.converTGoodsHist(goods, OperateType.Update.getPhrase(),true);
+        GoodsHistory converTGoodsHist = goodsHistoryService.converTGoodsHist(goods, OperateType.Update.getPhrase(), true);
         goodsHistoryService.save(converTGoodsHist);
         Goods good = goodsDao.save(goods);
         if (good == null) {
@@ -1962,7 +2168,7 @@ public class GoodsServiceImpl implements GoodsService {
                 goods.setStatus(Status.UNAVAILABLE.value());
             }
             // 每次批次保存同时保存一遍历史信息
-            GoodsHistory goodsHist = goodsHistoryService.converTGoodsHist(goods, OperateType.OrderPaied.getPhrase(),true);
+            GoodsHistory goodsHist = goodsHistoryService.converTGoodsHist(goods, OperateType.OrderPaied.getPhrase(), true);
             goodsHist.setMessage(goodsHist.getMessage() + "接口变更库存之后,扣除意向采购单 和正式采购单的购买数量");
             goodsHistoryService.save(goodsHist);
             good = goodsDao.save(goods);
@@ -2128,7 +2334,7 @@ public class GoodsServiceImpl implements GoodsService {
 
                 } else {
                     goods.setStatus(Status.REMOVED.value());
-                    GoodsHistory goodsHist = goodsHistoryService.converTGoodsHist(goods, OperateType.Down.getPhrase(),false);
+                    GoodsHistory goodsHist = goodsHistoryService.converTGoodsHist(goods, OperateType.Down.getPhrase(), false);
                     goodsHist.setMessage(goodsHist.getMessage() + "该批次产品下架(UAS接口)");
                     goodsHistoryService.save(goodsHist);
                     goodsDao.delete(goods);
@@ -2382,7 +2588,7 @@ public class GoodsServiceImpl implements GoodsService {
     }
 
 	@Override
-	public ResultMap offShelfGoodsByProvider(String batchCodes, Boolean isERP) {
+	public ResultMap offShelfGoodsByProvider(String batchCodes, String downMsg, Boolean isERP) {
 		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 		logger.info(String.format("%s 商城测试下架时间记录1", dateFormat.format(new Date())));
 		if (StringUtils.isEmpty(batchCodes)) {
@@ -2399,7 +2605,7 @@ public class GoodsServiceImpl implements GoodsService {
         logger.info(String.format("%s 商城测试下架时间记录2", dateFormat.format(new Date())));
         for (String batchCode : batchCodeArr) {
             logger.info(String.format("%s 商城测试下架时间记录 调用下架方法开始", dateFormat.format(new Date())));
-            ResultMap resultMap = offShelfOneGoodsByProvider(batchCode,isERP);
+            ResultMap resultMap = offShelfOneGoodsByProvider(batchCode, downMsg, isERP);
             logger.info(String.format("%s 商城测试下架时间记录  调用下架方法结束", dateFormat.format(new Date())));
             if (resultMap.isSuccess()) {
                 Goods goods = (Goods) resultMap.getData();
@@ -2436,9 +2642,10 @@ public class GoodsServiceImpl implements GoodsService {
      * 下架单个批次商品
      *
      * @param batchCode 商品批次号
+     * @param downMsg   下架信息
      */
     @Transactional
-    public ResultMap offShelfOneGoodsByProvider(String batchCode, Boolean isERP) {
+    public ResultMap offShelfOneGoodsByProvider(String batchCode, String downMsg, Boolean isERP) {
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         logger.info(String.format("%s 商城测试下架时间记录 进入下架方法", dateFormat.format(new Date())));
         if (StringUtils.isEmpty(batchCode)) {
@@ -2451,9 +2658,12 @@ public class GoodsServiceImpl implements GoodsService {
         if (goods == null) {
             return new ResultMap(CodeType.NOT_EXiST.code(), "对应的批次号" + batchCode + "不存在,请刷新界面再操作");
         }
-        if (!goods.getEnUU().equals(enUU)) {
-            return new ResultMap(CodeType.NOT_PERMIT.code(), "您提交的批次号不属于您当前登陆公司");
+        if (Status.AVAILABLE.value() != goods.getStatus() && Status.UNAVAILABLE.value() != goods.getStatus()) {
+            return new ResultMap(CodeType.NOT_EXiST.code(), "对应的批次号" + batchCode + "未上架,不要下架");
         }
+//        if (!goods.getEnUU().equals(enUU)) {
+//            return new ResultMap(CodeType.NOT_PERMIT.code(), "您提交的批次号不属于您当前登陆公司");
+//        }
         if (goods.getSourceId() != null) {
             return new ResultMap(CodeType.NOT_PERMIT.code(), "批次号" + batchCode + "来自接口,b2c不能进行操作");
         }
@@ -2470,6 +2680,9 @@ public class GoodsServiceImpl implements GoodsService {
                 GoodsHistory.OperateType.Down.getPhrase(), isERP);
         logger.info(String.format("%s 商城测试下架时间记录 转历史库存 结束", dateFormat.format(new Date())));
         goodsHist.setMessage(goodsHist.getMessage() + "该批次下架");
+        if (StringUtils.hasText(downMsg)) {
+            goodsHist.setDownMsg(downMsg);
+        }
         goodsHistoryService.save(goodsHist);
 
         Goods updateGoods = goodsDao.save(goods);
@@ -3484,6 +3697,26 @@ public class GoodsServiceImpl implements GoodsService {
         return ResultMap.success(null);
     }
 
+    @Override
+    public Goods getGoodsById(Long id) {
+        Goods goods = goodsDao.findOne(id);
+        if (goods != null) {
+            if (sysConf.getStoreid().equals(goods.getStoreid())) {
+                goods.setSelfSale("寄售");
+            } else {
+                goods.setSelfSale("自营");
+            }
+            goods.setFrozen(getFrozenCount(goods.getBatchCode()));
+        }
+        if (goods.getUuid() != null) {
+            Component component = componentDao.findByUuid(goods.getUuid());
+            if (component != null) {
+                goods.setAttach(component.getAttach());
+            }
+        }
+        return goods;
+    }
+
     /**
      * 修正测试的数据
      *
@@ -3530,35 +3763,139 @@ public class GoodsServiceImpl implements GoodsService {
         return String.valueOf(goodses.size());
     }
 
-    public ResultMap batchOnSale(List<Long> idList) {
-        Map<String, Object> result = new HashMap<>();
-        List<Integer> statusList = Arrays.asList(Status.AVAILABLE.value(), Status.UNAVAILABLE.value());
-        for (Long id : idList) {
-            Product aProduct = productDao.findOne(id);
-            if (aProduct == null) {
-                continue;
+	@Override
+	public Page<Goods> getPageDataOfBackground(final PageInfo info, GoodsFilter goodsFilter) {
+		if (info == null) {
+			throw new IllegalOperatorException("分页参数丢失");
+		}
+		if (goodsFilter != null) {
+			convertPageInfo(info, goodsFilter);
+		}
+        Page<Goods> page = goodsDao.findAll(new Specification<Goods>() {
+            @Override
+            public Predicate toPredicate(Root<Goods> root, CriteriaQuery<?> query,
+                                         CriteriaBuilder builder) {
+                query.where(info.getPredicates(root, query, builder));
+                return null;
             }
-            ProductDetail detail = productDetailDao.findByProductId(id);
-            if (detail != null) {
-                // 判断是否已有上架商品
-                List<Goods> goodsList = goodsDao.findByProductIdInStatus(id, statusList);
-                if (CollectionUtils.isEmpty(goodsList)) {
-                    // 生成Goods信息
-                    Goods goods = fillDataInGoods(detail);
-                    ResultMap resultMap = putOnGoods(goods);
-                }
+        }, info);
+        List<Goods> goodsList = page.getContent();
+        for (Goods goods : goodsList) {
+            if (sysConf.getStoreid().equals(goods.getStoreid())) {
+                goods.setSelfSale(StringConstant.CONSIGNMENT);
+            } else {
+                goods.setSelfSale(StringConstant.SALE_SELF);
             }
+            goods.setFrozen(getFrozenCount(goods.getBatchCode()));
         }
-        return ResultMap.success(result);
-    }
+		return page;
+	}
 
     /**
-     * 填充相应字段
-     * @param detail
+     * 获取未发货前订单的库存数
+     * @param batchCode
      * @return
      */
-    private Goods fillDataInGoods(ProductDetail detail) {
-        Goods goods = new Goods();
-        return goods;
+    private int getFrozenCount(String batchCode) {
+        String statusStr = OrderStatus.TOBEPAID.getCodes() + SplitChar.HYPHEN + OrderStatus.TOBEDELIVER.getCodes();
+        List<Integer> statusList = new ArrayList<>();
+        for (String str : statusStr.split(SplitChar.HYPHEN)) {
+            statusList.add(Integer.valueOf(str));
+        }
+        List<OrderDetail> detailList = orderDetailDao.findByBatchInStatus(batchCode, statusList);
+        int stock = 0;
+        for (OrderDetail detail : detailList) {
+            stock += detail.getNumber();
+        }
+        return stock;
     }
+
+	private void convertPageInfo(PageInfo info, GoodsFilter goodsFilter) {
+		if (!StringUtils.isEmpty(goodsFilter.getCode())) {
+			info.filter("code", goodsFilter.getCode());
+		}
+		if (!StringUtils.isEmpty(goodsFilter.getBrand())) {
+			SimpleExpression[] brandExpression = new SimpleExpression[2];
+			brandExpression[0] = PredicateUtils.like("brandNameCn", goodsFilter.getBrand(), false, true);
+			brandExpression[1] = PredicateUtils.like("brandNameEn", goodsFilter.getBrand(), false, true);
+			info.expression(PredicateUtils.or((CriterionExpression[]) brandExpression));
+		}
+		if (!StringUtils.isEmpty(goodsFilter.getStore())) {
+            if (RegexConstant.onlyHaveNumber(goodsFilter.getStore())) {
+                SimpleExpression[] storeExpression = new SimpleExpression[2];
+                storeExpression[0] = PredicateUtils.eq("enUU", goodsFilter.getStore(), true);
+                storeExpression[1] = PredicateUtils.like("storeName", goodsFilter.getStore(), false, true);
+                info.expression(PredicateUtils.or((CriterionExpression[]) storeExpression));
+            } else {
+                info.filter("storeName", goodsFilter.getStore());
+            }
+		}
+		if (!StringUtils.isEmpty(goodsFilter.getKindUuid())) {
+            // 如果包含多个叶子类目ID,则获取所有的叶子类目对应的商品信息
+            if (goodsFilter.getKindUuid().contains(SplitChar.COMMA)) {
+                String[] kindIds = goodsFilter.getKindUuid().split(SplitChar.COMMA);
+                info.expression(PredicateUtils.in("kindUuid", kindIds, false));
+            } else {
+                info.expression(PredicateUtils.eq("kindUuid", goodsFilter.getKindUuid(), false));
+            }
+        }
+		if (!StringUtils.isEmpty(goodsFilter.getCurrency())) {
+			info.expression(PredicateUtils.eq("currencyName", goodsFilter.getCurrency(), false));
+		}
+		if (goodsFilter.getSaleSelf() != null) {
+			if (goodsFilter.getSaleSelf()) {
+				info.expression(PredicateUtils.ne("storeid", sysConf.getStoreid(), false));
+			} else {
+				info.expression(PredicateUtils.eq("storeid", sysConf.getStoreid(), false));
+			}
+		}
+		if (goodsFilter.getBreakUp() != null) {
+            int breakUp = goodsFilter.getBreakUp() ? 1 : 0;
+			info.filter("breakUp", breakUp, false);
+		}
+		if (goodsFilter.getHaveImg() != null) {
+            if (goodsFilter.getHaveImg()) {
+                info.expression(PredicateUtils.isNotNull("img"));
+            } else {
+                info.expression(PredicateUtils.isNull("img"));
+            }
+        }
+        if (goodsFilter.getStandard() != null) {
+            if (goodsFilter.getStandard()) {
+                info.expression(PredicateUtils.isNotNull("uuid"));
+            } else {
+                info.expression(PredicateUtils.isNull("uuid"));
+            }
+        }
+        if (goodsFilter.getAudited() != null) {
+            info.expression(PredicateUtils.isNotNull("audited"));
+            info.expression(PredicateUtils.eq("audited", goodsFilter.getAudited(), true));
+        }
+        if (goodsFilter.getSaleStatus() != null || goodsFilter.getSaleNum() != null) {
+            Set<Integer> statusSet = new HashSet<>();
+            if (goodsFilter.getSaleStatus() != null) {
+                // 已上架状态
+                if (Status.AVAILABLE.value() == goodsFilter.getSaleStatus()) {
+                    statusSet.add(Status.AVAILABLE.value());
+                    statusSet.add(Status.UNAVAILABLE.value());
+                } else {
+                    statusSet.add(goodsFilter.getSaleStatus());
+                }
+            }
+            if (goodsFilter.getSaleNum() != null && 603 != goodsFilter.getSaleNum()) {
+                statusSet.add(goodsFilter.getSaleNum());
+            }
+            if (CollectionUtils.isNotEmpty(statusSet)) {
+                SimpleExpression[] statusExpression = new SimpleExpression[statusSet.size()];
+                int i = 0;
+                for (Integer status : statusSet) {
+                    statusExpression[i++] = PredicateUtils.eq("status", status, true);
+                }
+                info.expression(PredicateUtils.or((CriterionExpression[]) statusExpression));
+            }
+        }
+        if (goodsFilter.getSaleNum() != null && 603 == goodsFilter.getSaleNum()) {
+            info.expression(PredicateUtils.eq("reserve", 0, true));
+        }
+	}
 }

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

@@ -0,0 +1,43 @@
+package com.uas.platform.b2c.prod.commodity.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.uas.api.b2c_erp.seller.model.ProductReplaceErp;
+import com.uas.api.b2c_erp.seller.service.ProductReplaceService;
+import com.uas.platform.b2c.external.erp.product.util.ModelConverter;
+import com.uas.platform.b2c.prod.commodity.dao.ProductReplaceDao;
+import com.uas.platform.b2c.prod.commodity.model.ProductReplace;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 替代料传输接口实现类
+ * created by shicr on 2018/4/26
+ **/
+@Service
+public class ProductReplaceServiceImpl implements ProductReplaceService {
+
+    @Autowired
+    private ProductReplaceDao dao;
+
+    /**
+     * 更新替代料
+     *
+     * @param jsonStr
+     * @return
+     */
+    @Override
+    public void update(String jsonStr) {
+        List<ProductReplaceErp> list = (List<ProductReplaceErp>)JSONArray.parseArray(jsonStr,ProductReplaceErp.class);
+        for(ProductReplaceErp replace : list){
+            ProductReplace replace1 = ModelConverter.convert(replace);
+            ProductReplace p = dao.findByErpId(replace1.getErpId());
+            if(p == null){
+                dao.save(replace1);
+            }else{
+                dao.update(replace1.getStatus(),replace1.getErpId());
+            }
+        }
+    }
+}

+ 14 - 5
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -12,7 +12,6 @@ import com.uas.platform.b2c.core.constant.IntegerConstant;
 import com.uas.platform.b2c.core.constant.ShortConstant;
 import com.uas.platform.b2c.core.constant.SplitChar;
 import com.uas.platform.b2c.core.constant.Status;
-import com.uas.platform.b2c.core.constant.SplitChar;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.core.utils.NumberUtil;
@@ -45,7 +44,6 @@ import com.uas.platform.b2c.trade.order.status.OrderStatus;
 import com.uas.platform.b2c.trade.presale.dao.CartDao;
 import com.uas.platform.b2c.trade.presale.dao.GoodsBrowsingHistoryDao;
 import com.uas.platform.b2c.trade.presale.model.Cart;
-import com.uas.platform.b2c.trade.presale.model.Collection;
 import com.uas.platform.b2c.trade.presale.model.GoodsBrowsingHistory;
 import com.uas.platform.b2c.trade.presale.service.CartService;
 import com.uas.platform.b2c.trade.support.CodeType;
@@ -266,6 +264,7 @@ public class ProductServiceImpl implements ProductService {
         }, page);
         List<V_ProductPrivate> productList = productPage.getContent();
         for (V_ProductPrivate product : productList) {
+            product.setAddProductPerson(false);
             if ("ERP".equals(product.getSourceApp())) {
                 ProductDetail productDetail = productDetailDao.findByProductId(product.getId());
                 if (productDetail != null) {
@@ -279,7 +278,15 @@ public class ProductServiceImpl implements ProductService {
                 product.setBatchCount(productPrivate.getBatchCount());
             }
         }
-
+        userUU = SystemSession.getUser().getUserUU();
+        List<ProductPerson> ppList = productPersonDao.findByUserUU(userUU);
+        for (V_ProductPrivate v_productPrivate : productList) {
+            for (ProductPerson productPerson : ppList) {
+                if (v_productPrivate.getId().equals(productPerson.getProductId())) {
+                    v_productPrivate.setAddProductPerson(true);
+                }
+            }
+        }
         return new PageImpl<V_ProductPrivate>(productList, page, productPage.getTotalElements());
     }
 
@@ -351,8 +358,9 @@ public class ProductServiceImpl implements ProductService {
     }
 
     @Override
-    public boolean setAllProductsByProductIds(String ids, Integer isAll, Integer isStardand) {
+    public Integer setAllProductsByProductIds(String ids, Integer isAll, Integer isStardand) {
         List<Long> prIds;
+        int count = 0;
         try {
             prIds = JSON.parseArray(ids,Long.class);
         } catch (RuntimeException e){prIds = new ArrayList<>();}
@@ -370,10 +378,11 @@ public class ProductServiceImpl implements ProductService {
                     productPerson.setProductId(prId);
                     productPerson.setTime(new Date());
                     productPersonDao.save(productPerson);
+                    count++;
                 }
             }
         }
-        return true;
+        return count;
     }
 
     @Override

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

@@ -22,7 +22,12 @@ import com.uas.platform.b2c.prod.commodity.dao.ProductDao;
 import com.uas.platform.b2c.prod.commodity.dao.ProductPersonDao;
 import com.uas.platform.b2c.prod.commodity.dao.ProductPrivateDao;
 import com.uas.platform.b2c.prod.commodity.dao.ReleaseProductByBatchDao;
-import com.uas.platform.b2c.prod.commodity.model.*;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
+import com.uas.platform.b2c.prod.commodity.model.GoodsQtyPrice;
+import com.uas.platform.b2c.prod.commodity.model.Product;
+import com.uas.platform.b2c.prod.commodity.model.ProductPerson;
+import com.uas.platform.b2c.prod.commodity.model.ProductPrivate;
+import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
 import com.uas.platform.b2c.prod.commodity.service.GoodsService;
 import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
 import com.uas.platform.b2c.prod.commodity.util.GoodsUtil;
@@ -40,7 +45,11 @@ import com.uas.platform.core.persistence.criteria.SimpleExpression;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFDateUtil;
-import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.dao.DataAccessException;
@@ -63,7 +72,13 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -155,7 +170,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		int rowNum = sheet.getLastRowNum();
 		if (rowNum > 2000) {
 			throw new IllegalOperatorException
-					("您上传的信息超过2000条,请拆分成2000以再上传");
+					("您上传的信息超过2000条,请拆分成2000以再上传");
 		}
 		List<ReleaseProductByBatch> releaseProductByBatchs = new ArrayList<>(rowNum);
 		String batch = createNumberService.getTimeNumber("product$goods", 8, rowNum);
@@ -713,11 +728,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			} else {
 				String title = StringUtilB2C.replaceLineBreak(priceCellObj.toString());
 				if (Currency.USD.equals(currency)) {
-					if (!title.equals("USD单价1")) {
+					if (!title.equals("USD/PCS单价1")) {
 						throw new IllegalOperatorException("您上传的文件表头与美金模板不符");
 					}
 				} else {
-					if (!title.equals("RMB单价1")) {
+					if (!title.equals("RMB/PCS单价1")) {
 						throw new IllegalOperatorException("您上传的文件表头与人民币模板不符");
 					}
 				}
@@ -1623,6 +1638,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
                 product.setStandard(releaseProductByBatch.getComponentUuId() == null ? (short)0 : (short)1);
                 product.setCmpUuid(releaseProductByBatch.getComponentUuId());
                 product.setCreateTime(new Date(System.currentTimeMillis()));
+                // 产品导入默认可销售
+                product.setIsSale((short) 1);
                 if (isAPerson) {
                     product.setSpec(releaseProductByBatch.getPackaging());
                 }

+ 54 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/status/ModifyInfoStatus.java

@@ -0,0 +1,54 @@
+package com.uas.platform.b2c.prod.commodity.status;
+
+/**
+ * 产品修改记录状态
+ * @author hulh
+ */
+public enum  ModifyInfoStatus {
+
+    /**
+     * 未审核
+     */
+    TO_BE_AUDITED(10, "未审核"),
+
+    /**
+     * 审核通过
+     */
+    AUDITED_PASS(11, "审核通过"),
+
+    /**
+     * 审核不通过
+     */
+    AUDITED_NOT_PASS(12, "审核不通过");
+
+    /**
+     * 状态码
+     */
+    private Integer code;
+
+    /**
+     * 状态描述
+     */
+    private String message;
+
+    ModifyInfoStatus(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}

+ 43 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/type/ModifyConstant.java

@@ -0,0 +1,43 @@
+package com.uas.platform.b2c.prod.commodity.type;
+
+/**
+ * 商品修改常量
+ * @author hulh 2017年12月14日 11点22分
+ */
+public enum  ModifyConstant {
+    MODIFY_IMG(10, "产品图片"),
+    MODIFY_PACKAGE(11, "包装"),
+    MODIFY_PRODUCE_DATE(12, "生产日期"),
+    MODIFY_BREAK_UP(13, "可拆卖"),
+    MODIFY_RESERVE(14, "库存"),
+    MODIFY_BUY_QTY(15, "最小起订量"),
+    MODIFY_PACKAGE_QTY(16, "最小包装量"),
+    MODIFY_MIN_DELIVERY(17, "最小交期"),
+    MODIFY_MAX_DELIVERY(18, "最大交期"),
+    MODIFY_SALE_METHOD(19, "销售方式"),
+    MODIFY_QTY_NUMBER(20, "分段数量"),
+    MODIFY_QTY_PRICE(21, "分段价格");
+
+    ModifyConstant(int value, String phrase) {
+        this.value = value;
+        this.phrase = phrase;
+    }
+
+    private final int value;
+
+    private final String phrase;
+
+    /**
+     * @return 状态的整型编码
+     */
+    public int value() {
+        return this.value;
+    }
+
+    /**
+     * @return 状态的描述
+     */
+    public String getPhrase() {
+        return this.phrase;
+    }
+}

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/util/GoodsUtil.java

@@ -139,7 +139,7 @@ public class GoodsUtil {
 				return false;
 			}
 		} else if (Currency.USD.equals(currency)) {
-			if (!first.getRMBPrice().equals(second.getRMBPrice())) {
+			if (!first.getUSDPrice().equals(second.getUSDPrice())) {
 				return false;
 			}
 		}

+ 33 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/util/SetUtil.java

@@ -0,0 +1,33 @@
+package com.uas.platform.b2c.prod.commodity.util;
+
+import java.util.Set;
+
+/**
+ * 针对Set集合的工具类
+ * @author hulh 2017年12月13日 10点03分
+ */
+public final class SetUtil {
+
+    private SetUtil() {
+
+    }
+
+    /**
+     * 比较两个Set集合中元素是否相等
+     * @param beforeSet 会改变的Set
+     * @param nowSet 不会改变的Set
+     * @param <E> 类型参数
+     * @return Boolean 是否相等
+     */
+    public static <E> Boolean compareSet(Set<? super E> beforeSet, Set<? extends E> nowSet) {
+        if (beforeSet.size() != nowSet.size()) {
+            return false;
+        }
+        int length = beforeSet.size();
+        for (E e : nowSet) {
+            beforeSet.add(e);
+        }
+        return length == beforeSet.size();
+    }
+
+}

+ 17 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentSubmitController.java

@@ -63,6 +63,23 @@ public class ComponentSubmitController {
 		return componentSubmit;
 	}
 
+	/**
+	 * 保存标准器件提交信息(来自新增品牌,修改品牌) 2018年4月20日 09:49:19 前台插件禁用flash会失效,新增上传方法 dongbw
+	 *
+	 * @param component 器件申请信息
+	 * @param uploadItem 规格书附件
+	 * @return 器件申请信息
+	 */
+	@RequestMapping(value = "/upload", method = RequestMethod.POST)
+	public ComponentSubmit saveComponentSubmitWithUploadItem(String component, FileUpload uploadItem) {
+		ComponentSubmit componentSubmit = FastjsonUtils.fromJson(component, ComponentSubmit.class);
+		componentSubmit.setId(null);
+		componentSubmit = componentSubmitService.saveComponentSubmit(componentSubmit, uploadItem);
+		operationInfoService.save(componentSubmit, ServiceCode.componentApply.value());
+		logger.log("器件维护", "保存器件申请", "保存器件申请,原厂型号:" + componentSubmit.getCode(), componentSubmit.getCode(), componentSubmit.getId());
+		return componentSubmit;
+	}
+
 	/**
 	 * 审核通过
 	 * 

+ 13 - 1
src/main/java/com/uas/platform/b2c/prod/product/component/service/ComponentSubmitService.java

@@ -1,7 +1,10 @@
 package com.uas.platform.b2c.prod.product.component.service;
 
 import com.uas.platform.b2c.common.base.model.FileUpload;
-import com.uas.platform.b2c.prod.product.component.modal.*;
+import com.uas.platform.b2c.prod.product.component.modal.Component;
+import com.uas.platform.b2c.prod.product.component.modal.ComponentCrawlSubDetail;
+import com.uas.platform.b2c.prod.product.component.modal.ComponentCrawlSubmit;
+import com.uas.platform.b2c.prod.product.component.modal.ComponentSubmit;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.model.PageInfo;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -35,6 +38,15 @@ public interface ComponentSubmitService {
 	 */
 	public ComponentSubmit saveComponentSubmit(ComponentSubmit componentSubmit);
 
+	/**
+	 * 保存标准器件版本信息(来自新增,更新)
+	 *
+	 * @param componentSubmit  器件申请信息
+	 * @param uploadItem 规格书附件
+	 * @return 器件申请信息
+	 */
+	public ComponentSubmit saveComponentSubmit(ComponentSubmit componentSubmit, FileUpload uploadItem);
+
 	/**
 	 * 根据id查找提交的标准器件信息
 	 * 

+ 13 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentSubmitServiceImpl.java

@@ -2,6 +2,7 @@ package com.uas.platform.b2c.prod.product.component.service.impl;
 
 import com.uas.platform.b2c.common.account.dao.UserBaseInfoDao;
 import com.uas.platform.b2c.common.base.model.FileUpload;
+import com.uas.platform.b2c.common.base.service.FileService;
 import com.uas.platform.b2c.common.base.service.SendMessageService;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
@@ -108,6 +109,9 @@ public class ComponentSubmitServiceImpl implements ComponentSubmitService {
 	@Autowired
 	private KindContrastDao kindContrastDao;
 
+	@Autowired
+	private FileService fileService;
+
 	@Override
 	@Transactional
 	public Component componentSubmitAudit(ComponentSubmit componentSubmit) {
@@ -285,6 +289,15 @@ public class ComponentSubmitServiceImpl implements ComponentSubmitService {
 		return componentSubmitDao.save(componentSubmit);
 	}
 
+	@Override
+	public ComponentSubmit saveComponentSubmit(ComponentSubmit componentSubmit, FileUpload uploadItem) {
+		if ((uploadItem != null) && (uploadItem.getFile() != null)) {
+			String attachUrl = fileService.save(uploadItem);
+			componentSubmit.setAttach(attachUrl);
+		}
+		return saveComponentSubmit(componentSubmit);
+	}
+
 	@Override
 	public ComponentSubmit findComponentSubmitById(Long id) {
 		return componentSubmitDao.findOne(id);

+ 4 - 4
src/main/java/com/uas/platform/b2c/prod/store/api/StoreInController.java

@@ -6,6 +6,8 @@ import com.uas.platform.b2c.prod.store.service.StoreInService;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.List;
-
 /**
  * 店铺操作接口类
  *
@@ -126,9 +126,9 @@ public class StoreInController {
 	 * @param keyword		查询关键字
 	 */
 	@RequestMapping(value = "/stores", method = RequestMethod.GET, params = "op=pageByType")
-	public Page<StoreIn> pageStoresByTypesAndKeywordWhenUserVisitList(PageParams params, String types, @RequestParam(required = false) String keyword) {
+	public Page<StoreIn> pageStoresByTypesAndKeywordWhenUserVisitList(PageParams params, String types, @RequestParam(required = false) String keyword, HttpServletRequest request) {
 		PageInfo pageInfo = new PageInfo(params);
-		return storeService.pageStoresByTypesAndKeyword(pageInfo, types, keyword);
+		return storeService.pageStoresByTypesAndKeyword(pageInfo, types, keyword, request);
 	}
 
 	/**

+ 19 - 1
src/main/java/com/uas/platform/b2c/prod/store/controller/CommodityController.java

@@ -2,6 +2,8 @@ package com.uas.platform.b2c.prod.store.controller;
 
 import com.uas.platform.b2c.prod.commodity.model.Goods;
 import com.uas.platform.b2c.prod.commodity.service.GoodsService;
+import com.uas.platform.b2c.prod.product.kind.model.KindInfo;
+import com.uas.platform.b2c.prod.store.facade.CommodityFacade;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import org.slf4j.Logger;
@@ -13,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * 店铺商品操作接口类
  *
@@ -27,9 +31,12 @@ public class CommodityController {
 
 	private final GoodsService commodityService;
 
+	private final CommodityFacade commodityFacade;
+
 	@Autowired
-	public CommodityController(GoodsService commodityService) {
+	public CommodityController(GoodsService commodityService, CommodityFacade commodityFacade) {
 		this.commodityService = commodityService;
+		this.commodityFacade = commodityFacade;
 	}
 
 	/**
@@ -47,4 +54,15 @@ public class CommodityController {
 		PageInfo pageInfo = new PageInfo(params);
 		return commodityService.pageCommoditiesByEnInfos(storeid, kindUuid, code, pageInfo);
 	}
+
+	/**
+	 * 获取所有类目信息
+	 *
+	 * @return List<KindInfo>
+	 */
+	@RequestMapping(value = "/kinds", method = RequestMethod.GET)
+	public List<KindInfo> getAllKindsInfoByStoreUuid() {
+		logger.info("Get information of all kind");
+		return commodityFacade.getAllKindsInfoByGoods();
+	}
 }

+ 5 - 0
src/main/java/com/uas/platform/b2c/prod/store/facade/CommodityFacade.java

@@ -18,4 +18,9 @@ public interface CommodityFacade {
 	 * @param storeUuid		店铺UUID
 	 */
 	List<KindInfo> getAllKindsInfoByStoreUuid(String storeUuid);
+
+	/**
+	 * 获取店铺的所有类目信息
+	 */
+	List<KindInfo> getAllKindsInfoByGoods();
 }

+ 16 - 0
src/main/java/com/uas/platform/b2c/prod/store/facade/impl/CommodityFacadeImpl.java

@@ -52,4 +52,20 @@ public class CommodityFacadeImpl implements CommodityFacade {
 		allKind.setChildren(children);
 		return Collections.singletonList(allKind);
 	}
+
+	@Override
+	public List<KindInfo> getAllKindsInfoByGoods() {
+		// 外层所有类目包裹
+		final KindInfo allKind = KindInfo.getAllKind();
+		Set<KindInfo> children = new LinkedHashSet<>();
+
+		Set<Long> kindUuidSet = commodityService.findAllKinds();
+		if (!CollectionUtils.isEmpty(kindUuidSet)) {
+			List<KindInfo> kindList = kindService.getStructruingKindsByLeafKindIds(kindUuidSet);
+			children.addAll(kindList);
+		}
+
+		allKind.setChildren(children);
+		return Collections.singletonList(allKind);
+	}
 }

+ 2 - 2
src/main/java/com/uas/platform/b2c/prod/store/facade/impl/StoreApplyFacadeImpl.java

@@ -116,9 +116,9 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 
 		storeApplyService.handlerApply(storeApply);
 		//自动确认开通店铺;
-	/*	if (StoreApply.ApplyStatus.PASS == status) {
+		if (StoreApply.ApplyStatus.PASS == status) {
 			this.autoConfirmOpenStore(uuid, storeApply);
-		}*/
+		}
 		return ResultMap.success(null);
 	}
 

+ 31 - 10
src/main/java/com/uas/platform/b2c/prod/store/facade/impl/StoreInFacadeImpl.java

@@ -1,5 +1,7 @@
 package com.uas.platform.b2c.prod.store.facade.impl;
 
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
+import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.prod.store.dao.StoreInDao;
 import com.uas.platform.b2c.prod.store.facade.StoreInFacade;
 import com.uas.platform.b2c.prod.store.model.EnterpriseSimple;
@@ -33,11 +35,14 @@ public class StoreInFacadeImpl implements StoreInFacade {
 
 	private final QualificationService qualificationService;
 
+	private final EnterpriseDao enterpriseDao;
+
 	@Autowired
-	public StoreInFacadeImpl(StoreInDao storeInDao, StoreInService storeInService, QualificationService qualificationService) {
+	public StoreInFacadeImpl(StoreInDao storeInDao, StoreInService storeInService, QualificationService qualificationService, EnterpriseDao enterpriseDao) {
 		this.storeInDao = storeInDao;
 		this.storeInService = storeInService;
 		this.qualificationService = qualificationService;
+		this.enterpriseDao = enterpriseDao;
 	}
 
 	@Override
@@ -56,14 +61,13 @@ public class StoreInFacadeImpl implements StoreInFacade {
 		if (store == null) {
 			return new ResultMap(CodeType.ERROR_STATE, String.format("编号%s对应的店铺不存在", uuid));
 		}
-
+//		store.setEnterpriseJson(newStoreInfo.getEnterpriseJson());
+//		store.setEnterprise(newStoreInfo.getEnterprise());
 		ResultMap resultMap = setStoreInfoByKind(store, newStoreInfo, kind);
 		if (resultMap != null) {
 			return resultMap;
 		}
-
 		Set<Qualification> qualifications = store.getQualifications();
-
 		if (!CollectionUtils.isEmpty(qualifications)) {
 			Iterator<Qualification> iterator = qualifications.iterator();
 			while (iterator.hasNext()) {
@@ -75,8 +79,21 @@ public class StoreInFacadeImpl implements StoreInFacade {
 			}
 		}
 		store.setQualifications(qualifications);
-
-		store = storeInDao.save(store);
+        if ("BASIC_INFO".equals(kind)) {
+            Enterprise enter = enterpriseDao.findByUu(store.getEnUU());
+            enter.setEnAddress(store.getEnterprise().getEnAddress());
+            enter.setEnTel(store.getEnterprise().getEnTel());
+            enter.setEnFax(store.getEnterprise().getEnFax());
+            enter.setEnPhone(store.getEnterprise().getEnPhone());
+            enter.setEnWeixin(store.getEnterprise().getEnWeixin());
+            enter.setEnQQ(store.getEnterprise().getEnQQ());
+            enterpriseDao.save(enter);
+        }
+        store = storeInDao.save(store);
+		Set<Qualification> qualificationsSort = storeInService.getQualificationsSort();
+		Set<Qualification> qualificationsPo= store.getQualifications();
+		qualificationsSort.addAll(qualificationsPo);
+		store.setQualifications(qualificationsSort);
 		return ResultMap.success(store);
 	}
 
@@ -96,10 +113,14 @@ public class StoreInFacadeImpl implements StoreInFacade {
 			store.setStoreName(StringUtils.hasText(newStoreInfo.getStoreName()) ? newStoreInfo.getStoreName() : null);
 			store.setDescription(newStoreInfo.getDescription());
 			EnterpriseSimple enterprise = store.getEnterprise();
-			enterprise.setEnUrl(newStoreInfo.getEnterprise().getEnUrl());
-			enterprise.setAddress(newStoreInfo.getEnterprise().getAddress());
-			enterprise.setEnTel(newStoreInfo.getEnterprise().getEnTel());
-			enterprise.setEnFax(newStoreInfo.getEnterprise().getEnFax());
+            EnterpriseSimple newEnterprise = newStoreInfo.getEnterprise();
+			enterprise.setEnUrl(newEnterprise.getEnUrl());
+			enterprise.setAddress(newEnterprise.getAddress());
+			enterprise.setEnTel(newEnterprise.getEnTel());
+			enterprise.setEnFax(newEnterprise.getEnFax());
+            enterprise.setEnPhone(newEnterprise.getEnPhone());
+            enterprise.setEnWeixin(newEnterprise.getEnWeixin());
+            enterprise.setEnQQ(newEnterprise.getEnQQ());
 			store.setEnterprise(enterprise);
 			return null;
 		}

+ 41 - 1
src/main/java/com/uas/platform/b2c/prod/store/model/EnterpriseSimple.java

@@ -70,6 +70,19 @@ public class EnterpriseSimple {
 	 */
 	private String enUrl;
 
+	/**
+	 * 手机
+	 */
+	private String enPhone;
+	/**
+	 * 微信
+	 */
+	private String enWeixin;
+	/**
+	 * QQ
+	 */
+	private String enQQ;
+
 	/**
 	 * Logo
 	 */
@@ -187,13 +200,37 @@ public class EnterpriseSimple {
 		this.enLogoUrl = enLogoUrl;
 	}
 
+	public String getEnPhone() {
+		return enPhone;
+	}
+
+	public void setEnPhone(String enPhone) {
+		this.enPhone = enPhone;
+	}
+
+	public String getEnWeixin() {
+		return enWeixin;
+	}
+
+	public void setEnWeixin(String enWeixin) {
+		this.enWeixin = enWeixin;
+	}
+
+	public String getEnQQ() {
+		return enQQ;
+	}
+
+	public void setEnQQ(String enQQ) {
+		this.enQQ = enQQ;
+	}
+
 	public static EnterpriseSimple translateSimple(Enterprise enterprise) {
 		EnterpriseSimple simple = new EnterpriseSimple();
 		simple.uu = enterprise.getUu();
 		simple.enName = enterprise.getEnName();
 		simple.enShortname = enterprise.getEnShortname();
 		simple.enAddress = enterprise.getEnAddress();
-		simple.address = enterprise.getEnAddress();
+		//simple.address = enterprise.getEnAddress();
 		simple.enFax = enterprise.getEnFax();
 		simple.enTel = enterprise.getEnTel();
 		simple.enType = enterprise.getEnType();
@@ -202,6 +239,9 @@ public class EnterpriseSimple {
 		simple.enUrl = enterprise.getEnUrl();
 		simple.enLogoUrl = enterprise.getEnLogoUrl();
 		simple.enEmail = StringUtils.isEmpty(enterprise.getEnEmail()) ? " " : enterprise.getEnEmail();
+		simple.enPhone = enterprise.getEnPhone();
+		simple.enWeixin = enterprise.getEnWeixin();
+		simple.enQQ = enterprise.getEnQQ();
 		return simple;
 	}
 

+ 5 - 0
src/main/java/com/uas/platform/b2c/prod/store/service/CommodityService.java

@@ -16,4 +16,9 @@ public interface CommodityService {
 	 * @param storeUuid		店铺UUID
 	 */
 	Set<Long> findAllKindsByStoreUuid(String storeUuid);
+
+	/**
+	 * 获取所有类目信息
+	 */
+	Set<Long> findAllKinds();
 }

+ 15 - 4
src/main/java/com/uas/platform/b2c/prod/store/service/StoreInService.java

@@ -2,17 +2,19 @@ package com.uas.platform.b2c.prod.store.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.advertise.ad.model.StoreAdsType;
+import com.uas.platform.b2c.prod.store.model.Qualification;
 import com.uas.platform.b2c.prod.store.model.StoreApply;
 import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.prod.store.model.StoreStatus;
 import com.uas.platform.b2c.prod.store.model.StoreType;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.model.PageInfo;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 
 public interface StoreInService {
 
@@ -102,7 +104,7 @@ public interface StoreInService {
 	 * @param types			店铺类型
 	 * @param keyword		查询关键字
 	 */
-	Page<StoreIn> pageStoresByTypesAndKeyword(PageInfo pageInfo, String types, String keyword);
+	Page<StoreIn> pageStoresByTypesAndKeyword(PageInfo pageInfo, String types, String keyword, HttpServletRequest request);
 
 	/**
 	 * 获取最近开店的店铺信息
@@ -190,4 +192,13 @@ public interface StoreInService {
 	 * @return
 	 */
 	Map<String, JSONObject> getContactInfo(List<String> storeids);
+
+	/**
+	 * 给企业资质排序;
+	 * @param
+	 * @return
+	 */
+	Set<Qualification> getQualificationsSort();
+
+
 }

+ 5 - 0
src/main/java/com/uas/platform/b2c/prod/store/service/impl/CommodityServiceImpl.java

@@ -27,4 +27,9 @@ public class CommodityServiceImpl implements CommodityService {
 	public Set<Long> findAllKindsByStoreUuid(String storeUuid) {
 		return goodsDao.findAllKindsByStoreUuid(storeUuid);
 	}
+
+	@Override
+	public Set<Long> findAllKinds() {
+		return goodsDao.findAllKinds();
+	}
 }

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

@@ -102,6 +102,7 @@ public class QualificationServiceImpl implements QualificationService {
 		qualification.setUploaderUU(user.getUserUU());
 		qualification.setCreateTime(date);
 		qualification.setUpdateTime(date);
+		qualificationDao.save(qualification);
 		return qualification;
 	}
 }

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

@@ -122,6 +122,7 @@ public class StoreApplyServiceImpl implements StoreApplyService {
 		storeApply.setUserUU(user.getUserUU());
 		storeApply.setUserName(user.getUserName());
 		storeApply.setCreateTime(date);
+		//将storeApply设置为预审核状态;
 		storeApply.setStatus(StoreApply.ApplyStatus.PREPARE);
 		// 设置店铺基础信息
 		storeApply.setEnUU(user.getEnterprise().getUu());

+ 97 - 35
src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreInServiceImpl.java

@@ -6,8 +6,12 @@ import com.uas.platform.b2c.advertise.ad.model.StoreAdsType;
 import com.uas.platform.b2c.advertise.ad.service.StoreAdsService;
 import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
 import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.account.service.EnterpriseService;
+import com.uas.platform.b2c.common.search.dao.SearchHistoryDao;
+import com.uas.platform.b2c.common.search.model.SearchHistory;
 import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.constant.Type;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.JacksonUtils;
 import com.uas.platform.b2c.core.utils.UuidUtils;
@@ -19,7 +23,13 @@ import com.uas.platform.b2c.prod.store.dao.StoreApplyDao;
 import com.uas.platform.b2c.prod.store.dao.StoreBrandInfoDao;
 import com.uas.platform.b2c.prod.store.dao.StoreInDao;
 import com.uas.platform.b2c.prod.store.exception.EmptyParameterException;
-import com.uas.platform.b2c.prod.store.model.*;
+import com.uas.platform.b2c.prod.store.model.EnterpriseSimple;
+import com.uas.platform.b2c.prod.store.model.Qualification;
+import com.uas.platform.b2c.prod.store.model.StoreApply;
+import com.uas.platform.b2c.prod.store.model.StoreBrandInfo;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.prod.store.model.StoreStatus;
+import com.uas.platform.b2c.prod.store.model.StoreType;
 import com.uas.platform.b2c.prod.store.service.StoreInService;
 import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
 import com.uas.platform.b2c.trade.support.ResultMap;
@@ -28,6 +38,22 @@ import com.uas.platform.core.exception.IllegalStatusException;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
 import com.uas.platform.core.persistence.criteria.SimpleExpression;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -36,16 +62,12 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.jpa.domain.Specification;
+import org.springframework.mobile.device.DeviceResolver;
+import org.springframework.mobile.device.LiteDeviceResolver;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import java.util.*;
-
 /**
  * 店铺业务实现类
  *
@@ -76,8 +98,12 @@ public class StoreInServiceImpl implements StoreInService {
 
 	private final EnterpriseService enterpriseService;
 
+	private final SearchHistoryDao searchHistoryDao;
+
+	private final DeviceResolver deviceResolver = new LiteDeviceResolver();
+
 	@Autowired
-	public StoreInServiceImpl(StoreInDao storeDao, QualificationDao qualificationDao, GoodsDao goodsDao, ComponentDao componentDao, PurchaseDao purchaseDao, StoreBrandInfoDao brandInfoDao, StoreAdsService adsService, SysConf sysConf, EnterpriseService enterpriseService) {
+	public StoreInServiceImpl(StoreInDao storeDao, QualificationDao qualificationDao, GoodsDao goodsDao, ComponentDao componentDao, PurchaseDao purchaseDao, StoreBrandInfoDao brandInfoDao, StoreAdsService adsService, SysConf sysConf, EnterpriseService enterpriseService, SearchHistoryDao searchHistoryDao) {
 		this.storeDao = storeDao;
 		this.qualificationDao = qualificationDao;
 		this.goodsDao = goodsDao;
@@ -87,6 +113,7 @@ public class StoreInServiceImpl implements StoreInService {
 		this.adsService = adsService;
 		this.sysConf = sysConf;
 		this.enterpriseService = enterpriseService;
+		this.searchHistoryDao = searchHistoryDao;
 	}
 
 	@Override
@@ -168,22 +195,51 @@ public class StoreInServiceImpl implements StoreInService {
 		if (enUU == null) {
 			return null;
 		}
-
 		List<StoreIn> storeIns = storeDao.findByEnUU(enUU);
 		if(CollectionUtils.isEmpty(storeIns)) {
 			return null;
 		}else {
+			StoreIn returnStoreIn;
 			StoreIn storeInsOne = storeIns.get(0);
-			EnterpriseSimple enterpriseSimple = EnterpriseSimple.translateSimple(SystemSession.getUser().getEnterprise());
+			/*EnterpriseSimple enterpriseSimple = EnterpriseSimple.translateSimple(SystemSession.getUser().getEnterprise());
 			if (enterpriseSimple.getEnName().equals(storeInsOne.getEnterprise().getEnName())) {
-				return storeInsOne;
+				returnStoreIn = storeInsOne;
 			} else {
 				storeInsOne.setEnterprise(enterpriseSimple);
-				return storeDao.save(storeInsOne);
-			}
+				returnStoreIn = storeDao.save(storeInsOne);
+			}*/
+			returnStoreIn = storeInsOne;
+			Set<Qualification> qualifications = returnStoreIn.getQualifications();
+			Set<Qualification> qualificationsSort = getQualificationsSort();
+			qualificationsSort.addAll(qualifications);
+			returnStoreIn.setQualifications(qualificationsSort);
+			return returnStoreIn;
 		}
 	}
 
+	public Set<Qualification> getQualificationsSort() {
+		return new TreeSet<Qualification>(new Comparator()
+            {
+                public int compare(Object o1, Object o2) {
+                    Qualification time1 = (Qualification)o1;
+                    Qualification time2 = (Qualification)o2;
+                    if (time1.getId().intValue() > time2.getId().intValue())
+                    {
+                        return 1;
+                    }
+                    else if (time1.getId().intValue() == time2.getId().intValue())
+                    {
+                        return 0;
+                    }
+                    else
+                    {
+                        return -1;
+                    }
+                }
+
+            });
+	}
+
 	@Override
 	public String findUUidByEnUU(Long enUU) {
 		if (enUU == null) {
@@ -212,26 +268,7 @@ public class StoreInServiceImpl implements StoreInService {
 		logger.info("Start to execute find.");
 		StoreIn store = storeDao.findByUuid(uuid);
 		// 为了给前端返回一致的顺序
-		Set<Qualification> qualifications = new TreeSet<Qualification>(new Comparator()
-		{
-			public int compare(Object o1, Object o2) {
-				Qualification time1 = (Qualification)o1;
-				Qualification time2 = (Qualification)o2;
-				if (time1.getId().intValue() > time2.getId().intValue())
-				{
-					return 1;
-				}
-				else if (time1.getId().intValue() == time2.getId().intValue())
-				{
-					return 0;
-				}
-				else
-				{
-					return -1;
-				}
-			}
-
-		});
+		Set<Qualification> qualifications = getQualificationsSort();
 		if (!CollectionUtils.isEmpty(store.getQualifications())) {
 			qualifications.addAll(store.getQualifications());
 		}
@@ -331,7 +368,7 @@ public class StoreInServiceImpl implements StoreInService {
 	}
 
 	@Override
-	public Page<StoreIn> pageStoresByTypesAndKeyword(final PageInfo pageInfo, String types, String keyword) {
+	public Page<StoreIn> pageStoresByTypesAndKeyword(final PageInfo pageInfo, String types, String keyword, HttpServletRequest request) {
 		if (!StringUtils.isEmpty(keyword)) {
 			// keyword 只过滤店铺名称,可以使用此方法,否则,搜索多个字段需要生成查询条件
 			pageInfo.filter("storeName", keyword);
@@ -345,13 +382,38 @@ public class StoreInServiceImpl implements StoreInService {
 		// 设置排序
 		pageInfo.sorting(Sort.Direction.DESC, "totalReserve", "createTime");
 
-		return storeDao.findAll(new Specification<StoreIn>() {
+		Page<StoreIn> storeInPage =  storeDao.findAll(new Specification<StoreIn>() {
 			@Override
 			public Predicate toPredicate(Root<StoreIn> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
 				query.where(pageInfo.getPredicates(root, query, builder));
 				return null;
 			}
 		}, pageInfo);
+
+		if (this.deviceResolver.resolveDevice(request).isMobile()) {
+			SystemSession.setUser((User)request.getSession().getAttribute("user"));
+			if (null != SystemSession.getUser() && null!= SystemSession.getUser().getUserUU()){
+				SearchHistory searchHistory = null;
+				List<SearchHistory> searchHistories = searchHistoryDao.findByKeywordAndUserUUAndUserEnuu(keyword,SystemSession.getUser().getUserUU(),SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
+				if (searchHistories.size()>0){
+					searchHistory = searchHistories.get(0);
+				}else {
+					searchHistory = new SearchHistory();
+				}
+				searchHistory.setKeyword(keyword);
+				searchHistory.setSearchTime(new Date(System.currentTimeMillis()));
+				searchHistory.setUserUU(SystemSession.getUser().getUserUU());
+				searchHistory.setUserEnuu(SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
+				searchHistory.setType(Type.SEARCH_STORE.name());
+				searchHistoryDao.save(searchHistory);
+				searchHistories = searchHistoryDao.findByUserUUAndUserEnuuOrderBySearchTimeDesc(SystemSession.getUser().getUserUU(),SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
+				if (searchHistories.size()>10){
+					searchHistoryDao.delete(searchHistories.subList(10,searchHistories.size()));
+				}
+			}
+		}
+
+		return storeInPage;
 	}
 
 	@Override

+ 10 - 0
src/main/java/com/uas/platform/b2c/trade/order/dao/OrderDetailDao.java

@@ -26,6 +26,16 @@ public interface OrderDetailDao extends JpaSpecificationExecutor<OrderDetail>, J
 	 */
 	List<OrderDetail> findByBatchCode(String batchCode);
 
+	/**
+	 * 根据batchCode返回指定状态的订单明细
+	 *
+	 * @param batchCode
+	 * @param statusList
+	 * @return
+	 */
+	@Query(value = "select d from OrderDetail d where d.batchCode =:batchCode and d.status in :statusList")
+	List<OrderDetail> findByBatchInStatus(@Param("batchCode") String batchCode, @Param("statusList") List<Integer> statusList);
+
 	/**
 	 * 根据订单明细号查找订单明细
 	 *

+ 15 - 0
src/main/java/com/uas/platform/b2c/trade/seek/model/SeekPurchaseByBatch.java

@@ -85,6 +85,12 @@ public class SeekPurchaseByBatch {
     @Column(name = "sp_kind")
     private String kind;
 
+    /**
+     * 规格
+     */
+    @Column(name = "sp_spec")
+    private String spec;
+
     /**
      * 求购发布时间
      */
@@ -109,6 +115,15 @@ public class SeekPurchaseByBatch {
     @Transient
     private List<Map<String, Object>> brandWord;
 
+
+    public String getSpec() {
+        return spec;
+    }
+
+    public void setSpec(String spec) {
+        this.spec = spec;
+    }
+
     public Long getId() {
         return id;
     }

+ 163 - 70
src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseBomServiceImpl.java

@@ -7,19 +7,11 @@ import com.uas.platform.b2c.core.utils.StringUtilB2C;
 import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
 import com.uas.platform.b2c.prod.commodity.model.Goods;
 import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
+import com.uas.platform.b2c.prod.product.brand.modal.Brand;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
-import com.uas.platform.b2c.trade.seek.dao.SeekPurchaseBomDao;
-import com.uas.platform.b2c.trade.seek.dao.SeekPurchaseBomListDao;
-import com.uas.platform.b2c.trade.seek.dao.SeekPurchaseByBatchDao;
-import com.uas.platform.b2c.trade.seek.dao.SeekPurchaseDao;
-import com.uas.platform.b2c.trade.seek.dao.SeekPurchaseGoodsDao;
-import com.uas.platform.b2c.trade.seek.dao.SeekPurchaseOfferDao;
-import com.uas.platform.b2c.trade.seek.model.PurcInquiry;
-import com.uas.platform.b2c.trade.seek.model.PurcInquiryItem;
-import com.uas.platform.b2c.trade.seek.model.SeekPurchase;
-import com.uas.platform.b2c.trade.seek.model.SeekPurchaseBom;
-import com.uas.platform.b2c.trade.seek.model.SeekPurchaseBomList;
-import com.uas.platform.b2c.trade.seek.model.SeekPurchaseByBatch;
+import com.uas.platform.b2c.prod.product.component.modal.Component;
+import com.uas.platform.b2c.trade.seek.dao.*;
+import com.uas.platform.b2c.trade.seek.model.*;
 import com.uas.platform.b2c.trade.seek.service.SeekPurchaseBomService;
 import com.uas.platform.b2c.trade.seek.utils.DateUtils;
 import com.uas.platform.b2c.trade.support.CodeType;
@@ -30,25 +22,6 @@ import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
 import com.uas.platform.core.util.HttpUtil;
 import com.uas.platform.core.util.serializer.FlexJsonUtils;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.ss.usermodel.Cell;
@@ -64,9 +37,24 @@ import org.springframework.data.jpa.domain.Specification;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
+ * bom求购实现类
+ *
  * @author liusw
  * @version 2018/1/19 15:06
  */
@@ -111,9 +99,24 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
 
     private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
 
-    private int mallColNum = 8;
+    private int mallColNum = 10;
     private int mallRowNum = 500;
 
+    /**
+     * excel列名
+     */
+    public static final int CODENUM = 0;
+    public static final int BRANDNUM = 1;
+    public static final int DEADLINENUM = 2;
+    public static final int AMOUNTNUM = 3;
+    public static final int CURRENCYNUM = 4;
+    public static final int UNITPRICENUM = 5;
+    public static final int ENCAPSULATIONNUM = 8;
+    public static final int PRODUCEDATENUM = 9;
+    public static final int KINDNUM = 6;
+    public static final int SPECNUM = 7;
+
+
     /**
      * 导入bom
      * @param workbook
@@ -142,7 +145,6 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         seekPurchaseBom = seekPurchaseBomDao.save(seekPurchaseBom);
         // 获取第一行的信息
         Row headerRow = sheet.getRow(0);
-        int total = 0;
         int blankNum = 0;
         if (headerRow != null) {
             // 验证是否为商城模板
@@ -168,7 +170,12 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
                     seekPurchaseByBatchList.add(seekPurchaseByBatch);
                 }
             }
-            seekPurchaseByBatchDao.save(seekPurchaseByBatchList);
+            if (CollectionUtils.isEmpty(seekPurchaseByBatchList)) {
+                seekPurchaseBomDao.delete(seekPurchaseBom.getId());
+                return new ResultMap(CodeType.PARAMETER_ERROR, "上传的excel内容为空,请填写完整后上传");
+            } else {
+                seekPurchaseByBatchDao.save(seekPurchaseByBatchList);
+            }
         }
         return ResultMap.success(seekPurchaseBom.getId());
     }
@@ -179,16 +186,16 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
      * @return
      */
     private boolean vaidSample(Row row) {
-        Object codeCellObj = readWorkBookCell(row.getCell(0), Cell.CELL_TYPE_STRING,
-                0, 0);
+        Object codeCellObj = readWorkBookCell(row.getCell(CODENUM), Cell.CELL_TYPE_STRING,
+                0, CODENUM);
         String codeString = StringUtilB2C.getStr(codeCellObj);
-        Object brandCellObj = readWorkBookCell(row.getCell(1), Cell.CELL_TYPE_STRING,
-                0, 1);
+        Object brandCellObj = readWorkBookCell(row.getCell(BRANDNUM), Cell.CELL_TYPE_STRING,
+                0, BRANDNUM);
         String brandString = StringUtilB2C.getStr(brandCellObj);
-        Object produceDateCellObj = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING,
-                0, 7);
+        Object produceDateCellObj = readWorkBookCell(row.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
+                0, PRODUCEDATENUM);
         String produceDateString = StringUtilB2C.getStr(produceDateCellObj);
-        if ("只能填数字、英文、英文特殊符号".equals(codeString) || "请勿用中文特殊符号".equals(brandCellObj) || "不超过6个汉字或12个字符".equals(produceDateString)) {
+        if ("只能填数字、英文、英文特殊符号".equals(codeString) || "请勿用中文特殊符号".equals(brandString) || "不超过6个汉字或12个字符".equals(produceDateString)) {
             return true;
         }
         return false;
@@ -200,23 +207,23 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
      * @return
      */
     private boolean vaildTemplete(Row headerRow) {
-        Object codeCellObj = readWorkBookCell(headerRow.getCell(0), Cell.CELL_TYPE_STRING,
-                0, 0);
+        Object codeCellObj = readWorkBookCell(headerRow.getCell(CODENUM), Cell.CELL_TYPE_STRING,
+                0, CODENUM);
         if (!"产品型号".equals(StringUtilB2C.getStr(codeCellObj))) {
             return false;
         }
-        Object brandCellObj = readWorkBookCell(headerRow.getCell(1), Cell.CELL_TYPE_STRING,
-                0, 1);
+        Object brandCellObj = readWorkBookCell(headerRow.getCell(BRANDNUM), Cell.CELL_TYPE_STRING,
+                0, BRANDNUM);
         if (!"品牌名称".equals(StringUtilB2C.getStr(brandCellObj))) {
             return false;
         }
-        Object deadlineCellObj = readWorkBookCell(headerRow.getCell(2), Cell.CELL_TYPE_STRING,
-                0, 2);
+        Object deadlineCellObj = readWorkBookCell(headerRow.getCell(DEADLINENUM), Cell.CELL_TYPE_STRING,
+                0, DEADLINENUM);
         if (!"截止时间".equals(StringUtilB2C.getStr(deadlineCellObj))) {
             return false;
         }
-        Object produceDateCellObj = readWorkBookCell(headerRow.getCell(7), Cell.CELL_TYPE_STRING,
-                0, 7);
+        Object produceDateCellObj = readWorkBookCell(headerRow.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
+                0, PRODUCEDATENUM);
         if (!"生产日期".equals(StringUtilB2C.getStr(produceDateCellObj))) {
             return false;
         }
@@ -234,14 +241,17 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         // 统计为空的个数
         int result = 0;
         // 型号
-        Object codeValue = readWorkBookCell(row.getCell(0), Cell.CELL_TYPE_STRING,
-                rowNum, 0);
+        Object codeValue = readWorkBookCell(row.getCell(CODENUM), Cell.CELL_TYPE_STRING,
+                rowNum, CODENUM);
         if (StringUtils.isEmpty(codeValue)) {
             result += 1;
         } else {
-            String code = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(codeValue));
+            String code = StringUtilB2C.getStr(codeValue).trim();
             try {
                 code = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(code, 100);
+                if (!match(code)) {
+                    code = null;
+                }
             } catch (UnsupportedEncodingException e) {
                 e.printStackTrace();
             }
@@ -249,23 +259,26 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         }
 
         // 品牌
-        Object brandValue = readWorkBookCell(row.getCell(1), Cell.CELL_TYPE_STRING,
-                rowNum, 1);
+        Object brandValue = readWorkBookCell(row.getCell(BRANDNUM), Cell.CELL_TYPE_STRING,
+                rowNum, BRANDNUM);
         if (StringUtils.isEmpty(brandValue)) {
             result += 1;
         } else {
             String brand = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(brandValue));
             try {
                 brand = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(brand, 50);
+                if (!match(brand)) {
+                    brand = null;
+                }
             } catch (UnsupportedEncodingException e) {
                 e.printStackTrace();
             }
-            seekPurchaseByBatch.setBrand(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(brandValue)));
+            seekPurchaseByBatch.setBrand(brand);
         }
 
         // 截止日期
-        Object deadlineValue = readWorkBookCell(row.getCell(2), Cell.CELL_TYPE_STRING,
-                rowNum, 2);
+        Object deadlineValue = readWorkBookCell(row.getCell(DEADLINENUM), Cell.CELL_TYPE_STRING,
+                rowNum, DEADLINENUM);
         if (StringUtils.isEmpty(deadlineValue)) {
             result += 1;
         } else {
@@ -293,8 +306,8 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         }
 
         // 求购数量
-        Object amountValue = readWorkBookCell(row.getCell(3), Cell.CELL_TYPE_STRING,
-                rowNum, 3);
+        Object amountValue = readWorkBookCell(row.getCell(AMOUNTNUM), Cell.CELL_TYPE_STRING,
+                rowNum, AMOUNTNUM);
         if (!StringUtils.isEmpty(amountValue)) {
             try {
                 Double amount = Double.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(amountValue)));
@@ -309,8 +322,8 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         }
 
         // 币别
-        Object currencyValue = readWorkBookCell(row.getCell(4), Cell.CELL_TYPE_STRING,
-                rowNum, 4);
+        Object currencyValue = readWorkBookCell(row.getCell(CURRENCYNUM), Cell.CELL_TYPE_STRING,
+                rowNum, CURRENCYNUM);
         if (!StringUtils.isEmpty(currencyValue)) {
             try {
                 String currency = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(currencyValue));
@@ -321,8 +334,8 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         }
 
         // 单价
-        Object unitPriceValue = readWorkBookCell(row.getCell(5), Cell.CELL_TYPE_STRING,
-                rowNum, 5);
+        Object unitPriceValue = readWorkBookCell(row.getCell(UNITPRICENUM), Cell.CELL_TYPE_STRING,
+                rowNum, UNITPRICENUM);
         if (!StringUtils.isEmpty(unitPriceValue)) {
             try {
                 Double unitPrice = Double.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(unitPriceValue)));
@@ -340,8 +353,8 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         }
 
         // 封装
-        Object encapsulationValue = readWorkBookCell(row.getCell(6), Cell.CELL_TYPE_STRING,
-                rowNum, 6);
+        Object encapsulationValue = readWorkBookCell(row.getCell(ENCAPSULATIONNUM), Cell.CELL_TYPE_STRING,
+                rowNum, ENCAPSULATIONNUM);
         if (!StringUtils.isEmpty(encapsulationValue)) {
             try {
                 String encapsulation = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(encapsulationValue));
@@ -354,8 +367,8 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
 
 
         // 生产日期
-        Object produceDateValue = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING,
-                rowNum, 7);
+        Object produceDateValue = readWorkBookCell(row.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
+                rowNum, PRODUCEDATENUM);
         if (!StringUtils.isEmpty(produceDateValue)) {
             try {
                 String produceDate = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(produceDateValue));
@@ -365,9 +378,53 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
                 seekPurchaseByBatch.setProduceDate(null);
             }
         }
+
+        // 规格
+        Object specValue = readWorkBookCell(row.getCell(SPECNUM), Cell.CELL_TYPE_STRING,
+                rowNum, SPECNUM);
+        if (!StringUtils.isEmpty(specValue)) {
+            try {
+                String spec = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(specValue));
+                spec = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(spec, 50);
+                if (!match(spec)) {
+                    spec = null;
+                }
+                seekPurchaseByBatch.setSpec(spec);
+            } catch (Exception e) {
+                seekPurchaseByBatch.setSpec(null);
+            }
+        }
+
+        // 类目
+        Object kindValue = readWorkBookCell(row.getCell(KINDNUM), Cell.CELL_TYPE_STRING,
+                rowNum, KINDNUM);
+        if (!StringUtils.isEmpty(kindValue)) {
+            try {
+                String kind = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(kindValue));
+                kind = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(kind, 20);
+                seekPurchaseByBatch.setKind(kind);
+            } catch (Exception e) {
+                seekPurchaseByBatch.setKind(null);
+            }
+        }
         return result;
     }
 
+    /**
+     * 判断输入是否合法
+     * @param code
+     * @return
+     */
+    private boolean match(String code) {
+        List<String> filterList = Arrays.asList("空", "没", "无", "—", "-", "null", "#N/A");
+        for (String s : filterList) {
+            if (s.equals(code)){
+                return false;
+            }
+        }
+        return true;
+    }
+
     /**
      * 读取excel
      * @return
@@ -464,9 +521,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
             SeekPurchase seekPurchase = new SeekPurchase();
             Calendar now = Calendar.getInstance();
             now.add(Calendar.DAY_OF_MONTH, 91);
-            //Date deadlineMax = DateUtils.addTime(new Date(System.currentTimeMillis()), 90, 23, 59 ,59);
             if (!StringUtils.isEmpty(batch.getCode()) && !StringUtils.isEmpty(batch.getBrand()) && !StringUtils.isEmpty(batch.getDeadline()) && batch.getDeadline().compareTo(now.getTime()) != 1) {
-                //seekPurchase = (SeekPurchase) batch;
                 PurcInquiryItem inquiryItem = new PurcInquiryItem();
                 inquiryItem.setProdTitle(batch.getCode());
                 inquiryItem.setUserUU(user.getUserUU());
@@ -481,10 +536,15 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
                 inquiryItem.setProduceDate(batch.getProduceDate());
                 inquiryItem.setDate(new Date());
                 inquiryItem.setEndDate(batch.getDeadline());
+                if (StringUtils.isEmpty(batch.getKind())) {
+                    batch.setKind(matchKind(batch.getBrand(), batch.getCode()));
+                }
+                inquiryItem.setProdTitle(batch.getKind());
+                inquiryItem.setSpec(batch.getSpec());
                 if (StringUtils.isEmpty(endDate)) {
                     endDate = batch.getDeadline();
                 } else {
-                    if (endDate.compareTo(batch.getDeadline()) == 1) {
+                    if (endDate.compareTo(batch.getDeadline()) != 1) {
                         endDate = batch.getDeadline();
                     }
                 }
@@ -534,6 +594,39 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         return ResultMap.success(result);
     }
 
+    /**
+     * 根据型号和品牌类目匹配
+     * @param brand
+     * @param code
+     * @return
+     */
+    private String matchKind(String brand, String code) {
+        // 匹配类目
+        String kind = "";
+        Long brandId = null;
+        List<Brand> brands = brandDao.findByUpperNameEn(brand);
+        if (CollectionUtils.isEmpty(brands)) {
+            brands = brandDao.findByUpperNameCn(brand);
+            if (CollectionUtils.isEmpty(brands)) {
+                kind = "其他";
+            } else {
+                brandId = brands.get(0).getId();
+            }
+        } else {
+            brandId = brands.get(0).getId();
+        }
+        if (brandId != null) {
+            List<Component> components = componentDao
+                    .findByCodeAndBrandid(code, brandId);
+            if (!CollectionUtils.isEmpty(components)) {
+                kind = components.get(0).getKind().getNameCn();
+            } else {
+                kind = "其他";
+            }
+        }
+        return kind;
+    }
+
     @Override
     public Page<SeekPurchaseBomList> getSeekPurchaseBomListPage(final PageInfo pageInfo, User user, String minReleaseDate, String maxReleaseDate, String name) {
         if (user.getEnterprise() != null) {

+ 19 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/Readme.md

@@ -0,0 +1,19 @@
+## name
+
+vendor
+
+## 名称
+
+供应商资源模块
+
+## 创建人
+
+董必伟
+
+## 创建时间
+
+2018年4月25日 15:17:25
+
+## 说明
+
+供应商资源查看、对应企业物料列表、针对物料立即询价、ERP引进供应商

+ 124 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/controller/VendorIntroductionController.java

@@ -0,0 +1,124 @@
+package com.uas.platform.b2c.trade.vendor.controller;
+
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.prod.commodity.model.V_ProductPrivate;
+import com.uas.platform.b2c.trade.vendor.model.InviteVendorHistory;
+import com.uas.platform.b2c.trade.vendor.model.VendorIntroduction;
+import com.uas.platform.b2c.trade.vendor.service.InviteVendorHistoryService;
+import com.uas.platform.b2c.trade.vendor.service.VendorIntroductionService;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.sso.support.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 供应商资源引进模块
+ *
+ * @author dongbw
+ * @time 创建时间 :2018年4月25日 15:20:53
+ */
+@RestController
+@RequestMapping("/vendor/introduction")
+public class VendorIntroductionController {
+
+    @Autowired
+    private VendorIntroductionService vendorIntroductionService;
+
+    @Autowired
+	private InviteVendorHistoryService inviteVendorHistoryService;
+	
+	private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+
+    /**
+     * 根据关键词(非必填)获取供应商资源列表
+     *
+     * @param size  the params 一页的大小
+	 * @param page 第几页
+     * @param keyword the keyword  搜索关键字
+     * @return the Page<VendorIntroduction> 返回一页的数据
+     */
+    @RequestMapping(value = "/vendor/list", method = RequestMethod.GET)
+	public Page<VendorIntroduction> getVendorIntroductionList(int page, int size, String keyword) {
+		return vendorIntroductionService.getVendorIntroduction(page, size, keyword);
+	}
+
+	/**
+	 * 获取推荐企业物料列表(匹配到的排前面)
+	 * @param page 页数
+	 * @param size 每页条数
+	 * @param vendUU 推荐供应商企业UU
+	 * @param keyword 关键词
+	 * @return venduu企业物料list
+	 */
+	@RequestMapping(value = "/product/list", method = RequestMethod.GET)
+	public Page<V_ProductPrivate> getVendorProductList(int page, int size, Long vendUU, String keyword) {
+		Page<V_ProductPrivate> productPage = vendorIntroductionService.getVendorProductList(page, size, vendUU, keyword);
+		return productPage;
+	}
+
+	/**
+	 * 获取该物料详情
+	 * @param id 物料id
+	 * @return 物料内容
+	 */
+	@RequestMapping(value = "/product/detail", method = RequestMethod.GET)
+	public V_ProductPrivate getVendorProductDetail(Long id) {
+		V_ProductPrivate product = vendorIntroductionService.getVendorProductDetail(id);
+		return product;
+	}
+
+    /**
+     * 查找该企业待售物料数量
+     * @param vendUU 供应商UU
+     * @return 物料内容
+     */
+    @RequestMapping(value = "/product/count", method = RequestMethod.GET)
+    public ModelMap getVendorProductCount(Long vendUU) {
+        ModelMap map = new ModelMap();
+        try {
+            Integer count = vendorIntroductionService.getVendorProductCount(vendUU);
+            map.put("count", count);
+            map.put("success", true);
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("message", e.getMessage());
+        }
+        return map;
+    }
+
+	/**
+	 * 获取企业邀请完善信息历史记录
+	 * @param vendUU 供应商企业UU
+	 * @return 邀请历史记录
+	 */
+	@RequestMapping(value = "/invite/history", method = RequestMethod.GET)
+	public InviteVendorHistory getInviteVendorHistoryByVendUU(Long vendUU) {
+		InviteVendorHistory inviteVendorHistory = inviteVendorHistoryService.getInviteVendorHistoryByVendUU(vendUU);
+		return inviteVendorHistory;
+	}
+
+	/**
+	 * 邀请供应商完善信息
+	 * @param vendUU 供应商企业UU
+	 * @return 是否成功
+	 */
+	@RequestMapping(value = "/invite", method = RequestMethod.POST)
+	public ModelMap inviteVendorByVendUU(Long vendUU) {
+		ModelMap map = new ModelMap();
+		try {
+			inviteVendorHistoryService.inviteVendorByVendUU(vendUU);
+			map.put("success", true);
+			logger.log("供应商资源","邀请供应商完善信息成功,vendUU:" + vendUU);
+		} catch (Exception e) {
+			map.put("success", false);
+			map.put("message", e.getMessage());
+			logger.log("供应商资源","邀请供应商完善信息失败,vendUU:" + vendUU + "原因:" + e.getMessage());
+		}
+		return map;
+	}
+
+}

+ 21 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/dao/InviteVendorHistoryDao.java

@@ -0,0 +1,21 @@
+package com.uas.platform.b2c.trade.vendor.dao;
+
+import com.uas.platform.b2c.trade.vendor.model.InviteVendorHistory;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+ * Created by dongbw
+ * 18/04/27 15:01.
+ */
+public interface InviteVendorHistoryDao extends JpaSpecificationExecutor<InviteVendorHistory>,
+        JpaRepository<InviteVendorHistory, Long> {
+
+    /**
+     * 根据邀请企业与被邀请企业获取邀请记录
+     * @param enUU 邀请企业UU
+     * @param vendUU 被邀请企业UU
+     * @return
+     */
+    InviteVendorHistory findByEnUUAndVendUU(Long enUU, Long vendUU);
+}

+ 107 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/model/InviteVendorHistory.java

@@ -0,0 +1,107 @@
+package com.uas.platform.b2c.trade.vendor.model;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+/**
+ * 邀请供应商完善信息历史
+ *
+ * @author dongbw
+ * @version 2018年4月27日 14:58:12
+ */
+@Entity(name = "trade.inviteVendorHistory")
+@Table(name = "trade$inviteVendorHistory", indexes = {
+        @Index(name = "unique_enuu_venduu", columnList = "in_enuu,in_venduu", unique = true)})
+public class InviteVendorHistory {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @Column(name = "in_id")
+    private Long id;
+
+    /**
+     * 邀请企业uu
+     */
+    @Column(name = "in_enuu")
+    private Long enUU;
+
+    /**
+     * 被邀请企业UU
+     */
+    @Column(name = "in_venduu")
+    private Long vendUU;
+
+    /**
+     * 最近一次邀请时间
+     */
+    @Column(name = "in_date")
+    private Date date;
+
+    /**
+     * 已邀请次数
+     */
+    @Column(name = "in_times")
+    private Integer times;
+
+    public InviteVendorHistory() {
+
+    }
+
+    public InviteVendorHistory(Long enUU, Long vendUU) {
+        this.date = new Date();
+        this.enUU = enUU;
+        this.vendUU = vendUU;
+        this.times = 1;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getEnUU() {
+        return enUU;
+    }
+
+    public void setEnUU(Long enUU) {
+        this.enUU = enUU;
+    }
+
+    public Long getVendUU() {
+        return vendUU;
+    }
+
+    public void setVendUU(Long vendUU) {
+        this.vendUU = vendUU;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public Integer getTimes() {
+        return times;
+    }
+
+    public void setTimes(Integer times) {
+        this.times = times;
+    }
+}

+ 204 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/model/VendorIntroduction.java

@@ -0,0 +1,204 @@
+package com.uas.platform.b2c.trade.vendor.model;
+
+/**
+ * 供应商推荐实体
+ * Created by dongbw
+ * 18/01/18 15:40.
+ */
+public class VendorIntroduction {
+
+    /**
+     * 推荐的供应商UU
+     */
+    private Long enUU;
+
+    /**
+     * 推荐的供应商名称
+     */
+    private String enName;
+
+    /**
+     * 推荐的供应商简称
+     */
+    private String enShortname;
+
+    /**
+     * 推荐的供应商地址
+     */
+    private String enAddress;
+
+    /**
+     * 推荐的供应商电话
+     */
+    private String enTel;
+
+    /**
+     * 推荐的供应商邮箱
+     */
+    private String enEmail;
+
+    /**
+     * 公司法人
+     */
+    private String enCorporation;
+
+    /**
+     * 商业登记证号
+     */
+    private String enBusinesscode;
+
+    /**
+     * 行业
+     */
+    private String enIndustry;
+
+    /**
+     * 主营业务
+     */
+    private String enBusinessScope;
+
+    /**
+     * 联系人
+     */
+    private String enContactman;
+
+    /**
+     * 联系人电话
+     */
+    private String enContacttel;
+
+    /**
+     * 匹配物料信息 名称(品牌)
+     */
+    private String productInfo;
+
+    /**
+     * 是否开店
+     */
+    private Short isStore;
+
+    /**
+     * 是否有有效物料
+     */
+    private Short hasProduct;
+
+    public String getProductInfo() {
+        return productInfo;
+    }
+
+    public void setProductInfo(String productInfo) {
+        this.productInfo = productInfo;
+    }
+
+    public Long getEnUU() {
+        return enUU;
+    }
+
+    public void setEnUU(Long enUU) {
+        this.enUU = enUU;
+    }
+
+    public String getEnName() {
+        return enName;
+    }
+
+    public void setEnName(String enName) {
+        this.enName = enName;
+    }
+
+    public String getEnShortname() {
+        return enShortname;
+    }
+
+    public void setEnShortname(String enShortname) {
+        this.enShortname = enShortname;
+    }
+
+    public String getEnAddress() {
+        return enAddress;
+    }
+
+    public void setEnAddress(String enAddress) {
+        this.enAddress = enAddress;
+    }
+
+    public String getEnTel() {
+        return enTel;
+    }
+
+    public void setEnTel(String enTel) {
+        this.enTel = enTel;
+    }
+
+    public String getEnEmail() {
+        return enEmail;
+    }
+
+    public void setEnEmail(String enEmail) {
+        this.enEmail = enEmail;
+    }
+
+    public String getEnCorporation() {
+        return enCorporation;
+    }
+
+    public void setEnCorporation(String enCorporation) {
+        this.enCorporation = enCorporation;
+    }
+
+    public String getEnBusinesscode() {
+        return enBusinesscode;
+    }
+
+    public void setEnBusinesscode(String enBusinesscode) {
+        this.enBusinesscode = enBusinesscode;
+    }
+
+    public String getEnIndustry() {
+        return enIndustry;
+    }
+
+    public void setEnIndustry(String enIndustry) {
+        this.enIndustry = enIndustry;
+    }
+
+    public String getEnBusinessScope() {
+        return enBusinessScope;
+    }
+
+    public void setEnBusinessScope(String enBusinessScope) {
+        this.enBusinessScope = enBusinessScope;
+    }
+
+    public String getEnContactman() {
+        return enContactman;
+    }
+
+    public void setEnContactman(String enContactman) {
+        this.enContactman = enContactman;
+    }
+
+    public String getEnContacttel() {
+        return enContacttel;
+    }
+
+    public void setEnContacttel(String enContacttel) {
+        this.enContacttel = enContacttel;
+    }
+
+    public Short getIsStore() {
+        return isStore;
+    }
+
+    public void setIsStore(Short isStore) {
+        this.isStore = isStore;
+    }
+
+    public Short getHasProduct() {
+        return hasProduct;
+    }
+
+    public void setHasProduct(Short hasProduct) {
+        this.hasProduct = hasProduct;
+    }
+}

+ 23 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/service/InviteVendorHistoryService.java

@@ -0,0 +1,23 @@
+package com.uas.platform.b2c.trade.vendor.service;
+
+import com.uas.platform.b2c.trade.vendor.model.InviteVendorHistory;
+
+/**
+ * @author dongbw
+ * @version  2018年4月26日 17:24:54
+ */
+public interface InviteVendorHistoryService {
+
+    /**
+     * 获取企业邀请完善信息历史记录
+     * @param vendUU 供应商UU
+     * @return 邀请历史
+     */
+    InviteVendorHistory getInviteVendorHistoryByVendUU(Long vendUU);
+
+    /**
+     * 邀请供应商完善信息
+     * @param vendUU 供应商企业UU
+     */
+    void inviteVendorByVendUU(Long vendUU) throws Exception;
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است