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

+ 3 - 0
java110-interface/src/main/java/com/java110/intf/job/IDataBusInnerServiceSMO.java

@@ -93,4 +93,7 @@ public interface IDataBusInnerServiceSMO {
 
     @RequestMapping(value = "/payVideo", method = RequestMethod.POST)
     ResultVo payVideo(@RequestBody MachineDto machineDto);
+
+    @RequestMapping(value = "/heartbeatVideo", method = RequestMethod.POST)
+    ResultVo heartbeatVideo(@RequestBody JSONObject reqJson);
 }

+ 69 - 0
service-common/src/main/java/com/java110/common/cmd/machine/HeartbeatCameraCmd.java

@@ -0,0 +1,69 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.cmd.machine;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.log.LoggerFactory;
+import com.java110.intf.common.IMachineInnerServiceSMO;
+import com.java110.intf.job.IDataBusInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 类表述:摄像头播放
+ * 服务编码:machine.openParkingAreaDoorControlLog
+ * 请求路劲:/app/machine.openParkingAreaDoorControlLog
+ * add by 吴学文 at 2021-09-18 13:35:13 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "machine.heartbeatCamera")
+public class HeartbeatCameraCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(HeartbeatCameraCmd.class);
+
+    @Autowired
+    private IMachineInnerServiceSMO machineInnerServiceSMOImpl;
+
+    @Autowired
+    IDataBusInnerServiceSMO dataBusInnerServiceSMOImpl;
+
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "machineId", "未包含摄像头");
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+        Assert.hasKeyAndValue(reqJson, "callIds", "未包含callIds");
+
+        ResultVo resultVo = dataBusInnerServiceSMOImpl.heartbeatVideo(reqJson);
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.createResponseEntity(resultVo));
+    }
+}

+ 1 - 1
service-common/src/main/java/com/java110/common/cmd/machine/PlayCameraCmd.java

@@ -43,7 +43,7 @@ import java.util.List;
  * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
  * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
  */
-@Java110Cmd(serviceCode = "machine.playCameraCmd")
+@Java110Cmd(serviceCode = "machine.playCamera")
 public class PlayCameraCmd extends AbstractServiceCmdListener {
 
     private static Logger logger = LoggerFactory.getLogger(PlayCameraCmd.class);

+ 6 - 1
service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java

@@ -1,6 +1,7 @@
 package com.java110.fee.bmo.impl;
 
 import com.alibaba.fastjson.JSONArray;
+import com.java110.core.factory.CommunitySettingFactory;
 import com.java110.core.factory.Java110ThreadPoolFactory;
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.RoomDto;
@@ -164,7 +165,11 @@ public class QueryOweFeeImpl implements IQueryOweFee {
         feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
         feeDto.setFeeTotalPrice(Double.parseDouble(feePriceAll.get("feeTotalPrice").toString()));
         //应收款取值
-        String val = MappingCache.getValue(DOMAIN_COMMON, TOTAL_FEE_PRICE);
+        //先取单小区的如果没有配置 取 全局的
+        String val = CommunitySettingFactory.getValue(feeDto.getCommunityId(),TOTAL_FEE_PRICE);
+        if(StringUtil.isEmpty(val)){
+            val = MappingCache.getValue(DOMAIN_COMMON, TOTAL_FEE_PRICE);
+        }
         feeDto.setVal(val);
         String received_amount_switch = MappingCache.getValue(DOMAIN_COMMON, RECEIVED_AMOUNT_SWITCH);
         if (StringUtil.isEmpty(received_amount_switch)) {

+ 8 - 2
service-job/src/main/java/com/java110/job/adapt/DatabusAdaptImpl.java

@@ -22,7 +22,6 @@ import com.java110.dto.machine.MachineDto;
 import com.java110.dto.tempCarFeeConfig.TempCarPayOrderDto;
 import com.java110.entity.order.Business;
 import com.java110.job.adapt.hcIot.GetToken;
-import com.java110.po.machine.MachineRecordPo;
 import com.java110.vo.ResultVo;
 import org.springframework.http.HttpHeaders;
 
@@ -72,6 +71,11 @@ public abstract class DatabusAdaptImpl implements IDatabusAdapt {
         return new ResultVo(ResultVo.CODE_OK, ResultVo.MSG_OK);
     }
 
+    @Override
+    public ResultVo heartbeatVideo(JSONObject reqJson) {
+        return new ResultVo(ResultVo.CODE_OK, ResultVo.MSG_OK);
+    }
+
 
     /**
      * 重启设备
@@ -128,11 +132,13 @@ public abstract class DatabusAdaptImpl implements IDatabusAdapt {
     public void execute(Business business, List<Business> businesses) throws Exception {
 
     }
+
     /**
      * 手工 送数据
+     *
      * @param customBusinessDatabusDto
      */
-    public void customExchange(CustomBusinessDatabusDto customBusinessDatabusDto){
+    public void customExchange(CustomBusinessDatabusDto customBusinessDatabusDto) {
 
     }
 }

+ 2 - 0
service-job/src/main/java/com/java110/job/adapt/IDatabusAdapt.java

@@ -74,4 +74,6 @@ public interface IDatabusAdapt {
     ResultVo customCarInOut(JSONObject reqJson);
 
     ResultVo payVideo(MachineDto machineDto);
+
+    ResultVo heartbeatVideo(JSONObject reqJson);
 }

+ 9 - 0
service-job/src/main/java/com/java110/job/adapt/hcIot/IotConstant.java

@@ -87,6 +87,15 @@ public class IotConstant {
     //手动进出场
     public static final String CUSTOM_CAR_INOUT = "/extApi/machine/customCarInOut";
 
+    //播放视频
+    public static final String PLAY_VIDEO = "/extApi/machine/playVideo";
+
+    //结束视频
+    public static final String BYE_VIDEO = "/extApi/machine/byeVideo";
+
+    //心跳视频
+    public static final String HEARTBEAT_VIDEO = "/extApi/machine/heartbeatVideo";
+
     //获取二维码
     public static final String GET_QRCODE = "/extApi/machine/getQRcode";
     //重启接口

+ 26 - 14
service-job/src/main/java/com/java110/job/adapt/hcIot/OpenDoorAdapt.java

@@ -175,20 +175,32 @@ public class OpenDoorAdapt extends DatabusAdaptImpl {
     @Override
     public ResultVo payVideo(MachineDto machineDto) {
 
-//        JSONObject postParameters = new JSONObject();
-//        postParameters.put("taskId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_machineTranslateId));
-//        postParameters.put("extMachineId", paramIn.getString("machineId"));
-//        postParameters.put("carNum", paramIn.getString("carNum"));
-//        postParameters.put("type", paramIn.getString("type"));
-//        postParameters.put("amount", paramIn.getString("amount"));
-//        postParameters.put("payCharge", paramIn.getString("payCharge"));
-//        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters.toJSONString(), getHeaders(outRestTemplate));
-//        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.getUrl(IotConstant.CUSTOM_CAR_INOUT), HttpMethod.POST, httpEntity, String.class);
-//        if (responseEntity.getStatusCode() != HttpStatus.OK) {
-//            return new ResultVo(ResultVo.CODE_ERROR, responseEntity.getBody());
-//        }
-//        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
-        JSONObject paramOut = new JSONObject();
+        JSONObject postParameters = new JSONObject();
+        postParameters.put("taskId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_machineTranslateId));
+        postParameters.put("deviceId", machineDto.getMachineCode());
+        postParameters.put("channelId", machineDto.getMachineVersion());
+        postParameters.put("mediaProtocol", "UDP");
+        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters.toJSONString(), getHeaders(outRestTemplate));
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.getUrl(IotConstant.PLAY_VIDEO), HttpMethod.POST, httpEntity, String.class);
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
+            return new ResultVo(ResultVo.CODE_ERROR, responseEntity.getBody());
+        }
+        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+        return new ResultVo(paramOut.getInteger("code"), paramOut.getString("msg"), paramOut.getJSONObject("data"));
+    }
+
+    @Override
+    public ResultVo heartbeatVideo(JSONObject reqJson) {
+        JSONObject postParameters = new JSONObject();
+        postParameters.put("taskId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_machineTranslateId));
+        postParameters.put("callIds", reqJson.getString("callIds"));
+        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters.toJSONString(), getHeaders(outRestTemplate));
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.getUrl(IotConstant.HEARTBEAT_VIDEO), HttpMethod.POST, httpEntity, String.class);
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
+            return new ResultVo(ResultVo.CODE_ERROR, responseEntity.getBody());
+        }
+        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
         return new ResultVo(paramOut.getInteger("code"), paramOut.getString("msg"));
     }
+
 }

+ 6 - 0
service-job/src/main/java/com/java110/job/smo/impl/DataBusInnerServiceSMOImpl.java

@@ -76,6 +76,12 @@ public class DataBusInnerServiceSMOImpl extends BaseServiceSMO implements IDataB
         return databusAdaptImpl.payVideo(machineDto);
     }
 
+    @Override
+    public ResultVo heartbeatVideo(@RequestBody JSONObject reqJson) {
+        IDatabusAdapt databusAdaptImpl = ApplicationContextFactory.getBean(DEFAULT_OPEN_DOOR_PROTOCOL, IDatabusAdapt.class);
+        return databusAdaptImpl.heartbeatVideo(reqJson);
+    }
+
     @Override
     public ResultVo restartMachine(@RequestBody JSONObject reqJson) {
         IDatabusAdapt databusAdaptImpl = ApplicationContextFactory.getBean(DEFAULT_START_MACHINE_PROTOCOL, IDatabusAdapt.class);