修改支付
This commit is contained in:
@@ -23,4 +23,7 @@ public interface TbShopUserMapper {
|
||||
int updateByPrimaryKey(TbShopUser record);
|
||||
|
||||
List<TbShopUser> selectByShopId(@Param("shopId") String shopId,@Param("phone") String phone);
|
||||
|
||||
|
||||
TbShopUser selectByUserIdAndShopId(@Param("userId") String userId,@Param("shopId") String shopId);
|
||||
}
|
||||
@@ -33,6 +33,8 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.ACCOUNTEIXST;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PayService {
|
||||
@@ -118,7 +120,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "create");
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, null);
|
||||
if (ObjectUtil.isEmpty(cashierCarts) || ObjectUtil.isNull(cashierCarts)) {
|
||||
return Result.fail(CodeEnum.CARTEXIST);
|
||||
}
|
||||
@@ -505,7 +507,7 @@ public class PayService {
|
||||
|
||||
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByCardNo(memberCode);
|
||||
if (ObjectUtil.isEmpty(tbUserInfo)) {
|
||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
return Result.fail(ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
|
||||
@@ -801,6 +803,26 @@ public class PayService {
|
||||
|
||||
}
|
||||
|
||||
}else if("deposit".equals(payType)){
|
||||
TbShopUser user= tbShopUserMapper.selectByUserIdAndShopId(orderInfo.getUserId(),orderInfo.getShopId());
|
||||
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
|
||||
return Result.fail(ACCOUNTEIXST);
|
||||
}
|
||||
user.setAmount(user.getAmount().add( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
user.setConsumeAmount(user.getConsumeAmount().subtract( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
user.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKeySelective(user);
|
||||
|
||||
|
||||
TbShopUserFlow flow = new TbShopUserFlow();
|
||||
flow.setShopUserId(user.getId());
|
||||
flow.setBizCode("accountReturnPay");
|
||||
flow.setBizName("会员储值卡退款");
|
||||
flow.setAmount(orderInfo.getOrderAmount());
|
||||
flow.setBalance(user.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user