| | |
| | | package com.matrix.system.hiveErp.action; |
| | | |
| | | import com.matrix.component.redis.RedisClient; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hiveErp.analysUtil.SeriesVo; |
| | | import com.matrix.system.hiveErp.analysUtil.StatisticsParamVo; |
| | | import com.matrix.system.hive.service.imp.DataAnalysisCustomerServiceImpl; |
| | | import com.matrix.system.hiveErp.analysUtil.*; |
| | | import com.matrix.system.hiveErp.dao.TjVipSumDao; |
| | | import com.matrix.system.hiveErp.analysUtil.StatisticsTimeUtil; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | @Autowired |
| | | SysShopInfoDao shopInfoDao; |
| | | |
| | | |
| | | @Autowired |
| | | DataAnalysisCustomerServiceImpl dataAnalysisCustomerService; |
| | | |
| | | /** |
| | | * 会员人头数统计 |
| | |
| | | * @param statisticsParam |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "customerHeadCompare") |
| | | public @ResponseBody AjaxResult vipVisitCompare(StatisticsParamVo statisticsParam) { |
| | | |
| | | AjaxResult result = new AjaxResult(); |
| | | |
| | | //根据计算横坐标 |
| | | List<Date> xAxis = StatisticsTimeUtil.getTimeSpace(statisticsParam.getBeginTime(), statisticsParam.getEndTime(), statisticsParam.getStatisticsUnit()); |
| | | |
| | | //获取所有门店 |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<SysShopInfo> shops= shopInfoDao.selectShopInfo(user.getCompanyId()); |
| | | |
| | | //定义数据项内容 |
| | | List<SeriesVo> series=new ArrayList<>(); |
| | | |
| | | //定义数据主体 |
| | | String[] legendData=new String[shops.size()]; |
| | | |
| | | int i=0; |
| | | |
| | | //按门店统计数据 |
| | | for(SysShopInfo shop: shops){ |
| | | |
| | | legendData[i++]=shop.getShopName(); |
| | | |
| | | SeriesVo storeInfoSeries=new SeriesVo(); |
| | | storeInfoSeries.setName(shop.getShopName()); |
| | | |
| | | //从员工业绩统计表中,按时间段,门店的维度统计人头数 |
| | | Map<String, Integer> yAxisMap = tjVipSumDao.countVisitByTime(StatisticsTimeUtil.buidParam(xAxis),shop.getId()); |
| | | |
| | | storeInfoSeries.setData(StatisticsTimeUtil.getSeries(yAxisMap)); |
| | | series.add(storeInfoSeries); |
| | | |
| | | } |
| | | //构造返回对象 |
| | | Map<Object,Object> data=new HashMap<>(); |
| | | data.put("legendData",legendData); |
| | | data.put("series",series); |
| | | data.put("xAxis", StatisticsTimeUtil.getFormartDateList(xAxis,statisticsParam)); |
| | | result.setMapInfo(data); |
| | | result.setStatus(AjaxResult.STATUS_SUCCESS); |
| | | return result; |
| | | @RequestMapping(value = "/customerHeadCompare") |
| | | public @ResponseBody AjaxResult customerHeadCompare(StatisticsParamVo statisticsParam) { |
| | | return dataAnalysisCustomerService.getAnalysisResult(statisticsParam, new Caculate<Integer>() { |
| | | @Override |
| | | public Map<String, Integer> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | //从员工业绩统计表中,按时间段,门店的维度统计人头数 |
| | | return tjVipSumDao.customerHeadCompare(timeSpaceParam,shopId); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 会员人次统计 |
| | | * 业务说明: |
| | | * 一个会员在一天进店一次或者多次即为一个人次 |
| | | * @param statisticsParam |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/customerEnterCountCompare") |
| | | public @ResponseBody AjaxResult customerEnterCountCompare(StatisticsParamVo statisticsParam) { |
| | | return dataAnalysisCustomerService.getAnalysisResult(statisticsParam, new Caculate<Integer>() { |
| | | @Override |
| | | public Map<String, Integer> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | //从员工业绩统计表中,按时间段,门店的维度统计人次 |
| | | return tjVipSumDao.customerEnterCountCompare(timeSpaceParam,shopId); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 到店率 |
| | | * 业务说明: |
| | | * 门店所有客户人次数除以人头数 |
| | | * @param statisticsParam |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/customerEnterRateCompare") |
| | | public @ResponseBody AjaxResult customerEnterRateCompare(StatisticsParamVo statisticsParam) { |
| | | return dataAnalysisCustomerService.getAnalysisResult(statisticsParam, new Caculate<Integer>() { |
| | | @Override |
| | | public Map<String, Integer> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | //从员工业绩统计表中,按时间段,门店的维度统计人次 |
| | | return tjVipSumDao.customerEnterRateCompare(timeSpaceParam,shopId); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |