feat[通用模块]:getViewUrlByName在文件存储中fileName,小程序二维码生成并上传逻辑完善,二维码管理后台功能实现以及其他逻辑优化

This commit is contained in:
2025-02-14 16:44:44 +08:00
parent 62c372c456
commit d02ec0f324
15 changed files with 362 additions and 70 deletions
@@ -178,8 +178,6 @@ public class OrderController {
LoginAppUser user = LoginUserContextHolder.getUser();
//@TODO 设置价格逻辑优化
order.setOrderAmount("1990");
order.setUserId(user.getId());
order.setTenantId(TenantContextHolder.getTenant());
@@ -191,6 +189,7 @@ public class OrderController {
if (qrCode != null){
order.setTourismId(qrCode.getTourismId());
order.setDeviceSn(qrCode.getDeviceSn());
order.setOrderAmount(qrCode.getPrice());
}
boolean result = orderService.createOrder(order);
if (result) {
@@ -119,7 +119,6 @@ public class OrderFileController {
if (!CollectionUtils.isEmpty(orderFiles)) {
for (OrderFile orderFile : orderFiles) {
String viewUrl = fileCenterService.getViewUrl(orderFile.getFileId());
System.out.println("viewUrl:"+ viewUrl);
orderFile.setViewUrl(viewUrl);
}
}else {
@@ -4,6 +4,7 @@ import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.feign.FileCenterService;
import com.central.order.model.QrCode;
import com.central.order.model.Tourism;
import com.central.order.service.IQrCodeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -47,20 +48,29 @@ public class QrCodeController {
})
@GetMapping
public PageResult list(@RequestParam Map<String, Object> params) {
return qrCodeService.findList(params);
PageResult<QrCode> pageResult = qrCodeService.findList(params);
if (pageResult.getResp_code() == 0){
for (QrCode qrCode: pageResult.getData()){
qrCode.setViewUrl(fileCenterService.getViewUrlByName(qrCode.getPath()));
}
}
return pageResult;
}
@Operation(summary = "生成景区二维码")
@PostMapping
public Result<QrCode> createQrCode(@RequestBody QrCode qrCode) throws Exception {
String codeId = UUID.randomUUID().toString();
public Result<QrCode> saveOrUpdateQrcode(@RequestBody QrCode qrCode) throws Exception {
String codeId = "";
if (qrCode.getId() == null){
codeId = UUID.randomUUID().toString();
}
Result<Map> result = fileCenterService.uploadQrCodeFile(codeId);
if (result.getResp_code() == 0){
qrCode.setCodeId(codeId);
qrCode.setTourismId(32L);
qrCode.setPath(result.getData().get("filePath").toString());
qrCode.setPath(result.getData().get("fileName").toString());
qrCode.setFileId(result.getData().get("fileId").toString());
boolean res = qrCodeService.save(qrCode);
boolean res = qrCodeService.saveOrUpdate(qrCode);
if (res) {
return Result.succeed(qrCode,"qrcode创建成功");
} else {
@@ -82,4 +92,9 @@ public class QrCodeController {
}
@DeleteMapping()
public Result delete(@RequestBody Tourism tourism) {
boolean result = qrCodeService.removeById(tourism);
return result ? Result.succeed(tourism, "操作成功") : Result.failed("操作失败");
}
}
@@ -28,9 +28,14 @@ public class QrCode extends SuperEntity {
private Long tourismId;
private String path;
private transient String viewUrl;
private String fileId;
private Integer status;
private String price;
private String deviceSn;
@TableField(fill = FieldFill.INSERT)