diff --git a/mallinkBApi/src/main/java/com/iformall/aop/RedisCacheAspect.java b/mallinkBApi/src/main/java/com/iformall/aop/RedisCacheAspect.java index 97b844d1a..88609543c 100644 --- a/mallinkBApi/src/main/java/com/iformall/aop/RedisCacheAspect.java +++ b/mallinkBApi/src/main/java/com/iformall/aop/RedisCacheAspect.java @@ -95,7 +95,8 @@ public class RedisCacheAspect { // 接口路径 reqPath => /api/xxx String reqPath = requestUrl.substring(requestUrl.indexOf("/api/")); if (cache.md5()) { - redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, HashUtil.md5(StringUtils.join(token,args, DELIMITER_PARAMS))); + String md5Before = StringUtils.join(args, DELIMITER_PARAMS); + redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, HashUtil.md5(StringUtils.join(token, md5Before, DELIMITER_PARAMS))); } else { redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, StringUtils.join(token,args, DELIMITER_PARAMS)); } @@ -148,7 +149,7 @@ public class RedisCacheAspect { private Object parseCache(ProceedingJoinPoint jp, String redisKey, String value) { if (StringUtils.isBlank(value)) { - log.debug("CacheAspect 缓存存在,解析缓存数据为空:{},key:{}", value, redisKey); + log.debug("CacheAspect 缓存不存在,解析缓存数据为空:{},key:{}", value, redisKey); return null; } Class returnType = ((MethodSignature) jp.getSignature()).getReturnType(); diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java index 76ba76ac5..2a8c705cf 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java @@ -7,15 +7,14 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.WxCUserBasicInfo; import com.iformall.domain.po.WxCouponOrder; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantBUser; +import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxCouponOrderCVo; import com.iformall.enums.EnumCouponValidType; import com.iformall.enums.EnumCreditLockedStatus; import com.iformall.exception.MallinkException; -import com.iformall.service.WxCUserBasicInfoService; -import com.iformall.service.WxCUserService; -import com.iformall.service.WxCouponOrderService; -import com.iformall.service.WxMerchantBUserService; +import com.iformall.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -24,10 +23,14 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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.web.bind.annotation.*; import java.util.Date; import java.util.Map; +import java.util.concurrent.TimeUnit; @RestController @RequestMapping("/api/couponOrder") @@ -35,9 +38,15 @@ import java.util.Map; public class WxCouponOrderController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Autowired + private WxMerchantService wxMerchantService; + @Autowired private WxCouponOrderService wxCouponOrderService; + @Autowired + private WxCouponService wxCouponService; + @Autowired private WxMerchantBUserService wxMerchantBUserService; @@ -47,6 +56,10 @@ public class WxCouponOrderController extends BaseController { @Autowired private WxCUserService wxCUserService; + @Autowired + @Qualifier("couponDetailRedisTemplate") + RedisTemplate cdRedisTemplate; + @ApiOperation("分页列表接口") @GetMapping("list") @@ -115,7 +128,61 @@ public class WxCouponOrderController extends BaseController { if(couponOrderId == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } - return wxCouponOrderService.detailBUserVo(getUser().getId(), couponOrderId); + Long bUserId = getUser().getId(); + WxMerchantBUser wxMerchantBUser = wxMerchantBUserService.getById(getUser().getId()); + if (wxMerchantBUser == null) { + logger.error("用户不存在:" + bUserId); + throw new MallinkException(ErrorCode.USER_IS_EMPTY); + } + + WxMerchant wxMerchant = wxMerchantService.getById(wxMerchantBUser.getMerchantId()); + if (wxMerchant == null) { + logger.error("商户不存在:" + bUserId); + throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); + } + WxCouponOrderCVo wxCouponOrderCVo = null; + try { + wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId); + } catch (Exception e) { + return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); + } + if (wxCouponOrderCVo == null) + return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); + WxCouponCVo wxCouponCVo = null; + String key = "cd:" + wxCouponOrderCVo.getCouponId(); + ValueOperations operations = cdRedisTemplate.opsForValue(); + // 缓存 + boolean hasKey = cdRedisTemplate.hasKey(key); + if (hasKey) { + // 从缓存获取用户信息 + wxCouponCVo = operations.get(key); + if (wxCouponCVo == null) { + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + } else { + wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId()); + if (wxCouponCVo == null) { + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + // 插入缓存 + operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); + } + + wxCouponOrderCVo.setType(wxCouponCVo.getType()); + wxCouponOrderCVo.setCoverImg(wxCouponCVo.getCoverImg()); + wxCouponOrderCVo.setTitle(wxCouponCVo.getTitle()); + wxCouponOrderCVo.setSubTitle(wxCouponCVo.getSubTitle()); + wxCouponOrderCVo.setSalePrice(wxCouponCVo.getSalePrice()); + wxCouponOrderCVo.setUsePrice(wxCouponCVo.getUsePrice()); + wxCouponOrderCVo.setPrice(wxCouponCVo.getPrice()); + wxCouponOrderCVo.setUnit(wxCouponCVo.getUnit()); + wxCouponOrderCVo.setDetail(wxCouponCVo.getDetail()); + wxCouponOrderCVo.setRemark(wxCouponCVo.getRemark()); + wxCouponOrderCVo.setValidType(wxCouponCVo.getValidType()); + wxCouponOrderCVo.setValidStartDate(wxCouponCVo.getValidStartDate()); + wxCouponOrderCVo.setValidEndDate(wxCouponCVo.getValidEndDate()); + wxCouponOrderCVo.setAutoRefund(wxCouponCVo.getAutoRefund()); + return new ResultData(wxCouponOrderCVo); } @ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}") diff --git a/mallinkCApi/src/main/java/com/iformall/aop/RedisCacheAspect.java b/mallinkCApi/src/main/java/com/iformall/aop/RedisCacheAspect.java index 366b521be..8005c6bd0 100644 --- a/mallinkCApi/src/main/java/com/iformall/aop/RedisCacheAspect.java +++ b/mallinkCApi/src/main/java/com/iformall/aop/RedisCacheAspect.java @@ -92,7 +92,8 @@ public class RedisCacheAspect { // 接口路径 reqPath => /api/xxx String reqPath = requestUrl.substring(requestUrl.indexOf("/api/")); if (cache.md5()) { - redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, HashUtil.md5(StringUtils.join(token,args, DELIMITER_PARAMS))); + String md5Before = StringUtils.join(args, DELIMITER_PARAMS); + redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, HashUtil.md5(StringUtils.join(token, md5Before, DELIMITER_PARAMS))); } else { redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, StringUtils.join(token,args, DELIMITER_PARAMS)); } @@ -142,7 +143,7 @@ public class RedisCacheAspect { private Object parseCache(ProceedingJoinPoint jp, String redisKey, String value) { if (StringUtils.isBlank(value)) { - log.debug("CacheAspect 缓存存在,解析缓存数据为空:{},key:{}", value, redisKey); + log.debug("CacheAspect 缓存不存在,解析缓存数据为空:{},key:{}", value, redisKey); return null; } Class returnType = ((MethodSignature) jp.getSignature()).getReturnType(); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index 465541e83..01ba206ce 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -1,29 +1,41 @@ package com.iformall.controller; +import java.lang.reflect.InvocationTargetException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import com.iformall.common.ErrorCode; import com.iformall.common.ResultData; import com.iformall.domain.po.WxCoupon; +import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.vo.WxCouponCVo; +import com.iformall.domain.vo.WxMerchantVo; import com.iformall.enums.EnumCouponChannelActivityStatus; import com.iformall.enums.EnumCouponChannelType; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponService; +import com.iformall.service.WxMerchantService; import com.iformall.utils.Constant; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -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.web.bind.annotation.*; - -import java.util.Date; -import java.util.concurrent.TimeUnit; @RestController @RequestMapping("/api/wxCoupon") @@ -35,6 +47,8 @@ public class WxCouponController extends BaseController { private WxCouponChannelService wxCouponChannelService; @Autowired private WxCouponService couponService; + @Autowired + private WxMerchantService merchantService; @Autowired @Qualifier("couponDetailRedisTemplate") @@ -79,7 +93,8 @@ public class WxCouponController extends BaseController { wxCouponCVo.setStatus(couponCVo.getStatus()); } else { // 更新状态 - WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL); + // WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL); + WxCouponCVo couponCVo = generateWxCouponCVo(couponChannelIdL); if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -91,7 +106,17 @@ public class WxCouponController extends BaseController { return new ResultData(wxCouponCVo); } - WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelIdL); + //WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelIdL); + WxCouponCVo wxCouponCVo = null; + try { + wxCouponCVo = generateWxCouponCVoex(couponChannelIdL); + } catch (IllegalAccessException e) { + logger.error("coupon detail fail,copyproperties error" + couponChannelId,e); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "coupon detail fail,copyproperties error" + couponChannelId); + } catch (InvocationTargetException e) { + logger.error("coupon detail fail,copyproperties error" + couponChannelId,e); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "coupon detail fail,copyproperties error" + couponChannelId); + } if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -103,7 +128,56 @@ public class WxCouponController extends BaseController { return new ResultData(wxCouponCVo); } + + private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL) { + WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL); + if (cc == null) { + return null; + } + + WxCoupon c = couponService.getById(cc.getCouponId()); + if (c == null) { + return null; + } + + WxCouponCVo couponCVo = new WxCouponCVo(); + couponCVo.setId(cc.getId()); + couponCVo.setCouponId(cc.getCouponId()); + couponCVo.setRemainInventory(c.getRemainInventory()); + couponCVo.setStatus(c.getStatus()); + return couponCVo; + } + + private WxCouponCVo generateWxCouponCVoex(Long couponChannelIdL) throws IllegalAccessException, InvocationTargetException { + WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL); + if (cc == null) { + return null; + } + + WxCoupon c = couponService.getById(cc.getCouponId()); + if (c == null) { + c = new WxCoupon(); + } + + WxCouponCVo wxcv = new WxCouponCVo(); + BeanUtils.copyProperties(wxcv, c); + wxcv.setId(cc.getId()); + wxcv.setCouponId(cc.getCouponId()); + wxcv.setTargetAd(cc.getTargetAd()); + wxcv.setBeginTime(cc.getBeginTime()); + wxcv.setEndTime(cc.getEndTime()); + wxcv.setQrCode(cc.getQrCode()); + + Map param = new HashMap(); + param.put("productId", cc.getCouponId()); + List chantlist = merchantService.findMerchantVoList(param); + if (null != chantlist && chantlist.size()>0) { + wxcv.setMerchantVoList(chantlist); + } + return wxcv; + } + private void updateActivityStatus(WxCouponCVo wxCouponCVo) { if (wxCouponCVo.getTargetAd() != null && wxCouponCVo.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) { diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java index 11b419bdb..a79621a9d 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java @@ -1,6 +1,7 @@ package com.iformall.controller; import com.github.pagehelper.PageInfo; +import com.iformall.annotation.RedisCache; import com.iformall.common.ErrorCode; import com.iformall.common.ResultData; import com.iformall.domain.po.WxCUser; @@ -8,12 +9,14 @@ import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.WxCouponOrder; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxCardCVo; +import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxCouponOrderCVo; import com.iformall.enums.EnumCouponChannelActivityStatus; import com.iformall.enums.EnumCouponOrderStatus; import com.iformall.enums.EnumCouponOrderValidStatus; import com.iformall.service.MemCouponFromDspService; import com.iformall.service.WxCouponOrderService; +import com.iformall.service.WxCouponService; import com.iformall.utils.Constant; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -23,10 +26,14 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.web.bind.annotation.*; import java.util.*; +import java.util.concurrent.TimeUnit; @RestController @RequestMapping("/api/couponOrder") @@ -34,15 +41,22 @@ import java.util.*; public class WxCouponOrderController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Autowired + private WxCouponService wxCouponService; @Autowired private WxCouponOrderService wxCouponOrderService; @Autowired private MemCouponFromDspService memCouponFromDspService; + @Autowired + @Qualifier("couponDetailRedisTemplate") + RedisTemplate cdRedisTemplate; + @Autowired StringRedisTemplate stringRedisTemplate; + @RedisCache(expireTime = 100) @ApiOperation("券包分页列表接口") @GetMapping("list") @ApiImplicitParams({ @@ -81,6 +95,7 @@ public class WxCouponOrderController extends BaseController { return new ResultData(page); } + @RedisCache(expireTime = 100, dateUnit = TimeUnit.SECONDS) @ApiOperation(value = "券详情接口") @GetMapping("detail") @ApiImplicitParams({ @@ -92,15 +107,48 @@ public class WxCouponOrderController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } - WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderId); - + WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId); if (wxCouponOrderCVo == null) { return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); } - if (!wxCouponOrderCVo.getCUserId().equals(getUserId())) { return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); } + WxCouponCVo wxCouponCVo = null; + String key = "cd:" + wxCouponOrderCVo.getCouponId(); + ValueOperations operations = cdRedisTemplate.opsForValue(); + // 缓存 + boolean hasKey = cdRedisTemplate.hasKey(key); + if (hasKey) { + // 从缓存获取用户信息 + wxCouponCVo = operations.get(key); + if (wxCouponCVo == null) { + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + } else { + wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId()); + if (wxCouponCVo == null) { + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + // 插入缓存 + operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); + } + + wxCouponOrderCVo.setType(wxCouponCVo.getType()); + wxCouponOrderCVo.setCoverImg(wxCouponCVo.getCoverImg()); + wxCouponOrderCVo.setTitle(wxCouponCVo.getTitle()); + wxCouponOrderCVo.setSubTitle(wxCouponCVo.getSubTitle()); + wxCouponOrderCVo.setSalePrice(wxCouponCVo.getSalePrice()); + wxCouponOrderCVo.setUsePrice(wxCouponCVo.getUsePrice()); + wxCouponOrderCVo.setPrice(wxCouponCVo.getPrice()); + wxCouponOrderCVo.setUnit(wxCouponCVo.getUnit()); + wxCouponOrderCVo.setDetail(wxCouponCVo.getDetail()); + wxCouponOrderCVo.setRemark(wxCouponCVo.getRemark()); + wxCouponOrderCVo.setValidType(wxCouponCVo.getValidType()); + wxCouponOrderCVo.setValidStartDate(wxCouponCVo.getValidStartDate()); + wxCouponOrderCVo.setValidEndDate(wxCouponCVo.getValidEndDate()); + wxCouponOrderCVo.setAutoRefund(wxCouponCVo.getAutoRefund()); + Date now = new Date(); if (wxCouponOrderCVo.getValidStartDate() != null && wxCouponOrderCVo.getValidEndDate() != null ) { if (wxCouponOrderCVo.getValidStartDate().getTime() > now.getTime()) { diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxLiveController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxLiveController.java index fc239aadf..80c977d35 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxLiveController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxLiveController.java @@ -27,13 +27,13 @@ public class WxLiveController extends BaseController { * @return */ @ApiOperation("获取所有直播间和商品信息") - @RedisCache(expireTime = 30,dateUnit = TimeUnit.MINUTES) + @RedisCache(expireTime = 5, dateUnit = TimeUnit.MINUTES) @GetMapping("/roomList") - public ResultData getLiveinfos(String appId) { + public ResultData getLiveinfos(String appId, Integer start, Integer limit) { ResultData resultData = new ResultData(); try { WxMaService wxMaService = getWeappService(appId); - resultData.data = wxMaService.getLiveService().getLiveinfos(); + resultData.data = wxMaService.getLiveService().getLiveInfo(start,limit); } catch (WxErrorException e) { logger.error("getLiveinfos error", e); throw new MallinkException(ErrorCode.SYS_SERVER_ERROR); @@ -52,7 +52,7 @@ public class WxLiveController extends BaseController { * @return */ @ApiOperation("获取直播房间回放数据和商品信息") - @RedisCache(expireTime = 30,dateUnit = TimeUnit.MINUTES) + @RedisCache(expireTime = 5, dateUnit = TimeUnit.MINUTES) @GetMapping("/replayList") public ResultData getLiveReplay(Integer room_id, Integer start, Integer limit) { ResultData resultData = new ResultData(); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java index 0c282b5c5..dd945dc8c 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java @@ -41,6 +41,7 @@ public interface WxCouponOrderMapper extends CommonMapper { List findListOfCUser(WxCouponOrder wxCouponOrder); WxCouponOrderCVo findDetailOfCUser(@Param("id")Long id); + WxCouponOrderCVo findSimpleDetailOfCUser(@Param("id")Long id); List findListOfAdmin(WxCouponOrderBVo wxCouponOrder); WxCouponOrderBVo findDetailOfAdmin(@Param("id")Long id); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java index aba815a45..5abb3da78 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java @@ -123,6 +123,8 @@ public interface WxCouponOrderService { */ WxCouponOrderCVo detailCUserVo(String couponOrderId); + WxCouponOrderCVo simpleDetailCUserVo(String couponOrderId); + /** * C用户查券carlist * diff --git a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java index ac8d4328b..15baea659 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java @@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; /** @@ -139,5 +140,7 @@ public interface WxMerchantService { Optional findByName(String name); PageInfo listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); + + List findMerchantVoList(Map paramMap); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBuserTokenServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBuserTokenServiceImpl.java index c0e628075..c171c665c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBuserTokenServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBuserTokenServiceImpl.java @@ -30,7 +30,7 @@ public class WxBuserTokenServiceImpl implements WxBuserTokenService { @Override public WxBuser getByToken(String token) { - logger.info("获取用户信息start ..."); + logger.info("获取B用户信息start ..." + token); String key = tokenPrev + token; ValueOperations operations = bUserTokenRedisTemplate.opsForValue(); @@ -39,12 +39,13 @@ public class WxBuserTokenServiceImpl implements WxBuserTokenService { if (hasKey) { // 从缓存获取用户信息 WxBuser user = operations.get(key); + logger.info("缓存中获取B用户信息End ..." + token); return user; } WxBuser user = wxBuserMapper.findByToken(token); // 插入缓存 operations.set(key, user, 3600, TimeUnit.SECONDS); - + logger.info("DB中获取B用户信息End ..." + token); return user; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTokenServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTokenServiceImpl.java index 8ae593fc8..101c8225a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTokenServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTokenServiceImpl.java @@ -34,7 +34,7 @@ public class WxCUserTokenServiceImpl implements WxCUserTokenService { @Override public WxCUser getByToken(String token) { - logger.info("获取用户信息start ..."); + logger.info("获取用户信息start ..." + token); String key = tokenPrev + token; ValueOperations operations = cUserTokenRedisTemplate.opsForValue(); @@ -43,12 +43,13 @@ public class WxCUserTokenServiceImpl implements WxCUserTokenService { if(hasKey) { // 从缓存获取用户信息 WxCUser user = operations.get(key); + logger.info("缓存中获取用户信息End-" + token); return user; } WxCUser user = wxCUserMapper.findByToken(token); // 插入缓存 operations.set(key, user, 3600, TimeUnit.SECONDS); - + logger.info("DB中获取用户信息End-" + token); return user; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index b6ba5c197..772cf1f64 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -32,6 +32,8 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -130,6 +132,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Autowired WxPayOrderMapper payOrderMapper; + @Autowired + @Qualifier("couponDetailRedisTemplate") + RedisTemplate cdRedisTemplate; + private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @Override @@ -240,6 +246,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { return wxCouponOrderCVo; } + @Override + public WxCouponOrderCVo simpleDetailCUserVo(String couponOrderId) { + WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.findSimpleDetailOfCUser(Long.valueOf(couponOrderId)); + if (wxCouponOrderCVo == null) + throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); + return wxCouponOrderCVo; + } + @Override public ResultData carListCUserVoAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index cbcaa4e6c..6db5a2720 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -789,4 +789,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { public PageInfo userTradeDetailList(WxMerchant record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.userTradeDetailList(record)); } + + + @Override + public List findMerchantVoList(Map paramMap) { + return wxCouponMerchantMapper.findMerchantVoList(paramMap); + } } diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 9aae563c0..2840d2e8a 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -868,6 +868,10 @@ c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date,c.valid_end_date,c.auto_refund + + co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type + + @@ -941,11 +945,17 @@ + +