From 9ae90d315cb746380948843201a35edd5f10070e Mon Sep 17 00:00:00 2001 From: DB <2502523450@qq.com> Date: Wed, 11 Oct 2023 16:50:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=99=A8;=E9=9B=86=E6=88=90=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=BC=80=E6=94=BE=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cpop/core/base/table/SysOperationLog.java | 2 +- .../com/cpop/core/base/table/SysUser.java | 2 +- .../impl/OamStaffDetailsServiceImpl.java | 4 +- Cpop-Generator/pom.xml | 6 ++ .../com/cpop/generator/CpopGenerator.java | 6 +- .../{template.enjoy => template/enjoy}/bo.tpl | 0 .../enjoy}/controller.tpl | 0 .../enjoy}/dto.tpl | 0 .../enjoy}/entity.tpl | 0 .../enjoy}/mapper.tpl | 0 .../enjoy}/mapperXml.tpl | 0 .../enjoy}/package-info.tpl | 0 .../enjoy}/pageBo.tpl | 0 .../enjoy}/pageVo.tpl | 0 .../enjoy}/service.tpl | 0 .../enjoy}/serviceImpl.tpl | 0 .../enjoy}/tableDef.tpl | 0 .../{template.enjoy => template/enjoy}/vo.tpl | 0 .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-prod.yml | 8 +-- .../src/main/resources/application-test.yml | 14 ++-- .../src/main/resources/application.yml | 4 +- .../business/controller/WxOpenController.java | 37 ++++++++-- .../cpop/oam/business/entity/WxOpenMini.java | 57 ++++++++++++++++ .../oam/business/mapper/WxOpenMiniMapper.java | 14 ++++ .../business/service/WxOpenMiniService.java | 36 ++++++++++ .../impl/TaskWorkOrderServiceImpl.java | 2 +- .../service/impl/WxOpenMiniServiceImpl.java | 67 +++++++++++++++++++ .../cpop/oam/business/vo/WxOpenMiniVo.java | 52 ++++++++++++++ .../resources/mapper/WxOpenMiniMapper.xml | 7 ++ 30 files changed, 291 insertions(+), 29 deletions(-) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/bo.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/controller.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/dto.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/entity.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/mapper.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/mapperXml.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/package-info.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/pageBo.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/pageVo.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/service.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/serviceImpl.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/tableDef.tpl (100%) rename Cpop-Generator/src/main/resources/{template.enjoy => template/enjoy}/vo.tpl (100%) create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/WxOpenMini.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/WxOpenMiniMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/WxOpenMiniService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/WxOpenMiniServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/WxOpenMiniVo.java create mode 100644 Cpop-Oam/src/main/resources/mapper/WxOpenMiniMapper.xml diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysOperationLog.java b/Cpop-Core/src/main/java/com/cpop/core/base/table/SysOperationLog.java index 4ea1d0b..25fb832 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysOperationLog.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/table/SysOperationLog.java @@ -23,7 +23,7 @@ import java.io.Serializable; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -@Table(value = "pp_sys_operation_log", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +@Table(value = "cp_sys_operation_log", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) public class SysOperationLog extends BaseEntity implements Serializable { /** diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java b/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java index 79885c8..2822efa 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java @@ -24,7 +24,7 @@ import java.io.Serializable; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -@Table(value = "pp_sys_user", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +@Table(value = "cp_sys_user", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) public class SysUser extends BaseEntity implements Serializable { /** diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java index 44532ef..755b1df 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java +++ b/Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java @@ -72,8 +72,8 @@ public class OamStaffDetailsServiceImpl implements UserDetailsService { //查询员工信息 List list = DbChain.table("oam_menu") .select("pom.permission") - .from("pp_oam_menu").as("pom") - .leftJoin("pp_oam_role_menu").as("porm").on("porm.menu_id = pom.id") + .from("cp_oam_menu").as("pom") + .leftJoin("cp_oam_role_menu").as("porm").on("porm.menu_id = pom.id") .where("pom.type in (1,2)") .and("porm.role_id = ?", staffLoginInfo.getRoleId()) .and("pom.permission is not null") diff --git a/Cpop-Generator/pom.xml b/Cpop-Generator/pom.xml index 35176d2..2e67084 100644 --- a/Cpop-Generator/pom.xml +++ b/Cpop-Generator/pom.xml @@ -24,6 +24,12 @@ com.cpop Cpop-Core + + + com.mysql + mysql-connector-j + runtime + diff --git a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java index 391d9d7..27f28cc 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -39,17 +39,17 @@ public class CpopGenerator { /** * 输出路径 */ - private static final String EXPORT_URL = "/Cpop-Jambox"; + private static final String EXPORT_URL = "/Cpop-Oam"; /** * 模块 */ - private static final String EXPORT_ITEM = "jambox"; + private static final String EXPORT_ITEM = "oam"; /** * 表前缀 */ - private static final String TABLE_PREFIX = "cp_j_"; + private static final String TABLE_PREFIX = "cp_oam_"; /** * 主入口 diff --git a/Cpop-Generator/src/main/resources/template.enjoy/bo.tpl b/Cpop-Generator/src/main/resources/template/enjoy/bo.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/bo.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/bo.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/controller.tpl b/Cpop-Generator/src/main/resources/template/enjoy/controller.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/controller.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/controller.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/dto.tpl b/Cpop-Generator/src/main/resources/template/enjoy/dto.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/dto.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/dto.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/entity.tpl b/Cpop-Generator/src/main/resources/template/enjoy/entity.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/entity.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/entity.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/mapper.tpl b/Cpop-Generator/src/main/resources/template/enjoy/mapper.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/mapper.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/mapper.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/mapperXml.tpl b/Cpop-Generator/src/main/resources/template/enjoy/mapperXml.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/mapperXml.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/mapperXml.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/package-info.tpl b/Cpop-Generator/src/main/resources/template/enjoy/package-info.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/package-info.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/package-info.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/pageBo.tpl b/Cpop-Generator/src/main/resources/template/enjoy/pageBo.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/pageBo.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/pageBo.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/pageVo.tpl b/Cpop-Generator/src/main/resources/template/enjoy/pageVo.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/pageVo.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/pageVo.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/service.tpl b/Cpop-Generator/src/main/resources/template/enjoy/service.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/service.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/service.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/serviceImpl.tpl b/Cpop-Generator/src/main/resources/template/enjoy/serviceImpl.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/serviceImpl.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/serviceImpl.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/tableDef.tpl b/Cpop-Generator/src/main/resources/template/enjoy/tableDef.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/tableDef.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/tableDef.tpl diff --git a/Cpop-Generator/src/main/resources/template.enjoy/vo.tpl b/Cpop-Generator/src/main/resources/template/enjoy/vo.tpl similarity index 100% rename from Cpop-Generator/src/main/resources/template.enjoy/vo.tpl rename to Cpop-Generator/src/main/resources/template/enjoy/vo.tpl diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml index 0631c01..0c51045 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml @@ -51,7 +51,7 @@ spring: server: port: 9420 servlet: - context-path: /Cpop-Oam-Dev + context-path: /Cpop-Oam #Mybatis-Flex mybatis-flex: diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml index 6ee19ac..9142d63 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml @@ -4,7 +4,7 @@ cpop: profile: /root/jambox-union/jambox-oam/uploadPath/upload jwt: #白名单 - whiteList: /login,/getCaptcha,/profile/** + whiteList: /login,/getCaptcha,/profile/**,/wxOpen/receiveTicket,/wxOpen/*/callback #拦截 gateway: rsa-keypair: @@ -16,9 +16,9 @@ cpop: # DataSource Config spring: application: - name: PuPu_Oam + name: Cpop-Oam-Prod datasource: - url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/pupu-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: Customer0401 #redis配置 @@ -52,7 +52,7 @@ spring: server: port: 9420 servlet: - context-path: /PuPu-OAM + context-path: /Cpop-Oam #Mybatis-Flex mybatis-flex: diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml index 316894f..b9ae194 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml @@ -4,7 +4,7 @@ cpop: profile: /root/jambox-union/jambox-oam/uploadPath/upload jwt: #白名单 - whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources + whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback #拦截 gateway: rsa-keypair: @@ -16,9 +16,9 @@ cpop: # DataSource Config spring: application: - name: PuPu-TEST + name: Cpop-Oam-Test datasource: - url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/pupu-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: Customer0401 #redis配置 @@ -52,7 +52,7 @@ spring: server: port: 9420 servlet: - context-path: /PuPu-Oam-TEST + context-path: /Cpop-Oam #Mybatis-Flex mybatis-flex: @@ -63,7 +63,7 @@ mybatis-flex: knife4j: enable: true openapi: - title: PuPu-OAM开发API + title: Cpop-OAM开发API description: PuPu-OAM开发API email: concat: DB @@ -78,10 +78,10 @@ knife4j: group-name: Oam api-rule: package api-rule-resources: - - com.pupu.oam + - com.cpop.oam #jambox jambox: group-name: Jambox api-rule: package api-rule-resources: - - com.pupu.jambox \ No newline at end of file + - com.cpop.jambox \ No newline at end of file diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml index 9db0d3f..b62e9bb 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml @@ -68,7 +68,7 @@ spring: org: quartz: scheduler: - instanceName: PuPuOamScheduler + instanceName: CpopOamScheduler instanceId: AUTO jobStore: class: org.springframework.scheduling.quartz.LocalDataSourceJobStore @@ -108,7 +108,7 @@ task: # 设置队列容量 queueCapacity: 100 # 设置线程名称前缀 - threadNamePrefix: "PuPu-Oam-AsyncNotify-" + threadNamePrefix: "Cpop-Oam-AsyncNotify-" # 设置线程池等待终止时间(秒) awaitTerminationSeconds: 60 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java index 1cc0926..ed24f81 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java @@ -8,6 +8,8 @@ import com.cpop.core.base.exception.ServiceException; import com.cpop.core.utils.sql.SqlUtils; import com.cpop.oam.business.bo.WxOpenMaCodeCommitBo; import com.cpop.oam.business.bo.WxOpenMaTrialQrCodeBo; +import com.cpop.oam.business.service.WxOpenMiniService; +import com.cpop.oam.business.vo.WxOpenMiniVo; import com.cpop.sdk.framework.config.WxOpenProperties; import com.cpop.sdk.framework.handler.WxOpenService; import com.mybatisflex.core.paginate.Page; @@ -36,7 +38,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.util.Base64; import java.util.List; -import java.util.Map; /** * @author DB @@ -56,6 +57,9 @@ public class WxOpenController { @Autowired private WxOpenProperties properties; + @Autowired + private WxOpenMiniService wxOpenMiniService; + /** * @descriptions 第三方平台授权 * @author DB @@ -136,7 +140,7 @@ public class WxOpenController { * @param msgSignature 加密信息 * @return: java.lang.Object */ - @RequestMapping("{appId}/callback") + @RequestMapping("/{appId}/callback") public Object callback(@RequestBody(required = false) String requestBody, @PathVariable("appId") String appId, @RequestParam("signature") String signature, @@ -228,18 +232,37 @@ public class WxOpenController { */ @ApiOperation("获取授权小程序列表") @GetMapping("/getAuthorizerList") - public R>> getAuthorizerList() { + public R> getAuthorizerList() { try { PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); - WxOpenAuthorizerListResult authorizerList = wxOpenService.getWxOpenComponentService().getAuthorizerList(pageDomain.getPageNum(), pageDomain.getPageSize()); - Page> page = Page.of(pageDomain.getPageNum(), pageDomain.getPageSize(), authorizerList.getTotalCount()); - page.setRecords(authorizerList.getList()); + WxOpenAuthorizerListResult authorizerList = wxOpenService.getWxOpenComponentService().getAuthorizerList((pageDomain.getPageNum() - 1) * pageDomain.getPageSize(), pageDomain.getPageSize()); + List list = wxOpenMiniService.getAuthorizerList(authorizerList); + Page page = Page.of(pageDomain.getPageNum(), pageDomain.getPageSize(), authorizerList.getTotalCount()); + page.setRecords(list); return R.ok(page); } catch (WxErrorException e) { throw new ServiceException(e.getMessage()); } } + /** + * @Description: 数据同步 + * @return R + * @author DB + * @Date: 2023/6/16 0016 17:34 + */ + @ApiOperation("数据同步") + @PutMapping("/dataSync/{authorizerAppid}") + public R dataSync(@PathVariable("authorizerAppid") String authorizerAppid) { + try { + WxOpenAuthorizerInfoResult authorizerInfo = wxOpenService.getWxOpenComponentService().getAuthorizerInfo(authorizerAppid); + wxOpenMiniService.dataSync(authorizerInfo); + } catch (WxErrorException e) { + throw new ServiceException(e.getMessage()); + } + return R.ok(); + } + /** * @Description: 获取授权小程序详情 * @param authorizerAppid 授权小程序appid @@ -468,7 +491,7 @@ public class WxOpenController { */ @ApiOperation("获取模板列表") @GetMapping("/getTemplateList") - public R> getTemplateList(@RequestParam("templateType")Integer templateType) { + public R> getTemplateList(Integer templateType) { try { List templateList = wxOpenService.getWxOpenComponentService().getTemplateList(templateType); return R.ok(templateList); diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/WxOpenMini.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/WxOpenMini.java new file mode 100644 index 0000000..4714b35 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/WxOpenMini.java @@ -0,0 +1,57 @@ +package com.cpop.oam.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * Oam-微信开放平台-小程序 实体类。 + * + * @author DB + * @since 2023-10-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_oam_wx_open_mini", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class WxOpenMini extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 小程序appid + */ + private String appid; + + /** + * 昵称 + */ + private String nickName; + + + + + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/WxOpenMiniMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/WxOpenMiniMapper.java new file mode 100644 index 0000000..2ce5351 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/WxOpenMiniMapper.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.oam.business.entity.WxOpenMini; + +/** + * Oam-微信开放平台-小程序 映射层。 + * + * @author DB + * @since 2023-10-11 + */ +public interface WxOpenMiniMapper extends BaseMapper { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/WxOpenMiniService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/WxOpenMiniService.java new file mode 100644 index 0000000..f5310f1 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/WxOpenMiniService.java @@ -0,0 +1,36 @@ +package com.cpop.oam.business.service; + +import com.cpop.oam.business.vo.WxOpenMiniVo; +import com.mybatisflex.core.service.IService; +import com.cpop.oam.business.entity.WxOpenMini; +import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerInfoResult; +import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerListResult; + +import java.util.List; + +/** + * Oam-微信开放平台-小程序 服务层。 + * + * @author DB + * @since 2023-10-11 + */ +public interface WxOpenMiniService extends IService { + + /** + * @descriptions 获取授权小程序列表 + * @author DB + * @date 2023/10/11 12:52 + * @param authorizerList 微信拉取信息列表 + * @return: java.util.List + */ + List getAuthorizerList(WxOpenAuthorizerListResult authorizerList); + + /** + * @descriptions 数据同步 + * @author DB + * @date 2023/10/11 13:41 + * @param authorizerInfo 授权小程序信息 + * @return: void + */ + void dataSync(WxOpenAuthorizerInfoResult authorizerInfo); +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java index 9fa0c3f..e28a2a0 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java @@ -206,7 +206,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl implements WxOpenMiniService { + + /** + * @descriptions 获取授权小程序列表 + * @author DB + * @date 2023/10/11 12:52 + * @param authorizerList 微信拉取信息列表 + * @return: java.util.List + */ + @Override + public List getAuthorizerList(WxOpenAuthorizerListResult authorizerList) { + List wxOpenMiniVos = JSONArray.parseArray(JSON.toJSONString(authorizerList.getList()), WxOpenMiniVo.class); + if (!wxOpenMiniVos.isEmpty()){ + Map appletMap = this.list(QueryWrapper.create().where(WX_OPEN_MINI.APPID.in(wxOpenMiniVos.stream().map(WxOpenMiniVo::getAuthorizerAppid).collect(Collectors.toSet())))) + .stream().collect(Collectors.toMap(WxOpenMini::getAppid, WxOpenMini::getNickName)); + wxOpenMiniVos.forEach(item->{ + item.setNickName(appletMap.get(item.getAuthorizerAppid())); + }); + } + return wxOpenMiniVos; + } + + /** + * @descriptions 数据同步 + * @author DB + * @date 2023/10/11 13:41 + * @param authorizerInfo 授权小程序信息 + * @return: void + */ + @Override + public void dataSync(WxOpenAuthorizerInfoResult authorizerInfo) { + WxOpenMini wxOpenMini = this.getOne(QueryWrapper.create().where(WX_OPEN_MINI.APPID.eq(authorizerInfo.getAuthorizationInfo().getAuthorizerAppid()))); + if (null == wxOpenMini) { + wxOpenMini = new WxOpenMini(); + wxOpenMini.setAppid(authorizerInfo.getAuthorizationInfo().getAuthorizerAppid()); + } + wxOpenMini.setNickName(authorizerInfo.getAuthorizerInfo().getNickName()); + this.saveOrUpdate(wxOpenMini); + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/WxOpenMiniVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/WxOpenMiniVo.java new file mode 100644 index 0000000..7658e2d --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/WxOpenMiniVo.java @@ -0,0 +1,52 @@ +package com.cpop.oam.business.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.cpop.common.utils.DateUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author DB + * @createTime 2023/10/11 12:49 + * @description + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "OpenPlatformAuthorizerListVo拉取已授权的帐号信息") +public class WxOpenMiniVo implements Serializable { + + /** + * 已授权帐号的 appid + */ + @JSONField(name = "authorizer_appid") + @ApiModelProperty("已授权帐号的 appid") + private String authorizerAppid; + /** + * 刷新令牌authorizer_refresh_token + */ + @JSONField(name = "refresh_token") + @ApiModelProperty("刷新令牌authorizer_refresh_token") + private String refreshToken; + /** + * 授权的时间 + */ + @JSONField(name = "auth_time") + @ApiModelProperty("授权的时间") + private String authTime; + + public void setAuthTime(Integer authTime) { + Date date = new Date(authTime * 1000L); + this.authTime = DateUtils.format(date, "yyyy-MM-dd HH:mm:ss"); + } + + /** + * 小程序名称 + */ + @ApiModelProperty("小程序名称") + private String nickName; +} diff --git a/Cpop-Oam/src/main/resources/mapper/WxOpenMiniMapper.xml b/Cpop-Oam/src/main/resources/mapper/WxOpenMiniMapper.xml new file mode 100644 index 0000000..dd66644 --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/WxOpenMiniMapper.xml @@ -0,0 +1,7 @@ + + + + +