From 59624531b617e2df0549c0017d1bbe00e32b8786 Mon Sep 17 00:00:00 2001 From: fengdan Date: Thu, 23 Jun 2022 15:29:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=85=AC=E4=BC=97=E5=8F=B7=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=AE=A1=E7=90=86):=20=E5=A2=9E=E3=80=81=E5=88=A0?= =?UTF-8?q?=E3=80=81=E6=94=B9=E3=80=81=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/account/WxAccountController.java | 20 +- .../admin/account/vo/WxAccountBaseVO.java | 32 ++- .../account/vo/WxAccountCreateReqVO.java | 9 +- .../admin/account/vo/WxAccountExcelVO.java | 15 +- .../account/vo/WxAccountExportReqVO.java | 5 +- .../admin/account/vo/WxAccountPageReqVO.java | 7 +- .../admin/account/vo/WxAccountRespVO.java | 15 +- .../account/vo/WxAccountUpdateReqVO.java | 3 + .../mp/dal/mysql/account/WxAccountMapper.java | 4 +- yudao-ui-admin/src/api/wechatMp/wxAccount.js | 24 +- .../src/views/wechatMp/wxAccount/index.vue | 237 ++++++++++-------- 11 files changed, 215 insertions(+), 156 deletions(-) diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/WxAccountController.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/WxAccountController.java index acea38372..8d1952e2d 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/WxAccountController.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/WxAccountController.java @@ -25,10 +25,12 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -// TODO @亚洲:/mp/account 即可 +/** + * @author fengdan + */ @Api(tags = "管理后台 - 公众号账户") @RestController -@RequestMapping("/wechatMp/wx-account") +@RequestMapping("/wechatMp/account") @Validated public class WxAccountController { @@ -37,14 +39,14 @@ public class WxAccountController { @PostMapping("/create") @ApiOperation("创建公众号账户") - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:create')") + @PreAuthorize("@ss.hasPermission('wechatMp:account:create')") public CommonResult createWxAccount(@Valid @RequestBody WxAccountCreateReqVO createReqVO) { return success(wxAccountService.createWxAccount(createReqVO)); } @PutMapping("/update") @ApiOperation("更新公众号账户") - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:update')") + @PreAuthorize("@ss.hasPermission('wechatMp:account:update')") public CommonResult updateWxAccount(@Valid @RequestBody WxAccountUpdateReqVO updateReqVO) { wxAccountService.updateWxAccount(updateReqVO); return success(true); @@ -53,7 +55,7 @@ public class WxAccountController { @DeleteMapping("/delete") @ApiOperation("删除公众号账户") @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:delete')") + @PreAuthorize("@ss.hasPermission('wechatMp:account:delete')") public CommonResult deleteWxAccount(@RequestParam("id") Long id) { wxAccountService.deleteWxAccount(id); return success(true); @@ -62,7 +64,7 @@ public class WxAccountController { @GetMapping("/get") @ApiOperation("获得公众号账户") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:query')") + @PreAuthorize("@ss.hasPermission('wechatMp:account:query')") public CommonResult getWxAccount(@RequestParam("id") Long id) { WxAccountDO wxAccount = wxAccountService.getWxAccount(id); return success(WxAccountConvert.INSTANCE.convert(wxAccount)); @@ -71,7 +73,7 @@ public class WxAccountController { @GetMapping("/list") @ApiOperation("获得公众号账户列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:query')") + @PreAuthorize("@ss.hasPermission('wechatMp:account:query')") public CommonResult> getWxAccountList(@RequestParam("ids") Collection ids) { List list = wxAccountService.getWxAccountList(ids); return success(WxAccountConvert.INSTANCE.convertList(list)); @@ -79,7 +81,7 @@ public class WxAccountController { @GetMapping("/page") @ApiOperation("获得公众号账户分页") - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:query')") + @PreAuthorize("@ss.hasPermission('wechatMp:account:query')") public CommonResult> getWxAccountPage(@Valid WxAccountPageReqVO pageVO) { PageResult pageResult = wxAccountService.getWxAccountPage(pageVO); return success(WxAccountConvert.INSTANCE.convertPage(pageResult)); @@ -87,7 +89,7 @@ public class WxAccountController { @GetMapping("/export-excel") @ApiOperation("导出公众号账户 Excel") - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:export')") + @PreAuthorize("@ss.hasPermission('wechatMp:account:export')") @OperateLog(type = EXPORT) public void exportWxAccountExcel(@Valid WxAccountExportReqVO exportReqVO, HttpServletResponse response) throws IOException { diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountBaseVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountBaseVO.java index 29d4fe436..acd8dcc6b 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountBaseVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountBaseVO.java @@ -1,32 +1,40 @@ package cn.iocoder.yudao.module.mp.controller.admin.account.vo; -import lombok.*; -import io.swagger.annotations.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; /** -* 公众号账户 Base VO,提供给添加、修改、详细的子 VO 使用 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 -*/ + * 公众号账户 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + * + * @author fengdan + */ @Data public class WxAccountBaseVO { - @ApiModelProperty(value = "公众号名称") + @ApiModelProperty(value = "公众号名称", required = true) + @NotNull(message = "公众号名称不能为空") private String name; - @ApiModelProperty(value = "公众号账户") + @ApiModelProperty(value = "公众号账户", required = true) + @NotNull(message = "公众号账户不能为空") private String account; - @ApiModelProperty(value = "公众号appid") - private String appid; + @ApiModelProperty(value = "公众号appid", required = true) + @NotNull(message = "公众号appid不能为空") + private String appId; - @ApiModelProperty(value = "公众号密钥") - private String appsecret; + @ApiModelProperty(value = "公众号密钥", required = true) + @NotNull(message = "公众号密钥不能为空") + private String appSecret; @ApiModelProperty(value = "公众号token") private String token; @ApiModelProperty(value = "加密密钥") - private String aeskey; + private String aesKey; @ApiModelProperty(value = "备注") private String remark; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountCreateReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountCreateReqVO.java index 1d449bee6..d2d7414fd 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountCreateReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountCreateReqVO.java @@ -1,8 +1,13 @@ package cn.iocoder.yudao.module.mp.controller.admin.account.vo; -import lombok.*; -import io.swagger.annotations.*; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +/** + * @author fengdan + */ @ApiModel("管理后台 - 公众号账户创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExcelVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExcelVO.java index b2c0bba37..e889b353b 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExcelVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExcelVO.java @@ -1,9 +1,10 @@ package cn.iocoder.yudao.module.mp.controller.admin.account.vo; -import lombok.*; -import java.util.*; - import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; + /** * 公众号账户 Excel VO @@ -23,10 +24,7 @@ public class WxAccountExcelVO { private String account; @ExcelProperty("公众号appid") - private String appid; - - @ExcelProperty("公众号密钥") - private String appsecret; + private String appId; @ExcelProperty("公众号url") private String url; @@ -35,7 +33,7 @@ public class WxAccountExcelVO { private String token; @ExcelProperty("加密密钥") - private String aeskey; + private String aesKey; @ExcelProperty("二维码图片URL") private String qrCodeUrl; @@ -45,5 +43,4 @@ public class WxAccountExcelVO { @ExcelProperty("创建时间") private Date createTime; - } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExportReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExportReqVO.java index 87ad1c5fc..ac3a98dc3 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExportReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExportReqVO.java @@ -7,6 +7,9 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +/** + * @author fengdan + */ @ApiModel(value = "管理后台 - 公众号账户 Excel 导出 Request VO", description = "参数和 WxAccountPageReqVO 是一致的") @Data public class WxAccountExportReqVO { @@ -18,7 +21,7 @@ public class WxAccountExportReqVO { private String account; @ApiModelProperty(value = "公众号appid") - private String appid; + private String appId; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始创建时间") diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountPageReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountPageReqVO.java index bb1b789a7..d3145170d 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountPageReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountPageReqVO.java @@ -8,12 +8,14 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +/** + * @author fengdan + */ @ApiModel("管理后台 - 公众号账户分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class WxAccountPageReqVO extends PageParam { - @ApiModelProperty(value = "公众号名称") private String name; @@ -21,7 +23,7 @@ public class WxAccountPageReqVO extends PageParam { private String account; @ApiModelProperty(value = "公众号appid") - private String appid; + private String appId; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始创建时间") @@ -30,5 +32,4 @@ public class WxAccountPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "结束创建时间") private Date endCreateTime; - } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountRespVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountRespVO.java index 326ebfa0b..235bebc6d 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountRespVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountRespVO.java @@ -1,9 +1,16 @@ package cn.iocoder.yudao.module.mp.controller.admin.account.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.util.Date; + +/** + * @author fengdan + */ @ApiModel("管理后台 - 公众号账户 Response VO") @Data @EqualsAndHashCode(callSuper = true) @@ -22,4 +29,6 @@ public class WxAccountRespVO extends WxAccountBaseVO { @ApiModelProperty(value = "创建时间", required = true) private Date createTime; + @ApiModelProperty(value = "公众号密钥", required = true) + private String appSecret; } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountUpdateReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountUpdateReqVO.java index 63f0b6c1e..d1607d777 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountUpdateReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountUpdateReqVO.java @@ -4,6 +4,9 @@ import lombok.*; import io.swagger.annotations.*; import javax.validation.constraints.*; +/** + * @author fengdan + */ @ApiModel("管理后台 - 公众号账户更新 Request VO") @Data @EqualsAndHashCode(callSuper = true) diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/account/WxAccountMapper.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/account/WxAccountMapper.java index fe3e8e211..ada54e8e6 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/account/WxAccountMapper.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/account/WxAccountMapper.java @@ -22,7 +22,7 @@ public interface WxAccountMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(WxAccountDO::getName, reqVO.getName()) .eqIfPresent(WxAccountDO::getAccount, reqVO.getAccount()) - .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppid()) + .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppId()) .betweenIfPresent(WxAccountDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .orderByDesc(WxAccountDO::getId)); } @@ -31,7 +31,7 @@ public interface WxAccountMapper extends BaseMapperX { return selectList(new LambdaQueryWrapperX() .likeIfPresent(WxAccountDO::getName, reqVO.getName()) .eqIfPresent(WxAccountDO::getAccount, reqVO.getAccount()) - .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppid()) + .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppId()) .betweenIfPresent(WxAccountDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .orderByDesc(WxAccountDO::getId)); } diff --git a/yudao-ui-admin/src/api/wechatMp/wxAccount.js b/yudao-ui-admin/src/api/wechatMp/wxAccount.js index 51e9ae69f..22d826279 100644 --- a/yudao-ui-admin/src/api/wechatMp/wxAccount.js +++ b/yudao-ui-admin/src/api/wechatMp/wxAccount.js @@ -1,52 +1,52 @@ import request from '@/utils/request' // 创建公众号账户 -export function createWxAccount(data) { +export function createAccount(data) { return request({ - url: '/wechatMp/wx-account/create', + url: '/wechatMp/account/create', method: 'post', data: data }) } // 更新公众号账户 -export function updateWxAccount(data) { +export function updateAccount(data) { return request({ - url: '/wechatMp/wx-account/update', + url: '/wechatMp/account/update', method: 'put', data: data }) } // 删除公众号账户 -export function deleteWxAccount(id) { +export function deleteAccount(id) { return request({ - url: '/wechatMp/wx-account/delete?id=' + id, + url: '/wechatMp/account/delete?id=' + id, method: 'delete' }) } // 获得公众号账户 -export function getWxAccount(id) { +export function getAccount(id) { return request({ - url: '/wechatMp/wx-account/get?id=' + id, + url: '/wechatMp/account/get?id=' + id, method: 'get' }) } // 获得公众号账户分页 -export function getWxAccountPage(query) { +export function getAccountPage(query) { return request({ - url: '/wechatMp/wx-account/page', + url: '/wechatMp/account/page', method: 'get', params: query }) } // 导出公众号账户 Excel -export function exportWxAccountExcel(query) { +export function exportAccountExcel(query) { return request({ - url: '/wechatMp/wx-account/export-excel', + url: '/wechatMp/account/export-excel', method: 'get', params: query, responseType: 'blob' diff --git a/yudao-ui-admin/src/views/wechatMp/wxAccount/index.vue b/yudao-ui-admin/src/views/wechatMp/wxAccount/index.vue index 4449ba74d..e61ad6b2b 100644 --- a/yudao-ui-admin/src/views/wechatMp/wxAccount/index.vue +++ b/yudao-ui-admin/src/views/wechatMp/wxAccount/index.vue @@ -3,18 +3,13 @@ - - - - - - - - + + + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/> 搜索 @@ -26,27 +21,29 @@ 新增 + v-hasPermi="['wechatMp:account:create']">新增 + - 导出 + 导出 + - - - - - - - + + + + + + - - + +