Commit aa07254d authored by unset's avatar unset

添加通知信息

parent 512c4214
......@@ -54,6 +54,7 @@ public class ConfirmOrderService {
/**
* 确认订单
*
* @param confirmOrderDto
* @return
*/
......@@ -68,85 +69,84 @@ public class ConfirmOrderService {
AtomicReference<Integer> number = new AtomicReference<>(0);
AtomicReference<Double> amount = new AtomicReference<>((double) 0);
itemInfoDtoList.parallelStream().forEach(itemInfoDto -> {
switch (OrderTypeEnum.getByCode(itemInfoDto.getType())) {
//标准数据
case STANDARD_DATA:
List<ImageDataVO> imageDataVOList = datacenterFeign.queryByIds(itemInfoDto.getId() + "").getData();
if (imageDataVOList != null && imageDataVOList.size() > 0) {
ImageDataVO imageDataVO = imageDataVOList.get(0);
if (itemInfoDto.getType().equals(OrderTypeEnum.STANDARD_DATA.getType())) {
List<ImageDataVO> imageDataVOList = datacenterFeign.queryByIds(itemInfoDto.getId() + "").getData();
if (imageDataVOList != null && imageDataVOList.size() > 0) {
ImageDataVO imageDataVO = imageDataVOList.get(0);
ItemInfoVo itemInfoVo = new ItemInfoVo();
itemInfoVo.setId(Long.valueOf(imageDataVO.getId()));
itemInfoVo.setDetailJson(JSONObject.toJSONString(imageDataVO));
itemInfoVo.setNumber(itemInfoDto.getNumber());
itemInfoVo.setType(itemInfoDto.getType());
itemInfoVo.setPrice(imageDataVO.getPrice());
itemInfoVoList.add(itemInfoVo);
//总数量
number.updateAndGet(v -> v + itemInfoDto.getNumber());
BigDecimal totalAmount = imageDataVO.getPrice().multiply(new BigDecimal(itemInfoDto.getNumber()));
amount.updateAndGet(v -> new Double((double) (v + totalAmount.doubleValue())));
}
}
if (itemInfoDto.getType().equals(OrderTypeEnum.INDUSTRY_INFO.getType())) {
IndustryApplicationInfo industryApplicationInfo = industryApplicationInfoBiz.getOneById(itemInfoDto.getId().intValue()).getData();
if (industryApplicationInfo != null) {
ItemInfoVo itemInfoVo = new ItemInfoVo();
itemInfoVo.setId(Long.valueOf(industryApplicationInfo.getId()));
itemInfoVo.setDetailJson(JSONObject.toJSONString(industryApplicationInfo));
itemInfoVo.setImg(industryApplicationInfo.getCoverImg());
itemInfoVo.setNumber(itemInfoDto.getNumber());
itemInfoVo.setType(itemInfoDto.getType());
itemInfoVo.setPrice(industryApplicationInfo.getPrice());
itemInfoVo.setName(industryApplicationInfo.getTitle());
itemInfoVoList.add(itemInfoVo);
//总数量
number.updateAndGet(v -> v + itemInfoDto.getNumber());
BigDecimal totalAmount = industryApplicationInfo.getPrice().multiply(new BigDecimal(itemInfoDto.getNumber()));
amount.updateAndGet(v -> new Double((double) (v + totalAmount.doubleValue())));
}
}
if (itemInfoDto.getType().equals(OrderTypeEnum.IMAGE_STORAGE.getType())) {
ImageInfoRelation imageInfoRelation = imageInfoRelationBiz.selectById(itemInfoDto.getId());
if (imageInfoRelation != null) {
ImageImgStorage imageImgStorage = imageImgStorageBiz.getDetail(itemInfoDto.getId().intValue()).getData();
if (imageImgStorage != null) {
List<ImageInfoRelation> imageInfoRelationList = new ArrayList<>();
imageInfoRelationList.add(imageInfoRelation);
imageImgStorage.setImageInfoRelationList(imageInfoRelationList);
ItemInfoVo itemInfoVo = new ItemInfoVo();
itemInfoVo.setId(Long.valueOf(imageDataVO.getId()));
itemInfoVo.setDetailJson(JSONObject.toJSONString(imageDataVO));
itemInfoVo.setNumber(itemInfoDto.getNumber());
itemInfoVo.setId(Long.valueOf(imageImgStorage.getId()));
itemInfoVo.setPrice(imageInfoRelation.getPrice());
itemInfoVo.setType(itemInfoDto.getType());
itemInfoVo.setPrice(imageDataVO.getPrice());
itemInfoVoList.add(itemInfoVo);
//总数量
number.updateAndGet(v -> v + itemInfoDto.getNumber());
BigDecimal totalAmount = imageDataVO.getPrice().multiply(new BigDecimal(itemInfoDto.getNumber()));
amount.updateAndGet(v -> new Double((double) (v + totalAmount.doubleValue())));
}
//行业应用
case INDUSTRY_INFO:
IndustryApplicationInfo industryApplicationInfo = industryApplicationInfoBiz.getOneById(itemInfoDto.getId().intValue()).getData();
if (industryApplicationInfo != null) {
ItemInfoVo itemInfoVo = new ItemInfoVo();
itemInfoVo.setId(Long.valueOf(industryApplicationInfo.getId()));
itemInfoVo.setDetailJson(JSONObject.toJSONString(industryApplicationInfo));
itemInfoVo.setImg(industryApplicationInfo.getCoverImg());
itemInfoVo.setNumber(itemInfoDto.getNumber());
itemInfoVo.setType(itemInfoDto.getType());
itemInfoVo.setPrice(industryApplicationInfo.getPrice());
itemInfoVo.setName(industryApplicationInfo.getTitle());
itemInfoVo.setImg(imageImgStorage.getCoverImg());
itemInfoVo.setDetailJson(JSONObject.toJSONString(imageImgStorage));
itemInfoVo.setName(imageImgStorage.getName());
itemInfoVoList.add(itemInfoVo);
//总数量
number.updateAndGet(v -> v + itemInfoDto.getNumber());
BigDecimal totalAmount = industryApplicationInfo.getPrice().multiply(new BigDecimal(itemInfoDto.getNumber()));
amount.updateAndGet(v -> new Double((double) (v + totalAmount.doubleValue())));
}
//影像图库
case IMAGE_STORAGE:
ImageInfoRelation imageInfoRelation = imageInfoRelationBiz.selectById(itemInfoDto.getId());
if (imageInfoRelation != null ) {
ImageImgStorage imageImgStorage = imageImgStorageBiz.getDetail(itemInfoDto.getId().intValue()).getData();
if (imageImgStorage != null) {
List<ImageInfoRelation> imageInfoRelationList = new ArrayList<>();
imageInfoRelationList.add(imageInfoRelation);
imageImgStorage.setImageInfoRelationList(imageInfoRelationList);
ItemInfoVo itemInfoVo = new ItemInfoVo();
itemInfoVo.setId(Long.valueOf(imageImgStorage.getId()));
itemInfoVo.setPrice(imageInfoRelation.getPrice());
itemInfoVo.setType(itemInfoDto.getType());
itemInfoVo.setNumber(itemInfoDto.getNumber());
itemInfoVo.setImg(imageImgStorage.getCoverImg());
itemInfoVo.setDetailJson(JSONObject.toJSONString(imageImgStorage));
itemInfoVo.setName(imageImgStorage.getName());
itemInfoVoList.add(itemInfoVo);
//总数量
number.updateAndGet(v -> v + itemInfoDto.getNumber());
BigDecimal totalAmount = imageInfoRelation.getPrice().multiply(new BigDecimal(itemInfoDto.getNumber()));
amount.updateAndGet(v -> new Double((double) (v + totalAmount.doubleValue())));
}
}
//购物车
case SHOPPING_CART_INFO:
ShoppingCartInfo shoppingCartInfo = shoppingCartInfoBiz.selectById(itemInfoDto.getId());
if (shoppingCartInfo != null) {
ItemInfoVo itemInfoVo = new ItemInfoVo();
itemInfoVo.setId(shoppingCartInfo.getCartId());
itemInfoVo.setPrice(shoppingCartInfo.getPrice());
itemInfoVo.setType(shoppingCartInfo.getType());
itemInfoVo.setNumber(itemInfoDto.getNumber());
itemInfoVo.setImg(shoppingCartInfo.getItemPic());
itemInfoVo.setDetailJson(shoppingCartInfo.getDetailJson());
itemInfoVo.setName(shoppingCartInfo.getName());
itemInfoVoList.add(itemInfoVo);
number.updateAndGet(v -> v + itemInfoDto.getNumber());
BigDecimal totalAmount = shoppingCartInfo.getTotalAmount();
BigDecimal totalAmount = imageInfoRelation.getPrice().multiply(new BigDecimal(itemInfoDto.getNumber()));
amount.updateAndGet(v -> new Double((double) (v + totalAmount.doubleValue())));
}
default:
break;
}
}
if (itemInfoDto.getType().equals(OrderTypeEnum.SHOPPING_CART_INFO.getType())) {
ShoppingCartInfo shoppingCartInfo = shoppingCartInfoBiz.selectById(itemInfoDto.getId());
if (shoppingCartInfo != null) {
ItemInfoVo itemInfoVo = new ItemInfoVo();
itemInfoVo.setId(shoppingCartInfo.getCartId());
itemInfoVo.setPrice(shoppingCartInfo.getPrice());
itemInfoVo.setType(shoppingCartInfo.getType());
itemInfoVo.setNumber(itemInfoDto.getNumber());
itemInfoVo.setImg(shoppingCartInfo.getItemPic());
itemInfoVo.setDetailJson(shoppingCartInfo.getDetailJson());
itemInfoVo.setName(shoppingCartInfo.getName());
itemInfoVoList.add(itemInfoVo);
number.updateAndGet(v -> v + itemInfoDto.getNumber());
BigDecimal totalAmount = shoppingCartInfo.getTotalAmount();
amount.updateAndGet(v -> new Double((double) (v + totalAmount.doubleValue())));
}
}
});
confirmOrderInfoVo.setTotalAmount(new BigDecimal(amount.get()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment