| @@ -85,6 +85,22 @@ public class WxCarController extends BaseController { | |||||
| return wxPark; | return wxPark; | ||||
| } | } | ||||
| @ApiOperation(value = "车厂初始化配置", notes = "返回\n{\"vendor\":integer}") | |||||
| @GetMapping("/parkInitConfig") | |||||
| public ResultData parkInitConfig() { | |||||
| // 1, get mall's park | |||||
| WxPark park = getCurrentPark(getTenantInfo()); | |||||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||||
| return new ResultData(); | |||||
| }else { | |||||
| try { | |||||
| return parkFactory.getParkService(park.getVendorType()).parkInitConfig(park); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,"车厂初始化配置失败。"+e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ApiOperation(value = "获取车场支持的厂家", notes = "返回\n{\"vendor\":integer}") | @ApiOperation(value = "获取车场支持的厂家", notes = "返回\n{\"vendor\":integer}") | ||||
| @GetMapping("/getVendor") | @GetMapping("/getVendor") | ||||
| public ResultData getVendor() { | public ResultData getVendor() { | ||||
| @@ -15,6 +15,8 @@ import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||||
| */ | */ | ||||
| public interface ParkAdapterService { | public interface ParkAdapterService { | ||||
| ResultData parkInitConfig(WxPark park) throws Exception; | |||||
| /** | /** | ||||
| * 停车场初始化登陆 | * 停车场初始化登陆 | ||||
| * @param paramMap | * @param paramMap | ||||
| @@ -21,6 +21,12 @@ import com.iformall.service.park.impl.BaseParkService; | |||||
| @Service | @Service | ||||
| public class BoLinkParkService extends BaseParkService implements ParkAdapterService { | public class BoLinkParkService extends BaseParkService implements ParkAdapterService { | ||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| // TODO Auto-generated method stub | |||||
| return null; | |||||
| } | |||||
| @Override | @Override | ||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | ||||
| return null; | return null; | ||||
| @@ -37,6 +37,11 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||||
| CYFUtil cyf = new CYFUtil(); | CYFUtil cyf = new CYFUtil(); | ||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| // TODO Auto-generated method stub | |||||
| return null; | |||||
| } | |||||
| @Override | @Override | ||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | ||||
| @@ -21,6 +21,12 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| // TODO Auto-generated method stub | |||||
| return null; | |||||
| } | |||||
| @Override | @Override | ||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | ||||
| return null; | return null; | ||||
| @@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | import com.iformall.domain.po.WxCUserBasicInfo; | ||||
| import com.iformall.domain.po.WxCarJSOrder; | import com.iformall.domain.po.WxCarJSOrder; | ||||
| @@ -90,6 +91,24 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||||
| RedisCacheUtils.cache(redisTemplate, "carStop:haikangtoken:"+park.getId(), token, 36000); | RedisCacheUtils.cache(redisTemplate, "carStop:haikangtoken:"+park.getId(), token, 36000); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| Map retMap = new HashMap(); | |||||
| try { | |||||
| JSONObject retObj = haikang.subscription(park, getCacheToken(park)); | |||||
| if (retObj.getIntValue("code") == 0){ | |||||
| return new ResultData(); | |||||
| }else { | |||||
| logger.error("haikangweishi parkInitConfig error. haikangResult: {}",retObj); | |||||
| String msg = retObj.getString("msg"); | |||||
| return new ResultData(retObj.getIntValue("code"), "当前海康威视停车场初始化配置失败:"+msg); | |||||
| } | |||||
| }catch(Exception e) { | |||||
| return new ResultData(Result.ERROR, "当前海康威视停车场初始化配置失败:"+e.getMessage()); | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | ||||
| return null; | return null; | ||||
| @@ -177,5 +196,6 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||||
| public ResultData getParkStatus(WxPark park) throws Exception{ | public ResultData getParkStatus(WxPark park) throws Exception{ | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -148,26 +148,33 @@ public class HaiKangWeiShiUtil { | |||||
| /** | /** | ||||
| * 消息订阅 3.1.8 | * 消息订阅 3.1.8 | ||||
| * * 这个接口需要你们实现的时候规定下: | |||||
| 1、POST格式, | |||||
| 2、接口返回参数JSON格式:{errcode:0, errmsg: "success",data:null} | |||||
| 3、接口建议接收到过车事件,立即返回接收成功 | |||||
| 我这边根据这个 0 状态来判断你们是否接收成功,如果没成功,我这边会重发3次的 | |||||
| * | |||||
| * @param clientId | * @param clientId | ||||
| * @param clientSecret | * @param clientSecret | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public JSONObject subscription(WxPark wxPark,String couponNo,String carNumber,String orderNo,String token){ | |||||
| public JSONObject subscription(WxPark wxPark,String token){ | |||||
| String vendroParams = wxPark.getVendorParams(); | String vendroParams = wxPark.getVendorParams(); | ||||
| JSONObject vp = JSON.parseObject(vendroParams); | JSONObject vp = JSON.parseObject(vendroParams); | ||||
| ArrayList<NameValuePair> list = new ArrayList<NameValuePair>(); | ArrayList<NameValuePair> list = new ArrayList<NameValuePair>(); | ||||
| list.add(new BasicNameValuePair("partnerAppKey", vp.getString("AppKey")));//商户编号 | list.add(new BasicNameValuePair("partnerAppKey", vp.getString("AppKey")));//商户编号 | ||||
| list.add(new BasicNameValuePair("projectId", vp.getString("projectId"))); | list.add(new BasicNameValuePair("projectId", vp.getString("projectId"))); | ||||
| list.add(new BasicNameValuePair("eventTypes", carNumber)); | |||||
| list.add(new BasicNameValuePair("eventTypes", "[\"771760131\",\"771760134\"]")); | |||||
| list.add(new BasicNameValuePair("subUrl", vp.getString("subUrl"))); | list.add(new BasicNameValuePair("subUrl", vp.getString("subUrl"))); | ||||
| String retCode = ProcBussiness(SUBSCRIPTION, list,token); | String retCode = ProcBussiness(SUBSCRIPTION, list,token); | ||||
| if (StringUtils.isBlank(retCode)) { | if (StringUtils.isBlank(retCode)) { | ||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikang useCoupon error. has no result"); | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikang subscription error. has no result"); | |||||
| } | } | ||||
| JSONObject result = JSON.parseObject(retCode); | JSONObject result = JSON.parseObject(retCode); | ||||
| if (result.getInteger("code") != 0 ) { | if (result.getInteger("code") != 0 ) { | ||||
| String message = result.getString("msg"); | String message = result.getString("msg"); | ||||
| throw new MallinkException(result.getInteger("code"), "haikang useCoupon error."+message); | |||||
| throw new MallinkException(result.getInteger("code"), "haikang subscription error."+message); | |||||
| } | } | ||||
| return result; | return result; | ||||
| } | } | ||||
| @@ -101,7 +101,6 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||||
| RedisCacheUtils.cache(redisTemplate, "carStop:jieshuntoken:"+park.getId(), token, 3600); | RedisCacheUtils.cache(redisTemplate, "carStop:jieshuntoken:"+park.getId(), token, 3600); | ||||
| } | } | ||||
| /** | /** | ||||
| * 先去捷顺注册,调用登陆获取令牌,然后根据令牌调用别的接口 | * 先去捷顺注册,调用登陆获取令牌,然后根据令牌调用别的接口 | ||||
| * http://ap.jieshun.cn:9088/apply/ 注册信息地址 fumao/iformall2020 | * http://ap.jieshun.cn:9088/apply/ 注册信息地址 fumao/iformall2020 | ||||
| @@ -117,6 +116,13 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||||
| 3、所有接口要带车牌的一律带横杠。格式如:粤-B12345。 | 3、所有接口要带车牌的一律带横杠。格式如:粤-B12345。 | ||||
| 4、无效的数据签名是指sn加密方式不对。sn加密方式是对p+signkey进行Md5加密,加密后的字符串大写。 | 4、无效的数据签名是指sn加密方式不对。sn加密方式是对p+signkey进行Md5加密,加密后的字符串大写。 | ||||
| */ | */ | ||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| // TODO Auto-generated method stub | |||||
| return null; | |||||
| } | |||||
| @Override | @Override | ||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | ||||
| return null; | return null; | ||||
| @@ -29,6 +29,11 @@ public class ShangAnParkService extends BaseParkService implements ParkAdapterSe | |||||
| @Autowired | @Autowired | ||||
| WxCouponOrderService wxCouponOrderService; | WxCouponOrderService wxCouponOrderService; | ||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| // TODO Auto-generated method stub | |||||
| return null; | |||||
| } | |||||
| @Override | @Override | ||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | ||||
| @@ -55,6 +55,11 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||||
| @Autowired | @Autowired | ||||
| WxCouponService couponService; | WxCouponService couponService; | ||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| // TODO Auto-generated method stub | |||||
| return null; | |||||
| } | |||||
| @Override | @Override | ||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) { | ||||
| @@ -249,5 +254,4 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||||
| public ResultData getParkStatus(WxPark park) { | public ResultData getParkStatus(WxPark park) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| } | } | ||||