Просмотр исходного кода

[卡券][修改]:场景发券数据汇总

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
59823f7ec1
7 измененных файлов: 80 добавлений и 30 удалений
  1. +7
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponSendController.java
  2. +12
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponSend.java
  3. +3
    -5
      mallinkService/src/main/java/com/iformall/mapper/WxCouponActionLogMapper.java
  4. +3
    -5
      mallinkService/src/main/java/com/iformall/service/WxCouponActionLogService.java
  5. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java
  6. +4
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponActionLogServiceImpl.java
  7. +48
    -18
      mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml

+ 7
- 0
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponSendController.java Просмотреть файл

@@ -9,6 +9,7 @@ import com.iformall.domain.po.WxCouponSend;
import com.iformall.enums.EnumCouponSendStatus; import com.iformall.enums.EnumCouponSendStatus;
import com.iformall.enums.EnumCouponSendType; import com.iformall.enums.EnumCouponSendType;
import com.iformall.enums.EnumCouponStatus; import com.iformall.enums.EnumCouponStatus;
import com.iformall.service.WxCouponActionLogService;
import com.iformall.service.WxCouponSendService; import com.iformall.service.WxCouponSendService;
import com.iformall.service.WxCouponService; import com.iformall.service.WxCouponService;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -31,6 +32,8 @@ public class WxCouponSendController extends BaseController {
private WxCouponSendService wxCouponSendService; private WxCouponSendService wxCouponSendService;
@Autowired @Autowired
private WxCouponService wxCouponService; private WxCouponService wxCouponService;
@Autowired
private WxCouponActionLogService wxCouponActionLogService;


@ApiOperation("分页列表接口") @ApiOperation("分页列表接口")
@GetMapping("list") @GetMapping("list")
@@ -42,6 +45,10 @@ public class WxCouponSendController extends BaseController {
wxCouponSend.setTenantId(getTenantId()); wxCouponSend.setTenantId(getTenantId());
wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode());
final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize);

for (WxCouponSend cs:page.getList())
cs.setSendCount(wxCouponActionLogService.getCountByChannelId(getTenantId(), cs.getSendType(), cs.getId()));

return new ResultData(page); return new ResultData(page);
} }




+ 12
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCouponSend.java Просмотреть файл

@@ -74,6 +74,12 @@ public class WxCouponSend implements Serializable {
/*更新时间**/ /*更新时间**/
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate; private Date updateDate;

/*场景发券计数**/
@Transient
protected int sendCount;


public String getTenantId() { public String getTenantId() {
return tenantId; return tenantId;
} }
@@ -141,7 +147,13 @@ public class WxCouponSend implements Serializable {
updateDate = _updateDate; updateDate = _updateDate;
} }


public int getSendCount() {
return sendCount;
}


public void setSendCount(int sendCount) {
this.sendCount = sendCount;
}


public static enum Field public static enum Field
{ {


+ 3
- 5
mallinkService/src/main/java/com/iformall/mapper/WxCouponActionLogMapper.java Просмотреть файл

@@ -25,10 +25,8 @@ public interface WxCouponActionLogMapper extends CommonMapper<WxCouponActionLog,
List<MarkingSceneDataReportVo> sceneDataList(HashMap<String,Object> params); List<MarkingSceneDataReportVo> sceneDataList(HashMap<String,Object> params);


List<MarkingSceneDataReportVo> sceneDataJoinCouponOrderList(HashMap<String,Object> params); List<MarkingSceneDataReportVo> sceneDataJoinCouponOrderList(HashMap<String,Object> params);



int getCountByChannelId(@Param("tenantId")String tenantId,@Param("channelType") int channelType,@Param("channelId")Long channelId);
} }

+ 3
- 5
mallinkService/src/main/java/com/iformall/service/WxCouponActionLogService.java Просмотреть файл

@@ -37,13 +37,11 @@ public interface WxCouponActionLogService {
*/ */
void deleteById(Long id); void deleteById(Long id);



void addOne(String tenantId,Long couponId,Long coupon_order_id,int channelType,Long channelId); void addOne(String tenantId,Long couponId,Long coupon_order_id,int channelType,Long channelId);



int getCountByChannelId(String tenantId, int channelType, Long channelId);
} }

+ 3
- 2
mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java Просмотреть файл

@@ -8,6 +8,7 @@ import com.iformall.domain.vo.MarkingCouponDataReportVo;
import com.iformall.domain.vo.MarkingSceneDataReportVo; import com.iformall.domain.vo.MarkingSceneDataReportVo;
import com.iformall.domain.vo.MarkingSceneDataVo; import com.iformall.domain.vo.MarkingSceneDataVo;
import com.iformall.domain.vo.TouchUsersReportVo; import com.iformall.domain.vo.TouchUsersReportVo;
import com.iformall.enums.EnumCouponSendSendType;
import com.iformall.enums.EnumCouponType; import com.iformall.enums.EnumCouponType;
import com.iformall.mapper.*; import com.iformall.mapper.*;
import com.iformall.service.MarkingDataReportService; import com.iformall.service.MarkingDataReportService;
@@ -163,7 +164,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params1.put("tenantId", tenantId); params1.put("tenantId", tenantId);
params1.put("startTime", getFirstDayOfMonth()); params1.put("startTime", getFirstDayOfMonth());
params1.put("endTime", addDay(1)); params1.put("endTime", addDay(1));
params1.put("channelType", 3);//停车
params1.put("channelType", EnumCouponSendSendType.CAR_STOP);//停车
List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1); List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1);
Map<String, Integer> parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); Map<String, Integer> parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount()));
//核销发券被核销数 //核销发券被核销数
@@ -171,7 +172,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params2.put("tenantId", tenantId); params2.put("tenantId", tenantId);
params2.put("startTime", getFirstDayOfMonth()); params2.put("startTime", getFirstDayOfMonth());
params2.put("endTime", addDay(1)); params2.put("endTime", addDay(1));
params2.put("channelType", 4);//核销
params2.put("channelType", EnumCouponSendSendType.COUPON_VERIFY);//核销
List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2); List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2);
Map<String, Integer> verifyCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); Map<String, Integer> verifyCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount()));




+ 4
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponActionLogServiceImpl.java Просмотреть файл

@@ -59,5 +59,9 @@ public class WxCouponActionLogServiceImpl implements WxCouponActionLogService {
saveOrUpdate(actionLog); saveOrUpdate(actionLog);
} }


@Override
public int getCountByChannelId(String tenantId, int channelType, Long channelId) {
return wxCouponActionLogMapper.getCountByChannelId(tenantId, channelType, channelId);
}


} }

+ 48
- 18
mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml Просмотреть файл

@@ -73,36 +73,66 @@
</select> </select>


<select id="findCountByDateLimit" resultType="java.lang.Integer"> <select id="findCountByDateLimit" resultType="java.lang.Integer">
select COUNT(*) FROM wx_coupon_action_log where tenant_id = #{tenantId} and `createtime` >= #{startTime} and `createtime` &lt;= #{endTime}
select COUNT(*) FROM wx_coupon_action_log
where tenant_id = #{tenantId}
and `createtime` >= #{startTime}
and `createtime` &lt;= #{endTime}
</select> </select>


<select id="sceneDataMap" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> <select id="sceneDataMap" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
select DATE_FORMAT(createtime,'%m/%d') as xTime, (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%m/%d')=xTime and c.channel_type=3 and tenant_id=#{tenantId} ) as parkSendCount,(select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%m/%d')=xTime and c.channel_type=4 and tenant_id=#{tenantId}) as verifySendCount
from wx_coupon_action_log where tenant_id=#{tenantId} and createtime &gt;= #{startTime} and createtime &lt;= #{endTime} group by xTime
select DATE_FORMAT(createtime,'%m/%d') as xTime,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(createtime,'%m/%d')=xTime
and c.channel_type=2
and tenant_id=#{tenantId} ) as parkSendCount,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(createtime,'%m/%d')=xTime
and c.channel_type=3
and tenant_id=#{tenantId}) as verifySendCount
from wx_coupon_action_log
where tenant_id=#{tenantId}
and createtime &gt;= #{startTime}
and createtime &lt;= #{endTime} group by xTime
</select> </select>


<select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> <select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
select DATE_FORMAT(create_date,'%m/%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id where wx_coupon_action_log.tenant_id=#{tenantId}
AND wx_coupon_order.coupon_order_status = 1 and wx_coupon_action_log.createtime &gt;= #{startTime} and wx_coupon_action_log.createtime &lt;= #{endTime}
AND wx_coupon_action_log.channel_type = #{channelType} group by xTime
select DATE_FORMAT(create_date,'%m/%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log
left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
where wx_coupon_action_log.tenant_id=#{tenantId}
and wx_coupon_order.coupon_order_status = 1
and wx_coupon_action_log.createtime &gt;= #{startTime}
and wx_coupon_action_log.createtime &lt;= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType} group by xTime
</select> </select>


<select id="sceneDataList" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> <select id="sceneDataList" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
select DATE_FORMAT(createtime,'%Y-%m-%d') as xTime, (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%Y-%m-%d')=xTime and c.channel_type=3 and tenant_id=#{tenantId} ) as parkSendCount,(select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%Y-%m-%d')=xTime and c.channel_type=4 and tenant_id=#{tenantId}) as verifySendCount select DATE_FORMAT(createtime,'%Y-%m-%d') as xTime, (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%Y-%m-%d')=xTime and c.channel_type=3 and tenant_id=#{tenantId} ) as parkSendCount,(select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%Y-%m-%d')=xTime and c.channel_type=4 and tenant_id=#{tenantId}) as verifySendCount
from wx_coupon_action_log where tenant_id=#{tenantId}
<if test=" null != startTime ">
and createtime &gt;= #{startTime}
</if>
<if test=" null != endTime ">
and createtime &lt;= #{endTime}
</if>
group by xTime
order by xTime desc
from wx_coupon_action_log where tenant_id=#{tenantId}
<if test=" null != startTime ">
and createtime &gt;= #{startTime}
</if>
<if test=" null != endTime ">
and createtime &lt;= #{endTime}
</if>
group by xTime
order by xTime desc
</select> </select>


<select id="sceneDataJoinCouponOrderList" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> <select id="sceneDataJoinCouponOrderList" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
select DATE_FORMAT(create_date,'%Y-%m-%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id where wx_coupon_action_log.tenant_id=#{tenantId}
AND wx_coupon_order.coupon_order_status = 1 and wx_coupon_action_log.createtime &gt;= #{startTime} and wx_coupon_action_log.createtime &lt;= #{endTime}
AND wx_coupon_action_log.channel_type = #{channelType} group by xTime
select DATE_FORMAT(create_date,'%Y-%m-%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
where wx_coupon_action_log.tenant_id=#{tenantId}
and wx_coupon_order.coupon_order_status = 1
and wx_coupon_action_log.createtime &gt;= #{startTime}
and wx_coupon_action_log.createtime &lt;= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType} group by xTime
</select> </select>


<select id="getCountByChannelId" resultType="java.lang.Integer">
select COUNT(*) FROM wx_coupon_action_log
where tenant_id = #{tenantId}
and channel_type = #{channelType}
and channel_id &lt;= #{channelId}
</select>

</mapper> </mapper>

Загрузка…
Отмена
Сохранить