进店即会员 取消
长链接 异常打印
This commit is contained in:
@@ -90,7 +90,7 @@ public class UserContoller {
|
||||
shopUser.setCode(dynamicCode);
|
||||
shopUser.setTelephone(tbUserInfo.getTelephone());
|
||||
shopUser.setAmount(BigDecimal.ZERO);
|
||||
shopUser.setIsVip(Byte.parseByte("1"));
|
||||
shopUser.setIsVip(Byte.parseByte("0"));
|
||||
shopUser.setCreditAmount(BigDecimal.ZERO);
|
||||
shopUser.setConsumeAmount(BigDecimal.ZERO);
|
||||
shopUser.setConsumeNumber(0);
|
||||
|
||||
@@ -44,6 +44,13 @@ public class CartConsumer {
|
||||
} else if(jsonObject.getString("type").equals("createOrder")){
|
||||
String cartDetail = redisUtil.getMessage(RedisCst.TABLE_CART.concat(tableId).concat("-").concat(shopId));
|
||||
if (StringUtils.isEmpty(cartDetail)){
|
||||
log.info("createOrder购物车为空");
|
||||
// JSONObject jsonObject1 = new JSONObject();
|
||||
// jsonObject1.put("status", "success");
|
||||
// jsonObject1.put("msg", "订单已存在");
|
||||
// jsonObject1.put("type", jsonObject.getString("type"));
|
||||
// jsonObject1.put("data", "{\"id\": \"-1\"}");
|
||||
// AppWebSocketServer.AppSendInfo(jsonObject1,tableId+"-"+shopId, jsonObject.getString("userId"), true);
|
||||
throw new MsgException("购物车为空无法下单");
|
||||
}
|
||||
JSONArray array = JSON.parseArray(cartDetail);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CartService {
|
||||
private TbSystemCouponsMapper systemCouponsMapper;
|
||||
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void createCart(JSONObject jsonObject) throws Exception {
|
||||
public void createCart(JSONObject jsonObject) {
|
||||
try {
|
||||
String tableId = jsonObject.getString("tableId");
|
||||
String shopId = jsonObject.getString("shopId");
|
||||
@@ -144,11 +144,12 @@ public class CartService {
|
||||
jsonObject1.put("amount", amount);
|
||||
AppWebSocketServer.AppSendInfo(jsonObject1, jsonObject.getString("tableId").concat("-").concat(shopId),"", false);
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
log.info("长链接错误 createCart{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num, String tableId, String shopId) throws Exception {
|
||||
try {
|
||||
TbProduct product = productMapper.selectById(Integer.valueOf(productId));
|
||||
String key=tableId+"-"+shopId;
|
||||
if (Objects.isNull(product)) {
|
||||
@@ -193,6 +194,10 @@ public class CartService {
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
|
||||
cashierCartMapper.insert(cashierCart);
|
||||
return cashierCart;
|
||||
}catch (Exception e){
|
||||
log.info("长链接错误 addCart{}",e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -411,6 +416,7 @@ public class CartService {
|
||||
jsonObject12.put("data", new JSONArray());
|
||||
AppWebSocketServer.AppSendInfo(jsonObject12, jsonObject.getString("tableId").concat("-").concat(shopId),"", false);
|
||||
} catch (Exception e) {
|
||||
log.info("长链接错误 addCart{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -453,7 +459,8 @@ public class CartService {
|
||||
return "WX" + date + randomNum;
|
||||
}
|
||||
|
||||
public void clearCart(JSONObject jsonObject) throws IOException {
|
||||
public void clearCart(JSONObject jsonObject){
|
||||
try{
|
||||
String shopId = jsonObject.getString("shopId");
|
||||
if (redisUtil.exists(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId)))) {
|
||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId))));
|
||||
@@ -475,6 +482,10 @@ public class CartService {
|
||||
jsonObject1.put("amount", BigDecimal.ZERO);
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
AppWebSocketServer.AppSendInfo(jsonObject1, jsonObject.getString("tableId").concat("-").concat(shopId),"", false);
|
||||
}catch (Exception e){
|
||||
log.info("长链接错误 clearCart{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -694,11 +705,13 @@ public class CartService {
|
||||
jsonObject12.put("data", new JSONArray());
|
||||
AppWebSocketServer.AppSendInfo(jsonObject12, jsonObject.getString("tableId").concat("-").concat(shopId),"", false);
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
log.info("长链接错误 pendingOrder{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void queryCart(JSONObject jsonObject) throws IOException {
|
||||
public void queryCart(JSONObject jsonObject) {
|
||||
try {
|
||||
String shopId = jsonObject.getString("shopId");
|
||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId))));
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
@@ -714,5 +727,9 @@ public class CartService {
|
||||
jsonObject1.put("data", array);
|
||||
jsonObject1.put("amount", amount);
|
||||
AppWebSocketServer.AppSendInfo(jsonObject1, jsonObject.getString("tableId").concat("-").concat(shopId),"", false);
|
||||
}catch (Exception e){
|
||||
log.info("长链接错误 queryCart{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,12 +90,6 @@ public class LoginService {
|
||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
|
||||
if(CollectionUtils.isEmpty(tbShopUsers)){
|
||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
userInfo.setNickName(tbShopUser.getName());
|
||||
userInfo.setSex(tbShopUser.getSex());
|
||||
userInfo.setBirthDay(tbShopUser.getBirthDay());
|
||||
tbShopUser.setLevel(Byte.parseByte("1"));
|
||||
String dynamicCode = RandomUtil.randomNumbers(8);
|
||||
tbShopUser.setCode(dynamicCode);
|
||||
tbShopUser.setUserId(userInfo.getId() + "");
|
||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
@@ -185,12 +179,6 @@ public class LoginService {
|
||||
}
|
||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(phone);
|
||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
userInfo.setNickName(tbShopUser.getName());
|
||||
userInfo.setSex(tbShopUser.getSex());
|
||||
userInfo.setBirthDay(tbShopUser.getBirthDay());
|
||||
tbShopUser.setLevel(Byte.parseByte("1"));
|
||||
String dynamicCode = RandomUtil.randomNumbers(8);
|
||||
tbShopUser.setCode(dynamicCode);
|
||||
tbShopUser.setUserId(userInfo.getId() + "");
|
||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ProductService {
|
||||
tbShopUser.setCode(RandomUtil.randomNumbers(8));
|
||||
tbShopUser.setTelephone(tbUserInfo.getTelephone());
|
||||
tbShopUser.setAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setIsVip(Byte.parseByte("1"));
|
||||
tbShopUser.setIsVip(Byte.parseByte("0"));
|
||||
tbShopUser.setCreditAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setConsumeAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setConsumeNumber(0);
|
||||
|
||||
Reference in New Issue
Block a user