releaserelease_toaliyun_real
| @@ -101,17 +101,14 @@ public class WxCarController extends BaseController { | |||
| // 2. get vendor params | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| return initForEtcp(paramMap, user, park); | |||
| } else if (park.getVendorType().equals(EnumCarVendor.CAR_TJD.getCode())) { | |||
| // TJD不需要共同登录 | |||
| Map resultMap = new HashMap(); | |||
| resultMap.put("vendor", EnumCarVendor.CAR_TJD.getCode()); | |||
| return new ResultData(resultMap); | |||
| } else if (park.getVendorType().equals(EnumCarVendor.CAR_DAHUA.getCode())) { | |||
| } else if (park.getVendorType().equals(EnumCarVendor.CAR_TJD.getCode()) || | |||
| park.getVendorType().equals(EnumCarVendor.CAR_DAHUA.getCode()) || | |||
| park.getVendorType().equals(EnumCarVendor.CAR_SHANGAN.getCode()) || | |||
| park.getVendorType().equals(EnumCarVendor.CAR_BOLINK.getCode())) { | |||
| Map resultMap = new HashMap(); | |||
| resultMap.put("vendor", EnumCarVendor.CAR_DAHUA.getCode()); | |||
| resultMap.put("vendor", park.getVendorType()); | |||
| return new ResultData(resultMap); | |||
| } | |||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "登录失败"); | |||
| } | |||
| @@ -371,7 +368,7 @@ public class WxCarController extends BaseController { | |||
| if (e != null) return e; | |||
| return new ResultData(retObj); | |||
| } else { | |||
| return new ResultData(ErrorCode.TJD_BIND_FAIL.getCode(), "绑车牌失败", retObj); | |||
| return new ResultData(ErrorCode.CAR_BIND_FAIL.getCode(), "绑车牌失败", retObj); | |||
| } | |||
| } | |||
| @@ -538,7 +535,7 @@ public class WxCarController extends BaseController { | |||
| return new ResultData(); | |||
| } else { | |||
| return new ResultData(ErrorCode.TJD_UNBIND_FAIL, "解绑车牌失败"); | |||
| return new ResultData(ErrorCode.CAR_UNBIND_FAIL, "解绑车牌失败"); | |||
| } | |||
| } | |||
| return null; | |||
| @@ -721,9 +718,10 @@ public class WxCarController extends BaseController { | |||
| * 优免券不可退 | |||
| */ | |||
| @ApiOperation(value = "停车券使用", | |||
| notes = "ETCP:={\"etcpToken\":\"string(ETCP专用)\",\"carNumber\":\"string\",\"couponOrderId\"=\"String\"},输出\n{}\n" + | |||
| "TJD:{\"carNumber\":\"string\",\"tradeId\":\"string\",\"accountId\":\"string\",\"couponOrderId\":\"string\"}" + | |||
| "ShangAn:{\"carNumber\":\"string\",\"couponOrderId\":\"string\"}" | |||
| notes = "ETCP:={\"etcpToken\":\"string(ETCP专用)\",\"carNumber\":\"string\",\"couponOrderId\"=\"String\"}\n" + | |||
| "TJD:{\"carNumber\":\"string\",\"tradeId\":\"string\",\"accountId\":\"string\",\"couponOrderId\":\"string\"}\n" + | |||
| "ShangAn:{\"carNumber\":\"string\",\"couponOrderId\":\"string\"}\n" + | |||
| "BoLink:{\"carNumber\":\"string\",\"orderId\":\"string\",\"couponOrderId\":\"string\"}\n" | |||
| ) | |||
| @PostMapping("/getCoupon") | |||
| public ResultData getCoupon(@RequestBody Map<String, String> paramMap) { | |||
| @@ -842,7 +840,7 @@ public class WxCarController extends BaseController { | |||
| if (retObj.getString(TJDUtil.TJD_RETURN_CODE).equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||
| return new ResultData(); | |||
| } else { | |||
| return new ResultData(ErrorCode.TJD_DEDUCE_FEE_FAIL.getCode(), "停车费抵扣失败"); | |||
| return new ResultData(ErrorCode.CAR_DEDUCE_FEE_FAIL.getCode(), "停车费抵扣失败"); | |||
| } | |||
| } else if (park.getVendorType().equals(EnumCarVendor.CAR_SHANGAN.getCode())) { | |||
| WxCoupon coupon = couponService.getById(userCar.getCouponId()); | |||
| @@ -876,6 +874,40 @@ public class WxCarController extends BaseController { | |||
| } else { | |||
| return new ResultData(ErrorCode.SHANGAN_COUPON_FAIL.getCode(), retObj.getString(ShangAnUtil.SHANGAN_ERROR_CODE)); | |||
| } | |||
| } else if (park.getVendorType().equals(EnumCarVendor.CAR_BOLINK.getCode())) { | |||
| String orderId = paramMap.get("orderId"); | |||
| if (StringUtils.isBlank(orderId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId为空"); | |||
| } | |||
| WxCoupon coupon = couponService.getById(userCar.getCouponId()); | |||
| if (coupon == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | |||
| } | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString(BoLinkUtil.BOLINK_URL); | |||
| String comid = objParams.getString(BoLinkUtil.BOLINK_COMID); | |||
| String unionId = objParams.getString(BoLinkUtil.BOLINK_UNION_ID); | |||
| String key = objParams.getString(BoLinkUtil.BOLINK_KEY); | |||
| String amount = ""; | |||
| if (coupon.getUnit().equals(EnumCouponUnit.MONEY.getCode())) { | |||
| amount = coupon.getPriceStr(); | |||
| } else { | |||
| amount = String.valueOf(coupon.getPrice()* 60); | |||
| } | |||
| String ret = BoLinkUtil.couponSend(url, comid, unionId, key, | |||
| carNumber, | |||
| orderId, | |||
| coupon.getUnit().toString(), amount); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| JSONObject dataObj = retObj.getJSONObject(BoLinkUtil.BOLINK_DATA); | |||
| if (dataObj.getIntValue(BoLinkUtil.BOLINK_STATE) == BoLinkUtil.BOLINK_SUCCESS) { | |||
| return new ResultData(dataObj); | |||
| } else { | |||
| return new ResultData(ErrorCode.CAR_DEDUCE_FEE_FAIL); | |||
| } | |||
| } | |||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "优免券领取失败"); | |||
| } | |||
| @@ -151,17 +151,17 @@ public enum ErrorCode{ | |||
| ETCP_QUAN_SEND_FAIL(2056, "ETCP优免券发放失败"), | |||
| ETCP_CMD_FAIL(2057, "ETCP网络异常"), | |||
| TJD_BIND_FAIL(2060,"TJD绑车牌失败"), | |||
| TJD_UNBIND_FAIL(2061,"TJD解绑车牌失败"), | |||
| TJD_STOP_FEE_FAIL(2062, "TJD停车费失败"), | |||
| TJD_DEDUCE_FEE_FAIL(2063, "TJD停车费抵扣失败"), | |||
| CAR_BIND_FAIL(2060,"绑车牌失败"), | |||
| CAR_UNBIND_FAIL(2061,"解绑车牌失败"), | |||
| CAR_CMD_FAIL(2062, "网络异常"), | |||
| CAR_DEDUCE_FEE_FAIL(2063, "停车费抵扣失败"), | |||
| TJD_STOP_FEE_FAIL(2064, "TJD停车费失败"), | |||
| SHANGAN_COUPON_FAIL(2065, "优惠券失败"), | |||
| SHANGAN_CMD_FAIL(2066, "尚安网络异常"), | |||
| BOLINK_SIGN_ERR(2068, "泊链签名错误"), | |||
| BOLINK_STOP_FEE_FAIL(2069, "泊链停车费获取失败"), | |||
| BOLINK_CMD_FAIL(2066, "泊链网络异常"), | |||
| BOLINK_SIGN_ERR(2066, "泊链签名错误"), | |||
| BOLINK_STOP_FEE_FAIL(2067, "泊链停车费获取失败"), | |||
| /** | |||
| * 游戏 | |||
| @@ -56,7 +56,12 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ | |||
| wxCuserFloatingLayerQuery.setUserId(byOpenId.getId()); | |||
| WxCuserFloatingLayer wxCuserFloatingLayer = wxCuserFloatingLayerMapper.selectOne(new QueryWrapper<>(wxCuserFloatingLayerQuery)); | |||
| if (wxCuserFloatingLayer == null) { | |||
| saveCuserFloatingLayer(byOpenId); | |||
| try { | |||
| saveCuserFloatingLayer(byOpenId); | |||
| } catch (Exception e) { | |||
| logger.error("用户 {} 已弹过浮层",byOpenId.getId()); | |||
| return null; | |||
| } | |||
| return getWxFloatingLayer(byOpenId); | |||
| } | |||
| return null; | |||
| @@ -3,6 +3,7 @@ package com.iformall.utils.car; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.exception.MallinkException; | |||
| import org.apache.http.Consts; | |||
| import org.apache.http.HttpEntity; | |||
| @@ -21,6 +22,7 @@ import java.io.IOException; | |||
| import java.security.MessageDigest; | |||
| import java.security.NoSuchAlgorithmException; | |||
| import java.util.Base64; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @@ -35,8 +37,13 @@ public class BoLinkUtil { | |||
| public static final String BOLINK_UNION_ID = "union_id"; | |||
| public static final String BOLINK_KEY = "key"; | |||
| public static final String BOLINK_CAR_NUMBER = "car_number"; | |||
| public static final String BOLINK_ORDER_ID = "order_id"; | |||
| public static final String BOLINK_PAY_TIME = "pay_time"; | |||
| public static final String BOLINK_ACT_TOTAL = "act_total"; | |||
| public static final String BOLINK_DEDUCTION_TIME = "deduction_time"; | |||
| public static final String BOLINK_DEDUCTION_MONEY = "deduction_money"; | |||
| public static final String URL = "https://yun.bolink.club/zld/queryorderprice"; | |||
| public static final String URL = "https://yun.bolink.club"; | |||
| public static final String COMID = "30536"; | |||
| public static final String UNION_ID = "200389"; | |||
| public static final String KEY = "Y29PZH9KDT1V7Y1E"; | |||
| @@ -101,8 +108,10 @@ public class BoLinkUtil { | |||
| return false; | |||
| } | |||
| public static String getStopFee(String url, String comid, String unionId, String key, String carNumber) { | |||
| Map<String, String> params = new HashMap<>(); | |||
| public static String getStopFee(String baseUrl, String comid, String unionId, String key, String carNumber) { | |||
| String stopFeeUrl = "/zld/queryorderprice"; | |||
| String url = baseUrl + stopFeeUrl; | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put(BOLINK_COMID, comid); | |||
| params.put(BOLINK_UNION_ID, unionId); | |||
| params.put(BOLINK_CAR_NUMBER, carNumber); | |||
| @@ -115,10 +124,10 @@ public class BoLinkUtil { | |||
| try { | |||
| String result = Proc(url, key, params); | |||
| if(result == null) { | |||
| throw new MallinkException(ErrorCode.BOLINK_CMD_FAIL); | |||
| throw new MallinkException(ErrorCode.CAR_CMD_FAIL); | |||
| } | |||
| if(checkRespFailed(result)) { | |||
| throw new MallinkException(ErrorCode.BOLINK_CMD_FAIL); | |||
| throw new MallinkException(ErrorCode.CAR_CMD_FAIL); | |||
| } | |||
| return result; | |||
| } catch (Exception e) { | |||
| @@ -126,7 +135,47 @@ public class BoLinkUtil { | |||
| } | |||
| } | |||
| private static String Proc(String url, String key, Map<String, String> paramMap) { | |||
| public static String couponSend(String baseUrl, String comid, String unionId, String key, | |||
| String carNumber, | |||
| String orderId, | |||
| String unit, String amount) { | |||
| String couponUrl = "/zld/openservice/paynoticetopark"; | |||
| String url = baseUrl + couponUrl; | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put(BOLINK_COMID, comid); | |||
| params.put(BOLINK_UNION_ID, unionId); | |||
| params.put(BOLINK_CAR_NUMBER, carNumber); | |||
| params.put(BOLINK_ORDER_ID, orderId); | |||
| params.put(BOLINK_PAY_TIME, new Date().getTime()); | |||
| params.put(BOLINK_ACT_TOTAL, "0"); | |||
| if (unit.equals(EnumCouponUnit.MONEY.getCode())) { | |||
| // 金额 | |||
| params.put(BOLINK_DEDUCTION_MONEY, amount); | |||
| } else { | |||
| // 小时 | |||
| params.put(BOLINK_DEDUCTION_TIME, amount); | |||
| } | |||
| try { | |||
| String sign = getSign(key, JSON.toJSONString(params)); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| try { | |||
| String result = Proc(url, key, params); | |||
| if(result == null) { | |||
| throw new MallinkException(ErrorCode.CAR_CMD_FAIL); | |||
| } | |||
| if(checkRespFailed(result)) { | |||
| throw new MallinkException(ErrorCode.CAR_CMD_FAIL); | |||
| } | |||
| return result; | |||
| } catch (Exception e) { | |||
| return null; | |||
| } | |||
| } | |||
| private static String Proc(String url, String key, Map<String, Object> paramMap) { | |||
| CloseableHttpClient httpClient = HttpClients.createDefault(); | |||
| HttpPost httpPost = new HttpPost(url); | |||
| @@ -111,10 +111,10 @@ public class ShangAnUtil { | |||
| try { | |||
| String result = Proc(url, key, parkNumber, params); | |||
| if(result == null) { | |||
| throw new MallinkException(ErrorCode.SHANGAN_CMD_FAIL); | |||
| throw new MallinkException(ErrorCode.CAR_CMD_FAIL); | |||
| } | |||
| if(checkRespFailed(result)) { | |||
| throw new MallinkException(ErrorCode.SHANGAN_CMD_FAIL); | |||
| throw new MallinkException(ErrorCode.CAR_CMD_FAIL); | |||
| } | |||
| return result; | |||
| } catch (Exception e) { | |||