fix byhlc112 contract upload flow

This commit is contained in:
danaisuiyuan
2026-05-30 20:08:25 +08:00
parent 9eac385378
commit 718d8c5a3c
15 changed files with 162 additions and 77 deletions

View File

@@ -48,11 +48,11 @@ public class UploadFrontController {
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
})
public CommonResult<FileResultVo> image(MultipartFile multipart, @RequestParam(value = "model") String model,
public CommonResult<FileResultVo> image(@RequestParam("multipart") MultipartFile multipart,
@RequestParam(value = "model") String model,
@RequestParam(value = "pid") Integer pid) throws IOException {
return CommonResult.success(uploadService.imageUpload(multipart, model, pid));
}
}

View File

@@ -49,7 +49,7 @@ public class UserUploadController {
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
})
public CommonResult<FileResultVo> image(MultipartFile multipart,
public CommonResult<FileResultVo> image(@RequestParam("multipart") MultipartFile multipart,
@RequestParam(value = "model") String model,
@RequestParam(value = "pid") Integer pid) throws IOException {
@@ -66,9 +66,9 @@ public class UserUploadController {
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
})
public CommonResult<FileResultVo> imageOuter(MultipartFile multipart,
@RequestParam(value = "model") String model,
@RequestParam(value = "pid") Integer pid) throws IOException {
public CommonResult<FileResultVo> imageOuter(@RequestParam("multipart") MultipartFile multipart,
@RequestParam(value = "model") String model,
@RequestParam(value = "pid") Integer pid) throws IOException {
return CommonResult.success(uploadService.imageUpload(multipart, model, pid));
}
@@ -83,7 +83,7 @@ public class UserUploadController {
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
})
public CommonResult<FileResultVo> file(MultipartFile multipart,
public CommonResult<FileResultVo> file(@RequestParam("multipart") MultipartFile multipart,
@RequestParam(value = "model") String model,
@RequestParam(value = "pid") Integer pid) throws IOException {
return CommonResult.success(uploadService.fileUpload(multipart, model, pid));
@@ -92,4 +92,3 @@ public class UserUploadController {
}

View File

@@ -6,6 +6,7 @@ import com.zbkj.common.response.WaLoginResponse;
import com.zbkj.common.response.WaUserInfoResponse;
import com.zbkj.common.result.CommonResult;
import com.zbkj.common.token.FrontTokenComponent;
import com.zbkj.common.config.CrmebConfig;
import com.zbkj.common.vo.FileResultVo;
import com.zbkj.front.service.WaUserService;
import com.zbkj.service.dao.consignment.WaUsersDao;
@@ -14,7 +15,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
@@ -22,6 +22,9 @@ import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType0Font;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@@ -44,12 +47,13 @@ import java.util.Date;
* |
* +----------------------------------------------------------------------
*/
@Slf4j
@RestController
@RequestMapping("api/front/wa/user")
@Api(tags = "寄卖服务 -- 用户认证")
public class WaUserController {
private static final Logger log = LoggerFactory.getLogger(WaUserController.class);
@Autowired
private WaUserService waUserService;
@@ -62,6 +66,17 @@ public class WaUserController {
@Autowired
private WaUsersDao waUsersDao;
@Autowired
private CrmebConfig crmebConfig;
private String buildPublicFileUrl(String relativeUrl) {
String domain = StringUtils.defaultString(crmebConfig.getDomain(), "https://lehoo6.com").trim();
if (!StringUtils.startsWithAny(domain, "http://", "https://")) {
domain = "https://" + domain;
}
return StringUtils.removeEnd(domain, "/") + "/" + StringUtils.removeStart(relativeUrl, "/");
}
/**
* 处理PDF文件添加用户签名和签署日期
* @param signatureImage 用户签名图片
@@ -185,21 +200,27 @@ public class WaUserController {
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,新闻文章"),
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
})
public CommonResult<FileResultVo> image(MultipartFile multipart, @RequestParam(value = "model") String model,
@RequestParam(value = "pid") Integer pid) throws IOException {
public CommonResult<FileResultVo> image(@RequestParam("multipart") MultipartFile multipart,
@RequestParam(value = "model") String model,
@RequestParam(value = "pid", required = false) Integer pid,
@RequestParam(value = "userId", required = false) Integer userId) throws IOException {
// 如果是用户模型且上传的是图片则先处理PDF文件
if ("user".equals(model) && multipart != null) {
// 处理PDF文件添加用户签名和签署日期
FileResultVo pdfResultVo = processPdfWithSignature(multipart);
if (pdfResultVo != null) {
// 更新用户contract字段
if (pid != null) {
Integer targetUserId = userId != null ? userId : pid;
if (targetUserId == null) {
targetUserId = frontTokenComponent.getUserId();
}
if (targetUserId != null) {
WaUsers user = new WaUsers();
user.setId(pid);
user.setId(targetUserId);
// user.setContract("https://anyue.szxingming.com/"+pdfResultVo.getUrl());
// user.setContract("https://xiashengjun.com/"+pdfResultVo.getUrl());
// user.setContract("https://ccd.cichude.com/"+pdfResultVo.getUrl());
user.setContract("https://lehoo6.com/"+pdfResultVo.getUrl());
user.setContract(buildPublicFileUrl(pdfResultVo.getUrl()));
waUsersDao.updateById(user);
}
return CommonResult.success(pdfResultVo);

View File

@@ -1,5 +1,6 @@
crmeb:
imagePath: /www/wwwroot/lehoo6.com/ # 服务器图片路径配置 斜杠结尾
domain: lehoo6.com # 当前项目域名,合同/PDF 等公开地址拼接使用
asyncConfig: true #是否同步config表数据到redis
server: