|
|
|
@ -580,10 +580,13 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
return bretMap; |
|
|
|
} |
|
|
|
} |
|
|
|
// 判断当前订单是否存在问题
|
|
|
|
Order order = new Order(); |
|
|
|
|
|
|
|
//校验订单信息合法
|
|
|
|
SzOrderUtils.checkOrder(goods, goodsDetail, userIsli); |
|
|
|
String uretStr = SzOrderUtils.checkOrder(goods, goodsDetail, userIsli); |
|
|
|
if(uretStr!=null){ |
|
|
|
bretMap.put("error",uretStr); |
|
|
|
return bretMap; |
|
|
|
} |
|
|
|
// 计算服务费等 委托方总金额
|
|
|
|
BigDecimal serviceCharge = new BigDecimal("0"); |
|
|
|
BigDecimal totalMoney = new BigDecimal("0"); |
|
|
|
@ -644,8 +647,15 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 订单实体
|
|
|
|
//设置用户信息
|
|
|
|
orderGoodsDetail.setUserId(userId); |
|
|
|
// 暂存入订单号
|
|
|
|
orderGoodsDetail.setOrderIslicode(batchCode); |
|
|
|
// 新增订单商品
|
|
|
|
orderGoodsDetailMapper.addOrderGoodsDetail(orderGoodsDetail); |
|
|
|
|
|
|
|
// 创建订单实体
|
|
|
|
Order order = new Order(); |
|
|
|
order.setBatchcode(batchCode); |
|
|
|
order.setUserId(userId); |
|
|
|
order.setBuyIslicode(userIsli); |
|
|
|
@ -870,7 +880,7 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建订单实现方法 |
|
|
|
* |
|
|
|
* 用户信息来源于远程服务,仅仅记录购买用户 |
|
|
|
* @param userIsli |
|
|
|
* @param goodsJsonArray post过来的json参数 |
|
|
|
* @return |
|
|
|
@ -878,12 +888,6 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
@Override |
|
|
|
public Map<String, Object> createOrder(String userIsli, JSONArray goodsJsonArray) { |
|
|
|
Map<String, Object> retmap = new HashMap<>(); |
|
|
|
User user = userMapper.getUserByIsli(userIsli); |
|
|
|
if (user == null) { |
|
|
|
retmap.put("code", "error"); |
|
|
|
retmap.put("msg", "用户不存在"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
Map bmap = new HashMap();// 执行返回map
|
|
|
|
// 该用户的购物车
|
|
|
|
String rkey = "car_" + userIsli; |
|
|
|
@ -955,7 +959,13 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
otmap.put("buy_username", orderUser.getName()); |
|
|
|
// order goods
|
|
|
|
List<OrderGoodsDetail> orderGoodsDetailList = orderGoodsDetailMapper.getOrderGoodsDetailByBatchCode(batchcode); |
|
|
|
otmap.put("order_detail", orderGoodsDetailList); |
|
|
|
//转化为前端要求格式
|
|
|
|
List noglist = new ArrayList(); |
|
|
|
for(OrderGoodsDetail nog:orderGoodsDetailList){ |
|
|
|
JSONObject nogjson = JSONObject.parseObject(JSON.toJSONString(nog)); |
|
|
|
noglist.add(nogjson); |
|
|
|
} |
|
|
|
otmap.put("order_detail", noglist); |
|
|
|
//
|
|
|
|
return otmap; |
|
|
|
} |
|
|
|
|