From aa7727d8ed9eca34f8126c3dc5a80fbdf9ad56cd Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期三, 11 九月 2024 12:02:57 +0800 Subject: [PATCH] 添加系统日志 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 37 ++++++++++++++++++++++++++++++------- 1 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java index a106416..ebda806 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java @@ -26,6 +26,9 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.core.web.page.BasePage; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.auth.AuthUtil; import com.ruoyi.common.security.service.TokenService; @@ -114,6 +117,8 @@ private VipClient vipClient; @Resource private TInviteUserService inviteUserService; + @Resource + private GiveVipUtil giveVipUtil; /** @@ -149,8 +154,9 @@ public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone) { return R.ok(appUserService.list(new QueryWrapper<TAppUser>().like("phone",phone)).stream().map(TAppUser::getId).collect(Collectors.toList())); } - @Resource - private GiveVipUtil giveVipUtil; + + + @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"}) @PostMapping(value = "/unit/page") public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { @@ -180,6 +186,7 @@ @ApiOperation(value = "单位管理添加或编辑", tags = {"用户管理-单位管理"}) @PostMapping(value = "/unit/addOrUpdate") + @Log(title = "【单位管理】添加或编辑单位", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) public R add(@RequestBody TCompany tCompany) { //拿到单位列表 otherClient.unitAddorUpadate(tCompany); @@ -191,6 +198,7 @@ @ApiOperation(value = "单位管理删除", tags = {"用户管理-单位管理"}) @DeleteMapping(value = "/unit/delete") + @Log(title = "【单位管理】删除单位", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) public R add(@RequestParam String ids) { String[] split = ids.split(","); for (String s : split) { @@ -349,6 +357,7 @@ @ApiOperation(value = "用户添加编辑", tags = {"用户管理-用户列表"}) @PostMapping(value = "/user/addOrUpdate") + @Log(title = "【用户列表】添加编辑用户", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) public R addOrUpdate(@RequestBody TAppUser tAppUser) { if (tAppUser.getId() != null){ //为编辑操作,要进行vip的逻辑处理 @@ -466,6 +475,7 @@ @ApiOperation(value = "冻结解冻用户", tags = {"后台-用户管理-用户列表"}) @PostMapping(value = "/user/status/change") + @Log(title = "【用户列表】冻结解冻用户", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) public R pointsDetail(@RequestBody UserChangeDto userChangeDto) { TAppUser appUser = appUserService.getById(userChangeDto.getUserId()); appUser.setStatus(userChangeDto.getStatus()); @@ -476,6 +486,7 @@ @ApiOperation(value = "修改单位", tags = {"后台-用户管理-用户列表"}) @PostMapping(value = "/user/unit/change") + @Log(title = "【用户列表】修改用户单位", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) public R unitChange(@RequestBody UnitChangeDto unitChangeDto) { for (String s : unitChangeDto.getIds().split(",")) { TAppUser byId = appUserService.getById(s); @@ -487,6 +498,7 @@ @ApiOperation(value = "删除用户", tags = {"后台-用户管理-用户列表"}) @DeleteMapping(value = "/user/delete") + @Log(title = "【用户列表】删除用户", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) public R userDelete(String ids) { String[] split = ids.split(","); for (String s : split) { @@ -544,7 +556,7 @@ TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); InfoCouponDto infoCouponDto = new InfoCouponDto(); BeanUtils.copyProperties(coupon, infoCouponDto); - infoCouponDto.setId(tAppCoupon.getId()); + infoCouponDto.setId(tAppCoupon.getId().toString()); infoCouponDto.setEndTime(tAppCoupon.getEndTime()); couponDtos1.add(infoCouponDto); @@ -558,7 +570,7 @@ TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); InfoCouponDto infoCouponDto = new InfoCouponDto(); BeanUtils.copyProperties(coupon, infoCouponDto); - infoCouponDto.setId(tAppCoupon.getId()); + infoCouponDto.setId(tAppCoupon.getId().toString()); infoCouponDto.setEndTime(tAppCoupon.getEndTime()); couponDtos2.add(infoCouponDto); } @@ -566,7 +578,7 @@ TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); InfoCouponDto infoCouponDto = new InfoCouponDto(); BeanUtils.copyProperties(coupon, infoCouponDto); - infoCouponDto.setId(tAppCoupon.getId()); + infoCouponDto.setId(tAppCoupon.getId().toString()); infoCouponDto.setEndTime(tAppCoupon.getEndTime()); couponDtos2.add(infoCouponDto); } @@ -586,7 +598,7 @@ @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"}) - @PostMapping(value = "/user/coupon/getById") + @GetMapping(value = "/user/coupon/getById") public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { TAppCoupon appCoupon = appCouponService.getById(id); return R.ok(appCoupon); @@ -596,6 +608,7 @@ @ApiOperation(value = "赠送会员", tags = {"用户管理-用户列表"}) @PostMapping(value = "/user/give/vip") + @Log(title = "【用户列表】赠送会员", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE) public R giveVip(@RequestBody GiveVipDto giveVipDto) { String[] split = giveVipDto.getUserIds().split(","); for (String s : split) { @@ -628,7 +641,7 @@ } @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) - @PostMapping(value = "/user/invite/info") + @GetMapping(value = "/user/invite/info") public R<InviteInfoDto> inviteInfo() { Long userId = tokenService.getLoginUserApplet().getUserId(); Integer point = 0; @@ -725,6 +738,16 @@ .eq(TAppUser::getPhone,phone) .last("LIMIT 1"))); } + /** + * 通过手机号模糊查询用户 + * @param phone + * @return + */ + @GetMapping("/user/selectByPhoneLike") + public R<List<TAppUser>> selectByPhoneLike(@RequestParam("phone") String phone){ + return R.ok(appUserService.list(Wrappers.lambdaQuery(TAppUser.class) + .eq(TAppUser::getPhone,phone))); + } @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) @GetMapping(value = "/user/sign") -- Gitblit v1.7.1