全免费、0元购模式
This commit is contained in:
parent
294f9b6690
commit
8f41a4f66d
@ -5,6 +5,7 @@ import com.ycwl.basic.mapper.VideoMapper;
|
|||||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||||
@ -14,6 +15,8 @@ import com.ycwl.basic.repository.TemplateRepository;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class OrderBiz {
|
public class OrderBiz {
|
||||||
|
|
||||||
@ -28,10 +31,20 @@ public class OrderBiz {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderRepository orderRepository;
|
private OrderRepository orderRepository;
|
||||||
|
|
||||||
public PriceObj queryPrice(int goodsType, Long goodsId) {
|
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
||||||
PriceObj priceObj = new PriceObj();
|
PriceObj priceObj = new PriceObj();
|
||||||
priceObj.setGoodsType(goodsType);
|
priceObj.setGoodsType(goodsType);
|
||||||
priceObj.setGoodsId(goodsId);
|
priceObj.setGoodsId(goodsId);
|
||||||
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||||
|
if (scenicConfig != null) {
|
||||||
|
if (0 != scenicConfig.getAllFree()) {
|
||||||
|
// 景区全免
|
||||||
|
priceObj.setFree(true);
|
||||||
|
priceObj.setPrice(BigDecimal.ZERO);
|
||||||
|
priceObj.setSlashPrice(BigDecimal.ZERO);
|
||||||
|
return priceObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
switch (goodsType) {
|
switch (goodsType) {
|
||||||
case 0: // video
|
case 0: // video
|
||||||
VideoRespVO video = videoMapper.getById(goodsId);
|
VideoRespVO video = videoMapper.getById(goodsId);
|
||||||
@ -76,12 +89,12 @@ public class OrderBiz {
|
|||||||
return priceObj;
|
return priceObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsBuyRespVO isBuy(Long userId, int goodsType, Long goodsId) {
|
public IsBuyRespVO isBuy(Long userId, Long scenicId, int goodsType, Long goodsId) {
|
||||||
IsBuyRespVO respVO = new IsBuyRespVO();
|
IsBuyRespVO respVO = new IsBuyRespVO();
|
||||||
boolean isBuy = orderRepository.checkUserBuyItem(userId, goodsType, goodsId);
|
boolean isBuy = orderRepository.checkUserBuyItem(userId, goodsType, goodsId);
|
||||||
respVO.setBuy(isBuy);
|
respVO.setBuy(isBuy);
|
||||||
if (!isBuy) {
|
if (!isBuy) {
|
||||||
PriceObj priceObj = queryPrice(goodsType, goodsId);
|
PriceObj priceObj = queryPrice(scenicId, goodsType, goodsId);
|
||||||
if (priceObj == null) {
|
if (priceObj == null) {
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,6 @@ public class AppOrderController {
|
|||||||
@GetMapping("/scenic/{scenicId}/query")
|
@GetMapping("/scenic/{scenicId}/query")
|
||||||
public ApiResponse<IsBuyRespVO> isBuy(@PathVariable("scenicId") Long scenicId, @RequestParam("type") Integer type, @RequestParam("goodsId") Long goodsId) {
|
public ApiResponse<IsBuyRespVO> isBuy(@PathVariable("scenicId") Long scenicId, @RequestParam("type") Integer type, @RequestParam("goodsId") Long goodsId) {
|
||||||
Long userId = Long.parseLong(BaseContextHandler.getUserId());
|
Long userId = Long.parseLong(BaseContextHandler.getUserId());
|
||||||
return ApiResponse.success(orderBiz.isBuy(userId, type, goodsId));
|
return ApiResponse.success(orderBiz.isBuy(userId, scenicId, type, goodsId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PriceObj {
|
public class PriceObj {
|
||||||
|
private boolean free;
|
||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
private int goodsType;
|
private int goodsType;
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
|
@ -33,6 +33,7 @@ public class ScenicConfigEntity {
|
|||||||
* 是否为默认
|
* 是否为默认
|
||||||
*/
|
*/
|
||||||
private Integer isDefault;
|
private Integer isDefault;
|
||||||
|
private Integer allFree;
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@ -8,9 +8,6 @@ import com.ycwl.basic.constant.NumberConstant;
|
|||||||
import com.ycwl.basic.enums.*;
|
import com.ycwl.basic.enums.*;
|
||||||
import com.ycwl.basic.exception.AppException;
|
import com.ycwl.basic.exception.AppException;
|
||||||
import com.ycwl.basic.mapper.*;
|
import com.ycwl.basic.mapper.*;
|
||||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
|
||||||
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
|
|
||||||
import com.ycwl.basic.model.mobile.goods.GoodsPriceQueryReq;
|
|
||||||
import com.ycwl.basic.model.mobile.order.OrderAppPageReq;
|
import com.ycwl.basic.model.mobile.order.OrderAppPageReq;
|
||||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||||
import com.ycwl.basic.model.mobile.order.RefundOrderReq;
|
import com.ycwl.basic.model.mobile.order.RefundOrderReq;
|
||||||
@ -20,7 +17,6 @@ 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.entity.OrderItemEntity;
|
||||||
import com.ycwl.basic.model.pc.order.req.CreateOrderReqVO;
|
import com.ycwl.basic.model.pc.order.req.CreateOrderReqVO;
|
||||||
import com.ycwl.basic.model.pc.order.req.OrderUpdateReq;
|
import com.ycwl.basic.model.pc.order.req.OrderUpdateReq;
|
||||||
import com.ycwl.basic.model.pc.order.req.OrderAddReq;
|
|
||||||
import com.ycwl.basic.model.pc.order.req.OrderReqQuery;
|
import com.ycwl.basic.model.pc.order.req.OrderReqQuery;
|
||||||
import com.ycwl.basic.model.pc.order.resp.OrderAppRespVO;
|
import com.ycwl.basic.model.pc.order.resp.OrderAppRespVO;
|
||||||
import com.ycwl.basic.model.pc.order.resp.OrderItemVO;
|
import com.ycwl.basic.model.pc.order.resp.OrderItemVO;
|
||||||
@ -35,7 +31,6 @@ import com.ycwl.basic.service.mobile.WxPayService;
|
|||||||
import com.ycwl.basic.service.pc.OrderService;
|
import com.ycwl.basic.service.pc.OrderService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.BigDecimalUtil;
|
import com.ycwl.basic.utils.BigDecimalUtil;
|
||||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
|
||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -68,8 +63,6 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MemberMapper memberMapper;
|
private MemberMapper memberMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoodsService goodsService;
|
|
||||||
@Autowired
|
|
||||||
private OrderOperationMapper orderOperationMapper;
|
private OrderOperationMapper orderOperationMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private StatisticsMapper statisticsMapper;
|
private StatisticsMapper statisticsMapper;
|
||||||
@ -287,7 +280,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
orderItem.setGoodsType(createOrderReqVO.getGoodsType());
|
orderItem.setGoodsType(createOrderReqVO.getGoodsType());
|
||||||
orderItem.setOrderId(orderId);
|
orderItem.setOrderId(orderId);
|
||||||
orderItems.add(orderItem);
|
orderItems.add(orderItem);
|
||||||
PriceObj priceObj = orderBiz.queryPrice(createOrderReqVO.getGoodsType(), createOrderReqVO.getGoodsId());
|
PriceObj priceObj = orderBiz.queryPrice(order.getScenicId(), createOrderReqVO.getGoodsType(), createOrderReqVO.getGoodsId());
|
||||||
order.setPrice(priceObj.getPrice());
|
order.setPrice(priceObj.getPrice());
|
||||||
// promo code
|
// promo code
|
||||||
// coupon
|
// coupon
|
||||||
|
@ -20,7 +20,6 @@ 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.req.TaskReqQuery;
|
||||||
import com.ycwl.basic.model.pc.task.resp.TaskRespVO;
|
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.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.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
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.entity.VideoEntity;
|
||||||
@ -280,8 +279,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
memberVideoEntity.setTaskId(list.get(0).getId());
|
memberVideoEntity.setTaskId(list.get(0).getId());
|
||||||
VideoEntity video = videoMapper.findByTaskId(list.get(0).getId());
|
VideoEntity video = videoMapper.findByTaskId(list.get(0).getId());
|
||||||
if (video != null) {
|
if (video != null) {
|
||||||
PriceObj priceObj = orderBiz.queryPrice(0, video.getId());
|
PriceObj priceObj = orderBiz.queryPrice(list.get(0).getScenicId(), 0, video.getId());
|
||||||
if (priceObj.getPrice().equals(BigDecimal.ZERO)) {
|
if (priceObj.isFree()) {
|
||||||
memberVideoEntity.setIsBuy(1);
|
memberVideoEntity.setIsBuy(1);
|
||||||
}
|
}
|
||||||
memberVideoEntity.setVideoId(video.getId());
|
memberVideoEntity.setVideoId(video.getId());
|
||||||
@ -324,8 +323,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
videoMapper.add(video);
|
videoMapper.add(video);
|
||||||
}
|
}
|
||||||
int isBuy = 0;
|
int isBuy = 0;
|
||||||
PriceObj priceObj = orderBiz.queryPrice(0, video.getId());
|
PriceObj priceObj = orderBiz.queryPrice(task.getScenicId(), 0, video.getId());
|
||||||
if (priceObj.getPrice().equals(BigDecimal.ZERO)) {
|
if (priceObj.isFree()) {
|
||||||
isBuy = 1;
|
isBuy = 1;
|
||||||
}
|
}
|
||||||
videoMapper.updateRelationWhenTaskSuccess(taskId, video.getId(), isBuy);
|
videoMapper.updateRelationWhenTaskSuccess(taskId, video.getId(), isBuy);
|
||||||
|
@ -158,6 +158,7 @@ aliFace:
|
|||||||
accessKeySecret: "ZCIP8aKx1jwX1wkeYIPQEDZ8fPtN1c"
|
accessKeySecret: "ZCIP8aKx1jwX1wkeYIPQEDZ8fPtN1c"
|
||||||
region: "cn-shanghai"
|
region: "cn-shanghai"
|
||||||
|
|
||||||
|
# 通知到人
|
||||||
notify:
|
notify:
|
||||||
defaultUse: "developer"
|
defaultUse: "developer"
|
||||||
configs:
|
configs:
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
<if test="isDefault!=null">
|
<if test="isDefault!=null">
|
||||||
is_default=#{isDefault},
|
is_default=#{isDefault},
|
||||||
</if>
|
</if>
|
||||||
|
all_free=#{allFree},
|
||||||
book_routine=#{bookRoutine},
|
book_routine=#{bookRoutine},
|
||||||
sample_store_day=#{sampleStoreDay},
|
sample_store_day=#{sampleStoreDay},
|
||||||
video_store_day=#{videoStoreDay},
|
video_store_day=#{videoStoreDay},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user