java110
2022-08-20 b87ee5cfe8576c56aecf20221335cadf9e1b891e
优化common
4个文件已修改
2个文件已添加
79 ■■■■■ 已修改文件
java110-interface/src/main/java/com/java110/intf/api/IApiCallBackInnerServiceSMO.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/ApiApplicationStart.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/rest/RestApi.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/smo/impl/ApiCallBackInnerServiceSMOImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/CommonServiceApplicationStart.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/machine/OpenParkingAreaDoorControlLogCmd.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/api/IApiCallBackInnerServiceSMO.java
New file
@@ -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);
}
service-api/src/main/java/com/java110/api/ApiApplicationStart.java
@@ -73,7 +73,22 @@
        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 {
service-api/src/main/java/com/java110/api/rest/RestApi.java
@@ -43,6 +43,7 @@
    private IUserInnerServiceSMO userInnerServiceSMOImpl;
    /**
     * 健康检查 服务
     *
@@ -323,6 +324,9 @@
    }
    public IApiServiceSMO getApiServiceSMOImpl() {
        return apiServiceSMOImpl;
    }
service-api/src/main/java/com/java110/api/smo/impl/ApiCallBackInnerServiceSMOImpl.java
New file
@@ -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;
    }
}
service-common/src/main/java/com/java110/common/CommonServiceApplicationStart.java
@@ -72,7 +72,8 @@
        "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 {
service-common/src/main/java/com/java110/common/cmd/machine/OpenParkingAreaDoorControlLogCmd.java
@@ -20,12 +20,14 @@
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 @@
    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 @@
    @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());
    }
}