You've already forked FrameTour-BE
Compare commits
7 Commits
0a57eeaeef
...
2a662ae86d
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a662ae86d | |||
| e805fdac9a | |||
| 0db411c2e4 | |||
| 27930b1dca | |||
| b3e2601758 | |||
| d9049b8a29 | |||
| 0f0601e5eb |
@@ -54,6 +54,7 @@ public class TemplateBiz {
|
||||
if (scanSource) {
|
||||
List<SourceEntity> sourceEntities = sourceMapper.listVideoByScenicFaceRelation(face.getScenicId(), faceId);
|
||||
if (sourceEntities == null || sourceEntities.isEmpty()) {
|
||||
log.info("faceId:{} has no source", faceId);
|
||||
return false;
|
||||
}
|
||||
count = sourceEntities.stream()
|
||||
@@ -65,6 +66,7 @@ public class TemplateBiz {
|
||||
} else {
|
||||
List<FaceSampleEntity> faceSampleList = faceRepository.getFaceSampleList(faceId);
|
||||
if (faceSampleList == null || faceSampleList.isEmpty()) {
|
||||
log.info("faceId:{} has no faceSample", faceId);
|
||||
return false;
|
||||
}
|
||||
count = faceSampleList.stream()
|
||||
|
||||
@@ -62,8 +62,8 @@ public class AppPrinterController {
|
||||
String[] split = file.getOriginalFilename().split("\\.");
|
||||
String ext = split[split.length - 1];
|
||||
String url = StorageFactory.use().uploadFile(file, "printer", UUID.randomUUID() + "." + ext);
|
||||
printerService.addUserPhoto(JwtTokenUtil.getWorker().getUserId(), scenicId, url);
|
||||
return ApiResponse.success(url);
|
||||
Integer id = printerService.addUserPhoto(JwtTokenUtil.getWorker().getUserId(), scenicId, url);
|
||||
return ApiResponse.success(id);
|
||||
}
|
||||
@PostMapping("/uploadTo/{scenicId}/cropped/{id}")
|
||||
public ApiResponse<?> uploadReplace(@PathVariable("scenicId") Long scenicId, @PathVariable("id") Long id, @RequestParam(value = "file") MultipartFile file) throws IOException {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.mapper.PrintTaskMapper;
|
||||
import com.ycwl.basic.model.pc.printer.entity.PrintTaskEntity;
|
||||
import com.ycwl.basic.model.pc.printer.entity.PrinterEntity;
|
||||
import com.ycwl.basic.model.pc.printer.req.PrintTaskReqQuery;
|
||||
import com.ycwl.basic.service.printer.PrinterService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -20,6 +25,9 @@ public class PrinterController {
|
||||
@Autowired
|
||||
private PrinterService printerService;
|
||||
|
||||
@Autowired
|
||||
private PrintTaskMapper printTaskMapper;
|
||||
|
||||
// 查询列表
|
||||
@PostMapping("/list")
|
||||
public ApiResponse<List<PrinterEntity>> list(@RequestBody PrinterEntity condition) {
|
||||
@@ -49,4 +57,20 @@ public class PrinterController {
|
||||
public ApiResponse<Integer> delete(@PathVariable("id") Integer id) {
|
||||
return printerService.delete(id);
|
||||
}
|
||||
|
||||
// 分页查询打印任务
|
||||
@PostMapping("/task/page")
|
||||
public ApiResponse<PageInfo<PrintTaskEntity>> taskPage(@RequestBody PrintTaskReqQuery req) {
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
||||
List<PrintTaskEntity> list = printTaskMapper.queryByCondition(req.getPrinterId(), req.getStatus());
|
||||
PageInfo<PrintTaskEntity> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
|
||||
// 重新打印(将状态设置为0-未开始)
|
||||
@PostMapping("/task/reprint/{id}")
|
||||
public ApiResponse<Integer> reprint(@PathVariable("id") Integer id) {
|
||||
int result = printTaskMapper.updateStatus(id, 0);
|
||||
return ApiResponse.success(result);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,15 @@ package com.ycwl.basic.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ycwl.basic.model.pc.printer.entity.PrintTaskEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PrintTaskMapper extends BaseMapper<PrintTaskEntity> {
|
||||
int insertTask(PrintTaskEntity entity);
|
||||
|
||||
List<PrintTaskEntity> queryByCondition(@Param("printerId") Integer printerId, @Param("status") Integer status);
|
||||
|
||||
int updateStatus(@Param("id") Integer id, @Param("status") Integer status);
|
||||
}
|
||||
|
||||
@@ -55,4 +55,6 @@ public interface PrinterMapper {
|
||||
void updateUserPhotoListToPrinter(Long memberId, Long scenicId, Integer printerId);
|
||||
|
||||
List<MemberPrintResp> listRelationByOrderId(Long orderId);
|
||||
|
||||
PrintTaskResp queryTaskByMpId(Integer id);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ public class GoodsDetailVO {
|
||||
private Integer isFree;
|
||||
private Integer parts;
|
||||
private Integer sort;
|
||||
|
||||
private String printerName;
|
||||
private String printerPaper;
|
||||
|
||||
@JsonProperty("sourceType")
|
||||
public Integer getSourceType() {
|
||||
return goodsType;
|
||||
|
||||
@@ -45,4 +45,5 @@ public class OrderItemVO {
|
||||
private Date createTime;
|
||||
private Date shootingTime;
|
||||
private List<String> coverList;
|
||||
private String printerPaper;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public class PrintTaskEntity {
|
||||
|
||||
@TableField("height")
|
||||
private Integer height;
|
||||
private Integer mpId;
|
||||
private String paper;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@@ -24,4 +24,5 @@ public class PrinterEntity {
|
||||
private Date updateTime;
|
||||
private Integer preferW;
|
||||
private Integer preferH;
|
||||
private String preferPaper;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ycwl.basic.model.pc.printer.req;
|
||||
|
||||
import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PrintTaskReqQuery extends BaseQueryParameterReq {
|
||||
/**
|
||||
* 打印机ID
|
||||
*/
|
||||
private Integer printerId;
|
||||
|
||||
/**
|
||||
* 状态:0未开始,1已完成,2正在处理,3已失败
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class PrintTaskResp {
|
||||
private Integer printerId;
|
||||
private Integer status;
|
||||
private String printerName;
|
||||
private String paper;
|
||||
private String url;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.ycwl.basic.dto.MobileOrderRequest;
|
||||
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
|
||||
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
||||
import com.ycwl.basic.model.printer.resp.PrintTaskResp;
|
||||
import com.ycwl.basic.order.dto.PaymentParamsRequest;
|
||||
import com.ycwl.basic.order.dto.PaymentParamsResponse;
|
||||
import com.ycwl.basic.pricing.dto.CouponUseRequest;
|
||||
@@ -214,6 +215,39 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (item.getScenicId() != null) {
|
||||
item.setScenicName(scenicNames.get(item.getScenicId()));
|
||||
}
|
||||
|
||||
if (Integer.valueOf(-1).equals(item.getType())) {
|
||||
item.setGoodsName("一口价");
|
||||
item.setOrderType("一口价");
|
||||
} else if (Integer.valueOf(0).equals(item.getType())) {
|
||||
// 单品,查询
|
||||
OrderAppRespVO orderAppRespVO = orderMapper.appDetail(item.getId());
|
||||
List<OrderItemVO> orderItemList = orderAppRespVO.getOrderItemList();
|
||||
if (!orderItemList.isEmpty()) {
|
||||
if (Integer.valueOf(1).equals(orderItemList.getFirst().getGoodsType())) {
|
||||
item.setGoodsName("录像集");
|
||||
item.setOrderType("录像集");
|
||||
} else if (Integer.valueOf(2).equals(orderItemList.getFirst().getGoodsType())) {
|
||||
item.setGoodsName("照片集");
|
||||
item.setOrderType("照片集");
|
||||
} else if (Integer.valueOf(0).equals(orderItemList.getFirst().getGoodsType())) {
|
||||
item.setOrderType("旅行Vlog");
|
||||
item.setGoodsName(orderItemList.getFirst().getGoodsName());
|
||||
} else if (Integer.valueOf(4).equals(orderItemList.getFirst().getGoodsType())) {
|
||||
item.setGoodsName("一体机打印");
|
||||
item.setOrderType("一体机打印");
|
||||
} else {
|
||||
item.setGoodsName("未知商品");
|
||||
item.setOrderType("未知商品");
|
||||
}
|
||||
}
|
||||
} else if (Integer.valueOf(1).equals(item.getType())) {
|
||||
item.setGoodsName("多项商品");
|
||||
item.setOrderType("打包购买");
|
||||
} else if (Integer.valueOf(3).equals(item.getType())) {
|
||||
item.setGoodsName("打印照片");
|
||||
item.setOrderType("照片打印");
|
||||
}
|
||||
}
|
||||
PageInfo<OrderRespVO> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.success(pageInfo);
|
||||
@@ -237,6 +271,18 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (item.getScenicId() != null) {
|
||||
item.setScenicName(scenicNames.get(item.getScenicId()));
|
||||
}
|
||||
if (Integer.valueOf(3).equals(item.getType())) {
|
||||
item.setGoodsName("打印照片");
|
||||
if (item.getOrderItemList() != null && !item.getOrderItemList().isEmpty()) {
|
||||
item.getOrderItemList().getFirst().setGoodsName(item.getGoodsName());
|
||||
}
|
||||
}
|
||||
if (Integer.valueOf(4).equals(item.getType())) {
|
||||
item.setGoodsName("一体机打印");
|
||||
if (item.getOrderItemList() != null && !item.getOrderItemList().isEmpty()) {
|
||||
item.getOrderItemList().getFirst().setGoodsName(item.getGoodsName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ApiResponse.success(list);
|
||||
}
|
||||
@@ -306,6 +352,11 @@ public class OrderServiceImpl implements OrderService {
|
||||
goods.setScenicId(sourceEntity.getScenicId());
|
||||
goods.setTemplateCoverUrl(sourceEntity.getCropUrl());
|
||||
goods.setCreateTime(sourceEntity.getCreateTime());
|
||||
PrintTaskResp printTaskResp = printerMapper.queryTaskByMpId(sourceEntity.getId());
|
||||
if (printTaskResp != null) {
|
||||
goods.setPrinterName(printTaskResp.getPrinterName());
|
||||
goods.setPrinterPaper(printTaskResp.getPaper());
|
||||
}
|
||||
goodsList.add(goods);
|
||||
}
|
||||
}
|
||||
@@ -516,6 +567,16 @@ public class OrderServiceImpl implements OrderService {
|
||||
log.warn("获取景区名称失败: {}", orderAppRespVO.getScenicId(), e);
|
||||
}
|
||||
}
|
||||
if (orderAppRespVO != null && orderAppRespVO.getOrderItemList() != null && !orderAppRespVO.getOrderItemList().isEmpty()) {
|
||||
orderAppRespVO.getOrderItemList().forEach(orderItem -> {
|
||||
if (orderItem.getGoodsType() == 3) {
|
||||
PrintTaskResp printTaskResp = printerMapper.queryTaskByMpId(Math.toIntExact(orderItem.getGoodsId()));
|
||||
if (printTaskResp != null) {
|
||||
orderItem.setPrinterPaper(printTaskResp.getPaper());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return ApiResponse.success(orderAppRespVO);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface PrinterService {
|
||||
|
||||
boolean deleteUserPhoto(Long memberId, Long scenicId, Long relationId);
|
||||
|
||||
boolean addUserPhoto(Long memberId, Long scenicId, String url);
|
||||
Integer addUserPhoto(Long memberId, Long scenicId, String url);
|
||||
|
||||
MemberPrintResp getUserPhoto(Long memberId, Long scenicId, Long id);
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addUserPhoto(Long memberId, Long scenicId, String url) {
|
||||
public Integer addUserPhoto(Long memberId, Long scenicId, String url) {
|
||||
MemberPrintEntity entity = new MemberPrintEntity();
|
||||
entity.setMemberId(memberId);
|
||||
entity.setScenicId(scenicId);
|
||||
@@ -234,7 +234,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
entity.setCropUrl(url);
|
||||
entity.setStatus(0);
|
||||
printerMapper.addUserPhoto(entity);
|
||||
return true;
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -561,6 +561,8 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
|
||||
PrintTaskEntity task = new PrintTaskEntity();
|
||||
task.setPrinterId(printer.getId());
|
||||
task.setMpId(item.getId());
|
||||
task.setPaper(printer.getPreferPaper());
|
||||
task.setStatus(0);
|
||||
task.setUrl(printUrl);
|
||||
task.setHeight(printer.getPreferH());
|
||||
|
||||
@@ -2,7 +2,26 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.ycwl.basic.mapper.PrintTaskMapper">
|
||||
<insert id="insertTask">
|
||||
insert into print_task(printer_id, status, printer_name, url, width, height, create_time)
|
||||
values (#{printerId}, 0, #{printerName}, #{url}, #{width}, #{height}, NOW())
|
||||
insert into print_task(printer_id, mp_id, paper, status, printer_name, url, width, height, create_time)
|
||||
values (#{printerId}, #{mpId}, #{paper}, 0, #{printerName}, #{url}, #{width}, #{height}, NOW())
|
||||
</insert>
|
||||
|
||||
<select id="queryByCondition" resultType="com.ycwl.basic.model.pc.printer.entity.PrintTaskEntity">
|
||||
select id, printer_id, status, printer_name, url, width, height, mp_id, paper, create_time, update_time
|
||||
from print_task
|
||||
where 1=1
|
||||
<if test="printerId != null">
|
||||
and printer_id = #{printerId}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<update id="updateStatus">
|
||||
update print_task
|
||||
set status = #{status}, update_time = NOW()
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -68,6 +68,9 @@
|
||||
FROM member_print p
|
||||
WHERE p.id in (select order_item.goods_id from order_item where order_item.order_id = #{orderId} and order_item.goods_type = 3)
|
||||
</select>
|
||||
<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>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="add">
|
||||
@@ -80,6 +83,7 @@
|
||||
status,
|
||||
prefer_w,
|
||||
prefer_h,
|
||||
prefer_paper,
|
||||
create_time,
|
||||
update_time
|
||||
) VALUES (
|
||||
@@ -91,6 +95,7 @@
|
||||
#{status},
|
||||
#{preferW},
|
||||
#{preferH},
|
||||
#{preferPaper},
|
||||
NOW(),
|
||||
NOW()
|
||||
)
|
||||
@@ -145,6 +150,9 @@
|
||||
<if test="preferH != null">
|
||||
prefer_h = #{preferH},
|
||||
</if>
|
||||
<if test="preferPaper != null">
|
||||
prefer_paper = #{preferPaper},
|
||||
</if>
|
||||
update_time = NOW()
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
|
||||
Reference in New Issue
Block a user