| @@ -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; | |||
| @@ -39,5 +39,4 @@ public class PushLimitController extends BaseController { | |||
| pushLimitService.saveOrUpdate(pushLimit); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCardSpendVo; | |||
| import com.iformall.domain.vo.WxCardVo; | |||
| import com.iformall.enums.EnumMerchantSubsidySource; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxCardInfoService; | |||
| import com.iformall.service.WxCardSpendService; | |||
| @@ -105,6 +106,9 @@ public class WxCardPayController extends BaseController { | |||
| wxCardSpendVo.setPayStatusS(tmpList); | |||
| } | |||
| } | |||
| List<Integer> sources = new ArrayList<Integer>(); | |||
| sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||
| wxCardSpendVo.setSources(sources); | |||
| final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -1,9 +1,5 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.extension.api.R; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| @@ -11,15 +7,12 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.impl.etcp.EtcpHelper; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.utils.car.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -32,7 +25,6 @@ import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -99,7 +99,7 @@ public class WxCouponPasswordController extends BaseController { | |||
| WxOrder order = orderService.saveFreeOrderForCoupon(member, coupon, null, formId, couponPassword.getId(),payWay); | |||
| } catch (MallinkException e) { | |||
| setCouponPasswordStatus(couponPassword, EnumCouponPasswordStatus.getEnum(pwdStatus)); | |||
| logger.error(e.getMessage()); | |||
| logger.error(e.getMessage(),e); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| setCouponPasswordStatus(couponPassword, EnumCouponPasswordStatus.getEnum(pwdStatus)); | |||
| @@ -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; | |||
| @@ -1,6 +1,9 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import java.util.List; | |||
| import com.iformall.domain.po.WxCardSpend; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -35,5 +38,8 @@ public class WxCardSpendVo extends WxCardSpend { | |||
| @Excel(name = "手机", width = 20, orderNum = "2") | |||
| @io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone") | |||
| private String ouPhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="账单来源查询条件",name="ouPhone") | |||
| private List<Integer> sources; | |||
| } | |||
| @@ -42,5 +42,4 @@ public interface PushLimitService { | |||
| * @return | |||
| */ | |||
| boolean checkCoupon(TenantEntity tenantEntity, Long cUserId, Long couponId); | |||
| } | |||
| @@ -181,7 +181,8 @@ public class PushLimitServiceImpl implements PushLimitService { | |||
| // 4. check 每人多少天内不会重复收到一张券 | |||
| if (pushLimit.getCouponDay() > 0) { | |||
| params.put("couponId", couponId); | |||
| params.put("dayNum", pushLimit.getCouponDay()-1); | |||
| params.put("beginDate", DateUtils.getTimeBefore(pushLimit.getCouponDay()-1, curDate)); | |||
| params.put("endDate", curDate); | |||
| int countForUserCoupon = wxCouponActionLogMapper.getCountByUserAndCoupon(params); | |||
| if (countForUserCoupon >= 1) { | |||
| String errMsg = "每人" + pushLimit.getCouponDay() + "天领一张券已到疲劳度上限"; | |||
| @@ -245,30 +245,31 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| } | |||
| } | |||
| if (payAccount.checkShare()) { | |||
| // 分账 | |||
| if (cardInfo.getSaleAmount() > 0) { | |||
| // 9. 只有有价卡才能分账 | |||
| try { | |||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId(),payWay.getCode()); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | |||
| ErrorCode.PROFIT_SHARING_TIME_EXPIRED.getCode() == e.getErrorCode()) { | |||
| // 分账已到20次限制,后面只记录,不分账 | |||
| // 分账已过期,后面只记录,不分账 | |||
| logger.error("分账已到20次限制,后面只记录,无法分账"); | |||
| try { | |||
| creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | |||
| } catch (Exception ex) { | |||
| logger.error("分账已到20次限制,记录到结算表失败"); | |||
| } | |||
| } else { | |||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| //卡不再调用微信分账 | |||
| // if (payAccount.checkShare()) { | |||
| // // 分账 | |||
| // if (cardInfo.getSaleAmount() > 0) { | |||
| // // 9. 只有有价卡才能分账 | |||
| // try { | |||
| // shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId(),payWay.getCode()); | |||
| // } catch (MallinkException e) { | |||
| // logger.error(e.getMessage()); | |||
| // if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | |||
| // ErrorCode.PROFIT_SHARING_TIME_EXPIRED.getCode() == e.getErrorCode()) { | |||
| // // 分账已到20次限制,后面只记录,不分账 | |||
| // // 分账已过期,后面只记录,不分账 | |||
| // logger.error("分账已到20次限制,后面只记录,无法分账"); | |||
| // try { | |||
| // creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | |||
| // } catch (Exception ex) { | |||
| // logger.error("分账已到20次限制,记录到结算表失败"); | |||
| // } | |||
| // } else { | |||
| // throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||
| // } | |||
| // } | |||
| // } | |||
| // } else { | |||
| // 有价储值卡消费时,如果未启用分账,金额也记入补贴表,可能会导致查询错误, TODO | |||
| if (cardInfo.getSaleAmount() > 0 && payment > 0) { | |||
| try { | |||
| @@ -277,7 +278,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| logger.error("记录到结算表失败"); | |||
| } | |||
| } | |||
| } | |||
| // } | |||
| // 成长值 | |||
| try { | |||
| @@ -2050,7 +2050,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| try { | |||
| createCouponOrder(record, user, coupon, couponPasswordId,payWay); | |||
| } catch (Exception e) { | |||
| logger.error("couponOrder失败:" + e.getMessage()); | |||
| logger.error("couponOrder失败:" + e.getMessage(),e); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); | |||
| } | |||
| return record; | |||
| @@ -13,6 +13,8 @@ import com.iformall.service.park.impl.bolink.BoLinkParkService; | |||
| import com.iformall.service.park.impl.cyf.CYFParkCallbackService; | |||
| import com.iformall.service.park.impl.cyf.CYFParkService; | |||
| import com.iformall.service.park.impl.dahua.DaHuaParkService; | |||
| import com.iformall.service.park.impl.jieshun.JieShunParkCallbackService; | |||
| import com.iformall.service.park.impl.jieshun.JieShunParkService; | |||
| import com.iformall.service.park.impl.shangan.ShangAnParkService; | |||
| import com.iformall.service.park.impl.tjd.TJDParkService; | |||
| @@ -29,9 +31,13 @@ public class ParkFactory { | |||
| ShangAnParkService shangAnService; | |||
| @Autowired | |||
| TJDParkService tjdService; | |||
| @Autowired | |||
| JieShunParkService jieshunService; | |||
| @Autowired | |||
| CYFParkCallbackService cyfCallbackService; | |||
| @Autowired | |||
| JieShunParkCallbackService jieshunCallBackService; | |||
| private Map<Integer,ParkAdapterService> parkServiceMap ; | |||
| private Map<Integer,EnumCarVendor> enumMap ; | |||
| @@ -48,6 +54,7 @@ public class ParkFactory { | |||
| parkServiceMap.put(EnumCarVendor.CAR_DAHUA.getCode(), daHuaService); | |||
| parkServiceMap.put(EnumCarVendor.CAR_SHANGAN.getCode(), shangAnService); | |||
| parkServiceMap.put(EnumCarVendor.CAR_TJD.getCode(), tjdService); | |||
| parkServiceMap.put(EnumCarVendor.CAR_JIESHUN.getCode(), jieshunService); | |||
| return parkServiceMap; | |||
| } | |||
| @@ -69,6 +76,8 @@ public class ParkFactory { | |||
| } | |||
| callBackServiceMap = new ConcurrentHashMap<Integer, ParkCallBackAdapterService>(); | |||
| callBackServiceMap.put(EnumCarVendor.CAE_CYF.getCode(), cyfCallbackService); | |||
| callBackServiceMap.put(EnumCarVendor.CAR_JIESHUN.getCode(), jieshunCallBackService); | |||
| return callBackServiceMap; | |||
| } | |||
| @@ -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; | |||
| @@ -316,6 +316,8 @@ | |||
| <result column="onick_name" jdbcType="VARCHAR" property="onickName"/> | |||
| <result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/> | |||
| <result column="source" jdbcType="INTEGER" property="source"/> | |||
| </resultMap> | |||
| <sql id="allVoColumns"> | |||
| @@ -323,7 +325,7 @@ | |||
| cs.`card_remain_amount`,cs.`card_before_amount`,cs.`card_remain_real_amount`,cs.`card_before_real_amount`, | |||
| cs.`create_date`,cs.`update_date`, cs.`pay_status`, | |||
| m.`name`, c.`title`, | |||
| ms.`subsidy`,ms.`real_subsidy`,ms.`status`, | |||
| ms.`subsidy`,ms.`real_subsidy`,ms.`status` | |||
| ou.`nick_name` as onick_name, ou.`phone` as ou_phone | |||
| </sql> | |||
| @@ -383,6 +385,14 @@ | |||
| <if test=" null != status "> | |||
| and ms.`status` = #{status} | |||
| </if> | |||
| <if test=" null != sources "> | |||
| and ms.source in | |||
| <foreach collection="sources" index="index" item="sourceItem" open="(" separator="," close=")"> | |||
| #{sourceItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ouPhone and '' != ouPhone "> | |||
| and ou.`phone` = #{ouPhone} | |||
| </if> | |||
| @@ -311,7 +311,7 @@ | |||
| </if> | |||
| AND o.c_user_id = #{cUserId} | |||
| AND a.coupon_id = #{couponId} | |||
| AND date(a.create_time) between date_sub(curdate(),interval #{dayNum} day) and curdate() | |||
| AND date(a.create_time) between #{beginDate} and #{endDate} | |||
| </select> | |||
| <select id="getCountByUserAndCouponAndDate" resultType="java.lang.Integer" parameterType="hashmap"> | |||
| @@ -103,7 +103,7 @@ | |||
| c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.`valid_days`,c.`detail`,c.`price`,c.`unit`,c.`remain_inventory`,c.`inventory`, | |||
| c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`, | |||
| c.`press_limit_num`, c.`press_limit_hours`, c.`auto_refund`,c.`credit_price`,c.`credit_refund`,c.`put_apply_status`,c.`stock_apply_status`,c.`cancle_apply_status`, | |||
| c.`conditions`,c.approval_type,c.content_type,c.source_type | |||
| c.`conditions`,c.approval_type,c.content_type,c.source_type,c.password_support | |||
| </sql> | |||
| <sql id="statusColumns"> | |||
| @@ -30,6 +30,7 @@ import java.math.BigDecimal; | |||
| import java.sql.Date; | |||
| import java.sql.Time; | |||
| import java.sql.Timestamp; | |||
| import java.util.HashMap; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -202,8 +203,21 @@ public class ShardingSpherePlugin implements MyBatisPlus { | |||
| }else { | |||
| Map m = (Map) parameterObject; | |||
| for (Iterator it = m.keySet().iterator();it.hasNext();) { | |||
| o = m.get(it.next()); | |||
| Object v = getValue(column,o,parentChainMap); | |||
| Object ito = it.next(); | |||
| Object value = m.get(ito); | |||
| if(isBasicTypeValue(value)) { | |||
| if (ito instanceof String) { | |||
| String itoStr = (String) ito; | |||
| if( itoStr.equals(column) || itoStr.equals(field)) { | |||
| return value; | |||
| }else { | |||
| continue; | |||
| } | |||
| }else { | |||
| continue; | |||
| } | |||
| } | |||
| Object v = getValue(column,value,parentChainMap); | |||
| if (null != v) { | |||
| return v; | |||
| } | |||