添加新版开放平台支付

This commit is contained in:
韩鹏辉
2024-05-20 15:57:50 +08:00
parent 7c5433b2cc
commit 7cabb2a109
8 changed files with 334 additions and 9 deletions

View File

@@ -120,6 +120,8 @@ public class PayService {
@Autowired
ThirdPayService thirdPayService;
@Resource
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
@Autowired
@@ -127,6 +129,9 @@ public class PayService {
@Resource
private GroupOrderCouponService orderCouponService;
@Autowired
TbActivateMapper tbActivateMapper;
@Transactional(rollbackFor = Exception.class)
public Result payOrder(String openId,String orderId,String ip) throws Exception {
@@ -630,8 +635,9 @@ public class PayService {
return Result.fail("对应的用户信息不存在");
}
if(ObjectUtil.isEmpty(tbShopUser.getIsVip())||!"1".equals(tbShopUser.getIsVip().toString())){
return Result.fail("非会员用户不允许充值");
if("0".equals(tbShopUser.getIsPwd())){
return Result.fail("用户支付密码未设置");
}
@@ -848,10 +854,103 @@ public class PayService {
flow.setBalance(tbShopUser.getAmount());
flow.setCreateTime(new Date());
tbShopUserFlowMapper.insert(flow);
TbActivate activate= tbActivateMapper.selectByAmount(tbShopUser.getShopId(),memberIn.getAmount());
if(ObjectUtil.isNotEmpty(activate)&&ObjectUtil.isNotNull(activate)){
BigDecimal amount=BigDecimal.ZERO;
switch (activate.getHandselType()){
case "GD":
amount=activate.getHandselNum();
break;
case "RATIO":
amount=memberIn.getAmount().multiply(activate.getHandselNum());
break;
}
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
flow=new TbShopUserFlow();
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
flow.setBizCode("scanMemberAwardIn");
flow.setBizName("会员充值奖励");
flow.setAmount(amount);
flow.setBalance(tbShopUser.getAmount());
flow.setCreateTime(new Date());
tbShopUserFlowMapper.insert(flow);
}
return "success";
}
public String fstMemberInSuccess(String payOrderNO,String tradeNo){
TbMemberIn memberIn= tbMemberInMapper.selectByOrderNo(payOrderNO);
if(ObjectUtil.isEmpty(memberIn)){
return "充值记录不存在";
}
memberIn.setTradeNo(tradeNo);
memberIn.setStatus("0");
memberIn.setUpdateTime(new Date());
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
TbShopUser tbShopUser= tbShopUserMapper.selectByUserIdAndShopId(memberIn.getUserId().toString(),memberIn.getShopId().toString());
if(ObjectUtil.isEmpty(tbShopUser)){
return "用户信息不存在";
}
if(!"1".equals(tbShopUser.getIsVip().toString())){
tbShopUser.setIsVip(Byte.parseByte("1"));
}
//修改客户资金
tbShopUser.setAmount(tbShopUser.getAmount().add(memberIn.getAmount()));
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
TbShopUserFlow flow=new TbShopUserFlow();
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
flow.setBizCode("scanMemberIn");
flow.setBizName("会员扫码充值");
flow.setAmount(memberIn.getAmount());
flow.setBalance(tbShopUser.getAmount());
flow.setCreateTime(new Date());
tbShopUserFlowMapper.insert(flow);
TbActivate activate= tbActivateMapper.selectByAmount(tbShopUser.getShopId(),memberIn.getAmount());
if(ObjectUtil.isNotEmpty(activate)&&ObjectUtil.isNotNull(activate)){
BigDecimal amount=BigDecimal.ZERO;
switch (activate.getHandselType()){
case "GD":
amount=activate.getHandselNum();
break;
case "RATIO":
amount=memberIn.getAmount().multiply(activate.getHandselNum());
break;
}
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
flow=new TbShopUserFlow();
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
flow.setBizCode("scanMemberAwardIn");
flow.setBizName("会员充值奖励");
flow.setAmount(amount);
flow.setBalance(tbShopUser.getAmount());
flow.setCreateTime(new Date());
tbShopUserFlowMapper.insert(flow);
}
return "SUCCESS";
}
// public Result returnOrder(){
//
// }

View File

@@ -83,7 +83,8 @@ public class ProductService {
tbShopUser.setShopId(shopId);
tbShopUser.setUserId(userId);
tbShopUser.setMiniOpenId(openId);
tbShopUser.setIsPwd("1");
tbShopUser.setPwd(MD5Util.encrypt("123456"));
tbShopUser.setIsPwd("0");
tbShopUser.setCreatedAt(System.currentTimeMillis());
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.insert(tbShopUser);