|
|
|
@ -544,6 +544,7 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
if(goods==null){ |
|
|
|
log.error("create order error!"+goodsIsli+",不存在"); |
|
|
|
bretMap.put("error","没有该标的"); |
|
|
|
return bretMap; |
|
|
|
} |
|
|
|
// goods detail
|
|
|
|
GoodsDetail goodsDetail = goodsDetailMapper.getGoodsDetailBygid(goods.getGoodsDetailId()); |
|
|
|
@ -564,10 +565,13 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
if(orderDetailVo!=null) { |
|
|
|
if (orderDetailVo.getStatus() == 1) { |
|
|
|
bretMap.put("error","您的待付款订单中有标的:" + goods.getGoodsIslicode() + ",请勿重复下单"); |
|
|
|
return bretMap; |
|
|
|
} else if (orderDetailVo.getStatus() == 2) { |
|
|
|
bretMap.put("error","您的未完成订单中有标的:" + goods.getGoodsIslicode() + ",请勿重复下单"); |
|
|
|
return bretMap; |
|
|
|
} else { |
|
|
|
bretMap.put("error","您的已完成订单中有标的:" + goods.getGoodsIslicode() + ",请勿重复下单"); |
|
|
|
return bretMap; |
|
|
|
} |
|
|
|
} |
|
|
|
// 判断当前订单是否存在问题
|
|
|
|
@ -626,6 +630,7 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
if(StringUtils.isBlank(userjson.getString("data"))){ |
|
|
|
log.error("未查询到用户信息,下单失败"+userIsli); |
|
|
|
bretMap.put("error","未查询到用户信息,下单失败"); |
|
|
|
return bretMap; |
|
|
|
} |
|
|
|
//添加用户
|
|
|
|
OrderUser odu =SzOrderUtils.mkOrderUser(batchCode,userjson,0); |
|
|
|
@ -785,23 +790,24 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
/** |
|
|
|
* 创建订单实现方法 |
|
|
|
* @param userIsli |
|
|
|
* @param jsonArray json数组 |
|
|
|
* @param goodsJsonArray post过来的json参数 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, Object> createOrder(String userIsli, JSONArray jsonArray) { |
|
|
|
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; |
|
|
|
} |
|
|
|
// 该用户的购物车
|
|
|
|
String rkey="car_"+userIsli; |
|
|
|
String batchcode="";//订单编号,一次一个
|
|
|
|
if(jsonArray.size()==1){ // 下单商品只有一个
|
|
|
|
JSONObject tmpgjson = jsonArray.getJSONObject(0); |
|
|
|
String tuseYear = tmpgjson.getString("use_year"); |
|
|
|
if(goodsJsonArray.size()==1){ // 下单商品只有一个
|
|
|
|
JSONObject tmpgjson = goodsJsonArray.getJSONObject(0); |
|
|
|
String tuseYear = tmpgjson.getString("use_years"); |
|
|
|
//todo check it has null
|
|
|
|
Integer ituseYear = Integer.valueOf(tuseYear); |
|
|
|
String goodsIsli = tmpgjson.getString("goods_isli"); |
|
|
|
@ -811,6 +817,7 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
if(StringUtils.isNotEmpty(berrmsg)){ |
|
|
|
retmap.put("code",400); |
|
|
|
retmap.put("msg",berrmsg); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
//返回订单编号
|
|
|
|
batchcode = (String)bmap.get("batcha"); |
|
|
|
|