You've already forked FrameTour-BE
Compare commits
8 Commits
0432b99524
...
59b481989c
Author | SHA1 | Date | |
---|---|---|---|
59b481989c | |||
61cf9383d0 | |||
878dec2c55 | |||
48bd9d2b0c | |||
b365d86796 | |||
18cb459320 | |||
b7d3e20c46 | |||
d55c7a7769 |
@@ -360,4 +360,12 @@ public class OrderBiz {
|
|||||||
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
||||||
profitSharingBiz.revokeProfitSharing(order.getScenicId(), orderId, "订单已退款");
|
profitSharingBiz.revokeProfitSharing(order.getScenicId(), orderId, "订单已退款");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查用户是否购买了指定商品
|
||||||
|
* 提供给PriceBiz使用,避免循环调用
|
||||||
|
*/
|
||||||
|
public boolean checkUserBuyItem(Long userId, int goodsType, Long goodsId) {
|
||||||
|
return orderRepository.checkUserBuyItem(userId, goodsType, goodsId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package com.ycwl.basic.biz;
|
package com.ycwl.basic.biz;
|
||||||
|
|
||||||
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
|
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
|
||||||
|
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
|
||||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
|
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
|
||||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||||
@@ -9,20 +11,25 @@ import com.ycwl.basic.model.pc.price.entity.PriceConfigEntity;
|
|||||||
import com.ycwl.basic.model.pc.price.resp.GoodsListRespVO;
|
import com.ycwl.basic.model.pc.price.resp.GoodsListRespVO;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
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.pricing.entity.PriceOnePriceConfig;
|
import com.ycwl.basic.pricing.entity.PriceOnePriceConfig;
|
||||||
import com.ycwl.basic.pricing.service.IOnePricePurchaseService;
|
import com.ycwl.basic.pricing.service.IOnePricePurchaseService;
|
||||||
import com.ycwl.basic.repository.FaceRepository;
|
import com.ycwl.basic.repository.FaceRepository;
|
||||||
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
import com.ycwl.basic.repository.PriceRepository;
|
import com.ycwl.basic.repository.PriceRepository;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
|
import com.ycwl.basic.service.pc.FaceService;
|
||||||
import org.apache.commons.lang3.Strings;
|
import org.apache.commons.lang3.Strings;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -38,7 +45,12 @@ public class PriceBiz {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FaceRepository faceRepository;
|
private FaceRepository faceRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private FaceService faceService;
|
||||||
|
@Autowired
|
||||||
private CouponBiz couponBiz;
|
private CouponBiz couponBiz;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
public List<GoodsListRespVO> listGoodsByScenic(Long scenicId) {
|
public List<GoodsListRespVO> listGoodsByScenic(Long scenicId) {
|
||||||
List<GoodsListRespVO> goodsList = new ArrayList<>();
|
List<GoodsListRespVO> goodsList = new ArrayList<>();
|
||||||
@@ -48,15 +60,16 @@ public class PriceBiz {
|
|||||||
GoodsListRespVO goods = new GoodsListRespVO();
|
GoodsListRespVO goods = new GoodsListRespVO();
|
||||||
goods.setGoodsId(template.getId());
|
goods.setGoodsId(template.getId());
|
||||||
goods.setGoodsName(template.getName());
|
goods.setGoodsName(template.getName());
|
||||||
|
goods.setGoodsType(0);
|
||||||
return goods;
|
return goods;
|
||||||
}).forEach(goodsList::add);
|
}).forEach(goodsList::add);
|
||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||||
if (scenicConfig != null) {
|
if (scenicConfig != null) {
|
||||||
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
||||||
goodsList.add(new GoodsListRespVO(1L, "录像集"));
|
goodsList.add(new GoodsListRespVO(1L, "录像集", 1));
|
||||||
}
|
}
|
||||||
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
|
||||||
goodsList.add(new GoodsListRespVO(2L, "照片集"));
|
goodsList.add(new GoodsListRespVO(2L, "照片集", 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return goodsList;
|
return goodsList;
|
||||||
@@ -140,6 +153,52 @@ public class PriceBiz {
|
|||||||
respVO.setBuy(Integer.valueOf(1).equals(orderEntity.getStatus()));
|
respVO.setBuy(Integer.valueOf(1).equals(orderEntity.getStatus()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type == -1 && !respVO.isBuy()) {
|
||||||
|
// 直接查询用户购买状态,避免调用faceContentList造成循环调用
|
||||||
|
boolean allContentsPurchased = true;
|
||||||
|
|
||||||
|
// 检查视频模板购买状态
|
||||||
|
List<TemplateRespVO> templateList = templateRepository.getTemplateListByScenicId(scenicId);
|
||||||
|
for (TemplateRespVO template : templateList) {
|
||||||
|
// 使用OrderRepository直接检查是否购买了该模板下的内容
|
||||||
|
List<MemberVideoEntity> videoEntities = memberRelationRepository.listRelationByFaceAndTemplate(faceId, template.getId());
|
||||||
|
if (videoEntities == null || videoEntities.isEmpty()) {
|
||||||
|
allContentsPurchased = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
boolean hasPurchasedTemplate = orderBiz.checkUserBuyItem(userId, 0, videoEntities.getFirst().getVideoId());
|
||||||
|
if (!hasPurchasedTemplate) {
|
||||||
|
allContentsPurchased = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查源文件购买状态(录像集和照片集)
|
||||||
|
if (allContentsPurchased) {
|
||||||
|
if (scenicConfig != null) {
|
||||||
|
// 检查录像集
|
||||||
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
||||||
|
boolean hasPurchasedRecording = orderBiz.checkUserBuyItem(userId, 1, faceId);
|
||||||
|
if (!hasPurchasedRecording) {
|
||||||
|
allContentsPurchased = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查照片集
|
||||||
|
if (allContentsPurchased && !Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
|
||||||
|
boolean hasPurchasedPhoto = orderBiz.checkUserBuyItem(userId, 2, faceId);
|
||||||
|
if (!hasPurchasedPhoto) {
|
||||||
|
allContentsPurchased = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果所有内容都已购买,则认为已购买套餐
|
||||||
|
if (allContentsPurchased) {
|
||||||
|
respVO.setBuy(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
respVO.setShare(false);
|
respVO.setShare(false);
|
||||||
if (face == null || !face.getMemberId().equals(userId)) {
|
if (face == null || !face.getMemberId().equals(userId)) {
|
||||||
respVO.setShare(true);
|
respVO.setShare(true);
|
||||||
|
@@ -1,18 +0,0 @@
|
|||||||
package com.ycwl.basic.constant;
|
|
||||||
|
|
||||||
public class ShareParkingSpaceRedisKeyConstant {
|
|
||||||
// 更改数量时候的锁
|
|
||||||
public final static String UPDATE_NUMBER_LOCK_KEY="ShareParking:updateNumberLockKey";
|
|
||||||
// 地上车位
|
|
||||||
public final static String GROUND_PARKING_SPACE_NUMBER="ShareParking:groundParkingSpaceNumber";
|
|
||||||
// 地下车位数
|
|
||||||
public final static String UNDERGROUND_PARKING_SPACE_NUMBER="ShareParking:undergroundParkingSpaceNumber";
|
|
||||||
// 每日开放预约时间
|
|
||||||
public final static String OPEN_TIME="ShareParking:openTime";
|
|
||||||
// 预约后当日车辆最晚停留时间
|
|
||||||
public final static String RESIDENCE_TIME="ShareParking:residenceTime";
|
|
||||||
//取消时间
|
|
||||||
public final static String CANCEL_TIME="ShareParking:cancelTime";
|
|
||||||
//支付时间
|
|
||||||
public final static String PAY_TIME="ShareParking:payTime";
|
|
||||||
}
|
|
@@ -88,10 +88,10 @@ public class AppScenicController {
|
|||||||
resp.setBrokerDirectRate(scenicConfig.getBigDecimal("broker_direct_rate"));
|
resp.setBrokerDirectRate(scenicConfig.getBigDecimal("broker_direct_rate"));
|
||||||
resp.setVideoSourcePackHint(scenicConfig.getString("video_source_pack_hint"));
|
resp.setVideoSourcePackHint(scenicConfig.getString("video_source_pack_hint"));
|
||||||
resp.setImageSourcePackHint(scenicConfig.getString("image_source_pack_hint"));
|
resp.setImageSourcePackHint(scenicConfig.getString("image_source_pack_hint"));
|
||||||
resp.setVoucherEnable(scenicConfig.getBoolean("voucher_enable"));
|
resp.setVoucherEnable(scenicConfig.getBoolean("voucher_enable", false));
|
||||||
resp.setEnableVoucher(scenicConfig.getBoolean("voucher_enable")); // compactible
|
resp.setEnableVoucher(scenicConfig.getBoolean("voucher_enable", false)); // compactible
|
||||||
resp.setGroupingEnable(scenicConfig.getBoolean("grouping_enable"));
|
resp.setGroupingEnable(scenicConfig.getBoolean("grouping_enable", false));
|
||||||
resp.setShowPhotoWhenWaiting(scenicConfig.getBoolean("show_photo_when_waiting"));
|
resp.setShowPhotoWhenWaiting(scenicConfig.getBoolean("show_photo_when_waiting", false));
|
||||||
return ApiResponse.success(resp);
|
return ApiResponse.success(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ public class CouponController {
|
|||||||
@GetMapping("/{scenicId}/goodsList")
|
@GetMapping("/{scenicId}/goodsList")
|
||||||
public ApiResponse<List<GoodsListRespVO>> scenicGoodsList(@PathVariable Long scenicId) {
|
public ApiResponse<List<GoodsListRespVO>> scenicGoodsList(@PathVariable Long scenicId) {
|
||||||
List<GoodsListRespVO> data = priceBiz.listGoodsByScenic(scenicId);
|
List<GoodsListRespVO> data = priceBiz.listGoodsByScenic(scenicId);
|
||||||
data.add(new GoodsListRespVO(-1L, "一口价"));
|
data.add(new GoodsListRespVO(-1L, "一口价", -1));
|
||||||
return ApiResponse.success(data);
|
return ApiResponse.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ public interface SourceMapper {
|
|||||||
List<SourceEntity> listVideoByFaceRelation(Long memberId, Long faceId);
|
List<SourceEntity> listVideoByFaceRelation(Long memberId, Long faceId);
|
||||||
|
|
||||||
List<SourceEntity> listImageByFaceRelation(Long memberId, Long faceId);
|
List<SourceEntity> listImageByFaceRelation(Long memberId, Long faceId);
|
||||||
List<MemberSourceEntity> listByFaceRelation(Long memberId, Long faceId, Integer type);
|
List<MemberSourceEntity> listByFaceRelation(Long faceId, Integer type);
|
||||||
|
|
||||||
SourceEntity getEntity(Long id);
|
SourceEntity getEntity(Long id);
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ public interface VideoMapper {
|
|||||||
|
|
||||||
MemberVideoEntity queryRelationByMemberTask(Long userId, Long taskId);
|
MemberVideoEntity queryRelationByMemberTask(Long userId, Long taskId);
|
||||||
List<MemberVideoEntity> listRelationByTask(Long taskId);
|
List<MemberVideoEntity> listRelationByTask(Long taskId);
|
||||||
List<MemberVideoEntity> listRelationByFace(Long userId, Long faceId);
|
List<MemberVideoEntity> listRelationByFace(Long faceId);
|
||||||
List<MemberVideoEntity> listRelationByFaceAndTemplate(Long faceId, Long templateId);
|
List<MemberVideoEntity> listRelationByFaceAndTemplate(Long faceId, Long templateId);
|
||||||
|
|
||||||
List<TaskEntity> listTaskByScenicRelation(Long userId, Long scenicId);
|
List<TaskEntity> listTaskByScenicRelation(Long userId, Long scenicId);
|
||||||
|
@@ -10,4 +10,5 @@ import lombok.NoArgsConstructor;
|
|||||||
public class GoodsListRespVO {
|
public class GoodsListRespVO {
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
private String goodsName;
|
private String goodsName;
|
||||||
|
private Integer goodsType;
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@ public class TemplateRespVO {
|
|||||||
*/
|
*/
|
||||||
// 模版名称
|
// 模版名称
|
||||||
private String name;
|
private String name;
|
||||||
|
private String group;
|
||||||
/**
|
/**
|
||||||
* 父模版ID
|
* 父模版ID
|
||||||
*/
|
*/
|
||||||
|
@@ -0,0 +1,113 @@
|
|||||||
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.ycwl.basic.mapper.SourceMapper;
|
||||||
|
import com.ycwl.basic.mapper.VideoMapper;
|
||||||
|
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
|
||||||
|
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
||||||
|
import com.ycwl.basic.utils.JacksonUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class MemberRelationRepository {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VideoMapper videoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SourceMapper sourceMapper;
|
||||||
|
|
||||||
|
public static final String MEMBER_RELATION_BY_FACE_CACHE_KEY = "member_relation:face:%d:v";
|
||||||
|
public static final String MEMBER_RELATION_BY_FACE_TEMPLATE_CACHE_KEY = "member_relation:face:%d:v:template:%d";
|
||||||
|
public static final String MEMBER_SOURCE_BY_FACE_TYPE_CACHE_KEY = "member_relation:face:%d:s:type:%d";
|
||||||
|
|
||||||
|
public List<MemberVideoEntity> listRelationByFace(Long faceId) {
|
||||||
|
String cacheKey = String.format(MEMBER_RELATION_BY_FACE_CACHE_KEY, faceId);
|
||||||
|
|
||||||
|
if (redisTemplate.hasKey(cacheKey)) {
|
||||||
|
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||||
|
return JacksonUtil.fromJson(cacheValue, new TypeReference<List<MemberVideoEntity>>() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MemberVideoEntity> result = videoMapper.listRelationByFace(faceId);
|
||||||
|
if (result != null) {
|
||||||
|
redisTemplate.opsForValue().set(cacheKey, JacksonUtil.toJson(result), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MemberVideoEntity> listRelationByFaceAndTemplate(Long faceId, Long templateId) {
|
||||||
|
String cacheKey = String.format(MEMBER_RELATION_BY_FACE_TEMPLATE_CACHE_KEY, faceId, templateId);
|
||||||
|
|
||||||
|
if (redisTemplate.hasKey(cacheKey)) {
|
||||||
|
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||||
|
return JacksonUtil.fromJson(cacheValue, new TypeReference<List<MemberVideoEntity>>() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MemberVideoEntity> result = videoMapper.listRelationByFaceAndTemplate(faceId, templateId);
|
||||||
|
if (result != null) {
|
||||||
|
redisTemplate.opsForValue().set(cacheKey, JacksonUtil.toJson(result), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MemberSourceEntity> listSourceByFaceRelation(Long faceId, Integer type) {
|
||||||
|
String cacheKey = String.format(MEMBER_SOURCE_BY_FACE_TYPE_CACHE_KEY, faceId, type);
|
||||||
|
|
||||||
|
if (redisTemplate.hasKey(cacheKey)) {
|
||||||
|
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||||
|
return JacksonUtil.fromJson(cacheValue, new TypeReference<List<MemberSourceEntity>>() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MemberSourceEntity> result = sourceMapper.listByFaceRelation(faceId, type);
|
||||||
|
if (result != null) {
|
||||||
|
redisTemplate.opsForValue().set(cacheKey, JacksonUtil.toJson(result), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearCacheByFace(Long faceId) {
|
||||||
|
String pattern = "member_relation:face:" + faceId + ":*";
|
||||||
|
Set<String> keys = redisTemplate.keys(pattern);
|
||||||
|
if (keys != null && !keys.isEmpty()) {
|
||||||
|
redisTemplate.delete(keys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearVCacheByFace(Long faceId) {
|
||||||
|
String pattern = "member_relation:face:" + faceId + ":v:*";
|
||||||
|
Set<String> keys = redisTemplate.keys(pattern);
|
||||||
|
if (keys != null && !keys.isEmpty()) {
|
||||||
|
redisTemplate.delete(keys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearSCacheByFace(Long faceId) {
|
||||||
|
String pattern = "member_relation:face:" + faceId + ":s:*";
|
||||||
|
Set<String> keys = redisTemplate.keys(pattern);
|
||||||
|
if (keys != null && !keys.isEmpty()) {
|
||||||
|
redisTemplate.delete(keys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearAllCache() {
|
||||||
|
String pattern = "member_relation:*";
|
||||||
|
Set<String> keys = redisTemplate.keys(pattern);
|
||||||
|
if (keys != null && !keys.isEmpty()) {
|
||||||
|
redisTemplate.delete(keys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -98,6 +98,10 @@ public class OrderRepository {
|
|||||||
return checkUserBuyItem(userId, 0, videoId);
|
return checkUserBuyItem(userId, 0, videoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkUserBuyTemplate(Long userId, Long templateId) {
|
||||||
|
return checkUserBuyItem(userId, -1, templateId);
|
||||||
|
}
|
||||||
|
|
||||||
public void clearUserBuyItemCache(Long userId, int goodsType, Long goodsId) {
|
public void clearUserBuyItemCache(Long userId, int goodsType, Long goodsId) {
|
||||||
redisTemplate.delete(String.format(ORDER_USER_TYPE_BUY_ITEM_CACHE_KEY, userId, goodsType, goodsId));
|
redisTemplate.delete(String.format(ORDER_USER_TYPE_BUY_ITEM_CACHE_KEY, userId, goodsType, goodsId));
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,8 @@ public class SourceRepository {
|
|||||||
private TemplateRepository templateRepository;
|
private TemplateRepository templateRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceRepository deviceRepository;
|
private DeviceRepository deviceRepository;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
public void addSource(SourceEntity source) {
|
public void addSource(SourceEntity source) {
|
||||||
sourceMapper.add(source);
|
sourceMapper.add(source);
|
||||||
@@ -46,6 +48,7 @@ public class SourceRepository {
|
|||||||
memberSource.setOrderId(orderId);
|
memberSource.setOrderId(orderId);
|
||||||
memberSource.setIsBuy(1);
|
memberSource.setIsBuy(1);
|
||||||
sourceMapper.updateRelation(memberSource);
|
sourceMapper.updateRelation(memberSource);
|
||||||
|
memberRelationRepository.clearSCacheByFace(faceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserNotBuyItem(Long memberId, int type, Long faceId) {
|
public void setUserNotBuyItem(Long memberId, int type, Long faceId) {
|
||||||
@@ -56,6 +59,7 @@ public class SourceRepository {
|
|||||||
memberSource.setOrderId(null);
|
memberSource.setOrderId(null);
|
||||||
memberSource.setIsBuy(0);
|
memberSource.setIsBuy(0);
|
||||||
sourceMapper.updateRelation(memberSource);
|
sourceMapper.updateRelation(memberSource);
|
||||||
|
memberRelationRepository.clearSCacheByFace(faceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUserIsBuy(Long userId, int type, Long faceId) {
|
public boolean getUserIsBuy(Long userId, int type, Long faceId) {
|
||||||
|
@@ -2,8 +2,6 @@ package com.ycwl.basic.repository;
|
|||||||
|
|
||||||
import com.ycwl.basic.biz.PriceBiz;
|
import com.ycwl.basic.biz.PriceBiz;
|
||||||
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
|
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
|
||||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
|
||||||
import com.ycwl.basic.pricing.dto.DiscountDetectionContext;
|
|
||||||
import com.ycwl.basic.pricing.dto.VoucherInfo;
|
import com.ycwl.basic.pricing.dto.VoucherInfo;
|
||||||
import com.ycwl.basic.pricing.enums.VoucherDiscountType;
|
import com.ycwl.basic.pricing.enums.VoucherDiscountType;
|
||||||
import com.ycwl.basic.pricing.service.IVoucherService;
|
import com.ycwl.basic.pricing.service.IVoucherService;
|
||||||
@@ -36,6 +34,8 @@ public class VideoRepository {
|
|||||||
private PriceBiz priceBiz;
|
private PriceBiz priceBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IVoucherService iVoucherService;
|
private IVoucherService iVoucherService;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
public VideoEntity getVideo(Long videoId) {
|
public VideoEntity getVideo(Long videoId) {
|
||||||
if (redisTemplate.hasKey(String.format(VIDEO_CACHE_KEY, videoId))) {
|
if (redisTemplate.hasKey(String.format(VIDEO_CACHE_KEY, videoId))) {
|
||||||
@@ -84,6 +84,12 @@ public class VideoRepository {
|
|||||||
memberVideo.setIsBuy(1);
|
memberVideo.setIsBuy(1);
|
||||||
memberVideo.setOrderId(orderId);
|
memberVideo.setOrderId(orderId);
|
||||||
videoMapper.updateRelation(memberVideo);
|
videoMapper.updateRelation(memberVideo);
|
||||||
|
|
||||||
|
// 清理视频关系缓存
|
||||||
|
MemberVideoEntity existingVideo = videoMapper.queryUserVideo(memberId, videoId);
|
||||||
|
if (existingVideo != null && existingVideo.getFaceId() != null) {
|
||||||
|
memberRelationRepository.clearVCacheByFace(existingVideo.getFaceId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserNotBuyItem(Long memberId, Long videoId) {
|
public void setUserNotBuyItem(Long memberId, Long videoId) {
|
||||||
@@ -93,6 +99,12 @@ public class VideoRepository {
|
|||||||
memberVideo.setIsBuy(0);
|
memberVideo.setIsBuy(0);
|
||||||
memberVideo.setOrderId(null);
|
memberVideo.setOrderId(null);
|
||||||
videoMapper.updateRelation(memberVideo);
|
videoMapper.updateRelation(memberVideo);
|
||||||
|
|
||||||
|
// 清理视频关系缓存
|
||||||
|
MemberVideoEntity existingVideo = videoMapper.queryUserVideo(memberId, videoId);
|
||||||
|
if (existingVideo != null && existingVideo.getFaceId() != null) {
|
||||||
|
memberRelationRepository.clearVCacheByFace(existingVideo.getFaceId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUserIsBuy(Long userId, Long videoId) {
|
public boolean getUserIsBuy(Long userId, Long videoId) {
|
||||||
@@ -133,7 +145,4 @@ public class VideoRepository {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MemberVideoEntity> getVideoByFaceAndTemplateId(Long memberId, Long faceId, String templateId) {
|
|
||||||
return videoMapper.userFaceTemplateVideo(memberId, faceId, Long.valueOf(templateId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2DTO;
|
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2DTO;
|
||||||
|
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
|
||||||
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
import com.ycwl.basic.utils.JacksonUtil;
|
import com.ycwl.basic.utils.JacksonUtil;
|
||||||
import com.ycwl.basic.biz.CouponBiz;
|
import com.ycwl.basic.biz.CouponBiz;
|
||||||
import com.ycwl.basic.biz.OrderBiz;
|
import com.ycwl.basic.biz.OrderBiz;
|
||||||
@@ -105,6 +107,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
private TemplateBiz templateBiz;
|
private TemplateBiz templateBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
private VideoUpdateConfig videoUpdateConfig;
|
private VideoUpdateConfig videoUpdateConfig;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
||||||
Long scenicId = query.getScenicId();
|
Long scenicId = query.getScenicId();
|
||||||
@@ -362,7 +366,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
response.setStatus(2);
|
response.setStatus(2);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
List<MemberVideoEntity> taskList = videoMapper.listRelationByFace(userId, faceId);
|
List<MemberVideoEntity> taskList = videoMapper.listRelationByFace(faceId);
|
||||||
if (faceCutStatus != 1 && taskList.isEmpty()) {
|
if (faceCutStatus != 1 && taskList.isEmpty()) {
|
||||||
// 视频切成了能够获取视频的状态,但是没有任务,还是显示正在处理
|
// 视频切成了能够获取视频的状态,但是没有任务,还是显示正在处理
|
||||||
response.setStatus(0);
|
response.setStatus(0);
|
||||||
@@ -404,7 +408,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
// 重查一下
|
// 重查一下
|
||||||
taskList = videoMapper.listRelationByFace(userId, faceId);
|
taskList = videoMapper.listRelationByFace(faceId);
|
||||||
MemberVideoEntity lastVideo = taskList.getLast();
|
MemberVideoEntity lastVideo = taskList.getLast();
|
||||||
if (null == lastVideo.getVideoId()) {
|
if (null == lastVideo.getVideoId()) {
|
||||||
response.setTemplateId(lastVideo.getTemplateId());
|
response.setTemplateId(lastVideo.getTemplateId());
|
||||||
@@ -779,14 +783,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
if (face == null) {
|
if (face == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Integer sourceType = query.getSourceType();
|
List<MemberSourceEntity> memberSourceEntities = memberRelationRepository.listSourceByFaceRelation(face.getId(), query.getSourceType());
|
||||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
return memberSourceEntities.size();
|
||||||
sourceReqQuery.setScenicId(face.getScenicId());
|
|
||||||
sourceReqQuery.setIsBuy(query.getIsBuy());
|
|
||||||
sourceReqQuery.setMemberId(face.getMemberId());
|
|
||||||
sourceReqQuery.setType(sourceType);
|
|
||||||
sourceReqQuery.setFaceId(query.getFaceId());
|
|
||||||
return sourceMapper.countUser(sourceReqQuery);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -25,12 +25,10 @@ import com.ycwl.basic.model.mobile.goods.VideoTaskStatusVO;
|
|||||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||||
import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
|
import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
|
||||||
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
||||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
|
||||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||||
import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
|
||||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||||
import com.ycwl.basic.model.pc.project.resp.ProjectRespVO;
|
import com.ycwl.basic.model.pc.project.resp.ProjectRespVO;
|
||||||
@@ -40,13 +38,16 @@ import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
|||||||
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
||||||
import com.ycwl.basic.model.pc.order.entity.OrderEntity;
|
import com.ycwl.basic.model.pc.order.entity.OrderEntity;
|
||||||
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
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.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;
|
||||||
import com.ycwl.basic.model.repository.TaskUpdateResult;
|
import com.ycwl.basic.model.repository.TaskUpdateResult;
|
||||||
import com.ycwl.basic.model.task.resp.SearchFaceRespVo;
|
import com.ycwl.basic.model.task.resp.SearchFaceRespVo;
|
||||||
import com.ycwl.basic.repository.DeviceRepository;
|
import com.ycwl.basic.repository.DeviceRepository;
|
||||||
import com.ycwl.basic.repository.FaceRepository;
|
import com.ycwl.basic.repository.FaceRepository;
|
||||||
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||||
import com.ycwl.basic.service.mobile.GoodsService;
|
import com.ycwl.basic.service.mobile.GoodsService;
|
||||||
@@ -75,7 +76,6 @@ import java.util.Date;
|
|||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -134,6 +134,10 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
private GoodsService goodsService;
|
private GoodsService goodsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectMapper projectMapper;
|
private ProjectMapper projectMapper;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
@Autowired
|
||||||
|
private TemplateRepository templateRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||||
@@ -341,7 +345,8 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
|
|
||||||
// 保存关联关系并创建任务
|
// 保存关联关系并创建任务
|
||||||
sourceMapper.addRelations(memberSourceEntityList);
|
sourceMapper.addRelations(memberSourceEntityList);
|
||||||
taskTaskService.autoCreateTaskByFaceId(face.getId());
|
memberRelationRepository.clearSCacheByFace(faceId);
|
||||||
|
taskTaskService.autoCreateTaskByFaceId(faceId);
|
||||||
|
|
||||||
log.info("人脸匹配完成:faceId={}, 匹配样本数={}, 关联源文件数={}, 免费数={}",
|
log.info("人脸匹配完成:faceId={}, 匹配样本数={}, 关联源文件数={}, 免费数={}",
|
||||||
faceId, sampleListIds.size(), memberSourceEntityList.size(), freeSourceIds.size());
|
faceId, sampleListIds.size(), memberSourceEntityList.size(), freeSourceIds.size());
|
||||||
@@ -652,14 +657,32 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ContentPageVO> faceContentList(Long faceId) {
|
public List<ContentPageVO> faceContentList(Long faceId) {
|
||||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
FaceEntity face = faceRepository.getFace(faceId);
|
||||||
if (faceRespVO == null) {
|
if (face == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
Long userId = faceRespVO.getMemberId();
|
Long userId = face.getMemberId();
|
||||||
List<ContentPageVO> contentList = templateMapper.listFor(faceRespVO.getScenicId());
|
List<TemplateRespVO> templateList = templateRepository.getTemplateListByScenicId(face.getScenicId());
|
||||||
contentList.forEach(contentPageVO -> {
|
List<ContentPageVO> contentList = templateList.stream().map(template -> {
|
||||||
List<MemberVideoEntity> memberVideoEntityList = videoMapper.userFaceTemplateVideo(userId, faceId, contentPageVO.getTemplateId());
|
/// select t.id templateId, t.scenic_id, t.`group`, t.`name`, pid, t.cover_url templateCoverUrl,
|
||||||
|
/// 0 as sourceType, sort,
|
||||||
|
/// t.create_time, t.price
|
||||||
|
/// from template t
|
||||||
|
/// where t.scenic_id = #{scenicId} and pid = 0 and t.status = 1
|
||||||
|
/// order by sort
|
||||||
|
ContentPageVO content = new ContentPageVO();
|
||||||
|
content.setTemplateId(template.getId());
|
||||||
|
content.setScenicId(template.getScenicId());
|
||||||
|
content.setGroup(template.getGroup());
|
||||||
|
content.setName(template.getName());
|
||||||
|
content.setTemplateCoverUrl(template.getCoverUrl());
|
||||||
|
content.setSourceType(0);
|
||||||
|
content.setSort(template.getSort());
|
||||||
|
content.setGoodsType(0);
|
||||||
|
content.setScenicName(template.getScenicName());
|
||||||
|
return content;
|
||||||
|
}).peek(contentPageVO -> {
|
||||||
|
List<MemberVideoEntity> memberVideoEntityList = memberRelationRepository.listRelationByFaceAndTemplate(faceId, contentPageVO.getTemplateId());
|
||||||
contentPageVO.setGoodsType(0);
|
contentPageVO.setGoodsType(0);
|
||||||
contentPageVO.setContentType(1);
|
contentPageVO.setContentType(1);
|
||||||
contentPageVO.setSort(contentPageVO.getSort());
|
contentPageVO.setSort(contentPageVO.getSort());
|
||||||
@@ -692,14 +715,16 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
contentPageVO.setLockType(1);
|
contentPageVO.setLockType(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IsBuyRespVO buy = orderBiz.isBuy(userId, contentPageVO.getScenicId(), contentPageVO.getGoodsType(), contentPageVO.getContentId());
|
boolean buy = orderBiz.checkUserBuyItem(userId, contentPageVO.getGoodsType(), contentPageVO.getContentId());
|
||||||
if (buy.isBuy()) {
|
if (buy) {
|
||||||
contentPageVO.setIsBuy(1);
|
contentPageVO.setIsBuy(1);
|
||||||
|
} else {
|
||||||
|
contentPageVO.setIsBuy(0);
|
||||||
}
|
}
|
||||||
});
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||||
sourceReqQuery.setScenicId(faceRespVO.getScenicId());
|
sourceReqQuery.setScenicId(face.getScenicId());
|
||||||
sourceReqQuery.setFaceId(faceId);
|
sourceReqQuery.setFaceId(faceId);
|
||||||
sourceReqQuery.setMemberId(userId);
|
sourceReqQuery.setMemberId(userId);
|
||||||
//查询源素材
|
//查询源素材
|
||||||
@@ -710,8 +735,8 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
sourceImageContent.setName("照片集");
|
sourceImageContent.setName("照片集");
|
||||||
sourceVideoContent.setSort(9999);
|
sourceVideoContent.setSort(9999);
|
||||||
sourceImageContent.setSort(9999);
|
sourceImageContent.setSort(9999);
|
||||||
sourceVideoContent.setScenicId(faceRespVO.getScenicId());
|
sourceVideoContent.setScenicId(face.getScenicId());
|
||||||
sourceImageContent.setScenicId(faceRespVO.getScenicId());
|
sourceImageContent.setScenicId(face.getScenicId());
|
||||||
sourceVideoContent.setGoodsType(1);
|
sourceVideoContent.setGoodsType(1);
|
||||||
sourceImageContent.setGoodsType(2);
|
sourceImageContent.setGoodsType(2);
|
||||||
sourceVideoContent.setContentType(2);
|
sourceVideoContent.setContentType(2);
|
||||||
@@ -720,9 +745,9 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
sourceImageContent.setLockType(-1);
|
sourceImageContent.setLockType(-1);
|
||||||
sourceVideoContent.setGroup("直出原片");
|
sourceVideoContent.setGroup("直出原片");
|
||||||
sourceImageContent.setGroup("直出原片");
|
sourceImageContent.setGroup("直出原片");
|
||||||
ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(faceRespVO.getScenicId());
|
ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(face.getScenicId());
|
||||||
if (!Boolean.TRUE.equals(scenicConfig.getBoolean("disable_source_image"))) {
|
if (!Boolean.TRUE.equals(scenicConfig.getBoolean("disable_source_image"))) {
|
||||||
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, faceRespVO.getScenicId(), 2, faceId);
|
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, face.getScenicId(), 2, faceId);
|
||||||
sourceImageContent.setSourceType(isBuyRespVO.getGoodsType());
|
sourceImageContent.setSourceType(isBuyRespVO.getGoodsType());
|
||||||
sourceImageContent.setContentId(isBuyRespVO.getGoodsId());
|
sourceImageContent.setContentId(isBuyRespVO.getGoodsId());
|
||||||
if (isBuyRespVO.isBuy()) {
|
if (isBuyRespVO.isBuy()) {
|
||||||
@@ -730,7 +755,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
} else {
|
} else {
|
||||||
sourceImageContent.setIsBuy(0);
|
sourceImageContent.setIsBuy(0);
|
||||||
}
|
}
|
||||||
List<MemberSourceEntity> relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 2);
|
List<MemberSourceEntity> relations = memberRelationRepository.listSourceByFaceRelation(faceId, 2);
|
||||||
if (!relations.isEmpty()) {
|
if (!relations.isEmpty()) {
|
||||||
sourceImageContent.setLockType(-1);
|
sourceImageContent.setLockType(-1);
|
||||||
} else {
|
} else {
|
||||||
@@ -741,7 +766,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
contentList.add(sourceImageContent);
|
contentList.add(sourceImageContent);
|
||||||
}
|
}
|
||||||
if (!Boolean.TRUE.equals(scenicConfig.getBoolean("disable_source_video"))) {
|
if (!Boolean.TRUE.equals(scenicConfig.getBoolean("disable_source_video"))) {
|
||||||
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, faceRespVO.getScenicId(), 1, faceId);
|
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, face.getScenicId(), 1, faceId);
|
||||||
sourceVideoContent.setSourceType(isBuyRespVO.getGoodsType());
|
sourceVideoContent.setSourceType(isBuyRespVO.getGoodsType());
|
||||||
sourceVideoContent.setContentId(isBuyRespVO.getGoodsId());
|
sourceVideoContent.setContentId(isBuyRespVO.getGoodsId());
|
||||||
if (isBuyRespVO.isBuy()) {
|
if (isBuyRespVO.isBuy()) {
|
||||||
@@ -749,7 +774,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
} else {
|
} else {
|
||||||
sourceVideoContent.setIsBuy(0);
|
sourceVideoContent.setIsBuy(0);
|
||||||
}
|
}
|
||||||
List<MemberSourceEntity> relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 1);
|
List<MemberSourceEntity> relations = memberRelationRepository.listSourceByFaceRelation(faceId, 1);
|
||||||
if (!relations.isEmpty()) {
|
if (!relations.isEmpty()) {
|
||||||
sourceVideoContent.setLockType(-1);
|
sourceVideoContent.setLockType(-1);
|
||||||
} else {
|
} else {
|
||||||
@@ -885,12 +910,13 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
sourceReqQuery.setMemberId(face.getMemberId());
|
sourceReqQuery.setMemberId(face.getMemberId());
|
||||||
sourceReqQuery.setFaceId(faceId);
|
sourceReqQuery.setFaceId(faceId);
|
||||||
sourceReqQuery.setType(2);
|
sourceReqQuery.setType(2);
|
||||||
Integer countUser = sourceMapper.countUser(sourceReqQuery);
|
List<MemberSourceEntity> countUser = memberRelationRepository.listSourceByFaceRelation(faceId, 2);
|
||||||
if (countUser != null && countUser > 0) {
|
if (countUser != null && !countUser.isEmpty()) {
|
||||||
statusResp.setStep2Status(true);
|
statusResp.setStep2Status(true);
|
||||||
} else {
|
} else {
|
||||||
statusResp.setStep2Status(false);
|
statusResp.setStep2Status(false);
|
||||||
statusResp.setDisplayText("Hey,快去智能机位打卡吧");
|
statusResp.setDisplayText("Hey,快去智能机位打卡吧");
|
||||||
|
return statusResp;
|
||||||
}
|
}
|
||||||
VideoTaskStatusVO taskStatusByFaceId = goodsService.getTaskStatusByFaceId(faceId);
|
VideoTaskStatusVO taskStatusByFaceId = goodsService.getTaskStatusByFaceId(faceId);
|
||||||
if (Integer.valueOf(1).equals(taskStatusByFaceId.getStatus())) {
|
if (Integer.valueOf(1).equals(taskStatusByFaceId.getStatus())) {
|
||||||
@@ -898,11 +924,11 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
statusResp.setStep3Status(true);
|
statusResp.setStep3Status(true);
|
||||||
statusResp.setDisplayText("帧途AI已为您渲染"+ taskStatusByFaceId.getCount() +"个vlog");
|
statusResp.setDisplayText("帧途AI已为您渲染"+ taskStatusByFaceId.getCount() +"个vlog");
|
||||||
} else {
|
} else {
|
||||||
statusResp.setStep3Status(false);
|
statusResp.setStep3Status(true);
|
||||||
statusResp.setDisplayText("帧途AI将会为您渲染vlog,请稍候");
|
statusResp.setDisplayText("帧途AI将会为您渲染vlog,请稍候");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
statusResp.setStep3Status(false);
|
statusResp.setStep3Status(true);
|
||||||
statusResp.setDisplayText("帧途AI正在为您渲染vlog,请稍候");
|
statusResp.setDisplayText("帧途AI正在为您渲染vlog,请稍候");
|
||||||
}
|
}
|
||||||
return statusResp;
|
return statusResp;
|
||||||
@@ -1089,7 +1115,8 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
face.getMemberId(), sampleListIds, false);
|
face.getMemberId(), sampleListIds, false);
|
||||||
|
|
||||||
sourceMapper.addRelations(memberSourceEntityList);
|
sourceMapper.addRelations(memberSourceEntityList);
|
||||||
taskTaskService.autoCreateTaskByFaceId(face.getId());
|
memberRelationRepository.clearSCacheByFace(faceId);
|
||||||
|
taskTaskService.autoCreateTaskByFaceId(faceId);
|
||||||
|
|
||||||
log.info("自定义人脸匹配完成:faceId={}, 匹配样本数={}, 关联源文件数={}, 免费数={}",
|
log.info("自定义人脸匹配完成:faceId={}, 匹配样本数={}, 关联源文件数={}, 免费数={}",
|
||||||
faceId, sampleListIds.size(), memberSourceEntityList.size(), freeSourceIds.size());
|
faceId, sampleListIds.size(), memberSourceEntityList.size(), freeSourceIds.size());
|
||||||
|
@@ -51,6 +51,7 @@ import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
|||||||
import com.ycwl.basic.pay.adapter.IPayAdapter;
|
import com.ycwl.basic.pay.adapter.IPayAdapter;
|
||||||
import com.ycwl.basic.pay.entity.PayResponse;
|
import com.ycwl.basic.pay.entity.PayResponse;
|
||||||
import com.ycwl.basic.repository.FaceRepository;
|
import com.ycwl.basic.repository.FaceRepository;
|
||||||
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
import com.ycwl.basic.repository.PriceRepository;
|
import com.ycwl.basic.repository.PriceRepository;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
@@ -135,6 +136,8 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
private IVoucherService iVoucherService;
|
private IVoucherService iVoucherService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICouponService iCouponService;
|
private ICouponService iCouponService;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<OrderRespVO>> pageQuery(OrderReqQuery query) {
|
public ApiResponse<PageInfo<OrderRespVO>> pageQuery(OrderReqQuery query) {
|
||||||
@@ -760,7 +763,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
return ApiResponse.fail("您无权购买此内容!");
|
return ApiResponse.fail("您无权购买此内容!");
|
||||||
}
|
}
|
||||||
// 找下有没有照片
|
// 找下有没有照片
|
||||||
List<MemberSourceEntity> photoList = sourceMapper.listByFaceRelation(userId, batchOrderReqVO.getFaceId(), 2);
|
List<MemberSourceEntity> photoList = memberRelationRepository.listSourceByFaceRelation(batchOrderReqVO.getFaceId(), 2);
|
||||||
if (photoList.isEmpty()) {
|
if (photoList.isEmpty()) {
|
||||||
log.info("请先游玩后再来购买商品!");
|
log.info("请先游玩后再来购买商品!");
|
||||||
return ApiResponse.fail("请先游玩后再来购买商品!");
|
return ApiResponse.fail("请先游玩后再来购买商品!");
|
||||||
@@ -843,7 +846,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
Long goodsId = switch (productItem.getProductType()) {
|
Long goodsId = switch (productItem.getProductType()) {
|
||||||
case PHOTO_SET, RECORDING_SET -> face.getId();
|
case PHOTO_SET, RECORDING_SET -> face.getId();
|
||||||
case VLOG_VIDEO -> {
|
case VLOG_VIDEO -> {
|
||||||
List<MemberVideoEntity> videos = videoRepository.getVideoByFaceAndTemplateId(face.getMemberId(), face.getId(), productItem.getProductId());
|
List<MemberVideoEntity> videos = memberRelationRepository.listRelationByFaceAndTemplate(face.getId(), Long.valueOf(productItem.getProductId()));
|
||||||
yield videos.getFirst().getVideoId();
|
yield videos.getFirst().getVideoId();
|
||||||
}
|
}
|
||||||
default -> 0L;
|
default -> 0L;
|
||||||
|
@@ -3,6 +3,7 @@ package com.ycwl.basic.service.task.impl;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.ycwl.basic.integration.common.manager.DeviceConfigManager;
|
import com.ycwl.basic.integration.common.manager.DeviceConfigManager;
|
||||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||||
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
import com.ycwl.basic.utils.JacksonUtil;
|
import com.ycwl.basic.utils.JacksonUtil;
|
||||||
import com.aliyuncs.facebody.model.v20191230.SearchFaceRequest;
|
import com.aliyuncs.facebody.model.v20191230.SearchFaceRequest;
|
||||||
import com.ycwl.basic.biz.OrderBiz;
|
import com.ycwl.basic.biz.OrderBiz;
|
||||||
@@ -81,6 +82,8 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
private ScenicService scenicService;
|
private ScenicService scenicService;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
private IAcsClient getClient() {
|
private IAcsClient getClient() {
|
||||||
AliFaceBodyAdapter use = (AliFaceBodyAdapter) FaceBodyFactory.use();
|
AliFaceBodyAdapter use = (AliFaceBodyAdapter) FaceBodyFactory.use();
|
||||||
@@ -151,6 +154,7 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceMapper.addRelations(memberSourceEntityList);
|
sourceMapper.addRelations(memberSourceEntityList);
|
||||||
|
memberRelationRepository.clearSCacheByFace(faceId);
|
||||||
VideoPieceGetter.Task task = new VideoPieceGetter.Task();
|
VideoPieceGetter.Task task = new VideoPieceGetter.Task();
|
||||||
task.faceId = faceEntity.getId();
|
task.faceId = faceEntity.getId();
|
||||||
task.faceSampleIds = sampleListIds;
|
task.faceSampleIds = sampleListIds;
|
||||||
|
@@ -5,22 +5,20 @@ import cn.hutool.crypto.digest.MD5;
|
|||||||
import com.ycwl.basic.integration.common.manager.DeviceConfigManager;
|
import com.ycwl.basic.integration.common.manager.DeviceConfigManager;
|
||||||
import com.ycwl.basic.integration.common.manager.RenderWorkerConfigManager;
|
import com.ycwl.basic.integration.common.manager.RenderWorkerConfigManager;
|
||||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||||
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
import com.ycwl.basic.repository.SourceRepository;
|
import com.ycwl.basic.repository.SourceRepository;
|
||||||
import com.ycwl.basic.utils.JacksonUtil;
|
import com.ycwl.basic.utils.JacksonUtil;
|
||||||
import com.ycwl.basic.biz.OrderBiz;
|
import com.ycwl.basic.biz.OrderBiz;
|
||||||
import com.ycwl.basic.biz.TaskStatusBiz;
|
import com.ycwl.basic.biz.TaskStatusBiz;
|
||||||
import com.ycwl.basic.biz.TemplateBiz;
|
import com.ycwl.basic.biz.TemplateBiz;
|
||||||
import com.ycwl.basic.constant.StorageConstant;
|
import com.ycwl.basic.constant.StorageConstant;
|
||||||
import com.ycwl.basic.constant.TaskConstant;
|
|
||||||
import com.ycwl.basic.mapper.FaceMapper;
|
import com.ycwl.basic.mapper.FaceMapper;
|
||||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||||
import com.ycwl.basic.mapper.MemberMapper;
|
import com.ycwl.basic.mapper.MemberMapper;
|
||||||
import com.ycwl.basic.mapper.SourceMapper;
|
import com.ycwl.basic.mapper.SourceMapper;
|
||||||
import com.ycwl.basic.mapper.TaskMapper;
|
import com.ycwl.basic.mapper.TaskMapper;
|
||||||
import com.ycwl.basic.mapper.TemplateMapper;
|
|
||||||
import com.ycwl.basic.mapper.VideoMapper;
|
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.pc.device.entity.DeviceEntity;
|
|
||||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||||
@@ -69,8 +67,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -129,6 +125,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
private RedisTemplate<String, String> redisTemplate;
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SourceRepository sourceRepository;
|
private SourceRepository sourceRepository;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
||||||
String accessKey = req.getAccessKey();
|
String accessKey = req.getAccessKey();
|
||||||
@@ -423,6 +421,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
videoMapper.addRelation(memberVideoEntity);
|
videoMapper.addRelation(memberVideoEntity);
|
||||||
|
memberRelationRepository.clearVCacheByFace(faceId);
|
||||||
|
|
||||||
// 只有在非强制创建时才更新切割任务状态
|
// 只有在非强制创建时才更新切割任务状态
|
||||||
if (!forceCreate) {
|
if (!forceCreate) {
|
||||||
@@ -511,6 +510,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
videoMapper.updateRelationWhenTaskSuccess(taskId, video.getId(), isBuy);
|
videoMapper.updateRelationWhenTaskSuccess(taskId, video.getId(), isBuy);
|
||||||
|
memberRelationRepository.clearVCacheByFace(task.getFaceId());
|
||||||
Thread.ofVirtual().start(() -> sendVideoGeneratedServiceNotification(taskId));
|
Thread.ofVirtual().start(() -> sendVideoGeneratedServiceNotification(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +618,12 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String title = configTitle.replace("【景区】", scenic.getName());
|
String title = configTitle.replace("【景区】", scenic.getName());
|
||||||
String page = "pages/videoSynthesis/index?type=1&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
String page;
|
||||||
|
if (configManager.getBoolean("grouping_enable", false)) {
|
||||||
|
page = "pages/travelVideoCenter/index?type=1&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
} else {
|
||||||
|
page = "pages/videoSynthesis/index?type=1&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 视频名称 {{thing1.DATA}}
|
* 视频名称 {{thing1.DATA}}
|
||||||
* 生成时间 {{time4.DATA}}
|
* 生成时间 {{time4.DATA}}
|
||||||
|
@@ -76,7 +76,12 @@ public class DownloadNotificationTasker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String title = configTitle.replace("【景区】", scenic.getName());
|
String title = configTitle.replace("【景区】", scenic.getName());
|
||||||
String page = "pages/videoSynthesis/index?type=2&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
String page;
|
||||||
|
if (configManager.getBoolean("grouping_enable", false)) {
|
||||||
|
page = "pages/travelVideoCenter/index?type=2&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
} else {
|
||||||
|
page = "pages/videoSynthesis/index?type=2&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 景区 {{thing1.DATA}}
|
* 景区 {{thing1.DATA}}
|
||||||
* 备注 {{thing3.DATA}}
|
* 备注 {{thing3.DATA}}
|
||||||
@@ -131,7 +136,12 @@ public class DownloadNotificationTasker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String title = configTitle.replace("【景区】", scenic.getName());
|
String title = configTitle.replace("【景区】", scenic.getName());
|
||||||
String page = "pages/videoSynthesis/index?type=3&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
String page;
|
||||||
|
if (configManager.getBoolean("grouping_enable", false)) {
|
||||||
|
page = "pages/travelVideoCenter/index?type=3&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
} else {
|
||||||
|
page = "pages/videoSynthesis/index?type=3&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 影像名称 {{thing1.DATA}}
|
* 影像名称 {{thing1.DATA}}
|
||||||
* 过期时间 {{time2.DATA}}
|
* 过期时间 {{time2.DATA}}
|
||||||
@@ -211,7 +221,12 @@ public class DownloadNotificationTasker {
|
|||||||
|
|
||||||
log.info("发送模板消息");
|
log.info("发送模板消息");
|
||||||
String title = configTitle.replace("【景区】", scenic.getName());
|
String title = configTitle.replace("【景区】", scenic.getName());
|
||||||
String page = "pages/videoSynthesis/index?type=2&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
String page;
|
||||||
|
if (configManager.getBoolean("grouping_enable", false)) {
|
||||||
|
page = "pages/travelVideoCenter/index?type=2&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
} else {
|
||||||
|
page = "pages/videoSynthesis/index?type=2&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 景区 {{thing1.DATA}}
|
* 景区 {{thing1.DATA}}
|
||||||
* 备注 {{thing3.DATA}}
|
* 备注 {{thing3.DATA}}
|
||||||
|
@@ -18,10 +18,10 @@ import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
|||||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||||
import com.ycwl.basic.integration.device.service.DeviceIntegrationService;
|
import com.ycwl.basic.integration.device.service.DeviceIntegrationService;
|
||||||
import com.ycwl.basic.integration.device.dto.device.DeviceV2DTO;
|
import com.ycwl.basic.integration.device.dto.device.DeviceV2DTO;
|
||||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
|
||||||
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
|
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
|
||||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||||
import com.ycwl.basic.repository.FaceRepository;
|
import com.ycwl.basic.repository.FaceRepository;
|
||||||
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.storage.StorageFactory;
|
import com.ycwl.basic.storage.StorageFactory;
|
||||||
@@ -43,7 +43,6 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -81,6 +80,8 @@ public class VideoPieceGetter {
|
|||||||
private ScenicRepository scenicRepository;
|
private ScenicRepository scenicRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceIntegrationService deviceIntegrationService;
|
private DeviceIntegrationService deviceIntegrationService;
|
||||||
|
@Autowired
|
||||||
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Task {
|
public static class Task {
|
||||||
@@ -240,7 +241,7 @@ public class VideoPieceGetter {
|
|||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(face.getScenicId());
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(face.getScenicId());
|
||||||
if (scenicConfig != null) {
|
if (scenicConfig != null) {
|
||||||
// 免费送
|
// 免费送
|
||||||
List<MemberSourceEntity> sourceEntities = sourceMapper.listByFaceRelation(face.getScenicId(), face.getId(), 1);
|
List<MemberSourceEntity> sourceEntities = memberRelationRepository.listSourceByFaceRelation(face.getId(), 1);
|
||||||
if (sourceEntities.stream().noneMatch(item -> Integer.valueOf(1).equals(item.getIsFree()))) {
|
if (sourceEntities.stream().noneMatch(item -> Integer.valueOf(1).equals(item.getIsFree()))) {
|
||||||
List<Long> freeSourceRelationIds = new ArrayList<>();
|
List<Long> freeSourceRelationIds = new ArrayList<>();
|
||||||
if (scenicConfig.getVideoFreeNum() != null && scenicConfig.getVideoFreeNum() > 0) {
|
if (scenicConfig.getVideoFreeNum() != null && scenicConfig.getVideoFreeNum() > 0) {
|
||||||
@@ -305,6 +306,10 @@ public class VideoPieceGetter {
|
|||||||
log.warn("视频裁切失败");
|
log.warn("视频裁切失败");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (outFile.length() <= 1>>20) {
|
||||||
|
log.warn("视频裁切文件过小,文件大小: {}kB", outFile.length() >> 10);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
log.info("视频裁切成功");
|
log.info("视频裁切成功");
|
||||||
IStorageAdapter adapter = StorageFactory.use("assets");
|
IStorageAdapter adapter = StorageFactory.use("assets");
|
||||||
url = adapter.uploadFile("video/mp4", outFile, StorageConstant.VIDEO_PIECE_PATH, outFile.getName());
|
url = adapter.uploadFile("video/mp4", outFile, StorageConstant.VIDEO_PIECE_PATH, outFile.getName());
|
||||||
@@ -344,6 +349,7 @@ public class VideoPieceGetter {
|
|||||||
videoSource.setIsBuy(0);
|
videoSource.setIsBuy(0);
|
||||||
}
|
}
|
||||||
sourceMapper.addRelation(videoSource);
|
sourceMapper.addRelation(videoSource);
|
||||||
|
memberRelationRepository.clearSCacheByFace(task.faceId);
|
||||||
}
|
}
|
||||||
sourceMapper.add(sourceEntity);
|
sourceMapper.add(sourceEntity);
|
||||||
videoReUploader.addTask(sourceEntity.getId());
|
videoReUploader.addTask(sourceEntity.getId());
|
||||||
@@ -377,6 +383,7 @@ public class VideoPieceGetter {
|
|||||||
}
|
}
|
||||||
videoSource.setSourceId(source.getId());
|
videoSource.setSourceId(source.getId());
|
||||||
sourceMapper.addRelation(videoSource);
|
sourceMapper.addRelation(videoSource);
|
||||||
|
memberRelationRepository.clearSCacheByFace(task.faceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,9 @@ import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
|||||||
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.ScenicConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
|
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.service.pc.FaceService;
|
import com.ycwl.basic.service.pc.FaceService;
|
||||||
import com.ycwl.basic.service.task.impl.TaskTaskServiceImpl;
|
import com.ycwl.basic.service.task.impl.TaskTaskServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -41,6 +43,8 @@ public class VideoTaskGenerator {
|
|||||||
private ScenicRepository scenicRepository;
|
private ScenicRepository scenicRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaceService faceService;
|
private FaceService faceService;
|
||||||
|
@Autowired
|
||||||
|
private TemplateRepository templateRepository;
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 * * * *")
|
@Scheduled(cron = "0 0 * * * *")
|
||||||
public void generateVideoTask() {
|
public void generateVideoTask() {
|
||||||
@@ -68,8 +72,8 @@ public class VideoTaskGenerator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 定时逻辑
|
// 定时逻辑
|
||||||
List<ContentPageVO> contentList = templateMapper.listFor(scenicId);
|
List<TemplateRespVO> templateList = templateRepository.getTemplateListByScenicId(scenicId);
|
||||||
if (contentList.isEmpty()) {
|
if (templateList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FaceReqQuery faceReqQuery = new FaceReqQuery();
|
FaceReqQuery faceReqQuery = new FaceReqQuery();
|
||||||
@@ -81,8 +85,8 @@ public class VideoTaskGenerator {
|
|||||||
faceService.matchFaceId(face.getId(), false);
|
faceService.matchFaceId(face.getId(), false);
|
||||||
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine())) {
|
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine())) {
|
||||||
// 全部生成
|
// 全部生成
|
||||||
contentList.forEach(content -> {
|
templateList.forEach(content -> {
|
||||||
Long templateId = content.getTemplateId();
|
Long templateId = content.getId();
|
||||||
boolean canAutoGenerate = templateBiz.determineTemplateCanAutoGenerate(templateId, face.getId(), false);
|
boolean canAutoGenerate = templateBiz.determineTemplateCanAutoGenerate(templateId, face.getId(), false);
|
||||||
if (canAutoGenerate) {
|
if (canAutoGenerate) {
|
||||||
log.info("task callback: 自动生成");
|
log.info("task callback: 自动生成");
|
||||||
@@ -92,7 +96,7 @@ public class VideoTaskGenerator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Long templateId = contentList.getFirst().getTemplateId();
|
Long templateId = templateList.getFirst().getId();
|
||||||
boolean canAutoGenerate = templateBiz.determineTemplateCanAutoGenerate(templateId, face.getId(), false);
|
boolean canAutoGenerate = templateBiz.determineTemplateCanAutoGenerate(templateId, face.getId(), false);
|
||||||
if (canAutoGenerate) {
|
if (canAutoGenerate) {
|
||||||
log.info("task callback: 自动生成");
|
log.info("task callback: 自动生成");
|
||||||
|
@@ -237,8 +237,7 @@
|
|||||||
<select id="listByFaceRelation" resultType="com.ycwl.basic.model.pc.source.entity.MemberSourceEntity">
|
<select id="listByFaceRelation" resultType="com.ycwl.basic.model.pc.source.entity.MemberSourceEntity">
|
||||||
select *
|
select *
|
||||||
from member_source ms
|
from member_source ms
|
||||||
where ms.member_id = #{memberId}
|
where ms.face_id = #{faceId}
|
||||||
and ms.face_id = #{faceId}
|
|
||||||
<if test="type!=null">and ms.type = #{type} </if>
|
<if test="type!=null">and ms.type = #{type} </if>
|
||||||
</select>
|
</select>
|
||||||
<update id="updateMemberIdByFaceId">
|
<update id="updateMemberIdByFaceId">
|
||||||
|
@@ -130,7 +130,7 @@
|
|||||||
<select id="listRelationByFace" resultType="com.ycwl.basic.model.pc.video.entity.MemberVideoEntity">
|
<select id="listRelationByFace" resultType="com.ycwl.basic.model.pc.video.entity.MemberVideoEntity">
|
||||||
select mv.*
|
select mv.*
|
||||||
from member_video mv
|
from member_video mv
|
||||||
where mv.member_id = #{userId} and mv.face_id = #{faceId}
|
where mv.face_id = #{faceId}
|
||||||
</select>
|
</select>
|
||||||
<select id="listRelationByTask" resultType="com.ycwl.basic.model.pc.video.entity.MemberVideoEntity">
|
<select id="listRelationByTask" resultType="com.ycwl.basic.model.pc.video.entity.MemberVideoEntity">
|
||||||
select mv.*
|
select mv.*
|
||||||
|
Reference in New Issue
Block a user