From b0b52cbabf7a4bc8e00fc328d14ac05336d0221e Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期六, 15 七月 2023 20:07:44 +0800 Subject: [PATCH] 员工端 --- ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 209 insertions(+), 15 deletions(-) diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java index ffa4cfc..2dbd752 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java @@ -84,8 +84,6 @@ @Resource private RemoteOrderService orderService; - @Resource - private MemberNurseService memberNurseService; @Resource private RemoteConfigService remoteConfigService; @@ -306,6 +304,8 @@ AppOrderTotalVo appOrderTotalVo = orderService.getAppOrderTotal(userId).getData(); appUserInfoVo.setNoPayCount(appOrderTotalVo.getNoPayCount()); appUserInfoVo.setNoUseCount(appOrderTotalVo.getNoUseCount()); + MemberTotal memberTotal = memberTotalService.getById(member.getMemberId()); + appUserInfoVo.setIntegral(memberTotal.getUseableIntegral()); return appUserInfoVo; } @@ -323,27 +323,22 @@ switch (editType) { case 1: member.setNickName(editValue); - member.setUpdateTime(new Date()); - member.setUpdateUserId(appEditUserDto.getUserId()); - this.saveOrUpdate(member); break; case 2: + member.setAvatar(editValue); break; case 3: member.setGender(Integer.valueOf(editValue)); - member.setUpdateTime(new Date()); - member.setUpdateUserId(appEditUserDto.getUserId()); - this.saveOrUpdate(member); break; case 4: member.setBirthday(editValue); - member.setUpdateTime(new Date()); - member.setUpdateUserId(appEditUserDto.getUserId()); - this.saveOrUpdate(member); break; default: break; } + member.setUpdateTime(new Date()); + member.setUpdateUserId(appEditUserDto.getUserId()); + this.saveOrUpdate(member); sysUserService.editUserInfo(appEditUserDto); } @@ -772,6 +767,11 @@ memberTotal.setTotalExperienceOrder(0); memberTotal.setTotalServiceOrder(0); memberTotal.setTotalGoodsOrder(0); + memberTotal.setShareFlag(0); + memberTotal.setPlSuggestFlag(0); + memberTotal.setShopSuggestFlag(0); + memberTotal.setSignFlag(0); + memberTotal.setBuyFlag(0); memberTotalService.saveOrUpdate(memberTotal); } @@ -1145,6 +1145,12 @@ nurseTotalVos = listRemoveNull(nurseTotalVos); mgtTotalMemberTotalVo.setNurseTotalVos(nurseTotalVos); } + //获取不同等级的会员数 + List<MgtMapIntTotalVo> memberLevelTotalVos = memberMapper.getTotalMemberTotalLevel(mgtBaseShopDto); + if (memberLevelTotalVos != null && memberLevelTotalVos.size() > 0) { + memberLevelTotalVos = listRemoveNull(memberLevelTotalVos); + mgtTotalMemberTotalVo.setMemberLevelTotalVos(memberLevelTotalVos); + } // 获取不同商品类型的会员数 List<MgtMapIntTotalVo> goodsTypeTotalVos = memberMapper.getTotalMemberTotalGoodsType(mgtBaseShopDto); if (goodsTypeTotalVos != null && goodsTypeTotalVos.size() > 0) { @@ -1250,6 +1256,12 @@ if (nurseTotalVos != null && nurseTotalVos.size() > 0) { nurseTotalVos = listRemoveNull(nurseTotalVos); plTotalMemberTotalVo.setNurseTotalVos(nurseTotalVos); + } + //获取不同等级的会员数 + List<MgtMapIntTotalVo> memberLevelTotalVos = memberMapper.getPlTotalMemberTotalLevel(mgtBasePlatformDto); + if (memberLevelTotalVos != null && memberLevelTotalVos.size() > 0) { + memberLevelTotalVos = listRemoveNull(memberLevelTotalVos); + plTotalMemberTotalVo.setMemberLevelTotalVos(memberLevelTotalVos); } // 获取不同商品类型的会员数 List<MgtMapIntTotalVo> goodsTypeTotalVos = memberMapper.getPlTotalMemberTotalGoodsType(mgtBasePlatformDto); @@ -1384,10 +1396,15 @@ } //消费变动 if (memberTotalChangeDto.getPayMoney() != null) { - memberTotal.setTotalPayMoney(memberTotal.getTotalPayMoney().add(memberTotalChangeDto.getPayMoney())); - memberTotal.setTotalPayCount(memberTotal.getTotalPayCount() + 1); - memberTotal.setLastPayMoney(memberTotalChangeDto.getPayMoney()); - memberTotal.setLastPayTime(memberTotalChangeDto.getPayTime()); + if(memberTotalChangeDto.getPayMoney().compareTo(BigDecimal.ZERO)>=0){ + memberTotal.setTotalPayMoney(memberTotal.getTotalPayMoney().add(memberTotalChangeDto.getPayMoney())); + memberTotal.setTotalPayCount(memberTotal.getTotalPayCount() + 1); + memberTotal.setLastPayMoney(memberTotalChangeDto.getPayMoney()); + memberTotal.setLastPayTime(memberTotalChangeDto.getPayTime()); + }else{ + memberTotal.setTotalPayMoney(memberTotal.getTotalPayMoney().add(memberTotalChangeDto.getPayMoney())); + memberTotal.setTotalPayCount(memberTotal.getTotalPayCount() - 1); + } } //服务次数变动 if (memberTotalChangeDto.getServiceCount() != null) { @@ -1501,6 +1518,12 @@ if (nurseTotalVos != null && nurseTotalVos.size() > 0) { nurseTotalVos = listRemoveNull(nurseTotalVos); memberFixedTotalVo.setNurseTotalVos(nurseTotalVos); + } + //获取不同等级的会员数 + List<MgtMapIntTotalVo> memberLevelTotalVos = memberMapper.getMerMemberTotalLevel(merTotalDto); + if (memberLevelTotalVos != null && memberLevelTotalVos.size() > 0) { + memberLevelTotalVos = listRemoveNull(memberLevelTotalVos); + memberFixedTotalVo.setMemberLevelTotalVos(memberLevelTotalVos); } // 获取不同商品类型的会员数 List<MgtMapIntTotalVo> goodsTypeTotalVos = memberMapper.getMerMemberTotalGoodsType(merTotalDto); @@ -1644,4 +1667,175 @@ public void mgtFrozenMember(MgtBaseGetDto mgtBaseGetDto){ sysUserService.frozenUser(Long.valueOf(mgtBaseGetDto.getId())); } + + /** + * @description 获取用户任务列表 + * @author jqs + * @date 2023/7/12 15:07 + * @param userId + * @return List<AppIntegralTaskListVo> + */ + @Override + public List<AppIntegralTaskListVo> listAppMemberIntegralTask(Long userId){ + // 获取指定用户的会员信息 + Member member = this.getByUserId(userId); + // 获取会员的总积分信息 + MemberTotal memberTotal = memberTotalService.getById(member.getMemberId()); + // 获取其他配置信息 + AppOtherConfigGetVo appOtherConfigGetVo = remoteConfigService.getAppOtherConfigGetVo().getData(); + // 创建一个空的积分任务列表 + List<AppIntegralTaskListVo> appIntegralTaskListVoList = new ArrayList<>(); + // 创建分享小程序任务 + AppIntegralTaskListVo shareTask = new AppIntegralTaskListVo(); + shareTask.setTaskContent("分享小程序给微信好友"); + shareTask.setTaskDesc("完成任务+" + appOtherConfigGetVo.getShareIntegral() + "积分"); + shareTask.setRecommendFlag(1); + shareTask.setCompleteFlag(memberTotal.getShareFlag()); + appIntegralTaskListVoList.add(shareTask); + // 创建提交平台建议任务 + AppIntegralTaskListVo plSuggestTask = new AppIntegralTaskListVo(); + plSuggestTask.setTaskContent("提交平台建议"); + plSuggestTask.setTaskDesc("完成任务+" + appOtherConfigGetVo.getSuggestPlatformIntegral() + "积分"); + plSuggestTask.setRecommendFlag(1); + plSuggestTask.setCompleteFlag(memberTotal.getPlSuggestFlag()); + appIntegralTaskListVoList.add(plSuggestTask); + // 创建提交门店建议任务 + AppIntegralTaskListVo shopSuggestTask = new AppIntegralTaskListVo(); + shopSuggestTask.setTaskContent("提交门店建议"); + shopSuggestTask.setTaskDesc("完成任务+" + appOtherConfigGetVo.getSuggestShopIntegral() + "积分"); + shopSuggestTask.setRecommendFlag(1); + shopSuggestTask.setCompleteFlag(memberTotal.getShopSuggestFlag()); + appIntegralTaskListVoList.add(shopSuggestTask); + // 创建每日签到任务 + AppIntegralTaskListVo signTask = new AppIntegralTaskListVo(); + signTask.setTaskContent("每日签到"); + signTask.setTaskDesc("完成任务+" + appOtherConfigGetVo.getSignInIntegral() + "积分"); + signTask.setRecommendFlag(1); + signTask.setCompleteFlag(memberTotal.getSignFlag()); + appIntegralTaskListVoList.add(signTask); + // 创建消费得积分任务 + AppIntegralTaskListVo buyTask = new AppIntegralTaskListVo(); + buyTask.setTaskContent("消费得积分"); + buyTask.setTaskDesc("每消费1元+" + appOtherConfigGetVo.getPayMoneyIntegral() + "积分"); + buyTask.setRecommendFlag(1); + buyTask.setCompleteFlag(memberTotal.getBuyFlag()); + appIntegralTaskListVoList.add(buyTask); + // 返回积分任务列表 + return appIntegralTaskListVoList; + } + + /** + * @description 积分变动 + * @author jqs + * @date 2023/7/12 15:59 + * @param integralChangeDto + * @return void + */ + @Override + public Boolean changeIntegral(IntegralChangeDto integralChangeDto){ + Member member = this.getByUserId(integralChangeDto.getUserId()); + Integer integralType = integralChangeDto.getIntegralType(); + Integer changeIntegral = integralChangeDto.getChangeIntegral(); + MemberTotal memberTotal = memberTotalService.getById(member.getMemberId()); + Boolean completeFlag = false; + switch(integralType){ + case 1: + if(memberTotal.getShareFlag()==1){ + completeFlag = true; + } + break; + case 2: + if(memberTotal.getPlSuggestFlag()==1){ + completeFlag = true; + } + break; + case 3: + if(memberTotal.getShopSuggestFlag()==1){ + completeFlag = true; + } + break; + case 4: + if(memberTotal.getSignFlag()==1){ + completeFlag = true; + } + break; + default: + break; + } + if(completeFlag){ + return completeFlag; + } + AppOtherConfigGetVo appOtherConfigGetVo = remoteConfigService.getAppOtherConfigGetVo().getData(); + IntegralRecord integralRecord = new IntegralRecord(); + integralRecord.setDelFlag(0); + integralRecord.setUserId(integralChangeDto.getUserId()); + integralRecord.setChangeType(integralType); + integralRecord.setCreateTime(new Date()); + //1分享获取2平台建议获取3门店建议获取4每日签到5消费得积分 + switch(integralType){ + case 1: + changeIntegral = appOtherConfigGetVo.getShareIntegral(); + integralRecord.setChangeIntegral(changeIntegral); + integralRecord.setSurpIntegral(integralRecord.getSurpIntegral()+changeIntegral); + integralRecord.setChangeReason("每日任务【分享小程序】获得积分"); + memberTotal.setTotalIntegral(memberTotal.getTotalIntegral()+changeIntegral); + memberTotal.setUseableIntegral(memberTotal.getUseableIntegral()+changeIntegral); + memberTotal.setShareFlag(1); + break; + case 2: + changeIntegral = appOtherConfigGetVo.getSuggestPlatformIntegral(); + integralRecord.setChangeIntegral(changeIntegral); + integralRecord.setSurpIntegral(integralRecord.getSurpIntegral()+changeIntegral); + integralRecord.setChangeReason("每日任务【提交平台建议】获得积分"); + memberTotal.setTotalIntegral(memberTotal.getTotalIntegral()+changeIntegral); + memberTotal.setUseableIntegral(memberTotal.getUseableIntegral()+changeIntegral); + memberTotal.setPlSuggestFlag(1); + break; + case 3: + changeIntegral = appOtherConfigGetVo.getSuggestShopIntegral(); + integralRecord.setChangeIntegral(changeIntegral); + integralRecord.setSurpIntegral(integralRecord.getSurpIntegral()+changeIntegral); + integralRecord.setChangeReason("每日任务【提交门店建议】获得积分"); + memberTotal.setTotalIntegral(memberTotal.getTotalIntegral()+changeIntegral); + memberTotal.setUseableIntegral(memberTotal.getUseableIntegral()+changeIntegral); + memberTotal.setShopSuggestFlag(1); + break; + case 4: + changeIntegral = appOtherConfigGetVo.getSignInIntegral(); + integralRecord.setChangeIntegral(changeIntegral); + integralRecord.setSurpIntegral(integralRecord.getSurpIntegral()+changeIntegral); + integralRecord.setChangeReason("每日任务【签到】获得积分"); + memberTotal.setTotalIntegral(memberTotal.getTotalIntegral()+changeIntegral); + memberTotal.setUseableIntegral(memberTotal.getUseableIntegral()+changeIntegral); + memberTotal.setSignFlag(1); + break; + case 5: + integralRecord.setChangeIntegral(changeIntegral); + integralRecord.setSurpIntegral(integralRecord.getSurpIntegral()+changeIntegral); + integralRecord.setChangeReason("订单【"+integralChangeDto.getOrderNo()+"】获得积分"); + integralRecord.setOrderId(integralChangeDto.getOrderId()); + integralRecord.setOrderNo(integralChangeDto.getOrderNo()); + memberTotal.setTotalIntegral(memberTotal.getTotalIntegral()+changeIntegral); + memberTotal.setUseableIntegral(memberTotal.getUseableIntegral()+changeIntegral); + memberTotal.setBuyFlag(1); + break; + default: + break; + } + memberTotalService.saveOrUpdate(memberTotal); + integralRecordService.saveOrUpdate(integralRecord); + return completeFlag; + } + + /** + * @description 统计商户今日新增会员 + * @author jqs + * @date 2023/7/14 19:54 + * @param shopIdList + * @return Integer + */ + @Override + public Integer getAreaNewMember(List<Long> shopIdList){ + return memberMapper.getAreaNewMember(shopIdList); + } } -- Gitblit v1.7.1