| | |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | import static org.apache.commons.lang3.StringUtils.capitalize; |
| | | import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.panzhihua.common.model.dtos.community.microCommercialStreet.BindUserPhoneDTO; |
| | | import com.panzhihua.common.model.vos.community.ComAreaTownCommunityVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidCheckRecordVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO; |
| | | import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.user.*; |
| | | import com.panzhihua.common.utlis.*; |
| | |
| | | private SysAppConfigDao sysAppConfigDao; |
| | | @Resource |
| | | private SysTemplateConfigDao sysTemplateConfigDao; |
| | | public static final Integer ALLCOUNTY=1; |
| | | public static final Integer ALLSTREET=2; |
| | | public static final Integer ALLCOMMUNITY=3; |
| | | public static final Integer BYSTREET=4; |
| | | @Resource |
| | | private ObjectMapper objectMapper; |
| | | private static final Integer ALLCOUNTY=1; |
| | | private static final Integer ALLSTREET=2; |
| | | private static final Integer ALLCOMMUNITY=3; |
| | | private static final Integer BYSTREET=4; |
| | | private static final Integer BYAREA=5; |
| | | private static final String OTHERUSER="其他用户"; |
| | | private static final String UPDATEACIDCHECKRECORD="修改排查数据"; |
| | | private static final String UPDATEACIDMEMBER="修改防疫工作人员信息"; |
| | | private static final String UPDATEACIDRECORD="修改防疫信息数据"; |
| | | |
| | | // @Resource |
| | | // private GridService gridService; |
| | |
| | | // String encode = new BCryptPasswordEncoder().encode("lbsq123456"); |
| | | // System.out.println(encode); |
| | | |
| | | List<Date> dates = new ArrayList<>(); |
| | | List<String> dates = new ArrayList<>(); |
| | | Date date = new Date(); |
| | | for (int i = 6; i >= 0; i--) { |
| | | for (int i = 19; i >= 0; i--) { |
| | | Date date1 = DateUtils.addDays(date, -i); |
| | | dates.add(date1); |
| | | dates.add(DateFormatUtils.format(date1,"MM-dd" )); |
| | | } |
| | | System.out.println(dates); |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public R addOperLog(SysOperLogVO operlog) { |
| | | //判断是否需要保存修改前的数据 |
| | | final Boolean flag=(operlog.getTitle().equals(UPDATEACIDCHECKRECORD) || operlog.getTitle().equals(UPDATEACIDMEMBER) |
| | | || operlog.getTitle().equals(UPDATEACIDRECORD)); |
| | | if (flag){ |
| | | //保存数据 |
| | | try { |
| | | operlog.setBeforeUpdateData(saveBeforeUpdateData(operlog)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | SysOperLogDO sysOperLogDO = new SysOperLogDO(); |
| | | BeanUtils.copyProperties(operlog, sysOperLogDO); |
| | | int insert = sysOperLogDAO.insert(sysOperLogDO); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R newIndexData(Integer type, Long streetId) { |
| | | public R checkExport(String account, String password,String oldPassword) { |
| | | if(new BCryptPasswordEncoder().matches(password, oldPassword)){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | public R newIndexData(Integer type, Long streetId,Long areaCode) { |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); |
| | | IndexDataAnalysisVO vo=new IndexDataAnalysisVO(); |
| | | if (ObjectUtils.isEmpty(type)){ |
| | |
| | | if (type.equals(ALLCOUNTY) || type.equals(ALLCOMMUNITY) || type.equals(ALLSTREET)){ |
| | | BeanUtils.copyProperties(indexDataKanbanVO,vo); |
| | | }else { |
| | | IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId); |
| | | IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId,areaCode,null); |
| | | BeanUtils.copyProperties(indexDataVO,vo); |
| | | } |
| | | List<UserProportion> userProportionsTotal = userDao.userAnalysis(type, null, streetId); |
| | | Integer streetUser = userDao.streetUserCount(streetId); |
| | | for (UserProportion userProportion : userProportionsTotal) { |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ |
| | | //计算占比 |
| | | //userProportion.setAreaCode(null); |
| | | if (type.equals(BYSTREET)){ |
| | | userProportion.setRate(getRate(streetUser,userProportion.getUser())); |
| | | } |
| | | userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); |
| | | } |
| | | } |
| | | } |
| | | List<UserProportion> userProportionsMonth = userDao.userAnalysis(type, DateUtil.beginOfMonth(new Date()).toString(), streetId); |
| | | for (UserProportion userProportion : userProportionsMonth) { |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ |
| | | //计算占比 |
| | | //userProportion.setAreaCode(null); |
| | | if (type.equals(BYSTREET)){ |
| | | userProportion.setRate(getRate(streetUser,userProportion.getUser())); |
| | | } |
| | | userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); |
| | | } |
| | | } |
| | | } |
| | | vo.setUserProportionTotal(userProportionsTotal); |
| | | vo.setUserProportionMonth(userProportionsMonth); |
| | | List<RealUser> realUsersTotal = userDao.realUserCount(type, null, streetId); |
| | | List<RealUser> realUsersMonth = userDao.realUserCount(type, DateUtil.beginOfMonth(new Date()).toString(), streetId); |
| | | vo.setRealUsersTotal(realUsersTotal); |
| | | vo.setRealUsersMonth(realUsersMonth); |
| | | vo.setRealUser(getStreetRealUser(realUsersTotal)); |
| | | vo.setRealUserRate(getRate(vo.getAllUser(),vo.getRealUser())); |
| | | vo.setUserActivityXAll(getTwentyDays()); |
| | | vo.setUserActivityXMonth(getMonthTwentyDays()); |
| | | List<String> addUserYAll=new ArrayList<>(); |
| | | List<String> addUserYMonth=new ArrayList<>(); |
| | | List<String> activeUserYAll=new ArrayList<>(); |
| | | List<String> activeUserYMonth=new ArrayList<>(); |
| | | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| | | //获取用户行为Y轴 |
| | | for (Date date : vo.getUserActivityXAll()) { |
| | | //查询当天的新增和日活 |
| | | Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId); |
| | | addUserYAll.add(map.get("addUser").toString()); |
| | | activeUserYAll.add(map.get("activeUser").toString()); |
| | | } |
| | | for (Date date : vo.getUserActivityXMonth()) { |
| | | Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId); |
| | | addUserYMonth.add(map.get("addUser").toString()); |
| | | activeUserYMonth.add(map.get("activeUser").toString()); |
| | | } |
| | | vo.setAddUserYAll(addUserYAll); |
| | | vo.setAddUserYWeek(addUserYMonth); |
| | | vo.setActiveUserYAll(activeUserYAll); |
| | | vo.setActiveUserYMonth(activeUserYMonth); |
| | | if (type.equals(BYSTREET) || type.equals(ALLCOMMUNITY) || type.equals(ALLSTREET)){ |
| | | //获取其他用户 |
| | | vo.setOtherUser(indexDataKanbanVO.getAllUser()-countUser(vo.getUserProportionTotal())); |
| | | vo.setOtherUserRate(getRate(indexDataKanbanVO.getAllUser(),vo.getOtherUser())); |
| | | } |
| | | // List<UserProportion> userProportionsTotal = userDao.userAnalysis(type, null, streetId,areaCode); |
| | | // Integer streetUser = userDao.streetUserCount(streetId,areaCode); |
| | | // for (UserProportion userProportion : userProportionsTotal) { |
| | | // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ |
| | | // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ |
| | | // //计算占比 |
| | | // //userProportion.setAreaCode(null); |
| | | // if (type.equals(BYSTREET)){ |
| | | // userProportion.setRate(getRate(streetUser,userProportion.getUser())); |
| | | // } |
| | | // userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); |
| | | // } |
| | | // } |
| | | // } |
| | | // List<UserProportion> userProportionsMonth = userDao.userAnalysis(type, DateUtil.beginOfMonth(new Date()).toString(), streetId,areaCode); |
| | | // for (UserProportion userProportion : userProportionsMonth) { |
| | | // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ |
| | | // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ |
| | | // //计算占比 |
| | | // //userProportion.setAreaCode(null); |
| | | // if (type.equals(BYSTREET)){ |
| | | // userProportion.setRate(getRate(streetUser,userProportion.getUser())); |
| | | // } |
| | | // userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); |
| | | // } |
| | | // } |
| | | // } |
| | | // vo.setUserProportionTotal(userProportionsTotal); |
| | | // vo.setUserProportionMonth(userProportionsMonth); |
| | | // List<RealUser> realUsersTotal = userDao.realUserCount(type, null, streetId,areaCode); |
| | | // List<RealUser> realUsersMonth = userDao.realUserCount(type, DateUtil.beginOfMonth(new Date()).toString(), streetId,areaCode); |
| | | // vo.setRealUsersTotal(realUsersTotal); |
| | | // vo.setRealUsersMonth(realUsersMonth); |
| | | // vo.setRealUser(getStreetRealUser(realUsersTotal)); |
| | | // vo.setRealUserRate(getRate(vo.getAllUser(),vo.getRealUser())); |
| | | // List<Date> twentyDays = getTwentyDays(); |
| | | // List<Date> monthTwentyDays = getMonthTwentyDays(); |
| | | // vo.setUserActivityXAll(getMAndD(getTwentyDays())); |
| | | // vo.setUserActivityXMonth(getMAndD(getMonthTwentyDays())); |
| | | // List<String> addUserYAll=new ArrayList<>(); |
| | | // List<String> addUserYMonth=new ArrayList<>(); |
| | | // List<String> activeUserYAll=new ArrayList<>(); |
| | | // List<String> activeUserYMonth=new ArrayList<>(); |
| | | // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| | | // //获取用户行为Y轴 |
| | | // for (Date date : twentyDays) { |
| | | // //查询当天的新增和日活 |
| | | // Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode); |
| | | // addUserYAll.add(map.get("addUser").toString()); |
| | | // activeUserYAll.add(map.get("activeUser").toString()); |
| | | // } |
| | | // for (Date date : monthTwentyDays) { |
| | | // Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode); |
| | | // addUserYMonth.add(map.get("addUser").toString()); |
| | | // activeUserYMonth.add(map.get("activeUser").toString()); |
| | | // } |
| | | // vo.setAddUserYAll(addUserYAll); |
| | | // vo.setAddUserYWeek(addUserYMonth); |
| | | // vo.setActiveUserYAll(activeUserYAll); |
| | | // vo.setActiveUserYMonth(activeUserYMonth); |
| | | // if (type.equals(BYSTREET) || type.equals(ALLCOMMUNITY) || type.equals(ALLSTREET)){ |
| | | // //获取其他用户 |
| | | // vo.setOtherUser(indexDataKanbanVO.getAllUser()-countUser(vo.getUserProportionTotal())); |
| | | // vo.setOtherUserRate(getRate(indexDataKanbanVO.getAllUser(),vo.getOtherUser())); |
| | | // } |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | @Override |
| | | public R userRate(Integer type, Long streetId, Long areaCode, Integer range) { |
| | | IndexDataAnalysisVO analysisVO=new IndexDataAnalysisVO(); |
| | | if (type.equals(BYSTREET) || type.equals(BYAREA)){ |
| | | //街道,区县筛选 |
| | | IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId,areaCode,null); |
| | | BeanUtils.copyProperties(indexDataVO,analysisVO ); |
| | | }else { |
| | | //总量数据 |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); |
| | | BeanUtils.copyProperties(indexDataKanbanVO,analysisVO ); |
| | | } |
| | | String date=""; |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ |
| | | if (range.equals(1)){ |
| | | DateTime dateTime = DateUtil.beginOfMonth(new Date()); |
| | | date = DateUtil.parse(dateTime.toString(), "yyyy-MM-dd HH:mm:ss").toString(); |
| | | } |
| | | } |
| | | List<UserProportion> userProportions = userDao.userAnalysis(type, date, streetId,areaCode); |
| | | List<UserRateAnalysisVO> userRateAnalysisVOList=new ArrayList<>(); |
| | | Boolean monthRange=false; |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ |
| | | if (range.equals(1)){ |
| | | monthRange=true; |
| | | } |
| | | } |
| | | if (userProportions.size()>0){ |
| | | for (UserProportion userProportion : userProportions) { |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ |
| | | UserRateAnalysisVO vo=new UserRateAnalysisVO(); |
| | | vo.setName(typeToName(type,userProportion )); |
| | | if (monthRange){ |
| | | //获取本月的用户总数作为计算占比的用户总数 |
| | | IndexDataKanbanVO data = userDao.dataKanBanStreet(streetId, areaCode, date); |
| | | vo.setRate(getRate(data.getAllUser(),userProportion.getUser())); |
| | | }else{ |
| | | vo.setRate(getRate(analysisVO.getAllUser(),userProportion.getUser())); |
| | | } |
| | | vo.setCount(userProportion.getUser()); |
| | | userRateAnalysisVOList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | if (ObjectUtils.isEmpty(range)){ |
| | | //查看累计数据时才计算其他用户的比例 |
| | | final Boolean flag=(type.equals(ALLSTREET) || type.equals(ALLCOMMUNITY) || type.equals(BYSTREET) || type.equals(BYAREA)); |
| | | if (flag){ |
| | | UserRateAnalysisVO vo=new UserRateAnalysisVO(); |
| | | vo.setName(OTHERUSER); |
| | | vo.setCount(analysisVO.getAllUser()-countUser(userRateAnalysisVOList)); |
| | | vo.setRate(getRate(analysisVO.getAllUser(), vo.getCount())); |
| | | userRateAnalysisVOList.add(vo); |
| | | } |
| | | } |
| | | //计算其他用户占比 |
| | | UserRateVO userRate=new UserRateVO(); |
| | | userRate.setUserList(userRateAnalysisVOList); |
| | | return R.ok(userRate); |
| | | } |
| | | |
| | | @Override |
| | | public R realUser(Integer type, Long streetId, Long areaCode, Integer range) { |
| | | IndexDataAnalysisVO analysisVO=new IndexDataAnalysisVO(); |
| | | if (type.equals(BYSTREET) || type.equals(BYAREA)){ |
| | | //街道,区县筛选 |
| | | IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId,areaCode,null); |
| | | BeanUtils.copyProperties(indexDataVO,analysisVO ); |
| | | }else { |
| | | //总量数据 |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); |
| | | BeanUtils.copyProperties(indexDataKanbanVO,analysisVO ); |
| | | } |
| | | String date=""; |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ |
| | | if (range.equals(1)){ |
| | | DateTime dateTime = DateUtil.beginOfMonth(new Date()); |
| | | date = DateUtil.parse(dateTime.toString(), "yyyy-MM-dd HH:mm:ss").toString(); |
| | | } |
| | | } |
| | | RealUserVO realUserVO=new RealUserVO(); |
| | | List<RealUser> realUsers = userDao.realUserCount(type, date, streetId, areaCode); |
| | | List<RealUserAnalysisVO> realUserList=new ArrayList<>(); |
| | | realUserVO.setRealUserCount(getStreetRealUser(realUsers)); |
| | | realUserVO.setRealUserRate(NumberUtil.div(realUserVO.getRealUserCount(), analysisVO.getAllUser()).doubleValue()); |
| | | for (RealUser realUser : realUsers) { |
| | | RealUserAnalysisVO vo=new RealUserAnalysisVO(); |
| | | vo.setCount(realUser.getCount()); |
| | | vo.setName(typeToNameRealUser(type, realUser)); |
| | | realUserList.add(vo); |
| | | } |
| | | realUserVO.setRealUserList(realUserList); |
| | | //使用索引迭代避免从列表移除数据后出现空指针异常 |
| | | if (type.equals(BYSTREET) || type.equals(ALLCOMMUNITY)){ |
| | | for (int i = 0; i < realUserList.size() ; i++) { |
| | | RealUserAnalysisVO realUserAnalysisVO = realUserList.get(i); |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(realUserAnalysisVO)){ |
| | | if (StringUtils.isNotEmpty(realUserAnalysisVO.getName())){ |
| | | if (realUserAnalysisVO.getName().equals("请选择社区")){ |
| | | realUserList.remove(i); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | //只保留十条 |
| | | if (realUserList.size()>=11){ |
| | | realUserList.remove(10); |
| | | } |
| | | } |
| | | return R.ok(realUserVO); |
| | | } |
| | | |
| | | @Override |
| | | public R userActivity(Integer type, Long streetId, Long areaCode, Integer range) { |
| | | UserActivityAnalysisVO vo=new UserActivityAnalysisVO(); |
| | | List<Date> activeX=getTwentyDays(); |
| | | List<String> activeY=new ArrayList<>(); |
| | | List<String> adY=new ArrayList<>(); |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ |
| | | if (range.equals(1)){ |
| | | //本月数据 |
| | | activeX = getMonthTwentyDays(); |
| | | } |
| | | } |
| | | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| | | for (Date date : activeX) { |
| | | Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode); |
| | | adY.add(map.get("addUser").toString()); |
| | | activeY.add(map.get("activeUser").toString()); |
| | | } |
| | | vo.setUserX(getMAndD(activeX)); |
| | | vo.setAddUserY(adY); |
| | | vo.setActiveUserY(activeY); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R uuPush(String washPhone,String phone,String washName,Integer orderStatus) { |
| | | if(StringUtils.isNotEmpty(phone)){ |
| | | SysUserDO sysUserDO=userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone,phone).orderByDesc(SysUserDO::getCreateAt).last("limit 1")); |
| | | if(sysUserDO!=null&&StringUtils.isNotEmpty(sysUserDO.getOpenid())){ |
| | | String status=""; |
| | | String accessToken=""; |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | try { |
| | | accessToken = util.getAccessToken(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | switch (orderStatus){ |
| | | case 3 : status="已分配车美"; |
| | | WxUtil.sendUuWash3(sysUserDO.getOpenid(),accessToken,status,washName,washPhone,phone,"sU18zbyzxFldHAdOREaQCR5uq_uMvCKTmGtklO1xw-w"); |
| | | break; |
| | | case 4 : status="车美已开始服务"; |
| | | WxUtil.sendUuWash4(sysUserDO.getOpenid(),accessToken,status,washName,washPhone,phone,"Eft5ksvsnOQANy2uNOGY43CC3pb33eDGA_lgCEoxuiw"); |
| | | break; |
| | | case 6 : status="订单确认完成"; |
| | | WxUtil.sendUuWash6(sysUserDO.getOpenid(),accessToken,status,washName,washPhone,phone,"k1aV97H3pDNNcNcDTeZBD9jQemNDADnRE801HhTXweI"); |
| | | break; |
| | | case 9 : status="订单已取消"; |
| | | WxUtil.sendUuWash(sysUserDO.getOpenid(),accessToken,status,washName,washPhone,phone,"9_2FhQPDxZoUqmAuIZ1L1zjjYXokdNvu7A0gzKfvruI"); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @Override |
| | | public R getAreaAndStreet() { |
| | | List<Integer> areaCodeList=areaCodeList(); |
| | | List<AreaVO> areaVOList=new ArrayList<>(); |
| | | for (Integer code : areaCodeList) { |
| | | AreaVO vo=new AreaVO(); |
| | | vo.setId(code); |
| | | vo.setName(areaCodeToName(code.longValue())); |
| | | vo.setStreetList(userDao.selectStreetByAreaCode(code)); |
| | | areaVOList.add(vo); |
| | | } |
| | | return R.ok(areaVOList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取最近20天数据 |
| | |
| | | /** |
| | | * 计算占比 |
| | | * */ |
| | | private Double getRate(Integer total,Integer count){ |
| | | private Integer getRate(Integer total,Integer count){ |
| | | if (0 != total && null != total){ |
| | | if (0 != count && null != count){ |
| | | BigDecimal div = NumberUtil.div(count.toString(), total.toString(),2); |
| | | return div.doubleValue(); |
| | | BigDecimal mul = NumberUtil.mul(div, 100); |
| | | return mul.intValue(); |
| | | } |
| | | } |
| | | return null; |
| | |
| | | /** |
| | | * 计算当前统计范围内的所有用户数 |
| | | * */ |
| | | public Integer countUser(List<UserProportion> list){ |
| | | public Integer countUser(List<UserRateAnalysisVO> list){ |
| | | Integer count=0; |
| | | if (list.size()>0){ |
| | | for (UserProportion proportion : list) { |
| | | for (UserRateAnalysisVO proportion : list) { |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion)){ |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion.getUser())){ |
| | | count+=proportion.getUser(); |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion.getCount())){ |
| | | count+=proportion.getCount(); |
| | | } |
| | | } |
| | | } |
| | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * 截取月,日 |
| | | * */ |
| | | public List<String> getMAndD(List<Date> list){ |
| | | List<String> dateList=new ArrayList<>(); |
| | | if (list.size()>0){ |
| | | for (Date date : list) { |
| | | dateList.add(DateFormatUtils.format(date,"MM-dd" )); |
| | | } |
| | | } |
| | | return dateList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * areaCode转区县名 |
| | | * */ |
| | | private String areaCodeToName(Long areaCode){ |
| | | String code = areaCode.toString(); |
| | | String name="不正确的areaCode"; |
| | | switch (code){ |
| | | case "510423" : |
| | | name= "西区"; |
| | | break; |
| | | case "510402": |
| | | name="东区"; |
| | | case "510411": |
| | | name="仁和区"; |
| | | break; |
| | | case "510421": |
| | | name="米易县"; |
| | | break; |
| | | case "510422": |
| | | name="盐边县"; |
| | | break; |
| | | } |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | *根据type选择要设置的名称 |
| | | * */ |
| | | private String typeToName(Integer type,UserProportion proportion){ |
| | | String name=""; |
| | | if (type.equals(ALLCOUNTY)){ |
| | | name=areaCodeToName(proportion.getAreaCode()); |
| | | }else if(type.equals(ALLSTREET) || type.equals(BYAREA)){ |
| | | name=proportion.getStreetName(); |
| | | }else if (type.equals(ALLCOMMUNITY) || type.equals(BYSTREET)){ |
| | | name=proportion.getCommunityName(); |
| | | } |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | *根据type选择要设置的名称 |
| | | * */ |
| | | private String typeToNameRealUser(Integer type,RealUser proportion){ |
| | | String name=""; |
| | | if (type.equals(ALLCOUNTY)){ |
| | | name=areaCodeToName(Long.parseLong(proportion.getAreaCode())); |
| | | }else if(type.equals(ALLSTREET) || type.equals(BYAREA)){ |
| | | name=proportion.getStreetName(); |
| | | }else if (type.equals(ALLCOMMUNITY) || type.equals(BYSTREET)){ |
| | | name=proportion.getCommunityName(); |
| | | } |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * 生成区县code列表 |
| | | * */ |
| | | private List<Integer> areaCodeList(){ |
| | | List<Integer> list=new ArrayList<>(); |
| | | list.add(510423); |
| | | list.add(510402); |
| | | list.add(510411); |
| | | list.add(510421); |
| | | list.add(510422); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 根据日志保存修改之前的信息 |
| | | * */ |
| | | private String saveBeforeUpdateData(SysOperLogVO operlog) throws JsonProcessingException { |
| | | if (operlog.getTitle().equals(UPDATEACIDCHECKRECORD)){ |
| | | // |
| | | ComActAcidCheckRecordVO comActAcidCheckRecordVO = objectMapper.readValue(operlog.getOperParam(), ComActAcidCheckRecordVO.class); |
| | | ComActAcidCheckRecordVO comActAcidCheckRecordVO1 = userDao.selectComActAcidCheckRecordById(comActAcidCheckRecordVO.getId()); |
| | | return JSONObject.toJSONString(comActAcidCheckRecordVO1); |
| | | }else if (operlog.getTitle().equals(UPDATEACIDRECORD)){ |
| | | ComActAcidRecordVO comActAcidRecordVO = objectMapper.readValue(operlog.getOperParam(), ComActAcidRecordVO.class); |
| | | return JSONObject.toJSONString(userDao.selectComActAcidRecord(comActAcidRecordVO.getId())); |
| | | }else if(operlog.getTitle().equals(UPDATEACIDMEMBER)){ |
| | | ComActAcidMemberVO comActAcidMemberVO = objectMapper.readValue(operlog.getOperParam(), ComActAcidMemberVO.class); |
| | | return JSONObject.toJSONString(userDao.selectComActAcidMember(comActAcidMemberVO.getId())); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |