消费订阅消息验证

This commit is contained in:
谭凯凯 2024-10-21 15:52:41 +08:00 committed by Tankaikai
parent 3cbb0a4316
commit 8ce38563d4
1 changed files with 21 additions and 18 deletions

View File

@ -68,7 +68,7 @@ public class DutyService {
String loginName = tokenJson.getString("loginName");
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(shopId);
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
if(Objects.isNull(shopUserDuty)){
if (Objects.isNull(shopUserDuty)) {
shopUserDuty = new ShopUserDuty(userId, tbToken.getCreateTime(), 0, BigDecimal.ZERO, shopInfo.getShopName(), "0",
BigDecimal.ZERO, shopId, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, "");
shopUserDuty.setTokenId(tokenId);
@ -76,12 +76,12 @@ public class DutyService {
shopUserDuty.setTradeDay(DateUtils.getDay());
shopUserDuty.setQuickAmount(amount);
shopUserDutyMapper.insert(shopUserDuty);
}else {
shopUserDuty.setQuickAmount(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?amount:shopUserDuty.getQuickAmount().add(amount));
} else {
shopUserDuty.setQuickAmount(ObjectUtil.isNull(shopUserDuty.getQuickAmount()) ? amount : shopUserDuty.getQuickAmount().add(amount));
shopUserDutyMapper.updateByPrimaryKey(shopUserDuty);
}
} else if("memberIn".equals(type)){
} else if ("memberIn".equals(type)) {
Integer tokenId = tbToken.getId();
BigDecimal amount = new BigDecimal(jsonObject.getString("amount"));
@ -92,7 +92,7 @@ public class DutyService {
String loginName = tokenJson.getString("loginName");
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(shopId);
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
if(Objects.isNull(shopUserDuty)){
if (Objects.isNull(shopUserDuty)) {
shopUserDuty = new ShopUserDuty(userId, tbToken.getCreateTime(), 0, BigDecimal.ZERO, shopInfo.getShopName(), "0",
BigDecimal.ZERO, shopId, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, "");
shopUserDuty.setTokenId(tokenId);
@ -100,21 +100,21 @@ public class DutyService {
shopUserDuty.setTradeDay(DateUtils.getDay());
shopUserDuty.setMemberInAmount(amount);
shopUserDutyMapper.insert(shopUserDuty);
}else {
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())?amount:shopUserDuty.getMemberInAmount().add(amount));
} else {
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount()) ? amount : shopUserDuty.getMemberInAmount().add(amount));
shopUserDutyMapper.updateByPrimaryKey(shopUserDuty);
}
}else if("wxMemberIn".equals(type)){
String shopId=jsonObject.getString("shopId");
} else if ("wxMemberIn".equals(type)) {
String shopId = jsonObject.getString("shopId");
BigDecimal amount=new BigDecimal(jsonObject.getString("amount"));
BigDecimal amount = new BigDecimal(jsonObject.getString("amount"));
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(Integer.valueOf(shopId), "0");
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if(Objects.isNull(shopUserDuty)){
if (Objects.isNull(shopUserDuty)) {
shopUserDuty = new ShopUserDuty(Integer.valueOf(shopId), tbToken.getCreateTime(), 0, BigDecimal.ZERO, shopInfo.getShopName(), "0",
BigDecimal.ZERO, Integer.valueOf(shopId), BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, "");
@ -125,11 +125,11 @@ public class DutyService {
}
shopUserDuty.setTradeDay(DateUtils.getDay());
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())?amount:shopUserDuty.getMemberInAmount().add(amount));
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount()) ? amount : shopUserDuty.getMemberInAmount().add(amount));
shopUserDutyMapper.insert(shopUserDuty);
}else {
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())?amount:shopUserDuty.getMemberInAmount().add(amount));
} else {
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount()) ? amount : shopUserDuty.getMemberInAmount().add(amount));
shopUserDutyMapper.updateByPrimaryKey(shopUserDuty);
}
@ -164,7 +164,7 @@ public class DutyService {
shopUserDuty = new ShopUserDuty(userId, tbToken.getCreateTime(), 1, orderInfo.getOrderAmount(), shopInfo.getShopName(), "0",
orderInfo.getOrderAmount(), shopId, BigDecimal.ZERO, cashAmount, BigDecimal.ZERO, "");
shopUserDuty.setTokenId(tokenId);
shopUserDuty.setMemberOutAmount("deposit".equals(orderInfo.getPayType())?orderInfo.getOrderAmount():BigDecimal.ZERO);
shopUserDuty.setMemberOutAmount("deposit".equals(orderInfo.getPayType()) ? orderInfo.getOrderAmount() : BigDecimal.ZERO);
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
shopUserDuty.setTradeDay(DateUtils.getDay());
shopUserDutyMapper.insert(shopUserDuty);
@ -189,7 +189,7 @@ public class DutyService {
shopUserDuty.setAmount(shopUserDuty.getAmount().add(orderInfo.getPayAmount()));
shopUserDuty.setCashAmount(shopUserDuty.getCashAmount().add(cashAmount));
shopUserDuty.setIncomeAmount(shopUserDuty.getIncomeAmount().add(orderInfo.getPayAmount()));
shopUserDuty.setMemberOutAmount("deposit".equals(orderInfo.getPayType())?ObjectUtil.isNull(shopUserDuty.getMemberOutAmount())?orderInfo.getOrderAmount():shopUserDuty.getMemberOutAmount().add(orderInfo.getOrderAmount()):shopUserDuty.getMemberOutAmount());
shopUserDuty.setMemberOutAmount("deposit".equals(orderInfo.getPayType()) ? ObjectUtil.isNull(shopUserDuty.getMemberOutAmount()) ? orderInfo.getOrderAmount() : shopUserDuty.getMemberOutAmount().add(orderInfo.getOrderAmount()) : shopUserDuty.getMemberOutAmount());
shopUserDuty.setOrderNum(shopUserDuty.getOrderNum() + 1);
shopUserDutyMapper.updateByPrimaryKeySelective(shopUserDuty);
List<Integer> skuIds = new ArrayList<>();
@ -361,20 +361,23 @@ public class DutyService {
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
// cloudPrinterService.handoverprintData(token, shopUserDuty.getId(), "",true);
// shopUserDutyMapper.updateStatusByTokenId(day, shopId, staffId);
if(Objects.nonNull(shopUserDuty)){
if (Objects.nonNull(shopUserDuty)) {
shopUserDutyMapper.updateStatusById(shopUserDuty.getId(), staffId);
}
}
}
}
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
private void subInventory(Integer shopId, Integer skuId, Integer num) {
TbProductSku tbProductSku = productSkuMapper.selectByPrimaryKey(skuId);
if (tbProductSku == null) {
return;
}
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(Integer.valueOf(tbProductSku.getProductId()));