我得免单订单状态

This commit is contained in:
wangguocheng
2024-05-20 15:21:57 +08:00
parent 3f1839aaab
commit 1aea7ba5ba
11 changed files with 49 additions and 15 deletions

View File

@@ -196,8 +196,7 @@ public class CartService {
}
@Transactional(rollbackFor = Exception.class)
public void createOrder(JSONObject jsonObject) throws IOException {
try {
public void createOrder(JSONObject jsonObject) throws Exception {
String shopId = jsonObject.getString("shopId");
JSONArray array = JSON.parseArray(redisUtil.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId))));
List<Integer> ids = new ArrayList<>();
@@ -212,13 +211,13 @@ public class CartService {
Integer orderId = 0;
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(jsonObject.getString("shopId"));
if (tbMerchantAccount == null) {
throw new MsgException("生成订单错误");
MsgException.throwException("生成订单错误");
}
String userId = jsonObject.getString("userId");
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
if (tbUserInfo == null) {
throw new MsgException("生成订单失败");
MsgException.throwException("生成订单失败");
}
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
@@ -408,9 +407,6 @@ public class CartService {
jsonObject12.put("data", new JSONArray());
AppWebSocketServer.AppSendInfo(jsonObject12, jsonObject.getString("tableId").concat("-").concat(shopId), false);
} catch (Exception e) {
e.getMessage();
}
}
private TbOrderInfo getOrder(BigDecimal totalAmount, BigDecimal packAMount,

View File

@@ -28,7 +28,7 @@ public class IntegralService {
@Autowired
private TbOrderInfoMapper orderInfoMapper;
@Autowired
private TbCashierCartMapper cashierCartMapper;
private TbUserInfoMapper userInfoMapper;
@Autowired
private TbProductMapper productMapper;
@Autowired
@@ -65,6 +65,11 @@ public class IntegralService {
integralFlow.setType("TRADEADD");
integralFlow.setUserId(userCoupons.getUserId());
integralFlowMapper.insert(integralFlow);
TbUserInfo userInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userCoupons.getUserId()));
if (Objects.nonNull(userInfo)){
userInfo.setTotalScore(userInfo.getTotalScore() + integralFlow.getNum().intValue());
userInfoMapper.updateByPrimaryKeySelective(userInfo);
}
}else {
Integer orderId = jsonObject.getInteger("orderId");
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);

View File

@@ -242,7 +242,7 @@ public class OrderService {
List<TbProductSku> list = productSkuMapper.selectAll();
for (TbProductSku productSku : list) {
// productSku.setStockNumber(200.00);
redisUtil.saveMessage("PRODUCT:" + productSku.getShopId() + ":" + productSku.getId(), productSku.getStockNumber().intValue() + "");
redisUtil.saveMessage("PRODUCT:" + productSku.getShopId() + ":" + productSku.getId(), "10000");
}
}
@@ -402,4 +402,12 @@ public class OrderService {
}
return Result.success(CodeEnum.SUCCESS, pageInfo);
}
public Result kc() {
List<TbProductSku> list = productSkuMapper.selectAll();
for (TbProductSku productSku:list){
redisUtil.saveMessage(RedisCst.PRODUCT + productSku.getShopId() + ":" +productSku.getId(),"10000");
}
return Result.success(CodeEnum.SUCCESS);
}
}

View File

@@ -107,7 +107,7 @@ public class UserService {
tbShopUser.setTotalScore(tbShopUser.getTotalScore() - num.intValue());
}
} else if (type.equals("add")) {
tbShopUser.setTotalScore(tbShopUser.getTotalScore() - num.intValue());
tbShopUser.setTotalScore(tbShopUser.getTotalScore() + num.intValue());
}
if (flag) {
TbReleaseFlow releaseFlow = new TbReleaseFlow();