From f0acb97e91f456c9b402977416e73951b708a157 Mon Sep 17 00:00:00 2001 From: jiangqs <343695869@qq.com> Date: 星期一, 19 六月 2023 23:23:23 +0800 Subject: [PATCH] 营销统计 --- ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 116 insertions(+), 1 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 8645b64..15affd3 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 @@ -102,6 +102,7 @@ @Resource private MemberArchiveService memberArchiveService; + /** * @description: TODO @@ -740,7 +741,7 @@ String memberUserIds = mgtMemberRelDelDto.getMemberUserIds(); String[] memberUserIdArr = memberUserIds.split(","); for(String str : memberUserIdArr) { - Member member = this.getById(Long.valueOf(str)); + Member member = this.getByUserId(Long.valueOf(str)); member.setBindingFlag(0); member.setUpdateTime(new Date()); member.setUpdateUserId(mgtMemberRelDelDto.getUserId()); @@ -929,4 +930,118 @@ } return mgtUserIdByKeywordVo; } + + /** + * @description boardMemberTotal + * @param + * @return MgtBulletinBoardVo + * @author jqs34 + * @date 2023/6/18 16:45 + */ + @Override + public MgtBulletinBoardVo boardMemberTotal(){ + MgtBulletinBoardVo mgtBulletinBoardVo = new MgtBulletinBoardVo(); + mgtBulletinBoardVo.setMemberTotal(memberMapper.memberTotal()); + mgtBulletinBoardVo.setMemberToday(memberMapper.memberToday()); + return mgtBulletinBoardVo; + } + + /** + * @description 会员人数统计 + * @author jqs + * @date 2023/6/19 15:26 + * @param + * @return MgtTotalMemberTotalVo + */ + @Override + public MgtTotalMemberTotalVo getTotalMemberTotal(MgtBaseShopDto mgtBaseShopDto){ + Date nowDay = DateUtils.getNowDate(); + // 获取店铺ID + Long shopId = mgtBaseShopDto.getShopId(); + // 获取总会员数和不同年龄段的会员数 + MgtTotalMemberTotalVo mgtTotalMemberTotalVo = memberMapper.getTotalMemberTotal(mgtBaseShopDto); + MgtAgeTotalVo mgtAgeTotalVo = memberMapper.getTotalMemberTotalAge(mgtBaseShopDto); + // 年龄段数组 + String[] ageKey = {"<20", "21-30", "31-40", "41-50", ">50"}; + // 不同年龄段的会员数数组 + Integer[] ageValue = {mgtAgeTotalVo.getTenAge(), mgtAgeTotalVo.getTwentyAge(), mgtAgeTotalVo.getThirtyAge(), mgtAgeTotalVo.getFortyAge(), mgtAgeTotalVo.getFiftyAge()}; + // 设置年龄段数组和不同年龄段的会员数数组 + mgtTotalMemberTotalVo.setAgeKey(ageKey); + mgtTotalMemberTotalVo.setAgeValue(ageValue); + // 获取不同护理类型的会员数 + List<MgtMapTotalVo> nurseTotalVos = memberMapper.getTotalMemberTotalNurse(mgtBaseShopDto); + if (nurseTotalVos != null && nurseTotalVos.size() > 0) { + String[] nurseKey = new String[nurseTotalVos.size()]; + Integer[] nurseValue = new Integer[nurseTotalVos.size()]; + // 遍历不同护理类型的会员数列表,设置护理类型数组和对应的会员数数组 + for (int i = 0; i < nurseTotalVos.size(); i++) { + nurseKey[i] = nurseTotalVos.get(i).getMapKey(); + nurseValue[i] = nurseTotalVos.get(i).getMapValue(); + } + mgtTotalMemberTotalVo.setNurseKey(nurseKey); + mgtTotalMemberTotalVo.setNurseValue(nurseValue); + } + // 获取不同商品类型的会员数 + List<MgtMapTotalVo> goodsTypeTotalVos = memberMapper.getTotalMemberTotalGoodsType(mgtBaseShopDto); + if (goodsTypeTotalVos != null && goodsTypeTotalVos.size() > 0) { + String[] goodsTypeKey = new String[goodsTypeTotalVos.size()]; + Integer[] goodsTypeValue = new Integer[goodsTypeTotalVos.size()]; + // 遍历不同商品类型的会员数列表,设置商品类型数组和对应的会员数数组 + for (int i = 0; i < goodsTypeTotalVos.size(); i++) { + goodsTypeKey[i] = goodsTypeTotalVos.get(i).getMapKey(); + goodsTypeValue[i] = goodsTypeTotalVos.get(i).getMapValue(); + } + mgtTotalMemberTotalVo.setGoodsTypeKey(goodsTypeKey); + mgtTotalMemberTotalVo.setGoodsTypeValue(goodsTypeValue); + } + // 获取不同活跃度的会员数 + List<Activeness> activenessList = remoteConfigService.listActiveness().getData(); + if (activenessList != null && !activenessList.isEmpty()) { + String[] activenessKey = new String[activenessList.size()]; + Integer[] activenessValue = new Integer[activenessList.size()]; + Activeness activeness; + String actStartDate; + String actEndDate; + Integer count; + // 遍历不同活跃度列表,设置活跃度数组和对应的会员数数组 + for (int i = 0; i < activenessList.size(); i++) { + activeness = activenessList.get(i); + actStartDate = DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.addDays(nowDay, activeness.getEndDay())); + actEndDate = DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.addDays(nowDay, activeness.getStartDay())); + count = memberMapper.getTotalMemberTotalActiveness(shopId, actStartDate, actEndDate); + activenessKey[i] = activeness.getActivenessName(); + activenessValue[i] = count; + } + mgtTotalMemberTotalVo.setActivenessKey(activenessKey); + mgtTotalMemberTotalVo.setActivenessValue(activenessValue); + } + //获取会员消费排名 + List<MgtMapTotalVo> memberPayList = memberMapper.getTotalMemberRankPay(mgtBaseShopDto); + if (memberPayList != null && memberPayList.size() > 0) { + String[] memberPayKey = new String[memberPayList.size()]; + Integer[] memberPayValue = new Integer[memberPayList.size()]; + // 遍历不同商品类型的会员数列表,设置商品类型数组和对应的会员数数组 + for (int i = 0; i < memberPayList.size(); i++) { + memberPayKey[i] = memberPayList.get(i).getMapKey(); + memberPayValue[i] = memberPayList.get(i).getMapValue(); + } + mgtTotalMemberTotalVo.setOrderRankKey(memberPayKey); + mgtTotalMemberTotalVo.setOrderRankValue(memberPayValue); + } + //获取来源渠道排名 + List<MgtMapTotalVo> customerSourceList = memberMapper.getTotalMemberRankCustomerSource(mgtBaseShopDto); + if (customerSourceList != null && customerSourceList.size() > 0) { + String[] customerSourceKey = new String[customerSourceList.size()]; + Integer[] customerSourceValue = new Integer[customerSourceList.size()]; + // 遍历不同商品类型的会员数列表,设置商品类型数组和对应的会员数数组 + for (int i = 0; i < customerSourceList.size(); i++) { + customerSourceKey[i] = customerSourceList.get(i).getMapKey(); + customerSourceValue[i] = customerSourceList.get(i).getMapValue(); + } + mgtTotalMemberTotalVo.setCustomerSourceKey(customerSourceKey); + mgtTotalMemberTotalVo.setCustomerSourceValue(customerSourceValue); + } + // 返回总会员数和不同类型会员数的统计结果 + return mgtTotalMemberTotalVo; + } } -- Gitblit v1.7.1