修改bug

This commit is contained in:
longbinbin
2024-12-11 11:35:32 +08:00
parent 3c502c600c
commit 6ad8541b2e
11 changed files with 109 additions and 48 deletions

View File

@ -1,10 +1,7 @@
package com.ycwl.basic.controller.mobile;
import com.ycwl.basic.model.jwt.JwtInfo;
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
import com.ycwl.basic.model.mobile.goods.GoodsPriceQueryReq;
import com.ycwl.basic.model.mobile.goods.GoodsReqQuery;
import com.ycwl.basic.model.mobile.goods.GoodsPageVO;
import com.ycwl.basic.model.mobile.goods.*;
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
import com.ycwl.basic.service.mobile.GoodsService;
import com.ycwl.basic.utils.ApiResponse;
@ -44,7 +41,7 @@ public class AppGoodsController {
@ApiOperation("成片vlog商品详情")
@GetMapping("/getVideoGoodsDetail/{goodId}")
public ApiResponse<GoodsDetailVO> videoGoodsDetail(@PathVariable("goodId") Long goodsId) {
public ApiResponse<VideoGoodsDetailVO> videoGoodsDetail(@PathVariable("goodId") Long goodsId) {
return goodsService.videoGoodsDetail(goodsId);
}

View File

@ -6,6 +6,7 @@ import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -25,5 +26,5 @@ public interface DeviceMapper {
List<DeviceRespVO> listByScenicId(Long scenicId);
ScenicDeviceCountVO deviceCountByScenicId(Long scenicId, String userId);
ScenicDeviceCountVO deviceCountByScenicId(@Param("scenicId") Long scenicId,@Param("userId") Long userId);
}

View File

@ -39,4 +39,8 @@ public class GoodsDetailVO {
private String videoUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("价格")
private BigDecimal price;
@ApiModelProperty("是否已购买 0否 1是")
private Integer isBuy;
}

View File

@ -0,0 +1,48 @@
package com.ycwl.basic.model.mobile.goods;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Authorlongbinbin
* @Date2024/12/5 15:10
*/
@Data
@ApiModel("vlog商品详情")
public class VideoGoodsDetailVO {
@ApiModelProperty("商品名称")
private String goodsName;
@ApiModelProperty("景区id")
private Long scenicId;
@ApiModelProperty("景区名称")
private String scenicName;
@ApiModelProperty("经度")
private BigDecimal longitude;
@ApiModelProperty("纬度")
private BigDecimal latitude;
@ApiModelProperty("商品类型 1:成片视频 2:源素材")
private Integer goodsType;
@ApiModelProperty("源素材类型 1:视频 2:图片")
private Integer sourceType;
@ApiModelProperty("商品id goodsType=1时为videoIdgoodsType=2时为sourceId")
private Long goodsId;
@ApiModelProperty("模版封面图片")
private String templateCoverUrl;
@ApiModelProperty("图片文件存储地址")
private String url;
@ApiModelProperty("视频文件存储地址")
private String videoUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("价格")
private BigDecimal price;
@ApiModelProperty("是否已购买 0否 1是")
private Integer isBuy;
@ApiModelProperty("镜头数")
private Integer lensNum;
}

View File

@ -19,6 +19,8 @@ public class OrderItemVO {
*/
@ApiModelProperty("订单id")
private Long orderId;
@ApiModelProperty("商品类型1成片2源素材")
private Integer goodsType;
/**
* 商品IDgoods_type=1关联video.id=2关联source.id=3关联template.id
*/

View File

@ -72,8 +72,8 @@ public class AppScenicServiceImpl implements AppScenicService {
@Override
public ApiResponse<ScenicDeviceCountVO> deviceCountByScenicId(Long scenicId) {
String userId = BaseContextHandler.getUserId();
ScenicDeviceCountVO scenicDeviceCountVO = deviceMapper.deviceCountByScenicId(scenicId, userId);
JwtInfo worker = JwtTokenUtil.getWorker();
ScenicDeviceCountVO scenicDeviceCountVO = deviceMapper.deviceCountByScenicId(scenicId, worker.getUserId());
return ApiResponse.success(scenicDeviceCountVO);
}

View File

@ -1,14 +1,9 @@
package com.ycwl.basic.service.impl.mobile;
import com.ycwl.basic.mapper.pc.ScenicMapper;
import com.ycwl.basic.mapper.pc.SourceMapper;
import com.ycwl.basic.mapper.pc.TaskMapper;
import com.ycwl.basic.mapper.pc.VideoMapper;
import com.ycwl.basic.mapper.pc.*;
import com.ycwl.basic.model.jwt.JwtInfo;
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
import com.ycwl.basic.model.mobile.goods.GoodsPriceQueryReq;
import com.ycwl.basic.model.mobile.goods.GoodsReqQuery;
import com.ycwl.basic.model.mobile.goods.GoodsPageVO;
import com.ycwl.basic.model.mobile.goods.*;
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
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;
@ -39,6 +34,8 @@ public class GoodsServiceImpl implements GoodsService {
private ScenicMapper scenicMapper;
@Autowired
private TaskMapper taskMapper;
@Autowired
private DeviceMapper deviceMapper;
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
JwtInfo worker = JwtTokenUtil.getWorker();
@ -171,9 +168,12 @@ public class GoodsServiceImpl implements GoodsService {
}
@Override
public ApiResponse<GoodsDetailVO> videoGoodsDetail(Long goodsId) {
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
public ApiResponse<VideoGoodsDetailVO> videoGoodsDetail(Long goodsId) {
VideoGoodsDetailVO goodsDetailVO = new VideoGoodsDetailVO();
VideoRespVO videoRespVO = videoMapper.getById(goodsId);
if(videoRespVO==null){
return ApiResponse.fail("该vlog不存在或已失效");
}
goodsDetailVO.setGoodsName(videoRespVO.getTemplateName());
goodsDetailVO.setScenicId(videoRespVO.getScenicId());
goodsDetailVO.setScenicName(videoRespVO.getScenicName());
@ -184,6 +184,10 @@ public class GoodsServiceImpl implements GoodsService {
goodsDetailVO.setVideoUrl(videoRespVO.getVideoUrl());
goodsDetailVO.setTemplateCoverUrl(videoRespVO.getTemplateCoverUrl());
goodsDetailVO.setCreateTime(videoRespVO.getCreateTime());
goodsDetailVO.setPrice(videoRespVO.getTemplatePrice());
goodsDetailVO.setIsBuy(videoRespVO.getIsBuy());
ScenicDeviceCountVO scenicDeviceCountVO = deviceMapper.deviceCountByScenicId(videoRespVO.getScenicId(), -1L);
goodsDetailVO.setLensNum(scenicDeviceCountVO.getTotalDeviceCount());
return ApiResponse.success(goodsDetailVO);
}

View File

@ -264,6 +264,7 @@ public class OrderServiceImpl implements OrderService {
OrderItemVO itemVO = orderItemList.get(NumberConstant.ZERO);
appRespVO.setScenicName(itemVO.getScenicName());
appRespVO.setGoodsName(itemVO.getGoodsName());
appRespVO.setSourceType(itemVO.getSourceType());
}
}
PageInfo<OrderAppRespVO> pageInfo = new PageInfo<>(list);

View File

@ -1,9 +1,6 @@
package com.ycwl.basic.service.mobile;
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
import com.ycwl.basic.model.mobile.goods.GoodsPriceQueryReq;
import com.ycwl.basic.model.mobile.goods.GoodsReqQuery;
import com.ycwl.basic.model.mobile.goods.GoodsPageVO;
import com.ycwl.basic.model.mobile.goods.*;
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
import com.ycwl.basic.utils.ApiResponse;
@ -42,7 +39,7 @@ public interface GoodsService {
* @param goodsId 商品vlogid
* @return
*/
ApiResponse<GoodsDetailVO> videoGoodsDetail(Long goodsId);
ApiResponse<VideoGoodsDetailVO> videoGoodsDetail(Long goodsId);
/**
* 查询当前用户的成片合成任务状态

View File

@ -68,7 +68,7 @@
left join (
select count(1) shotDeviceCount,scenic_id
from source
where scenic_id = #{scenicId}
where scenic_id = #{scenicId} and member_id=#{userId}
group by device_id
)b on a.scenic_id = b.scenic_id
</select>

View File

@ -47,9 +47,9 @@
<result column="create_at" property="createAt"/>
<result column="update_at" property="updateAt"/>
<result column="cover_url" property="coverUrl"/>
<collection property="orderItemList" ofType="com.ycwl.basic.model.pc.order.resp.OrderItemVO">
<collection property="orderItemList" select="getOrderItemList" column="id" ofType="com.ycwl.basic.model.pc.order.resp.OrderItemVO">
<result column="oiId" property="id"/>
<result column="id" property="orderId"/>
<result column="orderId" property="orderId"/>
<result column="goods_id" property="goodsId"/>
<result column="scenicName" property="scenicName"/>
<result column="goodsName" property="goodsName"/>
@ -58,14 +58,29 @@
<result column="sourceType" property="sourceType"/>
</collection>
</resultMap>
<select id="getOrderItemList" parameterType="java.lang.Integer" resultType="com.ycwl.basic.model.pc.order.resp.OrderItemVO">
select oi.id oiId,oi.order_id orderId,oi.goods_id,
sc.name scenicName,t.cover_url coverUrl,
if(oi.goods_type='1',t.name,(select count(1) from order_item oi2 where oi2.order_id=oi.order_id)) as goodsName,
if(oi.goods_type='1',vd.video_url,sr.video_url) videoUrl,
if(oi.goods_type='2',sr.url,null) imgUrl,
if(oi.goods_type='2',sr.type,null) sourceType
from order_item oi
left join source sr on oi.goods_type='2' and oi.goods_id = sr.id
left join video vd on oi.goods_type='1' and oi.goods_id = vd.id
left join template t on oi.goods_type='1' and vd.template_id=t.id
left join scenic sc on (oi.goods_type='1' and vd.scenic_id=sc.id) or (oi.goods_type='2' and sr.scenic_id=sc.id)
where oi.order_id=#{id}
</select>
<insert id="add">
insert into `order`(id, member_id, openid,price, pay_price, remark, broker_id, promo_code,goods_type,scenic_id)
VALUES (#{id}, #{memberId}, #{openid},#{price}, #{payPrice}, #{remark}, #{brokerId}, #{promoCode},#{goodsType},#{scenicId})
</insert>
<insert id="addOrderItems">
insert into order_item(id, order_id, goods_id) VALUES
insert into order_item(id, order_id,goods_type, goods_id) VALUES
<foreach collection="orderItems" item="item" index="index" separator=",">
(#{item.id}, #{item.orderId}, #{item.goodsId})
(#{item.id}, #{item.orderId}, #{item.goodsType},#{item.goodsId})
</foreach>
</insert>
<update id="update">
@ -107,7 +122,7 @@
<select id="list" resultMap="PCBaseResultMap">
select o.id, o.member_id,m.nickname ,m.real_name , o.openid, 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, o.goods_type, oi.goods_id
from `order` o
from `order` AS o
left join member m on o.member_id = m.id
left join order_item oi on o.id = oi.order_id
left join source sr on o.goods_type='2' and oi.goods_id = sr.id
@ -207,7 +222,7 @@
and m.real_name like concat('%',#{memberRealName},'%')
</if>
<if test="price!= null ">
and price = #{price}
and o.price = #{price}
</if>
<if test="payPrice!= null ">
and pay_price = #{payPrice}
@ -257,20 +272,16 @@
</where>
</select>
<select id="appList" resultMap="AppBaseResultMap">
select o.id, o.member_id,m.nickname ,m.real_name , o.openid, 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, o.goods_type, oi.goods_id,
sc.name scenicName,t.cover_url coverUrl,
if(o.goods_type='1',t.name,(select count(1) from order_item oi2 where oi2.order_id=o.id)) as goodsName,
if(o.goods_type='1',vd.video_url,sr.video_url) videoUrl,
if(o.goods_type='2',sr.url,null) imgUrl,
if(o.goods_type='2',sr.type,null) sourceType
from `order` o
select DISTINCT o.id, o.member_id,m.nickname ,m.real_name , o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at, o.goods_type,
t.cover_url coverUrl
from `order` AS o
left join member m on o.member_id = m.id
left join order_item oi on o.id = oi.order_id
left join source sr on o.goods_type='2' and oi.goods_id = sr.id
left join video vd on o.goods_type='1' and oi.goods_id = vd.id
left join template t on o.goods_type='1' and vd.template_id=t.id
left join scenic sc on (o.goods_type='1' and vd.scenic_id=sc.id) or (o.goods_type='2' and sr.scenic_id=sc.id)
left join template t on o.goods_type='1' and vd.template_id=t.id
<where>
<if test="memberId!=null">
and o.member_id=#{memberId}
@ -290,14 +301,10 @@
order by o.create_at desc
</select>
<select id="appDetail" resultMap="AppBaseResultMap">
select o.id, o.member_id,m.nickname ,m.real_name , o.openid, 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, o.goods_type, oi.goods_id,
sc.name scenicName,
if(o.goods_type='1',t.name,(select count(1) from order_item oi2 where oi2.order_id=o.id)) as goodsName,
if(o.goods_type='1',vd.video_url,sr.video_url) videoUrl,
if(o.goods_type='2',sr.url,null) imgUrl,
if(o.goods_type='2',sr.type,null) sourceType
from `order` o
select distinct o.id, o.member_id,m.nickname ,m.real_name , o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at,o.goods_type
,t.cover_url coverUrl
from `order` AS o
left join member m on o.member_id = m.id
left join order_item oi on o.id = oi.order_id
left join source sr on o.goods_type='2' and oi.goods_id = sr.id