...
|
...
|
@@ -116,6 +116,12 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
|
|
|
@Override
|
|
|
public ApiResponse<Void> addOrUpdate(ProductRequestBo bo, boolean isCheckUrl) {
|
|
|
|
|
|
Integer uid = new UserHelper().getUserId();
|
|
|
if (uid == null || uid < 1) {
|
|
|
return new ApiResponse<>(400, "请先登录!", null);
|
|
|
}
|
|
|
|
|
|
checkProductInfo(bo, isCheckUrl);
|
|
|
Product product = getProductFromBo(bo);
|
|
|
Goods goods = getGoodsFromBo(bo);
|
...
|
...
|
@@ -167,12 +173,12 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
}
|
|
|
}
|
|
|
|
|
|
updateLimitSaleInfo(bo.getLimitSaleInfo(), productId);
|
|
|
updateLimitSaleInfo(bo.getLimitSaleInfo(), productId, uid);
|
|
|
productIntroService.insertProductDesc(productId, bo.getProductIntro());
|
|
|
return new ApiResponse<Void>(null);
|
|
|
}
|
|
|
|
|
|
private void updateLimitSaleInfo(List<String> limitSaleInfo, Integer productId) {
|
|
|
private void updateLimitSaleInfo(List<String> limitSaleInfo, Integer productId, Integer editUid) {
|
|
|
Map<Integer, BigDecimal> map = new HashMap<>();
|
|
|
if (CollectionUtils.isNotEmpty(limitSaleInfo)) {
|
|
|
for (int i = 0; i < limitSaleInfo.size(); i++) {
|
...
|
...
|
@@ -235,7 +241,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
}
|
|
|
LOGGER.info("商品:{} 限制出售包含关系,删除之后为:{}", productId, map);
|
|
|
} else {
|
|
|
int num = productLimitSaleMapper.softDeleteByProductId(productId);
|
|
|
int num = productLimitSaleMapper.softDeleteByProductId(productId, editUid);
|
|
|
LOGGER.info("商品:{} 限制出售清空模式!软删除结果:{}", productId, num);
|
|
|
}
|
|
|
int now = (int) (System.currentTimeMillis() / 1000);
|
...
|
...
|
@@ -246,6 +252,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
s.setProfitRate(percent);
|
|
|
s.setDelStatus(0);
|
|
|
s.setCreateTime(now);
|
|
|
s.setEditUid(editUid);
|
|
|
productLimitSaleMapper.insert(s);
|
|
|
LOGGER.info("商品:{} 限制出售,新增条目:{}", productId, s);
|
|
|
});
|
...
|
...
|
|