releaserelease_toaliyun_real
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -194,4 +195,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -154,4 +155,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| template.setConnectionFactory(connectionFactory); | template.setConnectionFactory(connectionFactory); | ||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -219,6 +219,9 @@ public class WxInfoController extends BaseController { | |||||
| } | } | ||||
| WxAppinfo wxAppinfo = getAppInfo(appId); | WxAppinfo wxAppinfo = getAppInfo(appId); | ||||
| if (wxAppinfo == null) { | |||||
| return new ResultData(Result.ERROR, "APP无权限"); | |||||
| } | |||||
| TenantEntity tenantEntity = new TenantEntity() {{ | TenantEntity tenantEntity = new TenantEntity() {{ | ||||
| setTenantId(wxAppinfo.getTenantId()); | setTenantId(wxAppinfo.getTenantId()); | ||||
| }}; | }}; | ||||
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -192,4 +193,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| template.setConnectionFactory(connectionFactory); | template.setConnectionFactory(connectionFactory); | ||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -178,4 +179,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| template.setConnectionFactory(connectionFactory); | template.setConnectionFactory(connectionFactory); | ||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -156,4 +157,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| template.setConnectionFactory(connectionFactory); | template.setConnectionFactory(connectionFactory); | ||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -1891,7 +1891,13 @@ public class PosServiceImpl implements PosService { | |||||
| Long posOrderId, Long memId, Integer orderAmount, Date orderTime, String orderCreateSn) { | Long posOrderId, Long memId, Integer orderAmount, Date orderTime, String orderCreateSn) { | ||||
| WxOrder order = createOrderByPos(buUser, memId, posOrderId, orderAmount, orderTime, orderCreateSn); | WxOrder order = createOrderByPos(buUser, memId, posOrderId, orderAmount, orderTime, orderCreateSn); | ||||
| String payDetail = params.get(WxPayConstant.PAY_DETAIL); | String payDetail = params.get(WxPayConstant.PAY_DETAIL); | ||||
| JSONObject payDetailObj = JSON.parseObject(payDetail); | |||||
| JSONObject payDetailObj = null; | |||||
| try { | |||||
| payDetailObj = JSON.parseObject(payDetail); | |||||
| } catch (Exception e) { | |||||
| logger.error("parse PAY_DETAIL error: {}", e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| } | |||||
| PromotionCalc scoreCreditCalc = new PromotionCalc(); | PromotionCalc scoreCreditCalc = new PromotionCalc(); | ||||
| scoreCreditCalc.setScore(0); | scoreCreditCalc.setScore(0); | ||||
| scoreCreditCalc.setCredit(0); | scoreCreditCalc.setCredit(0); | ||||
| @@ -2185,8 +2191,13 @@ public class PosServiceImpl implements PosService { | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR); | throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR); | ||||
| } | } | ||||
| WxCardSpend cardSpend = cardSpendService.getById(cardSpendId); | WxCardSpend cardSpend = cardSpendService.getById(cardSpendId); | ||||
| cardSpend.setOrderId(order.getId()); | |||||
| cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser); | |||||
| if (cardSpend != null) { | |||||
| cardSpend.setOrderId(order.getId()); | |||||
| cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser); | |||||
| } else { | |||||
| logger.error("卡支付ID未发现: " + cardSpendId); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||||
| } | |||||
| return payOrder; | return payOrder; | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -179,4 +180,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.schedule; | package com.iformall.schedule; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.dto.WxSharingOrderDto; | import com.iformall.domain.dto.WxSharingOrderDto; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| @@ -9,6 +10,7 @@ import com.iformall.mapper.*; | |||||
| import com.iformall.service.WxOrderService; | import com.iformall.service.WxOrderService; | ||||
| import com.iformall.service.WxProfitSharingOrderService; | import com.iformall.service.WxProfitSharingOrderService; | ||||
| import com.iformall.service.WxRefundOrderService; | import com.iformall.service.WxRefundOrderService; | ||||
| 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; | ||||
| @@ -119,11 +121,20 @@ public class CouponOrderExpiringSchedule { | |||||
| appinfo.setType(EnumAppType.B.getCode()); | appinfo.setType(EnumAppType.B.getCode()); | ||||
| appinfo = wxAppinfoMapper.findList(appinfo).get(0); | appinfo = wxAppinfoMapper.findList(appinfo).get(0); | ||||
| Date limitDate = DateUtils.getTimeAfterDays(360, co.getCreateDate()); | |||||
| if (limitDate.before(new Date())) { | |||||
| // 系统只自动处理360天内的订单 | |||||
| return; | |||||
| } | |||||
| try { | try { | ||||
| wxRefundOrderService.createRefundOrder(appinfo, co.getId(), EnumPayType.PAY_AUTO_REFUND, null); | wxRefundOrderService.createRefundOrder(appinfo, co.getId(), EnumPayType.PAY_AUTO_REFUND, null); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error("退款失败:"+e.getMessage()+"couponOrderId="+co.getId()); | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| if (e.getErrorCode() == ErrorCode.REFUND_NOT_ALLOW.getCode()) { | |||||
| } else { | |||||
| logger.error("退款失败:" + e.getMessage() + "couponOrderId=" + co.getId()); | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,18 +1,21 @@ | |||||
| package com.iformall.schedule; | package com.iformall.schedule; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.enums.EnumAppType; | import com.iformall.enums.EnumAppType; | ||||
| import com.iformall.enums.EnumOrderStatus; | import com.iformall.enums.EnumOrderStatus; | ||||
| import com.iformall.enums.EnumOrderType; | import com.iformall.enums.EnumOrderType; | ||||
| import com.iformall.enums.EnumRefundStatus; | import com.iformall.enums.EnumRefundStatus; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxAppinfoMapper; | import com.iformall.mapper.WxAppinfoMapper; | ||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.mapper.WxOrderGroupMapper; | import com.iformall.mapper.WxOrderGroupMapper; | ||||
| import com.iformall.mapper.WxOrderMapper; | import com.iformall.mapper.WxOrderMapper; | ||||
| import com.iformall.service.WxOrderService; | import com.iformall.service.WxOrderService; | ||||
| import com.iformall.service.WxRefundOrderService; | import com.iformall.service.WxRefundOrderService; | ||||
| 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; | ||||
| @@ -208,10 +211,22 @@ public class OrderExpiringSchedule { | |||||
| appinfo.updateTenantInfo(order); | appinfo.updateTenantInfo(order); | ||||
| appinfo.setType(EnumAppType.C.getCode()); | appinfo.setType(EnumAppType.C.getCode()); | ||||
| appinfo = wxAppinfoMapper.findList(appinfo).get(0); | appinfo = wxAppinfoMapper.findList(appinfo).get(0); | ||||
| Date limitDate = DateUtils.getTimeAfterDays(360, order.getCreateDate()); | |||||
| if (limitDate.before(new Date())) { | |||||
| // 系统只自动处理180内的订单 | |||||
| return; | |||||
| } | |||||
| //退款流程 | //退款流程 | ||||
| boolean has = wxRefundOrderService.hasRefundOrder(order.getId(), EnumRefundStatus.REFUND_SUCCESS.getCode()); | boolean has = wxRefundOrderService.hasRefundOrder(order.getId(), EnumRefundStatus.REFUND_SUCCESS.getCode()); | ||||
| if (!has) { | if (!has) { | ||||
| wxRefundOrderService.returnMoney(appinfo, order.getId()); | |||||
| try { | |||||
| wxRefundOrderService.returnMoney(appinfo, order.getId()); | |||||
| } catch (MallinkException e) { | |||||
| if (e.getErrorCode() == ErrorCode.REFUND_NOT_ALLOW.getCode()) { | |||||
| } | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -296,6 +296,7 @@ public enum ErrorCode{ | |||||
| REFUND_ORDER_NOTIFY_CHECK_SIGN_ERROR(12014, "退款验签失败"), | REFUND_ORDER_NOTIFY_CHECK_SIGN_ERROR(12014, "退款验签失败"), | ||||
| REFUND_ORDER_BUSER_IS_NULL(12015, "B端用户不存在"), | REFUND_ORDER_BUSER_IS_NULL(12015, "B端用户不存在"), | ||||
| REFUND_ORDER_BUSER_NOT_EQUAL(12016, "B端用户无操作权限"), | REFUND_ORDER_BUSER_NOT_EQUAL(12016, "B端用户无操作权限"), | ||||
| REFUND_NOT_ALLOW(12017, "退款订单不允许退款"), | |||||
| APP_ID_NOT_FOUND(12020, "APPID没找到"), | APP_ID_NOT_FOUND(12020, "APPID没找到"), | ||||
| MCH_INFO_NOT_FOUND(12021, "微信商户平台信息没找到"), | MCH_INFO_NOT_FOUND(12021, "微信商户平台信息没找到"), | ||||
| @@ -5,13 +5,15 @@ package com.iformall.enums; | |||||
| */ | */ | ||||
| public enum EnumNeuPosPamentType { | public enum EnumNeuPosPamentType { | ||||
| // 来源于Neusoft的定义 0微信;1支付宝;2现金;3优惠券;4预付卡;5银行卡 | |||||
| // 来源于Neusoft的定义 0微信;1支付宝;2现金;3-会员折扣, 4优惠券;5预付卡;6银行卡7记账 | |||||
| WECHAT(0, "微信"), | WECHAT(0, "微信"), | ||||
| ALIPAY(1, "支付宝"), | ALIPAY(1, "支付宝"), | ||||
| CASH(2, "现金"), | CASH(2, "现金"), | ||||
| MEM_COUPON(3, "优惠券"), | |||||
| MEM_CARD(4, "预付卡"), | |||||
| MEM_BANKCARD(5, "银行卡"), | |||||
| MEM_DEDUCT(3, "会员折扣"), | |||||
| MEM_COUPON(4, "优惠券"), | |||||
| MEM_CARD(5, "预付卡"), | |||||
| MEM_BANKCARD(6, "银行卡"), | |||||
| RECORD(7, "记账"), | |||||
| ; | ; | ||||
| public static EnumNeuPosPamentType getEnum(Integer code) { | public static EnumNeuPosPamentType getEnum(Integer code) { | ||||
| for (EnumNeuPosPamentType value : values()) { | for (EnumNeuPosPamentType value : values()) { | ||||
| @@ -10,6 +10,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.enums.EnumCouponChannelStatus; | import com.iformall.enums.EnumCouponChannelStatus; | ||||
| import com.iformall.enums.EnumCouponChannelType; | import com.iformall.enums.EnumCouponChannelType; | ||||
| @@ -24,11 +25,15 @@ import com.iformall.service.*; | |||||
| 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; | ||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.data.redis.core.ValueOperations; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.concurrent.TimeUnit; | |||||
| @Service | @Service | ||||
| public class WxGameServiceImpl implements WxGameService { | public class WxGameServiceImpl implements WxGameService { | ||||
| @@ -58,6 +63,10 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| @Autowired | @Autowired | ||||
| private QrCodeService qrCodeService; | private QrCodeService qrCodeService; | ||||
| @Autowired | |||||
| @Qualifier("couponDetailRedisTemplate") | |||||
| RedisTemplate<String, WxCouponCVo> cdRedisTemplate; | |||||
| @Override | @Override | ||||
| public PageInfo<WxGame> listAsPage(WxGame record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxGame> listAsPage(WxGame record, Integer pageIndex, Integer pageSize) { | ||||
| PageInfo<WxGame> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxGameMapper.findList(record)); | PageInfo<WxGame> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxGameMapper.findList(record)); | ||||
| @@ -176,6 +185,7 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| // get game's coupon | // get game's coupon | ||||
| List couponIdsList = new ArrayList(); | List couponIdsList = new ArrayList(); | ||||
| JSONArray couponChannelIds = JSON.parseArray(record.getCouponIds()); | JSONArray couponChannelIds = JSON.parseArray(record.getCouponIds()); | ||||
| ValueOperations<String, WxCouponCVo> operations = cdRedisTemplate.opsForValue(); | |||||
| for(int i=0; i<couponChannelIds.size();i++) { | for(int i=0; i<couponChannelIds.size();i++) { | ||||
| JSONObject couponChanObj = (JSONObject) couponChannelIds.get(i); | JSONObject couponChanObj = (JSONObject) couponChannelIds.get(i); | ||||
| Long couponId = couponChanObj.getLong("couponId"); | Long couponId = couponChanObj.getLong("couponId"); | ||||
| @@ -184,6 +194,14 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| if (couponChannelVo != null) { | if (couponChannelVo != null) { | ||||
| couponChannelVo.setGameWeight(couponChanObj.getInteger("weight")); | couponChannelVo.setGameWeight(couponChanObj.getInteger("weight")); | ||||
| couponIdsList.add(couponChannelVo); | couponIdsList.add(couponChannelVo); | ||||
| String key = "cc:" + couponChannelVo.getId(); | |||||
| if (!cdRedisTemplate.hasKey(key)) { | |||||
| WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelVo.getId()); | |||||
| if(Objects.nonNull(couponCVo)) { | |||||
| // 插入缓存 | |||||
| operations.set(key, couponCVo, 3600, TimeUnit.SECONDS); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| @@ -19,9 +20,12 @@ import com.iformall.mapper.*; | |||||
| import com.iformall.mq.MqBaseProducer; | import com.iformall.mq.MqBaseProducer; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.*; | import com.iformall.utils.*; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| 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; | ||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| @@ -32,6 +36,7 @@ import java.math.BigDecimal; | |||||
| import java.text.ParseException; | import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.concurrent.TimeUnit; | |||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @Service | @Service | ||||
| @@ -660,7 +665,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | ||||
| record.setPayment(payment); | record.setPayment(payment); | ||||
| record.setTotalPayment(payment); | |||||
| record.setTotalPayment(payment); | |||||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | ||||
| record.setDetail(bodyStr); | record.setDetail(bodyStr); | ||||
| record.setCreateDate(curr); | record.setCreateDate(curr); | ||||
| @@ -697,7 +702,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| record.setCUserId(cUserId); | record.setCUserId(cUserId); | ||||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | ||||
| record.setPayment(payment); | record.setPayment(payment); | ||||
| record.setTotalPayment(payment); | |||||
| record.setTotalPayment(payment); | |||||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | ||||
| record.setDetail(bodyStr); | record.setDetail(bodyStr); | ||||
| record.setCreateDate(curr); | record.setCreateDate(curr); | ||||
| @@ -1618,11 +1623,26 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| wxOrderMapper.updateStatusByPressCouponId(updateOrder); | wxOrderMapper.updateStatusByPressCouponId(updateOrder); | ||||
| } | } | ||||
| @Autowired | |||||
| @Qualifier("cuserTokenRedisTemplate") | |||||
| RedisTemplate<String, WxCUser> cUserTokenRedisTemplate; | |||||
| @Override | @Override | ||||
| public WxOrder saveOrderForCoupon(WxCUser user, WxCoupon coupon, OrderSaveDto orderSaveDto, boolean isPress) { | public WxOrder saveOrderForCoupon(WxCUser user, WxCoupon coupon, OrderSaveDto orderSaveDto, boolean isPress) { | ||||
| WxOrder order = null; | WxOrder order = null; | ||||
| // 防止同一用户重复抽奖(一分钟内) | |||||
| // 1. 订单保存时 加入redis缓存,key --> action:userId:couponId , 时间1000ms | |||||
| // 2. 如果存在,说明该用户正在下单,返回异常提示 | |||||
| // 3. 方法结束时清除 key | |||||
| if (checkCouponIsFree(coupon)) { | if (checkCouponIsFree(coupon)) { | ||||
| // 免费券 | // 免费券 | ||||
| String key = StringUtils.join("action", ":", user.getId(), coupon.getId()); | |||||
| boolean hasKey = cUserTokenRedisTemplate.hasKey(key); | |||||
| if (hasKey) { | |||||
| logger.error("用户正在下单,请求异常返回,user: {} " + JSON.toJSONString(user)); | |||||
| throw new MallinkException(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); | |||||
| } | |||||
| cUserTokenRedisTemplate.opsForValue().set(key, user, 1000, TimeUnit.MILLISECONDS); | |||||
| order = saveFreeOrderForCoupon(user, coupon, orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null); | order = saveFreeOrderForCoupon(user, coupon, orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null); | ||||
| if (order != null) { | if (order != null) { | ||||
| // 6. 下订单完成,发送内部消息 | // 6. 下订单完成,发送内部消息 | ||||
| @@ -511,6 +511,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | ||||
| } | } | ||||
| } else { | } else { | ||||
| String errDesc = returnMap.get("err_code_des"); | |||||
| if (errDesc.equalsIgnoreCase("订单已全额退款")) { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | |||||
| wxRefundOrderMapper.updateById(record); | |||||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||||
| } | |||||
| logger.error("微信退款订单申请失败: " + response); | logger.error("微信退款订单申请失败: " + response); | ||||
| String errMsg = ""; | String errMsg = ""; | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| @@ -523,6 +529,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | ||||
| wxRefundOrderMapper.updateById(record); | wxRefundOrderMapper.updateById(record); | ||||
| if (errDesc.equalsIgnoreCase("超期订单不允许退款")) { | |||||
| // 更新券状态 | |||||
| throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW); | |||||
| } | |||||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap); | return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap); | ||||
| } | } | ||||
| } else { | } else { | ||||
| @@ -590,6 +600,13 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败"); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败"); | ||||
| } | } | ||||
| } else { | } else { | ||||
| // 特殊处理 | |||||
| String errDesc = returnMap.get("err_code_des"); | |||||
| if (errDesc.equalsIgnoreCase("订单已全额退款")) { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | |||||
| wxRefundOrderMapper.updateById(record); | |||||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||||
| } | |||||
| logger.error("微信退款订单申请失败: " + response); | logger.error("微信退款订单申请失败: " + response); | ||||
| String errMsg = ""; | String errMsg = ""; | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| @@ -602,6 +619,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | ||||
| wxRefundOrderMapper.updateById(record); | wxRefundOrderMapper.updateById(record); | ||||
| if (errDesc.equalsIgnoreCase("超期订单不允许退款")) { | |||||
| // 更新券状态 | |||||
| throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW); | |||||
| } | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg); | ||||
| } | } | ||||
| } | } | ||||
| @@ -800,6 +821,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | ||||
| } | } | ||||
| } else { | } else { | ||||
| String errDesc = returnMap.get("err_code_des"); | |||||
| if (errDesc.equalsIgnoreCase("订单已全额退款")) { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | |||||
| wxRefundOrderMapper.updateById(record); | |||||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||||
| } | |||||
| logger.error("微信退款订单申请失败: " + response); | logger.error("微信退款订单申请失败: " + response); | ||||
| String errMsg = ""; | String errMsg = ""; | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| @@ -812,6 +839,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | ||||
| wxRefundOrderMapper.updateById(record); | wxRefundOrderMapper.updateById(record); | ||||
| if (errDesc.equalsIgnoreCase("超期订单不允许退款")) { | |||||
| // 更新券状态 | |||||
| throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW); | |||||
| } | |||||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap); | return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap); | ||||
| } | } | ||||
| } else { | } else { | ||||
| @@ -879,6 +910,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败"); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败"); | ||||
| } | } | ||||
| } else { | } else { | ||||
| String errDesc = returnMap.get("err_code_des"); | |||||
| if (errDesc.equalsIgnoreCase("订单已全额退款")) { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | |||||
| wxRefundOrderMapper.updateById(record); | |||||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||||
| } | |||||
| logger.error("微信退款订单申请失败: " + response); | logger.error("微信退款订单申请失败: " + response); | ||||
| String errMsg = ""; | String errMsg = ""; | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| @@ -891,6 +928,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | ||||
| wxRefundOrderMapper.updateById(record); | wxRefundOrderMapper.updateById(record); | ||||
| if (errDesc.equalsIgnoreCase("超期订单不允许退款")) { | |||||
| // 更新券状态 | |||||
| throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW); | |||||
| } | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1404,6 +1445,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | ||||
| } | } | ||||
| } else { | } else { | ||||
| String errDesc = returnMap.get("err_code_des"); | |||||
| if (errDesc.equalsIgnoreCase("订单已全额退款")) { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | |||||
| wxRefundOrderMapper.updateById(record); | |||||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||||
| } | |||||
| logger.error("微信退款订单申请失败: " + response); | logger.error("微信退款订单申请失败: " + response); | ||||
| String errMsg = ""; | String errMsg = ""; | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| @@ -1416,6 +1463,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | ||||
| wxRefundOrderMapper.updateById(record); | wxRefundOrderMapper.updateById(record); | ||||
| if (errDesc.equalsIgnoreCase("超期订单不允许退款")) { | |||||
| // 更新券状态 | |||||
| throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW); | |||||
| } | |||||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap); | return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap); | ||||
| } | } | ||||
| } else { | } else { | ||||
| @@ -1476,6 +1527,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败"); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败"); | ||||
| } | } | ||||
| } else { | } else { | ||||
| String errDesc = returnMap.get("err_code_des"); | |||||
| if (errDesc.equalsIgnoreCase("订单已全额退款")) { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | |||||
| wxRefundOrderMapper.updateById(record); | |||||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||||
| } | |||||
| logger.error("微信退款订单申请失败: " + response); | logger.error("微信退款订单申请失败: " + response); | ||||
| String errMsg = ""; | String errMsg = ""; | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| @@ -1488,6 +1545,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | ||||
| wxRefundOrderMapper.updateById(record); | wxRefundOrderMapper.updateById(record); | ||||
| if (errDesc.equalsIgnoreCase("超期订单不允许退款")) { | |||||
| // 更新券状态 | |||||
| throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW); | |||||
| } | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg); | throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg); | ||||
| } | } | ||||
| } | } | ||||
| @@ -538,12 +538,12 @@ | |||||
| <select id="findExpiredFreeCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap"> | <select id="findExpiredFreeCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_coupon_order | select <include refid="allColumns" /> from wx_coupon_order | ||||
| where expired_time < now() and coupon_price = 0 and coupon_order_status = 0 | |||||
| where expired_time >= date_sub(curdate(),interval 360 day) and expired_time < now() and coupon_price = 0 and coupon_order_status = 0 | |||||
| </select> | </select> | ||||
| <select id="findExpiredCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap"> | <select id="findExpiredCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_coupon_order | select <include refid="allColumns" /> from wx_coupon_order | ||||
| where expired_time < now() and coupon_price > 0 and coupon_order_status = 0 | |||||
| where expired_time >= date_sub(curdate(),interval 360 day) and expired_time < now() and coupon_price > 0 and coupon_order_status = 0 | |||||
| </select> | </select> | ||||
| @@ -588,6 +588,41 @@ | |||||
| </collection> | </collection> | ||||
| </resultMap> | </resultMap> | ||||
| <resultMap id="AdminBVoResultMap" type="com.iformall.domain.vo.WxCouponOrderBVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="BIGINT" property="tenantId" /> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="coupon_type" jdbcType="INTEGER" property="couponType" /> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId" /> | |||||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | |||||
| <result column="order_id" jdbcType="BIGINT" property="orderId" /> | |||||
| <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" /> | |||||
| <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" /> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | |||||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund" /> | |||||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | |||||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | |||||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="verify_merchant_name" jdbcType="VARCHAR" property="verifyMerchantName"/> | |||||
| </resultMap> | |||||
| <sql id="allAdminCouponOrderListColumns"> | <sql id="allAdminCouponOrderListColumns"> | ||||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | ||||
| c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num, | c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num, | ||||
| @@ -607,7 +642,7 @@ | |||||
| m.name as merchant_name,m.id as merchant_id | m.name as merchant_name,m.id as merchant_id | ||||
| </sql> | </sql> | ||||
| <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap"> | |||||
| <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap"> | |||||
| select <include refid="allAdminCouponOrderListColumns" /> | select <include refid="allAdminCouponOrderListColumns" /> | ||||
| from wx_coupon_order co | from wx_coupon_order co | ||||
| inner join wx_coupon c on c.id = co.coupon_id | inner join wx_coupon c on c.id = co.coupon_id | ||||
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -192,4 +193,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.iformall.config; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -177,4 +178,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| template.setConnectionFactory(connectionFactory); | template.setConnectionFactory(connectionFactory); | ||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||