| @@ -11,7 +11,9 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxCouponOrderMapper; | import com.iformall.mapper.WxCouponOrderMapper; | ||||
| import com.iformall.mapper.WxCouponSendConfigMapper; | import com.iformall.mapper.WxCouponSendConfigMapper; | ||||
| import com.iformall.mapper.WxCouponSendMapper; | import com.iformall.mapper.WxCouponSendMapper; | ||||
| import com.iformall.mapper.WxMerchantBUserMapper; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -41,6 +43,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponOrderMapper wxCouponOrderMapper; | WxCouponOrderMapper wxCouponOrderMapper; | ||||
| @Autowired | @Autowired | ||||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||||
| @Autowired | |||||
| PushLimitService pushLimitService; | PushLimitService pushLimitService; | ||||
| @@ -80,24 +84,55 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| JSONObject jo = JSONObject.parseObject(wxCouponSend.getConditions()); | JSONObject jo = JSONObject.parseObject(wxCouponSend.getConditions()); | ||||
| if (wxOrder.getProductId().equals(jo.getLong("id"))) | if (wxOrder.getProductId().equals(jo.getLong("id"))) | ||||
| return true; | return true; | ||||
| else | |||||
| return false; | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return false; | |||||
| logger.error("交易发券条件判断错误:ID=" + wxCouponSend.getId() + e.getMessage()); | |||||
| } | } | ||||
| return false; | |||||
| } else if (wxCouponSend.getSendType().equals(EnumCouponSendSendType.CAR_STOP.getCode())){ | } else if (wxCouponSend.getSendType().equals(EnumCouponSendSendType.CAR_STOP.getCode())){ | ||||
| try { | |||||
| JSONObject jo = JSONObject.parseObject(wxCouponSend.getConditions()); | |||||
| if (DateUtils.isInDate(new Date(), jo.getString("startTime"), jo.getString("endTime"))){ | |||||
| return true; | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("停车发券条件判断错误:ID=" + wxCouponSend.getId() + e.getMessage()); | |||||
| } | |||||
| return true; | |||||
| return false; | |||||
| }else if (wxCouponSend.getSendType().equals(EnumCouponSendSendType.B_MICROPAY.getCode())){ | }else if (wxCouponSend.getSendType().equals(EnumCouponSendSendType.B_MICROPAY.getCode())){ | ||||
| WxOrder wxOrder = (WxOrder)param; | |||||
| try { | |||||
| JSONObject jo = JSONObject.parseObject(wxCouponSend.getConditions()); | |||||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(wxOrder.getProductId()); | |||||
| if (wxMerchantBUser.getMerchantId()!= null | |||||
| && wxMerchantBUser.getMerchantId().equals(jo.getLong("id"))) { | |||||
| return true; | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("收银发券条件判断错误:ID=" + wxCouponSend.getId() + e.getMessage()); | |||||
| } | |||||
| return false; | |||||
| return true; | |||||
| }else if (wxCouponSend.getSendType().equals(EnumCouponSendSendType.COUPON_VERIFY.getCode())){ | }else if (wxCouponSend.getSendType().equals(EnumCouponSendSendType.COUPON_VERIFY.getCode())){ | ||||
| WxOrder wxOrder = (WxOrder)param; | |||||
| try { | |||||
| JSONObject jo = JSONObject.parseObject(wxCouponSend.getConditions()); | |||||
| if (wxOrder.getProductId().equals(jo.getLong("id"))) { | |||||
| return true; | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("核销发券条件判断错误:ID=" + wxCouponSend.getId() + e.getMessage()); | |||||
| } | |||||
| return false; | |||||
| return true; | |||||
| }else { | }else { | ||||
| return false; | return false; | ||||
| } | } | ||||