fix[订单模块]:排队,oss路径,自动任务,订单状态等逻辑
This commit is contained in:
+11
@@ -3,6 +3,7 @@ package com.central.device.controller;
|
|||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
||||||
import com.central.common.model.Result;
|
import com.central.common.model.Result;
|
||||||
|
import com.central.device.feign.OrderCenterService;
|
||||||
import com.central.device.message.ControlEnum;
|
import com.central.device.message.ControlEnum;
|
||||||
import com.central.device.message.ControlMessageConstant;
|
import com.central.device.message.ControlMessageConstant;
|
||||||
import com.central.device.util.MapUtil;
|
import com.central.device.util.MapUtil;
|
||||||
@@ -38,6 +39,9 @@ public class ApiDeviceController {
|
|||||||
private RequestUtils requestUtils;
|
private RequestUtils requestUtils;
|
||||||
|
|
||||||
private ControlMessageConstant controlMessageConstant = new ControlMessageConstant();
|
private ControlMessageConstant controlMessageConstant = new ControlMessageConstant();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderCenterService orderCenterService;
|
||||||
/**
|
/**
|
||||||
* 获取设备属性
|
* 获取设备属性
|
||||||
*/
|
*/
|
||||||
@@ -66,6 +70,13 @@ public class ApiDeviceController {
|
|||||||
JsonObject jsonObject;
|
JsonObject jsonObject;
|
||||||
String property = MapUtil.getStrValue(param, "control");
|
String property = MapUtil.getStrValue(param, "control");
|
||||||
String value = MapUtil.getStrValue(param, "order_no");
|
String value = MapUtil.getStrValue(param, "order_no");
|
||||||
|
if (value == null || "".equals(value)) {
|
||||||
|
return Result.succeed("暂未开放控制权限");
|
||||||
|
}
|
||||||
|
Result res = orderCenterService.getOrderExecStatus(value);
|
||||||
|
if (res.getResp_code() != null && res.getResp_code() == 0){
|
||||||
|
return Result.succeed("任务正在执行中");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (ControlEnum.contains(ControlEnum.valueOf(property.toUpperCase()))) {
|
if (ControlEnum.contains(ControlEnum.valueOf(property.toUpperCase()))) {
|
||||||
jsonObject = gson.fromJson(controlMessageConstant.CONTROL_MESSAGE_MAP.get(property), JsonObject.class);
|
jsonObject = gson.fromJson(controlMessageConstant.CONTROL_MESSAGE_MAP.get(property), JsonObject.class);
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.central.device.feign;
|
||||||
|
|
||||||
|
import com.central.common.constant.ServiceNameConstants;
|
||||||
|
import com.central.common.model.Result;
|
||||||
|
import com.central.device.feign.fallback.OrderCenterServiceFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* user-center模块远程调用
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @version 1.0
|
||||||
|
* @description user-center模块远程调用
|
||||||
|
* @create 2025/1/13
|
||||||
|
**/
|
||||||
|
@FeignClient(name = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderCenterServiceFallbackFactory.class, dismiss404 = true)
|
||||||
|
public interface OrderCenterService {
|
||||||
|
|
||||||
|
@GetMapping("/status/{orderNo}")
|
||||||
|
Result getOrderExecStatus(@PathVariable("orderNo") String orderNo);
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package com.central.device.feign.fallback;
|
||||||
|
|
||||||
|
import com.central.common.model.Result;
|
||||||
|
import com.central.device.feign.OrderCenterService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件中心调用失败回调
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @version 1.0
|
||||||
|
* @description 用户中心调用失败回调
|
||||||
|
* @create 2025/1/17 11:33
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class OrderCenterServiceFallbackFactory implements FallbackFactory<OrderCenterService> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderCenterService create(Throwable cause) {
|
||||||
|
return new OrderCenterService() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result getOrderExecStatus(String orderNo) {
|
||||||
|
return Result.failed(orderNo);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: device-center
|
name: device-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 81.70.164.178
|
ip: 81.70.164.178
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
+4
-4
@@ -6,6 +6,7 @@ import com.central.common.model.Result;
|
|||||||
import com.central.file.service.IFileService;
|
import com.central.file.service.IFileService;
|
||||||
import com.central.file.utils.HexToJpeg;
|
import com.central.file.utils.HexToJpeg;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
@@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -26,7 +26,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class FileController {
|
public class FileController {
|
||||||
@Resource
|
@Autowired
|
||||||
private IFileService fileService;
|
private IFileService fileService;
|
||||||
|
|
||||||
// @Value("tencent.accessTokenUrl")
|
// @Value("tencent.accessTokenUrl")
|
||||||
@@ -81,8 +81,8 @@ public class FileController {
|
|||||||
return fileService.getViewUrl(id);
|
return fileService.getViewUrl(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/files/name")
|
@PostMapping("/files/name")
|
||||||
public String getViewUrlByName(@RequestParam String name) {
|
public String getViewUrlByName(@RequestBody String name) {
|
||||||
return fileService.getViewUrlByName(name);
|
return fileService.getViewUrlByName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ import java.util.Map;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface FileMapper extends SuperMapper<FileInfo> {
|
public interface FileMapper extends SuperMapper<FileInfo> {
|
||||||
List<FileInfo> findList(Page<FileInfo> page, @Param("f") Map<String, Object> params);
|
List<FileInfo> findList(Page<FileInfo> page, @Param("f") Map<String, Object> params);
|
||||||
|
|
||||||
|
FileInfo findById(@Param("id") String id);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -110,4 +110,9 @@ public abstract class AbstractIFileService extends ServiceImpl<FileMapper, FileI
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getViewUrlByName(String name);
|
public abstract String getViewUrlByName(String name);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileInfo getFileInfo(String id) {
|
||||||
|
return baseMapper.selectById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -66,7 +66,7 @@ public class OssService extends AbstractIFileService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getViewUrl(String fileId) {
|
public String getViewUrl(String fileId) {
|
||||||
FileInfo fileInfo = baseMapper.selectById(fileId);
|
FileInfo fileInfo = getFileInfo(fileId);
|
||||||
if (fileInfo != null) {
|
if (fileInfo != null) {
|
||||||
return ossTemplate.getViewUrl(fileInfo.getName());
|
return ossTemplate.getViewUrl(fileInfo.getName());
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ public class OssService extends AbstractIFileService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileInfo getFileInfo(String id) {
|
public FileInfo getFileInfo(String id) {
|
||||||
return baseMapper.selectById(id);
|
return baseMapper.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ spring:
|
|||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
mapper-locations: classpath:/mapper/*Mapper.xml
|
mapper-locations: classpath:/mapper/*Mapper.xml
|
||||||
#实体扫描,多个package用逗号或者分号分隔
|
#实体扫描,多个package用逗号或者分号分隔
|
||||||
typeAliasesPackage: com.central.file.model
|
typeAliasesPackage: com.central.common.model
|
||||||
global-config:
|
global-config:
|
||||||
db-config:
|
db-config:
|
||||||
id-type: INPUT
|
id-type: INPUT
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -25,4 +25,8 @@
|
|||||||
<include refid="where" />
|
<include refid="where" />
|
||||||
order by t.create_time desc
|
order by t.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findById" resultType="com.central.common.model.FileInfo">
|
||||||
|
SELECT * FROM file_info WHERE id = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
+84
-8
@@ -88,7 +88,11 @@ public class OrderController {
|
|||||||
})
|
})
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public PageResult list(@RequestParam Map<String, Object> params) {
|
public PageResult list(@RequestParam Map<String, Object> params) {
|
||||||
params.put("userId", LoginUserContextHolder.getUser().getId());
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
|
if (user == null) {
|
||||||
|
return new PageResult<>();
|
||||||
|
}
|
||||||
|
params.put("userId", user.getId());
|
||||||
return orderService.findListByUser(params);
|
return orderService.findListByUser(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +110,7 @@ public class OrderController {
|
|||||||
params.put("userId", user.getId());
|
params.put("userId", user.getId());
|
||||||
|
|
||||||
// 获取当前日期,格式化为 yyyyMMdd
|
// 获取当前日期,格式化为 yyyyMMdd
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
PageResult<Order> result = orderService.findListByUser(params);
|
PageResult<Order> result = orderService.findListByUser(params);
|
||||||
if (result.getCount() > 0){
|
if (result.getCount() > 0){
|
||||||
@@ -121,10 +125,20 @@ public class OrderController {
|
|||||||
if (list.size() > 0){
|
if (list.size() > 0){
|
||||||
for (OrderFile orderFile : list){
|
for (OrderFile orderFile : list){
|
||||||
Map imgMap = new HashMap();
|
Map imgMap = new HashMap();
|
||||||
imgMap.put("url", fileCenterService.getViewUrl(orderFile.getFileId()));
|
String url = fileCenterService.getViewUrlByName(orderFile.getFilePath());
|
||||||
OrderFile file = orderFileService.getOrderFileByFileId(orderFile.getFileId());
|
url = url.replace("goflyapp.oss-cn-beijing.aliyuncs.com","cdn.goflytec.com");
|
||||||
if (file != null){
|
imgMap.put("url", url);
|
||||||
imgMap.put("contentType", file.getFileType());
|
//@TODO 待优化file_type获取方式
|
||||||
|
if (url != null && !"".equals(url) ){
|
||||||
|
if (url.contains(".jpeg")){
|
||||||
|
imgMap.put("contentType", "image/jpeg");
|
||||||
|
}else if (url.contains(".png")){
|
||||||
|
imgMap.put("contentType", "image/png");
|
||||||
|
}else if (url.contains(".gif")){
|
||||||
|
imgMap.put("contentType", "image/gif");
|
||||||
|
}else if (url.contains(".mp4")){
|
||||||
|
imgMap.put("contentType", "video/mp4");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
resultList.add(imgMap);
|
resultList.add(imgMap);
|
||||||
}
|
}
|
||||||
@@ -205,16 +219,35 @@ public class OrderController {
|
|||||||
// 获取排队总览信息
|
// 获取排队总览信息
|
||||||
@GetMapping("/queue/info")
|
@GetMapping("/queue/info")
|
||||||
public Result<Map> getQueueInfo() {
|
public Result<Map> getQueueInfo() {
|
||||||
Double price = 25.0;
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
|
Double price = 6.99;
|
||||||
long execTime = 3; //一单执行时间默认3分钟
|
long execTime = 3; //一单执行时间默认3分钟
|
||||||
Long count = orderService.getOrderCountByStatus(OrderStatus.PAID.getId());
|
Long count = orderService.getOrderCountByStatus(OrderStatus.PAID.getId());
|
||||||
|
Long userOrderCount = orderService.getOrderCountByStatusAndUser(OrderStatus.PAID.getId(),user.getId());
|
||||||
|
if (userOrderCount > 0){
|
||||||
|
count = count - userOrderCount;
|
||||||
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("count", count);
|
map.put("count", count == 0 ? -1 : count);
|
||||||
map.put("time",Math.multiplyExact(count,execTime));
|
map.put("time",Math.multiplyExact(count,execTime));
|
||||||
map.put("price",price);
|
map.put("price",price);
|
||||||
return Result.succeed(map,"获取成功");
|
return Result.succeed(map,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取排队总览信息
|
||||||
|
@GetMapping("/queue/info/user")
|
||||||
|
public Result<Integer> getQueueInfoByUser() {
|
||||||
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
|
Long count = orderService.getOrderCountByStatusAndUser(OrderStatus.PAID.getId(),user.getId());
|
||||||
|
if (count == 0){
|
||||||
|
return Result.succeed(0,"该用户未存在待执行订单");
|
||||||
|
}else if (count > 0 ){
|
||||||
|
return Result.succeed(1,"存在待执行订单");
|
||||||
|
}
|
||||||
|
return Result.succeed(0,"该用户未存在待执行订单");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 获取排队中的订单列表
|
// 获取排队中的订单列表
|
||||||
@GetMapping("/queue")
|
@GetMapping("/queue")
|
||||||
public Result<List<Order>> getOrdersInQueue() {
|
public Result<List<Order>> getOrdersInQueue() {
|
||||||
@@ -222,6 +255,16 @@ public class OrderController {
|
|||||||
return Result.succeed(orders,"获取成功");
|
return Result.succeed(orders,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取排队中的订单列表
|
||||||
|
@GetMapping("/queue/first")
|
||||||
|
public Result<Order> getOrdersInQueueFirstOne() {
|
||||||
|
List<Order> orders = orderService.getOrdersInQueue();
|
||||||
|
if (orders.size() > 0){
|
||||||
|
return Result.succeed(orders.get(0),"获取成功");
|
||||||
|
}
|
||||||
|
return Result.failed("未存在排队队列");
|
||||||
|
}
|
||||||
|
|
||||||
// 处理排队中的订单(模拟消费通知等操作)
|
// 处理排队中的订单(模拟消费通知等操作)
|
||||||
@PutMapping("/queue/process")
|
@PutMapping("/queue/process")
|
||||||
public Result<String> processOrdersInQueue() {
|
public Result<String> processOrdersInQueue() {
|
||||||
@@ -243,6 +286,24 @@ public class OrderController {
|
|||||||
return Result.failed("未查询到订单数据");
|
return Result.failed("未查询到订单数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<String> updateOrderStatusComplete(@RequestBody Map payload) {
|
||||||
|
Order order = orderService.getOrderByNumber(payload.get("orderNo").toString());
|
||||||
|
if (order != null) {
|
||||||
|
if (order.getOrderStatus().equals(OrderStatus.PAID.getId())){
|
||||||
|
order.setOrderStatus(OrderStatus.COMPLETE.getId());
|
||||||
|
boolean res = orderService.updateOrder(order);
|
||||||
|
if (res){
|
||||||
|
return Result.succeed("更新成功");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return Result.failed("已更新");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return Result.failed("未查询到订单数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 商户订单号查询订单 */
|
/** 商户订单号查询订单 */
|
||||||
@@ -280,4 +341,19 @@ public class OrderController {
|
|||||||
}
|
}
|
||||||
return Result.failed("请重试");
|
return Result.failed("请重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/status/{orderNo}")
|
||||||
|
public Result getOrderExecStatus(@PathVariable("orderNo") String orderNo) {
|
||||||
|
|
||||||
|
Order order = orderService.getOrderByNumber(orderNo);
|
||||||
|
if (order == null){
|
||||||
|
return Result.failed("未查询到订单");
|
||||||
|
}
|
||||||
|
if (order.getOrderStatus().equals(OrderStatus.COMPLETE.getId())){
|
||||||
|
return Result.failed("已执行");
|
||||||
|
}else if (order.getOrderStatus().equals(OrderStatus.PAID.getId())){
|
||||||
|
return Result.succeed("待执行");
|
||||||
|
}
|
||||||
|
return Result.failed("不满足执行条件");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -102,6 +102,7 @@ public class OrderFileController {
|
|||||||
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.getViewUrl(orderFile.getFileId());
|
||||||
|
System.out.println("viewUrl:"+ viewUrl);
|
||||||
orderFile.setViewUrl(viewUrl);
|
orderFile.setViewUrl(viewUrl);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
@@ -135,7 +136,7 @@ public class OrderFileController {
|
|||||||
if (orderFile.getFilePath() != null) {
|
if (orderFile.getFilePath() != null) {
|
||||||
|
|
||||||
FileInfo fileInfo = fileCenterService.creatFileInfo(orderFile.getFilePath());
|
FileInfo fileInfo = fileCenterService.creatFileInfo(orderFile.getFilePath());
|
||||||
orderFile.setFileId(fileInfo.get);
|
orderFile.setFileId(fileInfo.getId());
|
||||||
orderFile.setFilePath(fileInfo.getPath());
|
orderFile.setFilePath(fileInfo.getPath());
|
||||||
orderFile.setFileType(fileInfo.getContentType());
|
orderFile.setFileType(fileInfo.getContentType());
|
||||||
orderFile.setTourismId(order.getTourismId());
|
orderFile.setTourismId(order.getTourismId());
|
||||||
|
|||||||
@@ -40,4 +40,7 @@ public interface FileCenterService {
|
|||||||
|
|
||||||
@PostMapping("/path")
|
@PostMapping("/path")
|
||||||
FileInfo creatFileInfo(@RequestBody String path);
|
FileInfo creatFileInfo(@RequestBody String path);
|
||||||
|
|
||||||
|
@PostMapping("/files/name")
|
||||||
|
String getViewUrlByName(@RequestBody String name) ;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -45,6 +45,11 @@ public class FileCenterServiceFallbackFactory implements FallbackFactory<FileCen
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getViewUrlByName(String name) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ public class OrderTimeoutScheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 每隔一定时间(这里设置为每分钟检查一次,可根据实际情况调整)检查订单超时情况
|
// 每隔一定时间(这里设置为每分钟检查一次,可根据实际情况调整)检查订单超时情况
|
||||||
@Scheduled(fixedRate = 60 * 1000)
|
@Scheduled(fixedRate = 1 * 1000)
|
||||||
public void checkOrderPaySuccess() {
|
public void checkOrderPaySuccess() {
|
||||||
orderService.updateOrderStatus();
|
orderService.updateOrderStatus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ public interface IOrderService extends ISuperService<Order> {
|
|||||||
*/
|
*/
|
||||||
Long getOrderCountByStatus(Integer status);
|
Long getOrderCountByStatus(Integer status);
|
||||||
|
|
||||||
|
Long getOrderCountByStatusAndUser(Integer status, Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取user订单记录
|
* 获取user订单记录
|
||||||
* @param params
|
* @param params
|
||||||
|
|||||||
+8
@@ -156,6 +156,14 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getOrderCountByStatusAndUser(Integer status, Long userId) {
|
||||||
|
return baseMapper.selectCount(new QueryWrapper<Order>()
|
||||||
|
.eq("order_status", status)
|
||||||
|
.eq("user_id", userId));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult findListByUser(Map<String, Object> params) {
|
public PageResult findListByUser(Map<String, Object> params) {
|
||||||
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: order-center
|
name: order-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 119.45.169.13
|
ip: 119.45.169.13
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
</update>
|
</update>
|
||||||
<!-- 查询所有处于排队状态的订单 -->
|
<!-- 查询所有处于排队状态的订单 -->
|
||||||
<select id="getOrdersInQueue" resultType="com.central.order.model.Order">
|
<select id="getOrdersInQueue" resultType="com.central.order.model.Order">
|
||||||
SELECT * FROM orders WHERE order_status = 1
|
SELECT * FROM orders WHERE order_status = 1 order by id asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据店铺编号和创建时间(当天)查询订单数量 -->
|
<!-- 根据店铺编号和创建时间(当天)查询订单数量 -->
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -18,6 +20,8 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@TableName("file_info")
|
@TableName("file_info")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
public class FileInfo extends Model<FileInfo> {
|
public class FileInfo extends Model<FileInfo> {
|
||||||
private static final long serialVersionUID = -1438078028040922174L;
|
private static final long serialVersionUID = -1438078028040922174L;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -142,7 +142,7 @@ public class OssTemplate implements InitializingBean {
|
|||||||
public String getViewUrl(String objectName) {
|
public String getViewUrl(String objectName) {
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.add(Calendar.MINUTE, 7);
|
cal.add(Calendar.MINUTE, 7);
|
||||||
URL url = ossClient.generatePresignedUrl(fileProperties.getCos().getBucketName(), objectName, cal.getTime());
|
URL url = ossClient.generatePresignedUrl(fileProperties.getOss().getBucketName(), objectName, cal.getTime());
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ zlt.s3.accessKeySecret=mmfSh4gjJm8dck0KaG6fKItpIM3tenWVHS4Ygjlm
|
|||||||
zlt.s3.endpoint=http://81.70.164.178:9000
|
zlt.s3.endpoint=http://81.70.164.178:9000
|
||||||
zlt.s3.bucketName=gofly
|
zlt.s3.bucketName=gofly
|
||||||
|
|
||||||
|
zlt.oss.secretId=LTAI5tSNV1RvexXpMMCZhxSe
|
||||||
|
zlt.oss.secretKey=XocJRWU8emwjjvYLTrc04l91VZMkQK
|
||||||
|
zlt.oss.endpoint=https://oss-cn-beijing.aliyuncs.com
|
||||||
|
zlt.oss.bucketName=goflyapp
|
||||||
|
|
||||||
#### cos配置
|
#### cos配置
|
||||||
zlt.cos.secretId=AKIDkMn6B3h7KJ5dIkyzpRr7C6mFUqFWbu1u
|
zlt.cos.secretId=AKIDkMn6B3h7KJ5dIkyzpRr7C6mFUqFWbu1u
|
||||||
zlt.cos.secretKey=jDThssfEZieS4S8bqsgIiAUdbXVVYgdQ
|
zlt.cos.secretKey=jDThssfEZieS4S8bqsgIiAUdbXVVYgdQ
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
########################## 统一变量配置 ##########################
|
########################## 统一变量配置 ##########################
|
||||||
##### 数据库配置
|
##### 数据库配置
|
||||||
zlt.datasource.ip=192.168.28.130
|
zlt.datasource.ip=127.0.0.1
|
||||||
zlt.datasource.username=root
|
zlt.datasource.username=root
|
||||||
zlt.datasource.password=1q2w3e4r
|
zlt.datasource.password=root
|
||||||
|
|
||||||
##### redis配置
|
##### redis配置
|
||||||
spring.data.redis.host=192.168.28.130
|
spring.data.redis.host=192.168.2.20
|
||||||
spring.data.redis.port=6379
|
spring.data.redis.port=6379
|
||||||
|
spring.data.redis.password=ikingtec123456
|
||||||
|
spring.data.redis.database=8
|
||||||
spring.data.redis.timeout=5000
|
spring.data.redis.timeout=5000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### elasticsearch配置
|
##### elasticsearch配置
|
||||||
zlt.elasticsearch.uris=192.168.28.130:9200
|
zlt.elasticsearch.uris=119.45.169.13:9200
|
||||||
zlt.elasticsearch.username=
|
zlt.elasticsearch.username=elastic
|
||||||
zlt.elasticsearch.password=
|
zlt.elasticsearch.password=iot123456@
|
||||||
|
|
||||||
##### sentinel配置
|
##### sentinel配置
|
||||||
zlt.sentinel.dashboard=192.168.28.130:6999
|
zlt.sentinel.dashboard=192.168.28.130:6999
|
||||||
@@ -22,10 +26,43 @@ zlt.fdfs.web-url=192.168.28.130
|
|||||||
zlt.fdfs.trackerList=${zlt.fdfs.web-url}:22122
|
zlt.fdfs.trackerList=${zlt.fdfs.web-url}:22122
|
||||||
|
|
||||||
##### s3配置
|
##### s3配置
|
||||||
zlt.s3.access-key=minioadmin
|
zlt.s3.access-key=33RdDbIlEFK0z9IJHSqx
|
||||||
zlt.s3.accessKeySecret=minioadmin
|
zlt.s3.accessKeySecret=mmfSh4gjJm8dck0KaG6fKItpIM3tenWVHS4Ygjlm
|
||||||
zlt.s3.endpoint=http://192.168.28.130:9000
|
zlt.s3.endpoint=http://81.70.164.178:9000
|
||||||
zlt.s3.bucketName=test
|
zlt.s3.bucketName=gofly
|
||||||
|
|
||||||
|
zlt.oss.secretId=LTAI5tSNV1RvexXpMMCZhxSe
|
||||||
|
zlt.oss.secretKey=XocJRWU8emwjjvYLTrc04l91VZMkQK
|
||||||
|
zlt.oss.endpoint=https://oss-cn-beijing.aliyuncs.com
|
||||||
|
zlt.oss.bucketName=goflyapp
|
||||||
|
|
||||||
|
#### cos配置
|
||||||
|
zlt.cos.secretId=AKIDkMn6B3h7KJ5dIkyzpRr7C6mFUqFWbu1u
|
||||||
|
zlt.cos.secretKey=jDThssfEZieS4S8bqsgIiAUdbXVVYgdQ
|
||||||
|
zlt.cos.endpoint=gofly-1333114031.cos.ap-nanjing.myqcloud.com
|
||||||
|
zlt.cos.bucketName=gofly-1333114031
|
||||||
|
zlt.cos.region=ap-nanjing
|
||||||
|
|
||||||
##### 日志链路追踪
|
##### 日志链路追踪
|
||||||
zlt.trace.enable=true
|
zlt.trace.enable=true
|
||||||
|
|
||||||
|
zlt.security.tencent.appId=wx30a3c8de94a85584
|
||||||
|
zlt.security.tencent.appSecret=e64d6e3dcfe88d0daee50e77f5a2ee69
|
||||||
|
zlt.security.tencent.token=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pT
|
||||||
|
zlt.security.tencent.encodingAESKey=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pTZiyHTxCiQxh
|
||||||
|
zlt.security.tencent.templateId=YOUR_TEMPLATE_ID
|
||||||
|
zlt.security.tencent.jscode2sessionUrl=https://api.weixin.qq.com/sns/jscode2session
|
||||||
|
zlt.security.tencent.accessTokenUrl=https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${zlt.security.tencent.appId}&secret=${zlt.security.tencent.appSecret}
|
||||||
|
|
||||||
|
# 微信支付商户号
|
||||||
|
zlt.wxpay.merchantId=1703796518
|
||||||
|
# 商户证书序列号
|
||||||
|
zlt.wxpay.merchantSerialNumber=11F4AC03C50EB582D3EDE082591D1F9A65388D51
|
||||||
|
# 微信支付申请的应用ID
|
||||||
|
zlt.wxpay.appId=wx30a3c8de94a85584
|
||||||
|
# 微信支付异步通知地址(需外网可访问且与微信支付平台配置一致)
|
||||||
|
zlt.wxpay.notifyUrl=http://your_domain/weixin/pay/notify
|
||||||
|
# 商户API私钥路径
|
||||||
|
zlt.wxpay.privateKeyPath=D:\\wx\\WXCertUtil\\cert\\1703796518_20250114_cert\\apiclient_key.pem
|
||||||
|
# 商户APIV3密钥
|
||||||
|
zlt.wxpay.apiV3Key=aIt5Vw3cYXSCSd4L5h14kIyDsoXBow7r
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ zlt:
|
|||||||
/user/login, /oauth/authorize,
|
/user/login, /oauth/authorize,
|
||||||
/api-uaa/tokens/key,
|
/api-uaa/tokens/key,
|
||||||
/*/v3/api-docs/**,
|
/*/v3/api-docs/**,
|
||||||
/api-order/files/path
|
/api-order/files/path,
|
||||||
|
/api-order/update,
|
||||||
|
/api-order/queue/first
|
||||||
auth:
|
auth:
|
||||||
urlPermission:
|
urlPermission:
|
||||||
#是否开启url级别权限
|
#是否开启url级别权限
|
||||||
|
|||||||
Reference in New Issue
Block a user