You've already forked FrameTour-BE
补充全免费逻辑
This commit is contained in:
@ -3,6 +3,7 @@ package com.ycwl.basic.controller.task;
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.model.task.req.TaskReqVo;
|
||||
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
||||
import com.ycwl.basic.model.task.req.WorkerAuthReqVo;
|
||||
import com.ycwl.basic.model.task.resp.TaskSyncRespVo;
|
||||
import com.ycwl.basic.service.task.TaskService;
|
||||
@ -49,7 +50,7 @@ public class TaskTaskController {
|
||||
}
|
||||
|
||||
@PostMapping("/{taskId}/success")
|
||||
public ApiResponse taskSuccess(@PathVariable Long taskId, @RequestBody WorkerAuthReqVo req) {
|
||||
public ApiResponse taskSuccess(@PathVariable Long taskId, @RequestBody TaskSuccessReqVo req) {
|
||||
taskService.taskSuccess(taskId, req);
|
||||
return ApiResponse.success("OK");
|
||||
}
|
||||
|
@ -26,7 +26,11 @@ public class OrderEntity {
|
||||
*/
|
||||
private String openId;
|
||||
/**
|
||||
* 价格
|
||||
* 划线价
|
||||
*/
|
||||
private BigDecimal slashPrice;
|
||||
/**
|
||||
* 优惠价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
|
@ -31,6 +31,8 @@ public class ScenicAddOrUpdateReq {
|
||||
*/
|
||||
@ApiModelProperty("景区介绍")
|
||||
private String introduction;
|
||||
private String logoUrl;
|
||||
|
||||
@ApiModelProperty("封面图")
|
||||
private String coverUrl;
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ public class ScenicRespVO {
|
||||
*/
|
||||
@ApiModelProperty("景区介绍")
|
||||
private String introduction;
|
||||
private String logoUrl;
|
||||
@ApiModelProperty("封面图")
|
||||
private String coverUrl;
|
||||
/**
|
||||
|
@ -35,6 +35,7 @@ public class SourceRespVO {
|
||||
*/
|
||||
@ApiModelProperty("来源设备id")
|
||||
private Long deviceId;
|
||||
private String deviceName;
|
||||
private Long faceId;
|
||||
@ApiModelProperty("原素材类型:1视频,2图像")
|
||||
private Integer type;
|
||||
|
@ -25,10 +25,9 @@ public class VideoRespVO {
|
||||
@ApiModelProperty("景区名称")
|
||||
private String scenicName;
|
||||
/**
|
||||
* 用户id
|
||||
* 人脸ID
|
||||
*/
|
||||
@ApiModelProperty("用户id")
|
||||
private Long memberId;
|
||||
@ApiModelProperty("人脸ID")
|
||||
private Long faceId;
|
||||
/**
|
||||
* 模版id
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.ycwl.basic.model.task.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class TaskSuccessReqVo extends WorkerAuthReqVo {
|
||||
private VideoInfoReq videoInfo;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.ycwl.basic.model.task.req;
|
||||
|
||||
public class VideoInfoReq {
|
||||
private Integer height;
|
||||
private Integer width;
|
||||
private Float duration;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.ycwl.basic.profitsharing.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProfitSharingConfig {
|
||||
private boolean enabled;
|
||||
private Long scenicId;
|
||||
private List<ProfitSharingUser> profitSharingList;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.ycwl.basic.profitsharing.entity;
|
||||
|
||||
import com.ycwl.basic.profitsharing.enums.ProfitSharingUserType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ProfitSharingUser {
|
||||
private ProfitSharingUserType type;
|
||||
private Integer amount;
|
||||
private String description;
|
||||
private BigDecimal wxRate;
|
||||
private BigDecimal realRate;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.ycwl.basic.profitsharing.enums;
|
||||
|
||||
public enum ProfitSharingUserType {
|
||||
MERCHANT("MERCHANT_ID", "商户号"),
|
||||
PERSON_SUB("PERSONAL_SUB_OPENID", "子商户个人"),
|
||||
PERSON_PARENT("PERSONAL_OPENID", "父商户个人");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
ProfitSharingUserType(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
@ -2,18 +2,21 @@ package com.ycwl.basic.service.impl.mobile;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.biz.OrderBiz;
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.mapper.*;
|
||||
import com.ycwl.basic.model.mobile.goods.*;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
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.resp.ScenicRespVO;
|
||||
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
||||
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
||||
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
||||
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
||||
import com.ycwl.basic.model.pc.video.req.VideoReqQuery;
|
||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||
import com.ycwl.basic.repository.OrderRepository;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||
import com.ycwl.basic.service.mobile.GoodsService;
|
||||
@ -54,6 +57,10 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
private TaskService taskTaskService;
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
@Autowired
|
||||
private OrderRepository orderRepository;
|
||||
@Autowired
|
||||
private OrderBiz orderBiz;
|
||||
|
||||
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
||||
//查询原素材
|
||||
@ -174,39 +181,6 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
return ApiResponse.success(goodsDetailVOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<BigDecimal> queryPrice(GoodsPriceQueryReq queryPriceData) {
|
||||
Integer goodsType = queryPriceData.getGoodsType();
|
||||
|
||||
if (goodsType == 0) {//成片vlog
|
||||
//成片的价格就是成片所用template的价格
|
||||
Long videoId = queryPriceData.getGoodsId();
|
||||
VideoRespVO videoRespVO = videoMapper.getById(videoId);
|
||||
if (videoRespVO == null) {
|
||||
return ApiResponse.fail("该vlog不存在或已失效");
|
||||
}
|
||||
BigDecimal templatePrice = videoRespVO.getTemplatePrice();
|
||||
if (templatePrice == null) {
|
||||
return ApiResponse.fail("该vlog使用的模板价格或状态异常,请联系管理员");
|
||||
}
|
||||
return ApiResponse.success(templatePrice);
|
||||
|
||||
} else if (goodsType == 1 || goodsType == 2) {//原素材
|
||||
//原素材的价格就是原素材对应景区定的价格
|
||||
Long scenicId = queryPriceData.getScenicId();
|
||||
ScenicRespVO scenicRespVO = scenicMapper.getById(scenicId);
|
||||
if (scenicRespVO == null) {
|
||||
return ApiResponse.fail("该景区不存在或状态异常,请联系管理员");
|
||||
}
|
||||
BigDecimal price = scenicRespVO.getPrice();
|
||||
if (price == null) {
|
||||
return ApiResponse.fail("该景区的原片价格未设定或状态异常,请联系管理员");
|
||||
}
|
||||
return ApiResponse.success(price);
|
||||
}
|
||||
return ApiResponse.fail("不合法的商品,请联系管理员");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<VideoGoodsDetailVO> videoGoodsDetail(Long userId, Long videoId) {
|
||||
VideoGoodsDetailVO goodsDetailVO = new VideoGoodsDetailVO();
|
||||
@ -222,21 +196,31 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
goodsDetailVO.setVideoUrl(videoRespVO.getVideoUrl());
|
||||
goodsDetailVO.setTemplateCoverUrl(videoRespVO.getTemplateCoverUrl());
|
||||
goodsDetailVO.setCreateTime(videoRespVO.getCreateTime());
|
||||
MemberVideoEntity entity = videoMapper.queryUserVideo(userId, videoId);
|
||||
if (entity == null) {
|
||||
if (userId == null) {
|
||||
goodsDetailVO.setIsBuy(0);
|
||||
goodsDetailVO.setShare(true);
|
||||
goodsDetailVO.setPrice("未登录");
|
||||
} else if (entity.getIsBuy() == 1) {
|
||||
goodsDetailVO.setIsBuy(1);
|
||||
} else {
|
||||
goodsDetailVO.setIsBuy(0);
|
||||
BigDecimal templatePrice = videoRespVO.getTemplatePrice();
|
||||
BigDecimal slashPrice = videoRespVO.getSlashPrice();
|
||||
// 使用DecimalFormat格式化输出
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
goodsDetailVO.setPrice(templatePrice == null ? "" : df.format(templatePrice.setScale(2, RoundingMode.HALF_UP)));
|
||||
goodsDetailVO.setSlashPrice(slashPrice == null ? null : df.format(slashPrice.setScale(2, RoundingMode.HALF_UP)));
|
||||
MemberVideoEntity entity = videoMapper.queryUserVideo(userId, videoId);
|
||||
if (entity == null) {
|
||||
goodsDetailVO.setIsBuy(0);
|
||||
goodsDetailVO.setShare(true);
|
||||
goodsDetailVO.setPrice("未登录");
|
||||
} else {
|
||||
goodsDetailVO.setShare(false);
|
||||
goodsDetailVO.setFaceId(entity.getFaceId());
|
||||
goodsDetailVO.setIsBuy(entity.getIsBuy());
|
||||
if (Integer.valueOf(0).equals(entity.getIsBuy())) {
|
||||
PriceObj priceObj = orderBiz.queryPrice(videoRespVO.getScenicId(), 0, videoId);
|
||||
if (priceObj.isFree()) {
|
||||
goodsDetailVO.setIsBuy(1);
|
||||
} else {
|
||||
goodsDetailVO.setIsBuy(0);
|
||||
goodsDetailVO.setPrice(priceObj.getPrice().toString());
|
||||
goodsDetailVO.setSlashPrice(priceObj.getSlashPrice().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TaskEntity task = videoTaskRepository.getTaskById(videoRespVO.getTaskId());
|
||||
JSONObject paramJson = JSON.parseObject(task.getTaskParams());
|
||||
@ -248,9 +232,6 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
deviceCount = paramJson.keySet().stream().filter(StringUtils::isNumeric).count();
|
||||
}
|
||||
goodsDetailVO.setLensNum((int) deviceCount);
|
||||
if (entity != null) {
|
||||
goodsDetailVO.setFaceId(entity.getFaceId());
|
||||
}
|
||||
return ApiResponse.success(goodsDetailVO);
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.ycwl.basic.constant.NumberConstant;
|
||||
import com.ycwl.basic.enums.*;
|
||||
import com.ycwl.basic.exception.AppException;
|
||||
import com.ycwl.basic.mapper.*;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.order.OrderAppPageReq;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.mobile.order.RefundOrderReq;
|
||||
@ -267,6 +268,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResponse<WxPayRespVO> createOrder(Long userId, CreateOrderReqVO createOrderReqVO) throws Exception {
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(userId, createOrderReqVO.getScenicId(), createOrderReqVO.getGoodsType(), createOrderReqVO.getGoodsId());
|
||||
if (isBuy.isBuy()) {
|
||||
return ApiResponse.fail("您已购买此内容,无需重复购买!");
|
||||
}
|
||||
OrderEntity order = new OrderEntity();
|
||||
Long orderId = SnowFlakeUtil.getLongId();
|
||||
order.setId(orderId);
|
||||
@ -281,11 +286,17 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderItem.setOrderId(orderId);
|
||||
orderItems.add(orderItem);
|
||||
PriceObj priceObj = orderBiz.queryPrice(order.getScenicId(), createOrderReqVO.getGoodsType(), createOrderReqVO.getGoodsId());
|
||||
order.setSlashPrice(priceObj.getSlashPrice());
|
||||
order.setPrice(priceObj.getPrice());
|
||||
// promo code
|
||||
// coupon
|
||||
order.setPayPrice(priceObj.getPrice());
|
||||
order.setStatus(OrderStateEnum.UNPAID.getState());
|
||||
if (order.getPayPrice().equals(BigDecimal.ZERO)) {
|
||||
order.setStatus(OrderStateEnum.PAID.getState());
|
||||
order.setPayAt(new Date());
|
||||
} else {
|
||||
order.setStatus(OrderStateEnum.UNPAID.getState());
|
||||
}
|
||||
orderMapper.add(order);
|
||||
int addOrderItems = orderMapper.addOrderItems(orderItems);
|
||||
if (addOrderItems == NumberConstant.ZERO) {
|
||||
|
@ -33,6 +33,7 @@ import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
||||
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||
import com.ycwl.basic.model.task.req.ClientStatusReqVo;
|
||||
import com.ycwl.basic.model.task.req.TaskReqVo;
|
||||
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
||||
import com.ycwl.basic.model.task.req.WorkerAuthReqVo;
|
||||
import com.ycwl.basic.model.task.resp.TaskSyncRespVo;
|
||||
import com.ycwl.basic.notify.NotifyFactory;
|
||||
@ -345,7 +346,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskSuccess(@NonNull Long taskId, @NonNull WorkerAuthReqVo req) {
|
||||
public void taskSuccess(@NonNull Long taskId, @NonNull TaskSuccessReqVo req) {
|
||||
TaskRespVO task = taskMapper.getById(taskId);
|
||||
if (task == null) {
|
||||
return;
|
||||
|
@ -3,7 +3,6 @@ package com.ycwl.basic.service.mobile;
|
||||
import com.ycwl.basic.model.mobile.goods.*;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -28,13 +27,6 @@ public interface GoodsService {
|
||||
*/
|
||||
ApiResponse<List<GoodsDetailVO>> sourceGoodsList(Long userId, GoodsReqQuery query);
|
||||
|
||||
/**
|
||||
* 查询订单应付价格
|
||||
* @param queryPriceData
|
||||
* @return
|
||||
*/
|
||||
ApiResponse<BigDecimal> queryPrice(GoodsPriceQueryReq queryPriceData);
|
||||
|
||||
/**
|
||||
* @param userId 商品(vlog)id
|
||||
* @param videoId
|
||||
|
@ -2,6 +2,7 @@ package com.ycwl.basic.service.task;
|
||||
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.model.task.req.TaskReqVo;
|
||||
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
||||
import com.ycwl.basic.model.task.req.WorkerAuthReqVo;
|
||||
import com.ycwl.basic.model.task.resp.TaskSyncRespVo;
|
||||
|
||||
@ -17,7 +18,7 @@ public interface TaskService {
|
||||
|
||||
void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId, int automatic);
|
||||
|
||||
void taskSuccess(Long taskId, WorkerAuthReqVo req);
|
||||
void taskSuccess(Long taskId, TaskSuccessReqVo req);
|
||||
|
||||
void taskFail(Long taskId, WorkerAuthReqVo req);
|
||||
|
||||
|
Reference in New Issue
Block a user