|
|
|
@@ -0,0 +1,214 @@ |
|
|
|
package com.iformall.controller.callback.car.haikangweishi; |
|
|
|
|
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.controller.callback.car.WxParkCallBackBaseController; |
|
|
|
import com.iformall.enums.EnumCarCmd; |
|
|
|
import com.iformall.enums.EnumCarVendor; |
|
|
|
import com.iformall.service.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author: furunxin |
|
|
|
* @Date: 2020/7/6 15:29 |
|
|
|
* @Description: 海康威视回调接口 |
|
|
|
*/ |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@RestController |
|
|
|
@RequestMapping("/hkwsv2CarCallback") |
|
|
|
public class WxCarHaiKangWeiShiV2CallBackController extends WxParkCallBackBaseController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxParkService wxParkService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCarCmdLogService wxCarCmdLogService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCUserService wxCUserService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCUserCarService wxCUserCarService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponSendService wxCouponSendService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCarPayRecordService wxCarPayRecordService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCUserBasicInfoService wxCUserBasicInfoService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 入场事件: |
|
|
|
|
|
|
|
{ |
|
|
|
"method":"OnEventNotify", |
|
|
|
"params":{ |
|
|
|
"ability":"vehicle_pass_in_event", |
|
|
|
"eventType":771760131, |
|
|
|
"events":[ |
|
|
|
{ |
|
|
|
"crossTime":"2021-07-01T17:29:27+08:00", |
|
|
|
"crossType":1, |
|
|
|
"eventIndexCode":"74b64514-4888-4f42-8cf7-22fed37d5dc8", |
|
|
|
"eventType":3, |
|
|
|
"resource":{ |
|
|
|
"deviceId":"3715149265421676", |
|
|
|
"deviceSerial":"R20150664", |
|
|
|
"direction":0, |
|
|
|
"entranceId":"2063867554789264", |
|
|
|
"entranceName":"前门1", |
|
|
|
"parkId":"2064637172217744", |
|
|
|
"parkName":"车库", |
|
|
|
"resType":"roadway", |
|
|
|
"roadWayId":"2064272439342992", |
|
|
|
"roadWayName":"前门入口" |
|
|
|
}, |
|
|
|
"stopType":11, |
|
|
|
"vehicle":{ |
|
|
|
"plateColor":12, |
|
|
|
"plateNo":"苏A23658", |
|
|
|
"plateType":8, |
|
|
|
"vehicleColor":12, |
|
|
|
"vehicleType":12 |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
"sendTime":"2021-07-01T17:29:29.315+08:00" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
3 出场事件: |
|
|
|
|
|
|
|
{ |
|
|
|
"method":"OnEventNotify", |
|
|
|
"params":{ |
|
|
|
"ability":"vehicle_pass_out_event", |
|
|
|
"eventType":771760134, |
|
|
|
"events":[ |
|
|
|
{ |
|
|
|
"crossTime":"2021-07-01T17:31:17+08:00", |
|
|
|
"crossType":1, |
|
|
|
"eventIndexCode":"a5464f46-ba7b-4059-b657-5ebc2f3774a9", |
|
|
|
"eventType":4, |
|
|
|
"resource":{ |
|
|
|
"deviceId":"370573791833424", |
|
|
|
"deviceSerial":"9b1037b5-8a95-4657-81f0-edf27f71d92f", |
|
|
|
"direction":1, |
|
|
|
"entranceId":"2063867554789264", |
|
|
|
"entranceName":"前门1", |
|
|
|
"parkId":"2064637172217744", |
|
|
|
"parkName":"车库", |
|
|
|
"resType":"roadway", |
|
|
|
"roadWayId":"2064664422217616", |
|
|
|
"roadWayName":"前门出口test" |
|
|
|
}, |
|
|
|
"stopType":11, |
|
|
|
"vehicle":{ |
|
|
|
"plateColor":12, |
|
|
|
"plateNo":"苏A23658", |
|
|
|
"plateType":8, |
|
|
|
"vehicleColor":12, |
|
|
|
"vehicleType":12 |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
"sendTime":"2021-07-01T17:31:17.337+08:00" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
4 图片事件: |
|
|
|
{ |
|
|
|
"method":"OnEventNotify", |
|
|
|
"params":{ |
|
|
|
"ability":"vehicle_pass_out_event", |
|
|
|
"eventType":771760144, |
|
|
|
"events":[ |
|
|
|
{ |
|
|
|
"crossTime":"2021-07-01T17:31:17+08:00", |
|
|
|
"crossType":1, |
|
|
|
"eventIndexCode":"a5464f46-ba7b-4059-b657-5ebc2f3774a9", |
|
|
|
"eventType":4, |
|
|
|
"resource":{ |
|
|
|
"deviceId":"370573791833424", |
|
|
|
"deviceSerial":"9b1037b5-8a95-4657-81f0-edf27f71d92f", |
|
|
|
"direction":1, |
|
|
|
"entranceId":"2063867554789264", |
|
|
|
"entranceName":"前门1", |
|
|
|
"parkId":"2064637172217744", |
|
|
|
"parkName":"车库", |
|
|
|
"resType":"roadway", |
|
|
|
"roadWayId":"2064664422217616", |
|
|
|
"roadWayName":"前门出口test" |
|
|
|
}, |
|
|
|
"stopType":11, |
|
|
|
"vehicle":{ |
|
|
|
"plateColor":12, |
|
|
|
"plateNo":"苏A23658", |
|
|
|
"plateNoPicUrl":"62834762", |
|
|
|
"plateType":8, |
|
|
|
"vehicleColor":12, |
|
|
|
"vehiclePicUrl":"62834762", |
|
|
|
"vehicleType":12 |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
"sendTime":"2021-07-01T17:31:19.659+08:00" |
|
|
|
} |
|
|
|
} |
|
|
|
* @param paramMap |
|
|
|
* @return |
|
|
|
* |
|
|
|
* 这个接口需要你们实现的时候规定下: |
|
|
|
1、POST格式, |
|
|
|
2、接口返回参数JSON格式:{errcode:0, errmsg: "success",data:null} |
|
|
|
3、接口建议接收到过车事件,立即返回接收成功 |
|
|
|
* |
|
|
|
*/ |
|
|
|
@PostMapping(value = "/notify") |
|
|
|
public Map notify(@RequestBody Map<String, Object> paramMap) { |
|
|
|
Map retMap = new HashMap(); |
|
|
|
try { |
|
|
|
log.info("["+getIpAddr()+"] hkwsv2CarCallback notify: " + paramMap.toString()); |
|
|
|
|
|
|
|
Map params = (Map)paramMap.get("params"); |
|
|
|
String eventType = params.get("eventType").toString(); |
|
|
|
Result result = null; |
|
|
|
if ("771760131".equals(eventType)) { |
|
|
|
//解析车易付参数 |
|
|
|
result = super.parkInCallBack(EnumCarVendor.CAR_HAIKANGWEISHI_V2, EnumCarCmd.CAR_HAIKANGWEISHI_V2_CALLBACK_PARK_IN, paramMap); |
|
|
|
}else if ("771760134".equals(eventType)) { |
|
|
|
result = super.parkOutCallBack(EnumCarVendor.CAR_HAIKANGWEISHI_V2, EnumCarCmd.CAR_HAIKANGWEISHI_V2_CALLBACK_PARK_OUT, paramMap); |
|
|
|
} |
|
|
|
|
|
|
|
int errcode = 0; |
|
|
|
String msg = "success"; |
|
|
|
if (null != result) { |
|
|
|
if (result.code != Result.SUCCESS) { |
|
|
|
errcode = result.code; |
|
|
|
msg = result.message; |
|
|
|
} |
|
|
|
}else { |
|
|
|
errcode = Result.ERROR; |
|
|
|
msg = "no result.eventType["+eventType+"]"; |
|
|
|
} |
|
|
|
retMap.put("errcode", errcode); |
|
|
|
retMap.put("errmsg", msg); |
|
|
|
} catch(Exception e) { |
|
|
|
retMap.put("errcode", Result.ERROR); |
|
|
|
retMap.put("errmsg", "notify error."+e.getLocalizedMessage()); |
|
|
|
log.error("haikangweishiv2 notity error "+paramMap.toString(),e); |
|
|
|
} |
|
|
|
retMap.put("data", null); |
|
|
|
return retMap; |
|
|
|
} |
|
|
|
} |