|
|
|
@ -574,24 +574,28 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
@Override |
|
|
|
public Map<String, Object> addShopCar(String userIsli, String goodsIsli, Integer userYears) { |
|
|
|
Map<String, Object> retmap = new HashMap<>(); |
|
|
|
User user = userMapper.getUserByIsli(userIsli); |
|
|
|
//User user = userMapper.getUserByIsli(userIsli);
|
|
|
|
// get current goods
|
|
|
|
Goods goods = goodsMapper.getGoodsFuelByIsLi(goodsIsli); |
|
|
|
if (goods == null) { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "没有该标的"); |
|
|
|
return retmap; |
|
|
|
} else { |
|
|
|
if (goods.getGoodsStatus() != 1) { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "该标的现不在上架中"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
if (goods.getContractStatus() != 1) { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "标的未申请合约关联,不可购买"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
if (goods.getUserIslicode() == userIsli) { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "您是标的的授权方,不可添加"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
} |
|
|
|
//
|
|
|
|
@ -604,12 +608,19 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
if (orderDetailVo != null) { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "该标的已有订单,添加购物车失败"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
// goods detail
|
|
|
|
GoodsDetail goodsDetail = goodsDetailMapper.getGoodsDetailBygid(goods.getGoodsDetailId()); |
|
|
|
if(goodsDetail==null){ |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "该标的详情不存在,请检查标的编号"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
if (goodsDetail.getStock() <= 0 && goodsDetail.getGoodsEntrust() == 1) { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "该标的已有订单,添加购物车失败"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
Date now = new Date(); |
|
|
|
if (goodsDetail.getContractualPeriod() == 3) { |
|
|
|
@ -618,6 +629,7 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
) { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "标的委托已结束"); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
} |
|
|
|
//shop car infomation
|
|
|
|
@ -643,6 +655,9 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
retmap.put("code", 400); |
|
|
|
retmap.put("msg", "该标的已添加到购物车"); |
|
|
|
return retmap; |
|
|
|
}else{ |
|
|
|
cimap.put("goods_isli",goodsIsli); |
|
|
|
cimap.put("use_years",userYears); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -654,9 +669,6 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
} |
|
|
|
//购物车添加成功
|
|
|
|
JSONObject retjson =SzCarUtils.addCart(shopRedisKey,userIsli,cimap); |
|
|
|
// carjson.put("user_isli",userIsli);
|
|
|
|
// carjson.put("data",retjson);
|
|
|
|
// RedisUtil.set(shopRedisKey, carjson.toJSONString());
|
|
|
|
|
|
|
|
retmap.put("code", 200); |
|
|
|
retmap.put("msg", "成功"); |
|
|
|
|