...
|
...
|
@@ -114,6 +114,8 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
@Autowired
|
|
|
private BatchService batchService;
|
|
|
|
|
|
private static final Integer NOT_SYN_CALENDER = 0;
|
|
|
|
|
|
@Override
|
|
|
public ApiResponse<Void> addOrUpdate(ProductRequestBo bo, boolean isCheckUrl) {
|
|
|
|
...
|
...
|
@@ -323,17 +325,15 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
p.setCreateTime((int) (System.currentTimeMillis() / 1000));
|
|
|
p.setMinPrice(new BigDecimal(bo.getMinPrice()));
|
|
|
p.setMaxPrice(new BigDecimal(bo.getMaxPrice()));
|
|
|
p.setIsSynCalender(bo.getIsSynCalender());
|
|
|
p.setIsSynCalender(null == bo.getIsSynCalender() ? NOT_SYN_CALENDER : bo.getIsSynCalender());
|
|
|
p.setOfferPrice(StringUtils.isEmpty(bo.getOfferPrice()) ? BigDecimal.valueOf(0.00) : new BigDecimal(bo.getOfferPrice()));
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
try {
|
|
|
p.setSaleTime((int) (sdf.parse(bo.getSaleTime()).getTime() / 1000));
|
|
|
} catch (ParseException e) {
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(bo.getOfferPrice())) {
|
|
|
p.setOfferPrice(new BigDecimal(bo.getOfferPrice()));
|
|
|
}
|
|
|
|
|
|
|
|
|
p.setGender(bo.getGender().toString());
|
|
|
return p;
|
|
|
}
|
...
|
...
|
@@ -387,9 +387,9 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
if ((bo.getId() == null || bo.getId() < 1) && CollectionUtils.isEmpty(bo.getSizeIdList())) {
|
|
|
throw new CommonException(400, "请选择至少选择一个尺寸");
|
|
|
}
|
|
|
if (isCheckUrl && CollectionUtils.isEmpty(bo.getImageUrlList())) {
|
|
|
throw new CommonException(400, "请上传至少一张图片");
|
|
|
}
|
|
|
// if (isCheckUrl && CollectionUtils.isEmpty(bo.getImageUrlList())) {
|
|
|
// throw new CommonException(400, "请上传至少一张图片");
|
|
|
// }
|
|
|
List<String> limitInfo = bo.getLimitSaleInfo();
|
|
|
if (CollectionUtils.isNotEmpty(limitInfo)) {
|
|
|
Set<Integer> uids = new HashSet<>();
|
...
|
...
|
@@ -476,7 +476,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
bo.setProductIntro(productIntroService.selectProductIntroById(product.getId()));
|
|
|
bo.setLimitSaleInfo(CollectionUtil.distinct(productLimitSaleMapper.selectByProductId(product.getId()), limit-> limit.getUid()+" "+limit.getProfitRate()));
|
|
|
bo.setIsSynCalender(product.getIsSynCalender());
|
|
|
bo.setOfferPrice(product.getOfferPrice().toString());
|
|
|
bo.setOfferPrice(product.getOfferPrice().compareTo(BigDecimal.valueOf(0.00)) == 0 ? null : product.getOfferPrice().toString());
|
|
|
|
|
|
return new ApiResponse<ProductEditResponceBo>(bo);
|
|
|
}
|
...
|
...
|
|