| @@ -122,6 +122,7 @@ public class ShiroConfig { | |||||
| filterChainDefinitionMap.put("/swagger-resources/**","anon"); | filterChainDefinitionMap.put("/swagger-resources/**","anon"); | ||||
| filterChainDefinitionMap.put("/webjars/**","anon"); | filterChainDefinitionMap.put("/webjars/**","anon"); | ||||
| filterChainDefinitionMap.put("/wxMsgCallback/**","anon"); | filterChainDefinitionMap.put("/wxMsgCallback/**","anon"); | ||||
| filterChainDefinitionMap.put("/carCallback/**","anon"); | |||||
| // filterChainDefinitionMap.put("/role/**", "corsFilter,token"); | // filterChainDefinitionMap.put("/role/**", "corsFilter,token"); | ||||
| filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); | filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); | ||||
| // filterChainDefinitionMap.put("/**", "anon"); | // filterChainDefinitionMap.put("/**", "anon"); | ||||
| @@ -0,0 +1,323 @@ | |||||
| package com.simple.controller; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.*; | |||||
| import com.simple.enums.EnumCarCmd; | |||||
| import com.simple.enums.EnumCarVendor; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| import com.simple.service.WxCarCmdLogService; | |||||
| import com.simple.service.WxMerchantService; | |||||
| import com.simple.service.WxParkService; | |||||
| import com.simple.utils.ETCPUtil; | |||||
| import com.simple.utils.TJDCarUtil; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("/carCallback") | |||||
| public class WxCarCallBackController extends BaseController | |||||
| { | |||||
| private Logger logger = Logger.getLogger(WxCarCallBackController.class); | |||||
| ETCPUtil etcp = new ETCPUtil(); | |||||
| TJDCarUtil tjd = new TJDCarUtil(); | |||||
| @Autowired | |||||
| WxParkService wxParkService; | |||||
| @Autowired | |||||
| WxCUserCarService wxCUserCarService; | |||||
| @Autowired | |||||
| WxMerchantService wxMerchantService; | |||||
| @Autowired | |||||
| WxCarCmdLogService wxCarCmdLogService; | |||||
| /** | |||||
| * ETCP 车辆入场通知 | |||||
| * { | |||||
| * "synId": "4ebd80ff-cfcf-462a-94cb-727e9fa9547c", | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "parkName": "ETCP 智慧停车场", | |||||
| * "parkId": "1", | |||||
| * "entranceTime": "2017-08-20 12:59:54", | |||||
| * "userType": "76", | |||||
| * "pushTime": "2017-08-20 12:59:57", | |||||
| * "fixParkingId": "U7", | |||||
| * "remainingDays": "11" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpParkInCallback") | |||||
| public Result etcpParkInCallback(@RequestBody Map<String,String> paramMap) { | |||||
| logger.info("etcpParkInCallback: " + paramMap.toString()); | |||||
| String etcpParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| parkQ.setParkId(etcpParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("etcpParkInCallback: ETCP车场未找到"+ etcpParkId); | |||||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // TODO 发起 营销 -- 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * ETCP 车辆出场通知 | |||||
| * { | |||||
| * "synId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "parkName": "ETCP 智慧停车场", | |||||
| * "parkId": "1", | |||||
| * "entranceTime": "2017-08-17 18:44:19", | |||||
| * "userType": "76", | |||||
| * "pushTime": "2017-08-20 11:57:51", | |||||
| * "exitTime": "2017-08-19 12:07:19", | |||||
| * "stayedTime": 148980, | |||||
| * "receivableFee": 0, | |||||
| * "paidServiceFee": 0, | |||||
| * "fixParkingId": "U7", | |||||
| * "remainingDays": "12" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpParkOutCallback") | |||||
| public Result etcpParkOutCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpParkOutCallback: " + paramMap.toString()); | |||||
| String etcpParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| parkQ.setParkId(etcpParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("etcpParkInCallback: ETCP车场未找到 "+ etcpParkId); | |||||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // TODO 发起 营销 -- 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * ETCP 车辆解绑通知 | |||||
| * { | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "time": "2017-08-20 11:57:51" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpUnbindCarCallBack") | |||||
| public Result etcpUnbindCarCallBack(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpUnbindCarCallBack: " + paramMap.toString()); | |||||
| String carNumber = paramMap.get("plateNumber"); | |||||
| // TODO how to get the parkId | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_UNBIND.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| WxCUserCar userCarQ = new WxCUserCar(); | |||||
| userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCarQ.setCarNumber(carNumber); | |||||
| // 数据库里删除,保持同步 | |||||
| try { | |||||
| wxCUserCarService.deleteByObj(userCarQ); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| // 营销 - 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * ETCP 主动支付结果通知 | |||||
| * { | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "orderId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| * "fee": 7.65, | |||||
| * "paidServiceFee": 0.07, | |||||
| * "coupon": 0, | |||||
| * "time": "2017-08-20 11:57:51" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpPaidCallback") | |||||
| public Result etcpPaidCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpPaidCallback: " + paramMap.toString()); | |||||
| String carNumber = paramMap.get("plateNumber"); | |||||
| // TODO how to get the parkId | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // 营销 - 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * TJD 车辆入场通知 | |||||
| * { | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outCarId": "45454545454", | |||||
| * "carNum": "京A45413", | |||||
| * "carNumColor ": "blue", | |||||
| * "inDt": "20170319202020", | |||||
| * "parkName": "测试停车场", | |||||
| * "parkId": "5836b8b52ada463ebc6199579f029561", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735", | |||||
| * "payUrl": "http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?prePayType=16&channel=10001", | |||||
| * "canFindCar": "0" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/tjdParkInCallback") | |||||
| public Map tjdParkInCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkInCallback: " + paramMap.toString()); | |||||
| Map map = new HashMap(); | |||||
| String tjdParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| parkQ.setParkId(tjdParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("tjdParkInCallback: 停简单车场未找到"+ tjdParkId); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "停简单车场未找到"+ tjdParkId); | |||||
| return map; | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("tjdParkInCallback: 入库错误"+ paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||||
| return map; | |||||
| } | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| /** | |||||
| * TJD 车辆出场通知 | |||||
| * { | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outDt": "20170319232020", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735", | |||||
| * "parkAmount": "5.20" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/tjdParkoutCallback") | |||||
| public Map tjdParkOutCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkoutCallback: " + paramMap.toString()); | |||||
| Map map = new HashMap(); | |||||
| String tradeId = paramMap.get("tradeId"); | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("tjdParkoutCallback: 入库错误"+ paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||||
| return map; | |||||
| } | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| } | |||||
| @@ -161,279 +161,4 @@ public class WxCarController extends BaseController | |||||
| businessId = objParams1.getString("businessId"); | businessId = objParams1.getString("businessId"); | ||||
| return businessId; | return businessId; | ||||
| } | } | ||||
| /** | |||||
| * ETCP 车辆入场通知 | |||||
| * { | |||||
| * "synId": "4ebd80ff-cfcf-462a-94cb-727e9fa9547c", | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "parkName": "ETCP 智慧停车场", | |||||
| * "parkId": "1", | |||||
| * "entranceTime": "2017-08-20 12:59:54", | |||||
| * "userType": "76", | |||||
| * "pushTime": "2017-08-20 12:59:57", | |||||
| * "fixParkingId": "U7", | |||||
| * "remainingDays": "11" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpParkInCallback") | |||||
| public Result etcpParkInCallback(@RequestBody Map<String,String> paramMap) { | |||||
| logger.info("etcpParkInCallback: " + paramMap.toString()); | |||||
| String etcpParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| parkQ.setParkId(etcpParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("etcpParkInCallback: ETCP车场未找到"+ etcpParkId); | |||||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // TODO 发起 营销 -- 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * ETCP 车辆出场通知 | |||||
| * { | |||||
| * "synId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "parkName": "ETCP 智慧停车场", | |||||
| * "parkId": "1", | |||||
| * "entranceTime": "2017-08-17 18:44:19", | |||||
| * "userType": "76", | |||||
| * "pushTime": "2017-08-20 11:57:51", | |||||
| * "exitTime": "2017-08-19 12:07:19", | |||||
| * "stayedTime": 148980, | |||||
| * "receivableFee": 0, | |||||
| * "paidServiceFee": 0, | |||||
| * "fixParkingId": "U7", | |||||
| * "remainingDays": "12" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpParkOutCallback") | |||||
| public Result etcpParkOutCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpParkOutCallback: " + paramMap.toString()); | |||||
| String etcpParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| parkQ.setParkId(etcpParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("etcpParkInCallback: ETCP车场未找到 "+ etcpParkId); | |||||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // TODO 发起 营销 -- 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * ETCP 车辆解绑通知 | |||||
| * { | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "time": "2017-08-20 11:57:51" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpUnbindCarCallBack") | |||||
| public Result etcpUnbindCarCallBack(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpUnbindCarCallBack: " + paramMap.toString()); | |||||
| String carNumber = paramMap.get("plateNumber"); | |||||
| // TODO how to get the parkId | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_UNBIND.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| WxCUserCar userCarQ = new WxCUserCar(); | |||||
| userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCarQ.setCarNumber(carNumber); | |||||
| // 数据库里删除,保持同步 | |||||
| try { | |||||
| wxCUserCarService.deleteByObj(userCarQ); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| // 营销 - 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * ETCP 主动支付结果通知 | |||||
| * { | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "orderId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| * "fee": 7.65, | |||||
| * "paidServiceFee": 0.07, | |||||
| * "coupon": 0, | |||||
| * "time": "2017-08-20 11:57:51" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpPaidCallback") | |||||
| public Result etcpPaidCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpPaidCallback: " + paramMap.toString()); | |||||
| String carNumber = paramMap.get("plateNumber"); | |||||
| // TODO how to get the parkId | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // 营销 - 短信 | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| /** | |||||
| * TJD 车辆入场通知 | |||||
| * { | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outCarId": "45454545454", | |||||
| * "carNum": "京A45413", | |||||
| * "carNumColor ": "blue", | |||||
| * "inDt": "20170319202020", | |||||
| * "parkName": "测试停车场", | |||||
| * "parkId": "5836b8b52ada463ebc6199579f029561", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735", | |||||
| * "payUrl": "http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?prePayType=16&channel=10001", | |||||
| * "canFindCar": "0" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/tjdParkInCallback") | |||||
| public Map tjdParkInCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkInCallback: " + paramMap.toString()); | |||||
| Map map = new HashMap(); | |||||
| String tjdParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| parkQ.setParkId(tjdParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("tjdParkInCallback: 停简单车场未找到"+ tjdParkId); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "停简单车场未找到"+ tjdParkId); | |||||
| return map; | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("tjdParkInCallback: 入库错误"+ paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||||
| return map; | |||||
| } | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| /** | |||||
| * TJD 车辆出场通知 | |||||
| * { | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outDt": "20170319232020", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735", | |||||
| * "parkAmount": "5.20" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/tjdParkoutCallback") | |||||
| public Map tjdParkOutCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkoutCallback: " + paramMap.toString()); | |||||
| Map map = new HashMap(); | |||||
| String tradeId = paramMap.get("tradeId"); | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("tjdParkoutCallback: 入库错误"+ paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||||
| return map; | |||||
| } | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,35 @@ | |||||
| package com.simple.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumETCPCode { | |||||
| SUCCESS(0, "ok"), | |||||
| ; | |||||
| public static EnumETCPCode getEnum(Integer code) { | |||||
| for (EnumETCPCode value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumETCPCode(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -219,13 +219,14 @@ public class ETCPUtil { | |||||
| String carNumber = "京D12345"; | String carNumber = "京D12345"; | ||||
| String parkId = "Wj7YdvqyiYM="; | String parkId = "Wj7YdvqyiYM="; | ||||
| String businessId = "IgWGUtpAX68="; | String businessId = "IgWGUtpAX68="; | ||||
| String couponFreeId = "5627"; | |||||
| //caller.carSimulation(domain, appId, merchantNo, merchantKey, version, carNumber); | //caller.carSimulation(domain, appId, merchantNo, merchantKey, version, carNumber); | ||||
| /* {"code":0,"message":"ok","data":{"isInPark":0}} */ | /* {"code":0,"message":"ok","data":{"isInPark":0}} */ | ||||
| //caller.getBCouponList(domain, merchantNo, merchantKey, version, parkId, businessId); | //caller.getBCouponList(domain, merchantNo, merchantKey, version, parkId, businessId); | ||||
| // {"code":0,"message":"查询成功","data":{"count":1,"couponPlatformModels":[{"id":5627,"parkId":"Wj7YdvqyiYM=","businessId":"IgWGUtpAX68=","businessName":"fmtest5678","name":"优免现金1元","category":"2","categoryValue":"1.00","amount":100,"status":"1","effectiveStart":"2018-08-20","effectiveEnd":"2018-08-25","couponType":"0","avaliavleNum":100}]}} | // {"code":0,"message":"查询成功","data":{"count":1,"couponPlatformModels":[{"id":5627,"parkId":"Wj7YdvqyiYM=","businessId":"IgWGUtpAX68=","businessName":"fmtest5678","name":"优免现金1元","category":"2","categoryValue":"1.00","amount":100,"status":"1","effectiveStart":"2018-08-20","effectiveEnd":"2018-08-25","couponType":"0","avaliavleNum":100}]}} | ||||
| //caller.bCouponRecord(domain, merchantNo, merchantKey, version, etcpToken, parkId, businessId, carNumber, couponFreeId); | |||||
| // 联合登录测试 | // 联合登录测试 | ||||
| /*ret = caller.userSignin(domain, appId, merchantNo, merchantKey, version, "13910154397"); | /*ret = caller.userSignin(domain, appId, merchantNo, merchantKey, version, "13910154397"); | ||||
| @@ -237,9 +238,9 @@ public class ETCPUtil { | |||||
| etcpToken = objret.getJSONObject("data").getString("token"); | etcpToken = objret.getJSONObject("data").getString("token"); | ||||
| System.out.println(etcpToken); | System.out.println(etcpToken); | ||||
| */ | */ | ||||
| /* | |||||
| // 绑定车牌查询 | // 绑定车牌查询 | ||||
| ret = caller.carNum(merchantNo, merchantKey, version, etcpToken); | |||||
| ret = caller.carNum(domain, merchantNo, merchantKey, version, etcpToken); | |||||
| System.out.println(ret); | System.out.println(ret); | ||||
| objret = JSON.parseObject(ret); | objret = JSON.parseObject(ret); | ||||
| if (objret.getIntValue("code") != 0) | if (objret.getIntValue("code") != 0) | ||||
| @@ -247,7 +248,7 @@ public class ETCPUtil { | |||||
| JSONObject data = objret.getJSONObject("data"); | JSONObject data = objret.getJSONObject("data"); | ||||
| if (data.getIntValue("number") <= 0) { | if (data.getIntValue("number") <= 0) { | ||||
| // 车牌绑定测试 | // 车牌绑定测试 | ||||
| ret = caller.bindCar(etcpToken, carNumber, null, merchantNo, merchantKey, version); | |||||
| ret = caller.bindCar(domain, etcpToken, carNumber, null, merchantNo, merchantKey, version); | |||||
| objret = JSON.parseObject(ret); | objret = JSON.parseObject(ret); | ||||
| if (objret.getIntValue("code") != 0) | if (objret.getIntValue("code") != 0) | ||||
| return; | return; | ||||
| @@ -257,7 +258,7 @@ public class ETCPUtil { | |||||
| carNumber = carNumber.substring(1, carNumber.length() -1); | carNumber = carNumber.substring(1, carNumber.length() -1); | ||||
| System.out.println(carNumber); | System.out.println(carNumber); | ||||
| // 停车费查询 | // 停车费查询 | ||||
| ret = caller.orderUnpay(appId, merchantNo, merchantKey, version, etcpToken, carNumber); | |||||
| ret = caller.orderUnpay(domain, appId, merchantNo, merchantKey, version, etcpToken, carNumber); | |||||
| System.out.println(ret); | System.out.println(ret); | ||||
| objret = JSON.parseObject(ret); | objret = JSON.parseObject(ret); | ||||
| if (objret.getIntValue("code") != 0) | if (objret.getIntValue("code") != 0) | ||||
| @@ -266,9 +267,9 @@ public class ETCPUtil { | |||||
| JSONObject payObj = payArr.getJSONObject(0); | JSONObject payObj = payArr.getJSONObject(0); | ||||
| String orderId = payObj.getString("orderId"); | String orderId = payObj.getString("orderId"); | ||||
| // 微信h5支付 | // 微信h5支付 | ||||
| ret = caller.orderPay(merchantNo, merchantKey, version, etcpToken, orderId, "http://test.cn", null); | |||||
| ret = caller.orderPay(domain, merchantNo, merchantKey, version, etcpToken, orderId, "http://test.cn", null); | |||||
| System.out.println(ret); | System.out.println(ret); | ||||
| */ | |||||
| // 车牌解绑测试 | // 车牌解绑测试 | ||||
| //caller.unbindCar(merchantNo, merchantKey, version, etcpToken, carNumber); | //caller.unbindCar(merchantNo, merchantKey, version, etcpToken, carNumber); | ||||
| @@ -556,7 +557,7 @@ public class ETCPUtil { | |||||
| String etcpToken, String orderId, | String etcpToken, String orderId, | ||||
| String returnUrl, String couponCode) { | String returnUrl, String couponCode) { | ||||
| // payType 支付方式(1 微信公众号内支付 2 支付宝 H5 支付 3 微信二维码 4 支付宝二维码 5 微信 H5)(非空) | // payType 支付方式(1 微信公众号内支付 2 支付宝 H5 支付 3 微信二维码 4 支付宝二维码 5 微信 H5)(非空) | ||||
| int payType = 5; | |||||
| int payType = 1; | |||||
| JSONObject jsonObject = new JSONObject(); | JSONObject jsonObject = new JSONObject(); | ||||
| jsonObject.put("token", etcpToken); | jsonObject.put("token", etcpToken); | ||||
| jsonObject.put("payType", payType); | jsonObject.put("payType", payType); | ||||