From 0af329d7210a84c97ec071735a2d0d1d7b0b785c Mon Sep 17 00:00:00 2001 From: zhanglin8526 <852614290@qq.com> Date: 星期六, 26 八月 2023 13:58:48 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/HongRuiTang --- ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 103 insertions(+), 9 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 71b248d..f559ea3 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 @@ -527,6 +527,7 @@ member.setBindingFlag(appMemberBindingDto.getBindingFlag()); member.setRelationShopId(appMemberBindingDto.getShopId()); member.setRelationShopName(appMemberBindingDto.getShopName()); + member.setBindingType(appMemberBindingDto.getBindingType()); this.saveOrUpdate(member); } @@ -659,6 +660,7 @@ member.setMiniOpenid(null); member.setBindingFlag(1); member.setBindingTime(new Date()); + member.setBindingType(6); // Get shop information and set it to the member Shop shop = remoteShopService.getShop(merMemberAddDto.getShopId()).getData(); member.setRelationShopName(shop.getShopName()); @@ -971,6 +973,7 @@ member.setRelationShopId(shop.getShopId()); member.setRelationShopName(shop.getShopName()); member.setBindingFlag(1); + member.setBindingType(7); member.setBindingTime(new Date()); member.setUpdateTime(new Date()); member.setUpdateUserId(mgtMemberRelEditDto.getUserId()); @@ -1239,6 +1242,9 @@ BigDecimal bigTen = new BigDecimal("100.00"); BigDecimal menPercent = new BigDecimal("100.00"); BigDecimal womenPercent = new BigDecimal("100.00"); + if(personTotal==0){ + personTotalBig = bigTen; + } if(manTotal==0&&womenTotal==0){ menPercent = new BigDecimal("50.00"); womenPercent = new BigDecimal("50.00"); @@ -1249,7 +1255,7 @@ menPercent = new BigDecimal("100.00"); womenPercent = new BigDecimal("0.00"); }else{ - menPercent = manTotalBig.divide(personTotalBig).setScale(0,BigDecimal.ROUND_HALF_UP); + menPercent = manTotalBig.divide(personTotalBig,2,BigDecimal.ROUND_HALF_UP); womenPercent = bigTen.subtract(menPercent); } mgtTotalMemberTotalVo.setManPercent(menPercent); @@ -1258,6 +1264,18 @@ String[] ageKey = {"<20", "21-30", "31-40", "41-50", ">50"}; // 不同年龄段的会员数数组 Integer[] ageValue = {mgtAgeTotalVo.getTenAge(), mgtAgeTotalVo.getTwentyAge(), mgtAgeTotalVo.getThirtyAge(), mgtAgeTotalVo.getFortyAge(), mgtAgeTotalVo.getFiftyAge()}; + BigDecimal[] agePercentValue = new BigDecimal[5]; + Integer totalPerson = mgtAgeTotalVo.getTenAge()+mgtAgeTotalVo.getTwentyAge()+ mgtAgeTotalVo.getThirtyAge()+mgtAgeTotalVo.getFortyAge()+mgtAgeTotalVo.getFiftyAge(); + BigDecimal totalPersonBig = new BigDecimal(totalPerson.toString()); + BigDecimal hundredBig = new BigDecimal("100"); + if(totalPerson==0){ + totalPersonBig = hundredBig; + } + agePercentValue[0] = new BigDecimal(mgtAgeTotalVo.getTenAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[1] = new BigDecimal(mgtAgeTotalVo.getTwentyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[2] = new BigDecimal(mgtAgeTotalVo.getThirtyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[3] = new BigDecimal(mgtAgeTotalVo.getFortyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[4] = new BigDecimal(mgtAgeTotalVo.getFiftyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); // 设置年龄段数组和不同年龄段的会员数数组 mgtTotalMemberTotalVo.setAgeKey(ageKey); mgtTotalMemberTotalVo.setAgeValue(ageValue); @@ -1359,20 +1377,55 @@ MgtPlTotalMemberTotalVo plTotalMemberTotalVo = memberMapper.getPlTotalMemberTotal(mgtBasePlatformDto); MgtAgeTotalVo mgtAgeTotalVo = memberMapper.getPlTotalMemberTotalAge(mgtBasePlatformDto); if (mgtAgeTotalVo != null) { - plTotalMemberTotalVo.setManTotal(mgtAgeTotalVo.getManTotal()); - plTotalMemberTotalVo.setWomenTotal(mgtAgeTotalVo.getWomenTotal()); - } else { - plTotalMemberTotalVo.setManTotal(0); - plTotalMemberTotalVo.setWomenTotal(0); + Integer manTotal = mgtAgeTotalVo.getManTotal(); + Integer womenTotal = mgtAgeTotalVo.getWomenTotal(); + Integer personTotal = manTotal + womenTotal; + BigDecimal manTotalBig = new BigDecimal(manTotal); + BigDecimal personTotalBig = new BigDecimal(personTotal); + BigDecimal bigTen = new BigDecimal("100.00"); + BigDecimal menPercent = new BigDecimal("100.00"); + BigDecimal womenPercent = new BigDecimal("100.00"); + if(personTotal==0){ + personTotalBig = bigTen; + } + if(manTotal==0&&womenTotal==0){ + menPercent = new BigDecimal("50.00"); + womenPercent = new BigDecimal("50.00"); + }else if(manTotal==0&&womenTotal>0){ + menPercent = new BigDecimal("0.00"); + womenPercent = new BigDecimal("100.00"); + }else if(manTotal>0&&womenTotal==0){ + menPercent = new BigDecimal("100.00"); + womenPercent = new BigDecimal("0.00"); + }else{ + menPercent = manTotalBig.divide(personTotalBig,2,BigDecimal.ROUND_HALF_UP); + womenPercent = bigTen.subtract(menPercent); + } + plTotalMemberTotalVo.setManTotal(manTotal); + plTotalMemberTotalVo.setWomenTotal(womenTotal); + plTotalMemberTotalVo.setManPercent(menPercent); + plTotalMemberTotalVo.setWomenPercent(womenPercent); } - // 年龄段数组 String[] ageKey = {"<20", "21-30", "31-40", "41-50", ">50"}; // 不同年龄段的会员数数组 Integer[] ageValue = {mgtAgeTotalVo.getTenAge(), mgtAgeTotalVo.getTwentyAge(), mgtAgeTotalVo.getThirtyAge(), mgtAgeTotalVo.getFortyAge(), mgtAgeTotalVo.getFiftyAge()}; + BigDecimal[] agePercentValue = new BigDecimal[5]; + Integer totalPerson = mgtAgeTotalVo.getTenAge()+mgtAgeTotalVo.getTwentyAge()+ mgtAgeTotalVo.getThirtyAge()+mgtAgeTotalVo.getFortyAge()+mgtAgeTotalVo.getFiftyAge(); + BigDecimal totalPersonBig = new BigDecimal(totalPerson.toString()); + BigDecimal hundredBig = new BigDecimal("100"); + if(totalPerson==0){ + totalPersonBig = hundredBig; + } + agePercentValue[0] = new BigDecimal(mgtAgeTotalVo.getTenAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[1] = new BigDecimal(mgtAgeTotalVo.getTwentyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[2] = new BigDecimal(mgtAgeTotalVo.getThirtyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[3] = new BigDecimal(mgtAgeTotalVo.getFortyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[4] = new BigDecimal(mgtAgeTotalVo.getFiftyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); // 设置年龄段数组和不同年龄段的会员数数组 plTotalMemberTotalVo.setAgeKey(ageKey); plTotalMemberTotalVo.setAgeValue(ageValue); + plTotalMemberTotalVo.setAgePercent(agePercentValue); // 获取不同调理类型的会员数 List<MgtMapIntTotalVo> nurseTotalVos = memberMapper.getPlTotalMemberTotalNurse(mgtBasePlatformDto); if (nurseTotalVos != null && nurseTotalVos.size() > 0) { @@ -1489,6 +1542,18 @@ String[] ageKey = {"<20", "21-30", "31-40", "41-50", ">50"}; // 不同年龄段的会员数数组 Integer[] ageValue = {mgtAgeTotalVo.getTenAge(), mgtAgeTotalVo.getTwentyAge(), mgtAgeTotalVo.getThirtyAge(), mgtAgeTotalVo.getFortyAge(), mgtAgeTotalVo.getFiftyAge()}; + BigDecimal[] agePercentValue = new BigDecimal[5]; + Integer totalPerson = mgtAgeTotalVo.getTenAge()+mgtAgeTotalVo.getTwentyAge()+ mgtAgeTotalVo.getThirtyAge()+mgtAgeTotalVo.getFortyAge()+mgtAgeTotalVo.getFiftyAge(); + BigDecimal totalPersonBig = new BigDecimal(totalPerson.toString()); + BigDecimal hundredBig = new BigDecimal("100"); + if(totalPerson==0){ + totalPersonBig = hundredBig; + } + agePercentValue[0] = new BigDecimal(mgtAgeTotalVo.getTenAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[1] = new BigDecimal(mgtAgeTotalVo.getTwentyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[2] = new BigDecimal(mgtAgeTotalVo.getThirtyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[3] = new BigDecimal(mgtAgeTotalVo.getFortyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[4] = new BigDecimal(mgtAgeTotalVo.getFiftyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); // 设置年龄段数组和不同年龄段的会员数数组 mgtShopTotalMemberVo.setAgeKey(ageKey); mgtShopTotalMemberVo.setAgeValue(ageValue); @@ -1626,6 +1691,9 @@ BigDecimal bigTen = new BigDecimal("100.00"); BigDecimal menPercent = new BigDecimal("100.00"); BigDecimal womenPercent = new BigDecimal("100.00"); + if(personTotal==0){ + personTotalBig = bigTen; + } if(manTotal==0&&womenTotal==0){ menPercent = new BigDecimal("50.00"); womenPercent = new BigDecimal("50.00"); @@ -1636,7 +1704,7 @@ menPercent = new BigDecimal("100.00"); womenPercent = new BigDecimal("0.00"); }else{ - menPercent = manTotalBig.divide(personTotalBig,0,BigDecimal.ROUND_HALF_UP); + menPercent = manTotalBig.divide(personTotalBig,2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); womenPercent = bigTen.subtract(menPercent); } memberFixedTotalVo.setManPercent(menPercent); @@ -1645,9 +1713,22 @@ String[] ageKey = {"<20", "21-30", "31-40", "41-50", ">50"}; // 不同年龄段的会员数数组 Integer[] ageValue = {mgtAgeTotalVo.getTenAge(), mgtAgeTotalVo.getTwentyAge(), mgtAgeTotalVo.getThirtyAge(), mgtAgeTotalVo.getFortyAge(), mgtAgeTotalVo.getFiftyAge()}; + BigDecimal[] agePercentValue = new BigDecimal[5]; + Integer totalPerson = mgtAgeTotalVo.getTenAge()+mgtAgeTotalVo.getTwentyAge()+ mgtAgeTotalVo.getThirtyAge()+mgtAgeTotalVo.getFortyAge()+mgtAgeTotalVo.getFiftyAge(); + BigDecimal totalPersonBig = new BigDecimal(totalPerson.toString()); + BigDecimal hundredBig = new BigDecimal("100"); + if(totalPerson==0){ + totalPersonBig = hundredBig; + } + agePercentValue[0] = new BigDecimal(mgtAgeTotalVo.getTenAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[1] = new BigDecimal(mgtAgeTotalVo.getTwentyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[2] = new BigDecimal(mgtAgeTotalVo.getThirtyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[3] = new BigDecimal(mgtAgeTotalVo.getFortyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); + agePercentValue[4] = new BigDecimal(mgtAgeTotalVo.getFiftyAge().toString()).divide(totalPersonBig,2,BigDecimal.ROUND_HALF_UP).multiply(hundredBig); // 设置年龄段数组和不同年龄段的会员数数组 memberFixedTotalVo.setAgeKey(ageKey); memberFixedTotalVo.setAgeValue(ageValue); + memberFixedTotalVo.setAgePercentValue(agePercentValue); // 获取不同护理类型的会员数 List<MgtMapIntTotalVo> nurseTotalVos = memberMapper.getMerMemberTotalNurse(merTotalDto); if (nurseTotalVos != null && nurseTotalVos.size() > 0) { @@ -1790,7 +1871,20 @@ orderAgeUserVoList.add(merOrderAgeUserVo); return orderAgeUserVoList; } - + /** + * @description 通过年龄层获取用户id列表 + * @author jqs + * @date 2023/8/23 18:59 + * @param ageType + * @return List<Long> + */ + @Override + public List<Long> listUserIdByAgeType(Integer ageType){ + MerTotalDto merTotalDto = new MerTotalDto(); + merTotalDto.setAgeType(ageType); + List<Long> userIdList = memberMapper.listOrderAgeUser(merTotalDto); + return userIdList; + } /** * @description * @author jqs -- Gitblit v1.7.1