yangdamao 1 year ago
parent
commit
7334191863

+ 7 - 4
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -13,10 +13,7 @@ import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.service.IUserService;
-import com.zhongzheng.modules.user.vo.UserIdCardBatchVo;
-import com.zhongzheng.modules.user.vo.UserStatstVo;
-import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
-import com.zhongzheng.modules.user.vo.UserVo;
+import com.zhongzheng.modules.user.vo.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -239,4 +236,10 @@ public class UserController extends BaseController {
         List<UserVo> list = iUserService.dangAnList(bo);
         return getDataTable(list);
     }
+
+    @ApiOperation("获取用户同专业下课程")
+    @PostMapping("/getUserBusinessGoods")
+    public AjaxResult<List<UserBusinessGoodsVo>> getUserBusinessGoods(@RequestBody List<UserBusinessGoodsBo> bos) {
+        return AjaxResult.success(iUserService.getUserBusinessGoods(bos));
+    }
 }

+ 0 - 7
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -224,11 +224,4 @@ public class UserController extends BaseController {
         return toAjax(iUserLoginKeyService.offline(editBo) ? 1 : 0);
     }
 
-    @ApiOperation("获取用户同专业下课程")
-    @PostMapping("/getUserBusinessGoods")
-    public AjaxResult<List<UserBusinessGoodsVo>> getUserBusinessGoods(@RequestBody List<UserBusinessGoodsBo> bos) {
-        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
-        bos.forEach(x -> x.setUserId(loginUser.getUser().getUserId()));
-        return AjaxResult.success(iUserService.getUserBusinessGoods(bos));
-    }
 }

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

@@ -2095,10 +2095,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     public List<UserBusinessGoodsVo> getUserBusinessGoods(List<UserBusinessGoodsBo> bos) {
         List<UserBusinessGoodsVo> goodsBoList = new ArrayList<>();
         for (UserBusinessGoodsBo item : bos) {
-            User user = getById(item.getUserId());
+            User user = getOne(new LambdaQueryWrapper<User>()
+            .eq(User::getIdCard,EncryptHandler.encrypt(item.getIdNum()))
+            .last("limit 1"));
             if (ObjectUtils.isNull(user)) {
                 continue;
             }
+            item.setUserId(user.getUserId());
             //查询购买课程
             UserBusinessGoodsVo goodsVo = baseMapper.getCourseByUser(item);
             goodsVo.setIdNum(item.getIdNum());