|
@@ -71,6 +71,54 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
private PayOrderMapper payOrderMapper;
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 验证是否有购买资格
|
|
|
+ *
|
|
|
+ * @param submitDto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> verify(SubmitDto submitDto) {
|
|
|
+
|
|
|
+ /*Map<String, Object> map = new HashMap<>();
|
|
|
+ boolean bol = false;
|
|
|
+ // 机构一级分类
|
|
|
+ String firstClubType = baseMapper.firstClubTypeById(submitDto.getClubId());
|
|
|
+ if (!StringUtils.isNotBlank(firstClubType)) {
|
|
|
+ firstClubType = "0";
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ ArrayList<Integer> list = new ArrayList<>();
|
|
|
+ JSONArray orderInfo = parseArray(submitDto.getOrderInfo());
|
|
|
+ *//*Object productInfo = orderInfo.get("productInfo");
|
|
|
+ JSONArray jsonArray = parseArray(productInfo.toString());*//*
|
|
|
+ for (Object infoObject : orderInfo) {
|
|
|
+ JSONObject productTemp = (JSONObject) infoObject;
|
|
|
+ JSONArray productArr = (JSONArray) productTemp.get("productInfo");
|
|
|
+ for (Object productObject : productArr) {
|
|
|
+ JSONObject product = (JSONObject) productObject;
|
|
|
+ list.add((Integer) product.get("skuId"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 获取订单商品械字号类型
|
|
|
+ List<String> machineType = baseMapper.machineTypeByID(list);
|
|
|
+ for (String str : machineType) {
|
|
|
+ if ("3".equals(str)) {
|
|
|
+ bol = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!"1".equals(firstClubType) && bol) {
|
|
|
+ map.put("code", -1);
|
|
|
+ } else {
|
|
|
+ map.put("code", 1);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ResponseJson.error("商品验证失败",null);
|
|
|
+ }*/
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成订单
|
|
|
*
|
|
@@ -298,6 +346,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
orderParamBo.setAddressId(submitDto.getAddressId());
|
|
|
orderParamBo.setClubCouponId(submitDto.getClubCouponId());
|
|
|
orderParamBo.setOrderSeen(submitDto.getOrderSeen());
|
|
|
+ orderParamBo.setOrderMiniType(submitDto.getOrderMiniType());
|
|
|
/*
|
|
|
* 保存订单
|
|
|
*/
|
|
@@ -1310,12 +1359,15 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
*/
|
|
|
if (orderProduct.getLadderPriceFlag() == 1) {
|
|
|
// 使用阶梯价格的订单商品保存下单时的阶梯价格列表
|
|
|
- orderProduct.getLadderPrices().forEach(ladderPriceVo -> {
|
|
|
- ladderPriceVo.setOrderProductId(orderProduct.getOrderProductId());
|
|
|
- ladderPriceVo.setCreateDate(date);
|
|
|
- submitMapper.insertLadderPrices(ladderPriceVo);
|
|
|
- log.info("【提交订单】>>>>>>>>>>>>>>>>>>>>>>>>>>保存订单阶梯价格(insert[order_product_ladder_price])id:" + ladderPriceVo.getId() + ",orderId:" + mainOrder.getOrderId());
|
|
|
- });
|
|
|
+ List<LadderPriceVo> ladderPrices = orderProduct.getLadderPrices();
|
|
|
+ if (null != ladderPrices && ladderPrices.size() > 0) {
|
|
|
+ ladderPrices.forEach(ladderPriceVo -> {
|
|
|
+ ladderPriceVo.setOrderProductId(orderProduct.getOrderProductId());
|
|
|
+ ladderPriceVo.setCreateDate(date);
|
|
|
+ submitMapper.insertLadderPrices(ladderPriceVo);
|
|
|
+ log.info("【提交订单】>>>>>>>>>>>>>>>>>>>>>>>>>>保存订单阶梯价格(insert[order_product_ladder_price])id:" + ladderPriceVo.getId() + ",orderId:" + mainOrder.getOrderId());
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
/*
|
|
|
* 机构用户 写入价格库
|
|
@@ -1571,6 +1623,14 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return ResponseJson.error(-3, "您已有2个采购金额过小的订单,本次不能再进行采购。您可使用微信扫描以下二维码,进入采美旗下“呵呵商城”小程序购买小额商品");
|
|
|
}
|
|
|
+ if (orderParamBo.getOrderMiniType() == 0) {
|
|
|
+ if (mainOrderIds != null && mainOrderIds.size() <= 1) {
|
|
|
+ // 设置手动回滚事务
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return ResponseJson.error(-5, "采购金额过小,将扣除500采美豆,建议您使用微信扫描以下二维码,进入采美旗下“呵呵商城”小程序购买小额商品。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("订单提交状态:"+orderParamBo.getOrderMiniType());
|
|
|
UserBeansHistoryPo beansHistory = new UserBeansHistoryPo();
|
|
|
beansHistory.setUserId(mainOrder.getUserId());
|
|
|
beansHistory.setOrderId(mainOrder.getOrderId());
|
|
@@ -1584,6 +1644,27 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
productService.updateUserBeans(beansHistory, beans, "【价格低于1000,倒扣500采美豆】");
|
|
|
}
|
|
|
}
|
|
|
+ if (orderParamBo.getOrderMiniType() != 2) {
|
|
|
+ boolean bol = false;
|
|
|
+ // 机构一级分类
|
|
|
+ String firstClubType = baseMapper.firstClubTypeById(orderParamBo.getClubId());
|
|
|
+ if (!StringUtils.isNotBlank(firstClubType)) {
|
|
|
+ firstClubType = "0";
|
|
|
+ }
|
|
|
+ // 获取订单商品械字号类型
|
|
|
+ List<String> machineType = baseMapper.machineTypeByID(skuIdList);
|
|
|
+ for (String str : machineType) {
|
|
|
+ if ("3".equals(str)) {
|
|
|
+ bol = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!"1".equals(firstClubType) && bol) {
|
|
|
+// map.put("code", -1);
|
|
|
+ // 设置手动回滚事务
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return ResponseJson.error(-6, "订单内存在械字号三类商品,需要拥有医疗执业许可证的医美机构才能购买。建议升级医美机构后再下单,否则会导致订单退款或影响发货。");
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (ParseException e) {
|
|
|
log.info("自主下单价格低于1000,倒扣500采美豆", e);
|
|
|
}
|