| @@ -25,7 +25,6 @@ public class CockpitScreenController extends BaseController { | |||||
| private CockpitScreenService cockpitScreenService; | private CockpitScreenService cockpitScreenService; | ||||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | @ApiVersion(group = SwaggerConstant.V_1_0_0) | ||||
| @TenantIgnore | |||||
| @ApiOperation("驾驶舱大屏-统计会员性别信息") | @ApiOperation("驾驶舱大屏-统计会员性别信息") | ||||
| @GetMapping("/countUserGender") | @GetMapping("/countUserGender") | ||||
| public ResultData countUserGender() { | public ResultData countUserGender() { | ||||
| @@ -33,7 +32,6 @@ public class CockpitScreenController extends BaseController { | |||||
| } | } | ||||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | @ApiVersion(group = SwaggerConstant.V_1_0_0) | ||||
| @TenantIgnore | |||||
| @ApiOperation("驾驶舱大屏-统计商铺信息") | @ApiOperation("驾驶舱大屏-统计商铺信息") | ||||
| @GetMapping("/countShop") | @GetMapping("/countShop") | ||||
| public ResultData countShop() { | public ResultData countShop() { | ||||
| @@ -41,7 +39,6 @@ public class CockpitScreenController extends BaseController { | |||||
| } | } | ||||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | @ApiVersion(group = SwaggerConstant.V_1_0_0) | ||||
| @TenantIgnore | |||||
| @ApiOperation("驾驶舱大屏-统计会员信息") | @ApiOperation("驾驶舱大屏-统计会员信息") | ||||
| @GetMapping("/countUser") | @GetMapping("/countUser") | ||||
| public ResultData countUser(@RequestParam("years") List<Integer> years) { | public ResultData countUser(@RequestParam("years") List<Integer> years) { | ||||
| @@ -49,7 +46,6 @@ public class CockpitScreenController extends BaseController { | |||||
| } | } | ||||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | @ApiVersion(group = SwaggerConstant.V_1_0_0) | ||||
| @TenantIgnore | |||||
| @ApiOperation("驾驶舱大屏-统计触达用户信息") | @ApiOperation("驾驶舱大屏-统计触达用户信息") | ||||
| @GetMapping("/countReachUser") | @GetMapping("/countReachUser") | ||||
| public ResultData countReachUser(@RequestParam("years") List<Integer> years) { | public ResultData countReachUser(@RequestParam("years") List<Integer> years) { | ||||
| @@ -57,7 +53,6 @@ public class CockpitScreenController extends BaseController { | |||||
| } | } | ||||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | @ApiVersion(group = SwaggerConstant.V_1_0_0) | ||||
| @TenantIgnore | |||||
| @ApiOperation("驾驶舱大屏-统计车辆数量信息") | @ApiOperation("驾驶舱大屏-统计车辆数量信息") | ||||
| @GetMapping("/countCar") | @GetMapping("/countCar") | ||||
| public ResultData countCar(@RequestParam("years") List<Integer> years) { | public ResultData countCar(@RequestParam("years") List<Integer> years) { | ||||
| @@ -65,7 +60,6 @@ public class CockpitScreenController extends BaseController { | |||||
| } | } | ||||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | @ApiVersion(group = SwaggerConstant.V_1_0_0) | ||||
| @TenantIgnore | |||||
| @ApiOperation("驾驶舱大屏-统计订单趋势信息") | @ApiOperation("驾驶舱大屏-统计订单趋势信息") | ||||
| @GetMapping("/countOrderTrend") | @GetMapping("/countOrderTrend") | ||||
| public ResultData countOrderTrend(@RequestParam("year") Integer year) { | public ResultData countOrderTrend(@RequestParam("year") Integer year) { | ||||
| @@ -73,10 +67,9 @@ public class CockpitScreenController extends BaseController { | |||||
| } | } | ||||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | @ApiVersion(group = SwaggerConstant.V_1_0_0) | ||||
| @TenantIgnore | |||||
| @ApiOperation("驾驶舱大屏-统计基本数据信息") | @ApiOperation("驾驶舱大屏-统计基本数据信息") | ||||
| @GetMapping("/countBasic") | @GetMapping("/countBasic") | ||||
| public ResultData countBasic() { | public ResultData countBasic() { | ||||
| return new ResultData(cockpitScreenService.countBasic()); | |||||
| return new ResultData(cockpitScreenService.countBasic(getTenantInfo())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -184,7 +184,7 @@ jasypt: | |||||
| password: oRqdnDbK5pj3eMmB | password: oRqdnDbK5pj3eMmB | ||||
| fm: | fm: | ||||
| exception: true | |||||
| exception: false | |||||
| exception_emails: xuxiaohu@iformall.com | exception_emails: xuxiaohu@iformall.com | ||||
| deploy: 1 | deploy: 1 | ||||
| open: true | open: true | ||||
| @@ -0,0 +1,13 @@ | |||||
| package com.iformall.domain.dto.cockpit; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| @ApiModel(value = "uv/pv") | |||||
| @Data | |||||
| public class SumVisitDTO { | |||||
| private Integer uv; | |||||
| private Integer pv; | |||||
| } | |||||
| @@ -14,20 +14,20 @@ public class CountBasicVO { | |||||
| @ApiModelProperty(value = "总核销额") | @ApiModelProperty(value = "总核销额") | ||||
| private BigDecimal totalVerifiedAmount; | private BigDecimal totalVerifiedAmount; | ||||
| @ApiModelProperty(value = "总商户数") | @ApiModelProperty(value = "总商户数") | ||||
| private BigDecimal totalMerchantCount; | |||||
| private Integer totalMerchantCount; | |||||
| @ApiModelProperty(value = "总会员数") | @ApiModelProperty(value = "总会员数") | ||||
| private BigDecimal totalUserCount; | |||||
| private Integer totalUserCount; | |||||
| @ApiModelProperty(value = "总触达用户数") | @ApiModelProperty(value = "总触达用户数") | ||||
| private BigDecimal totalReachUserCount; | |||||
| private Integer totalReachUserCount; | |||||
| @ApiModelProperty(value = "本周新增会员数") | @ApiModelProperty(value = "本周新增会员数") | ||||
| private BigDecimal weekUserCount; | |||||
| private Integer weekUserCount; | |||||
| @ApiModelProperty(value = "总有车会员数") | @ApiModelProperty(value = "总有车会员数") | ||||
| private BigDecimal carUserCount; | |||||
| private Integer carUserCount; | |||||
| @ApiModelProperty(value = "今日访问量") | @ApiModelProperty(value = "今日访问量") | ||||
| private BigDecimal todayPvCount; | |||||
| private Integer todayPvCount; | |||||
| @ApiModelProperty(value = "今日会员数") | @ApiModelProperty(value = "今日会员数") | ||||
| private BigDecimal todayUserCount; | |||||
| private Integer todayUserCount; | |||||
| @ApiModelProperty(value = "今日交易金额") | @ApiModelProperty(value = "今日交易金额") | ||||
| private BigDecimal todayTradingAmount; | private BigDecimal todayTradingAmount; | ||||
| } | } | ||||
| @@ -10,7 +10,7 @@ import java.math.BigDecimal; | |||||
| @Data | @Data | ||||
| public class CountOrderTrendVO { | public class CountOrderTrendVO { | ||||
| @ApiModelProperty(value = "月份") | @ApiModelProperty(value = "月份") | ||||
| private Integer month; | |||||
| private String month; | |||||
| @ApiModelProperty(value = "订单信息") | @ApiModelProperty(value = "订单信息") | ||||
| private OrderInfo order; | private OrderInfo order; | ||||
| @ApiModelProperty(value = "核销订单信息") | @ApiModelProperty(value = "核销订单信息") | ||||
| @@ -19,18 +19,18 @@ public class CountOrderTrendVO { | |||||
| @Data | @Data | ||||
| public static class OrderInfo { | public static class OrderInfo { | ||||
| @ApiModelProperty(value = "订单金额") | @ApiModelProperty(value = "订单金额") | ||||
| private BigDecimal orderAmount; | |||||
| private BigDecimal amount; | |||||
| @ApiModelProperty(value = "订单数量") | @ApiModelProperty(value = "订单数量") | ||||
| private Integer orderCount; | |||||
| private Integer count; | |||||
| } | } | ||||
| @Data | @Data | ||||
| public static class VerifiedOrderInfo { | public static class VerifiedOrderInfo { | ||||
| @ApiModelProperty(value = "订单核销金额") | @ApiModelProperty(value = "订单核销金额") | ||||
| private BigDecimal verifiedOrderAmount; | |||||
| private BigDecimal amount; | |||||
| @ApiModelProperty(value = "订单核销数") | @ApiModelProperty(value = "订单核销数") | ||||
| private Integer verifiedOrderCount; | |||||
| private Integer count; | |||||
| @ApiModelProperty(value = "订单核销用户数") | @ApiModelProperty(value = "订单核销用户数") | ||||
| private Integer verifiedUserCount; | |||||
| private Integer userCount; | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,7 +6,7 @@ import lombok.Data; | |||||
| @ApiModel(value = "每月统计数量") | @ApiModel(value = "每月统计数量") | ||||
| @Data | @Data | ||||
| public class MonthDataMapping { | |||||
| public class MonthCountMapping { | |||||
| @ApiModelProperty(value = "某年某月") | @ApiModelProperty(value = "某年某月") | ||||
| private String name; | private String name; | ||||
| @ApiModelProperty(value = "数量") | @ApiModelProperty(value = "数量") | ||||
| @@ -8,7 +8,7 @@ import lombok.Data; | |||||
| @Data | @Data | ||||
| public class MonthDataVO { | public class MonthDataVO { | ||||
| @ApiModelProperty(value = "月份") | @ApiModelProperty(value = "月份") | ||||
| private Integer month; | |||||
| private String month; | |||||
| @ApiModelProperty(value = "数量") | @ApiModelProperty(value = "数量") | ||||
| private Integer count; | private Integer count; | ||||
| } | } | ||||
| @@ -0,0 +1,20 @@ | |||||
| package com.iformall.domain.vo.cockpit; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Data; | |||||
| import java.math.BigDecimal; | |||||
| @ApiModel(value = "每月订单统计") | |||||
| @Data | |||||
| public class MonthOrderMapping { | |||||
| @ApiModelProperty(value = "某年某月") | |||||
| private String name; | |||||
| @ApiModelProperty(value = "金额") | |||||
| private BigDecimal amount; | |||||
| @ApiModelProperty(value = "笔数") | |||||
| private Integer count; | |||||
| @ApiModelProperty(value = "用户数") | |||||
| private Integer userCount; | |||||
| } | |||||
| @@ -7,10 +7,10 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.vo.CUserBaseVo; | import com.iformall.domain.vo.CUserBaseVo; | ||||
| import com.iformall.domain.vo.UserCountVo; | import com.iformall.domain.vo.UserCountVo; | ||||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | import com.iformall.domain.vo.WxCUserBasicInfoVo; | ||||
| import com.iformall.domain.vo.cockpit.CountUserGenderVO; | |||||
| import com.iformall.domain.vo.cockpit.MonthDataMapping; | |||||
| import com.iformall.domain.vo.cockpit.MonthCountMapping; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | ||||
| @@ -90,8 +90,10 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| * | * | ||||
| * @param finalTenantId | * @param finalTenantId | ||||
| * @param years | * @param years | ||||
| * @return {@link List}<{@link MonthDataMapping}> | |||||
| * @return {@link List}<{@link MonthCountMapping}> | |||||
| */ | */ | ||||
| List<MonthDataMapping> groupByDate(@Param("finalTenantId") String finalTenantId, @Param("years") List<Integer> years); | |||||
| List<MonthCountMapping> groupByDate(@Param("finalTenantId") String finalTenantId, @Param("years") List<Integer> years); | |||||
| Integer countUser(@Param("finalTenantId") String finalTenantId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); | |||||
| } | } | ||||
| @@ -3,7 +3,8 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | import com.iformall.domain.dto.WxCUserBasicInfoDto; | ||||
| import com.iformall.domain.po.WxCUserCar; | import com.iformall.domain.po.WxCUserCar; | ||||
| import com.iformall.domain.vo.cockpit.MonthDataMapping; | |||||
| import com.iformall.domain.vo.cockpit.MonthCountMapping; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -24,7 +25,9 @@ public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | |||||
| * | * | ||||
| * @param finalTenantId | * @param finalTenantId | ||||
| * @param years | * @param years | ||||
| * @return {@link List}<{@link MonthDataMapping}> | |||||
| * @return {@link List}<{@link MonthCountMapping}> | |||||
| */ | */ | ||||
| List<MonthDataMapping> groupByDate(String finalTenantId, List<Integer> years); | |||||
| List<MonthCountMapping> groupByDate(String finalTenantId, List<Integer> years); | |||||
| Integer countCarUser(@Param("finalTenantId") String finalTenantId); | |||||
| } | } | ||||
| @@ -5,8 +5,10 @@ import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||||
| import com.iformall.domain.po.WxCouponOrder; | import com.iformall.domain.po.WxCouponOrder; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.domain.vo.cockpit.MonthOrderMapping; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -122,4 +124,24 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| * @return {@link Integer} | * @return {@link Integer} | ||||
| */ | */ | ||||
| SumVerifiedVO sumVerified(@Param("tenantId") String tenantId, @Param("bMerchantId") Long merchantId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); | SumVerifiedVO sumVerified(@Param("tenantId") String tenantId, @Param("bMerchantId") Long merchantId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); | ||||
| /** | |||||
| * 查询某年某月订单金额和订单数 | |||||
| * | |||||
| * @param finalTenantId | |||||
| * @param year | |||||
| * @return {@link List}<{@link MonthOrderMapping}> | |||||
| */ | |||||
| List<MonthOrderMapping> orderGroupByDate(@Param("finalTenantId") String finalTenantId, @Param("year") Integer year); | |||||
| /** | |||||
| * 查询某年某月核销订单金额,订单数,用户数 | |||||
| * | |||||
| * @param finalTenantId | |||||
| * @param year | |||||
| * @return {@link List}<{@link MonthOrderMapping}> | |||||
| */ | |||||
| List<MonthOrderMapping> verifiedOrderGroupByDate(@Param("finalTenantId") String finalTenantId, @Param("year") Integer year); | |||||
| BigDecimal sumOrderAmount(@Param("finalTenantId") String finalTenantId, @Param("couponOrderStatus") Integer couponOrderStatus, @Param("specificDate") Date specificDate); | |||||
| } | } | ||||
| @@ -58,4 +58,5 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||||
| List<WxMerchant> getMerchantListByIds(@Param("relationIds") List<Long> relationIds); | List<WxMerchant> getMerchantListByIds(@Param("relationIds") List<Long> relationIds); | ||||
| Integer countMerchant(@Param("finalTenantId") String finalTenantId); | |||||
| } | } | ||||
| @@ -2,11 +2,13 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | import com.iformall.domain.dto.MarkingCouponDataReportDto; | ||||
| import com.iformall.domain.dto.cockpit.SumVisitDTO; | |||||
| import com.iformall.domain.po.WxUserVisit; | import com.iformall.domain.po.WxUserVisit; | ||||
| import com.iformall.domain.vo.TouchUsersReportVo; | import com.iformall.domain.vo.TouchUsersReportVo; | ||||
| import com.iformall.domain.vo.cockpit.MonthDataMapping; | |||||
| import com.iformall.domain.vo.cockpit.MonthCountMapping; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| public interface WxUserVisitMapper extends CommonMapper<WxUserVisit, Long> { | public interface WxUserVisitMapper extends CommonMapper<WxUserVisit, Long> { | ||||
| @@ -25,7 +27,9 @@ public interface WxUserVisitMapper extends CommonMapper<WxUserVisit, Long> { | |||||
| * | * | ||||
| * @param finalTenantId | * @param finalTenantId | ||||
| * @param years | * @param years | ||||
| * @return {@link List}<{@link MonthDataMapping}> | |||||
| * @return {@link List}<{@link MonthCountMapping}> | |||||
| */ | */ | ||||
| List<MonthDataMapping> groupByDate(@Param("finalTenantId") String finalTenantId, @Param("years") List<Integer> years); | |||||
| List<MonthCountMapping> groupByDate(@Param("finalTenantId") String finalTenantId, @Param("years") List<Integer> years); | |||||
| SumVisitDTO sumVisit(@Param("finalTenantId") String finalTenantId, @Param("specificDate") Date specificDate); | |||||
| } | } | ||||
| @@ -69,5 +69,5 @@ public interface CockpitScreenService { | |||||
| * | * | ||||
| * @return {@link CountBasicVO} | * @return {@link CountBasicVO} | ||||
| */ | */ | ||||
| CountBasicVO countBasic(); | |||||
| CountBasicVO countBasic(TenantEntity tenantInfo); | |||||
| } | } | ||||
| @@ -3,16 +3,14 @@ package com.iformall.service.impl; | |||||
| import com.iformall.common.CommonConstant; | import com.iformall.common.CommonConstant; | ||||
| import com.iformall.domain.dto.cockpit.CountShopByStatusDTO; | import com.iformall.domain.dto.cockpit.CountShopByStatusDTO; | ||||
| import com.iformall.domain.dto.cockpit.CountUserByGenderDTO; | import com.iformall.domain.dto.cockpit.CountUserByGenderDTO; | ||||
| import com.iformall.domain.dto.cockpit.SumVisitDTO; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.cockpit.*; | import com.iformall.domain.vo.cockpit.*; | ||||
| import com.iformall.enums.EnumCouponOrderStatus; | |||||
| import com.iformall.enums.EnumShopStatus; | import com.iformall.enums.EnumShopStatus; | ||||
| import com.iformall.enums.EnumUserGender; | import com.iformall.enums.EnumUserGender; | ||||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | |||||
| import com.iformall.mapper.WxCUserCarMapper; | |||||
| import com.iformall.mapper.WxShopMapper; | |||||
| import com.iformall.mapper.WxUserVisitMapper; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.CockpitScreenService; | import com.iformall.service.CockpitScreenService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| @@ -34,7 +32,7 @@ import java.util.stream.Collectors; | |||||
| public class CockpitScreenServiceImpl implements CockpitScreenService { | public class CockpitScreenServiceImpl implements CockpitScreenService { | ||||
| @Autowired | @Autowired | ||||
| private WxCUserBasicInfoMapper cUserBasicInfoMapper; | |||||
| private WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||||
| @Autowired | @Autowired | ||||
| private WxMallService wxMallService; | private WxMallService wxMallService; | ||||
| @Autowired | @Autowired | ||||
| @@ -43,11 +41,15 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { | |||||
| private WxUserVisitMapper wxUserVisitMapper; | private WxUserVisitMapper wxUserVisitMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxCUserCarMapper wxCUserCarMapper; | private WxCUserCarMapper wxCUserCarMapper; | ||||
| @Autowired | |||||
| private WxCouponOrderMapper wxCouponOrderMapper; | |||||
| @Autowired | |||||
| private WxMerchantMapper wxMerchantMapper; | |||||
| @Override | @Override | ||||
| public CountUserGenderVO countUserGender(TenantEntity tenantEntity) { | public CountUserGenderVO countUserGender(TenantEntity tenantEntity) { | ||||
| CountUserGenderVO result = new CountUserGenderVO(); | CountUserGenderVO result = new CountUserGenderVO(); | ||||
| List<CountUserByGenderDTO> dtos = cUserBasicInfoMapper.countUserByGender(tenantEntity.getFinalTenantId()); | |||||
| List<CountUserByGenderDTO> dtos = wxCUserBasicInfoMapper.countUserByGender(tenantEntity.getFinalTenantId()); | |||||
| List<CountUserByGenderDTO> totalGenders = dtos.stream().filter(x -> | List<CountUserByGenderDTO> totalGenders = dtos.stream().filter(x -> | ||||
| x.getGender() != null && (x.getGender().equals(EnumUserGender.GENDER_MALE.getCode()) || x.getGender().equals(EnumUserGender.GENDER_FEMALE.getCode())) | x.getGender() != null && (x.getGender().equals(EnumUserGender.GENDER_MALE.getCode()) || x.getGender().equals(EnumUserGender.GENDER_FEMALE.getCode())) | ||||
| ).collect(Collectors.toList()); | ).collect(Collectors.toList()); | ||||
| @@ -106,7 +108,7 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { | |||||
| years.add(DateUtils.getYear(new Date())); | years.add(DateUtils.getYear(new Date())); | ||||
| } | } | ||||
| List<MonthDataMapping> mappings = cUserBasicInfoMapper.groupByDate(tenantInfo.getFinalTenantId(), years); | |||||
| List<MonthCountMapping> mappings = wxCUserBasicInfoMapper.groupByDate(tenantInfo.getFinalTenantId(), years); | |||||
| return getResult(years, mappings); | return getResult(years, mappings); | ||||
| } | } | ||||
| @@ -116,7 +118,7 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { | |||||
| years.add(DateUtils.getYear(new Date())); | years.add(DateUtils.getYear(new Date())); | ||||
| } | } | ||||
| List<MonthDataMapping> mappings = wxUserVisitMapper.groupByDate(tenantInfo.getFinalTenantId(), years); | |||||
| List<MonthCountMapping> mappings = wxUserVisitMapper.groupByDate(tenantInfo.getFinalTenantId(), years); | |||||
| return getResult(years, mappings); | return getResult(years, mappings); | ||||
| } | } | ||||
| @@ -126,18 +128,86 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { | |||||
| years.add(DateUtils.getYear(new Date())); | years.add(DateUtils.getYear(new Date())); | ||||
| } | } | ||||
| List<MonthDataMapping> mappings = wxCUserCarMapper.groupByDate(tenantInfo.getFinalTenantId(), years); | |||||
| List<MonthCountMapping> mappings = wxCUserCarMapper.groupByDate(tenantInfo.getFinalTenantId(), years); | |||||
| return getResult(years, mappings); | return getResult(years, mappings); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public List<CountOrderTrendVO> countOrderTrend(TenantEntity tenantInfo, Integer year) { | public List<CountOrderTrendVO> countOrderTrend(TenantEntity tenantInfo, Integer year) { | ||||
| return null; | |||||
| year = year != null ? year : DateUtils.getYear(new Date()); | |||||
| List<CountOrderTrendVO> result = new ArrayList<>(); | |||||
| List<MonthOrderMapping> tradeOrderMappings = wxCouponOrderMapper.orderGroupByDate(tenantInfo.getFinalTenantId(), year); | |||||
| Map<String, MonthOrderMapping> tradeOrderMappingMap = tradeOrderMappings.stream().collect(Collectors.toMap(MonthOrderMapping::getName, x -> x)); | |||||
| List<MonthOrderMapping> verifiedOrderMappings = wxCouponOrderMapper.verifiedOrderGroupByDate(tenantInfo.getFinalTenantId(), year); | |||||
| Map<String, MonthOrderMapping> verifiedOrderMappingMap = verifiedOrderMappings.stream().collect(Collectors.toMap(MonthOrderMapping::getName, x -> x)); | |||||
| for (int i = 0; i < 12; i++) { | |||||
| CountOrderTrendVO vo = new CountOrderTrendVO(); | |||||
| String monthStr = DateUtils.getMonthStr(i + 1); | |||||
| MonthOrderMapping tradeOrder = tradeOrderMappingMap.get(year + "-" + monthStr); | |||||
| tradeOrder = Optional.ofNullable(tradeOrder).orElseGet(() -> { | |||||
| MonthOrderMapping newTradeOrder = new MonthOrderMapping(); | |||||
| newTradeOrder.setAmount(BigDecimal.ZERO); | |||||
| newTradeOrder.setCount(0); | |||||
| return newTradeOrder; | |||||
| }); | |||||
| MonthOrderMapping verifiedOrder = verifiedOrderMappingMap.get(year + "-" + monthStr); | |||||
| verifiedOrder = Optional.ofNullable(verifiedOrder).orElseGet(() -> { | |||||
| MonthOrderMapping newVerifiedOrder = new MonthOrderMapping(); | |||||
| newVerifiedOrder.setAmount(BigDecimal.ZERO); | |||||
| newVerifiedOrder.setCount(0); | |||||
| newVerifiedOrder.setUserCount(0); | |||||
| return newVerifiedOrder; | |||||
| }); | |||||
| CountOrderTrendVO.OrderInfo orderInfo = new CountOrderTrendVO.OrderInfo(); | |||||
| orderInfo.setAmount(tradeOrder.getAmount()); | |||||
| orderInfo.setCount(tradeOrder.getCount()); | |||||
| CountOrderTrendVO.VerifiedOrderInfo verifiedOrderInfo = new CountOrderTrendVO.VerifiedOrderInfo(); | |||||
| verifiedOrderInfo.setAmount(verifiedOrder.getAmount()); | |||||
| verifiedOrderInfo.setCount(verifiedOrder.getCount()); | |||||
| verifiedOrderInfo.setUserCount(verifiedOrder.getUserCount()); | |||||
| vo.setMonth(monthStr); | |||||
| vo.setOrder(orderInfo); | |||||
| vo.setVerifiedOrder(verifiedOrderInfo); | |||||
| result.add(vo); | |||||
| } | |||||
| return result; | |||||
| } | } | ||||
| @Override | @Override | ||||
| public CountBasicVO countBasic() { | |||||
| return null; | |||||
| public CountBasicVO countBasic(TenantEntity tenantInfo) { | |||||
| BigDecimal totalTradingAmount = wxCouponOrderMapper.sumOrderAmount(tenantInfo.getFinalTenantId(), null, null); | |||||
| BigDecimal totalVerifiedAmount = wxCouponOrderMapper.sumOrderAmount(tenantInfo.getFinalTenantId(), EnumCouponOrderStatus.COUPON_ORDER_USED.getCode(), new Date()); | |||||
| BigDecimal todayTradingAmount = wxCouponOrderMapper.sumOrderAmount(tenantInfo.getFinalTenantId(), null, new Date()); | |||||
| Integer totalMerchantCount = wxMerchantMapper.countMerchant(tenantInfo.getFinalTenantId()); | |||||
| Integer totalUserCount = wxCUserBasicInfoMapper.countUser(tenantInfo.getFinalTenantId(), null, null); | |||||
| Integer todayUserCount = wxCUserBasicInfoMapper.countUser(tenantInfo.getFinalTenantId(), new Date(), new Date()); | |||||
| Integer weekUserCount = wxCUserBasicInfoMapper.countUser(tenantInfo.getFinalTenantId(), DateUtils.getFirstDayForCurrWeek(), DateUtils.getLastDayForCurrWeek()); | |||||
| SumVisitDTO sumVisit = wxUserVisitMapper.sumVisit(tenantInfo.getFinalTenantId(), null); | |||||
| SumVisitDTO todaySumVisit = wxUserVisitMapper.sumVisit(tenantInfo.getFinalTenantId(), new Date()); | |||||
| Integer carUserCount = wxCUserCarMapper.countCarUser(tenantInfo.getFinalTenantId()); | |||||
| CountBasicVO vo = new CountBasicVO(); | |||||
| vo.setTotalTradingAmount(totalTradingAmount); | |||||
| vo.setTotalVerifiedAmount(totalVerifiedAmount); | |||||
| vo.setTotalMerchantCount(totalMerchantCount); | |||||
| vo.setTotalUserCount(totalUserCount); | |||||
| vo.setTotalReachUserCount(sumVisit.getUv()); | |||||
| vo.setWeekUserCount(weekUserCount); | |||||
| vo.setCarUserCount(carUserCount); | |||||
| vo.setTodayPvCount(todaySumVisit.getPv()); | |||||
| vo.setTodayUserCount(todayUserCount); | |||||
| vo.setTodayTradingAmount(todayTradingAmount); | |||||
| return vo; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -147,17 +217,18 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { | |||||
| * @param mappings | * @param mappings | ||||
| * @return {@link List}<{@link CountMonthVO}> | * @return {@link List}<{@link CountMonthVO}> | ||||
| */ | */ | ||||
| private List<CountMonthVO> getResult(List<Integer> years, List<MonthDataMapping> mappings) { | |||||
| private List<CountMonthVO> getResult(List<Integer> years, List<MonthCountMapping> mappings) { | |||||
| List<CountMonthVO> result = new ArrayList<>(); | List<CountMonthVO> result = new ArrayList<>(); | ||||
| Map<String, Integer> mappingMap = mappings.stream().collect(Collectors.toMap(MonthDataMapping::getName, MonthDataMapping::getCount)); | |||||
| Map<String, Integer> mappingMap = mappings.stream().collect(Collectors.toMap(MonthCountMapping::getName, MonthCountMapping::getCount)); | |||||
| for (int i = 0; i < years.size(); i++) { | for (int i = 0; i < years.size(); i++) { | ||||
| CountMonthVO vo = new CountMonthVO(); | CountMonthVO vo = new CountMonthVO(); | ||||
| List<MonthDataVO> months = new ArrayList<>(); | List<MonthDataVO> months = new ArrayList<>(); | ||||
| for (int j = 0; j < 12; j++) { | for (int j = 0; j < 12; j++) { | ||||
| MonthDataVO month = new MonthDataVO(); | MonthDataVO month = new MonthDataVO(); | ||||
| month.setMonth(j + 1); | |||||
| Integer count = mappingMap.get(years.get(i) + "-" + DateUtils.getMonthStr(j + 1)); | |||||
| String monthStr = DateUtils.getMonthStr(j + 1); | |||||
| month.setMonth(monthStr); | |||||
| Integer count = mappingMap.get(years.get(i) + "-" + monthStr); | |||||
| count = count != null ? count : 0; | count = count != null ? count : 0; | ||||
| month.setCount(count); | month.setCount(count); | ||||
| months.add(month); | months.add(month); | ||||
| @@ -1542,4 +1542,17 @@ public class DateUtils { | |||||
| DateTime dateTime = new DateTime(date, DateTimeZone.forTimeZone(TimeZone.getTimeZone("Asia/Shanghai"))); | DateTime dateTime = new DateTime(date, DateTimeZone.forTimeZone(TimeZone.getTimeZone("Asia/Shanghai"))); | ||||
| return dateTime.toString(); | return dateTime.toString(); | ||||
| } | } | ||||
| public static Date getFirstDayForCurrWeek() { | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.set(Calendar.DAY_OF_WEEK, 2); | |||||
| return c.getTime(); | |||||
| } | |||||
| public static Date getLastDayForCurrWeek() { | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.set(Calendar.DAY_OF_WEEK, 7); | |||||
| c.add(Calendar.DATE, 1); | |||||
| return c.getTime(); | |||||
| } | |||||
| } | } | ||||
| @@ -581,7 +581,7 @@ | |||||
| FROM wx_c_user_basic_info | FROM wx_c_user_basic_info | ||||
| WHERE final_tenant_id = #{finalTenantId} AND DATE_FORMAT(create_date, '%Y') = #{year} AND DATE_FORMAT(create_date, '%m') = #{month} | WHERE final_tenant_id = #{finalTenantId} AND DATE_FORMAT(create_date, '%Y') = #{year} AND DATE_FORMAT(create_date, '%m') = #{month} | ||||
| </select> | </select> | ||||
| <select id="groupByDate" resultType="com.iformall.domain.vo.cockpit.MonthDataMapping"> | |||||
| <select id="groupByDate" resultType="com.iformall.domain.vo.cockpit.MonthCountMapping"> | |||||
| SELECT | SELECT | ||||
| DATE_FORMAT( create_date, '%Y-%m' ) AS `name`, | DATE_FORMAT( create_date, '%Y-%m' ) AS `name`, | ||||
| COUNT( id ) AS `count` | COUNT( id ) AS `count` | ||||
| @@ -596,6 +596,20 @@ | |||||
| GROUP BY | GROUP BY | ||||
| DATE_FORMAT( create_date, '%Y-%m' ) | DATE_FORMAT( create_date, '%Y-%m' ) | ||||
| </select> | </select> | ||||
| <select id="countUser" resultType="java.lang.Integer"> | |||||
| SELECT | |||||
| COUNT(1) | |||||
| FROM | |||||
| wx_c_user_basic_info | |||||
| WHERE | |||||
| final_tenant_id = #{finalTenantId} | |||||
| <if test=" null != startDate"> | |||||
| and DATE_FORMAT( create_date, '%Y-%m-%d' ) >= DATE_FORMAT( #{startDate}, '%Y-%m-%d' ) | |||||
| </if> | |||||
| <if test=" null != endDate"> | |||||
| and DATE_FORMAT( create_date, '%Y-%m-%d' ) <= DATE_FORMAT( #{endDate}, '%Y-%m-%d' ) | |||||
| </if> | |||||
| </select> | |||||
| <update id="incActRecordById" parameterType="java.util.HashMap"> | <update id="incActRecordById" parameterType="java.util.HashMap"> | ||||
| @@ -134,7 +134,7 @@ | |||||
| AND ubi.create_date BETWEEN #{startdate} AND #{enddate}) c | AND ubi.create_date BETWEEN #{startdate} AND #{enddate}) c | ||||
| GROUP BY c.create_time ORDER BY c.create_time | GROUP BY c.create_time ORDER BY c.create_time | ||||
| </select> | </select> | ||||
| <select id="groupByDate" resultType="com.iformall.domain.vo.cockpit.MonthDataMapping"> | |||||
| <select id="groupByDate" resultType="com.iformall.domain.vo.cockpit.MonthCountMapping"> | |||||
| SELECT | SELECT | ||||
| DATE_FORMAT( create_date, '%Y-%m' ) AS `name`, | DATE_FORMAT( create_date, '%Y-%m' ) AS `name`, | ||||
| COUNT(DISTINCT c_user_id) AS count | COUNT(DISTINCT c_user_id) AS count | ||||
| @@ -149,5 +149,13 @@ | |||||
| GROUP BY | GROUP BY | ||||
| `name` | `name` | ||||
| </select> | </select> | ||||
| <select id="countCarUser" resultType="java.lang.Integer"> | |||||
| SELECT | |||||
| COUNT(DISTINCT c_user_id) AS count | |||||
| FROM | |||||
| wx_c_user_car | |||||
| WHERE | |||||
| tenant_id = #{finalTenantId} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -1197,5 +1197,47 @@ | |||||
| AND co.update_date <= #{endDate,jdbcType=TIMESTAMP} | AND co.update_date <= #{endDate,jdbcType=TIMESTAMP} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="orderGroupByDate" resultType="com.iformall.domain.vo.cockpit.MonthOrderMapping"> | |||||
| SELECT | |||||
| DATE_FORMAT( create_date, '%Y-%m' ) AS `name`, | |||||
| IFNULL( SUM( coupon_price ), 0 ) AS amount, | |||||
| COUNT(1) AS `count` | |||||
| FROM | |||||
| wx_coupon_order | |||||
| WHERE | |||||
| `tenant_id` = #{finalTenantId} | |||||
| AND DATE_FORMAT( create_date, '%Y' ) = #{year} | |||||
| GROUP BY | |||||
| `name` | |||||
| </select> | |||||
| <select id="verifiedOrderGroupByDate" resultType="com.iformall.domain.vo.cockpit.MonthOrderMapping"> | |||||
| SELECT | |||||
| DATE_FORMAT( create_date, '%Y-%m' ) AS `name`, | |||||
| IFNULL( SUM( coupon_price ), 0 ) AS amount, | |||||
| COUNT(1) AS `count`, | |||||
| COUNT(DISTINCT c_user_id) AS userCount | |||||
| FROM | |||||
| wx_coupon_order | |||||
| WHERE | |||||
| `tenant_id` = #{finalTenantId} | |||||
| AND coupon_order_status = '1' | |||||
| AND DATE_FORMAT( create_date, '%Y' ) = #{year} | |||||
| GROUP BY | |||||
| `name` | |||||
| </select> | |||||
| <select id="sumOrderAmount" resultType="java.math.BigDecimal"> | |||||
| SELECT | |||||
| IFNULL( SUM( coupon_price ), 0 ) AS amount | |||||
| FROM | |||||
| wx_coupon_order | |||||
| WHERE | |||||
| `tenant_id` = #{finalTenantId} | |||||
| <!-- <if test=" null != couponOrderStatus">--> | |||||
| <!-- and `coupon_order_status` = #{couponOrderStatus}--> | |||||
| <!-- </if>--> | |||||
| <!-- <if test=" null != specificDate">--> | |||||
| <!-- and DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( #{specificDate}, '%Y-%m-%d' )--> | |||||
| <!-- </if>--> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -497,5 +497,13 @@ | |||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="countMerchant" resultType="java.lang.Integer"> | |||||
| SELECT | |||||
| COUNT(1) | |||||
| FROM | |||||
| wx_merchant | |||||
| WHERE | |||||
| tenant_id = #{finalTenantId} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -164,7 +164,7 @@ | |||||
| and day_date <= #{endTime} | and day_date <= #{endTime} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="groupByDate" resultType="com.iformall.domain.vo.cockpit.MonthDataMapping"> | |||||
| <select id="groupByDate" resultType="com.iformall.domain.vo.cockpit.MonthCountMapping"> | |||||
| SELECT | SELECT | ||||
| DATE_FORMAT( day_date, '%Y-%m' ) AS `name`, | DATE_FORMAT( day_date, '%Y-%m' ) AS `name`, | ||||
| IFNULL( sum( visit_uv ), 0 ) AS count | IFNULL( sum( visit_uv ), 0 ) AS count | ||||
| @@ -179,5 +179,17 @@ | |||||
| GROUP BY | GROUP BY | ||||
| `name` | `name` | ||||
| </select> | </select> | ||||
| <select id="sumVisit" resultType="com.iformall.domain.dto.cockpit.SumVisitDTO"> | |||||
| SELECT | |||||
| IFNULL( sum( visit_uv ), 0 ) AS uv, | |||||
| IFNULL( sum( visit_pv ), 0 ) AS pv | |||||
| FROM | |||||
| wx_user_visit | |||||
| WHERE | |||||
| tenant_id = #{finalTenantId} | |||||
| <if test=" null != specificDate"> | |||||
| and DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( #{specificDate}, '%Y-%m-%d' ) | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||