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