You've already forked FrameTour-BE
Compare commits
2 Commits
2a662ae86d
...
e887fd47f2
| Author | SHA1 | Date | |
|---|---|---|---|
| e887fd47f2 | |||
| f07d808f3d |
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -65,12 +66,15 @@ public class AppPrinterController {
|
||||
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 {
|
||||
@PostMapping(value = "/uploadTo/{scenicId}/cropped/{id}", consumes = "multipart/form-data")
|
||||
public ApiResponse<?> uploadReplace(@PathVariable("scenicId") Long scenicId,
|
||||
@PathVariable("id") Long id,
|
||||
@RequestPart(value = "crop", required = false) String crop,
|
||||
@RequestPart(value = "file") MultipartFile file) throws IOException {
|
||||
String[] split = file.getOriginalFilename().split("\\.");
|
||||
String ext = split[split.length - 1];
|
||||
String url = StorageFactory.use().uploadFile(file, "printer", UUID.randomUUID() + "." + ext);
|
||||
printerService.setPhotoCropped(JwtTokenUtil.getWorker().getUserId(), scenicId, id, url);
|
||||
printerService.setPhotoCropped(JwtTokenUtil.getWorker().getUserId(), scenicId, id, url, crop);
|
||||
return ApiResponse.success(url);
|
||||
}
|
||||
@PostMapping("/uploadTo/{scenicId}/formSource")
|
||||
|
||||
@@ -80,6 +80,7 @@ public class AppScenicController {
|
||||
resp.setShowPhotoWhenWaiting(scenicConfig.getBoolean("show_photo_when_waiting", false));
|
||||
resp.setImageSourcePackHint(scenicConfig.getString("image_source_pack_hint"));
|
||||
resp.setVideoSourcePackHint(scenicConfig.getString("video_source_pack_hint"));
|
||||
resp.setShareBeforeBuy(scenicConfig.getBoolean("share_before_buy"));
|
||||
return ApiResponse.success(resp);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface PrinterMapper {
|
||||
|
||||
MemberPrintResp getUserPhoto(Long memberId, Long scenicId, Long id);
|
||||
|
||||
int setPhotoCropped(Long memberId, Long scenicId, Long id, String url);
|
||||
int setPhotoCropped(Long memberId, Long scenicId, Long id, String url, String crop);
|
||||
|
||||
int setPhotoQuantity(Long memberId, Long scenicId, Long id, Integer quantity);
|
||||
|
||||
|
||||
@@ -17,4 +17,5 @@ public class MemberPrintResp {
|
||||
private Long orderId;
|
||||
private Integer status;
|
||||
private Date createTime;
|
||||
private String crop;
|
||||
}
|
||||
|
||||
@@ -55,4 +55,5 @@ public class ScenicConfigResp {
|
||||
* 视频素材包提示文案
|
||||
*/
|
||||
private String videoSourcePackHint = "";
|
||||
private Boolean shareBeforeBuy = true;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface PrinterService {
|
||||
|
||||
MemberPrintResp getUserPhoto(Long memberId, Long scenicId, Long id);
|
||||
|
||||
int setPhotoCropped(Long memberId, Long scenicId, Long id, String url);
|
||||
int setPhotoCropped(Long memberId, Long scenicId, Long id, String url, String crop);
|
||||
|
||||
int setPhotoQuantity(Long memberId, Long scenicId, Long id, Integer quantity);
|
||||
|
||||
|
||||
@@ -243,8 +243,8 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setPhotoCropped(Long memberId, Long scenicId, Long id, String url) {
|
||||
return printerMapper.setPhotoCropped(memberId, scenicId, id, url);
|
||||
public int setPhotoCropped(Long memberId, Long scenicId, Long id, String url, String crop) {
|
||||
return printerMapper.setPhotoCropped(memberId, scenicId, id, url, crop);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,23 +38,17 @@
|
||||
WHERE p.scenic_id = #{scenicId} and p.status = 1
|
||||
</select>
|
||||
<select id="listRelation" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id as scenicId, p.member_id as memberId,
|
||||
p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
SELECT p.*
|
||||
FROM member_print p
|
||||
WHERE p.member_id = #{memberId} AND p.scenic_id = #{scenicId} AND p.status = 0
|
||||
</select>
|
||||
<select id="getUserPhoto" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id, p.member_id as memberId,
|
||||
p.member_id, p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
SELECT p.*
|
||||
FROM member_print p
|
||||
WHERE p.id = #{id} AND p.member_id = #{memberId} AND p.scenic_id = #{scenicId}
|
||||
</select>
|
||||
<select id="getUserPhotoByIds" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id, p.member_id as memberId,
|
||||
p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
SELECT p.*
|
||||
FROM member_print p
|
||||
WHERE p.id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
@@ -62,9 +56,7 @@
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="listRelationByOrderId" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id as scenicId, p.member_id as memberId,
|
||||
p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
SELECT p.*
|
||||
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>
|
||||
@@ -166,7 +158,7 @@
|
||||
WHERE id = #{id} AND status = #{expectStatus}
|
||||
</update>
|
||||
<update id="setPhotoCropped">
|
||||
UPDATE member_print SET crop_url = #{url}, update_time = NOW(), print_url = null WHERE id = #{id}
|
||||
UPDATE member_print SET crop_url = #{url}, crop = #{crop}, update_time = NOW(), print_url = null WHERE id = #{id}
|
||||
</update>
|
||||
<update id="setPhotoQuantity">
|
||||
UPDATE member_print SET quantity = #{quantity}, update_time = NOW() WHERE id = #{id}
|
||||
|
||||
Reference in New Issue
Block a user