bug修复等
This commit is contained in:
parent
cfc870edb6
commit
a329100212
@ -41,8 +41,7 @@ public class AppGoodsController {
|
||||
@ApiOperation("源素材(原片/照片)商品列表")
|
||||
@PostMapping("/sourceGoodsList")
|
||||
public ApiResponse<List<GoodsDetailVO>> sourceGoodsList(@RequestBody GoodsReqQuery query) {
|
||||
query.setMemberId(Long.valueOf(BaseContextHandler.getUserId()));
|
||||
return goodsService.sourceGoodsList(query);
|
||||
return goodsService.sourceGoodsList(Long.valueOf(BaseContextHandler.getUserId()), query);
|
||||
}
|
||||
|
||||
@ApiOperation("成片vlog商品详情")
|
||||
|
@ -14,8 +14,6 @@ public class GoodsReqQuery {
|
||||
@ApiModelProperty("是否已购买 0否 1是")
|
||||
private Integer isBuy;
|
||||
private Long faceId;
|
||||
@ApiModelProperty(value = "用户id", hidden = true)
|
||||
private Long memberId;
|
||||
@ApiModelProperty("景区id")
|
||||
private Long scenicId;
|
||||
@ApiModelProperty("源素材商品类型 1视频 2图像")
|
||||
|
@ -7,6 +7,7 @@ import com.ycwl.basic.biz.OrderBiz;
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.mapper.*;
|
||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||
import com.ycwl.basic.model.mobile.goods.GoodsPageVO;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||
@ -36,6 +37,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
@ -132,25 +134,28 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
|
||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||
sourceReqQuery.setScenicId(faceRespVO.getScenicId());
|
||||
sourceReqQuery.setFaceId(faceId);
|
||||
sourceReqQuery.setMemberId(userId);
|
||||
//查询源素材
|
||||
List<SourceRespVO> sourceList = sourceMapper.listGroupByType(sourceReqQuery);
|
||||
List<SourceRespVO> sourceList = sourceMapper.queryByRelation(sourceReqQuery);
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(faceRespVO.getScenicId());
|
||||
sourceList.stream().filter(item -> {
|
||||
if (item.getType() == 1) {
|
||||
sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet()
|
||||
.stream()
|
||||
.filter(type -> {
|
||||
if (Integer.valueOf(1).equals(type)) {
|
||||
if (Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
||||
return false;
|
||||
}
|
||||
} else if (item.getType() == 2) {
|
||||
} else if (Integer.valueOf(2).equals(type)) {
|
||||
if (Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}).forEach(sourceRespVO -> {
|
||||
})
|
||||
.forEach(type -> {
|
||||
ContentPageVO contentPageVO = new ContentPageVO();
|
||||
Integer type = sourceRespVO.getType();
|
||||
if(type==1){
|
||||
if (type == 1) {
|
||||
contentPageVO.setName("原片集");
|
||||
} else {
|
||||
contentPageVO.setName("照片集");
|
||||
@ -163,6 +168,8 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
} else {
|
||||
contentPageVO.setIsBuy(0);
|
||||
}
|
||||
contentPageVO.setScenicId(faceRespVO.getScenicId());
|
||||
contentPageVO.setTemplateCoverUrl(sourceList.get(0).getUrl());
|
||||
contentPageVO.setContentType(2);
|
||||
contentList.add(contentPageVO);
|
||||
});
|
||||
|
@ -1,23 +1,21 @@
|
||||
package com.ycwl.basic.service.impl.mobile;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.mapper.*;
|
||||
import com.ycwl.basic.model.mobile.goods.*;
|
||||
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.task.resp.TaskRespVO;
|
||||
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.ScenicRepository;
|
||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||
import com.ycwl.basic.service.impl.pc.TaskServiceImpl;
|
||||
import com.ycwl.basic.service.impl.task.TaskTaskServiceImpl;
|
||||
import com.ycwl.basic.service.mobile.GoodsService;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
import com.ycwl.basic.service.task.TaskService;
|
||||
@ -31,15 +29,14 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/5 15:04
|
||||
*/@Service
|
||||
*/
|
||||
@Service
|
||||
public class GoodsServiceImpl implements GoodsService {
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
@ -55,14 +52,16 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
private VideoTaskRepository videoTaskRepository;
|
||||
@Autowired
|
||||
private TaskService taskTaskService;
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
|
||||
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
||||
//查询原素材
|
||||
List<GoodsPageVO> goodsList = new ArrayList<>();
|
||||
|
||||
VideoReqQuery videoReqQuery = new VideoReqQuery();
|
||||
videoReqQuery.setScenicId(query.getScenicId());
|
||||
videoReqQuery.setIsBuy(query.getIsBuy());
|
||||
videoReqQuery.setFaceId(query.getFaceId());
|
||||
videoReqQuery.setMemberId(Long.valueOf(BaseContextHandler.getUserId()));
|
||||
//查询成片vlog
|
||||
List<VideoRespVO> videoList = videoMapper.queryByRelation(videoReqQuery);
|
||||
@ -79,18 +78,31 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
goodsList.add(goodsPageVO);
|
||||
});
|
||||
|
||||
|
||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||
sourceReqQuery.setScenicId(query.getScenicId());
|
||||
sourceReqQuery.setIsBuy(query.getIsBuy());
|
||||
sourceReqQuery.setFaceId(query.getFaceId());
|
||||
sourceReqQuery.setMemberId(Long.valueOf(BaseContextHandler.getUserId()));
|
||||
//查询源素材
|
||||
List<SourceRespVO> sourceList = sourceMapper.queryByRelation(sourceReqQuery);
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(query.getScenicId());
|
||||
List<GoodsPageVO> sourceGoods = sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getFaceId)).entrySet().stream().flatMap((faceEntry) -> {
|
||||
Long faceId = faceEntry.getKey();
|
||||
List<SourceRespVO> goods = faceEntry.getValue();
|
||||
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().map(type -> {
|
||||
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().filter(type -> {
|
||||
if (Integer.valueOf(1).equals(type)) {
|
||||
if (Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
||||
return false;
|
||||
}
|
||||
} else if (Integer.valueOf(2).equals(type)) {
|
||||
if (Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}).map(type -> {
|
||||
GoodsPageVO goodsPageVO = new GoodsPageVO();
|
||||
goodsPageVO.setTemplateCoverUrl(goods.get(0).getUrl());
|
||||
goodsPageVO.setFaceId(faceId);
|
||||
if (type == 1) {
|
||||
goodsPageVO.setGoodsName("原片集");
|
||||
@ -114,24 +126,24 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<List<GoodsDetailVO>> sourceGoodsList(GoodsReqQuery query) {
|
||||
public ApiResponse<List<GoodsDetailVO>> sourceGoodsList(Long userId, GoodsReqQuery query) {
|
||||
Integer sourceType = query.getSourceType();
|
||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||
sourceReqQuery.setScenicId(query.getScenicId());
|
||||
sourceReqQuery.setIsBuy(query.getIsBuy());
|
||||
sourceReqQuery.setMemberId(query.getMemberId());
|
||||
sourceReqQuery.setMemberId(userId);
|
||||
sourceReqQuery.setType(sourceType);
|
||||
sourceReqQuery.setFaceId(query.getFaceId());
|
||||
List<SourceRespVO> list = sourceMapper.listUser(sourceReqQuery);
|
||||
List<GoodsDetailVO> goodsDetailVOList = new ArrayList<>();
|
||||
|
||||
String goodsNamePrefix = "";
|
||||
if(sourceType==1){
|
||||
goodsNamePrefix="视频";
|
||||
}else if (sourceType==2){
|
||||
goodsNamePrefix="图片";
|
||||
}else {
|
||||
goodsNamePrefix="其他类型";
|
||||
if (sourceType == 1) {
|
||||
goodsNamePrefix = "视频";
|
||||
} else if (sourceType == 2) {
|
||||
goodsNamePrefix = "图片";
|
||||
} else {
|
||||
goodsNamePrefix = "其他类型";
|
||||
}
|
||||
//图片编号
|
||||
int i=1;
|
||||
@ -139,10 +151,10 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
|
||||
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
||||
String shootingTime = DateUtils.format(sourceRespVO.getCreateTime(), "yyyy.MM.dd HH:mm:ss");
|
||||
if(i<10){
|
||||
goodsDetailVO.setGoodsName(goodsNamePrefix +"0"+i+" "+shootingTime);
|
||||
}else {
|
||||
goodsDetailVO.setGoodsName(goodsNamePrefix +i+" "+shootingTime);
|
||||
if (i < 10) {
|
||||
goodsDetailVO.setGoodsName(goodsNamePrefix + "0" + i + " " + shootingTime);
|
||||
} else {
|
||||
goodsDetailVO.setGoodsName(goodsNamePrefix + i + " " + shootingTime);
|
||||
}
|
||||
goodsDetailVO.setScenicId(sourceRespVO.getScenicId());
|
||||
goodsDetailVO.setScenicName(sourceRespVO.getScenicName());
|
||||
@ -166,28 +178,28 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
public ApiResponse<BigDecimal> queryPrice(GoodsPriceQueryReq queryPriceData) {
|
||||
Integer goodsType = queryPriceData.getGoodsType();
|
||||
|
||||
if(goodsType==0){//成片vlog
|
||||
if (goodsType == 0) {//成片vlog
|
||||
//成片的价格就是成片所用template的价格
|
||||
Long videoId = queryPriceData.getGoodsId();
|
||||
VideoRespVO videoRespVO = videoMapper.getById(videoId);
|
||||
if(videoRespVO==null){
|
||||
if (videoRespVO == null) {
|
||||
return ApiResponse.fail("该vlog不存在或已失效");
|
||||
}
|
||||
BigDecimal templatePrice = videoRespVO.getTemplatePrice();
|
||||
if(templatePrice==null){
|
||||
if (templatePrice == null) {
|
||||
return ApiResponse.fail("该vlog使用的模板价格或状态异常,请联系管理员");
|
||||
}
|
||||
return ApiResponse.success(templatePrice);
|
||||
|
||||
}else if(goodsType==1 || goodsType == 2){//原素材
|
||||
} else if (goodsType == 1 || goodsType == 2) {//原素材
|
||||
//原素材的价格就是原素材对应景区定的价格
|
||||
Long scenicId = queryPriceData.getScenicId();
|
||||
ScenicRespVO scenicRespVO = scenicMapper.getById(scenicId);
|
||||
if(scenicRespVO==null){
|
||||
if (scenicRespVO == null) {
|
||||
return ApiResponse.fail("该景区不存在或状态异常,请联系管理员");
|
||||
}
|
||||
BigDecimal price = scenicRespVO.getPrice();
|
||||
if(price==null){
|
||||
if (price == null) {
|
||||
return ApiResponse.fail("该景区的原片价格未设定或状态异常,请联系管理员");
|
||||
}
|
||||
return ApiResponse.success(price);
|
||||
@ -199,7 +211,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
public ApiResponse<VideoGoodsDetailVO> videoGoodsDetail(Long userId, Long videoId) {
|
||||
VideoGoodsDetailVO goodsDetailVO = new VideoGoodsDetailVO();
|
||||
VideoRespVO videoRespVO = videoMapper.getById(videoId);
|
||||
if(videoRespVO==null){
|
||||
if (videoRespVO == null) {
|
||||
return ApiResponse.fail("该vlog不存在或已失效");
|
||||
}
|
||||
goodsDetailVO.setGoodsName(videoRespVO.getTemplateName());
|
||||
@ -223,8 +235,8 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
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)));
|
||||
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)));
|
||||
}
|
||||
TaskEntity task = videoTaskRepository.getTaskById(videoRespVO.getTaskId());
|
||||
JSONObject paramJson = JSON.parseObject(task.getTaskParams());
|
||||
|
@ -57,7 +57,7 @@ public class FaceServiceImpl implements FaceService {
|
||||
|
||||
@Value("${face.score}")
|
||||
private float faceScore;
|
||||
private final float strictScore = 0.90F;
|
||||
private final float strictScore = 0.75F;
|
||||
@Autowired
|
||||
private TaskService taskTaskService;
|
||||
@Autowired
|
||||
|
@ -21,10 +21,12 @@ public interface GoodsService {
|
||||
|
||||
/**
|
||||
* 查询源素材商品列表
|
||||
*
|
||||
* @param userId
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
ApiResponse<List<GoodsDetailVO>> sourceGoodsList(GoodsReqQuery query);
|
||||
ApiResponse<List<GoodsDetailVO>> sourceGoodsList(Long userId, GoodsReqQuery query);
|
||||
|
||||
/**
|
||||
* 查询订单应付价格
|
||||
|
@ -137,9 +137,11 @@
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
where
|
||||
ms.member_id = #{memberId}
|
||||
<if test="faceId!= null">and ms.face_id = #{faceId} </if>
|
||||
<if test="type!=null">and ms.type = #{type} </if>
|
||||
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
|
||||
<if test="isBuy!=null">and ms.is_buy = #{isBuy}</if>
|
||||
order by so.create_time desc
|
||||
</select>
|
||||
<select id="querySameVideo" resultType="com.ycwl.basic.model.pc.source.entity.SourceEntity">
|
||||
select *
|
||||
|
@ -99,11 +99,7 @@
|
||||
<if test="isBuy!=null">and mv.is_buy = #{isBuy}</if>
|
||||
<if test="startTime!= null">and v.create_time >= #{startTime} </if>
|
||||
<if test="endTime!= null">and v.create_time <= #{endTime} </if>
|
||||
<if test="faceId!= null">
|
||||
and mv.task_id in (
|
||||
select id from task where face_id = #{faceId}
|
||||
)
|
||||
</if>
|
||||
<if test="faceId!= null">and mv.face_id = #{faceId} </if>
|
||||
</where>
|
||||
order by v.create_time desc
|
||||
</select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user