|
|
@@ -106,6 +106,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
@Autowired
|
|
|
private ProductPrivateDao productPrivateDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductPersonDao productPersonDao;
|
|
|
+
|
|
|
@Value("#{sys.productServiceIp}")
|
|
|
private String productServiceIp;
|
|
|
|
|
|
@@ -205,12 +208,28 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (!isAPerson) {
|
|
|
- resetRepeatData(releaseProductByBatchs, isImport);
|
|
|
- }
|
|
|
- commonDao.save(releaseProductByBatchs, ReleaseProductByBatch.class);
|
|
|
Long userUU = SystemSession.getUser().getUserUU();
|
|
|
Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ List<ReleaseProductByBatch> addList = new ArrayList<>(releaseProductByBatchs.size());
|
|
|
+ addList.addAll(releaseProductByBatchs);
|
|
|
+ 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);
|
|
|
+
|
|
|
releaseProductByBatchDao.callValidProcedure(enUU, batch);
|
|
|
Integer filter = releaseProductByBatchDao.getCountOfImportFail(userUU, batch, failCode);
|
|
|
Integer failure = releaseProductByBatchDao.getCountPublisherUuAndBatchAndReleaseCode(userUU, batch, ReleaseStatus.failure.value());
|
|
|
@@ -257,7 +276,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
* @param data
|
|
|
* @param isImport
|
|
|
*/
|
|
|
- private void resetRepeatData(List<ReleaseProductByBatch> data, Boolean isImport) {
|
|
|
+ private void resetRepeatData(List<ReleaseProductByBatch> data, Boolean isImport, boolean isAPerson) {
|
|
|
Long enuu = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
|
|
|
if (enuu == null) {
|
|
|
throw new IllegalOperatorException("企业enuu丢失");
|
|
|
@@ -271,6 +290,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());
|