| @@ -62,7 +62,6 @@ public class BaseController { | |||||
| /** | /** | ||||
| * 返回租户信息 | * 返回租户信息 | ||||
| * 集团版帐号tenantId为空,parentTenantId为集团tenantId | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| public TenantEntity getTenantInfo(){ | public TenantEntity getTenantInfo(){ | ||||
| @@ -696,6 +696,9 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| public ResultData getPayAccountInfo() { | public ResultData getPayAccountInfo() { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | ||||
| WxPayAccountBill payAccountBill = payAccountBillService.getByTenantInfo(getTenantInfo()); | WxPayAccountBill payAccountBill = payAccountBillService.getByTenantInfo(getTenantInfo()); | ||||
| if(payAccountBill == null){ | |||||
| return new ResultData(Result.ERROR,"未找到收款数据"); | |||||
| } | |||||
| Map<String, String> map = new HashMap<>(); | Map<String, String> map = new HashMap<>(); | ||||
| if(StringUtils.isNotBlank(payAccountBill.getBankAccountName()) && StringUtils.isNotBlank(payAccountBill.getBankCardId())) { | if(StringUtils.isNotBlank(payAccountBill.getBankAccountName()) && StringUtils.isNotBlank(payAccountBill.getBankCardId())) { | ||||
| map.put("bankAccountName", payAccountBill.getBankAccountName()); | map.put("bankAccountName", payAccountBill.getBankAccountName()); | ||||
| @@ -46,11 +46,6 @@ public class WxUserStatisticsController extends BaseController { | |||||
| plat = EnumAppPlat.WX.getCode(); | plat = EnumAppPlat.WX.getCode(); | ||||
| } | } | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||||
| //昨日同比 | //昨日同比 | ||||
| Map<String, Object> map = new HashMap<>(); | Map<String, Object> map = new HashMap<>(); | ||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | ||||
| @@ -99,11 +94,6 @@ public class WxUserStatisticsController extends BaseController { | |||||
| plat = EnumAppPlat.WX.getCode(); | plat = EnumAppPlat.WX.getCode(); | ||||
| } | } | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | ||||
| dto.updateTenantInfo(tenantEntity); | dto.updateTenantInfo(tenantEntity); | ||||
| @@ -307,11 +307,6 @@ public class WxUserStructureController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserCount"); | logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserCount"); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||||
| //昨日同比 | //昨日同比 | ||||
| Map<String, Object> map = new HashMap<>(); | Map<String, Object> map = new HashMap<>(); | ||||
| @@ -476,11 +471,6 @@ public class WxUserStructureController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserByChannel"); | logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserByChannel"); | ||||
| List<String> sceneList = null; | List<String> sceneList = null; | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||||
| wxCUser.updateTenantInfo(tenantEntity); | wxCUser.updateTenantInfo(tenantEntity); | ||||
| if (StringUtils.isNotBlank(wxCUser.getChannelName())) { | if (StringUtils.isNotBlank(wxCUser.getChannelName())) { | ||||
| WxUserChannel c = new WxUserChannel(); | WxUserChannel c = new WxUserChannel(); | ||||
| @@ -73,10 +73,6 @@ public class MarkingDataReportController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::findSceneDataList"); | logger.debug("[" + getIpAddr() + "] MarkingDataReportController::findSceneDataList"); | ||||
| if(StringUtils.isBlank(getTenantInfo().getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| return new ResultData(markingDataReportService.getSceneDataList(getTenantInfo(), markingCouponDataReportDto, pageNum, pageSize)); | return new ResultData(markingDataReportService.getSceneDataList(getTenantInfo(), markingCouponDataReportDto, pageNum, pageSize)); | ||||
| } | } | ||||
| @@ -34,10 +34,6 @@ public class WxMerchantMicroPayController extends BaseController { | |||||
| public ResultData listMonth() { | public ResultData listMonth() { | ||||
| logger.debug("[" + getIpAddr() + "] WxMerchantMicroPayController::listMonth"); | logger.debug("[" + getIpAddr() + "] WxMerchantMicroPayController::listMonth"); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| WxOrderReportDto wxOrderReportDto = new WxOrderReportDto(); | WxOrderReportDto wxOrderReportDto = new WxOrderReportDto(); | ||||
| wxOrderReportDto.updateTenantInfo(tenantEntity); | wxOrderReportDto.updateTenantInfo(tenantEntity); | ||||
| wxOrderReportDto.setType(EnumOrderType.MICROPAY.getCode()); | wxOrderReportDto.setType(EnumOrderType.MICROPAY.getCode()); | ||||
| @@ -52,10 +48,6 @@ public class WxMerchantMicroPayController extends BaseController { | |||||
| public ResultData detail(@RequestParam Long merchantId) { | public ResultData detail(@RequestParam Long merchantId) { | ||||
| logger.debug("[" + getIpAddr() + "] WxMerchantMicroPayController::detail"); | logger.debug("[" + getIpAddr() + "] WxMerchantMicroPayController::detail"); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| WxOrderReportDto wxOrderReportDto = new WxOrderReportDto(); | WxOrderReportDto wxOrderReportDto = new WxOrderReportDto(); | ||||
| wxOrderReportDto.updateTenantInfo(tenantEntity); | wxOrderReportDto.updateTenantInfo(tenantEntity); | ||||
| wxOrderReportDto.setMerchantId(merchantId); | wxOrderReportDto.setMerchantId(merchantId); | ||||
| @@ -68,10 +60,6 @@ public class WxMerchantMicroPayController extends BaseController { | |||||
| public ResultData listYesterday(@ModelAttribute WxOrderReportDto wxOrderReportDto, Integer pageNum, Integer pageSize) { | public ResultData listYesterday(@ModelAttribute WxOrderReportDto wxOrderReportDto, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listYesterday"); | logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listYesterday"); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| if (wxOrderReportDto == null) | if (wxOrderReportDto == null) | ||||
| wxOrderReportDto = new WxOrderReportDto(); | wxOrderReportDto = new WxOrderReportDto(); | ||||
| wxOrderReportDto.updateTenantInfo(tenantEntity); | wxOrderReportDto.updateTenantInfo(tenantEntity); | ||||
| @@ -61,11 +61,6 @@ public class WxCUserDataController extends BaseController { | |||||
| plat = EnumAppPlat.WX.getCode(); | plat = EnumAppPlat.WX.getCode(); | ||||
| } | } | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | ||||
| dto.updateTenantInfo(tenantEntity); | dto.updateTenantInfo(tenantEntity); | ||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| @@ -328,10 +323,6 @@ public class WxCUserDataController extends BaseController { | |||||
| public ResultData findUserAmountData() { | public ResultData findUserAmountData() { | ||||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAmountData"); | logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAmountData"); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| Date today = c.getTime(); | Date today = c.getTime(); | ||||
| c.add(Calendar.DAY_OF_YEAR, 1); | c.add(Calendar.DAY_OF_YEAR, 1); | ||||
| @@ -413,10 +404,6 @@ public class WxCUserDataController extends BaseController { | |||||
| public ResultData findUserConsumeAmount() { | public ResultData findUserConsumeAmount() { | ||||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserConsumeAmount"); | logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserConsumeAmount"); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||||
| //todo 集团版查询数据待重构 | |||||
| return new ResultData("集团版查询数据待重构"); | |||||
| } | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| c.set(Calendar.HOUR_OF_DAY, 0); | c.set(Calendar.HOUR_OF_DAY, 0); | ||||
| c.set(Calendar.MINUTE, 0); | c.set(Calendar.MINUTE, 0); | ||||
| @@ -233,9 +233,6 @@ public class HomeController extends BaseController { | |||||
| if (StringUtils.isNotBlank(subTenantId)) { | if (StringUtils.isNotBlank(subTenantId)) { | ||||
| session.setAttribute(UserSession.tenantId, subTenantId); | session.setAttribute(UserSession.tenantId, subTenantId); | ||||
| session.setAttribute(UserSession.parentTenantId, tenantId); | session.setAttribute(UserSession.parentTenantId, tenantId); | ||||
| } else { | |||||
| session.setAttribute(UserSession.tenantId, null); | |||||
| session.setAttribute(UserSession.parentTenantId, tenantId); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -1,6 +1,5 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.iformall.annotation.AuthIgnore; | import com.iformall.annotation.AuthIgnore; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| @@ -5,10 +5,13 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | import com.iformall.domain.dto.WxCUserBasicInfoDto; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumAppPlat; | |||||
| import com.iformall.enums.EnumCarCmd; | import com.iformall.enums.EnumCarCmd; | ||||
| import com.iformall.enums.EnumChartType; | import com.iformall.enums.EnumChartType; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxCUserCarService; | import com.iformall.service.WxCUserCarService; | ||||
| import com.iformall.service.cuser.CUserServiceFactory; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -53,6 +56,12 @@ public class ChartDataSchedule { | |||||
| @Autowired | @Autowired | ||||
| WxCUserCarService wxCUserCarService; | WxCUserCarService wxCUserCarService; | ||||
| @Autowired | |||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Autowired | |||||
| private CUserServiceFactory cuserFactory; | |||||
| /** | /** | ||||
| * 每天7点执行 | * 每天7点执行 | ||||
| @@ -60,21 +69,75 @@ public class ChartDataSchedule { | |||||
| @Async | @Async | ||||
| @Scheduled(cron = "0 0 7 * * ?") | @Scheduled(cron = "0 0 7 * * ?") | ||||
| public void createData() { | public void createData() { | ||||
| createUserData(); | |||||
| createCarData(); | createCarData(); | ||||
| createSaleData(); | createSaleData(); | ||||
| createMerchantTradeData(); | createMerchantTradeData(); | ||||
| } | } | ||||
| /** | |||||
| * 微信新增用户、抖音新增用户、ali新增用户,新增会员 | |||||
| */ | |||||
| public void createUserData() { | |||||
| Date createtime = new Date(); | |||||
| String yesterday = DateUtils.getTimeBefore(1, createtime); | |||||
| Date date = DateUtils.stringToDate(yesterday); | |||||
| String today = DateUtils.getSystemTime("yyyy-MM-dd"); | |||||
| Date endDate = DateUtils.stringToDate(today); | |||||
| WxChartDataEntity wxChartDataEntity = new WxChartDataEntity(); | |||||
| wxChartDataEntity.setQuerytime(date); | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||||
| dto.setStartTime(date); | |||||
| dto.setEndTime(endDate); | |||||
| List<WxMall> wxMalls = wxMallMapper.findList(null); | |||||
| for (WxMall wxMall : wxMalls) { | |||||
| TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||||
| dto.updateTenantInfo(tenantEntity); | |||||
| wxChartDataEntity.updateTenantInfo(tenantEntity); | |||||
| wxChartDataEntity.setType(EnumChartType.WX_USER.getCode()); | |||||
| int count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | |||||
| if (count == 0) { | |||||
| logger.info("微信用户数>>>>>>>>>>>>>>>>>>>>>>>>>>"); | |||||
| long wxUserCount = cuserFactory.getCUserService(EnumAppPlat.WX).findCount(dto); | |||||
| addChartData(tenantEntity, String.valueOf(wxUserCount), EnumChartType.WX_USER.getCode(), date, createtime); | |||||
| } | |||||
| wxChartDataEntity.setType(EnumChartType.TT_USER.getCode()); | |||||
| count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | |||||
| if (count == 0) { | |||||
| logger.info("抖音用户数>>>>>>>>>>>>>>>>>>>>>>>>>>"); | |||||
| long ttUserCount = cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).findCount(dto); | |||||
| addChartData(tenantEntity, String.valueOf(ttUserCount), EnumChartType.TT_USER.getCode(), date, createtime); | |||||
| } | |||||
| // wxChartDataEntity.setType(EnumChartType.ALI_USER.getCode()); | |||||
| // count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | |||||
| // if (count == 0) { | |||||
| // logger.info("支付宝用户>>>>>>>>>>>>>>>>>>>>>>>>>>"); | |||||
| // } | |||||
| wxChartDataEntity.setType(EnumChartType.BASIC_USER.getCode()); | |||||
| count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | |||||
| if (count == 0) { | |||||
| logger.info("会员数>>>>>>>>>>>>>>>>>>>>>>>>>>"); | |||||
| long basicUserCount = wxCUserBasicInfoService.findCount(dto); | |||||
| addChartData(tenantEntity, String.valueOf(basicUserCount), EnumChartType.BASIC_USER.getCode(), date, createtime); | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * 出场车辆、缴费车辆、缴费金额、新增会员、新增停车会员、已绑车辆 | * 出场车辆、缴费车辆、缴费金额、新增会员、新增停车会员、已绑车辆 | ||||
| */ | */ | ||||
| public void createCarData() { | public void createCarData() { | ||||
| HashMap<String, Object> params = new HashMap<>(); | HashMap<String, Object> params = new HashMap<>(); | ||||
| Date createtime = new Date(); | Date createtime = new Date(); | ||||
| String startdate = DateUtils.getTimeBefore(1, createtime); | |||||
| Date date = DateUtils.stringToDate(startdate); | |||||
| params.put("startdate", startdate + " 00:00:00"); | |||||
| params.put("enddate", startdate + " 23:59:59"); | |||||
| String yesterday = DateUtils.getTimeBefore(1, createtime); | |||||
| Date date = DateUtils.stringToDate(yesterday); | |||||
| String today = DateUtils.getSystemTime("yyyy-MM-dd"); | |||||
| Date endDate = DateUtils.stringToDate(today); | |||||
| params.put("startdate", yesterday + " 00:00:00"); | |||||
| params.put("enddate", today + " 00:00:00"); | |||||
| WxChartDataEntity wxChartDataEntity = new WxChartDataEntity(); | WxChartDataEntity wxChartDataEntity = new WxChartDataEntity(); | ||||
| wxChartDataEntity.setQuerytime(date); | wxChartDataEntity.setQuerytime(date); | ||||
| @@ -90,28 +153,32 @@ public class ChartDataSchedule { | |||||
| if (count == 0) { | if (count == 0) { | ||||
| logger.info("入场车数>>>>>>>>>>>>>>>>>>>>>>>>>>"); | logger.info("入场车数>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||||
| params.put("cmdTypes",EnumCarCmd.getCarIn()); | params.put("cmdTypes",EnumCarCmd.getCarIn()); | ||||
| carInData(params, createtime, date, tenantEntity); | |||||
| Long carOutCount = wxCarCmdLogMapper.queryHistoryCount(params); | |||||
| addChartData(tenantEntity, carOutCount.toString(), EnumChartType.CAR_IN.getCode(), date, createtime); | |||||
| } | } | ||||
| wxChartDataEntity.setType(EnumChartType.CAR_OUT.getCode()); | wxChartDataEntity.setType(EnumChartType.CAR_OUT.getCode()); | ||||
| count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | ||||
| if (count == 0) { | if (count == 0) { | ||||
| logger.info("出场车数>>>>>>>>>>>>>>>>>>>>>>>>>>"); | logger.info("出场车数>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||||
| params.put("cmdTypes",EnumCarCmd.getCarOut()); | params.put("cmdTypes",EnumCarCmd.getCarOut()); | ||||
| carOutData(params, createtime, date, tenantEntity); | |||||
| Long carOutCount = wxCarCmdLogMapper.queryHistoryCount(params); | |||||
| addChartData(tenantEntity, carOutCount.toString(), EnumChartType.CAR_OUT.getCode(), date, createtime); | |||||
| } | } | ||||
| wxChartDataEntity.setType(EnumChartType.CAR_PAID.getCode()); | wxChartDataEntity.setType(EnumChartType.CAR_PAID.getCode()); | ||||
| count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | ||||
| if (count == 0) { | if (count == 0) { | ||||
| logger.info("缴费车辆>>>>>>>>>>>>>>>>>>>>>>>>>>"); | logger.info("缴费车辆>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||||
| params.put("cmdTypes", EnumCarCmd.getCarPay()); | params.put("cmdTypes", EnumCarCmd.getCarPay()); | ||||
| carPaidData(params, createtime, date, tenantEntity); | |||||
| Long carPayFeeCount = wxCarCmdLogMapper.queryHistoryCount(params); | |||||
| addChartData(tenantEntity, carPayFeeCount.toString(), EnumChartType.CAR_PAID.getCode(), date, createtime); | |||||
| } | } | ||||
| wxChartDataEntity.setType(EnumChartType.CAR_PAY_FEE.getCode()); | wxChartDataEntity.setType(EnumChartType.CAR_PAY_FEE.getCode()); | ||||
| count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | ||||
| if (count == 0) { | if (count == 0) { | ||||
| logger.info("缴费金额>>>>>>>>>>>>>>>>>>>>>>>>>>"); | logger.info("缴费金额>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||||
| params.put("cmdTypes", EnumCarCmd.getCarPay()); | params.put("cmdTypes", EnumCarCmd.getCarPay()); | ||||
| carPayFeeData(params, createtime, date, tenantEntity); | |||||
| BigDecimal fee = wxCarCmdLogMapper.queryCarPay(params); | |||||
| addChartData(tenantEntity, fee.toString(), EnumChartType.CAR_PAY_FEE.getCode(), date, createtime); | |||||
| } | } | ||||
| // wxChartDataEntity.setType(EnumChartType.CAR_MEMBER.getCode()); | // wxChartDataEntity.setType(EnumChartType.CAR_MEMBER.getCode()); | ||||
| // count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | // count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | ||||
| @@ -123,13 +190,19 @@ public class ChartDataSchedule { | |||||
| count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | ||||
| if (count == 0) { | if (count == 0) { | ||||
| logger.info("新增停车会员>>>>>>>>>>>>>>>>>>>>>>>>>>"); | logger.info("新增停车会员>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||||
| carNewMemberData(createtime, date, tenantEntity); | |||||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto(); | |||||
| wxCUserBasicInfoDto.updateTenantInfo(tenantEntity); | |||||
| wxCUserBasicInfoDto.setStartTime(date); | |||||
| wxCUserBasicInfoDto.setEndTime(endDate); | |||||
| Integer carUserCount = wxCUserCarService.countUser(wxCUserBasicInfoDto); | |||||
| addChartData(tenantEntity, carUserCount.toString(), EnumChartType.CAR_NEW_MEMBER.getCode(), date, createtime); | |||||
| } | } | ||||
| wxChartDataEntity.setType(EnumChartType.CAR_BIND.getCode()); | wxChartDataEntity.setType(EnumChartType.CAR_BIND.getCode()); | ||||
| count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | ||||
| if (count == 0) { | if (count == 0) { | ||||
| logger.info("已绑车辆>>>>>>>>>>>>>>>>>>>>>>>>>>"); | logger.info("已绑车辆>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||||
| carBindData(params, createtime, date, tenantEntity); | |||||
| Long todaybindcar = wxCUserCarMapper.queryCarCount(params); | |||||
| addChartData(tenantEntity, todaybindcar.toString(), EnumChartType.CAR_BIND.getCode(), date, createtime); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -208,47 +281,6 @@ public class ChartDataSchedule { | |||||
| } | } | ||||
| } | } | ||||
| public void carBindData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||||
| Long todaybindcar = wxCUserCarMapper.queryCarCount(params); | |||||
| addChartData(tenantEntity, todaybindcar.toString(), EnumChartType.CAR_BIND.getCode(), date, createtime); | |||||
| } | |||||
| public void carNewMemberData(Date createtime, Date date, TenantEntity tenantEntity) { | |||||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto(); | |||||
| wxCUserBasicInfoDto.updateTenantInfo(tenantEntity); | |||||
| wxCUserBasicInfoDto.setStartTime(date); | |||||
| wxCUserBasicInfoDto.setEndTime(date); | |||||
| Integer carUserCount = wxCUserCarService.countUser(wxCUserBasicInfoDto); | |||||
| addChartData(tenantEntity, carUserCount.toString(), EnumChartType.CAR_NEW_MEMBER.getCode(), date, createtime); | |||||
| } | |||||
| // public void carMemberData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||||
| // List<Map<String, Object>> carCountHistory = wxCUserCarMapper.queryCarCountHistory(params); | |||||
| // Long userCount = carCountHistory.isEmpty() ? 0L : (Long) carCountHistory.get(0).get("count"); | |||||
| // addChartData(tenantEntity, userCount.toString(), EnumChartType.CAR_MEMBER.getCode(), date, createtime); | |||||
| // } | |||||
| public void carPayFeeData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||||
| BigDecimal fee = wxCarCmdLogMapper.queryCarPay(params); | |||||
| addChartData(tenantEntity, fee.toString(), EnumChartType.CAR_PAY_FEE.getCode(), date, createtime); | |||||
| } | |||||
| public void carPaidData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||||
| Long carPayFeeCount = wxCarCmdLogMapper.queryHistoryCount(params); | |||||
| addChartData(tenantEntity, carPayFeeCount.toString(), EnumChartType.CAR_PAID.getCode(), date, createtime); | |||||
| } | |||||
| public void carOutData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||||
| Long carOutCount = wxCarCmdLogMapper.queryHistoryCount(params); | |||||
| addChartData(tenantEntity, carOutCount.toString(), EnumChartType.CAR_OUT.getCode(), date, createtime); | |||||
| } | |||||
| public void carInData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||||
| Long carOutCount = wxCarCmdLogMapper.queryHistoryCount(params); | |||||
| addChartData(tenantEntity, carOutCount.toString(), EnumChartType.CAR_IN.getCode(), date, createtime); | |||||
| } | |||||
| private void addChartData(TenantEntity tenantEntity, String result, Integer type, Date querytime, Date createtime) { | private void addChartData(TenantEntity tenantEntity, String result, Integer type, Date querytime, Date createtime) { | ||||
| logger.info("即将插入数据>>>>>>>>>>>>>>>>>>>>>>>"); | logger.info("即将插入数据>>>>>>>>>>>>>>>>>>>>>>>"); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| @@ -20,7 +20,7 @@ public enum EnumChart { | |||||
| JYZXXZTCHY(13, "近一周新增停车会员"), | JYZXXZTCHY(13, "近一周新增停车会员"), | ||||
| JYZXSJFCL(14, "近一周线上缴费车辆"), | JYZXSJFCL(14, "近一周线上缴费车辆"), | ||||
| JYZXSJFJE(15, "近一周线上缴费金额"), | JYZXSJFJE(15, "近一周线上缴费金额"), | ||||
| JYZXZHYS(16, "近一周新增会员数"), | |||||
| // JYZXZHYS(16, "近一周新增会员数"),弃用了 | |||||
| ZRCDYH(17, "昨日触达用户"), | ZRCDYH(17, "昨日触达用户"), | ||||
| JRQJYSJ(18, "今日券交易数据"), | JRQJYSJ(18, "今日券交易数据"), | ||||
| JRCJYX(19, "今日场景营销"), | JRCJYX(19, "今日场景营销"), | ||||
| @@ -11,8 +11,15 @@ public enum EnumChartType { | |||||
| // CAR_MEMBER(4, "新增会员"), | // CAR_MEMBER(4, "新增会员"), | ||||
| CAR_NEW_MEMBER(5, "新增停车会员"), | CAR_NEW_MEMBER(5, "新增停车会员"), | ||||
| CAR_BIND(6, "已绑车辆"), | CAR_BIND(6, "已绑车辆"), | ||||
| SALE_COUPON_PRICE(8, "销售总交易额"), | SALE_COUPON_PRICE(8, "销售总交易额"), | ||||
| MERCHANT_TRADE(9, "解单金额"),; | |||||
| MERCHANT_TRADE(9, "解单金额"), | |||||
| WX_USER(11,"微信用户"), | |||||
| TT_USER(12,"抖音用户"), | |||||
| ALI_USER(13,"Ali用户"), | |||||
| BASIC_USER(14,"会员"); | |||||
| public static EnumChartType getEnum(Integer code) { | public static EnumChartType getEnum(Integer code) { | ||||
| for (EnumChartType value : values()) { | for (EnumChartType value : values()) { | ||||
| if (value.getCode().equals(code)) { | if (value.getCode().equals(code)) { | ||||
| @@ -16,6 +16,4 @@ public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | |||||
| long queryCarCount(Map<String,Object> carParams); | long queryCarCount(Map<String,Object> carParams); | ||||
| List<Map<String, Object>> queryCarCountHistory(HashMap<String,Object> params); | |||||
| } | } | ||||
| @@ -306,16 +306,6 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| @Override | @Override | ||||
| public long findCount(WxCUserBasicInfoDto dto) { | public long findCount(WxCUserBasicInfoDto dto) { | ||||
| if(StringUtils.isBlank(dto.getTenantId()) | |||||
| && StringUtils.isNotBlank(dto.getParentTenantId())){ | |||||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(dto); | |||||
| long count = 0l; | |||||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||||
| dto.updateTenantInfo(tenantEntity); | |||||
| count += ttCUserMapper.findCount(dto); | |||||
| } | |||||
| return count; | |||||
| } | |||||
| return ttCUserMapper.findCount(dto); | return ttCUserMapper.findCount(dto); | ||||
| } | } | ||||
| @@ -314,16 +314,6 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| @Override | @Override | ||||
| public long findCount(WxCUserBasicInfoDto dto) { | public long findCount(WxCUserBasicInfoDto dto) { | ||||
| if(StringUtils.isBlank(dto.getTenantId()) | |||||
| && StringUtils.isNotBlank(dto.getParentTenantId())){ | |||||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(dto); | |||||
| long count = 0l; | |||||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||||
| dto.updateTenantInfo(tenantEntity); | |||||
| count += wxCUserMapper.findCount(dto); | |||||
| } | |||||
| return count; | |||||
| } | |||||
| return wxCUserMapper.findCount(dto); | return wxCUserMapper.findCount(dto); | ||||
| } | } | ||||
| @@ -136,8 +136,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| @Autowired | @Autowired | ||||
| private WxShopService wxShopService; | private WxShopService wxShopService; | ||||
| @Override | @Override | ||||
| public ResultData queryData(Map<String, String> paramsMap) { | public ResultData queryData(Map<String, String> paramsMap) { | ||||
| String tenantId = paramsMap.get("tenantId"); | String tenantId = paramsMap.get("tenantId"); | ||||
| @@ -225,9 +224,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| return getCarPayCountInWeek(tenantEntity); | return getCarPayCountInWeek(tenantEntity); | ||||
| } | } | ||||
| //近一周新增会员数 | //近一周新增会员数 | ||||
| if (chart.equals(EnumChart.JYZXZHYS.getCode())) { | |||||
| return getCarNewMemberCountInWeek(tenantEntity); | |||||
| } | |||||
| // if (chart.equals(EnumChart.JYZXZHYS.getCode())) { | |||||
| // return getCarNewMemberCountInWeek(tenantEntity); | |||||
| // } | |||||
| //// --- 车流 -- END | //// --- 车流 -- END | ||||
| //昨日触达用户 | //昨日触达用户 | ||||
| if (chart.equals(EnumChart.ZRCDYH.getCode())) { | if (chart.equals(EnumChart.ZRCDYH.getCode())) { | ||||
| @@ -1066,54 +1065,6 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| return new ResultData(datamap); | return new ResultData(datamap); | ||||
| } | } | ||||
| /** | |||||
| * 车流 - 近一周新增会员数 | |||||
| * @param tenantEntity | |||||
| * @return | |||||
| */ | |||||
| private ResultData getCarNewMemberCountInWeek(TenantEntity tenantEntity) { | |||||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||||
| HashMap<String, Object> datamap = new HashMap<>(); | |||||
| HashMap<String, Object> weekParams = new HashMap<>(); | |||||
| // weekParams.put("tenantEntitys", tenantEntitys); | |||||
| weekParams.put("tenantId", tenantEntity.getTenantId()); | |||||
| weekParams.put("finalTenantId", tenantEntity.getFinalTenantId()); | |||||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||||
| weekParams.put("parentTenantId", tenantEntity.getParentTenantId()); | |||||
| } | |||||
| String oneWeekStartdate = DateUtils.getTimeBefore(7, new Date()); | |||||
| String oneWeekEndDate = DateUtils.getTimeBefore(1, new Date()); | |||||
| weekParams.put("startdate", oneWeekStartdate + " 00:00:00"); | |||||
| weekParams.put("enddate", oneWeekEndDate + " 23:59:59"); | |||||
| weekParams.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode()); | |||||
| List<Map<String, Object>> carCountHistory = wxCUserCarMapper.queryCarCountHistory(weekParams); | |||||
| Map<String, Object> weekCarCollect = carCountHistory.stream().collect(Collectors.toMap(m -> { | |||||
| return (String) m.get("create_time"); | |||||
| }, m -> { | |||||
| return m.get("count"); | |||||
| })); | |||||
| List<String> days = DateUtils.getTjTimeList(oneWeekStartdate, oneWeekEndDate, "0"); | |||||
| List<String> timeList = new ArrayList<>(); | |||||
| List<Object> valList = new ArrayList<>(); | |||||
| for (String date : days) { | |||||
| String newdate = date.substring(5, date.length()).replace("-", "/"); | |||||
| Object o = weekCarCollect.get(newdate); | |||||
| timeList.add(newdate); | |||||
| if (o == null) { | |||||
| valList.add(0L); | |||||
| } else { | |||||
| valList.add(o); | |||||
| } | |||||
| } | |||||
| Map map = new HashMap(); | |||||
| map.put("index", timeList); | |||||
| map.put("val", valList); | |||||
| datamap.put("oneWeekNewCarUserHistory", map); | |||||
| return new ResultData(datamap); | |||||
| } | |||||
| /** | /** | ||||
| * 今日券交易数据 | * 今日券交易数据 | ||||
| * @param tenantEntity | * @param tenantEntity | ||||
| @@ -557,7 +557,7 @@ | |||||
| </select> | </select> | ||||
| <select id="getTotalCreditAmount" resultType="java.lang.Long"> | <select id="getTotalCreditAmount" resultType="java.lang.Long"> | ||||
| SELECT SUM (wcubi.credit) | |||||
| SELECT IFNULL(SUM(wcubi.credit),0) | |||||
| FROM wx_c_user_basic_info wcubi | FROM wx_c_user_basic_info wcubi | ||||
| where wcubi.`final_tenant_id` = #{finalTenantId} | where wcubi.`final_tenant_id` = #{finalTenantId} | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -121,18 +121,4 @@ | |||||
| and create_date between #{startdate} and #{enddate} | and create_date between #{startdate} and #{enddate} | ||||
| </select> | </select> | ||||
| <select id="queryCarCountHistory" resultType="hashmap" parameterType="hashmap"> | |||||
| SELECT count(DISTINCT c.id) count, c.create_time FROM | |||||
| (SELECT ubi.id as id, DATE_FORMAT(uc.create_date, '%m/%d') create_time | |||||
| FROM wx_c_user_car uc, wx_c_user_basic_info ubi | |||||
| WHERE uc.c_user_id = ubi.id | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and uc.tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and uc.parent_tenant_id = #{parentTenantId} | |||||
| </if> | |||||
| AND ubi.create_date BETWEEN #{startdate} AND #{enddate}) c | |||||
| GROUP BY c.create_time ORDER BY c.create_time | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||