fix[订单模块]:任务下发设备后更新任务状态为服务中(Doing)

This commit is contained in:
2025-02-18 16:08:52 +08:00
parent 916b355f08
commit de48851c6f
6 changed files with 48 additions and 10 deletions
@@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
@@ -29,8 +30,8 @@ import java.util.Map;
@RestController
public class ApiDeviceController {
// @Value("${jetlinks.server.url}")
private String baseUrl = "http://119.45.169.13:8848/";
@Value("${jetlinks.server.baseUrl}")
private String baseUrl;// = "http://119.45.169.13:8848/";
@Autowired
private HeaderUtils headerUtils;
@@ -70,7 +71,7 @@ public class ApiDeviceController {
JsonObject jsonObject;
String property = MapUtil.getStrValue(param, "control");
String value = MapUtil.getStrValue(param, "order_no");
System.out.println("order_no"+value);
// System.out.println("order_no"+value);
if (value == null || "".equals(value)) {
return Result.succeed("暂未开放控制权限");
}
@@ -91,7 +92,11 @@ public class ApiDeviceController {
return Result.succeed("暂未开放控制权限");
}
Map<String, String> result = requestUtils.getPostRequestResultMap(url, jsonObject.toString());
return Result.succeed(result,"设置成功");
Result result1 = orderCenterService.updateOrderStatusDoing(value);
if (result1.getResp_code() != null && result1.getResp_code() == 1){
return Result.succeed(result,"设置成功");
}
return Result.failed("请重试");
} catch (Exception e) {
return Result.failed(e.getMessage());
}
@@ -5,6 +5,7 @@ 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.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
@@ -20,4 +21,7 @@ public interface OrderCenterService {
@GetMapping("/status/{orderNo}")
Result getOrderExecStatus(@PathVariable("orderNo") String orderNo);
@PatchMapping("/status/{orderNo}")
Result updateOrderStatusDoing(@PathVariable("orderNo") String orderNo);
}
@@ -27,6 +27,11 @@ public class OrderCenterServiceFallbackFactory implements FallbackFactory<OrderC
public Result getOrderExecStatus(String orderNo) {
return Result.failed(orderNo);
}
@Override
public Result updateOrderStatusDoing(String orderNo) {
return null;
}
};
}
}
@@ -19,11 +19,11 @@ import java.util.stream.Collectors;
@Component
public class HeaderUtils {
// @Value("${jetlinks.clientId}")
private String xClientId = "WFMfEGS8iHrEPRBH" ;
@Value("${jetlinks.clientId}")
private String xClientId;// = "WFMfEGS8iHrEPRBH" ;
// @Value("${jetlinks.secureKey}")
private String secureKey = "ihat3zHC6T7xPZYFAEnG3tExQiFANd2n" ;
@Value("${jetlinks.secureKey}")
private String secureKey;// = "ihat3zHC6T7xPZYFAEnG3tExQiFANd2n" ;
public Map<String, String> createHeadersOfParams(Map<String, Object> params) {
//时间戳
String xTimestamp = String.valueOf(System.currentTimeMillis());