1
This commit is contained in:
parent
94bf358a2d
commit
8428907db4
@ -2,4 +2,5 @@ package com.ycwl.basic.constant;
|
||||
|
||||
public class StorageConstant {
|
||||
public static final String VLOG_PATH = "vlog";
|
||||
public static final String VIDEO_PIECE_PATH = "source_video";
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import com.ycwl.basic.service.pc.FaceService;
|
||||
import com.ycwl.basic.service.task.impl.TaskTaskServiceImpl;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -39,6 +40,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/ly")
|
||||
public class LyCompatibleController {
|
||||
@ -81,11 +83,11 @@ public class LyCompatibleController {
|
||||
if (StringUtils.isBlank(scid)) {
|
||||
return R.error("景区ID为空!");
|
||||
}
|
||||
if (StringUtils.equals("288",scid)) {
|
||||
// if (StringUtils.equals("288",scid)) {
|
||||
scenicId = 3955650120997015552L;
|
||||
} else {
|
||||
scenicId = 3946669713328836608L;
|
||||
}
|
||||
// } else {
|
||||
// scenicId = 3946669713328836608L;
|
||||
// }
|
||||
String openId = headersMap.get("client");
|
||||
MemberRespVO member = memberMapper.getByOpenId(openId);
|
||||
if (member == null) {
|
||||
@ -98,6 +100,12 @@ public class LyCompatibleController {
|
||||
memberEntity.setNickname("用户");
|
||||
memberMapper.add(memberEntity);
|
||||
member.setId(memberEntity.getId());
|
||||
} else {
|
||||
MemberEntity memberUpd = new MemberEntity();
|
||||
memberUpd.setId(member.getId());
|
||||
memberUpd.setScenicId(scenicId);
|
||||
memberUpd.setUpdateAt(new Date());
|
||||
memberMapper.update(memberUpd);
|
||||
}
|
||||
FaceRecognizeResp resp;
|
||||
try {
|
||||
@ -136,6 +144,7 @@ public class LyCompatibleController {
|
||||
if (taskStatusVO == null) {
|
||||
return R.ok().put("hasVideo", 0);
|
||||
}
|
||||
log.info("> {}", taskStatusVO);
|
||||
switch (taskStatusVO.getStatus()) {
|
||||
case 1:
|
||||
return R.ok().put("hasVideo", 1);
|
||||
@ -202,6 +211,9 @@ public class LyCompatibleController {
|
||||
map.put("ossurldm", goodsDetailVO.getVideoUrl());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
log.info("> {}", taskStatusVO);
|
||||
log.info("> {}", videoList);
|
||||
log.info("> {}", userVideoList);
|
||||
return R.ok()
|
||||
.put("isgen", taskStatusVO.getStatus() == 1 ? 0 : 1)
|
||||
.put("newvideo", videoList)
|
||||
|
@ -45,6 +45,6 @@ public class AppScenicOrderController {
|
||||
return ApiResponse.fail("用户未绑定景区");
|
||||
}
|
||||
query.setScenicId(account.getScenicId());
|
||||
return orderService.pageQuery(query);
|
||||
return orderService.pageQueryDetail(query);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
package com.ycwl.basic.controller.vpt;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.annotation.IgnoreLogReq;
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.constant.StorageConstant;
|
||||
import com.ycwl.basic.device.entity.common.FileObject;
|
||||
import com.ycwl.basic.device.operator.VptPassiveStorageOperator;
|
||||
import com.ycwl.basic.device.operator.VptPassiveStorageOperator;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.wvp.WvpSyncReqVo;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||
import com.ycwl.basic.storage.enums.StorageAcl;
|
||||
import com.ycwl.basic.storage.utils.StorageUtil;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -21,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@IgnoreToken
|
||||
@ -29,6 +35,12 @@ import java.util.List;
|
||||
@RequestMapping("/vpt/v1/")
|
||||
public class VptController {
|
||||
|
||||
private final ScenicRepository scenicRepository;
|
||||
|
||||
public VptController(ScenicRepository scenicRepository) {
|
||||
this.scenicRepository = scenicRepository;
|
||||
}
|
||||
|
||||
@IgnoreLogReq
|
||||
@PostMapping("/scenic/{scenicId}/sync")
|
||||
public ApiResponse<List<VptPassiveStorageOperator.Task>> sync(@PathVariable("scenicId") Long scenicId, @RequestBody WvpSyncReqVo reqVo) {
|
||||
@ -36,13 +48,30 @@ public class VptController {
|
||||
}
|
||||
@PostMapping("/scenic/{scenicId}/{taskId}/uploadUrl")
|
||||
public String uploadUrl(@PathVariable("scenicId") Long scenicId, @PathVariable("taskId") Long taskId) {
|
||||
IStorageAdapter adapter = StorageFactory.use("assets-ext");
|
||||
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "video/mp4", StorageUtil.joinPath("video-source", taskId.toString() + ".mp4"));
|
||||
IStorageAdapter adapter;
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null && scenicConfig.getStoreType() != null) {
|
||||
adapter = StorageFactory.get(scenicConfig.getStoreType());
|
||||
adapter.loadConfig(JSONObject.parseObject(scenicConfig.getStoreConfigJson(), Map.class));
|
||||
} else {
|
||||
adapter = StorageFactory.use("video");
|
||||
}
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VIDEO_PIECE_PATH, taskId.toString() + ".mp4");
|
||||
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "video/mp4", filename);
|
||||
}
|
||||
@PostMapping("/scenic/{scenicId}/{taskId}/success")
|
||||
public ApiResponse<String> success(@PathVariable("scenicId") Long scenicId, @PathVariable("taskId") Long taskId, @RequestBody FileObject fileObject) {
|
||||
IStorageAdapter adapter = StorageFactory.use("assets-ext");
|
||||
fileObject.setUrl(adapter.getUrl(VptPassiveStorageOperator.getUrlForTask(taskId)));
|
||||
IStorageAdapter adapter;
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null && scenicConfig.getStoreType() != null) {
|
||||
adapter = StorageFactory.get(scenicConfig.getStoreType());
|
||||
adapter.loadConfig(JSONObject.parseObject(scenicConfig.getStoreConfigJson(), Map.class));
|
||||
} else {
|
||||
adapter = StorageFactory.use("video");
|
||||
}
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VIDEO_PIECE_PATH, taskId.toString() + ".mp4");
|
||||
fileObject.setUrl(adapter.getUrl(filename));
|
||||
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
||||
VptPassiveStorageOperator.onReceiveResult(taskId, fileObject);
|
||||
return ApiResponse.success("success");
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
package com.ycwl.basic.controller.wvp;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.annotation.IgnoreLogReq;
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.constant.StorageConstant;
|
||||
import com.ycwl.basic.device.entity.common.FileObject;
|
||||
import com.ycwl.basic.device.operator.WvpPassiveStorageOperator;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.wvp.WvpSyncReqVo;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.service.pc.DeviceService;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||
import com.ycwl.basic.storage.enums.StorageAcl;
|
||||
import com.ycwl.basic.storage.utils.StorageUtil;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -22,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@IgnoreToken
|
||||
@ -32,6 +38,8 @@ public class WvpController {
|
||||
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
|
||||
@IgnoreLogReq
|
||||
@PostMapping("/scenic/{scenicId}/sync")
|
||||
@ -42,13 +50,30 @@ public class WvpController {
|
||||
|
||||
@PostMapping("/scenic/{scenicId}/{taskId}/uploadUrl")
|
||||
public String uploadUrl(@PathVariable("scenicId") Long scenicId, @PathVariable("taskId") Long taskId) {
|
||||
IStorageAdapter adapter = StorageFactory.use("assets-ext");
|
||||
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "video/mp4", StorageUtil.joinPath("video-source", taskId.toString() + ".mp4"));
|
||||
IStorageAdapter adapter;
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null && scenicConfig.getStoreType() != null) {
|
||||
adapter = StorageFactory.get(scenicConfig.getStoreType());
|
||||
adapter.loadConfig(JSONObject.parseObject(scenicConfig.getStoreConfigJson(), Map.class));
|
||||
} else {
|
||||
adapter = StorageFactory.use("video");
|
||||
}
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VIDEO_PIECE_PATH, taskId.toString() + ".mp4");
|
||||
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "video/mp4", filename);
|
||||
}
|
||||
@PostMapping("/scenic/{scenicId}/{taskId}/success")
|
||||
public ApiResponse<String> success(@PathVariable("scenicId") Long scenicId, @PathVariable("taskId") Long taskId, @RequestBody FileObject fileObject) {
|
||||
IStorageAdapter adapter = StorageFactory.use("assets-ext");
|
||||
fileObject.setUrl(adapter.getUrl(WvpPassiveStorageOperator.getUrlForTask(taskId)));
|
||||
IStorageAdapter adapter;
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null && scenicConfig.getStoreType() != null) {
|
||||
adapter = StorageFactory.get(scenicConfig.getStoreType());
|
||||
adapter.loadConfig(JSONObject.parseObject(scenicConfig.getStoreConfigJson(), Map.class));
|
||||
} else {
|
||||
adapter = StorageFactory.use("video");
|
||||
}
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VIDEO_PIECE_PATH, taskId.toString() + ".mp4");
|
||||
fileObject.setUrl(adapter.getUrl(filename));
|
||||
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
||||
WvpPassiveStorageOperator.onReceiveResult(taskId, fileObject);
|
||||
return ApiResponse.success("success");
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public class DeviceFactory {
|
||||
operator = new WvpPassiveStorageOperator(config.getStoreConfigJson());
|
||||
} else if (Integer.valueOf(DeviceStoreTypeEnum.VPT_PASSIVE.getType()).equals(config.getStoreType())) {
|
||||
operator = new VptPassiveStorageOperator(config.getStoreConfigJson());
|
||||
} else if (Integer.valueOf(DeviceStoreTypeEnum.AWS_OSS.getType()).equals(config.getStoreType())) {
|
||||
operator = new VptPassiveStorageOperator(config.getStoreConfigJson());
|
||||
} else if (Integer.valueOf(DeviceStoreTypeEnum.LOCAL.getType()).equals(config.getStoreType())) {
|
||||
operator = new LocalStorageOperator(config.getStoreConfigJson());
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ public enum DeviceStoreTypeEnum {
|
||||
WVP_ACTIVE(3, "WVP主动模式"),
|
||||
WVP_PASSIVE(4, "WVP被动模式"),
|
||||
VPT_PASSIVE(5, "VPT被动模式"),
|
||||
AWS_OSS(6, "S3 OSS"),
|
||||
LOCAL(2, "本地文件");
|
||||
|
||||
private final int type;
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface OrderMapper {
|
||||
List<OrderRespVO> list(OrderReqQuery orderReqQuery);
|
||||
List<OrderRespVO> listDetail(OrderReqQuery orderReqQuery);
|
||||
OrderRespVO getById(Long id);
|
||||
int add(OrderEntity order);
|
||||
// int deleteById(Long id);
|
||||
|
@ -100,6 +100,14 @@ public class OrderServiceImpl implements OrderService {
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<OrderRespVO>> pageQueryDetail(OrderReqQuery query) {
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize());
|
||||
List<OrderRespVO> list = orderMapper.listDetail(query);
|
||||
PageInfo<OrderRespVO> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<List<OrderRespVO>> list(OrderReqQuery query) {
|
||||
return ApiResponse.success(orderMapper.list(query));
|
||||
@ -144,13 +152,13 @@ public class OrderServiceImpl implements OrderService {
|
||||
WXPayOrderReqVO wxPayOrderReqVO = new WXPayOrderReqVO();
|
||||
String goodsName = null;
|
||||
if (orderItems.size() > 1) {
|
||||
goodsName = "多项景区VLOG商品";
|
||||
goodsName = "多项景区Vloh商品";
|
||||
} else {
|
||||
int type = orderItems.get(NumberConstant.ZERO).getGoodsType();
|
||||
if (type == NumberConstant.ZERO) {
|
||||
goodsName = "景区VLog视频";
|
||||
goodsName = "景区Vlog视频";
|
||||
} else if (type == NumberConstant.ONE) {
|
||||
goodsName = "景区原片包";
|
||||
goodsName = "景区录像包";
|
||||
} else if (type == NumberConstant.TWO) {
|
||||
goodsName = "景区照片包";
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface OrderService {
|
||||
ApiResponse<PageInfo<OrderRespVO>> pageQuery(OrderReqQuery query);
|
||||
ApiResponse<PageInfo<OrderRespVO>> pageQueryDetail(OrderReqQuery query);
|
||||
|
||||
ApiResponse<List<OrderRespVO>> list(OrderReqQuery query);
|
||||
|
||||
|
@ -52,6 +52,7 @@ import com.ycwl.basic.repository.VideoTaskRepository;
|
||||
import com.ycwl.basic.service.task.TaskService;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||
import com.ycwl.basic.storage.enums.StorageAcl;
|
||||
import com.ycwl.basic.storage.utils.StorageUtil;
|
||||
import com.ycwl.basic.task.VideoPieceGetter;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
@ -580,6 +581,16 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
videoMapper.add(video);
|
||||
}
|
||||
IStorageAdapter adapter;
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(task.getScenicId());
|
||||
if (scenicConfig != null && scenicConfig.getStoreType() != null) {
|
||||
adapter = StorageFactory.get(scenicConfig.getStoreType());
|
||||
adapter.loadConfig(JSONObject.parseObject(scenicConfig.getStoreConfigJson(), Map.class));
|
||||
} else {
|
||||
adapter = StorageFactory.use("video");
|
||||
}
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
|
||||
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
||||
int isBuy = 0;
|
||||
FaceEntity face = faceRepository.getFace(task.getFaceId());
|
||||
if (face != null) {
|
||||
@ -592,8 +603,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
if (isBuy != 1) {
|
||||
// 判断景区新生成免费送逻辑
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(task.getScenicId());
|
||||
if (Integer.valueOf(2).equals(scenicConfig.getTemplateNewVideoType())) {
|
||||
if (scenicConfig != null && Integer.valueOf(2).equals(scenicConfig.getTemplateNewVideoType())) {
|
||||
log.info("景区{}启用:templateNewVideoType:全新视频不需要重新购买", task.getScenicId());
|
||||
// 全新视频,不需要重新购买,旧视频在我的里面查看
|
||||
List<MemberVideoEntity> entityList = videoMapper.listRelationByFaceAndTemplate(face.getMemberId(), face.getId(), task.getTemplateId());
|
||||
|
@ -15,7 +15,7 @@
|
||||
update member
|
||||
<set>
|
||||
<if test="scenicId!= null">
|
||||
scenicId = #{scenicId},
|
||||
scenic_id = #{scenicId},
|
||||
</if>
|
||||
<if test="openId!= null and openId!= ''">
|
||||
openid = #{openId},
|
||||
|
@ -288,6 +288,78 @@
|
||||
</where>
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="listDetail" resultMap="PCBaseResultMap">
|
||||
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
|
||||
<where>
|
||||
<if test="id!= null ">
|
||||
and o.id = #{id}
|
||||
</if>
|
||||
<if test="scenicId != null">
|
||||
and o.scenic_id = #{scenicId}
|
||||
</if>
|
||||
<if test="memberNickname!= null and memberNickname!=''">
|
||||
and m.nickname like concat('%',#{memberNickname},'%')
|
||||
</if>
|
||||
<if test="memberRealName!= null and memberRealName!=''">
|
||||
and m.real_name like concat('%',#{memberRealName},'%')
|
||||
</if>
|
||||
<if test="price!= null ">
|
||||
and o.price = #{price}
|
||||
</if>
|
||||
<if test="payPrice!= null ">
|
||||
and pay_price = #{payPrice}
|
||||
</if>
|
||||
<if test="remark!= null and remark!= ''">
|
||||
and remark like concat('%',#{remark},'%')
|
||||
</if>
|
||||
<if test="brokerId!= null ">
|
||||
and o.broker_id = #{brokerId}
|
||||
</if>
|
||||
<if test="promoCode!= null and promoCode!= ''">
|
||||
and o.promo_code like concat('%',#{promoCode},'%')
|
||||
</if>
|
||||
<if test="refundReason!= null and refundReason!= ''">
|
||||
and refund_reason like concat('%',#{refundReason},'%')
|
||||
</if>
|
||||
<if test="refundStatus!= null ">
|
||||
and refund_status = #{refundStatus}
|
||||
</if>
|
||||
<if test="status!= null ">
|
||||
and o.`status` = #{status}
|
||||
</if>
|
||||
<if test="startCreateTime!= null ">
|
||||
and o.create_at >= #{startCreateTime}
|
||||
</if>
|
||||
<if test="endCreateTime!= null ">
|
||||
and o.create_at <= #{endCreateTime}
|
||||
</if>
|
||||
<if test="startPayTime!= null ">
|
||||
and pay_at >= #{startPayTime}
|
||||
</if>
|
||||
<if test="endPayTime!= null ">
|
||||
and pay_at <= #{endPayTime}
|
||||
</if>
|
||||
<if test="startRefundTime!= null ">
|
||||
and refund_at >= #{startRefundTime}
|
||||
</if>
|
||||
<if test="endRefundTime!= null ">
|
||||
and refund_at <= #{endRefundTime}
|
||||
</if>
|
||||
<if test="startCancelTime!= null ">
|
||||
and cancel_at >= #{startCancelTime}
|
||||
</if>
|
||||
<if test="endCancelTime!= null ">
|
||||
and cancel_at <= #{endCancelTime}
|
||||
</if>
|
||||
</where>
|
||||
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.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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user