From 75c05d5dbe83320aa67ec25fe2cf07e702a2d635 Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Mon, 11 Dec 2023 09:39:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9/auth/tenant=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/AppRenewController.java | 139 ++++++++++++++++++ .../system/controller/AppUserController.java | 50 +++---- .../system/controller/CompanyController.java | 2 - .../system/controller/MainController.java | 13 +- .../system/controller/WxLoginController.java | 9 +- .../controller/WxOfficialController.java | 11 +- .../common/system/entity/AppRenew.java | 60 ++++++++ .../common/system/entity/AppUser.java | 21 +++ .../common/system/entity/Tenant.java | 16 +- .../gxwebsoft/common/system/entity/User.java | 12 +- .../common/system/mapper/AppRenewMapper.java | 37 +++++ .../system/mapper/xml/AppRenewMapper.xml | 53 +++++++ .../system/mapper/xml/AppUserMapper.xml | 10 +- .../common/system/param/AppRenewParam.java | 56 +++++++ .../common/system/param/AppUserParam.java | 21 +++ .../system/service/AppRenewService.java | 42 ++++++ .../service/impl/AppRenewServiceImpl.java | 47 ++++++ .../system/service/impl/UserServiceImpl.java | 34 ++--- src/main/resources/application.yml | 2 +- .../com/gxwebsoft/generator/SysGenerator.java | 5 +- 20 files changed, 555 insertions(+), 85 deletions(-) create mode 100644 src/main/java/com/gxwebsoft/common/system/controller/AppRenewController.java create mode 100644 src/main/java/com/gxwebsoft/common/system/entity/AppRenew.java create mode 100644 src/main/java/com/gxwebsoft/common/system/mapper/AppRenewMapper.java create mode 100644 src/main/java/com/gxwebsoft/common/system/mapper/xml/AppRenewMapper.xml create mode 100644 src/main/java/com/gxwebsoft/common/system/param/AppRenewParam.java create mode 100644 src/main/java/com/gxwebsoft/common/system/service/AppRenewService.java create mode 100644 src/main/java/com/gxwebsoft/common/system/service/impl/AppRenewServiceImpl.java diff --git a/src/main/java/com/gxwebsoft/common/system/controller/AppRenewController.java b/src/main/java/com/gxwebsoft/common/system/controller/AppRenewController.java new file mode 100644 index 0000000..7835055 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/AppRenewController.java @@ -0,0 +1,139 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.AppRenewService; +import com.gxwebsoft.common.system.entity.AppRenew; +import com.gxwebsoft.common.system.param.AppRenewParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 续费管理控制器 + * + * @author 科技小王子 + * @since 2023-11-14 14:14:07 + */ +@Api(tags = "续费管理管理") +@RestController +@RequestMapping("/api/system/app-renew") +public class AppRenewController extends BaseController { + @Resource + private AppRenewService appRenewService; + + @PreAuthorize("hasAuthority('sys:appRenew:list')") + @OperationLog + @ApiOperation("分页查询续费管理") + @GetMapping("/page") + public ApiResult> page(AppRenewParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(appRenewService.page(page, page.getWrapper())); + // 使用关联查询 + //return success(appRenewService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:appRenew:list')") + @OperationLog + @ApiOperation("查询全部续费管理") + @GetMapping() + public ApiResult> list(AppRenewParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(appRenewService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(appRenewService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:appRenew:list')") + @OperationLog + @ApiOperation("根据id查询续费管理") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(appRenewService.getById(id)); + // 使用关联查询 + //return success(appRenewService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:appRenew:save')") + @OperationLog + @ApiOperation("添加续费管理") + @PostMapping() + public ApiResult save(@RequestBody AppRenew appRenew) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + appRenew.setUserId(loginUser.getUserId()); + } + if (appRenewService.save(appRenew)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:appRenew:update')") + @OperationLog + @ApiOperation("修改续费管理") + @PutMapping() + public ApiResult update(@RequestBody AppRenew appRenew) { + if (appRenewService.updateById(appRenew)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:appRenew:remove')") + @OperationLog + @ApiOperation("删除续费管理") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (appRenewService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:appRenew:save')") + @OperationLog + @ApiOperation("批量添加续费管理") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (appRenewService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:appRenew:update')") + @OperationLog + @ApiOperation("批量修改续费管理") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(appRenewService, "app_renew_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:appRenew:remove')") + @OperationLog + @ApiOperation("批量删除续费管理") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (appRenewService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/AppUserController.java b/src/main/java/com/gxwebsoft/common/system/controller/AppUserController.java index ae625c1..eed9328 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/AppUserController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/AppUserController.java @@ -1,5 +1,6 @@ package com.gxwebsoft.common.system.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.system.entity.User; import com.gxwebsoft.common.system.service.AppUserService; @@ -32,57 +33,47 @@ public class AppUserController extends BaseController { private AppUserService appUserService; @PreAuthorize("hasAuthority('sys:appUser:list')") - @OperationLog @ApiOperation("分页查询应用成员") @GetMapping("/page") public ApiResult> page(AppUserParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - return success(appUserService.page(page, page.getWrapper())); - // 使用关联查询 - //return success(appUserService.pageRel(param)); + // 使用关联查询 + return success(appUserService.pageRel(param)); } @PreAuthorize("hasAuthority('sys:appUser:list')") - @OperationLog @ApiOperation("查询全部应用成员") @GetMapping() public ApiResult> list(AppUserParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - return success(appUserService.list(page.getOrderWrapper())); - // 使用关联查询 - //return success(appUserService.listRel(param)); + // 使用关联查询 + if (param.getAppId() == null) { + return fail("AppId不存在",null); + } + return success(appUserService.listRel(param)); } @PreAuthorize("hasAuthority('sys:appUser:list')") - @OperationLog @ApiOperation("根据id查询应用成员") @GetMapping("/{id}") public ApiResult get(@PathVariable("id") Integer id) { - return success(appUserService.getById(id)); - // 使用关联查询 - //return success(appUserService.getByIdRel(id)); + // 使用关联查询 + return success(appUserService.getByIdRel(id)); } @PreAuthorize("hasAuthority('sys:appUser:save')") - @OperationLog @ApiOperation("添加应用成员") @PostMapping() public ApiResult save(@RequestBody AppUser appUser) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - appUser.setUserId(loginUser.getUserId()); - } - if (appUserService.save(appUser)) { - return success("添加成功"); - } - return fail("添加失败"); + if (appUserService.count(new LambdaQueryWrapper() + .eq(AppUser::getUserId, appUser.getUserId()).eq(AppUser::getAppId,appUser.getAppId())) > 0) { + return fail("该成员已存在"); + } + if (appUserService.save(appUser)) { + return success("添加成功"); + } + return fail("添加失败"); } @PreAuthorize("hasAuthority('sys:appUser:update')") - @OperationLog @ApiOperation("修改应用成员") @PutMapping() public ApiResult update(@RequestBody AppUser appUser) { @@ -93,14 +84,13 @@ public class AppUserController extends BaseController { } @PreAuthorize("hasAuthority('sys:appUser:remove')") - @OperationLog @ApiOperation("删除应用成员") @DeleteMapping("/{id}") public ApiResult remove(@PathVariable("id") Integer id) { if (appUserService.removeById(id)) { - return success("删除成功"); + return success("移除成功"); } - return fail("删除失败"); + return fail("移除失败"); } @PreAuthorize("hasAuthority('sys:appUser:save')") diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CompanyController.java b/src/main/java/com/gxwebsoft/common/system/controller/CompanyController.java index dc335f8..67fccfa 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/CompanyController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/CompanyController.java @@ -38,8 +38,6 @@ public class CompanyController extends BaseController { @Resource private CompanyMapper companyMapper; - @PreAuthorize("hasAuthority('sys:auth:user')") - @OperationLog @ApiOperation("分页查询企业信息不限租户") @GetMapping("/pageAll") public ApiResult> pageAll(CompanyParam param) { diff --git a/src/main/java/com/gxwebsoft/common/system/controller/MainController.java b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java index 8cd946a..798b9f9 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/MainController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java @@ -155,6 +155,9 @@ public class MainController extends BaseController { @GetMapping("/auth/tenant") public ApiResult tenant() { Integer tenantId = getTenantId(); + if(tenantId == null){ + throw new BusinessException("缺少参数tenantId"); + } Tenant tenant = tenantService.getByIdRel(tenantId); // 企业信息 Company company = companyService.getByTenantIdRel(tenantId); @@ -178,16 +181,6 @@ public class MainController extends BaseController { menu.setMenuType(0); list.add(menu); tenant.setMenu(list); - // 查询游客用户 - User loginUser = userService.getByUsername("www", tenantId); - tenant.setLoginUser(loginUser); - // 设置过期时间 - Long tokenExpireTime = configProperties.getTokenExpireTime(); - // 签发token - String access_token = JwtUtil.buildToken(new JwtSubject("www", tenantId), - tokenExpireTime, configProperties.getTokenKey()); - tenant.setToken(access_token); - tenant.setUsername("www"); return success(tenant); } diff --git a/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java index 0633e05..4b3a8f1 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java @@ -219,12 +219,16 @@ public class WxLoginController extends BaseController { String key = ACCESS_TOKEN_KEY.concat(":").concat(getTenantId().toString()); // 获取微信小程序配置信息 JSONObject setting = settingService.getBySettingKey("mp-weixin"); + if(setting == null){ + throw new BusinessException("请先配置小程序"); + } // 从缓存获取access_token String value = redisTemplate.opsForValue().get(key); if (value != null) { // 解析access_token JSONObject response = JSON.parseObject(value); - return response.getString("access_token"); + System.out.println("response = " + response); +// return response.getString("access_token"); } // 微信获取凭证接口 String apiUrl = "https://api.weixin.qq.com/cgi-bin/token"; @@ -232,6 +236,7 @@ public class WxLoginController extends BaseController { String url = apiUrl.concat("?grant_type=client_credential").concat("&appid=").concat(setting.getString("appId")).concat("&secret=").concat(setting.getString("appSecret")); // 执行get请求 String result = HttpUtil.get(url); + System.out.println("result = " + result); // 解析access_token JSONObject response = JSON.parseObject(result); if (response.getString("access_token") != null) { @@ -239,7 +244,7 @@ public class WxLoginController extends BaseController { redisTemplate.opsForValue().set(key, result,7000L, TimeUnit.SECONDS); return response.getString("access_token"); } - return null; + throw new BusinessException("小程序配置不正确"); } @ApiOperation("获取微信openId") diff --git a/src/main/java/com/gxwebsoft/common/system/controller/WxOfficialController.java b/src/main/java/com/gxwebsoft/common/system/controller/WxOfficialController.java index 7904fca..fab9a90 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/WxOfficialController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/WxOfficialController.java @@ -176,7 +176,7 @@ public class WxOfficialController extends BaseController { String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + getAccessToken(); TemplateMessage templateMessage = new TemplateMessage(); templateMessage.setToUser(openId); - templateMessage.setTemplateId("DSGpuDx1i7AWyRXejalnkq5AeslKnkm6T9omu6NPoLM"); // dVSbX2NRzAG7IuN4kkCQhgV-LjzxvApN3PgrGlon9JU + templateMessage.setTemplateId("dVSbX2NRzAG7IuN4kkCQhgV-LjzxvApN3PgrGlon9JU"); /* 您好,您已成功消费。 @@ -187,9 +187,12 @@ public class WxOfficialController extends BaseController { {{productType.DATA}}:{{name.DATA}} 消费时间:{{time.DATA}} {{remark.DATA}} */ HashMap data = new HashMap<>(); - data.put("thing33",new TemplateMessageDTO("您的新的工单需要处理")); - data.put("phrase5",new TemplateMessageDTO("网站故障")); - data.put("time40",new TemplateMessageDTO("2023-11-11")); + data.put("first",new TemplateMessageDTO("您收到了一条新的订单。")); + data.put("tradeDateTime",new TemplateMessageDTO("02月18日 01时05分")); + data.put("customerInfo",new TemplateMessageDTO("广州 王俊")); + data.put("orderItemName",new TemplateMessageDTO("兴趣车型")); + data.put("orderItemData",new TemplateMessageDTO("骐达 2011款 1.6 CVT 舒适版")); + data.put("remark",new TemplateMessageDTO("截止24日09:39分,您尚有10个订单未处理。")); System.out.println("data = " + data); // 链式构建请求 String result = HttpRequest.post(url) diff --git a/src/main/java/com/gxwebsoft/common/system/entity/AppRenew.java b/src/main/java/com/gxwebsoft/common/system/entity/AppRenew.java new file mode 100644 index 0000000..3bf49a2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/AppRenew.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.common.system.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 续费管理 + * + * @author 科技小王子 + * @since 2023-11-14 14:14:07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "AppRenew对象", description = "续费管理") +@TableName("sys_app_renew") +public class AppRenew implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "自增ID") + @TableId(value = "app_renew_id", type = IdType.AUTO) + private Integer appRenewId; + + @ApiModelProperty(value = "续费金额") + private BigDecimal money; + + @ApiModelProperty(value = "备注") + private String comments; + + @ApiModelProperty(value = "开始时间") + private Date startTime; + + @ApiModelProperty(value = "到期时间") + private Date endTime; + + @ApiModelProperty(value = "用户ID") + private Integer userId; + + @ApiModelProperty(value = "应用ID") + private Integer appId; + + @ApiModelProperty(value = "状态, 0正常, 1待确认") + private Integer status; + + @ApiModelProperty(value = "租户id") + private Integer tenantId; + + @ApiModelProperty(value = "注册时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/AppUser.java b/src/main/java/com/gxwebsoft/common/system/entity/AppUser.java index 1d8c757..5d4c445 100644 --- a/src/main/java/com/gxwebsoft/common/system/entity/AppUser.java +++ b/src/main/java/com/gxwebsoft/common/system/entity/AppUser.java @@ -1,5 +1,6 @@ package com.gxwebsoft.common.system.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; @@ -47,4 +48,24 @@ public class AppUser implements Serializable { @ApiModelProperty(value = "注册时间") private Date createTime; + @ApiModelProperty(value = "昵称") + @TableField(exist = false) + private String nickname; + + @ApiModelProperty(value = "用户名") + @TableField(exist = false) + private String username; + + @ApiModelProperty(value = "手机号码") + @TableField(exist = false) + private String phone; + + @ApiModelProperty(value = "邮箱") + @TableField(exist = false) + private String email; + + @ApiModelProperty(value = "头像") + @TableField(exist = false) + private String avatar; + } diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Tenant.java b/src/main/java/com/gxwebsoft/common/system/entity/Tenant.java index f0e574b..cab2dfb 100644 --- a/src/main/java/com/gxwebsoft/common/system/entity/Tenant.java +++ b/src/main/java/com/gxwebsoft/common/system/entity/Tenant.java @@ -52,17 +52,13 @@ public class Tenant implements Serializable { @ApiModelProperty(value = "修改时间") private Date updateTime; - @ApiModelProperty(value = "游客") - @TableField(exist = false) - private String username; +// @ApiModelProperty(value = "游客") +// @TableField(exist = false) +// private String username; - @ApiModelProperty(value = "游客身份") - @TableField(exist = false) - private String token; - - @ApiModelProperty(value = "当前登录用户") - @TableField(exist = false) - private User loginUser; +// @ApiModelProperty(value = "游客身份") +// @TableField(exist = false) +// private String token; @ApiModelProperty(value = "菜单信息") @TableField(exist = false) diff --git a/src/main/java/com/gxwebsoft/common/system/entity/User.java b/src/main/java/com/gxwebsoft/common/system/entity/User.java index 34f7219..6b72231 100644 --- a/src/main/java/com/gxwebsoft/common/system/entity/User.java +++ b/src/main/java/com/gxwebsoft/common/system/entity/User.java @@ -265,13 +265,13 @@ public class User implements UserDetails { @TableField(exist = false) private String mobile; - @ApiModelProperty("企业信息") - @TableField(exist = false) - private Company companyInfo; +// @ApiModelProperty("企业信息") +// @TableField(exist = false) +// private Company companyInfo; - @ApiModelProperty("系统配置信息") - @TableField(exist = false) - private Object system; +// @ApiModelProperty("系统配置信息") +// @TableField(exist = false) +// private Object system; @Override public boolean isAccountNonExpired() { diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/AppRenewMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/AppRenewMapper.java new file mode 100644 index 0000000..633ab83 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/AppRenewMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.AppRenew; +import com.gxwebsoft.common.system.param.AppRenewParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 续费管理Mapper + * + * @author 科技小王子 + * @since 2023-11-14 14:14:07 + */ +public interface AppRenewMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") AppRenewParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") AppRenewParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/AppRenewMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/AppRenewMapper.xml new file mode 100644 index 0000000..f75c73b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/AppRenewMapper.xml @@ -0,0 +1,53 @@ + + + + + + + SELECT a.* + FROM sys_app_renew a + + + AND a.app_renew_id = #{param.appRenewId} + + + AND a.money = #{param.money} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.app_id = #{param.appId} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/AppUserMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/AppUserMapper.xml index 225d7d9..4ef7d46 100644 --- a/src/main/java/com/gxwebsoft/common/system/mapper/xml/AppUserMapper.xml +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/AppUserMapper.xml @@ -4,8 +4,9 @@ - SELECT a.* + SELECT a.*, b.nickname,b.email,b.phone,b.avatar FROM sys_app_user a + LEFT JOIN sys_user b ON a.user_id = b.user_id AND a.app_user_id = #{param.appUserId} @@ -28,6 +29,13 @@ AND a.create_time <= #{param.createTimeEnd} + + AND (b.nickname LIKE CONCAT('%', #{param.keywords}, '%') + OR b.email LIKE CONCAT('%', #{param.keywords}, '%') + OR b.username LIKE CONCAT('%', #{param.keywords}, '%') + OR b.phone LIKE CONCAT('%', #{param.keywords}, '%') + ) + diff --git a/src/main/java/com/gxwebsoft/common/system/param/AppRenewParam.java b/src/main/java/com/gxwebsoft/common/system/param/AppRenewParam.java new file mode 100644 index 0000000..519996a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/AppRenewParam.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 续费管理查询参数 + * + * @author 科技小王子 + * @since 2023-11-14 14:14:07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@ApiModel(value = "AppRenewParam对象", description = "续费管理查询参数") +public class AppRenewParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer appRenewId; + + @ApiModelProperty(value = "续费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @ApiModelProperty(value = "备注") + private String comments; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "到期时间") + private String endTime; + + @ApiModelProperty(value = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @ApiModelProperty(value = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @ApiModelProperty(value = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/AppUserParam.java b/src/main/java/com/gxwebsoft/common/system/param/AppUserParam.java index e466c45..8605cb3 100644 --- a/src/main/java/com/gxwebsoft/common/system/param/AppUserParam.java +++ b/src/main/java/com/gxwebsoft/common/system/param/AppUserParam.java @@ -1,5 +1,6 @@ package com.gxwebsoft.common.system.param; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonInclude; import com.gxwebsoft.common.core.annotation.QueryField; import com.gxwebsoft.common.core.annotation.QueryType; @@ -42,4 +43,24 @@ public class AppUserParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer status; + @ApiModelProperty(value = "昵称") + @TableField(exist = false) + private String nickname; + + @ApiModelProperty(value = "用户名") + @TableField(exist = false) + private String username; + + @ApiModelProperty(value = "手机号码") + @TableField(exist = false) + private String phone; + + @ApiModelProperty(value = "邮箱") + @TableField(exist = false) + private String email; + + @ApiModelProperty(value = "头像") + @TableField(exist = false) + private String avatar; + } diff --git a/src/main/java/com/gxwebsoft/common/system/service/AppRenewService.java b/src/main/java/com/gxwebsoft/common/system/service/AppRenewService.java new file mode 100644 index 0000000..77a43da --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/AppRenewService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.AppRenew; +import com.gxwebsoft.common.system.param.AppRenewParam; + +import java.util.List; + +/** + * 续费管理Service + * + * @author 科技小王子 + * @since 2023-11-14 14:14:07 + */ +public interface AppRenewService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(AppRenewParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(AppRenewParam param); + + /** + * 根据id查询 + * + * @param appRenewId 自增ID + * @return AppRenew + */ + AppRenew getByIdRel(Integer appRenewId); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/AppRenewServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/AppRenewServiceImpl.java new file mode 100644 index 0000000..6220a97 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/AppRenewServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.mapper.AppRenewMapper; +import com.gxwebsoft.common.system.service.AppRenewService; +import com.gxwebsoft.common.system.entity.AppRenew; +import com.gxwebsoft.common.system.param.AppRenewParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 续费管理Service实现 + * + * @author 科技小王子 + * @since 2023-11-14 14:14:07 + */ +@Service +public class AppRenewServiceImpl extends ServiceImpl implements AppRenewService { + + @Override + public PageResult pageRel(AppRenewParam param) { + PageParam page = new PageParam<>(param); + //page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(AppRenewParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + //page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public AppRenew getByIdRel(Integer appRenewId) { + AppRenewParam param = new AppRenewParam(); + param.setAppRenewId(appRenewId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/UserServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/UserServiceImpl.java index 22cd95f..cec8f91 100644 --- a/src/main/java/com/gxwebsoft/common/system/service/impl/UserServiceImpl.java +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/UserServiceImpl.java @@ -80,24 +80,24 @@ public class UserServiceImpl extends ServiceImpl implements Us if (user != null) { user.setRoles(userRoleService.listByUserId(user.getUserId())); user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null)); - // 系统配置信息 - Map map = new HashMap<>(); - // 1)云存储 - String key = "setting:upload:" + user.getTenantId(); - final String upload = redisUtil.get(key); - if(upload != null){ - final JSONObject object = JSONObject.parseObject(upload); - map.put("uploadMethod",object.getString("uploadMethod")); - map.put("bucketDomain",object.getString("bucketDomain")); - map.put("fileUrl",object.getString("fileUrl") + "/"); - user.setSystem(map); - } +// // 系统配置信息 +// Map map = new HashMap<>(); +// // 1)云存储 +// String key = "setting:upload:" + user.getTenantId(); +// final String upload = redisUtil.get(key); +// if(upload != null){ +// final JSONObject object = JSONObject.parseObject(upload); +// map.put("uploadMethod",object.getString("uploadMethod")); +// map.put("bucketDomain",object.getString("bucketDomain")); +// map.put("fileUrl",object.getString("fileUrl") + "/"); +// user.setSystem(map); +// } // 企业信息 - final Company company = companyService.getByTenantIdRel(user.getTenantId()); - if (company != null) { - user.setCompanyId(company.getCompanyId()); - user.setCompanyInfo(company); - } +// final Company company = companyService.getByTenantIdRel(user.getTenantId()); +// if (company != null) { +// user.setCompanyId(company.getCompanyId()); +// user.setCompanyInfo(company); +// } } return user; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7659ea8..12ad5e6 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,6 +1,6 @@ # 端口 server: - port: 9090 + port: 9091 # socketIo socketio: port: 9191 diff --git a/src/test/java/com/gxwebsoft/generator/SysGenerator.java b/src/test/java/com/gxwebsoft/generator/SysGenerator.java index 4dee577..3471cef 100644 --- a/src/test/java/com/gxwebsoft/generator/SysGenerator.java +++ b/src/test/java/com/gxwebsoft/generator/SysGenerator.java @@ -50,7 +50,7 @@ public class SysGenerator { // "sys_industry" // "sys_plug", // "sys_company" - "sys_user_oauth" +// "sys_user_oauth", // "sys_user_grade" // "sys_user_referee" // "sys_notice" @@ -62,7 +62,8 @@ public class SysGenerator { // "sys_user_group" // "sys_app", // "sys_app_user", -// "sys_app_url" +// "sys_app_url", + "sys_app_renew" }; // 需要去除的表前缀 private static final String[] TABLE_PREFIX = new String[]{