|
|
@@ -3,6 +3,7 @@ package com.uas.platform.b2c.prod.commodity.service.impl;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.platform.b2c.advertise.ad.service.RecommendProductService;
|
|
|
+import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
import com.uas.platform.b2c.common.account.service.EnterpriseService;
|
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
|
import com.uas.platform.b2c.core.constant.IntegerConstant;
|
|
|
@@ -18,6 +19,7 @@ import com.uas.platform.b2c.prod.commodity.service.ProductService;
|
|
|
import com.uas.platform.b2c.prod.commodity.type.ProductConstant;
|
|
|
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.common.service.impl.CreateNumberServiceImpl;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentSubmitDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.modal.Component;
|
|
|
@@ -155,6 +157,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Autowired
|
|
|
private GoodsService goodsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CreateNumberServiceImpl createNumberService;
|
|
|
+
|
|
|
private ConcurrentHashMap<String, Field> sortFields = new ConcurrentHashMap<String, Field>();
|
|
|
|
|
|
@Override
|
|
|
@@ -599,15 +604,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 一键匹配非标产品,并带出该型号匹配的器件信息
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public ResultMap matchNonStandardProduct(){
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- final Long uu = SystemSession.getUser().getUserUU();
|
|
|
- final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ private ResultMap validateProductStatus(Long enUU) {
|
|
|
ProductStoreStatus status = productStoreStatusDao.findByEnuu(enUU);
|
|
|
if (status != null) {
|
|
|
// 有人正在操作这张单据,不能进行操作
|
|
|
@@ -631,6 +628,23 @@ public class ProductServiceImpl implements ProductService {
|
|
|
storeStatus.setStatus(Status.RUNNING.value());
|
|
|
status = productStoreStatusDao.save(storeStatus);
|
|
|
}
|
|
|
+ return ResultMap.success(status);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一键匹配非标产品,并带出该型号匹配的器件信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResultMap matchNonStandardProduct(){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ final Long uu = SystemSession.getUser().getUserUU();
|
|
|
+ final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ ResultMap statusResult = validateProductStatus(enUU);
|
|
|
+ if (statusResult.getCode() != CodeType.OK.code()) {
|
|
|
+ return statusResult;
|
|
|
+ }
|
|
|
+ ProductStoreStatus status = (ProductStoreStatus) statusResult.getData();
|
|
|
|
|
|
int total = productDao.getCountByEnuuAndStatusAndEnabled(enUU, ShortConstant.NO_SHORT, IntegerConstant.YES_SHORT);
|
|
|
int success = 0;
|
|
|
@@ -684,6 +698,39 @@ public class ProductServiceImpl implements ProductService {
|
|
|
return product;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResultMap matchSelected(List<Long> idList) {
|
|
|
+ Enterprise enterprise = SystemSession.getUser().getEnterprise();
|
|
|
+ Long enUU = enterprise != null ? enterprise.getUu() : null;
|
|
|
+ if (enUU == null) {
|
|
|
+ return new ResultMap(CodeType.NO_INFO, "企业或EnUU信息丢失");
|
|
|
+ }
|
|
|
+ ResultMap statusResult = validateProductStatus(enUU);
|
|
|
+ if (statusResult.getCode() != CodeType.OK.code()) {
|
|
|
+ return statusResult;
|
|
|
+ }
|
|
|
+ ProductStoreStatus status = (ProductStoreStatus) statusResult.getData();
|
|
|
+ String batch = createNumberService.getTimeNumber("product$match", 8);
|
|
|
+ // 保存要匹配的id数据
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void createMatchModel(List<Long> idList, String batch) {
|
|
|
+ Long uu = SystemSession.getUser().getUserUU();
|
|
|
+ Long enUU = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
|
|
|
+ List<MatchModel> resultList = new ArrayList<>(idList.size());
|
|
|
+ for (Long id : idList) {
|
|
|
+ MatchModel matchModel = new MatchModel();
|
|
|
+ matchModel.setBatch(batch);
|
|
|
+ matchModel.setProductId(id);
|
|
|
+ matchModel.setUseruu(uu);
|
|
|
+ matchModel.setEnuu(enUU);
|
|
|
+ resultList.add(matchModel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存匹配的信息
|
|
|
* @param json
|