|
|
@@ -16,10 +16,7 @@ import com.uas.platform.b2c.prod.commodity.constant.DoubleConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.constant.ErrorInfoConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.constant.ShortConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.constant.UploadConstant;
|
|
|
-import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
|
-import com.uas.platform.b2c.prod.commodity.dao.ProductDao;
|
|
|
-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.dao.*;
|
|
|
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.ReleaseProductByBatchService;
|
|
|
@@ -106,6 +103,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
@Autowired
|
|
|
private ProductPrivateDao productPrivateDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductPersonDao productPersonDao;
|
|
|
+
|
|
|
@Value("#{sys.productServiceIp}")
|
|
|
private String productServiceIp;
|
|
|
|
|
|
@@ -200,14 +200,28 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ Long userUU = SystemSession.getUser().getUserUU();
|
|
|
+ Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
List<ReleaseProductByBatch> addList = new ArrayList<>(releaseProductByBatchs.size());
|
|
|
addList.addAll(releaseProductByBatchs);
|
|
|
- if (!isAPerson) {
|
|
|
- resetRepeatData(addList);
|
|
|
+ resetRepeatData(addList, isAPerson);
|
|
|
+ if (isAPerson) {
|
|
|
+ for (ReleaseProductByBatch releaseProductByBatch : addList) {
|
|
|
+ List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enUU,releaseProductByBatch.getB2cCode(),
|
|
|
+ releaseProductByBatch.getB2cBranden(),IntegerConstant.YES_SHORT);
|
|
|
+ if (!CollectionUtils.isEmpty(productList)) {
|
|
|
+ List<ProductPerson> productPersonList = productPersonDao.findByProductId(productList.get(0).getId());
|
|
|
+ if (!CollectionUtils.isEmpty(productPersonList)) {
|
|
|
+ releaseProductByBatch.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
|
|
|
+ releaseProductByBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+ releaseProductByBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+ total --;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
commonDao.save(addList, ReleaseProductByBatch.class);
|
|
|
- Long userUU = SystemSession.getUser().getUserUU();
|
|
|
- Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+
|
|
|
releaseProductByBatchDao.callValidProcedure(enUU, batch);
|
|
|
Integer filter = releaseProductByBatchDao.getCountOfImportFail(userUU, batch, failCode);
|
|
|
Integer failure = releaseProductByBatchDao.getCountPublisherUuAndBatchAndReleaseCode(userUU, batch, ReleaseStatus.failure.value());
|
|
|
@@ -224,7 +238,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
* 判断是否重复,重复则重设状态
|
|
|
* @param data
|
|
|
*/
|
|
|
- private void resetRepeatData(List<ReleaseProductByBatch> data) {
|
|
|
+ private void resetRepeatData(List<ReleaseProductByBatch> data, boolean isAPerson) {
|
|
|
Long enuu = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
|
|
|
if (enuu == null) {
|
|
|
throw new IllegalOperatorException("企业enuu丢失");
|
|
|
@@ -235,6 +249,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
each.setB2cBranden(standardList.get(0).getPbranden());
|
|
|
each.setB2cCode(standardList.get(0).getPcmpcode());
|
|
|
}
|
|
|
+ if (isAPerson) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enuu, each.getB2cCode(), each.getB2cBranden(), IntegerConstant.YES_SHORT);
|
|
|
if (!CollectionUtils.isEmpty(productList)) {
|
|
|
List<Goods> goodsList = goodsDao.findRepeatGoodsInProductId(productList.get(0).getId(), each.getProductDate(), each.getPackaging(), each.getMinPackage(), each.getMinBuyQty(), each.getSelfMaxDelivery(), each.getSelfMinDelivery(), each.getUnit());
|