fix(设备中心):获取IOT平台token接口优化
This commit is contained in:
+10
-3
@@ -1,6 +1,7 @@
|
||||
package com.central.device.controller.token;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.device.util.Utils;
|
||||
import com.central.device.util.http.HeaderUtils;
|
||||
@@ -11,6 +12,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -36,10 +38,10 @@ public class ApiTokenController {
|
||||
private HeaderUtils headerUtils;
|
||||
|
||||
@Operation(summary = "客户端获取通信平台token")
|
||||
@GetMapping("_query")
|
||||
@GetMapping("/query")
|
||||
public Result token() throws IOException {
|
||||
|
||||
String url = jetlinksServiceUrl+"/api/v1/token";
|
||||
String url = jetlinksServiceUrl+"/token";
|
||||
|
||||
HttpRequest request = new SimpleHttpRequest(url);
|
||||
|
||||
@@ -51,6 +53,11 @@ public class ApiTokenController {
|
||||
|
||||
Response response = request.post();
|
||||
Map<String, String> result = Utils.queryStringToMap(new String(response.asBytes(), "utf8"), "utf8");
|
||||
return Result.succeed("data",result.get(""));
|
||||
JSONObject jsonObject = JSON.parseObject(result.get(""));
|
||||
Assert.notNull(jsonObject,"获取IOT数据异常");
|
||||
if (jsonObject.getString("message").equals("success")) {
|
||||
return Result.succeed(jsonObject,"获取成功");
|
||||
}
|
||||
return Result.failed("请重试");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -10,16 +10,16 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Getter
|
||||
public class WechatMpConfig {
|
||||
|
||||
@Value("${wechat.app-id}")
|
||||
@Value("${tencent.notification.app-id}")
|
||||
private String appId;
|
||||
|
||||
@Value("${wechat.app-secret}")
|
||||
@Value("${tencent.notification.app-secret}")
|
||||
private String appSecret;
|
||||
|
||||
@Value("${wechat.token}")
|
||||
@Value("${tencent.notification.token}")
|
||||
private String token;
|
||||
|
||||
@Value("${wechat.encoding-aes-key}")
|
||||
@Value("${tencent.notification.encoding-aes-key}")
|
||||
private String encodingAesKey;
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -182,6 +182,8 @@ public class OrderController {
|
||||
order.setUserId(user.getId());
|
||||
order.setTenantId(TenantContextHolder.getTenant());
|
||||
|
||||
Assert.notNull(order.getTourismId(),"TOURISM数据缺失");
|
||||
|
||||
//景区唯一二维码codeId,该二维码中包含价格信息
|
||||
if (order.getCodeId() == null){
|
||||
order.setCodeId("f83be3a9-2888-4000-8cf9-e6acdb3a22cd");
|
||||
@@ -189,7 +191,7 @@ public class OrderController {
|
||||
|
||||
List<Order> userOrderList = orderService.getOrderCountByStatusAndUser(user.getId(),OrderStatus.PAID.getId());
|
||||
if (!userOrderList.isEmpty()){
|
||||
return Result.failed("已存在支付订单,请刷新");
|
||||
return Result.succeed("已存在订单");
|
||||
}
|
||||
|
||||
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
|
||||
|
||||
+7
-5
@@ -159,11 +159,13 @@ public class OrderFileController {
|
||||
orderFile.setFileType(fileInfo.getContentType());
|
||||
orderFile.setTourismId(order.getTourismId());
|
||||
}
|
||||
orderFileService.save(orderFile);
|
||||
|
||||
// 机库上报订单素材,更新订单状态为素材上传中
|
||||
order.setOrderStatus(OrderStatus.UPLOADING.getId());
|
||||
orderService.updateOrder(order);
|
||||
if (orderFileService.save(orderFile)){
|
||||
// 机库上报订单素材,更新订单状态为素材上传中,如果订单为设备执行中则更新,否则说明状态已更新
|
||||
if (order.getOrderStatus().equals(OrderStatus.DOING.getId())){
|
||||
order.setOrderStatus(OrderStatus.UPLOADING.getId());
|
||||
orderService.updateOrder(order);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface OrderMapper extends SuperMapper<Order> {
|
||||
" orders,\n" +
|
||||
" (SELECT @rank := 0) r\n" +
|
||||
"WHERE \n" +
|
||||
" order_status in(1,4,) \n" +
|
||||
" order_status in(1,4,5,6) \n" +
|
||||
"ORDER BY \n" +
|
||||
" pay_time;")
|
||||
List<OrderRanking> getOrderRanking1();
|
||||
|
||||
@@ -44,6 +44,11 @@ tencent:
|
||||
getwxacodeUrl: https://api.weixin.qq.com/wxa/getwxacode?access_token=
|
||||
# 微信退款通知地址
|
||||
refund-notify-url: ${zlt.wxrefund.notifyUrl}
|
||||
notification:
|
||||
app-id:
|
||||
app-secret:
|
||||
token:
|
||||
encoding-aes-key:
|
||||
file:
|
||||
oss-url: goflyapp.oss-cn-beijing.aliyuncs.com
|
||||
cdn-url: cdn.goflytec.com
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
"playwright": "playwright install && playwright test",
|
||||
"prettier": "prettier -c --write \"src/**/*\"",
|
||||
"serve": "umi-serve",
|
||||
"start": "cross-env UMI_ENV=dev umi dev --port=8066",
|
||||
"start:dev": " cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev",
|
||||
"start": "set NODE_OPTIONS=--openssl-legacy-provider && cross-env UMI_ENV=dev umi dev --port=8066",
|
||||
"start:dev": "set NODE_OPTIONS=--openssl-legacy-provider && cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev",
|
||||
"start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev",
|
||||
"start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev",
|
||||
"start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev umi dev",
|
||||
@@ -61,6 +61,7 @@
|
||||
"react-dev-inspector": "^1.7.0",
|
||||
"react-dom": "^17.0.0",
|
||||
"react-helmet-async": "^1.2.0",
|
||||
"react-intl": "6.4.4",
|
||||
"react-json-tree": "^0.17.0",
|
||||
"treeify-js": "^1.0.8",
|
||||
"umi": "^3.5.0",
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
options={[
|
||||
{ label: '北塘古镇', value: 33 },
|
||||
{ label: '海丝首港', value: 32 },
|
||||
{ label: '景区C', value: 2 },
|
||||
{ label: '武汉东湖', value: 35 },
|
||||
// 添加更多选项...
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -268,7 +268,7 @@ const TableList: React.FC = () => {
|
||||
options={[
|
||||
{ label: '北塘古镇', value: 33 },
|
||||
{ label: '海丝首港', value: 32 },
|
||||
{ label: '景区C', value: 2 },
|
||||
{ label: '武汉东湖', value: 35 },
|
||||
// 添加更多选项...
|
||||
]}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user