You've already forked FrameTour-BE
feat(printer): 添加素材打印状态查询功能
- 在PrinterMapper中新增countFacePhoto方法用于统计用户打印素材数量 - 创建GoodsDetailPrintSceneVO类继承GoodsDetailVO并添加inList字段 - 修改GoodsReqQuery类添加scene字段用于标识打印场景 - 在GoodsServiceImpl中注入PrinterMapper并实现打印状态判断逻辑 - 在PrinterMapper.xml中添加对应的SQL查询语句 - 移除BaseContextHandler引入,优化代码依赖关系
This commit is contained in:
@@ -35,7 +35,7 @@ public interface PrinterMapper {
|
|||||||
PrintTaskEntity getTaskById(Integer id);
|
PrintTaskEntity getTaskById(Integer id);
|
||||||
|
|
||||||
List<PrinterResp> listByScenicId(@Param("scenicId") Long scenicId);
|
List<PrinterResp> listByScenicId(@Param("scenicId") Long scenicId);
|
||||||
|
int countFacePhoto(Long scenicId, Long faceId, Long sourceId);
|
||||||
List<MemberPrintResp> listRelation(@Param("memberId") Long memberId, @Param("scenicId") Long scenicId);
|
List<MemberPrintResp> listRelation(@Param("memberId") Long memberId, @Param("scenicId") Long scenicId);
|
||||||
List<MemberPrintResp> listRelationByFaceId(Long memberId, Long scenicId, Long faceId);
|
List<MemberPrintResp> listRelationByFaceId(Long memberId, Long scenicId, Long faceId);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ycwl.basic.model.mobile.goods;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class GoodsDetailPrintSceneVO extends GoodsDetailVO{
|
||||||
|
private Boolean inList;
|
||||||
|
}
|
||||||
@@ -17,4 +17,5 @@ public class GoodsReqQuery {
|
|||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
// 源素材商品类型 1视频 2图像
|
// 源素材商品类型 1视频 2图像
|
||||||
private Integer sourceType;
|
private Integer sourceType;
|
||||||
|
private String scene;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ 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;
|
||||||
import com.ycwl.basic.biz.TaskStatusBiz;
|
import com.ycwl.basic.biz.TaskStatusBiz;
|
||||||
import com.ycwl.basic.constant.BaseContextHandler;
|
|
||||||
import com.ycwl.basic.constant.StorageConstant;
|
import com.ycwl.basic.constant.StorageConstant;
|
||||||
import com.ycwl.basic.image.watermark.ImageWatermarkFactory;
|
import com.ycwl.basic.image.watermark.ImageWatermarkFactory;
|
||||||
import com.ycwl.basic.image.watermark.entity.WatermarkInfo;
|
import com.ycwl.basic.image.watermark.entity.WatermarkInfo;
|
||||||
@@ -56,6 +55,7 @@ import com.ycwl.basic.utils.ApiResponse;
|
|||||||
import com.ycwl.basic.utils.WxMpUtil;
|
import com.ycwl.basic.utils.WxMpUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.Strings;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -109,6 +109,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
private VideoUpdateConfig videoUpdateConfig;
|
private VideoUpdateConfig videoUpdateConfig;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberRelationRepository memberRelationRepository;
|
private MemberRelationRepository memberRelationRepository;
|
||||||
|
@Autowired
|
||||||
|
private PrinterMapper printerMapper;
|
||||||
|
|
||||||
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
||||||
Long scenicId = query.getScenicId();
|
Long scenicId = query.getScenicId();
|
||||||
@@ -218,7 +220,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
//图片编号
|
//图片编号
|
||||||
int i=1;
|
int i=1;
|
||||||
for (SourceRespVO sourceRespVO : list) {
|
for (SourceRespVO sourceRespVO : list) {
|
||||||
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
|
GoodsDetailPrintSceneVO goodsDetailVO = new GoodsDetailPrintSceneVO();
|
||||||
goodsDetailVO.setFaceId(sourceRespVO.getFaceId());
|
goodsDetailVO.setFaceId(sourceRespVO.getFaceId());
|
||||||
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
||||||
String shootingTime = DateUtil.format(sourceRespVO.getCreateTime(), "yyyy.MM.dd HH:mm:ss");
|
String shootingTime = DateUtil.format(sourceRespVO.getCreateTime(), "yyyy.MM.dd HH:mm:ss");
|
||||||
@@ -261,6 +263,10 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
goodsDetailVO.setUrl(sourceRespVO.getUrl());
|
goodsDetailVO.setUrl(sourceRespVO.getUrl());
|
||||||
goodsDetailVO.setCreateTime(sourceRespVO.getCreateTime());
|
goodsDetailVO.setCreateTime(sourceRespVO.getCreateTime());
|
||||||
goodsDetailVO.setIsFree(sourceRespVO.getIsFree());
|
goodsDetailVO.setIsFree(sourceRespVO.getIsFree());
|
||||||
|
if (Strings.CI.equals("print", query.getScene())) {
|
||||||
|
// 查询该素材是否在用户打印列表中
|
||||||
|
goodsDetailVO.setInList(printerMapper.countFacePhoto(sourceRespVO.getScenicId(), face.getId(), sourceRespVO.getId()) > 0);
|
||||||
|
}
|
||||||
goodsDetailVOList.add(goodsDetailVO);
|
goodsDetailVOList.add(goodsDetailVO);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,9 @@
|
|||||||
<select id="queryTaskByMpId" resultType="com.ycwl.basic.model.printer.resp.PrintTaskResp">
|
<select id="queryTaskByMpId" resultType="com.ycwl.basic.model.printer.resp.PrintTaskResp">
|
||||||
SELECT t.*, p.name as printerName FROM print_task t left join printer p on p.id = t.printer_id WHERE mp_id = #{orderId} order by t.create_time desc limit 1
|
SELECT t.*, p.name as printerName FROM print_task t left join printer p on p.id = t.printer_id WHERE mp_id = #{orderId} order by t.create_time desc limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="countFacePhoto" resultType="java.lang.Integer">
|
||||||
|
SELECT count(*) FROM member_print WHERE face_id = #{faceId} AND scenic_id = #{scenicId} AND source_id = #{sourceId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 新增 -->
|
<!-- 新增 -->
|
||||||
<insert id="add">
|
<insert id="add">
|
||||||
|
|||||||
Reference in New Issue
Block a user