|
@@ -0,0 +1,57 @@
|
|
|
+package com.szwl.controller;
|
|
|
+
|
|
|
+import com.szwl.feign.bean.SyncOldFeign;
|
|
|
+import com.szwl.model.bo.R;
|
|
|
+import com.szwl.model.bo.ResponseModel;
|
|
|
+import com.szwl.model.entity.TOrder;
|
|
|
+import com.szwl.service.TOrderService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Api(value = "/syncOrder", tags = {"同步旧系统的order数据"})
|
|
|
+@RestController
|
|
|
+@RequestMapping("/syncOrder")
|
|
|
+public class SyncOrderController {
|
|
|
+
|
|
|
+ TOrderService orderService;
|
|
|
+
|
|
|
+ SyncOldFeign syncOldFeign;
|
|
|
+ public SyncOrderController(TOrderService orderService, SyncOldFeign syncOldFeign) {
|
|
|
+ this.orderService = orderService;
|
|
|
+ this.syncOldFeign = syncOldFeign;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "同步某客户的某一设备某一时间段内的订单")
|
|
|
+ @PostMapping("/getOrderByCAT")
|
|
|
+ public ResponseModel<?> getOrderByCAT(String adminId, String clientId, String startTime, String endTime) {
|
|
|
+ if (StringUtils.isNotEmpty(adminId) && StringUtils.isNotEmpty(clientId) && StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
+ long l = Long.parseLong(adminId);
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+// Date start = sdf.parse(startTime);
|
|
|
+// Date end = sdf.parse(endTime);
|
|
|
+
|
|
|
+ List<TOrder> orderList = R.getDataIfSuccess(syncOldFeign.getOrderByACT(l, clientId, startTime, endTime));
|
|
|
+
|
|
|
+ for (TOrder order : orderList) {
|
|
|
+ System.out.println("order》》" + order);
|
|
|
+// TODO: 这里插入数据失败
|
|
|
+// orderService.save(order);
|
|
|
+ }
|
|
|
+ return R.ok(adminId + "同步设备" + clientId + "从" + startTime + "至" + endTime + "的 order 信息成功");
|
|
|
+ }
|
|
|
+ return R.fail("参数不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|