fix[任务模块]:排队信息返回价格优化,用户昵称头像更新逻辑,新增获取可查看文件接口等
This commit is contained in:
+3
-3
@@ -26,11 +26,11 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Tag(name = "token获取")
|
@Tag(name = "token获取")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/token")
|
@RequestMapping("/token")
|
||||||
public class ApiTokenController {
|
public class ApiTokenController {
|
||||||
|
|
||||||
// @Value("${jetlinks.server.url}")
|
@Value("${jetlinks.server.baseUrl}")
|
||||||
private String jetlinksServiceUrl = "http://119.45.169.13:8848/";
|
private String jetlinksServiceUrl;//= "http://119.45.169.13:8848/";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HeaderUtils headerUtils;
|
private HeaderUtils headerUtils;
|
||||||
|
|||||||
+12
-2
@@ -87,11 +87,21 @@ public class FileController {
|
|||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/files/{id}")
|
@GetMapping("/file/{id}")
|
||||||
public String getViewUrl(@PathVariable String id) {
|
public String getFileViewUrl(@PathVariable String id) {
|
||||||
return fileService.getViewUrl(id);
|
return fileService.getViewUrl(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/files/{id}")
|
||||||
|
public Result getViewUrl(@PathVariable String id) {
|
||||||
|
return Result.succeed(fileService.getViewUrl(id),"获取成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/file/path")
|
||||||
|
public Result getFileViewUrlByPath(@RequestParam String path) {
|
||||||
|
return Result.succeed(fileService.getViewUrlByPath(path),"获取成功");
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/files/path")
|
@GetMapping("/files/path")
|
||||||
public String getViewUrlByPath(@RequestParam String path) {
|
public String getViewUrlByPath(@RequestParam String path) {
|
||||||
return fileService.getViewUrlByPath(path);
|
return fileService.getViewUrlByPath(path);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: file-center
|
name: file-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 119.45.169.13
|
ip: 119.45.169.13
|
||||||
|
|||||||
+33
-14
@@ -32,6 +32,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -52,6 +53,9 @@ import java.util.Map;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class OrderController {
|
public class OrderController {
|
||||||
|
|
||||||
|
//设备执行任务默认时间长度3分钟
|
||||||
|
private static final long DEVICE_EXEC_TIME = 3;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOrderService orderService;
|
private IOrderService orderService;
|
||||||
|
|
||||||
@@ -239,30 +243,26 @@ public class OrderController {
|
|||||||
|
|
||||||
@Operation(summary = "获取排队总览信息")
|
@Operation(summary = "获取排队总览信息")
|
||||||
@GetMapping("/queue/info")
|
@GetMapping("/queue/info")
|
||||||
public Result<Map> getQueueInfo() {
|
public Result<Map> getQueueInfo(@RequestParam String codeId) {
|
||||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
//@TODO 价格配置问题优化
|
QrCode qrCode = qrCodeService.getByCodeId(codeId);
|
||||||
Double price = 19.90;
|
if (qrCode == null){
|
||||||
long execTime = 3; //一单执行时间默认3分钟
|
Assert.isNull(qrCode,"二维码CODEID不能为空");
|
||||||
|
}
|
||||||
Order order = orderService.getOrderyStatusAndUser(OrderStatus.PAID.getId(), user.getId());
|
Order order = orderService.getOrderyStatusAndUser(OrderStatus.PAID.getId(), user.getId());
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("price",appendPriceStr(qrCode.getPrice()));
|
||||||
//如果用户存在已支付订单,则查询当前排在第几
|
//如果用户存在已支付订单,则查询当前排在第几
|
||||||
if (order != null){
|
if (order != null){
|
||||||
Integer count = orderService.getOrderRankingByOrderId(order.getId());
|
Integer count = orderService.getOrderRankingByOrderId(order.getId());
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
map.put("count", count == 1 ? -1 : count-1 );
|
map.put("count", count == 1 ? -1 : count-1 );
|
||||||
map.put("time",Math.multiplyExact((count-1),execTime));
|
map.put("time",Math.multiplyExact((count-1),DEVICE_EXEC_TIME));
|
||||||
map.put("price",price);
|
|
||||||
return Result.succeed(map,"获取成功");
|
|
||||||
}else {
|
}else {
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
Long count = orderService.getOrderCountByStatus(OrderStatus.PAID.getId());
|
Long count = orderService.getOrderCountByStatus(OrderStatus.PAID.getId());
|
||||||
map.put("count", count == 0 ? -1 : count);
|
map.put("count", count == 0 ? -1 : count);
|
||||||
map.put("time",Math.multiplyExact(count,execTime));
|
map.put("time",Math.multiplyExact(count,DEVICE_EXEC_TIME));
|
||||||
map.put("price",price);
|
|
||||||
return Result.succeed(map,"获取成功");
|
|
||||||
}
|
}
|
||||||
|
return Result.succeed(map,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取用户是否存在排队订单")
|
@Operation(summary = "获取用户是否存在排队订单")
|
||||||
@@ -412,4 +412,23 @@ public class OrderController {
|
|||||||
}
|
}
|
||||||
return Result.failed("不满足执行条件");
|
return Result.failed("不满足执行条件");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将分的价格转换为元的str,方便前端显示
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String appendPriceStr(String str){
|
||||||
|
// 获取字符串长度
|
||||||
|
int length = str.length();
|
||||||
|
|
||||||
|
// 获取除了最后两位字符之外的部分
|
||||||
|
String prefix = str.substring(0, length - 2);
|
||||||
|
|
||||||
|
// 获取最后两位字符
|
||||||
|
String lastTwo = str.substring(length - 2);
|
||||||
|
|
||||||
|
// 在最后两位字符前添加小数点
|
||||||
|
return prefix + "." + lastTwo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -34,7 +34,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@Tag(name = "订单资源管理")
|
@Tag(name = "任务资源管理")
|
||||||
@RequestMapping("/files")
|
@RequestMapping("/files")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class OrderFileController {
|
public class OrderFileController {
|
||||||
@@ -118,7 +118,7 @@ public class OrderFileController {
|
|||||||
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(orderNo);
|
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(orderNo);
|
||||||
if (!CollectionUtils.isEmpty(orderFiles)) {
|
if (!CollectionUtils.isEmpty(orderFiles)) {
|
||||||
for (OrderFile orderFile : orderFiles) {
|
for (OrderFile orderFile : orderFiles) {
|
||||||
String viewUrl = fileCenterService.getViewUrl(orderFile.getFileId());
|
String viewUrl = fileCenterService.getFileViewUrl(orderFile.getFileId());
|
||||||
orderFile.setViewUrl(viewUrl);
|
orderFile.setViewUrl(viewUrl);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
@@ -133,7 +133,7 @@ public class OrderFileController {
|
|||||||
List<OrderFile> orderFiles = orderFileService.getOrderFileByUserId(userId);
|
List<OrderFile> orderFiles = orderFileService.getOrderFileByUserId(userId);
|
||||||
if (!CollectionUtils.isEmpty(orderFiles)) {
|
if (!CollectionUtils.isEmpty(orderFiles)) {
|
||||||
for (OrderFile orderFile : orderFiles) {
|
for (OrderFile orderFile : orderFiles) {
|
||||||
String viewUrl = fileCenterService.getViewUrl(orderFile.getFileId());
|
String viewUrl = fileCenterService.getFileViewUrl(orderFile.getFileId());
|
||||||
orderFile.setViewUrl(viewUrl);
|
orderFile.setViewUrl(viewUrl);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
|||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
1. 待支付
|
||||||
|
说明:用户成功提交订单,但尚未完成支付操作。此状态下,订单处于暂挂状态,可能因为用户还在选择支付方式、支付过程中出现问题等原因导致未支付。
|
||||||
|
操作:用户可选择支付、取消订单;商家可设置订单自动取消时间,超时未支付则订单自动取消。
|
||||||
|
|
||||||
|
2. 已取消
|
||||||
|
说明:订单在支付前被用户主动取消,或者因超过规定的支付时间而被系统自动取消。
|
||||||
|
操作:一般无后续操作,订单流程结束。
|
||||||
|
|
||||||
|
3. 支付成功
|
||||||
|
说明:用户成功完成支付,订单进入待处理排队(此时的状态也称作排队中)阶段。
|
||||||
|
操作:商家开始处理订单,如确认设备状态;系统可发送支付成功通知给用户。
|
||||||
|
|
||||||
|
4. 设备执行中
|
||||||
|
说明:商家正在对订单进行处理调度设备作业,包括但不限于确认订单信息、设备作业状态、设备素材上传等操作。
|
||||||
|
操作:商家完成处理后,可将订单状态更新为素材上传完成或素材上传中(对于多素材订单)。
|
||||||
|
|
||||||
|
5. 素材上传中
|
||||||
|
说明:商家已将照片上传。用户可以通过订单号查询订单对应素材。
|
||||||
|
操作:商家上传照片中,用户可查询上传进度。
|
||||||
|
|
||||||
|
6. 素材上传完成
|
||||||
|
说明:订单上传素材完成,处于用户下载状态。
|
||||||
|
操作:用户可查询素材信息并进行下载操作;若出现上传异常,商家需及时处理。
|
||||||
|
|
||||||
|
7. 用户已下载完成
|
||||||
|
说明:用户确认订单素材并下载完成且可能已完成评价,整个订单流程结束。
|
||||||
|
操作:无后续主要操作,可作为历史订单进行存档和统计分析。
|
||||||
|
|
||||||
|
8. 退款中
|
||||||
|
说明:用户发起退款申请,商家或平台正在处理该申请。
|
||||||
|
操作:商家需审核退款申请,根据情况决定是否同意退款;若同意,需进行退款操作。
|
||||||
|
|
||||||
|
9. 退款成功
|
||||||
|
说明:商家或平台已同意退款申请,并完成退款操作,款项已返还给用户。
|
||||||
|
操作:订单流程结束,可记录退款相关信息。
|
||||||
|
|
||||||
|
10. 退款失败
|
||||||
|
说明:退款申请因各种原因未能成功处理,如支付渠道问题、用户账户异常等。
|
||||||
|
操作:商家或平台需与用户沟通,解决问题后重新发起退款操作。
|
||||||
|
状态流转图示例
|
||||||
|
|
||||||
|
注意:(括号中的为订单状态),发起支付、用户支付中等为处理逻辑
|
||||||
|
(待支付) ── 发起支付 ── 用户支付中 ── 支付回调成功或者主动查询支付成功状态 ──> (支付成功) ── 排队中 ──> (设备执行中)── 飞机拍照 ── 飞机返航 ──> (素材上传中) ──> (素材上传完成) ── 用户下载 ──> (用户下载完成)
|
||||||
|
└─ 长时间未支付自动取消 ──> (已取消)
|
||||||
|
└─ 退款 ──> (退款中) ── 同意 ──> (退款成功)
|
||||||
|
└─ 拒绝并填写原因 ──> (退款失败)
|
||||||
@@ -9,7 +9,16 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum OrderStatus implements ZltEnum {
|
public enum OrderStatus implements ZltEnum {
|
||||||
UNPAID(0,"待支付"), PAID(1, "已支付排队中"), CANCELED(2, "已取消"),DOING(4,"正在服务中"),COMPLETE(3,"服务完成");
|
UNPAID(0,"待支付"),
|
||||||
|
PAID(1, "已支付排队中"),
|
||||||
|
CANCELED(2, "已取消"),
|
||||||
|
DOING(4,"正在服务中"),
|
||||||
|
COMPLETE(3,"用户下载完成"),
|
||||||
|
UPLOADING(5,"素材上传中"),
|
||||||
|
UPLOADED(6,"素材上传完成"),
|
||||||
|
REFUNDING(7,"退款中"),
|
||||||
|
REFUNDED(8,"已退款"),
|
||||||
|
REFUND_FAILED(9,"退款失败");
|
||||||
|
|
||||||
OrderStatus(Integer id, String content) {
|
OrderStatus(Integer id, String content) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|||||||
+2
-2
@@ -26,8 +26,8 @@ public interface FileCenterService {
|
|||||||
* @param id 文件ID
|
* @param id 文件ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/files/{id}")
|
@GetMapping("/file/{id}")
|
||||||
String getViewUrl(@PathVariable("id") String id);
|
String getFileViewUrl(@PathVariable("id") String id);
|
||||||
|
|
||||||
@GetMapping("/type/{id}")
|
@GetMapping("/type/{id}")
|
||||||
String getFileContentType(@PathVariable("id") String id);
|
String getFileContentType(@PathVariable("id") String id);
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ public class FileCenterServiceFallbackFactory implements FallbackFactory<FileCen
|
|||||||
return new FileCenterService() {
|
return new FileCenterService() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getViewUrl(String id) {
|
public String getFileViewUrl(String id) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: order-center
|
name: order-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 81.70.164.178
|
ip: 81.70.164.178
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
+6
@@ -144,6 +144,12 @@ public class SysUserController {
|
|||||||
appUserService.updateById(sysUser);
|
appUserService.updateById(sysUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/user")
|
||||||
|
@CachePut(value = "user", key = "#sysUser.username", unless="#result == null")
|
||||||
|
public Result updateSysUserInfo(@RequestBody SysUser sysUser) {
|
||||||
|
return Result.succeed(appUserService.updateById(sysUser),"更新成功");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理后台给用户分配角色
|
* 管理后台给用户分配角色
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: user-center
|
name: user-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 124.222.128.40
|
ip: 124.222.128.40
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
########################## bootstrap级别通用配置 ##########################
|
########################## bootstrap级别通用配置 ##########################
|
||||||
# 默认开发环境
|
# 默认开发环境
|
||||||
spring.profiles.active=dev
|
spring.profiles.active=prod
|
||||||
|
|
||||||
##### nacos(注册中心和配置中心)地址
|
##### nacos(注册中心和配置中心)地址
|
||||||
#spring.cloud.nacos.server-addr=47.94.136.130:8848
|
spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||||
spring.cloud.nacos.server-addr=127.0.0.1:8848
|
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||||
spring.cloud.nacos.username=nacos
|
spring.cloud.nacos.username=nacos
|
||||||
spring.cloud.nacos.password=nacos
|
spring.cloud.nacos.password=nacos
|
||||||
spring.cloud.nacos.config.file-extension=yml
|
spring.cloud.nacos.config.file-extension=yml
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ import {
|
|||||||
ModalForm,
|
ModalForm,
|
||||||
PageContainer,
|
PageContainer,
|
||||||
ProForm,
|
ProForm,
|
||||||
|
ProFormSelect,
|
||||||
ProFormText,
|
ProFormText,
|
||||||
ProTable,
|
ProTable,
|
||||||
QueryFilter,
|
QueryFilter,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { Typography, Popconfirm, Space, message, Image, Button } from 'antd';
|
import { Typography, Popconfirm, Space, message, Image, Button, Tag } from 'antd';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import UpdateForm from './components/UpdateForm';
|
import UpdateForm from './components/UpdateForm';
|
||||||
import Upload, { RcFile } from 'antd/lib/upload';
|
import Upload, { RcFile } from 'antd/lib/upload';
|
||||||
@@ -90,7 +91,18 @@ const handleImport = async (file: RcFile) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// 类型颜色映射
|
||||||
|
const typeColorMap = {
|
||||||
|
0: { color: 'yellow', text: '首页轮播' },
|
||||||
|
1: { color: 'orange', text: '活动' },
|
||||||
|
2: { color: 'red', text: '其他' },
|
||||||
|
};
|
||||||
|
|
||||||
|
// 类型渲染标签
|
||||||
|
const renderType = (type: {} | null | undefined) => {
|
||||||
|
const typeInfo = typeColorMap[type] || { color: 'gray', text: '未知状态' };
|
||||||
|
return <Tag color={typeInfo.color}>{typeInfo.text}</Tag>;
|
||||||
|
};
|
||||||
const TableList: React.FC = () => {
|
const TableList: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||||
@@ -119,6 +131,11 @@ const TableList: React.FC = () => {
|
|||||||
title: '跳转链接',
|
title: '跳转链接',
|
||||||
dataIndex: 'redirectUrl',
|
dataIndex: 'redirectUrl',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '类型',
|
||||||
|
dataIndex: 'type',
|
||||||
|
render: (type) => renderType(type),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '描述',
|
title: '描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
@@ -235,6 +252,18 @@ const TableList: React.FC = () => {
|
|||||||
label="链接url"
|
label="链接url"
|
||||||
placeholder="输入url"
|
placeholder="输入url"
|
||||||
/>
|
/>
|
||||||
|
<ProFormSelect
|
||||||
|
width="md"
|
||||||
|
name="type"
|
||||||
|
label="类型"
|
||||||
|
placeholder="请选择类型"
|
||||||
|
options={[
|
||||||
|
{ label: '首页轮播', value: 0 },
|
||||||
|
{ label: '活动', value: 1 },
|
||||||
|
{ label: '其他', value: 2 },
|
||||||
|
// 添加更多选项...
|
||||||
|
]}
|
||||||
|
/>
|
||||||
<ProFormText
|
<ProFormText
|
||||||
width="md"
|
width="md"
|
||||||
name="description"
|
name="description"
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ const TableList: React.FC = () => {
|
|||||||
dataIndex: 'fileType',
|
dataIndex: 'fileType',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '订单编号',
|
title: '任务编号',
|
||||||
dataIndex: 'orderNo',
|
dataIndex: 'orderNo',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ declare namespace ORDERS {
|
|||||||
id: number;
|
id: number;
|
||||||
imageUrl: string;
|
imageUrl: string;
|
||||||
redirectUrl: string;
|
redirectUrl: string;
|
||||||
type: string;
|
type: number;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
sortOrder: number;
|
sortOrder: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user