| @@ -16,8 +16,9 @@ import com.iformall.enums.EnumRentContractAppStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCouponMapper; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.car.ETCPUtil; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| import com.iformall.service.park.impl.etcp.ETCPUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -11,8 +11,9 @@ import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.car.CYFUtil; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| import com.iformall.service.park.impl.cyf.CYFUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -13,10 +13,11 @@ import com.iformall.enums.EnumETCPCode; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.impl.etcp.ETCPUtil; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import com.iformall.utils.car.ETCPUtil; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -9,8 +9,9 @@ import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -15,12 +15,12 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.entity.ParkNotifyParam; | |||
| import com.iformall.service.park.impl.cyf.CYFUtil; | |||
| import com.iformall.service.park.impl.etcp.ETCPUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import com.iformall.utils.car.CYFUtil; | |||
| import com.iformall.utils.car.ETCPUtil; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -13,8 +13,9 @@ import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.car.CYFUtil; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| import com.iformall.service.park.impl.cyf.CYFUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -13,8 +13,9 @@ import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.car.CYFUtil; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| import com.iformall.service.park.impl.cyf.CYFUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -17,7 +17,6 @@ import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.utils.car.BoLinkUtil; | |||
| @Service | |||
| public class BoLinkParkService extends BaseParkService implements ParkAdapterService { | |||
| @@ -1,4 +1,4 @@ | |||
| package com.iformall.utils.car; | |||
| package com.iformall.service.park.impl.bolink; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| @@ -10,8 +10,7 @@ import com.iformall.domain.vo.WxCarCYFVo; | |||
| import com.iformall.service.park.ParkCallBackAdapterService; | |||
| import com.iformall.service.park.entity.ParkNotifyParam; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.utils.car.CYFUtil; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| @@ -24,7 +24,6 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.utils.car.CYFUtil; | |||
| @Service | |||
| public class CYFParkService extends BaseParkService implements ParkAdapterService { | |||
| @@ -1,4 +1,4 @@ | |||
| package com.iformall.utils.car; | |||
| package com.iformall.service.park.impl.cyf; | |||
| import com.alibaba.fastjson.JSON; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| @@ -15,7 +15,6 @@ import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.utils.car.DaHuaUtil; | |||
| @Service | |||
| public class DaHuaParkService extends BaseParkService implements ParkAdapterService { | |||
| @@ -1,4 +1,4 @@ | |||
| package com.iformall.utils.car; | |||
| package com.iformall.service.park.impl.dahua; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.utils.AesUtils; | |||
| @@ -1,4 +1,4 @@ | |||
| package com.iformall.utils.car; | |||
| package com.iformall.service.park.impl.etcp; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| @@ -35,7 +35,6 @@ import com.iformall.service.WxCUserCarService; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.utils.car.ETCPUtil; | |||
| @Service | |||
| public class EtcpHelper { | |||
| @@ -0,0 +1,89 @@ | |||
| package com.iformall.service.park.impl.jieshun; | |||
| import java.text.ParseException; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.domain.vo.WxCarCYFVo; | |||
| import com.iformall.service.park.ParkCallBackAdapterService; | |||
| import com.iformall.service.park.entity.ParkNotifyParam; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.cyf.CYFUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| @Slf4j | |||
| @Service | |||
| public class JieShunParkCallbackService extends BaseParkService implements ParkCallBackAdapterService { | |||
| @Override | |||
| public ParkNotifyParam parseInNoticyParam(Object param) { | |||
| Map<String, Object> paramMap = (Map<String, Object>) param; | |||
| String carNumber = paramMap.get(CYFUtil.CYF_CAR_NUMBER).toString(); | |||
| String cyfParkId = paramMap.get(CYFUtil.CYF_PARK_ID).toString(); | |||
| String parkName = paramMap.get(CYFUtil.CYF_PARK_NAME).toString(); | |||
| String synId = paramMap.get(CYFUtil.CYF_SYN_ID).toString(); | |||
| String entranceTime = paramMap.get(CYFUtil.CYF_ENTRANCE_TIME).toString(); | |||
| ParkNotifyParam p = new ParkNotifyParam(); | |||
| p.setCarNumber(carNumber); | |||
| p.setParkId(cyfParkId); | |||
| p.setParkName(parkName); | |||
| p.setSynId(synId); | |||
| try { | |||
| p.setEntranceTime(CYFUtil.utcToLocal(entranceTime)); | |||
| } catch (ParseException e) { | |||
| log.error("cyf entranceTime format error",e); | |||
| return null; | |||
| } | |||
| return p; | |||
| } | |||
| @Override | |||
| public ParkNotifyParam parseOutNoticyParam(Object param) { | |||
| WxCarCYFVo vo = (WxCarCYFVo) param; | |||
| ParkNotifyParam p = new ParkNotifyParam(); | |||
| p.setCarNumber(vo.getPlate()); | |||
| p.setParkId(String.valueOf(vo.getParkingId())); | |||
| p.setParkName(vo.getRecordOrderId()); | |||
| p.setSynId(vo.getRecordOrderId()); | |||
| try { | |||
| p.setEntranceTime(TJDUtil.dateOutFormat.parse(vo.getInInfo().getTime())); | |||
| } catch (ParseException e) { | |||
| log.error("cyf entranceTime format error",e); | |||
| return null; | |||
| } | |||
| try { | |||
| p.setOutTime(TJDUtil.dateOutFormat.parse(vo.getOutInfo().getTime())); | |||
| } catch (ParseException e) { | |||
| log.error("cyf outTime format error",e); | |||
| return null; | |||
| } | |||
| p.setFee(String.valueOf(vo.getPayInfoList().getActualFee())); | |||
| return p; | |||
| } | |||
| @Override | |||
| public ParkNotifyParam parseUnbindNoticyParam(Object param) { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyParam parsePaidNoticyParam(Object param) { | |||
| Map vo = (Map) param; | |||
| ParkNotifyParam p = new ParkNotifyParam(); | |||
| p.setCarNumber((String) vo.get("plate")); | |||
| p.setParkId(String.valueOf(vo.get("parkId"))); | |||
| p.setParkOrderId((String) vo.get("orderNo")); | |||
| p.setSynId((String) vo.get("orderNo")); | |||
| p.setFee(vo.get("fee").toString()); | |||
| p.setPayTime((Date) vo.get("payTime")); | |||
| return p; | |||
| } | |||
| } | |||
| @@ -0,0 +1,152 @@ | |||
| package com.iformall.service.park.impl.jieshun; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @Service | |||
| public class JieShunParkService extends BaseParkService implements ParkAdapterService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| ParkHelper parkHelper; | |||
| JieShunUtil cyf = new JieShunUtil(); | |||
| @Override | |||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||
| return null; | |||
| } | |||
| @Override | |||
| public String bindCar(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||
| return jieshunBindCar(paramMap,park,member); | |||
| } | |||
| /** | |||
| * @description 车易付会员车辆信息注册 | |||
| * @Params [paramMap, park, wxCUser] | |||
| * @return com.iformall.common.ResultData | |||
| * @Author furunxin | |||
| * @Date 2020/7/8 下午10:23 | |||
| **/ | |||
| private String jieshunBindCar(Map<String, String> paramMap, WxPark park,WxCUserBasicInfo member) throws Exception { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| logger.error("carNumber为空"); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String token = objParams.getString("token"); | |||
| int feeGroupId = objParams.getIntValue("feeGroupId"); | |||
| String ret = cyf.registerCar(token,park.getNumber(),feeGroupId,park.getParkingId(),carNumber,null,member.getNickName()); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("result") == 1){ | |||
| return retObj.get("localPersonId").toString(); | |||
| }else { | |||
| logger.error("cyfBindCar error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| throw new MallinkException(ErrorCode.CAR_BIND_FAIL.getCode(), "绑车牌失败:"+msg); | |||
| //return new ResultData(, "绑车牌失败", retObj); | |||
| } | |||
| } | |||
| @Override | |||
| public void unbindCar(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||
| } | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| return cyfCarStopFee(paramMap, park); | |||
| } | |||
| private ResultData cyfCarStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String token = objParams.getString("token"); | |||
| String ret = cyf.getCarStopFee(token,park.getParkingId(),carNumber); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("result") == 1){ | |||
| return new ResultData(retObj); | |||
| }else { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| } | |||
| } | |||
| /** | |||
| * 优惠券支付流程:(1):调取openapi/getFee路径获取当前停车费,入参:plate,parkingId,token | |||
| (2):调用地址:http://wechat.cheyifu2016.com/fm-pay/#/transit?encodeURIComponent('orderNo=123&couponFee=2&actualFee=20') | |||
| 注: 详细参考接口文档参数 | |||
| * @param token | |||
| * @param orderNo | |||
| * @param couponFee | |||
| * @param actualFee | |||
| * @return | |||
| */ | |||
| @Override | |||
| public ResultData useCoupon(Map<String, String> paramMap, WxPark park, WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception{ | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String token = objParams.getString("token"); | |||
| //先获取停车费,然后再提交停车费 | |||
| String ret = cyf.getCarStopFee(token,park.getParkingId(),carNumber); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("result") == 1){ | |||
| String orderId = retObj.getString("orderId"); | |||
| if (StringUtils.isBlank(orderId)) { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "车易付停车费查询未返回订单编号:"+orderId); | |||
| } | |||
| if (!coupon.getUnit().equals(EnumCouponUnit.MONEY.getCode())) { | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "车易付只能支持金额券,不能使用小时券:"+orderId); | |||
| } | |||
| int fee = retObj.getInteger("fee"); | |||
| int amount = Integer.parseInt(coupon.getPriceStr()); | |||
| Map retmap = new HashMap(); | |||
| retmap.put("orderNo", orderId); | |||
| retmap.put("couponFee", amount); | |||
| retmap.put("actualFee", fee-amount); | |||
| return new ResultData(); | |||
| }else { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData getParkStatus(WxPark park) throws Exception{ | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,190 @@ | |||
| package com.iformall.service.park.impl.jieshun; | |||
| import com.alibaba.fastjson.JSON; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.http.Consts; | |||
| import org.apache.http.HttpEntity; | |||
| import org.apache.http.HttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| import org.apache.http.entity.StringEntity; | |||
| import org.apache.http.impl.client.CloseableHttpClient; | |||
| import org.apache.http.impl.client.HttpClients; | |||
| import org.apache.http.message.BasicHeader; | |||
| import org.apache.http.protocol.HTTP; | |||
| import org.apache.http.util.EntityUtils; | |||
| import java.io.IOException; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.time.LocalDateTime; | |||
| import java.time.format.DateTimeFormatter; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import java.util.TimeZone; | |||
| /** | |||
| * @author: furunxin | |||
| * @Date: 2020/7/1 17:16 | |||
| * @Description: 车易付接口对接参数类 | |||
| */ | |||
| @Slf4j | |||
| public class JieShunUtil { | |||
| public static final String CYF_PARK_ID = "parkingId"; | |||
| public static final String CYF_CAR_NUMBER = "plate"; | |||
| public static final String CYF_PARK_NAME = "parking"; | |||
| public static final String CYF_SYN_ID = "recordOrderId"; | |||
| public static final String CYF_ENTRANCE_TIME = "inTime"; | |||
| public static final String CYF_IS_RESULT = "result"; | |||
| public static final String CYF_ERR_MSG = "strError"; | |||
| public static final int CYF_SUC = 1; | |||
| public static final int CYF_ERR = 0; | |||
| //会员车辆信息注册接口地址 | |||
| public static final String REGISTER_CAR_URL = "http://open.cheyifu2016.com:8892/openapi/personCar"; | |||
| //获取停车费 | |||
| public static final String GET_CAR_STOPFEE = "http://open.cheyifu2016.com:8892/openapi/getFee"; | |||
| //解绑车辆 | |||
| public static final String UNBIND_CAR = "http://oepn.cheyifu2016.com:8892/openapi/personCar/delete"; | |||
| //优惠券缴费接口 | |||
| public static final String COUPON_FEE = "http://oepn.cheyifu2016.com:8892/openapi/couponFee"; | |||
| /** | |||
| * @description UTC时间转化为本地时间 | |||
| * @Params [utcTime] | |||
| * @return java.util.Date | |||
| * @Author furunxin | |||
| * @Date 2020/7/8 下午12:45 | |||
| **/ | |||
| public static Date utcToLocal(String seconds) throws ParseException { | |||
| String format = "yyyy-MM-dd HH:mm:ss"; | |||
| SimpleDateFormat sdf = new SimpleDateFormat(format); | |||
| String d = sdf.format(new Date(Long.valueOf(seconds+"000"))); | |||
| Date date=sdf.parse(d); | |||
| return date; | |||
| } | |||
| public static String getLocalDate(){ | |||
| LocalDateTime ldt = LocalDateTime.now(); | |||
| DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | |||
| String nowDate = ldt.format(dtf); | |||
| return nowDate; | |||
| } | |||
| /** | |||
| * @description 会员车辆信息注册 | |||
| * @Params [token, carport, feeGroupId, parkingId, plates, personId, personName] | |||
| * @return java.lang.String | |||
| * @Author furunxin | |||
| * @Date 2020/7/8 下午10:12 | |||
| **/ | |||
| public String registerCar(String token,int carport,int feeGroupId,String parkingId,String plates,Long personId,String personName){ | |||
| String[] plate = new String[1]; | |||
| plate[0] = plates; | |||
| Map<String, Object> paramMap = new HashMap<>(); | |||
| paramMap.put("token",token); | |||
| paramMap.put("parkingId",Integer.valueOf(parkingId)); | |||
| paramMap.put("beginTime",getLocalDate()); | |||
| paramMap.put("endTime",getLocalDate()); | |||
| paramMap.put("feeGroupId",feeGroupId); | |||
| paramMap.put("lotNumber",carport); | |||
| //paramMap.put("personId",personId); | |||
| paramMap.put("personName",personName); | |||
| paramMap.put("plates",plate); | |||
| String result = Proc(REGISTER_CAR_URL, paramMap); | |||
| return result; | |||
| } | |||
| /** | |||
| * @description 根据车牌号获取停车费 | |||
| * @Params [token, parkingId, plates] | |||
| * @return java.lang.String | |||
| * @Author furunxin | |||
| * @Date 2020/7/12 下午3:51 | |||
| **/ | |||
| public String getCarStopFee(String token,String parkingId,String plates){ | |||
| Map<String, Object> paramMap = new HashMap<>(); | |||
| paramMap.put("token ",token); | |||
| paramMap.put("parkingId",Integer.valueOf(parkingId)); | |||
| paramMap.put("plates",plates); | |||
| paramMap.put("carOutTime",0); | |||
| String result = Proc(GET_CAR_STOPFEE, paramMap); | |||
| return result; | |||
| } | |||
| /** | |||
| * @description 解绑车辆 | |||
| * @param token | |||
| * @param parkingId | |||
| * @param personId | |||
| * @return | |||
| */ | |||
| public String unbindCar(String token,String parkingId,String vendorPersonId) { | |||
| Map<String, Object> paramMap = new HashMap<>(); | |||
| paramMap.put("token ",token); | |||
| paramMap.put("parkingId",Integer.valueOf(parkingId)); | |||
| paramMap.put("personId",Integer.valueOf(vendorPersonId)); | |||
| String result = Proc(UNBIND_CAR, paramMap); | |||
| return result; | |||
| } | |||
| private static String Proc(String url, Map<String, Object> paramMap) { | |||
| CloseableHttpClient httpClient = HttpClients.createDefault(); | |||
| HttpPost httpPost = new HttpPost(url); | |||
| httpPost.addHeader(HTTP.CONTENT_TYPE,"application/json"); | |||
| httpPost.addHeader("Accept", "application/json"); | |||
| httpPost.addHeader("Accept-Encoding", "UTF-8"); | |||
| String jsonstr = JSON.toJSONString(paramMap); | |||
| log.info("请求报文:"+jsonstr); | |||
| try { | |||
| StringEntity se = new StringEntity(jsonstr, Consts.UTF_8); | |||
| se.setContentType("application/json"); | |||
| se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"UTF-8")); | |||
| httpPost.setEntity(se); | |||
| } catch (Exception e) { | |||
| log.error(e.getMessage()); | |||
| } | |||
| HttpResponse response = null; | |||
| try { | |||
| response = httpClient.execute(httpPost); | |||
| } catch (Exception e) { | |||
| log.error(e.getLocalizedMessage()); | |||
| } | |||
| String result = null; | |||
| //打印StatusLine | |||
| log.debug("StatusLine: " + response.getStatusLine()); | |||
| try{ | |||
| //获取实体 | |||
| HttpEntity httpEntity= response.getEntity(); | |||
| result = EntityUtils.toString(httpEntity, "UTF-8"); | |||
| log.debug(result); | |||
| } catch (Exception e) { | |||
| log.error(e.getLocalizedMessage()); | |||
| } | |||
| try { //关闭流并释放资源 | |||
| httpClient.close(); | |||
| } catch (IOException e) { | |||
| log.error(e.getLocalizedMessage()); | |||
| } | |||
| return result; | |||
| } | |||
| } | |||
| @@ -20,7 +20,6 @@ import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.utils.car.ShangAnUtil; | |||
| @Service | |||
| public class ShangAnParkService extends BaseParkService implements ParkAdapterService{ | |||
| @@ -1,4 +1,4 @@ | |||
| package com.iformall.utils.car; | |||
| package com.iformall.service.park.impl.shangan; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| @@ -32,7 +32,6 @@ import com.iformall.service.WxScoreRulesService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| @Service | |||
| public class TJDParkService extends BaseParkService implements ParkAdapterService { | |||
| @@ -1,4 +1,4 @@ | |||
| package com.iformall.utils.car; | |||
| package com.iformall.service.park.impl.tjd; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||