| @@ -5,6 +5,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.po.WxOrderGroup; | import com.iformall.domain.po.WxOrderGroup; | ||||
| import com.iformall.domain.vo.WxOrderGroupMarketing; | |||||
| import com.iformall.enums.EnumOrderStatus; | import com.iformall.enums.EnumOrderStatus; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.WxOrderGroupService; | import com.iformall.service.WxOrderGroupService; | ||||
| @@ -122,4 +123,16 @@ public class WxOrderGroupController extends BaseController { | |||||
| return wxOrderGroupService.queryAttendStatus(wxOrderGroup); | return wxOrderGroupService.queryAttendStatus(wxOrderGroup); | ||||
| } | } | ||||
| @ApiOperation(value = "拼团营销分析") | |||||
| @GetMapping("queryOrderGroupMarketingList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "couponId", value = "couponId", dataType = "String", paramType = "query"), | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData queryOrderGroupMarketingList(@ModelAttribute WxOrderGroupMarketing wxOrderGroupMarketing, Integer pageNum, Integer pageSize) { | |||||
| final PageInfo<WxOrderGroupMarketing> page = wxOrderGroupService.queryOrderGroupMarketingList(wxOrderGroupMarketing, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,25 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| public class WxOrderGroupMarketing implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private String tenantId; | |||||
| private String couponId; | |||||
| private String coverImg; | |||||
| private String title; | |||||
| private String price; | |||||
| private String salePrice; | |||||
| private String groupTotalCount; | |||||
| private String groupSuccessCount; | |||||
| private String groupTransferRatio; | |||||
| private String successPeople; | |||||
| private String verifyCount; | |||||
| private String verifyRatio; | |||||
| private String totalPeople; | |||||
| } | |||||
| @@ -3,6 +3,7 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.po.WxOrderGroup; | import com.iformall.domain.po.WxOrderGroup; | ||||
| import com.iformall.domain.vo.WxOrderGroupMarketing; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -18,4 +19,17 @@ public interface WxOrderGroupMapper extends CommonMapper<WxOrderGroup, Long> { | |||||
| int updateOrderGroup(WxOrderGroup wxOrderGroup); | int updateOrderGroup(WxOrderGroup wxOrderGroup); | ||||
| List<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing); | |||||
| List<Map<String, Object>> queryOrderGroupSuccessCountAndTime(Map<String, Object> params); | |||||
| List<Map<String, Object>> queryOrderGroupVerifyCountAndTime(Map<String, Object> params); | |||||
| long queryOrderGroupCount(Map<String, Object> params); | |||||
| long queryOrderGroupSuccessCount(Map<String, Object> params); | |||||
| long queryOrderGroupPeopleCount(Map<String, Object> params); | |||||
| } | } | ||||
| @@ -5,6 +5,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.po.WxOrderGroup; | import com.iformall.domain.po.WxOrderGroup; | ||||
| import com.iformall.domain.vo.WxOrderGroupMarketing; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -30,4 +31,6 @@ public interface WxOrderGroupService { | |||||
| List<WxOrderGroup> findList(WxOrderGroup group); | List<WxOrderGroup> findList(WxOrderGroup group); | ||||
| PageInfo<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing, Integer pageNum, Integer pageSize); | |||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxOrderGroupMarketing; | |||||
| import com.iformall.enums.EnumAppType; | import com.iformall.enums.EnumAppType; | ||||
| import com.iformall.enums.EnumCouponStatus; | import com.iformall.enums.EnumCouponStatus; | ||||
| import com.iformall.enums.EnumOrderStatus; | import com.iformall.enums.EnumOrderStatus; | ||||
| @@ -287,6 +288,14 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||||
| return wxOrderGroupMapper.select(group); | return wxOrderGroupMapper.select(group); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing, Integer pageIndex, Integer pageSize) { | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<WxOrderGroupMarketing> result = wxOrderGroupMapper.queryOrderGroupMarketingList(marketing); | |||||
| PageInfo<WxOrderGroupMarketing> pageInfo = new PageInfo<>(result); | |||||
| return pageInfo; | |||||
| } | |||||
| public void returnMoney(WxOrderGroup group) { | public void returnMoney(WxOrderGroup group) { | ||||
| //券失效或拼团超时 修改 拼团的状态 | //券失效或拼团超时 修改 拼团的状态 | ||||
| wxOrderGroupMapper.updateByPrimaryKeySelective(group); | wxOrderGroupMapper.updateByPrimaryKeySelective(group); | ||||
| @@ -94,5 +94,101 @@ | |||||
| <update id="updateOrderGroup" parameterType="com.iformall.domain.po.WxOrderGroup"> | <update id="updateOrderGroup" parameterType="com.iformall.domain.po.WxOrderGroup"> | ||||
| update wx_order_group set remain_people=remain_people-1,update_date=#{updateDate} where id=#{id} and remain_people>0 | update wx_order_group set remain_people=remain_people-1,update_date=#{updateDate} where id=#{id} and remain_people>0 | ||||
| </update> | </update> | ||||
| <select id="queryOrderGroupMarketingList" parameterType="com.iformall.domain.vo.WxOrderGroupMarketing" | |||||
| resultType="com.iformall.domain.vo.WxOrderGroupMarketing"> | |||||
| select c.tenant_id,coupon_id,c.cover_img,title,c.price,c.sale_price,c.group_total_count,c.group_success_count, | |||||
| ROUND(IFNULL((c.group_success_count/c.group_total_count),0)*100) | |||||
| group_transfer_ratio,c.success_people,c.verify_count, | |||||
| ROUND(IFNULL((verify_count/success_people),0)*100) verify_ratio,c.total_people from( | |||||
| select tenant_id,id couponId,cover_img,title,FORMAT(price/100,2) price,FORMAT(sale_price/100,2) sale_price, | |||||
| (select count(*) total from wx_order_group where coupon_id=c.id) group_total_count, | |||||
| (select count(*) total from wx_order_group where status=11 and coupon_id=c.id) group_success_count, | |||||
| IFNULL((select success.total from ( | |||||
| select count(success.product_id) total,success.product_id from ( | |||||
| select product_id,c_user_id from wx_order | |||||
| where order_status=11 | |||||
| group by product_id,c_user_id) success | |||||
| group by success.product_id) success where success.product_id=c.id),0) success_people, | |||||
| (select count(*) total | |||||
| from wx_coupon_order where coupon_type=9 and coupon_order_status=1 and coupon_id=c.id) verify_count, | |||||
| IFNULL((select success.total from ( | |||||
| select count(success.product_id) total,success.product_id from ( | |||||
| select product_id,c_user_id from wx_order | |||||
| group by product_id,c_user_id) success | |||||
| group by success.product_id) success where success.product_id=c.id),0) total_people | |||||
| from wx_coupon c where type=9 | |||||
| ) c | |||||
| <where> | |||||
| <if test=" null != couponId "> | |||||
| and c.coupon_id=#{couponId} | |||||
| </if> | |||||
| </where> | |||||
| </select> | |||||
| <select id="queryOrderGroupSuccessCountAndTime" parameterType="hashmap" resultType="hashmap"> | |||||
| select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time from wx_coupon_order | |||||
| where coupon_type=9 | |||||
| <if test=" null != tenantId"> | |||||
| and tenant_id=#{tenantId} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate "> | |||||
| and create_date BETWEEN #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and coupon_id=#{couponId} | |||||
| </if> | |||||
| group by time | |||||
| </select> | |||||
| <select id="queryOrderGroupVerifyCountAndTime" parameterType="hashmap" resultType="hashmap"> | |||||
| select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time | |||||
| from wx_coupon_order where coupon_type=9 and coupon_order_status=1 | |||||
| <if test=" null != tenantId"> | |||||
| and tenant_id=#{tenantId} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate "> | |||||
| and create_date BETWEEN #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and coupon_id=#{couponId} | |||||
| </if> | |||||
| group by time | |||||
| </select> | |||||
| <select id="queryOrderGroupCount" parameterType="hashmap" resultType="long"> | |||||
| select count(*) total from wx_order_group | |||||
| <where> | |||||
| <if test=" null != tenantId"> | |||||
| and tenant_id=#{tenantId} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate "> | |||||
| and create_date BETWEEN #{startdate} and #{enddate} | |||||
| </if> | |||||
| </where> | |||||
| </select> | |||||
| <select id="queryOrderGroupSuccessCount" parameterType="hashmap" resultType="long"> | |||||
| select count(*) total from wx_order_group where status=11 | |||||
| <if test=" null != tenantId"> | |||||
| and tenant_id=#{tenantId} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate "> | |||||
| and create_date BETWEEN #{startdate} and #{enddate} | |||||
| </if> | |||||
| </select> | |||||
| <select id="queryOrderGroupPeopleCount" parameterType="hashmap" resultType="long"> | |||||
| select count(*) from (select DISTINCT c_user_id from wx_order where order_group_id!=0 | |||||
| <if test=" null != tenantId"> | |||||
| and tenant_id=#{tenantId} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate "> | |||||
| and create_date BETWEEN #{startdate} and #{enddate} | |||||
| </if> | |||||
| ) g | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||