This commit is contained in:
韩鹏辉
2024-03-26 16:25:16 +08:00
parent b77eacdccb
commit 3bb8dfed1e
3 changed files with 23 additions and 7 deletions

View File

@@ -25,6 +25,8 @@ public class TbMemberIn implements Serializable {
private Date updateTime;
private Integer shopId;
private static final long serialVersionUID = 1L;
public Integer getId() {
@@ -106,4 +108,12 @@ public class TbMemberIn implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
}

View File

@@ -276,6 +276,7 @@ public class PayService {
@Transactional(rollbackFor = Exception.class)
public Result memberIn(String openId,String userId,String amount,String shopId,String ip){
if(ObjectUtil.isEmpty(openId)||ObjectUtil.isEmpty(userId)){
return Result.fail("用户信息允许为空");
@@ -287,6 +288,10 @@ public class PayService {
return Result.fail("对应的用户信息不存在");
}
if(ObjectUtil.isEmpty(tbShopUser.getIsVip())||!"1".equals(tbShopUser.getIsVip().toString())){
return Result.fail("非会员用户不允许充值");
}
TbShopInfo shopInfo= tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if(ObjectUtil.isEmpty(shopInfo)){
@@ -305,8 +310,9 @@ public class PayService {
TbMemberIn memberIn=new TbMemberIn();
memberIn.setAmount(payAmount);
memberIn.setUserId(Integer.valueOf(tbShopUser.getId()));
memberIn.setUserId(Integer.valueOf(tbShopUser.getUserId()));
memberIn.setCode(tbShopUser.getCode());
memberIn.setShopId(shopInfo.getId());
memberIn.setStatus("7");
memberIn.setMerchantId(Integer.valueOf(shopInfo.getMerchantId()));
memberIn.setCreateTime(new Date());
@@ -335,7 +341,6 @@ public class PayService {
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
JSONObject object=JSONObject.parseObject(response.getBody());
if(object.get("code").equals("0")){
memberIn.setOrderNo(object.getJSONObject("data").get("orderNumber").toString());
memberIn.setUpdateTime(new Date());
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
@@ -403,7 +408,7 @@ public class PayService {
memberIn.setUpdateTime(new Date());
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
TbShopUser tbShopUser= tbShopUserMapper.selectByUserId(memberIn.getUserId().toString());
TbShopUser tbShopUser= tbShopUserMapper.selectByUserIdAndShopId(memberIn.getUserId().toString(),memberIn.getShopId().toString());
if(ObjectUtil.isEmpty(tbShopUser)){
return "用户信息不存在";
}