|
@@ -120,36 +120,30 @@ public class UserServiceImpl implements UserService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateUserForPaySuccess(UpdateUserForPaySuccessDTO updateUserForPaySuccessDTO) {
|
|
|
+ public void updateUserForOrder(UpdateUserForOrderDTO updateUserForOrderDTO) {
|
|
|
//支付成功之后修改用户状态
|
|
|
- User user = userMapper.selectByPrimaryKey(updateUserForPaySuccessDTO.getUserId());
|
|
|
+ User user = userMapper.selectByPrimaryKey(updateUserForOrderDTO.getUserId());
|
|
|
//通过用户可以查到对应的app
|
|
|
user.setUpdatedAt(new Date());
|
|
|
//账号类型 付费账号1 免费账号0 AccountTypeEnum
|
|
|
user.setAccountType(AccountTypeEnum.PAID_ACCOUNT.value());
|
|
|
- //付费类型 0 试用 1单次购买 2订阅 3单次购买+订阅 4买断 PaidTypeEnum
|
|
|
-// user.setPayType(null);
|
|
|
-// user.setMemberType(updateUserForPaySuccessDTO.getMemberType());
|
|
|
- //0已注销(1订阅中2订阅过期3试用中4试用过期)PDFOfficeUserStatusEnum
|
|
|
- //用户如果在订阅中 然后给用户赠送了试用,那么状态还是订阅中(根据付费类型和当前状态来判断)
|
|
|
-
|
|
|
- user.setValidFlag(null);
|
|
|
+ //通过用户id和平台类型查询会员信息表,如果有会员信息则更新,如果没有会员信息就插入
|
|
|
+ UserSubscriptionInfo userSubscriptionInfo = userSubscriptionInfoService.getByUserIdAndPlatform(user.getId(), updateUserForOrderDTO.getPlatform());
|
|
|
+ if(ObjectUtils.isEmpty(userSubscriptionInfo)){
|
|
|
+ UserSubscriptionInfo newInfo = new UserSubscriptionInfo().withId(CommonUtils.generateId())
|
|
|
+ .withUserId(user.getId()).withStatus(updateUserForOrderDTO.getUserStatus())
|
|
|
+ .withPayType(updateUserForOrderDTO.getPayTpe()).withEndDate(updateUserForOrderDTO.getEndDate());
|
|
|
+ userSubscriptionInfoService.insert(newInfo);
|
|
|
+ }else{
|
|
|
+ //更新
|
|
|
+ userSubscriptionInfo.setPayType(updateUserForOrderDTO.getPayTpe());
|
|
|
+ userSubscriptionInfo.setStatus(updateUserForOrderDTO.getUserStatus());
|
|
|
+ userSubscriptionInfo.setEndDate(updateUserForOrderDTO.getEndDate());
|
|
|
+ userSubscriptionInfoService.update(userSubscriptionInfo);
|
|
|
+ }
|
|
|
userMapper.updateByPrimaryKey(user);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void updateUserForRefund(UpdateUserForRefundDTO updateUserForRefundDTO) {
|
|
|
- //退单之后修改用户状态
|
|
|
- User user = userMapper.selectByPrimaryKey(updateUserForRefundDTO.getUserId());
|
|
|
- user.setUpdatedAt(new Date());
|
|
|
- // 推线账号类型 付费账号1 免费账号0 AccountTypeEnum
|
|
|
- // user.setAccountType(AccountTypeEnum.PAID_ACCOUNT.value());
|
|
|
- //付费类型 0 试用 1单次购买 2订阅 3单次购买+订阅 4买断 PaidTypeEnum
|
|
|
-// user.setPayType(null);
|
|
|
- //0已注销(1订阅中2订阅过期3试用中4试用过期)PDFOfficeUserStatusEnum
|
|
|
- user.setValidFlag(null);
|
|
|
- userMapper.updateByPrimaryKey(user);
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public void register(UserRegisterDTO userRegisterDTO) {
|