diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/qrcode/QrCodeController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/qrcode/QrCodeController.java new file mode 100644 index 000000000..305c667d5 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/qrcode/QrCodeController.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.module.shop.controller.app.qrcode; + +import cn.iocoder.yudao.framework.common.enums.Constants; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.shop.service.qrcode.QrCodeService; +import com.alibaba.fastjson.JSONObject; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 验证码 + * +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- + */ + +@Slf4j +@RestController +@RequestMapping("/qrcode") +@Tag(name = "用户APP - 二维码服务") +public class QrCodeController { + + @Autowired + private QrCodeService qrCodeService; + /** + * 获取二维码 + * @return CommonResult + */ + @Operation(summary="获取二维码") + @RequestMapping(value = "/get", method = RequestMethod.POST) + public CommonResult> get(@RequestBody JSONObject data) { + return CommonResult.success(qrCodeService.get(data)); + } + + /** + * 远程图片转base64 + * @return CommonResult + */ + @Operation(summary="远程图片转base64") + @RequestMapping(value = "/base64", method = RequestMethod.POST) + public CommonResult> get(@RequestBody String url) { + return CommonResult.success(qrCodeService.base64(url)); + } + + /** + * 将字符串 转base64 + * @return CommonResult + */ + @Operation(summary="将字符串 转base64") + @RequestMapping(value = "/str2base64", method = RequestMethod.POST) + public CommonResult> getQrcodeByString( + @RequestParam String text, + @RequestParam int width, + @RequestParam int height) { + if((width < 50 || height < 50) && (width > 500 || height > 500) && text.length() >= 999){ + throw new ServiceException(Constants.RESULT_QRCODE_PRAMERROR); + } + return CommonResult.success(qrCodeService.base64String(text, width,height)); + } +} + + + diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeService.java new file mode 100644 index 000000000..d6b0608dd --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeService.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.shop.service.qrcode; + +import com.alibaba.fastjson.JSONObject; + +import java.util.Map; + +/** +* QrCodeService 接口 +* +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- +*/ +public interface QrCodeService { + + /** + * 获取二维码 + * @return CommonResult + */ + Map get(JSONObject data); + + /** + * 远程图片转base64 + * @param url 图片链接地址 + */ + Map base64(String url); + + /** + * 将字符串 转base64 + * @param text 字符串 + * @param width 宽 + * @param height 高 + */ + Map base64String(String text,int width, int height); + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeServiceImpl.java new file mode 100644 index 000000000..a02c91572 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeServiceImpl.java @@ -0,0 +1,88 @@ +package cn.iocoder.yudao.module.shop.service.qrcode; + +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.http.HttpUtil; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; +import org.springframework.util.Base64Utils; + +import java.util.HashMap; +import java.util.Map; + +/** +* QrCodeServiceImpl 接口实现 +* +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- +*/ +@Service +public class QrCodeServiceImpl implements QrCodeService { + + /** + * 二维码 + * @return Object + */ + @Override + public Map get(JSONObject data) { + Map map = new HashMap<>(); + StringBuilder scene = new StringBuilder(); + String page = ""; + try{ + if(null != data){ + Map dataMap = JSONObject.toJavaObject(data, Map.class); + + for (Map.Entry m : dataMap.entrySet()) { + if(m.getKey().equals("path")){ + //前端路由, 不需要拼参数 + page = m.getValue().toString(); + continue; + } + if (scene.length() > 0) { + scene.append(","); + } + scene.append(m.getKey()).append(":").append(m.getValue()); + } + } + }catch (Exception e){ + throw new ServiceException("url参数错误 " + e.getMessage()); + } + map.put("code", ""); + return map; + } + + @Override + public Map base64(String url) { + byte[] bytes = HttpUtil.downloadBytes(url); + String base64Image = Base64Utils.encodeToString(bytes); + Map map = new HashMap<>(); + map.put("code", base64Image); + return map; + } + + /** + * 讲字符串转为QRcode + * @param text 待转换字符串 + * @return QRcode base64格式 + */ + @Override + public Map base64String(String text,int width, int height) { + + String base64Image = null; + try { + base64Image = Base64Utils.encodeToString(QrCodeUtil.generatePng(text,width,height)); + }catch (Exception e){ + throw new ServiceException("生成二维码异常"); + } + Map map = new HashMap<>(); + map.put("code", base64Image); + return map; + } +} + diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java index 493dbb58f..504bf8cf7 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java @@ -23,6 +23,8 @@ public interface ErrorCodeConstants { ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1004003005, "未绑定账号,需要进行绑定"); ErrorCode AUTH_WEIXIN_MINI_APP_PHONE_CODE_ERROR = new ErrorCode(1004003006, "获得手机号失败"); + ErrorCode USER_PHONE_EXISTS = new ErrorCode(1004003007, "手机号已经存在"); + // ========== 用户收件地址 1004004000 ========== ErrorCode ADDRESS_NOT_EXISTS = new ErrorCode(1004004000, "用户收件地址不存在"); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java index f9c1817f9..e273be81d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java @@ -16,7 +16,7 @@ public class PromoterBaseVO { @Schema(description = "组织id", required = true, example = "18443") @NotNull(message = "组织id不能为空") - private String orgId; + private String deptId; @Schema(description = "推广员名称", required = true, example = "5841") @NotEmpty(message = "推广员名称不能为空") diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java index 57325dd0d..a837dbe7f 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java @@ -18,7 +18,7 @@ public class PromoterExcelVO { private Long id; @ExcelProperty("组织id") - private String orgId; + private String deptId; @ExcelProperty("会员id") private Long userId; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java index 3fc155d41..823d2c52c 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java @@ -10,7 +10,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; public class PromoterExportReqVO { @Schema(description = "组织id", example = "18443") - private String orgId; + private String deptId; @Schema(description = "会员id", example = "5841") private Long userId; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java index c7efb3d64..44939b62e 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java @@ -1,10 +1,15 @@ package cn.iocoder.yudao.module.member.controller.admin.promoter.vo; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.validation.Mobile; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + @Schema(description = "管理后台 - 推广员分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @@ -12,9 +17,20 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; public class PromoterPageReqVO extends PageParam { @Schema(description = "组织id", example = "18443") - private String orgId; + private String deptId; - @Schema(description = "会员id", example = "5841") - private Long userId; + @Schema(description = "推广员名称", example = "5841") + private String nickname; + + @Schema(description = "推广员手机号", example = "15601691300") + private String mobile; + + /** + * 帐号状态 + *

+ * 枚举 {@link CommonStatusEnum} + */ + @Schema(description = "帐号状态") + private Integer status; } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java index 354c0002f..1d193a120 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java @@ -5,9 +5,11 @@ import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; +import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoReqVO; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoRespVO; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; +import cn.iocoder.yudao.module.member.controller.app.user.vo.UserSpreadBannerVO; import cn.iocoder.yudao.module.member.convert.user.UserConvert; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.service.promoter.PromoterService; @@ -22,6 +24,9 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @@ -32,6 +37,7 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMP @RequestMapping("/member/user") @Validated @Slf4j + public class AppUserController { @Resource @@ -43,6 +49,7 @@ public class AppUserController { @PutMapping("/update-nickname") @Operation(summary = "修改用户昵称") @PreAuthenticated + @TenantIgnore public CommonResult updateUserNickname(@RequestParam("nickname") String nickname) { userService.updateUserNickname(getLoginUserId(), nickname); return success(true); @@ -51,6 +58,7 @@ public class AppUserController { @PostMapping("/update-avatar") @Operation(summary = "修改用户头像") @PreAuthenticated + @TenantIgnore public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { if (file.isEmpty()) { throw exception(FILE_IS_EMPTY); @@ -62,6 +70,7 @@ public class AppUserController { @GetMapping("/get") @Operation(summary = "获得基本信息") @PreAuthenticated + @TenantIgnore public CommonResult getUserInfo() { MemberUserDO user = userService.getUser(getLoginUserId()); AppUserInfoRespVO appUserInfoRespVO = UserConvert.INSTANCE.convert(user); @@ -76,6 +85,7 @@ public class AppUserController { @PostMapping("/update-mobile") @Operation(summary = "修改用户手机") @PreAuthenticated + @TenantIgnore public CommonResult updateMobile(@RequestBody @Valid AppUserUpdateMobileReqVO reqVO) { userService.updateUserMobile(getLoginUserId(), reqVO); return success(true); @@ -83,6 +93,7 @@ public class AppUserController { @PostMapping("/update-user") @Operation(summary = "修改用户信息") @PreAuthenticated + @TenantIgnore public CommonResult updateMobile(@RequestBody @Validated AppUserInfoReqVO req) { req.setId(getLoginUserId()); MemberUserDO userDO = new MemberUserDO(); @@ -92,6 +103,19 @@ public class AppUserController { userService.updateById(userDO); return success(true); } - + /** + * 海报背景图 + */ + @Operation(summary = "推广海报图") + @RequestMapping(value = "/spread/banner", method = RequestMethod.GET) + public CommonResult> getSpreadBannerList() { + List list = new ArrayList<>(); + UserSpreadBannerVO userSpreadBannerVO = new UserSpreadBannerVO(); + userSpreadBannerVO.setId(1); + userSpreadBannerVO.setPic("http://192.168.1.147:48080/admin-api/infra/file/4/get/431efea27162d536d35f7b3c0b844ede98a6ba58f4fd72ac7181e7ee5ebae77a.jpg"); + userSpreadBannerVO.setTitle("推广背景图"); + list.add(userSpreadBannerVO); + return CommonResult.success(list); + } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/UserSpreadBannerVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/UserSpreadBannerVO.java new file mode 100644 index 000000000..ec4156680 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/UserSpreadBannerVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.member.controller.app.user.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 用户地址表 + * +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@Schema(description="用户推广海报") +public class UserSpreadBannerVO implements Serializable { + + private static final long serialVersionUID=1L; + + @Schema(description = "id") + private Integer id; + + @Schema(description = "名称") + private String title; + + @Schema(description = "背景图") + private String pic; + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java index 01d631f2d..dc1b9868a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.member.dal.dataobject.promoter; import lombok.*; import java.io.Serializable; +import java.time.LocalDateTime; + import com.baomidou.mybatisplus.annotation.*; /** @@ -32,10 +34,12 @@ public class PromoterDO implements Serializable { /** * 组织id */ - private Long orgId; + private Long deptId; /** * 会员id */ private Long userId; + private LocalDateTime createTime; + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java index 3913dde16..394215498 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java @@ -21,14 +21,13 @@ public interface PromoterMapper extends BaseMapperX { default PageResult selectPage(PromoterPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(PromoterDO::getOrgId, reqVO.getOrgId()) - .eqIfPresent(PromoterDO::getUserId, reqVO.getUserId()) + .eqIfPresent(PromoterDO::getDeptId, reqVO.getDeptId()) .orderByDesc(PromoterDO::getId)); } IPage findListPage(IPage page, @Param("data") PromoterPageReqVO data); default List selectList(PromoterExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() - .eqIfPresent(PromoterDO::getOrgId, reqVO.getOrgId()) + .eqIfPresent(PromoterDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(PromoterDO::getUserId, reqVO.getUserId()) .orderByDesc(PromoterDO::getId)); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java index 2776136c0..93c891c78 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java @@ -1,10 +1,12 @@ package cn.iocoder.yudao.module.member.service.promoter; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; +import cn.iocoder.yudao.module.member.enums.ErrorCodeConstants; import cn.iocoder.yudao.module.member.service.user.MemberUserService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; @@ -17,8 +19,10 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.validation.Validator; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import java.time.LocalDateTime; import java.util.*; import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*; import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO; @@ -75,18 +79,28 @@ public class PromoterServiceImpl implements PromoterService { throw new ServiceException(PROMOTER_EXISTS); } promoter.setUserId(memberUserDO.getId()); + promoter.setCreateTime(LocalDateTime.now()); promoterMapper.insert(promoter); // 返回 return promoter.getId(); } @Override + @Transactional(rollbackFor = Exception.class) public void updatePromoter(PromoterUpdateReqVO updateReqVO) { // 校验存在 - validatePromoterExists(updateReqVO.getId()); + PromoterDO promoterDO = validatePromoterExists(updateReqVO.getId()); // 更新 PromoterDO updateObj = PromoterConvert.INSTANCE.convert(updateReqVO); promoterMapper.updateById(updateObj); + MemberUserDO memberUserDO = memberUserService.getUserByMobile(updateReqVO.getMobile()); + if(memberUserDO!=null&&!promoterDO.getUserId().equals(memberUserDO.getId())){ + throw new ServiceException(ErrorCodeConstants.USER_PHONE_EXISTS); + }else { + memberUserDO.setMobile(updateReqVO.getMobile()); + memberUserDO.setNickname(updateReqVO.getNickname()); + memberUserService.updateById(memberUserDO); + } } @Override @@ -97,10 +111,12 @@ public class PromoterServiceImpl implements PromoterService { promoterMapper.deleteById(id); } - private void validatePromoterExists(Long id) { - if (promoterMapper.selectById(id) == null) { + private PromoterDO validatePromoterExists(Long id) { + PromoterDO promoterDO = promoterMapper.selectById(id); + if (promoterDO == null) { throw exception(PROMOTER_NOT_EXISTS); } + return promoterDO; } @Override @@ -127,6 +143,13 @@ public class PromoterServiceImpl implements PromoterService { @Override public PageResult getPromoterPage(PromoterPageReqVO pageReqVO) { Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + if(StrUtil.isNotBlank(pageReqVO.getDeptId())){ + DeptRespDTO deptRespDTO = deptApi.getDept(Long.parseLong(pageReqVO.getDeptId())); + if(deptRespDTO!=null){ + pageReqVO.setDeptId(deptRespDTO.getParentOrganizationIds()); + } + } + promoterMapper.findListPage(page,pageReqVO); return new PageResult<>(page.getRecords(), page.getTotal()); } @@ -174,6 +197,7 @@ public class PromoterServiceImpl implements PromoterService { PromoterDO promoter = new PromoterDO(); promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); promoter.setUserId(memberUserDO.getId()); + promoter.setCreateTime(LocalDateTime.now()); Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,memberUserDO.getId())); if(count>0){ respVO.getFailureUsernames().put(importUser.getNickName(), "已经是推广员"); @@ -184,7 +208,7 @@ public class PromoterServiceImpl implements PromoterService { respVO.getFailureUsernames().put(importUser.getNickName(), "组织不存在"); return; } - promoter.setOrgId(deptRespDTO.getId()); + promoter.setDeptId(deptRespDTO.getId()); promoterMapper.insert(promoter); respVO.getCreateUsernames().add(importUser.getNickName()); return; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml b/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml index 38b6dc70b..ab426817b 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml +++ b/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml @@ -10,9 +10,23 @@ --> diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java index 582eaae51..20ee1a558 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java @@ -19,5 +19,15 @@ public class DeptSimpleRespVO { @Schema(description = "父部门 ID", required = true, example = "1024") private Long parentId; + /** + * 父级组织链 + */ + private String parentOrganizationIds; + + /** + * 父级组织链名称 + */ + private String parentOrganizationName; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java index f52ff8bf4..be7873f92 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.annotation.security.PermitAll; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -30,6 +31,7 @@ public class AppTenantController { @GetMapping("/get") @Operation(summary = "获得租户") @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PermitAll public CommonResult getTenant(@RequestParam("id") Long id) { TenantDO tenant = tenantService.getTenant(id); return success(TenantConvert.INSTANCE.convert(tenant)); diff --git a/yudao-server/Dockerfile b/yudao-server/Dockerfile index 234081ad0..4dcd1e0d0 100644 --- a/yudao-server/Dockerfile +++ b/yudao-server/Dockerfile @@ -16,4 +16,4 @@ ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" EXPOSE 48080 ## 启动后端项目 -CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar -Dspring.profiles.active=dev app.jar diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 2cfe63be7..4de32b44a 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -108,8 +108,6 @@ yudao: permit-all_urls: - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录 - /admin-api/notice/wxpay/** - - /app-api/tenant/get - - /admin-api/system/tenant/get-id-by-name websocket: enable: true # websocket的开关 path: /websocket/message # 路径 diff --git a/yudao-server/src/main/resources/logback-spring.xml b/yudao-server/src/main/resources/logback-spring.xml index b1b9f3faf..a92625500 100644 --- a/yudao-server/src/main/resources/logback-spring.xml +++ b/yudao-server/src/main/resources/logback-spring.xml @@ -66,7 +66,7 @@ - + diff --git a/yudao-ui-admin/.env.dev b/yudao-ui-admin/.env.dev index 4667a55eb..cd578096a 100644 --- a/yudao-ui-admin/.env.dev +++ b/yudao-ui-admin/.env.dev @@ -5,8 +5,8 @@ ENV = 'development' VUE_APP_TITLE = 创盈商户管理系统 # 芋道管理系统/开发环境 -#VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/admin-api' -VUE_APP_BASE_API = 'http://192.168.1.147:48080' +VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/cyywl-api' +#VUE_APP_BASE_API = 'http://192.168.1.147:48080' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/yudao-ui-admin/.env.prod b/yudao-ui-admin/.env.prod index d1ef847d9..82641e167 100644 --- a/yudao-ui-admin/.env.prod +++ b/yudao-ui-admin/.env.prod @@ -9,7 +9,7 @@ VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/admin-api' #VUE_APP_BASE_API = 'http://192.168.2.71' # 根据服务器或域名修改 -PUBLIC_PATH = 'https://cmx.bskies.cc:8000/cy-admin/' +PUBLIC_PATH = 'http://192.168.2.71/' # 二级部署路径 VUE_APP_APP_NAME ='/cy-admin/' diff --git a/yudao-ui-admin/src/views/member/promoter/index.vue b/yudao-ui-admin/src/views/member/promoter/index.vue index 3cfbc285e..7242908bb 100644 --- a/yudao-ui-admin/src/views/member/promoter/index.vue +++ b/yudao-ui-admin/src/views/member/promoter/index.vue @@ -3,8 +3,8 @@ - - + @@ -75,8 +75,8 @@ - - + @@ -213,14 +213,14 @@ export default { queryParams: { pageNo: 1, pageSize: 10, - orgId: null, + deptId: null, userId: null, }, // 表单参数 form: {}, // 表单校验 rules: { - orgId: [{ + deptId: [{ required: true, message: '请选择所属组织', trigger: 'blur' @@ -309,7 +309,7 @@ export default { reset() { this.form = { id: undefined, - orgId: undefined, + deptId: undefined, userId: undefined, }; this.resetForm('form');