关联关系修改

This commit is contained in:
2024-12-30 14:37:27 +08:00
parent fd7511ad55
commit aa7d1fab52
17 changed files with 154 additions and 71 deletions

View File

@ -38,4 +38,6 @@ public interface OrderMapper {
OrderAppRespVO appDetail(Long id);
List<OrderRespVO> refundList(OrderReqQuery query);
List<OrderItemEntity> listOrderItemByOrderId(Long orderId);
}

View File

@ -51,4 +51,8 @@ public interface SourceMapper {
List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
int addRelations(List<MemberSourceEntity> list);
int updateRelation(MemberSourceEntity memberSourceEntity);
List<SourceRespVO> queryByRelation(SourceReqQuery sourceReqQuery);
}

View File

@ -1,8 +1,6 @@
package com.ycwl.basic.mapper;
import com.ycwl.basic.model.pc.template.entity.TemplateEntity;
import com.ycwl.basic.model.pc.template.req.TemplateReqQuery;
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
import com.ycwl.basic.model.pc.video.req.VideoReqQuery;
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
@ -25,4 +23,11 @@ public interface VideoMapper {
int update(VideoEntity task);
VideoEntity findByTaskId(@NonNull Long taskId);
int addRelation(MemberVideoEntity source);
int addRelations(List<MemberVideoEntity> list);
int updateRelation(MemberVideoEntity memberVideoEntity);
List<VideoRespVO> queryByRelation(VideoReqQuery videoReqQuery);
}

View File

@ -19,10 +19,6 @@ public class GoodsPageVO {
private Long scenicId;
@ApiModelProperty("景区名称")
private String scenicName;
@ApiModelProperty("经度")
private BigDecimal longitude;
@ApiModelProperty("纬度")
private BigDecimal latitude;
@ApiModelProperty("商品类型 1:成片视频 2:源素材")
private Integer goodsType;
@ApiModelProperty("源素材类型 1:视频 2:图片")

View File

@ -13,6 +13,4 @@ import lombok.Data;
public class ScenicDeviceCountVO {
@ApiModelProperty("景区设备总数")
private Integer totalDeviceCount;
@ApiModelProperty("拍摄到用户的设备数量")
private Integer shotDeviceCount;
}

View File

@ -11,4 +11,5 @@ public class MemberSourceEntity {
private Integer type;
private Long sourceId;
private Integer isBuy;
private Long orderId;
}

View File

@ -35,11 +35,6 @@ public class SourceRespVO {
*/
@ApiModelProperty("来源设备id")
private Long deviceId;
/**
* 所属用户
*/
@ApiModelProperty("所属用户")
private Long memberId;
@ApiModelProperty("原素材类型1视频2图像")
private Integer type;
/**

View File

@ -0,0 +1,13 @@
package com.ycwl.basic.model.pc.video.entity;
import lombok.Data;
@Data
public class MemberVideoEntity {
private Long id;
private Long memberId;
private Long taskId;
private Long videoId;
private Integer isBuy;
private Long orderId;
}

View File

@ -41,10 +41,6 @@ public class VideoRespVO {
private BigDecimal slashPrice;
@ApiModelProperty("模版封面图片")
private String templateCoverUrl;
@ApiModelProperty("经度")
private BigDecimal longitude;
@ApiModelProperty("纬度")
private BigDecimal latitude;
/**
* 任务id
*/

View File

@ -26,6 +26,7 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @Authorlongbinbin
@ -54,14 +55,12 @@ public class GoodsServiceImpl implements GoodsService {
videoReqQuery.setIsBuy(query.getIsBuy());
videoReqQuery.setMemberId(Long.valueOf(BaseContextHandler.getUserId()));
//查询成片vlog
List<VideoRespVO> videoList = videoMapper.list(videoReqQuery);
List<VideoRespVO> videoList = videoMapper.queryByRelation(videoReqQuery);
videoList.forEach(videoRespVO -> {
GoodsPageVO goodsPageVO = new GoodsPageVO();
goodsPageVO.setGoodsName(videoRespVO.getTemplateName());
goodsPageVO.setScenicId(videoRespVO.getScenicId());
goodsPageVO.setScenicName(videoRespVO.getScenicName());
goodsPageVO.setLongitude(videoRespVO.getLongitude());
goodsPageVO.setLatitude(videoRespVO.getLatitude());
goodsPageVO.setGoodsType(1);
goodsPageVO.setGoodsId(videoRespVO.getId());
goodsPageVO.setTemplateName(videoRespVO.getTemplateName());
@ -73,21 +72,17 @@ public class GoodsServiceImpl implements GoodsService {
SourceReqQuery sourceReqQuery = new SourceReqQuery();
sourceReqQuery.setScenicId(query.getScenicId());
sourceReqQuery.setIsBuy(query.getIsBuy());
sourceReqQuery.setMemberId(query.getMemberId());
sourceReqQuery.setMemberId(Long.valueOf(BaseContextHandler.getUserId()));
//查询源素材
List<SourceRespVO> sourceList = sourceMapper.listGroupByType(sourceReqQuery);
sourceList.forEach(sourceRespVO -> {
List<SourceRespVO> sourceList = sourceMapper.queryByRelation(sourceReqQuery);
sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).forEach((type, value) -> {
GoodsPageVO goodsPageVO = new GoodsPageVO();
Integer type = sourceRespVO.getType();
if(type==1){
if (type == 1) {
goodsPageVO.setGoodsName("原片集");
}else {
} else {
goodsPageVO.setGoodsName("照片集");
}
goodsPageVO.setScenicId(sourceRespVO.getScenicId());
goodsPageVO.setScenicName(sourceRespVO.getScenicName());
goodsPageVO.setLongitude(sourceRespVO.getLongitude());
goodsPageVO.setLatitude(sourceRespVO.getLatitude());
goodsPageVO.setScenicId(query.getScenicId());
goodsPageVO.setGoodsType(2);
goodsPageVO.setSourceType(type);
goodsList.add(goodsPageVO);
@ -187,8 +182,6 @@ public class GoodsServiceImpl implements GoodsService {
goodsDetailVO.setGoodsName(videoRespVO.getTemplateName());
goodsDetailVO.setScenicId(videoRespVO.getScenicId());
goodsDetailVO.setScenicName(videoRespVO.getScenicName());
goodsDetailVO.setLongitude(videoRespVO.getLongitude());
goodsDetailVO.setLatitude(videoRespVO.getLatitude());
goodsDetailVO.setGoodsType(1);
goodsDetailVO.setGoodsId(videoRespVO.getId());
goodsDetailVO.setVideoUrl(videoRespVO.getVideoUrl());

View File

@ -27,11 +27,17 @@ import com.ycwl.basic.enums.BizCodeEnum;
import com.ycwl.basic.enums.OrderStateEnum;
import com.ycwl.basic.enums.StatisticEnum;
import com.ycwl.basic.exception.AppException;
import com.ycwl.basic.mapper.OrderMapper;
import com.ycwl.basic.mapper.PaymentMapper;
import com.ycwl.basic.mapper.SourceMapper;
import com.ycwl.basic.mapper.StatisticsMapper;
import com.ycwl.basic.mapper.VideoMapper;
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
import com.ycwl.basic.model.pc.order.entity.OrderItemEntity;
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
import com.ycwl.basic.model.pc.payment.entity.PaymentEntity;
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
import com.ycwl.basic.model.wx.WxPayRespVO;
import com.ycwl.basic.model.wx.WxchatCallbackSuccessData;
@ -88,6 +94,12 @@ public class WxPayServiceImpl implements WxPayService {
private PaymentMapper paymentMapper;
@Autowired
private StatisticsMapper statisticsMapper;
@Autowired
private OrderMapper orderMapper;
@Autowired
private SourceMapper sourceMapper;
@Autowired
private VideoMapper videoMapper;
@Override
public WxPayRespVO createOrder(WXPayOrderReqVO req) {
@ -196,7 +208,31 @@ public class WxPayServiceImpl implements WxPayService {
}catch (Exception e) {
log.error("[微信支付回调]更新订单状态失败", e);
}
OrderRespVO byId = orderMapper.getById(orderId);
List<OrderItemEntity> orderItemList = orderMapper.listOrderItemByOrderId(orderId);
orderItemList.forEach(orderItemVO -> {
switch (orderItemVO.getGoodsType()) {
case 1: // 成片
MemberVideoEntity memberVideoEntity = new MemberVideoEntity();
memberVideoEntity.setMemberId(byId.getMemberId());
memberVideoEntity.setVideoId(orderItemVO.getGoodsId());
memberVideoEntity.setIsBuy(1);
memberVideoEntity.setOrderId(orderId);
videoMapper.updateRelation(memberVideoEntity);
break;
case 2: // 源素材
MemberSourceEntity memberSourceEntity = new MemberSourceEntity();
memberSourceEntity.setMemberId(byId.getMemberId());
memberSourceEntity.setSourceId(orderItemVO.getGoodsId());
memberSourceEntity.setType(orderItemVO.getGoodsType());
memberSourceEntity.setIsBuy(1);
memberSourceEntity.setOrderId(orderId);
sourceMapper.updateRelation(memberSourceEntity);
break;
default:
break;
}
});
}
}).start();

View File

@ -128,19 +128,6 @@ public class OrderServiceImpl implements OrderService {
orderItemEntity.setGoodsType(goodsType);
orderItemEntity.setGoodsId(goodsId);
orderItems.add(orderItemEntity);
//修改商品状态
// if (Objects.equals(goodsType, GoodsTypeEnum.VIDEO.code)) {
// VideoEntity videoEntity = new VideoEntity();
// videoEntity.setId(goodsId);
// videoEntity.setIsBuy(1);
// videoMapper.update(videoEntity);
// }else if (Objects.equals(goodsType, GoodsTypeEnum.SOURCE.code)) {
// SourceEntity sourceEntity = new SourceEntity();
// sourceEntity.setId(goodsId);
// sourceEntity.setIsBuy(1);
// sourceMapper.update(sourceEntity);
// }
});
int addOrderItems = orderMapper.addOrderItems(orderItems);
if (addOrderItems == NumberConstant.ZERO) {

View File

@ -17,6 +17,7 @@ import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
import com.ycwl.basic.model.pc.task.req.TaskReqQuery;
import com.ycwl.basic.model.pc.task.resp.TaskRespVO;
import com.ycwl.basic.model.pc.template.entity.TemplateConfigEntity;
import com.ycwl.basic.model.pc.template.entity.TemplateEntity;
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
@ -130,6 +131,7 @@ public class TaskTaskServiceImpl implements TaskService {
if (faceId == null) {
return;
}
TemplateConfigEntity config = templateMapper.getConfig(templateId);
FaceRespVO faceRespVO = faceMapper.getById(faceId);
if (faceRespVO == null) {
return;
@ -141,6 +143,11 @@ public class TaskTaskServiceImpl implements TaskService {
.map(FaceSampleRespVO::getSourceId)
.map(sourceId -> sourceMapper.getById(sourceId))
.collect(Collectors.groupingBy(item -> item.getDeviceId().toString()));
if (config != null) {
if (config.getMinimalPlaceholderFill() > sourcesMap.size()) {
throw new RuntimeException("请先游玩后在来生成吧~");
}
}
TaskEntity taskEntity = new TaskEntity();
taskEntity.setId(SnowFlakeUtil.getLongId());
taskEntity.setFaceId(faceId);