From 451747bd24471956066a5b8d012706ca2e28ef6b Mon Sep 17 00:00:00 2001 From: tangqian Date: Thu, 1 Jun 2023 11:24:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/promoter/PromoterController.java | 10 +++--- .../service/promoter/PromoterServiceImpl.java | 32 +++++++++++-------- .../service/user/MemberUserService.java | 3 ++ .../service/user/MemberUserServiceImpl.java | 11 ++++++- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java index 07abbc93a..3529ad176 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.member.controller.admin.promoter; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.module.system.enums.common.SexEnum; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Parameters; @@ -115,11 +116,12 @@ public class PromoterController { } @PostMapping("/import") @Operation(summary = "导入推广员") - @Parameters({ - @Parameter(name = "file", description = "Excel 文件", required = true), - @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") - }) +// @Parameters({ +// @Parameter(name = "file", description = "Excel 文件", required = true), +// @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") +// }) // @PreAuthorize("@ss.hasPermission('system:user:import')") + @TenantIgnore public CommonResult importExcel(@RequestParam("file") MultipartFile file, @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { List list = ExcelUtils.read(file, PromoterImportExcelVO.class); 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 a3aef67ad..78c8b8ac1 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 @@ -22,10 +22,12 @@ import javax.annotation.Resource; import javax.validation.Validator; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import java.time.LocalDateTime; import java.util.*; +import java.util.stream.Collectors; import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*; import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO; @@ -179,6 +181,12 @@ public class PromoterServiceImpl implements PromoterService { if (CollUtil.isEmpty(importUsers)) { throw exception(PROMOTER_IMPORT_LIST_IS_EMPTY); } + Set collect = importUsers.stream().map(PromoterImportExcelVO::getMobile).collect(Collectors.toSet()); + List list = memberUserService.getByMobileList(collect); + if (!CollectionUtils.isEmpty(list)) { + List collect1 = list.stream().map(MemberUserDO::getMobile).collect(Collectors.toList()); + throw new ServiceException(200, "电话号码:" + collect1 + "重复"); + } PromoterImportRespVO respVO = PromoterImportRespVO.builder().createUsernames(new ArrayList<>()) .updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build(); List deptRespDTOList = deptApi.getDeptList(); @@ -191,20 +199,20 @@ public class PromoterServiceImpl implements PromoterService { return; } //判断手机号是否注册 - MemberUserDO memberUserDO = memberUserService.getUserByMobile(importUser.getMobile()); - if (memberUserDO == null) { - //创建用户 - memberUserDO = new MemberUserDO(); - memberUserDO.setNickname(importUser.getNickName()); - memberUserDO.setMobile(importUser.getMobile()); - memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length() - 6)); - memberUserDO.setStatus(0); - memberUserService.createUserIfAbsent(importUser.getMobile(), importUser.getNickName(), getClientIP()); - } +// MemberUserDO memberUserDO = memberUserService.getUserByMobile(importUser.getMobile()); +// if (memberUserDO == null) { + //创建用户 + MemberUserDO memberUserDO = new MemberUserDO(); + memberUserDO.setNickname(importUser.getNickName()); + memberUserDO.setMobile(importUser.getMobile()); + memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length() - 6)); + memberUserDO.setStatus(0); + MemberUserDO userIfAbsent = memberUserService.createUserIfAbsent(importUser.getMobile(), importUser.getNickName(), getClientIP()); +// } // 插入 PromoterDO promoter = new PromoterDO(); promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); - promoter.setUserId(memberUserDO.getId()); + promoter.setUserId(userIfAbsent.getId()); promoter.setCreateTime(LocalDateTime.now()); Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId, memberUserDO.getId())); if (count > 0) { @@ -225,8 +233,6 @@ public class PromoterServiceImpl implements PromoterService { } - - @Override public PromoterDO getPromoterDOByUserId(Long userId) { return promoterMapper.selectOne(Wrappers.lambdaQuery().eq(PromoterDO::getUserId, userId).last("LIMIT 1")); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java index ea5b052f0..d199b59e7 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import java.io.InputStream; import java.util.Collection; import java.util.List; +import java.util.Set; /** * 会员用户 Service 接口 @@ -139,4 +140,6 @@ public interface MemberUserService { Long promoterOrderCount(AppUserInfoReqDTO reqVO); + + List getByMobileList(Set collect); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index ff4bdb1bd..9b110490d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO; import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import org.springframework.security.crypto.password.PasswordEncoder; @@ -27,6 +28,7 @@ import java.io.InputStream; import java.time.LocalDateTime; import java.util.Collection; import java.util.List; +import java.util.Set; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; @@ -103,7 +105,7 @@ public class MemberUserServiceImpl implements MemberUserService { user.setMobile(mobile); user.setNickname(realName); user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启 - user.setPassword(encodePassword(mobile.substring(5,11))); // 加密密码 + user.setPassword(encodePassword(mobile.substring(mobile.length() - 6))); // 加密密码 user.setRegisterIp(registerIp); user.setPromoterId(promoterId); user.setTenantId(TenantContextHolder.getRequiredTenantId()); @@ -261,4 +263,11 @@ public class MemberUserServiceImpl implements MemberUserService { return memberUserMapper.promoterOrderCount(reqVO); } + + @Override + public List getByMobileList(Set collect) { + LambdaQueryWrapper qw = new LambdaQueryWrapper(); + qw.in(MemberUserDO::getMobile,collect); + return memberUserMapper.selectList(qw); + } } From d6ea232b812537384f4fbd99aba4064da28c2b96 Mon Sep 17 00:00:00 2001 From: Jruome <2559028966@qq.com> Date: Thu, 1 Jun 2023 11:24:27 +0800 Subject: [PATCH 2/4] =?UTF-8?q?uniapp=20=E6=97=B6=E9=97=B4=E6=88=B3?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-app/pages/index/index.vue | 8 ++--- yudao-ui-app/pages/member_record/index.vue | 2 +- yudao-ui-app/pages/notice/index.vue | 7 +++-- yudao-ui-app/pages/sale_performance/index.vue | 30 +++++++++---------- yudao-ui-app/utils/util.js | 14 +++++++++ 5 files changed, 39 insertions(+), 22 deletions(-) diff --git a/yudao-ui-app/pages/index/index.vue b/yudao-ui-app/pages/index/index.vue index 8a907d1f1..bf8723fdf 100644 --- a/yudao-ui-app/pages/index/index.vue +++ b/yudao-ui-app/pages/index/index.vue @@ -28,14 +28,14 @@ - 会员等级1级 + 会员等级{{vipData.findIndex((item) => item == vip.grade) +1}}级 查看权益 - 会员等级0级 + 会员等级{{vipData.findIndex((item) => item == vip.grade) +1}}级 申请会员 @@ -223,7 +223,7 @@ bastInfo: '', fastInfo: '', fastList: [], - text: '尊敬的业主:接环卫所通知,近期将对小区进行大扫除,请大家做好准备', + text: '暂无公告', firstInfo: '', salesInfo: '', indicatorDots: false, @@ -286,7 +286,7 @@ lineColor: 'red', lineStyle: {}, // 下划线位置--动态甲酸 listActive: 0, // 当前选中项 - + vipData:['普通会员','中级会员','高级会员'], duration: 0.2 // 下划线动画时长 } }, diff --git a/yudao-ui-app/pages/member_record/index.vue b/yudao-ui-app/pages/member_record/index.vue index 210e517be..db23f8851 100644 --- a/yudao-ui-app/pages/member_record/index.vue +++ b/yudao-ui-app/pages/member_record/index.vue @@ -14,7 +14,7 @@ 充值档次:{{item.grade}} - 日期:{{item.stringCreateTime}} + 日期:{{$util.timestampToTime(item.stringCreateTime)}} diff --git a/yudao-ui-app/pages/notice/index.vue b/yudao-ui-app/pages/notice/index.vue index 782f84bae..5838f4d3d 100644 --- a/yudao-ui-app/pages/notice/index.vue +++ b/yudao-ui-app/pages/notice/index.vue @@ -15,6 +15,9 @@ import { setVisit, getUserInfo } from '@/api/user.js' + import { + mapGetters + } from "vuex"; export default { data(){ return { @@ -23,11 +26,11 @@ export default { userInfo: {} } }, + computed: mapGetters(['tenantId']), mounted(){ getUserInfo().then(res => { this.userInfo = res.data - console.log(res.data) - getTenant(153).then(res => { + getTenant(this.tenantId).then(res => { this.tenant = res.data this.text = res.data.notice }) diff --git a/yudao-ui-app/pages/sale_performance/index.vue b/yudao-ui-app/pages/sale_performance/index.vue index 85bd0b4fb..e7e53ee0b 100644 --- a/yudao-ui-app/pages/sale_performance/index.vue +++ b/yudao-ui-app/pages/sale_performance/index.vue @@ -67,7 +67,7 @@ {{item.nickname}} - {{ timestampToTime(item.payTime) }} + {{ $util.timestampToTime(item.payTime) }} {{ item.grade }} @@ -152,20 +152,20 @@ } }, methods: { - timestampToTime(timestamp) { - // 时间戳为10位需*1000,时间戳为13位不需乘1000 - var date = new Date(timestamp); - var Y = date.getFullYear() + "-"; - var M = - (date.getMonth() + 1 < 10 - ? "0" + (date.getMonth() + 1) - : date.getMonth() + 1) + "-"; - var D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " "; - var h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":"; - var m = (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) + ":"; - var s = (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds()); - return Y + M + D + h + m + s; - }, + // timestampToTime(timestamp) { + // // 时间戳为10位需*1000,时间戳为13位不需乘1000 + // var date = new Date(timestamp); + // var Y = date.getFullYear() + "-"; + // var M = + // (date.getMonth() + 1 < 10 + // ? "0" + (date.getMonth() + 1) + // : date.getMonth() + 1) + "-"; + // var D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " "; + // var h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":"; + // var m = (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) + ":"; + // var s = (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds()); + // return Y + M + D + h + m + s; + // }, selectClick(value) { console.log(value) this.active = value.id diff --git a/yudao-ui-app/utils/util.js b/yudao-ui-app/utils/util.js index cf193f044..37dfd4d82 100644 --- a/yudao-ui-app/utils/util.js +++ b/yudao-ui-app/utils/util.js @@ -8,6 +8,20 @@ import { pathToBase64 } from '@/plugin/image-tools/index.js'; export default { + timestampToTime(timestamp) { + // 时间戳为10位需*1000,时间戳为13位不需乘1000 + var date = new Date(timestamp); + var Y = date.getFullYear() + "-"; + var M = + (date.getMonth() + 1 < 10 + ? "0" + (date.getMonth() + 1) + : date.getMonth() + 1) + "-"; + var D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " "; + var h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":"; + var m = (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) + ":"; + var s = (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds()); + return Y + M + D + h + m + s; + }, /** * opt object | string * to_url object | string From 06a0f96bf1ccf09d16cf0fa93a802211baf873dc Mon Sep 17 00:00:00 2001 From: tangqian Date: Thu, 1 Jun 2023 11:27:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/recharge/RechargeOrderServiceImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java index 7b8914900..274b699d6 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java @@ -132,14 +132,16 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { rechargeOrderMapper.findListPage(page, pageReqVO); return new PageResult<>(page.getRecords(), page.getTotal()); } + @Override public List findPromoterDrawExcel(PromoterDrawReqExcelVO excelVO) { return rechargeOrderMapper.findPromoterDrawExcel(excelVO); } + @Override public PageResult findPromoterDrawPage(PromoterDrawReqVO pageReqVO) { Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); - if (Objects.nonNull(pageReqVO.getSort())&& StringUtils.equals("2",pageReqVO.getSort())) { + if (Objects.nonNull(pageReqVO.getSort()) && StringUtils.equals("2", pageReqVO.getSort())) { pageReqVO.setSort(null); } rechargeOrderMapper.findPromoterDrawPage(page, pageReqVO); @@ -241,11 +243,11 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { List infoDOS1 = collect.get(orderDO.getOrderId()); for (RechargeOrderInfoDO infoDO : infoDOS1) { if (infoDO.getPrice().compareTo(new BigDecimal("240")) == 0) { - grade.append("套餐1,"); + grade.append("套餐" + infoDO.getPrice() + ","); } else if (infoDO.getPrice().compareTo(new BigDecimal("400")) == 0) { - grade.append("套餐2,"); + grade.append("套餐" + infoDO.getPrice() + ","); } else if (infoDO.getPrice().compareTo(new BigDecimal("640")) == 0) { - grade.append("套餐3"); + grade.append("套餐" + infoDO.getPrice() + ","); } } orderDO.setGrade(grade.toString()); From bec5e56addc81be9814ab26b1c266bd49068aa0f Mon Sep 17 00:00:00 2001 From: tangqian Date: Thu, 1 Jun 2023 11:27:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/promoter/PromoterController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java index 3529ad176..cc67062c4 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java @@ -116,10 +116,10 @@ public class PromoterController { } @PostMapping("/import") @Operation(summary = "导入推广员") -// @Parameters({ -// @Parameter(name = "file", description = "Excel 文件", required = true), -// @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") -// }) + @Parameters({ + @Parameter(name = "file", description = "Excel 文件", required = true), + @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") + }) // @PreAuthorize("@ss.hasPermission('system:user:import')") @TenantIgnore public CommonResult importExcel(@RequestParam("file") MultipartFile file,