订单类型,名称变更
This commit is contained in:
parent
e199e0e57b
commit
99f5adf841
@ -18,6 +18,7 @@ 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.source.entity.SourceEntity;
|
||||
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||
@ -28,6 +29,7 @@ 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.repository.VideoTaskRepository;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -64,6 +66,8 @@ public class OrderBiz {
|
||||
private SourceMapper sourceMapper;
|
||||
@Autowired
|
||||
private ProfitSharingBiz profitSharingBiz;
|
||||
@Autowired
|
||||
private VideoTaskRepository videoTaskRepository;
|
||||
|
||||
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
||||
PriceObj priceObj = new PriceObj();
|
||||
@ -87,6 +91,10 @@ public class OrderBiz {
|
||||
if (video == null) {
|
||||
return null;
|
||||
}
|
||||
TaskEntity task = videoTaskRepository.getTaskById(video.getTaskId());
|
||||
if (task != null) {
|
||||
priceObj.setFaceId(task.getFaceId());
|
||||
}
|
||||
TemplateRespVO template = templateRepository.getTemplate(video.getTemplateId());
|
||||
if (template == null) {
|
||||
return priceObj;
|
||||
@ -103,10 +111,12 @@ public class OrderBiz {
|
||||
case 1: // source
|
||||
priceObj.setPrice(scenic.getSourceVideoPrice());
|
||||
priceObj.setSlashPrice(scenic.getSourceVideoPrice());
|
||||
priceObj.setFaceId(goodsId);
|
||||
break;
|
||||
case 2: // source
|
||||
priceObj.setPrice(scenic.getSourceImagePrice());
|
||||
priceObj.setSlashPrice(scenic.getSourceImagePrice());
|
||||
priceObj.setFaceId(goodsId);
|
||||
break;
|
||||
}
|
||||
return priceObj;
|
||||
@ -115,6 +125,22 @@ public class OrderBiz {
|
||||
public IsBuyRespVO isBuy(Long userId, Long scenicId, int goodsType, Long goodsId) {
|
||||
IsBuyRespVO respVO = new IsBuyRespVO();
|
||||
boolean isBuy = orderRepository.checkUserBuyItem(userId, goodsType, goodsId);
|
||||
// 模板购买逻辑
|
||||
if (!isBuy) {
|
||||
if (goodsType == 0) {
|
||||
VideoEntity video = videoRepository.getVideo(goodsId);
|
||||
TaskEntity task = videoTaskRepository.getTaskById(video.getTaskId());
|
||||
Long templateId = video.getTemplateId();
|
||||
// -1为整个模板购买
|
||||
OrderEntity orderEntity = orderRepository.getUserBuyItem(userId, -1, templateId);
|
||||
if (orderEntity != null && task != null) {
|
||||
respVO.setOrderId(orderEntity.getId());
|
||||
if (orderEntity.getFaceId() != null && task.getFaceId() != null) {
|
||||
isBuy = orderEntity.getFaceId().equals(task.getFaceId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 免费送逻辑,之前已经赠送了的
|
||||
if (!isBuy) {
|
||||
switch (goodsType) {
|
||||
|
@ -38,7 +38,7 @@ public class PriceBiz {
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null) {
|
||||
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
||||
goodsList.add(new GoodsListRespVO(1L, "原片集"));
|
||||
goodsList.add(new GoodsListRespVO(1L, "录像集"));
|
||||
}
|
||||
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage())) {
|
||||
goodsList.add(new GoodsListRespVO(2L, "照片集"));
|
||||
@ -52,8 +52,11 @@ public class PriceBiz {
|
||||
if (priceConfig == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
String[] goodsIds = priceConfig.getGoodsIds().split(",");
|
||||
List<GoodsListRespVO> goodsList = listGoodsByScenic(priceConfig.getScenicId());
|
||||
if (Integer.valueOf(-1).equals(priceConfig.getType())) {
|
||||
return goodsList;
|
||||
}
|
||||
String[] goodsIds = priceConfig.getGoodsIds().split(",");
|
||||
return goodsList.stream().filter(goods -> {
|
||||
for (String goodsId : goodsIds) {
|
||||
if (StringUtils.equals(goods.getGoodsId().toString(), goodsId)) {
|
||||
|
@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public enum SourceTypeNameEnum {
|
||||
ORIGINAL_FILM_SET(1, "原片集"),
|
||||
ORIGINAL_FILM_SET(1, "录像集"),
|
||||
PHOTO_GALLERY(2, "照片集"),
|
||||
UNKNOWN(-1, "未知");
|
||||
private int type;
|
||||
|
@ -10,6 +10,7 @@ public class PriceObj {
|
||||
private Long scenicId;
|
||||
private int goodsType;
|
||||
private Long goodsId;
|
||||
private Long faceId;
|
||||
private BigDecimal price = BigDecimal.ZERO;
|
||||
private BigDecimal scenicAllPrice;
|
||||
private BigDecimal slashPrice;
|
||||
|
@ -26,6 +26,7 @@ public class OrderEntity {
|
||||
* 用户id
|
||||
*/
|
||||
private Long memberId;
|
||||
private Long faceId;
|
||||
/**
|
||||
* 微信openId
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@ public class OrderItemEntity {
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 商品类型,0其他,1成片,,2源素材
|
||||
* 商品类型,-1模板,0其他,1成片,2源素材
|
||||
*/
|
||||
private Integer goodsType;
|
||||
/**
|
||||
|
@ -19,6 +19,9 @@ import java.util.List;
|
||||
public class OrderRespVO {
|
||||
private Long id;
|
||||
private Long memberId;
|
||||
private Long faceId;
|
||||
private String faceUrl;
|
||||
private Integer type;
|
||||
@ApiModelProperty("用户昵称")
|
||||
private String memberNickname;
|
||||
@ApiModelProperty("用户真实名称")
|
||||
|
@ -153,7 +153,7 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
List<SourceRespVO> sourceList = sourceMapper.queryByRelation(sourceReqQuery);
|
||||
ContentPageVO sourceVideoContent = new ContentPageVO();
|
||||
ContentPageVO sourceImageContent = new ContentPageVO();
|
||||
sourceVideoContent.setName("原片集");
|
||||
sourceVideoContent.setName("录像集");
|
||||
sourceImageContent.setName("照片集");
|
||||
sourceVideoContent.setScenicId(faceRespVO.getScenicId());
|
||||
sourceImageContent.setScenicId(faceRespVO.getScenicId());
|
||||
|
@ -116,7 +116,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
goodsPageVO.setTemplateCoverUrl(goods.get(0).getUrl());
|
||||
goodsPageVO.setFaceId(faceId);
|
||||
if (type == 1) {
|
||||
goodsPageVO.setGoodsName("原片集");
|
||||
goodsPageVO.setGoodsName("录像集");
|
||||
goodsPageVO.setGoodsType(1);
|
||||
} else {
|
||||
goodsPageVO.setGoodsName("照片集");
|
||||
|
@ -328,6 +328,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// promo code
|
||||
// coupon
|
||||
order.setPayPrice(priceObj.getPrice());
|
||||
order.setFaceId(priceObj.getFaceId());
|
||||
if (order.getPayPrice().equals(BigDecimal.ZERO)) {
|
||||
order.setStatus(OrderStateEnum.PAID.getState());
|
||||
order.setPayAt(new Date());
|
||||
@ -370,17 +371,19 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderItem.setGoodsId(batchOrderReqVO.getFaceId());
|
||||
orderItem.setGoodsType(1);
|
||||
} else if (Long.valueOf(2L).equals(goods.getGoodsId())) {
|
||||
orderItem.setGoodsId(batchOrderReqVO.getCouponId());
|
||||
orderItem.setGoodsId(batchOrderReqVO.getFaceId());
|
||||
orderItem.setGoodsType(2);
|
||||
} else {
|
||||
// templateId
|
||||
orderItem.setGoodsId(goods.getGoodsId());
|
||||
orderItem.setGoodsType(0);
|
||||
orderItem.setGoodsType(-1);
|
||||
}
|
||||
return orderItem;
|
||||
}).collect(Collectors.toList());
|
||||
order.setSlashPrice(priceConfig.getSlashPrice());
|
||||
order.setPrice(priceConfig.getPrice());
|
||||
order.setPayPrice(priceConfig.getPrice());
|
||||
order.setFaceId(batchOrderReqVO.getFaceId());
|
||||
if (order.getPayPrice().equals(BigDecimal.ZERO)) {
|
||||
order.setStatus(OrderStateEnum.PAID.getState());
|
||||
order.setPayAt(new Date());
|
||||
|
@ -57,7 +57,7 @@ public class PriceConfigServiceImpl extends ServiceImpl<PriceConfigMapper, Price
|
||||
List<String> goodsNames = new ArrayList<>();
|
||||
for (String s : item.getGoodsIds().split(",")) {
|
||||
if (StringUtils.equals(s, "1")) {
|
||||
goodsNames.add("原片集");
|
||||
goodsNames.add("录像集");
|
||||
} else if (StringUtils.equals(s, "2")) {
|
||||
goodsNames.add("照片集");
|
||||
} else {
|
||||
|
@ -113,7 +113,7 @@
|
||||
oi.goods_type,
|
||||
CASE oi.goods_type
|
||||
WHEN '0' THEN mvd.name
|
||||
WHEN '1' THEN '原片集'
|
||||
WHEN '1' THEN '录像集'
|
||||
WHEN '2' THEN '照片集'
|
||||
ELSE '其他'
|
||||
END AS goods_name,
|
||||
@ -144,8 +144,8 @@
|
||||
</select>
|
||||
|
||||
<insert id="add">
|
||||
insert into `order`(id, member_id, openid, `type`, `price_config_id`, slash_price, price, pay_price, remark, broker_id, promo_code, scenic_id, status)
|
||||
VALUES (#{id}, #{memberId}, #{openId}, #{type}, #{priceConfigId}, #{slashPrice}, #{price}, #{payPrice}, #{remark}, #{brokerId}, #{promoCode}, #{scenicId}, #{status})
|
||||
insert into `order`(id, member_id, openid, face_id, `type`, `price_config_id`, slash_price, price, pay_price, remark, broker_id, promo_code, scenic_id, status)
|
||||
VALUES (#{id}, #{memberId}, #{openId}, #{faceId}, #{type}, #{priceConfigId}, #{slashPrice}, #{price}, #{payPrice}, #{remark}, #{brokerId}, #{promoCode}, #{scenicId}, #{status})
|
||||
</insert>
|
||||
<insert id="addOrderItems">
|
||||
insert into order_item(order_id,goods_type, goods_id) VALUES
|
||||
@ -217,9 +217,10 @@
|
||||
delete from `order` where id = #{id}
|
||||
</delete>
|
||||
<select id="list" resultMap="PCBaseResultListMap">
|
||||
select distinct o.id, o.scenic_id, s.name as scenic_name, o.member_id,m.nickname ,m.real_name , o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
select distinct o.id, o.scenic_id, s.name as scenic_name, o.member_id,m.nickname ,m.real_name, o.type, o.openid, o.face_id, f.face_url, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at,oi.id oiId, oi.goods_id, o.create_at
|
||||
from `order` AS o
|
||||
left join face f on o.face_id = f.id
|
||||
left join member m on o.member_id = m.id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
left join order_item oi on o.id = oi.order_id
|
||||
@ -288,10 +289,11 @@
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="getById" resultMap="PCBaseResultMap">
|
||||
select o.id, o.scenic_id, s.name as scenic_name, o.member_id, o.openid, o.price, o.pay_price, o.remark, o.broker_id, o.promo_code, o.refund_reason,
|
||||
select o.id, o.scenic_id, s.name as scenic_name, o.member_id, o.type, o.openid, o.face_id, f.face_url, o.price, o.pay_price, o.remark, o.broker_id, o.promo_code, o.refund_reason,
|
||||
o.refund_status, o.status, o.create_at, o.update_at, o.pay_at, o.cancel_at, o.refund_at,
|
||||
m.nickname , m.real_name
|
||||
from `order` o
|
||||
left join face f on o.face_id = f.id
|
||||
left join member m on m.id = o.member_id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
where o.id = #{id}
|
||||
@ -302,10 +304,11 @@
|
||||
where o.member_id = #{userId}
|
||||
</select>
|
||||
<select id="appList" resultMap="AppBaseResultMap">
|
||||
select DISTINCT o.id, o.member_id,o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
select DISTINCT o.id, o.member_id,o.openid, o.type, o.face_id, f.face_url, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
refund_reason, refund_status, o.`status`, o.create_at, refund_at, pay_at, cancel_at,
|
||||
sc.name scenicName
|
||||
from `order` AS o
|
||||
left join face f on o.face_id = f.id
|
||||
left join scenic sc on o.scenic_id = sc.id
|
||||
<where>
|
||||
<if test="memberId!=null">
|
||||
@ -315,7 +318,7 @@
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="appDetail" resultMap="AppBaseResultMap">
|
||||
select distinct o.id, o.member_id,o.openid, o.price, o.slash_price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
select distinct o.id, o.member_id,o.openid, o.type, o.price, o.slash_price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
refund_reason, refund_status, o.`status`, o.create_at, refund_at, pay_at, cancel_at,
|
||||
o.scenic_id, sc.name scenicName
|
||||
from `order` AS o
|
||||
@ -324,7 +327,7 @@
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
<select id="refundList" resultType="com.ycwl.basic.model.pc.order.resp.OrderRespVO">
|
||||
select distinct o.id, o.scenic_id, s.name as scenic_name, o.member_id,m.nickname ,m.real_name , o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
select distinct o.id, o.scenic_id, s.name as scenic_name, o.member_id,m.nickname ,m.real_name, o.type, o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at,oi.id oiId, oi.goods_id, o.create_at
|
||||
from `order` AS o
|
||||
left join member m on o.member_id = m.id
|
||||
|
Loading…
x
Reference in New Issue
Block a user