he2802 2 лет назад
Родитель
Сommit
8924e97b5b

+ 31 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -37,7 +37,9 @@ import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
 import com.zhongzheng.modules.inform.domain.InformRemind;
 import com.zhongzheng.modules.system.service.ISysConfigService;
+import com.zhongzheng.modules.top.mall.bo.TopActionLogAddBo;
 import com.zhongzheng.modules.top.mall.domain.TopStore;
+import com.zhongzheng.modules.top.mall.service.ITopActionLogService;
 import com.zhongzheng.modules.top.mall.service.ITopStoreService;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
 import com.zhongzheng.modules.top.user.vo.TopSysPointsRuleVo;
@@ -121,6 +123,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     private  ISysConfigService configService;
     @Autowired
     private  ITopStoreService iTopStoreService;
+    @Autowired
+    private ITopActionLogService iTopActionLogService;
 
     @Override
     public UserVo queryById(Long userId) {
@@ -1097,6 +1101,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Override
     public Boolean openVip(UserEditBo bo) {
         User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, bo.getUserId()));
+        if(Validator.isEmpty(user)){
+            throw new CustomException("用户不存在");
+        }
         if(Validator.isNotEmpty(user)&&(user.getVipTag()!=0)){
             throw new CustomException("该会员已开通过会员");
         }
@@ -1108,7 +1115,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         objectLambdaUpdateWrapper.set(User::getVipFrom, 6);
         objectLambdaUpdateWrapper.set(User::getVipOpenTime, DateUtils.getNowTime());
         objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
-        return this.update(null, objectLambdaUpdateWrapper);
+        if(this.update(null, objectLambdaUpdateWrapper)){
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(2);
+            addBo.setLogAction(4L);
+            addBo.setMajorId(bo.getUserId());
+            addBo.setNewContent("正常");
+            iTopActionLogService.insertByAddBo(addBo);
+            return true;
+        }
+        return false;
     }
 
     @Override
@@ -1130,6 +1146,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             objectLambdaUpdateWrapper.set(User::getVipCloseTime, DateUtils.getNowTime());
             objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
             this.update(null, objectLambdaUpdateWrapper);
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(2);
+            addBo.setLogAction(6L);
+            addBo.setMajorId(userId);
+            addBo.setOldContent("正常");
+            addBo.setNewContent("已注销");
+            iTopActionLogService.insertByAddBo(addBo);
         }
         return true;
     }
@@ -1146,6 +1169,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             objectLambdaUpdateWrapper.set(User::getVipTag, 1);
             objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
             this.update(null, objectLambdaUpdateWrapper);
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(2);
+            addBo.setLogAction(5L);
+            addBo.setMajorId(userId);
+            addBo.setOldContent("已注销");
+            addBo.setNewContent("正常");
+            iTopActionLogService.insertByAddBo(addBo);
         }
         return true;
     }