数据
This commit is contained in:
parent
3f493b0d81
commit
9c13d7261c
@ -1,12 +1,18 @@
|
||||
package com.ycwl.basic.biz;
|
||||
|
||||
import com.ycwl.basic.enums.StatisticEnum;
|
||||
import com.ycwl.basic.mapper.OrderMapper;
|
||||
import com.ycwl.basic.mapper.StatisticsMapper;
|
||||
import com.ycwl.basic.mapper.VideoMapper;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.order.entity.OrderEntity;
|
||||
import com.ycwl.basic.model.pc.order.entity.OrderItemEntity;
|
||||
import com.ycwl.basic.model.pc.order.req.OrderUpdateReq;
|
||||
import com.ycwl.basic.model.pc.order.resp.OrderAppRespVO;
|
||||
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
@ -17,10 +23,12 @@ import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.repository.SourceRepository;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
import com.ycwl.basic.repository.VideoRepository;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -41,6 +49,10 @@ public class OrderBiz {
|
||||
private SourceRepository sourceRepository;
|
||||
@Autowired
|
||||
private VideoRepository videoRepository;
|
||||
@Autowired
|
||||
private StatisticsMapper statisticsMapper;
|
||||
@Autowired
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
||||
PriceObj priceObj = new PriceObj();
|
||||
@ -159,6 +171,30 @@ public class OrderBiz {
|
||||
}
|
||||
});
|
||||
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
||||
|
||||
//支付时间
|
||||
Date payAt = order.getPayAt();
|
||||
OrderAppRespVO orderDetail = orderMapper.appDetail(orderId);
|
||||
//商品创建时间
|
||||
Date goodsCreateTime = orderDetail.getOrderItemList().get(0).getShootingTime();
|
||||
|
||||
StatisticsRecordAddReq statisticsRecordAddReq = new StatisticsRecordAddReq();
|
||||
statisticsRecordAddReq.setMemberId(order.getMemberId());
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(goodsCreateTime);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 21);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
// TODO: 他的购买的内容于内容生成当天晚9点之前算现场订单,否则算推送订单
|
||||
if(calendar.getTime().compareTo(payAt)>0){//
|
||||
statisticsRecordAddReq.setType(StatisticEnum.ON_SITE_PAYMENT.code);
|
||||
}else {
|
||||
statisticsRecordAddReq.setType(StatisticEnum.POST_PAYMENT.code);
|
||||
}
|
||||
calendar.clear();
|
||||
statisticsRecordAddReq.setScenicId(order.getScenicId());
|
||||
statisticsRecordAddReq.setMorphId(orderId);
|
||||
statisticsMapper.addStatisticsRecord(statisticsRecordAddReq);
|
||||
}
|
||||
|
||||
public void cancelOrder(Long orderId) {
|
||||
|
@ -7,8 +7,8 @@ public enum StatisticEnum {
|
||||
SCAN_THE_CODE_TO_ENTER(0,"扫码进入"),
|
||||
UPLOAD_FACE(1,"上传人脸"),
|
||||
PREVIEWING_VIDEO(2,"预览视频"),
|
||||
ON_SITE_PAYMENT(3,"现场支付"),
|
||||
POST_PAYMENT(4,"事后支付"),
|
||||
POST_PAYMENT(3,"事后支付"),
|
||||
ON_SITE_PAYMENT(4,"现场支付"),
|
||||
REFUND(5,"退款"),
|
||||
MESSAGE_PUSH(6,"消息推送"),
|
||||
DOWNLOAD(8,"下载"),
|
||||
|
@ -213,12 +213,14 @@ public class AppStatisticsServiceImpl implements AppStatisticsService {
|
||||
@Override
|
||||
public ApiResponse addStatistics(StatisticsRecordAddReq req) {
|
||||
// req.setId(SnowFlakeUtil.getLongId());
|
||||
try {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
Long userId = worker.getUserId();
|
||||
req.setMemberId(userId);
|
||||
} catch (Exception ignored) {
|
||||
if (req.getMemberId() == null) {
|
||||
try {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
Long userId = worker.getUserId();
|
||||
req.setMemberId(userId);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
Integer type = req.getType();
|
||||
if(type==null){
|
||||
|
@ -223,34 +223,6 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private void statisticsHandler(Long orderId) {
|
||||
ApiResponse<OrderRespVO> orderDetail = orderService.detail(orderId);
|
||||
OrderRespVO orderData = orderDetail.getData();
|
||||
//支付时间
|
||||
Date payAt = orderData.getPayAt();
|
||||
//商品创建时间
|
||||
Date createTime = orderData.getOrderItemList().get(0).getCreateTime();
|
||||
|
||||
StatisticsRecordAddReq statisticsRecordAddReq = new StatisticsRecordAddReq();
|
||||
statisticsRecordAddReq.setMemberId(orderData.getMemberId());
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(createTime);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 21);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
// TODO: 他的购买的内容于内容生成当天晚9点之前算现场订单,否则算推送订单
|
||||
if(calendar.getTime().compareTo(payAt)>0){//
|
||||
statisticsRecordAddReq.setType(StatisticEnum.ON_SITE_PAYMENT.code);
|
||||
}else {
|
||||
statisticsRecordAddReq.setType(StatisticEnum.POST_PAYMENT.code);
|
||||
}
|
||||
calendar.clear();
|
||||
statisticsRecordAddReq.setScenicId(orderData.getScenicId());
|
||||
statisticsRecordAddReq.setMorphId(orderId);
|
||||
statisticsMapper.addStatisticsRecord(statisticsRecordAddReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxchatCallbackSuccessData queryPay(Long orderId) {
|
||||
WxchatCallbackSuccessData wxchatCallbackSuccessData = new WxchatCallbackSuccessData();
|
||||
|
@ -228,6 +228,14 @@ public class FaceServiceImpl implements FaceService {
|
||||
// 以这个结果为人脸库的匹配结果
|
||||
scenicDbSearchResult = faceService.searchFace(face.getScenicId().toString(), faceSample.getFaceUrl(), "补救措施2:存在得分够高但是结果少");
|
||||
}
|
||||
} else if (scenicDbSearchResult.getSampleListIds().size() > 5) {
|
||||
// 补救逻辑
|
||||
Long faceSampleId = scenicDbSearchResult.getSampleListIds().get(0);
|
||||
FaceSampleEntity faceSample = faceRepository.getFaceSample(faceSampleId);
|
||||
if (faceSample != null) {
|
||||
// 以这个结果为人脸库的匹配结果
|
||||
scenicDbSearchResult = faceService.searchFace(face.getScenicId().toString(), faceSample.getFaceUrl(), "补救措施3:人脸数过多大于5");
|
||||
}
|
||||
}
|
||||
}
|
||||
FaceEntity faceEntity = new FaceEntity();
|
||||
|
@ -38,7 +38,7 @@
|
||||
SELECT
|
||||
IFNULL(count(1), 0) AS count
|
||||
FROM (
|
||||
select count(1) as count
|
||||
select 1
|
||||
from statistics
|
||||
where type=10 and morph_id in (1047,1048,1049) and scenic_id = #{scenicId}
|
||||
<if test="startTime!= null">
|
||||
@ -47,7 +47,6 @@
|
||||
<if test="endTime!= null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
group by member_id
|
||||
) AS subquery;
|
||||
</select>
|
||||
<select id="countClickPayOfMember" resultType="java.lang.Integer">
|
||||
@ -83,23 +82,28 @@
|
||||
)a
|
||||
</select>
|
||||
<select id="countSceneOrderNum" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
IFNULL(count(count), 0) AS count
|
||||
FROM (
|
||||
select count(1) as count
|
||||
from `order`
|
||||
where scenic_id = #{scenicId} and pay_at is not null
|
||||
from statistics
|
||||
where type=4 and scenic_id = #{scenicId}
|
||||
<if test="startTime!= null">
|
||||
and create_at >= #{startTime}
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!= null">
|
||||
and create_at <= #{endTime}
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
group by morph_id
|
||||
)a
|
||||
</select>
|
||||
<select id="countPushOrderNum" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
IFNULL(SUM(count), 0) AS count
|
||||
IFNULL(count(count), 0) AS count
|
||||
FROM (
|
||||
select count(1) as count
|
||||
from statistics
|
||||
where type=4 and scenic_id = #{scenicId}
|
||||
where type=3 and scenic_id = #{scenicId}
|
||||
<if test="startTime!= null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
|
Loading…
x
Reference in New Issue
Block a user