java110 лет назад: 3
Родитель
Сommit
b87ee5cfe8

+ 17 - 0
java110-interface/src/main/java/com/java110/intf/api/IApiCallBackInnerServiceSMO.java

@@ -0,0 +1,17 @@
+package com.java110.intf.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.po.advert.AdvertItemPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@FeignClient(name = "${java110.api-service}", configuration = {FeignConfiguration.class})
+@RequestMapping("/apiCallBack")
+public interface IApiCallBackInnerServiceSMO {
+
+    @RequestMapping(value = "/webSentParkingArea", method = RequestMethod.POST)
+    public int webSentParkingArea(@RequestBody JSONObject reqJson);
+}

+ 16 - 1
service-api/src/main/java/com/java110/api/ApiApplicationStart.java

@@ -73,7 +73,22 @@ import java.util.concurrent.TimeUnit;
         basePackages = {"com.java110.api.listener"})
 @EnableSwagger2
 //@EnableConfigurationProperties(EventProperties.class)
-@EnableFeignClients(basePackages = {"com.java110.intf"})
+@EnableFeignClients(basePackages = {
+        "com.java110.intf.acct",
+        "com.java110.intf.code",
+        "com.java110.intf.common",
+        "com.java110.intf.community",
+        "com.java110.intf.demo",
+        "com.java110.intf.dev",
+        "com.java110.intf.fee",
+        "com.java110.intf.goods",
+        "com.java110.intf.job",
+        "com.java110.intf.oa",
+        "com.java110.intf.order",
+        "com.java110.intf.report",
+        "com.java110.intf.store",
+        "com.java110.intf.user"
+})
 @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
 @EnableAsync
 public class ApiApplicationStart {

+ 4 - 0
service-api/src/main/java/com/java110/api/rest/RestApi.java

@@ -43,6 +43,7 @@ public class RestApi extends BaseController {
     private IUserInnerServiceSMO userInnerServiceSMOImpl;
 
 
+
     /**
      * 健康检查 服务
      *
@@ -323,6 +324,9 @@ public class RestApi extends BaseController {
     }
 
 
+
+
+
     public IApiServiceSMO getApiServiceSMOImpl() {
         return apiServiceSMOImpl;
     }

+ 22 - 0
service-api/src/main/java/com/java110/api/smo/impl/ApiCallBackInnerServiceSMOImpl.java

@@ -0,0 +1,22 @@
+package com.java110.api.smo.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.websocket.ParkingAreaWebsocket;
+import com.java110.intf.api.IApiCallBackInnerServiceSMO;
+import com.java110.utils.exception.SMOException;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class ApiCallBackInnerServiceSMOImpl implements IApiCallBackInnerServiceSMO {
+    @Override
+    public int webSentParkingArea(@RequestBody JSONObject reqJson) {
+        JSONObject param = JSONObject.parseObject(reqJson.toString());
+        try {
+            ParkingAreaWebsocket.sendInfo(param.toJSONString(), param.getString("extBoxId"));
+        } catch (Exception e) {
+            throw new SMOException(e.getMessage());
+        }
+        return 1;
+    }
+}

+ 2 - 1
service-common/src/main/java/com/java110/common/CommonServiceApplicationStart.java

@@ -72,7 +72,8 @@ import java.nio.charset.Charset;
         "com.java110.intf.job",
         "com.java110.intf.order",
         "com.java110.intf.oa",
-        "com.java110.intf.report"
+        "com.java110.intf.report",
+        "com.java110.intf.api"
 })
 public class CommonServiceApplicationStart {
 

+ 11 - 5
service-common/src/main/java/com/java110/common/cmd/machine/OpenParkingAreaDoorControlLogCmd.java

@@ -20,12 +20,14 @@ import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.api.IApiCallBackInnerServiceSMO;
 import com.java110.utils.constant.KafkaConstant;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.kafka.KafkaFactory;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import com.java110.core.log.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * 类表述:保存
@@ -42,6 +44,9 @@ public class OpenParkingAreaDoorControlLogCmd extends Cmd {
 
     private static Logger logger = LoggerFactory.getLogger(OpenParkingAreaDoorControlLogCmd.class);
 
+    @Autowired
+    private IApiCallBackInnerServiceSMO apiCallBackInnerServiceSMOImpl;
+
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
@@ -52,11 +57,12 @@ public class OpenParkingAreaDoorControlLogCmd extends Cmd {
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-        try {
-            KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_API_SEND_PARKING_AREA_WEB, reqJson.toJSONString());
-        } catch (Exception e) {
-            logger.error("发送停车场信息失败", e);
-        }
+//        try {
+//            KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_API_SEND_PARKING_AREA_WEB, reqJson.toJSONString());
+//        } catch (Exception e) {
+//            logger.error("发送停车场信息失败", e);
+//        }
+        apiCallBackInnerServiceSMOImpl.webSentParkingArea(reqJson);
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
 }