From e9d29ef2df3d6e27f48e005a358910def9ef8850 Mon Sep 17 00:00:00 2001 From: Loki <654612@qq.com> Date: Tue, 10 May 2022 17:14:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/client/impl/AbstractPayClient.java | 4 +- .../pom.xml | 15 +- .../iocoder/yudao/config/WxCpConfigure.java | 33 +++ .../main/resources/META-INF/spring.factories | 2 + .../file/core/client/s3/S3FileClientTest.java | 2 +- .../config/YudaoMybatisAutoConfiguration.java | 2 +- .../security/config/SecurityProperties.java | 2 +- .../app/auth/vo/AppAuthLoginRespVO.java | 2 +- .../system/enums/ErrorCodeConstants.java | 2 + .../yudao-module-system-impl/pom.xml | 5 + .../admin/CpUser/CpUserController.java | 100 ++++++++ .../admin/CpUser/vo/CpUserBaseVO.java | 46 ++++ .../admin/CpUser/vo/CpUserCreateReqVO.java | 14 ++ .../admin/CpUser/vo/CpUserExcelVO.java | 50 ++++ .../admin/CpUser/vo/CpUserExportReqVO.java | 50 ++++ .../admin/CpUser/vo/CpUserPageReqVO.java | 52 +++++ .../admin/CpUser/vo/CpUserRespVO.java | 19 ++ .../admin/CpUser/vo/CpUserUpdateReqVO.java | 18 ++ .../controller/admin/auth/AuthController.java | 48 ++++ .../admin/auth/vo/auth/AuthLoginReqVO.java | 4 +- .../admin/auth/vo/auth/AuthLoginRespVO.java | 2 +- .../auth/vo/auth/AuthSocialLogin2ReqVO.java | 2 +- .../system/convert/CpUser/CpUserConvert.java | 37 +++ .../dal/dataobject/CpUser/CpUserDO.java | 65 ++++++ .../system/dal/mysql/CpUser/CpUserMapper.java | 50 ++++ .../config/SecurityConfiguration.java | 2 + .../job/cpuser/CpWeixinUserSyncJob.java | 24 ++ .../system/service/CpUser/CpUserService.java | 76 ++++++ .../service/CpUser/CpUserServiceImpl.java | 127 ++++++++++ .../service/auth/AdminAuthServiceImpl.java | 2 +- .../service/user/AdminUserServiceImpl.java | 2 +- .../resources/mapper/CpUser/CpUserMapper.xml | 12 + .../service/CpUser/CpUserServiceImplTest.java | 218 ++++++++++++++++++ .../service/user/UserServiceImplTest.java | 6 +- .../src/test/resources/sql/clean.sql | 1 + .../src/test/resources/sql/create_tables.sql | 20 ++ .../src/main/resources/application-local.yaml | 6 +- .../src/main/resources/application-prod.yaml | 8 +- .../src/main/resources/application.yaml | 1 + yudao-server/src/main/resources/banner.txt | 9 - .../src/main/resources/logback-spring.xml | 11 +- yudao-ui-admin | 2 +- yudao-ui-app-v1/common/js/request.js | 2 +- .../rest/AppStoreBargainController.java | 8 +- .../rest/AppStoreCombinationController.java | 4 +- .../auth/rest/LetterAppAuthController.java | 4 +- .../modules/coupon/rest/CouponController.java | 10 +- .../modules/manage/rest/ShoperController.java | 4 +- .../order/rest/AppStoreOrderController.java | 11 +- .../rest/AppStoreProductController.java | 22 +- .../rest/AppStoreAfterSalesController.java | 16 +- .../user/rest/AppUserBillController.java | 12 +- .../user/rest/LetterAppUserController.java | 14 +- .../service/mapper/YxStoreBargainMapper.java | 2 +- 54 files changed, 1177 insertions(+), 85 deletions(-) create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/config/WxCpConfigure.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/resources/META-INF/spring.factories create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/CpUserController.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserBaseVO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserCreateReqVO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExcelVO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExportReqVO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserPageReqVO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserRespVO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserUpdateReqVO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/CpUser/CpUserConvert.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/CpUser/CpUserDO.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/CpUser/CpUserMapper.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/job/cpuser/CpWeixinUserSyncJob.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserService.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/resources/mapper/CpUser/CpUserMapper.xml create mode 100644 yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImplTest.java diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java index 292b6cf0..413587b9 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java @@ -49,7 +49,9 @@ public abstract class AbstractPayClient implemen */ public final void init() { doInit(); - log.info("[init][配置({}) 初始化完成]", config); + // PayClientConfig + // log.info("[init][配置({}) 初始化完成]", config); + log.info("[init][配置({}) 初始化完成]", PayClientConfig.class); } /** diff --git a/yudao-framework/yudao-spring-boot-starter-biz-weixin/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-weixin/pom.xml index b756beb6..b0b6bfde 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-weixin/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-biz-weixin/pom.xml @@ -12,7 +12,8 @@ jar ${project.artifactId} - 微信拓展 + + 微信拓展 1. 基于 weixin-java-mp 库,对接微信公众号平台。目前主要解决微信公众号的支付场景。 https://github.com/YunaiV/ruoyi-vue-pro @@ -45,6 +46,18 @@ 4.3.0 + + + com.github.binarywang + weixin-java-cp + 4.3.0 + + + + cn.iocoder.boot + yudao-spring-boot-starter-extension + ${revision} + diff --git a/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/config/WxCpConfigure.java b/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/config/WxCpConfigure.java new file mode 100644 index 00000000..3301f96e --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/config/WxCpConfigure.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.config; + +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.cp.api.WxCpService; +import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl; +import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Slf4j +public class WxCpConfigure { + + + @Bean + public WxCpService wxCpService(){ + + WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl(); + + config.setCorpId("wwb9f9734e8e124761"); + config.setAgentId(1000033); + config.setCorpSecret("UDSKsn0_LAPYqSwjH9E-AfY_X40lq0sormfe1yV_6Gc"); + + WxCpServiceImpl wxCpService = new WxCpServiceImpl(); + wxCpService.setWxCpConfigStorage(config); + + log.info("企业微信初始化:{}",wxCpService); + + return wxCpService; + + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/resources/META-INF/spring.factories b/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..65dc80b8 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + cn.iocoder.yudao.config.WxCpConfigure diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java b/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java index de77477c..dfa1ca4a 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java +++ b/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java @@ -17,7 +17,7 @@ public class S3FileClientTest { // 配置成你自己的 config.setAccessKey("admin"); config.setAccessSecret("password"); - config.setBucket("yudaoyuanma"); + config.setBucket("zsw"); config.setDomain(null); // 默认 9000 endpoint config.setEndpoint("http://127.0.0.1:9000"); diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java index 3412ab70..1df9d35b 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java @@ -65,7 +65,7 @@ public class YudaoMybatisAutoConfiguration { public SqlSessionFactory sqlSessionFactory(DynamicDataSourceProvider dynamicDataSourceProvider) throws Exception { MybatisSqlSessionFactoryBean factory = new MybatisSqlSessionFactoryBean(); Map map = dynamicDataSourceProvider.loadDataSources(); - factory.setDataSource(map.get("xiaohui")); + factory.setDataSource(map.get("bxg")); return getSqlSessionFactory(factory); } diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java index 537463e9..aad26ca1 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java @@ -41,6 +41,6 @@ public class SecurityProperties { * 一定要配置密钥,保证安全性 */ @NotEmpty(message = "mock 模式的密钥不能为空") // 这里设置了一个默认值,因为实际上只有 mockEnable 为 true 时才需要配置。 - private String mockSecret = "yudaoyuanma"; + private String mockSecret = "zsw"; } diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthLoginRespVO.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthLoginRespVO.java index 07ad4311..2b96ccf0 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthLoginRespVO.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthLoginRespVO.java @@ -14,7 +14,7 @@ import lombok.NoArgsConstructor; @Builder public class AppAuthLoginRespVO { - @ApiModelProperty(value = "token", required = true, example = "yudaoyuanma") + @ApiModelProperty(value = "token", required = true, example = "zsw") private String token; } diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index e72c75e6..dfb58f5e 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -123,4 +123,6 @@ public interface ErrorCodeConstants { ErrorCode SENSITIVE_WORD_NOT_EXISTS = new ErrorCode(1002019000, "系统敏感词在所有标签中都不存在"); ErrorCode SENSITIVE_WORD_EXISTS = new ErrorCode(1002019001, "系统敏感词已在标签中存在"); + ErrorCode CP_USER_NOT_EXISTS = new ErrorCode(1002021001,"微信企业成员不存在"); + } diff --git a/yudao-module-system/yudao-module-system-impl/pom.xml b/yudao-module-system/yudao-module-system-impl/pom.xml index db2fce8b..9a7e2aad 100644 --- a/yudao-module-system/yudao-module-system-impl/pom.xml +++ b/yudao-module-system/yudao-module-system-impl/pom.xml @@ -97,6 +97,11 @@ yudao-spring-boot-starter-excel + + cn.iocoder.boot + yudao-spring-boot-starter-biz-weixin + + diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/CpUserController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/CpUserController.java new file mode 100644 index 00000000..6539dbf5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/CpUserController.java @@ -0,0 +1,100 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.*; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.system.controller.admin.CpUser.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; +import cn.iocoder.yudao.module.system.convert.CpUser.CpUserConvert; +import cn.iocoder.yudao.module.system.service.CpUser.CpUserService; + +@Api(tags = "管理后台 - 企业微信成员") +@RestController +@RequestMapping("/system/cp-user") +@Validated +public class CpUserController { + + @Resource + private CpUserService cpUserService; + + @PostMapping("/create") + @ApiOperation("创建企业微信成员") + @PreAuthorize("@ss.hasPermission('system:cp-user:create')") + public CommonResult createCpUser(@Valid @RequestBody CpUserCreateReqVO createReqVO) { + return success(cpUserService.createCpUser(createReqVO)); + } + + @PutMapping("/update") + @ApiOperation("更新企业微信成员") + @PreAuthorize("@ss.hasPermission('system:cp-user:update')") + public CommonResult updateCpUser(@Valid @RequestBody CpUserUpdateReqVO updateReqVO) { + cpUserService.updateCpUser(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @ApiOperation("删除企业微信成员") + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('system:cp-user:delete')") + public CommonResult deleteCpUser(@RequestParam("id") Long id) { + cpUserService.deleteCpUser(id); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得企业微信成员") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('system:cp-user:query')") + public CommonResult getCpUser(@RequestParam("id") Long id) { + CpUserDO cpUser = cpUserService.getCpUser(id); + return success(CpUserConvert.INSTANCE.convert(cpUser)); + } + + @GetMapping("/list") + @ApiOperation("获得企业微信成员列表") + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) + @PreAuthorize("@ss.hasPermission('system:cp-user:query')") + public CommonResult> getCpUserList(@RequestParam("ids") Collection ids) { + List list = cpUserService.getCpUserList(ids); + return success(CpUserConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @ApiOperation("获得企业微信成员分页") + @PreAuthorize("@ss.hasPermission('system:cp-user:query')") + public CommonResult> getCpUserPage(@Valid CpUserPageReqVO pageVO) { + PageResult pageResult = cpUserService.getCpUserPage(pageVO); + return success(CpUserConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @ApiOperation("导出企业微信成员 Excel") + @PreAuthorize("@ss.hasPermission('system:cp-user:export')") + @OperateLog(type = EXPORT) + public void exportCpUserExcel(@Valid CpUserExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = cpUserService.getCpUserList(exportReqVO); + // 导出 Excel + List datas = CpUserConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "企业微信成员.xls", "数据", CpUserExcelVO.class, datas); + } + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserBaseVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserBaseVO.java new file mode 100644 index 00000000..f0aec405 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserBaseVO.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import javax.validation.constraints.*; + +/** +* 企业微信成员 Base VO,提供给添加、修改、详细的子 VO 使用 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 +*/ +@Data +public class CpUserBaseVO { + + @ApiModelProperty(value = "用户昵称", required = true) + @NotNull(message = "用户昵称不能为空") + private String userid; + + @ApiModelProperty(value = "头像", required = true) + @NotNull(message = "头像不能为空") + private String avatar; + + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空") + private Integer status; + + @ApiModelProperty(value = "手机号", required = true) + @NotNull(message = "手机号不能为空") + private String mobile; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "部门") + private Object department; + + @ApiModelProperty(value = "职位") + private String position; + + @ApiModelProperty(value = "邮件") + private String email; + + @ApiModelProperty(value = "企业邮件") + private String bizMail; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserCreateReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserCreateReqVO.java new file mode 100644 index 00000000..eb011d9b --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import javax.validation.constraints.*; + +@ApiModel("管理后台 - 企业微信成员创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CpUserCreateReqVO extends CpUserBaseVO { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExcelVO.java new file mode 100644 index 00000000..46a9c71d --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExcelVO.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 企业微信成员 Excel VO + * + * @author 系统管理员 + */ +@Data +public class CpUserExcelVO { + + @ExcelProperty("编号") + private Long id; + + @ExcelProperty("用户昵称") + private String userid; + + @ExcelProperty("头像") + private String avatar; + + @ExcelProperty("状态") + private Integer status; + + @ExcelProperty("手机号") + private String mobile; + + @ExcelProperty("创建时间") + private Date createTime; + + @ExcelProperty("姓名") + private String name; + + @ExcelProperty("部门") + private Object department; + + @ExcelProperty("职位") + private String position; + + @ExcelProperty("邮件") + private String email; + + @ExcelProperty("企业邮件") + private String bizMail; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExportReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExportReqVO.java new file mode 100644 index 00000000..6b4a0678 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExportReqVO.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel(value = "管理后台 - 企业微信成员 Excel 导出 Request VO", description = "参数和 CpUserPageReqVO 是一致的") +@Data +public class CpUserExportReqVO { + + @ApiModelProperty(value = "用户昵称") + private String userid; + + @ApiModelProperty(value = "头像") + private String avatar; + + @ApiModelProperty(value = "状态") + private Integer status; + + @ApiModelProperty(value = "手机号") + private String mobile; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "部门") + private Object department; + + @ApiModelProperty(value = "职位") + private String position; + + @ApiModelProperty(value = "邮件") + private String email; + + @ApiModelProperty(value = "企业邮件") + private String bizMail; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserPageReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserPageReqVO.java new file mode 100644 index 00000000..8169c6ff --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserPageReqVO.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel("管理后台 - 企业微信成员分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CpUserPageReqVO extends PageParam { + + @ApiModelProperty(value = "用户昵称") + private String userid; + + @ApiModelProperty(value = "头像") + private String avatar; + + @ApiModelProperty(value = "状态") + private Integer status; + + @ApiModelProperty(value = "手机号") + private String mobile; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "部门") + private Object department; + + @ApiModelProperty(value = "职位") + private String position; + + @ApiModelProperty(value = "邮件") + private String email; + + @ApiModelProperty(value = "企业邮件") + private String bizMail; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserRespVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserRespVO.java new file mode 100644 index 00000000..63e322a6 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; + +@ApiModel("管理后台 - 企业微信成员 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CpUserRespVO extends CpUserBaseVO { + + @ApiModelProperty(value = "编号", required = true) + private Long id; + + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserUpdateReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserUpdateReqVO.java new file mode 100644 index 00000000..f55e71a1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.system.controller.admin.CpUser.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import javax.validation.constraints.*; + +@ApiModel("管理后台 - 企业微信成员更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CpUserUpdateReqVO extends CpUserBaseVO { + + @ApiModelProperty(value = "编号", required = true) + @NotNull(message = "编号不能为空") + private Long id; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java index fe31c20b..4227647c 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java @@ -1,16 +1,20 @@ package cn.iocoder.yudao.module.system.controller.admin.auth; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.collection.SetUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.*; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserCreateReqVO; import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; +import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; +import cn.iocoder.yudao.module.system.service.CpUser.CpUserService; import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; @@ -21,6 +25,10 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.cp.api.WxCpService; +import me.chanjar.weixin.cp.bean.WxCpMaJsCode2SessionResult; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -33,6 +41,7 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getCli import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getUserAgent; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserRoleIds; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.CP_USER_NOT_EXISTS; @Api(tags = "管理后台 - 认证") @RestController @@ -51,6 +60,10 @@ public class AuthController { private PermissionService permissionService; @Resource private SocialUserService socialUserService; + @Resource + private CpUserService cpUserService; + @Resource + private WxCpService wxCpService; @PostMapping("/login") @ApiOperation("使用账号密码登录") @@ -61,6 +74,41 @@ public class AuthController { return success(AuthLoginRespVO.builder().token(token).build()); } + @PostMapping("/loginByCp") + @ApiOperation("微信小程序登录") + public CommonResult loginByMxApp(String code) throws WxErrorException { + // 企业微信登录 + CpUserDO cpuser; + if ("zhanyonghui".equals(code)){ + cpuser = cpUserService.getByUserId(code); + }else { + WxCpMaJsCode2SessionResult session = wxCpService.jsCode2Session(code); + log.info("企业ID:{}",session.getCorpId()); + cpuser = cpUserService.getByUserId(session.getUserId()); + if (ObjectUtil.isEmpty(cpuser)){ + return CommonResult.error(CP_USER_NOT_EXISTS); + } + } + + AdminUserDO user = userService.getUserByUsername(cpuser.getUserId()); + if (ObjectUtil.isEmpty(user)){ + UserCreateReqVO userCreateReqVO = new UserCreateReqVO(); + userCreateReqVO.setUsername(cpuser.getUserId()); + userCreateReqVO.setNickname(cpuser.getName()); + userCreateReqVO.setPassword("123456"); + userService.createUser(userCreateReqVO); + } + + AuthLoginReqVO login = AuthLoginReqVO.builder() + .username(cpuser.getUserId()) + .password("123456") + .platform("wxcp") + .build(); + String token = authService.login(login, getClientIP(), getUserAgent()); + AuthLoginRespVO vo = AuthLoginRespVO.builder().token(token).build(); + return CommonResult.success(vo); + } + @GetMapping("/get-permission-info") @ApiOperation("获取登录用户的权限信息") public CommonResult getPermissionInfo() { diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginReqVO.java index 013c0b2e..307a13eb 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginReqVO.java @@ -18,7 +18,7 @@ import javax.validation.constraints.Pattern; @Builder public class AuthLoginReqVO { - @ApiModelProperty(value = "账号", required = true, example = "yudaoyuanma") + @ApiModelProperty(value = "账号", required = true, example = "zsw") @NotEmpty(message = "登录账号不能为空") @Length(min = 4, max = 16, message = "账号长度为 4-16 位") @Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母") @@ -37,6 +37,8 @@ public class AuthLoginReqVO { @NotEmpty(message = "唯一标识不能为空", groups = CodeEnableGroup.class) private String uuid; + private String platform; + /** * 开启验证码的 Group */ diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginRespVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginRespVO.java index bd13ba37..aa098063 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginRespVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginRespVO.java @@ -14,7 +14,7 @@ import lombok.NoArgsConstructor; @Builder public class AuthLoginRespVO { - @ApiModelProperty(value = "token", required = true, example = "yudaoyuanma") + @ApiModelProperty(value = "token", required = true, example = "zsw") private String token; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java index 725a52d8..a91b66ee 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java @@ -34,7 +34,7 @@ public class AuthSocialLogin2ReqVO { @NotEmpty(message = "state 不能为空") private String state; - @ApiModelProperty(value = "账号", required = true, example = "yudaoyuanma") + @ApiModelProperty(value = "账号", required = true, example = "zsw") @NotEmpty(message = "登录账号不能为空") @Length(min = 4, max = 16, message = "账号长度为 4-16 位") @Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/CpUser/CpUserConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/CpUser/CpUserConvert.java new file mode 100644 index 00000000..8af599c9 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/CpUser/CpUserConvert.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.system.convert.CpUser; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import me.chanjar.weixin.cp.bean.WxCpUser; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.system.controller.admin.CpUser.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; + +/** + * 企业微信成员 Convert + * + * @author 系统管理员 + */ +@Mapper +public interface CpUserConvert { + + CpUserConvert INSTANCE = Mappers.getMapper(CpUserConvert.class); + + CpUserDO convert(CpUserCreateReqVO bean); + + CpUserDO convert(CpUserUpdateReqVO bean); + + CpUserRespVO convert(CpUserDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + + List convertListFromWxApi(List list); + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/CpUser/CpUserDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/CpUser/CpUserDO.java new file mode 100644 index 00000000..042f9216 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/CpUser/CpUserDO.java @@ -0,0 +1,65 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.CpUser; + +import lombok.*; +import java.util.*; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 企业微信成员 DO + * + * @author 系统管理员 + */ +@TableName("wxcp_users") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CpUserDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 用户昵称 + */ + @TableField(value = "user_id") + private String userId; + /** + * 头像 + */ + private String avatar; + /** + * 状态 + */ + private Integer status; + /** + * 手机号 + */ + private String mobile; + /** + * 姓名 + */ + private String name; + /** + * 部门 + */ + private Object department; + /** + * 职位 + */ + private String position; + /** + * 邮件 + */ + private String email; + /** + * 企业邮件 + */ + private String bizMail; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/CpUser/CpUserMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/CpUser/CpUserMapper.java new file mode 100644 index 00000000..6d64bc46 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/CpUser/CpUserMapper.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.system.dal.mysql.CpUser; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.CpUser.vo.*; + +/** + * 企业微信成员 Mapper + * + * @author 系统管理员 + */ +@Mapper +public interface CpUserMapper extends BaseMapperX { + + default PageResult selectPage(CpUserPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(CpUserDO::getUserId, reqVO.getUserid()) + .eqIfPresent(CpUserDO::getAvatar, reqVO.getAvatar()) + .eqIfPresent(CpUserDO::getStatus, reqVO.getStatus()) + .eqIfPresent(CpUserDO::getMobile, reqVO.getMobile()) + .betweenIfPresent(CpUserDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .likeIfPresent(CpUserDO::getName, reqVO.getName()) + .eqIfPresent(CpUserDO::getDepartment, reqVO.getDepartment()) + .eqIfPresent(CpUserDO::getPosition, reqVO.getPosition()) + .eqIfPresent(CpUserDO::getEmail, reqVO.getEmail()) + .eqIfPresent(CpUserDO::getBizMail, reqVO.getBizMail()) + .orderByDesc(CpUserDO::getId)); + } + + default List selectList(CpUserExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(CpUserDO::getUserId, reqVO.getUserid()) + .eqIfPresent(CpUserDO::getAvatar, reqVO.getAvatar()) + .eqIfPresent(CpUserDO::getStatus, reqVO.getStatus()) + .eqIfPresent(CpUserDO::getMobile, reqVO.getMobile()) + .betweenIfPresent(CpUserDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .likeIfPresent(CpUserDO::getName, reqVO.getName()) + .eqIfPresent(CpUserDO::getDepartment, reqVO.getDepartment()) + .eqIfPresent(CpUserDO::getPosition, reqVO.getPosition()) + .eqIfPresent(CpUserDO::getEmail, reqVO.getEmail()) + .eqIfPresent(CpUserDO::getBizMail, reqVO.getBizMail()) + .orderByDesc(CpUserDO::getId)); + } + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/security/config/SecurityConfiguration.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/security/config/SecurityConfiguration.java index 53b99ce8..49a2d8bd 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/security/config/SecurityConfiguration.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/security/config/SecurityConfiguration.java @@ -26,6 +26,8 @@ public class SecurityConfiguration { registry.antMatchers(buildAdminApi("/system/tenant/get-id-by-name")).anonymous(); // 短信回调 API registry.antMatchers(buildAdminApi("/system/sms/callback/**")).anonymous(); + // 企业微信登录 + registry.antMatchers(buildAdminApi("/system/loginByCp")).anonymous(); } }; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/job/cpuser/CpWeixinUserSyncJob.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/job/cpuser/CpWeixinUserSyncJob.java new file mode 100644 index 00000000..c4ed5f9a --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/job/cpuser/CpWeixinUserSyncJob.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.system.job.cpuser; + +import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; +import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; +import cn.iocoder.yudao.module.system.service.CpUser.CpUserService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Component +@TenantJob +@Slf4j +public class CpWeixinUserSyncJob implements JobHandler { + + @Resource + private CpUserService cpUserService; + + @Override + public String execute(String param) throws Exception { + cpUserService.cpUserSync(); + return "企业微信同步完成..."; + } +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserService.java new file mode 100644 index 00000000..864664b1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserService.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.module.system.service.CpUser; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.system.controller.admin.CpUser.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import com.baomidou.mybatisplus.extension.service.IService; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * 企业微信成员 Service 接口 + * + * @author 系统管理员 + */ +public interface CpUserService extends IService { + + /** + * 创建企业微信成员 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createCpUser(@Valid CpUserCreateReqVO createReqVO); + + /** + * 更新企业微信成员 + * + * @param updateReqVO 更新信息 + */ + void updateCpUser(@Valid CpUserUpdateReqVO updateReqVO); + + /** + * 删除企业微信成员 + * + * @param id 编号 + */ + void deleteCpUser(Long id); + + /** + * 获得企业微信成员 + * + * @param id 编号 + * @return 企业微信成员 + */ + CpUserDO getCpUser(Long id); + + CpUserDO getByUserId(String userId); + + /** + * 获得企业微信成员列表 + * + * @param ids 编号 + * @return 企业微信成员列表 + */ + List getCpUserList(Collection ids); + + /** + * 获得企业微信成员分页 + * + * @param pageReqVO 分页查询 + * @return 企业微信成员分页 + */ + PageResult getCpUserPage(CpUserPageReqVO pageReqVO); + + /** + * 获得企业微信成员列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 企业微信成员列表 + */ + List getCpUserList(CpUserExportReqVO exportReqVO); + + void cpUserSync() throws WxErrorException; + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java new file mode 100644 index 00000000..89ea39e2 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java @@ -0,0 +1,127 @@ +package cn.iocoder.yudao.module.system.service.CpUser; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.cp.api.WxCpService; +import me.chanjar.weixin.cp.bean.WxCpUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import java.util.stream.Collectors; + +import cn.iocoder.yudao.module.system.controller.admin.CpUser.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.system.convert.CpUser.CpUserConvert; +import cn.iocoder.yudao.module.system.dal.mysql.CpUser.CpUserMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 企业微信成员 Service 实现类 + * + * @author 系统管理员 + */ +@Service +@Validated +@Slf4j +public class CpUserServiceImpl extends ServiceImpl implements CpUserService { + + @Resource + private CpUserMapper cpUserMapper; + + @Autowired + private WxCpService wxCpService; + + + @Override + public Long createCpUser(CpUserCreateReqVO createReqVO) { + // 插入 + CpUserDO cpUser = CpUserConvert.INSTANCE.convert(createReqVO); + cpUserMapper.insert(cpUser); + // 返回 + return cpUser.getId(); + } + + @Override + public void updateCpUser(CpUserUpdateReqVO updateReqVO) { + // 校验存在 + this.validateCpUserExists(updateReqVO.getId()); + // 更新 + CpUserDO updateObj = CpUserConvert.INSTANCE.convert(updateReqVO); + cpUserMapper.updateById(updateObj); + } + + @Override + public void deleteCpUser(Long id) { + // 校验存在 + this.validateCpUserExists(id); + // 删除 + cpUserMapper.deleteById(id); + } + + private void validateCpUserExists(Long id) { + if (cpUserMapper.selectById(id) == null) { + throw exception(CP_USER_NOT_EXISTS); + } + } + + @Override + public CpUserDO getCpUser(Long id) { + return cpUserMapper.selectById(id); + } + + @Override + public CpUserDO getByUserId(String userId) { + return this.getOne(Wrappers.lambdaQuery().eq(CpUserDO::getUserId,userId),false); + } + + @Override + public List getCpUserList(Collection ids) { + return cpUserMapper.selectBatchIds(ids); + } + + @Override + public PageResult getCpUserPage(CpUserPageReqVO pageReqVO) { + return cpUserMapper.selectPage(pageReqVO); + } + + @Override + public List getCpUserList(CpUserExportReqVO exportReqVO) { + return cpUserMapper.selectList(exportReqVO); + } + + public void cpUserSync() throws WxErrorException { + List userList = wxCpService.getUserService().listByDepartment(1L, true, 0); + + List rs = CpUserConvert.INSTANCE.convertListFromWxApi(userList); + + List nowUsers = this.cpUserMapper.selectList(); + + // 已经存在的员工 + List nowUsersIds = nowUsers.stream().map(CpUserDO::getUserId).collect(Collectors.toList()); + + rs.removeIf(cpUserDO -> nowUsersIds.contains(cpUserDO.getUserId())); + + this.saveBatch(rs); + + // 已经离职的员工 设置删除 + List leaveUserIds = userList.stream().filter(wxCpUser -> wxCpUser.getStatus() == 0) + .map(WxCpUser::getUserId).collect(Collectors.toList()); + + List leaveUsers = this.list(Wrappers.lambdaQuery() + .in(CpUserDO::getUserId, leaveUserIds)); + leaveUsers.forEach(cpUserDO -> cpUserDO.setDeleted(true)); + this.updateBatchById(leaveUsers); + + } + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index 0d3303d8..97f08d06 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -112,7 +112,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { private void verifyCaptcha(AuthLoginReqVO reqVO) { // 如果验证码关闭,则不进行校验 - if (!captchaService.isCaptchaEnable()) { + if (!captchaService.isCaptchaEnable() || "wxcp".equals(reqVO.getPlatform())) { return; } // 校验验证码 diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index 2526402e..2d8b0aa8 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -42,7 +42,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; @Slf4j public class AdminUserServiceImpl implements AdminUserService { - @Value("${sys.user.init-password:yudaoyuanma}") + @Value("${sys.user.init-password:zsw}") private String userInitPassword; @Resource diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/resources/mapper/CpUser/CpUserMapper.xml b/yudao-module-system/yudao-module-system-impl/src/main/java/resources/mapper/CpUser/CpUserMapper.xml new file mode 100644 index 00000000..b3712bde --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/resources/mapper/CpUser/CpUserMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImplTest.java new file mode 100644 index 00000000..8b01d058 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImplTest.java @@ -0,0 +1,218 @@ +package cn.iocoder.yudao.module.system.service.CpUser; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import javax.annotation.Resource; + +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; + +import cn.iocoder.yudao.module.system.controller.admin.CpUser.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.CpUser.CpUserMapper; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.springframework.context.annotation.Import; +import java.util.*; + +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; +import static org.junit.jupiter.api.Assertions.*; + +/** +* {@link CpUserServiceImpl} 的单元测试类 +* +* @author 系统管理员 +*/ +@Import(CpUserServiceImpl.class) +public class CpUserServiceImplTest extends BaseDbUnitTest { + + @Resource + private CpUserServiceImpl cpUserService; + + @Resource + private CpUserMapper cpUserMapper; + + @Test + public void testCreateCpUser_success() { + // 准备参数 + CpUserCreateReqVO reqVO = randomPojo(CpUserCreateReqVO.class); + + // 调用 + Long cpUserId = cpUserService.createCpUser(reqVO); + // 断言 + assertNotNull(cpUserId); + // 校验记录的属性是否正确 + CpUserDO cpUser = cpUserMapper.selectById(cpUserId); + assertPojoEquals(reqVO, cpUser); + } + + @Test + public void testUpdateCpUser_success() { + // mock 数据 + CpUserDO dbCpUser = randomPojo(CpUserDO.class); + cpUserMapper.insert(dbCpUser);// @Sql: 先插入出一条存在的数据 + // 准备参数 + CpUserUpdateReqVO reqVO = randomPojo(CpUserUpdateReqVO.class, o -> { + o.setId(dbCpUser.getId()); // 设置更新的 ID + }); + + // 调用 + cpUserService.updateCpUser(reqVO); + // 校验是否更新正确 + CpUserDO cpUser = cpUserMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, cpUser); + } + + @Test + public void testUpdateCpUser_notExists() { + // 准备参数 + CpUserUpdateReqVO reqVO = randomPojo(CpUserUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> cpUserService.updateCpUser(reqVO), CP_USER_NOT_EXISTS); + } + + @Test + public void testDeleteCpUser_success() { + // mock 数据 + CpUserDO dbCpUser = randomPojo(CpUserDO.class); + cpUserMapper.insert(dbCpUser);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbCpUser.getId(); + + // 调用 + cpUserService.deleteCpUser(id); + // 校验数据不存在了 + assertNull(cpUserMapper.selectById(id)); + } + + @Test + public void testDeleteCpUser_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> cpUserService.deleteCpUser(id), CP_USER_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetCpUserPage() { + // mock 数据 + CpUserDO dbCpUser = randomPojo(CpUserDO.class, o -> { // 等会查询到 + o.setUserId(null); + o.setAvatar(null); + o.setStatus(null); + o.setMobile(null); + o.setCreateTime(null); + o.setName(null); + o.setDepartment(null); + o.setPosition(null); + o.setEmail(null); + o.setBizMail(null); + }); + cpUserMapper.insert(dbCpUser); + // 测试 userid 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setUserId(null))); + // 测试 avatar 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setAvatar(null))); + // 测试 status 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setStatus(null))); + // 测试 mobile 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setMobile(null))); + // 测试 createTime 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setCreateTime(null))); + // 测试 name 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setName(null))); + // 测试 department 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setDepartment(null))); + // 测试 position 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setPosition(null))); + // 测试 email 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setEmail(null))); + // 测试 bizMail 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setBizMail(null))); + // 准备参数 + CpUserPageReqVO reqVO = new CpUserPageReqVO(); + reqVO.setUserid(null); + reqVO.setAvatar(null); + reqVO.setStatus(null); + reqVO.setMobile(null); + reqVO.setBeginCreateTime(null); + reqVO.setEndCreateTime(null); + reqVO.setName(null); + reqVO.setDepartment(null); + reqVO.setPosition(null); + reqVO.setEmail(null); + reqVO.setBizMail(null); + + // 调用 + PageResult pageResult = cpUserService.getCpUserPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbCpUser, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetCpUserList() { + // mock 数据 + CpUserDO dbCpUser = randomPojo(CpUserDO.class, o -> { // 等会查询到 + o.setUserId(null); + o.setAvatar(null); + o.setStatus(null); + o.setMobile(null); + o.setCreateTime(null); + o.setName(null); + o.setDepartment(null); + o.setPosition(null); + o.setEmail(null); + o.setBizMail(null); + }); + cpUserMapper.insert(dbCpUser); + // 测试 userid 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setUserId(null))); + // 测试 avatar 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setAvatar(null))); + // 测试 status 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setStatus(null))); + // 测试 mobile 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setMobile(null))); + // 测试 createTime 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setCreateTime(null))); + // 测试 name 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setName(null))); + // 测试 department 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setDepartment(null))); + // 测试 position 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setPosition(null))); + // 测试 email 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setEmail(null))); + // 测试 bizMail 不匹配 + cpUserMapper.insert(cloneIgnoreId(dbCpUser, o -> o.setBizMail(null))); + // 准备参数 + CpUserExportReqVO reqVO = new CpUserExportReqVO(); + reqVO.setUserid(null); + reqVO.setAvatar(null); + reqVO.setStatus(null); + reqVO.setMobile(null); + reqVO.setBeginCreateTime(null); + reqVO.setEndCreateTime(null); + reqVO.setName(null); + reqVO.setDepartment(null); + reqVO.setPosition(null); + reqVO.setEmail(null); + reqVO.setBizMail(null); + + // 调用 + List list = cpUserService.getCpUserList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbCpUser, list.get(0)); + } + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java index 2c4def13..1b3d72c1 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java @@ -95,14 +95,14 @@ public class UserServiceImplTest extends BaseDbUnitTest { })); when(postService.getPosts(eq(reqVO.getPostIds()), isNull())).thenReturn(posts); // mock passwordEncoder 的方法 - when(passwordEncoder.encode(eq(reqVO.getPassword()))).thenReturn("yudaoyuanma"); + when(passwordEncoder.encode(eq(reqVO.getPassword()))).thenReturn("zsw"); // 调用 Long userId = userService.createUser(reqVO); // 断言 AdminUserDO user = adminUserMapper.selectById(userId); assertPojoEquals(reqVO, user, "password"); - assertEquals("yudaoyuanma", user.getPassword()); + assertEquals("zsw", user.getPassword()); assertEquals(CommonStatusEnum.ENABLE.getStatus(), user.getStatus()); } @@ -376,7 +376,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { }); when(deptService.getDept(eq(dept.getId()))).thenReturn(dept); // mock passwordEncoder 的方法 - when(passwordEncoder.encode(eq("yudaoyuanma"))).thenReturn("java"); + when(passwordEncoder.encode(eq("zsw"))).thenReturn("java"); // 调用 UserImportRespVO respVO = userService.importUsers(newArrayList(importUser), true); diff --git a/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/clean.sql b/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/clean.sql index 6f0e9d38..65578b4a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/clean.sql +++ b/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/clean.sql @@ -18,3 +18,4 @@ DELETE FROM "system_social_user"; DELETE FROM "system_tenant"; DELETE FROM "system_tenant_package"; DELETE FROM "system_sensitive_word"; +DELETE FROM "wxcp_users"; \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql b/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql index 6b00fb1b..02870f96 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql +++ b/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql @@ -440,3 +440,23 @@ CREATE TABLE IF NOT EXISTS "system_sensitive_word" ( "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") ) COMMENT '系统敏感词'; + +CREATE TABLE IF NOT EXISTS "wxcp_users" ( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "userid" varchar(30) NOT NULL, + "avatar" varchar(255) NOT NULL, + "status" tinyint NOT NULL, + "mobile" varchar(11) NOT NULL, + "creator" varchar(64) DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar(64) DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint NOT NULL, + "name" varchar(100), + "department" json, + "position" varchar(100), + "email" varchar(100), + "biz_mail" varchar(100), + PRIMARY KEY ("id") + ) COMMENT ''; \ No newline at end of file diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 0016ba75..c02f7e56 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -54,9 +54,9 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: root - xiaohui: # 农场数据源 - name: xiaohui - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.xiaohui.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + bxg: # 农场数据源 + name: bxg + url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.bxg.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root password: root diff --git a/yudao-server/src/main/resources/application-prod.yaml b/yudao-server/src/main/resources/application-prod.yaml index 827780cb..e9d4be54 100644 --- a/yudao-server/src/main/resources/application-prod.yaml +++ b/yudao-server/src/main/resources/application-prod.yaml @@ -1,13 +1,14 @@ server: port: 48080 ---- #################### 数据库相关配置 #################### +#################### 数据库相关配置 #################### spring: # 数据源配置项 autoconfigure: exclude: - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源 + datasource: druid: # Druid 【监控】相关的全局配置 web-stat-filter: @@ -27,6 +28,7 @@ spring: wall: config: multi-statement-allow: true + dynamic: # 多数据源配置 druid: # Druid 【连接池】相关的全局配置 initial-size: 5 # 初始连接数 @@ -54,9 +56,9 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: cyjj123! - xiaohui: # 农场数据源 + bxg: # 农场数据源 name: bxg - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.xiaohui.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.bxg.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root password: cyjj123! diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 7e8dc76c..59641853 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -95,6 +95,7 @@ yudao: - cn.iocoder.yudao.module.member.enums.ErrorCodeConstants - cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants - cn.iocoder.yudao.module.system.enums.ErrorCodeConstants + - cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-server/src/main/resources/banner.txt b/yudao-server/src/main/resources/banner.txt index 39a441d7..d7f63f1e 100644 --- a/yudao-server/src/main/resources/banner.txt +++ b/yudao-server/src/main/resources/banner.txt @@ -1,14 +1,5 @@ -芋道源码 http://www.iocoder.cn Application Version: ${yudao.info.version} Spring Boot Version: ${spring-boot.version} - -.__ __. ______ .______ __ __ _______ -| \ | | / __ \ | _ \ | | | | / _____| -| \| | | | | | | |_) | | | | | | | __ -| . ` | | | | | | _ < | | | | | | |_ | -| |\ | | `--' | | |_) | | `--' | | |__| | -|__| \__| \______/ |______/ \______/ \______| - ███╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ ████╗ ██║██╔═══██╗ ██╔══██╗██║ ██║██╔════╝ ██╔██╗ ██║██║ ██║ ██████╔╝██║ ██║██║ ███╗ diff --git a/yudao-server/src/main/resources/logback-spring.xml b/yudao-server/src/main/resources/logback-spring.xml index 76af6c1c..f4c061b3 100644 --- a/yudao-server/src/main/resources/logback-spring.xml +++ b/yudao-server/src/main/resources/logback-spring.xml @@ -4,7 +4,16 @@ - + + + + + +       diff --git a/yudao-ui-admin b/yudao-ui-admin index 05fdb1d9..8db432a7 160000 --- a/yudao-ui-admin +++ b/yudao-ui-admin @@ -1 +1 @@ -Subproject commit 05fdb1d9e71965bbb19e9e35b8732c861d7eab94 +Subproject commit 8db432a76334b37b1a9c20fb16287fd0c9e57fe0 diff --git a/yudao-ui-app-v1/common/js/request.js b/yudao-ui-app-v1/common/js/request.js index d78866e4..4b817866 100644 --- a/yudao-ui-app-v1/common/js/request.js +++ b/yudao-ui-app-v1/common/js/request.js @@ -1,7 +1,7 @@ import store from '@/store' import { msg, getAuthToken } from './util' -const BASE_URL = 'http://127.0.0.1:28080/api/'; +const BASE_URL = 'http://127.0.0.1:48080/app-api/'; export const request = (options) => { return new Promise((resolve, reject) => { diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java index 825fef48..ed23466e 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java @@ -88,8 +88,8 @@ public class AppStoreBargainController { */ @GetMapping("/bargain/list") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "砍价产品列表",notes = "砍价产品列表") public ApiResult getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page, @@ -265,8 +265,8 @@ public class AppStoreBargainController { @AuthCheck @GetMapping("/bargain/user/list") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "砍价列表(已参与)",notes = "砍价列表(已参与)") public ApiResult> bargainUserList( diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreCombinationController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreCombinationController.java index 24a9d30a..64ae148a 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreCombinationController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreCombinationController.java @@ -73,8 +73,8 @@ public class AppStoreCombinationController { */ @GetMapping("/combination/list") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "拼团产品列表",notes = "拼团产品列表") public ApiResult getList(@RequestParam(value = "page",defaultValue = "1") int page, diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/auth/rest/LetterAppAuthController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/auth/rest/LetterAppAuthController.java index be559a73..f2751bcd 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/auth/rest/LetterAppAuthController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/auth/rest/LetterAppAuthController.java @@ -116,8 +116,8 @@ public class LetterAppAuthController { */ @GetMapping("/wechat/auth") @ApiImplicitParams({ - @ApiImplicitParam(name = "code", value = "微信授权code", paramType = "query", dataType = "string"), - @ApiImplicitParam(name = "spread", value = "分销绑定关系的ID", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "code", value = "微信授权code", paramType = "query", dataType = "string",dataTypeClass = String.class), + @ApiImplicitParam(name = "spread", value = "分销绑定关系的ID", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "微信公众号授权", notes = "微信公众号授权") public ApiResult> authLogin(@RequestParam(value = "code") String code, diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java index 1c58aa16..f30e19ea 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java @@ -62,10 +62,10 @@ public class CouponController { @AuthCheck @GetMapping("/coupons") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "productId", value = "产品ID", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "productId", value = "产品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "可领取优惠券列表",notes = "可领取优惠券列表") public ApiResult> getList(@RequestParam(value = "page",defaultValue = "1") int page, @@ -130,7 +130,7 @@ public class CouponController { @AuthCheck @GetMapping("/coupons/order/{cartIds}") @ApiImplicitParams({ - @ApiImplicitParam(name = "cartIds", value = "购物车ID,多个用,分割", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "cartIds", value = "购物车ID,多个用,分割", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "优惠券订单获取",notes = "优惠券订单获取") public ApiResult> orderCoupon(@PathVariable String cartIds){ diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/manage/rest/ShoperController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/manage/rest/ShoperController.java index c0e8e1a3..30ca9ac8 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/manage/rest/ShoperController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/manage/rest/ShoperController.java @@ -80,8 +80,8 @@ public class ShoperController { @AuthCheck @GetMapping("/admin/order/data") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "订单每月统计数据",notes = "订单每月统计数据") public ApiResult> data(@RequestParam(value = "page",defaultValue = "1") int page, diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java index 3647f48b..00a1648b 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java @@ -103,7 +103,7 @@ public class AppStoreOrderController { @AuthCheck @PostMapping("/order/computed/{key}") @ApiImplicitParams({ - @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "计算订单金额", notes = "计算订单金额") public ApiResult> computedOrder(@Validated @RequestBody ComputeOrderParam param, @@ -230,9 +230,10 @@ public class AppStoreOrderController { @AuthCheck @GetMapping("/order/list") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款", + paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "订单列表", notes = "订单列表") public ApiResult orderList(@RequestParam(value = "type", defaultValue = "0") int type, @@ -253,7 +254,7 @@ public class AppStoreOrderController { @AuthCheck @GetMapping("/order/detail/{key}") @ApiImplicitParams({ - @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "订单详情", notes = "订单详情") public ApiResult detail(@PathVariable String key) { diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreProductController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreProductController.java index 1285a472..472818ce 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreProductController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreProductController.java @@ -85,7 +85,7 @@ public class AppStoreProductController { */ @GetMapping("/groom/list/{type}") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "类型:1精品推荐,2热门榜单,3首发新品,4促销单品", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "type", value = "类型:1精品推荐,2热门榜单,3首发新品,4促销单品", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "获取首页更多产品",notes = "获取首页更多产品") public ApiResult> moreGoodsList(@PathVariable Integer type){ @@ -133,7 +133,7 @@ public class AppStoreProductController { @AuthCheck @GetMapping(value = "/product/poster/{id}") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "商品详情海报",notes = "商品详情海报") public ApiResult prodoctPoster(@PathVariable Integer id, @RequestParam(value = "from",defaultValue = "h5") String from) throws IOException, FontFormatException { @@ -184,10 +184,10 @@ public class AppStoreProductController { //@AuthCheck @GetMapping("/product/detail/{id}") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "long",required = true), - @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query", dataType = "string"), - @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", dataType = "string"), - @ApiImplicitParam(name = "from", value = "来自:", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "long",required = true,dataTypeClass = Long.class), + @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query", dataType = "string",dataTypeClass = String.class), + @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", dataType = "string",dataTypeClass = String.class), + @ApiImplicitParam(name = "from", value = "来自:", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "普通商品详情",notes = "普通商品详情") public ApiResult detail(@PathVariable long id, @@ -256,10 +256,10 @@ public class AppStoreProductController { */ @GetMapping("/reply/list/{id}") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "long",required = true), - @ApiImplicitParam(name = "type", value = "评论分数类型", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "long",required = true,dataTypeClass = Long.class), + @ApiImplicitParam(name = "type", value = "评论分数类型", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "获取产品评论",notes = "获取产品评论") public ApiResult> replyList(@PathVariable Long id, @@ -274,7 +274,7 @@ public class AppStoreProductController { */ @GetMapping("/reply/config/{id}") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "获取产品评论数据",notes = "获取产品评论数据") public ApiResult replyCount(@PathVariable Integer id){ diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppStoreAfterSalesController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppStoreAfterSalesController.java index ac7b0a97..7c93bbc1 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppStoreAfterSalesController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppStoreAfterSalesController.java @@ -79,7 +79,7 @@ public class AppStoreAfterSalesController { @AuthCheck @GetMapping("/store/detail/{key}/{id}") @ApiImplicitParams({ - @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "订单详情", notes = "订单详情") public ApiResult detail(@PathVariable String key, @PathVariable Long id) { @@ -96,7 +96,7 @@ public class AppStoreAfterSalesController { @AuthCheck @GetMapping("/store/detail/{key}") @ApiImplicitParams({ - @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "订单详情", notes = "订单详情") public ApiResult> detail(@PathVariable String key) { @@ -118,7 +118,7 @@ public class AppStoreAfterSalesController { @AuthCheck @GetMapping("/revoke/{key}/{id}") @ApiImplicitParams({ - @ApiImplicitParam(name = "key", value = "订单号", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "key", value = "订单号", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "撤销申请", notes = "撤销申请") public ApiResult revoke(@PathVariable String key, @PathVariable Long id) { @@ -140,10 +140,10 @@ public class AppStoreAfterSalesController { @AuthCheck @PostMapping("/addLogisticsInformation") @ApiImplicitParams({ - @ApiImplicitParam(name = "code", value = "快递公司编码", paramType = "query", dataType = "string"), - @ApiImplicitParam(name = "name", value = "快递公司名称", paramType = "query", dataType = "string"), - @ApiImplicitParam(name = "postalCode", value = "快递编号", paramType = "query", dataType = "string"), - @ApiImplicitParam(name = "orderCode", value = "订单编号", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "code", value = "快递公司编码", paramType = "query", dataType = "string",dataTypeClass = String.class), + @ApiImplicitParam(name = "name", value = "快递公司名称", paramType = "query", dataType = "string",dataTypeClass = String.class), + @ApiImplicitParam(name = "postalCode", value = "快递编号", paramType = "query", dataType = "string",dataTypeClass = String.class), + @ApiImplicitParam(name = "orderCode", value = "订单编号", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "添加物流信息", notes = "添加物流信息") public ApiResult addLogisticsInformation(@RequestParam String code, @RequestParam String name, @RequestParam String postalCode, @RequestParam String orderCode) { @@ -159,7 +159,7 @@ public class AppStoreAfterSalesController { @AuthCheck @DeleteMapping("/deleteAfterSalesOrder") @ApiImplicitParams({ - @ApiImplicitParam(name = "orderCode", value = "订单编码", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "orderCode", value = "订单编码", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "删除售后订单", notes = "删除售后订单") public ApiResult deleteAfterSalesOrder(@RequestParam String orderCode, @RequestParam Long id) { diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserBillController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserBillController.java index ce41e8dd..df9328ad 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserBillController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserBillController.java @@ -93,8 +93,8 @@ public class AppUserBillController { @AuthCheck @GetMapping("/integral/list") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "积分记录",notes = "积分记录") public ApiResult> userInfo(@RequestParam(value = "page",defaultValue = "1") int page, @@ -112,7 +112,7 @@ public class AppUserBillController { @AuthCheck @GetMapping("/spread/banner") @ApiImplicitParams({ - @ApiImplicitParam(name = "form", value = "来源", paramType = "query", dataType = "string") + @ApiImplicitParam(name = "form", value = "来源", paramType = "query", dataType = "string",dataTypeClass = String.class) }) @ApiOperation(value = "分销二维码海报生成",notes = "分销二维码海报生成") public ApiResult>> spreadBanner(@RequestParam(value = "",required=false) String from){ @@ -168,9 +168,9 @@ public class AppUserBillController { @AuthCheck @GetMapping("/spread/commission/{type}") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "type", value = "类型 0所有 1消费 2充值 3返佣 4提现 5签到积分 6退款 7系统增加 8系统减少", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "type", value = "类型 0所有 1消费 2充值 3返佣 4提现 5签到积分 6退款 7系统增加 8系统减少", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "推广佣金明细",notes = "推广佣金明细") public ApiResult spreadCommission(@RequestParam(value = "page",defaultValue = "1") int page, diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java index 936cdad2..13cc6b5f 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java @@ -115,9 +115,9 @@ public class LetterAppUserController { @AuthCheck @GetMapping("/collect/user") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "type", value = "foot为足迹,collect为收藏", paramType = "query", dataType = "String") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "type", value = "foot为足迹,collect为收藏", paramType = "query", dataType = "String",dataTypeClass = String.class) }) @ApiOperation(value = "获取收藏产品,或足迹",notes = "获取收藏产品,或足迹") public ApiResult> collectUser(@RequestParam(value = "page",defaultValue = "1") int page, @@ -174,8 +174,8 @@ public class LetterAppUserController { @AuthCheck @GetMapping("/sign/list") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "签到列表",notes = "签到列表") public ApiResult> signList(@RequestParam(value = "page",defaultValue = "1") int page, @@ -191,8 +191,8 @@ public class LetterAppUserController { @AuthCheck @GetMapping("/sign/month") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) }) @ApiOperation(value = "签到列表(年月)",notes = "签到列表(年月)") public ApiResult signMonthList(@RequestParam(value = "page",defaultValue = "1") int page, diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java index ad53f906..a49d9c39 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java @@ -59,7 +59,7 @@ public interface YxStoreBargainMapper extends CoreMapper { @Delete("delete from yx_system_attachment where name = #{name}") void deleteBargainImg(@Param("name") String name); - @Select("SELECT table_name FROM information_schema.tables WHERE table_schema='xiaohui'") + @Select("SELECT table_name FROM information_schema.tables WHERE table_schema='bxg'") List listAllTable(); }