Browse Source

企业微信成员新增

zyh
Loki 3 years ago
parent
commit
e9d29ef2df
  1. 4
      yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java
  2. 15
      yudao-framework/yudao-spring-boot-starter-biz-weixin/pom.xml
  3. 33
      yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/config/WxCpConfigure.java
  4. 2
      yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/resources/META-INF/spring.factories
  5. 2
      yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java
  6. 2
      yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java
  7. 2
      yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java
  8. 2
      yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthLoginRespVO.java
  9. 2
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  10. 5
      yudao-module-system/yudao-module-system-impl/pom.xml
  11. 100
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/CpUserController.java
  12. 46
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserBaseVO.java
  13. 14
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserCreateReqVO.java
  14. 50
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExcelVO.java
  15. 50
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserExportReqVO.java
  16. 52
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserPageReqVO.java
  17. 19
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserRespVO.java
  18. 18
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/CpUser/vo/CpUserUpdateReqVO.java
  19. 48
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
  20. 4
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginReqVO.java
  21. 2
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthLoginRespVO.java
  22. 2
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java
  23. 37
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/CpUser/CpUserConvert.java
  24. 65
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/CpUser/CpUserDO.java
  25. 50
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/CpUser/CpUserMapper.java
  26. 2
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/security/config/SecurityConfiguration.java
  27. 24
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/job/cpuser/CpWeixinUserSyncJob.java
  28. 76
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserService.java
  29. 127
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java
  30. 2
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
  31. 2
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
  32. 12
      yudao-module-system/yudao-module-system-impl/src/main/java/resources/mapper/CpUser/CpUserMapper.xml
  33. 218
      yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImplTest.java
  34. 6
      yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java
  35. 1
      yudao-module-system/yudao-module-system-impl/src/test/resources/sql/clean.sql
  36. 20
      yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql
  37. 6
      yudao-server/src/main/resources/application-local.yaml
  38. 8
      yudao-server/src/main/resources/application-prod.yaml
  39. 1
      yudao-server/src/main/resources/application.yaml
  40. 9
      yudao-server/src/main/resources/banner.txt
  41. 11
      yudao-server/src/main/resources/logback-spring.xml
  42. 2
      yudao-ui-admin
  43. 2
      yudao-ui-app-v1/common/js/request.js
  44. 8
      zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java
  45. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreCombinationController.java
  46. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/auth/rest/LetterAppAuthController.java
  47. 10
      zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java
  48. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/manage/rest/ShoperController.java
  49. 11
      zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
  50. 22
      zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreProductController.java
  51. 16
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppStoreAfterSalesController.java
  52. 12
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserBillController.java
  53. 14
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java
  54. 2
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java

4
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<Config extends PayClientConfig> implemen
*/
public final void init() {
doInit();
log.info("[init][配置({}) 初始化完成]", config);
// PayClientConfig
// log.info("[init][配置({}) 初始化完成]", config);
log.info("[init][配置({}) 初始化完成]", PayClientConfig.class);
}
/**

15
yudao-framework/yudao-spring-boot-starter-biz-weixin/pom.xml

@ -12,7 +12,8 @@
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>微信拓展
<description>
微信拓展
1. 基于 weixin-java-mp 库,对接微信公众号平台。目前主要解决微信公众号的支付场景。
</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
@ -45,6 +46,18 @@
<version>4.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.binarywang/weixin-java-cp -->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-cp</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-extension</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>

33
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;
}
}

2
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

2
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");

2
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<String, DataSource> map = dynamicDataSourceProvider.loadDataSources();
factory.setDataSource(map.get("xiaohui"));
factory.setDataSource(map.get("bxg"));
return getSqlSessionFactory(factory);
}

2
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";
}

2
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;
}

2
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,"微信企业成员不存在");
}

5
yudao-module-system/yudao-module-system-impl/pom.xml

@ -97,6 +97,11 @@
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
</dependency>
</dependencies>
</project>

100
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<Long> createCpUser(@Valid @RequestBody CpUserCreateReqVO createReqVO) {
return success(cpUserService.createCpUser(createReqVO));
}
@PutMapping("/update")
@ApiOperation("更新企业微信成员")
@PreAuthorize("@ss.hasPermission('system:cp-user:update')")
public CommonResult<Boolean> 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<Boolean> 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<CpUserRespVO> 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<List<CpUserRespVO>> getCpUserList(@RequestParam("ids") Collection<Long> ids) {
List<CpUserDO> list = cpUserService.getCpUserList(ids);
return success(CpUserConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@ApiOperation("获得企业微信成员分页")
@PreAuthorize("@ss.hasPermission('system:cp-user:query')")
public CommonResult<PageResult<CpUserRespVO>> getCpUserPage(@Valid CpUserPageReqVO pageVO) {
PageResult<CpUserDO> 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<CpUserDO> list = cpUserService.getCpUserList(exportReqVO);
// 导出 Excel
List<CpUserExcelVO> datas = CpUserConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "企业微信成员.xls", "数据", CpUserExcelVO.class, datas);
}
}

46
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;
}

14
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 {
}

50
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;
}

50
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;
}

52
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;
}

19
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;
}

18
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;
}

48
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<AuthLoginRespVO> 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<AuthPermissionInfoRespVO> getPermissionInfo() {

4
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
*/

2
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;
}

2
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 = "账号格式为数字以及字母")

37
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<CpUserRespVO> convertList(List<CpUserDO> list);
PageResult<CpUserRespVO> convertPage(PageResult<CpUserDO> page);
List<CpUserExcelVO> convertList02(List<CpUserDO> list);
List<CpUserDO> convertListFromWxApi(List<WxCpUser> list);
}

65
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;
}

50
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<CpUserDO> {
default PageResult<CpUserDO> selectPage(CpUserPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CpUserDO>()
.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<CpUserDO> selectList(CpUserExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<CpUserDO>()
.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));
}
}

2
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();
}
};

24
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 "企业微信同步完成...";
}
}

76
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<CpUserDO> {
/**
* 创建企业微信成员
*
* @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<CpUserDO> getCpUserList(Collection<Long> ids);
/**
* 获得企业微信成员分页
*
* @param pageReqVO 分页查询
* @return 企业微信成员分页
*/
PageResult<CpUserDO> getCpUserPage(CpUserPageReqVO pageReqVO);
/**
* 获得企业微信成员列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 企业微信成员列表
*/
List<CpUserDO> getCpUserList(CpUserExportReqVO exportReqVO);
void cpUserSync() throws WxErrorException;
}

127
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<CpUserMapper,CpUserDO> 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.<CpUserDO>lambdaQuery().eq(CpUserDO::getUserId,userId),false);
}
@Override
public List<CpUserDO> getCpUserList(Collection<Long> ids) {
return cpUserMapper.selectBatchIds(ids);
}
@Override
public PageResult<CpUserDO> getCpUserPage(CpUserPageReqVO pageReqVO) {
return cpUserMapper.selectPage(pageReqVO);
}
@Override
public List<CpUserDO> getCpUserList(CpUserExportReqVO exportReqVO) {
return cpUserMapper.selectList(exportReqVO);
}
public void cpUserSync() throws WxErrorException {
List<WxCpUser> userList = wxCpService.getUserService().listByDepartment(1L, true, 0);
List<CpUserDO> rs = CpUserConvert.INSTANCE.convertListFromWxApi(userList);
List<CpUserDO> nowUsers = this.cpUserMapper.selectList();
// 已经存在的员工
List<String> nowUsersIds = nowUsers.stream().map(CpUserDO::getUserId).collect(Collectors.toList());
rs.removeIf(cpUserDO -> nowUsersIds.contains(cpUserDO.getUserId()));
this.saveBatch(rs);
// 已经离职的员工 设置删除
List<String> leaveUserIds = userList.stream().filter(wxCpUser -> wxCpUser.getStatus() == 0)
.map(WxCpUser::getUserId).collect(Collectors.toList());
List<CpUserDO> leaveUsers = this.list(Wrappers.<CpUserDO>lambdaQuery()
.in(CpUserDO::getUserId, leaveUserIds));
leaveUsers.forEach(cpUserDO -> cpUserDO.setDeleted(true));
this.updateBatchById(leaveUsers);
}
}

2
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;
}
// 校验验证码

2
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

12
yudao-module-system/yudao-module-system-impl/src/main/java/resources/mapper/CpUser/CpUserMapper.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.CpUser.CpUserMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

218
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<CpUserDO> 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<CpUserDO> list = cpUserService.getCpUserList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbCpUser, list.get(0));
}
}

6
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);

1
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";

20
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 '';

6
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

8
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!

1
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:

9
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}
.__ __. ______ .______ __ __ _______
| \ | | / __ \ | _ \ | | | | / _____|
| \| | | | | | | |_) | | | | | | | __
| . ` | | | | | | _ < | | | | | | |_ |
| |\ | | `--' | | |_) | | `--' | | |__| |
|__| \__| \______/ |______/ \______/ \______|
███╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗
████╗ ██║██╔═══██╗ ██╔══██╗██║ ██║██╔════╝
██╔██╗ ██║██║ ██║ ██████╔╝██║ ██║██║ ███╗

11
yudao-server/src/main/resources/logback-spring.xml

@ -4,7 +4,16 @@
<!-- 变量 yudao.info.base-package,基础业务包 -->
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%thread] [%tid] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
<!-- <property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } -&#45;&#45; [%thread] [%tid] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>-->
<property name="PATTERN_DEFAULT"
value=" %clr(%d{MM-dd HH:mm:ss:SSS}) %clr([%5.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr"
converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 控制台 Appender -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">     

2
yudao-ui-admin

@ -1 +1 @@
Subproject commit 05fdb1d9e71965bbb19e9e35b8732c861d7eab94
Subproject commit 8db432a76334b37b1a9c20fb16287fd0c9e57fe0

2
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) => {

8
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<Object> 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<List<YxStoreBargainUserQueryVo>> bargainUserList(

4
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<CombinationQueryVo> getList(@RequestParam(value = "page",defaultValue = "1") int page,

4
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<Map<String, Object>> authLogin(@RequestParam(value = "code") String code,

10
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<List<YxStoreCouponIssueQueryVo>> 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<List<StoreCouponUserVo>> orderCoupon(@PathVariable String cartIds){

4
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<List<OrderDataVo>> data(@RequestParam(value = "page",defaultValue = "1") int page,

11
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<Map<String, Object>> 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<Object> 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<YxStoreOrderQueryVo> detail(@PathVariable String key) {

22
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<Map<String,Object>> 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<String> 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<ProductVo> 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<List<YxStoreProductReplyQueryVo>> 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<ReplyCountVo> replyCount(@PathVariable Integer id){

16
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<StoreAfterSalesVo> 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<List<StoreAfterSalesVo>> 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<Boolean> 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<Boolean> 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<Boolean> deleteAfterSalesOrder(@RequestParam String orderCode, @RequestParam Long id) {

12
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<List<YxUserBillQueryVo>> 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<List<Map<String,Object>>> 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<Object> spreadCommission(@RequestParam(value = "page",defaultValue = "1") int page,

14
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<List<YxStoreProductRelationQueryVo>> 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<List<SignVo>> 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<Object> signMonthList(@RequestParam(value = "page",defaultValue = "1") int page,

2
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java

@ -59,7 +59,7 @@ public interface YxStoreBargainMapper extends CoreMapper<YxStoreBargain> {
@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<String> listAllTable();
}

Loading…
Cancel
Save