feat[文件模块]:任务编号生成文件数据
This commit is contained in:
+26
-2
@@ -1,13 +1,15 @@
|
||||
package com.central.order.controller;
|
||||
|
||||
import com.central.common.context.LoginUserContextHolder;
|
||||
import com.central.common.model.FileInfo;
|
||||
import com.central.common.model.LoginAppUser;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.order.feign.FileCenterService;
|
||||
import com.central.order.model.Order;
|
||||
import com.central.order.model.OrderFile;
|
||||
import com.central.order.service.IOrderFileService;
|
||||
import com.central.order.service.ITourismService;
|
||||
import com.central.order.service.IOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
@@ -42,7 +44,7 @@ public class OrderFileController {
|
||||
private FileCenterService fileCenterService;
|
||||
|
||||
@Autowired
|
||||
private ITourismService tourismService;
|
||||
private IOrderService orderService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@@ -122,4 +124,26 @@ public class OrderFileController {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Operation(summary = "设备回传照片path记录创建")
|
||||
@PostMapping("/path")
|
||||
public void createOrderFileForPath(@RequestBody OrderFile orderFile) {
|
||||
|
||||
if (orderFile != null && orderFile.getOrderNo() != null) {
|
||||
Order order = orderService.getOrderByNumber(orderFile.getOrderNo());
|
||||
orderFile.setOrderNo(order.getOrderNo());
|
||||
orderFile.setUserId(order.getUserId());
|
||||
if (orderFile.getFilePath() != null) {
|
||||
|
||||
FileInfo fileInfo = fileCenterService.creatFileInfo(orderFile.getFilePath());
|
||||
orderFile.setFileId(fileInfo.get);
|
||||
orderFile.setFilePath(fileInfo.getPath());
|
||||
orderFile.setFileType(fileInfo.getContentType());
|
||||
orderFile.setTourismId(order.getTourismId());
|
||||
}
|
||||
orderFileService.save(orderFile);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.central.order.feign;
|
||||
|
||||
import com.central.common.constant.ServiceNameConstants;
|
||||
import com.central.common.model.FileInfo;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.order.feign.fallback.FileCenterServiceFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -34,4 +37,7 @@ public interface FileCenterService {
|
||||
|
||||
@GetMapping("/qrcode/{codeId}")
|
||||
Result<Map> uploadQrCodeFile(@PathVariable("codeId") String codeId) throws Exception;
|
||||
|
||||
@PostMapping("/path")
|
||||
FileInfo creatFileInfo(@RequestBody String path);
|
||||
}
|
||||
|
||||
+6
@@ -1,5 +1,6 @@
|
||||
package com.central.order.feign.fallback;
|
||||
|
||||
import com.central.common.model.FileInfo;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.order.feign.FileCenterService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -39,6 +40,11 @@ public class FileCenterServiceFallbackFactory implements FallbackFactory<FileCen
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileInfo creatFileInfo(String path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: order-center
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 119.45.169.13
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 119.45.169.13
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
|
||||
@@ -47,6 +47,6 @@
|
||||
|
||||
<!-- 根据订单编号查询订单信息 -->
|
||||
<select id="getOrderByNumber" resultMap="OrderResultMap">
|
||||
SELECT * FROM orders WHERE order_number = #{orderNumber}
|
||||
SELECT * FROM orders WHERE order_no = #{orderNumber}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user