Przeglądaj źródła

Merge tag 'refs/tags/jenkins-back-end-3326' into SiChuan

release
release_toaliyun_real
Stormeye Wu 6 lat temu
rodzic
commit
bf9522f072
14 zmienionych plików z 263 dodań i 34 usunięć
  1. +3
    -2
      mallinkBApi/src/main/java/com/iformall/aop/RedisCacheAspect.java
  2. +72
    -5
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java
  3. +3
    -2
      mallinkCApi/src/main/java/com/iformall/aop/RedisCacheAspect.java
  4. +87
    -13
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  5. +51
    -3
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java
  6. +4
    -4
      mallinkCApi/src/main/java/com/iformall/controller/WxLiveController.java
  7. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java
  8. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java
  9. +3
    -0
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  10. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxBuserTokenServiceImpl.java
  11. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserTokenServiceImpl.java
  12. +14
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  13. +6
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  14. +11
    -1
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 3
- 2
mallinkBApi/src/main/java/com/iformall/aop/RedisCacheAspect.java Wyświetl plik

@@ -95,7 +95,8 @@ public class RedisCacheAspect {
// 接口路径 reqPath => /api/xxx // 接口路径 reqPath => /api/xxx
String reqPath = requestUrl.substring(requestUrl.indexOf("/api/")); String reqPath = requestUrl.substring(requestUrl.indexOf("/api/"));
if (cache.md5()) { 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 { } else {
redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, StringUtils.join(token,args, DELIMITER_PARAMS)); 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) { private Object parseCache(ProceedingJoinPoint jp, String redisKey, String value) {
if (StringUtils.isBlank(value)) { if (StringUtils.isBlank(value)) {
log.debug("CacheAspect 缓存存在,解析缓存数据为空:{},key:{}", value, redisKey);
log.debug("CacheAspect 缓存存在,解析缓存数据为空:{},key:{}", value, redisKey);
return null; return null;
} }
Class<?> returnType = ((MethodSignature) jp.getSignature()).getReturnType(); Class<?> returnType = ((MethodSignature) jp.getSignature()).getReturnType();


+ 72
- 5
mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java Wyświetl plik

@@ -7,15 +7,14 @@ import com.iformall.common.Result;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUserBasicInfo; import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxCouponOrder; import com.iformall.domain.po.WxCouponOrder;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponOrderCVo; import com.iformall.domain.vo.WxCouponOrderCVo;
import com.iformall.enums.EnumCouponValidType; import com.iformall.enums.EnumCouponValidType;
import com.iformall.enums.EnumCreditLockedStatus; import com.iformall.enums.EnumCreditLockedStatus;
import com.iformall.exception.MallinkException; 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.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@@ -24,10 +23,14 @@ 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.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;


@RestController @RestController
@RequestMapping("/api/couponOrder") @RequestMapping("/api/couponOrder")
@@ -35,9 +38,15 @@ import java.util.Map;
public class WxCouponOrderController extends BaseController { public class WxCouponOrderController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());


@Autowired
private WxMerchantService wxMerchantService;

@Autowired @Autowired
private WxCouponOrderService wxCouponOrderService; private WxCouponOrderService wxCouponOrderService;


@Autowired
private WxCouponService wxCouponService;

@Autowired @Autowired
private WxMerchantBUserService wxMerchantBUserService; private WxMerchantBUserService wxMerchantBUserService;


@@ -47,6 +56,10 @@ public class WxCouponOrderController extends BaseController {
@Autowired @Autowired
private WxCUserService wxCUserService; private WxCUserService wxCUserService;


@Autowired
@Qualifier("couponDetailRedisTemplate")
RedisTemplate<String, WxCouponCVo> cdRedisTemplate;



@ApiOperation("分页列表接口") @ApiOperation("分页列表接口")
@GetMapping("list") @GetMapping("list")
@@ -115,7 +128,61 @@ public class WxCouponOrderController extends BaseController {
if(couponOrderId == null) { if(couponOrderId == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_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<String, WxCouponCVo> 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\"}") @ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}")


+ 3
- 2
mallinkCApi/src/main/java/com/iformall/aop/RedisCacheAspect.java Wyświetl plik

@@ -92,7 +92,8 @@ public class RedisCacheAspect {
// 接口路径 reqPath => /api/xxx // 接口路径 reqPath => /api/xxx
String reqPath = requestUrl.substring(requestUrl.indexOf("/api/")); String reqPath = requestUrl.substring(requestUrl.indexOf("/api/"));
if (cache.md5()) { 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 { } else {
redisKey = StringUtils.join(reqPath, DELIMITER_KEY, tenantId, DELIMITER_KEY, StringUtils.join(token,args, DELIMITER_PARAMS)); 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) { private Object parseCache(ProceedingJoinPoint jp, String redisKey, String value) {
if (StringUtils.isBlank(value)) { if (StringUtils.isBlank(value)) {
log.debug("CacheAspect 缓存存在,解析缓存数据为空:{},key:{}", value, redisKey);
log.debug("CacheAspect 缓存存在,解析缓存数据为空:{},key:{}", value, redisKey);
return null; return null;
} }
Class<?> returnType = ((MethodSignature) jp.getSignature()).getReturnType(); Class<?> returnType = ((MethodSignature) jp.getSignature()).getReturnType();


+ 87
- 13
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java Wyświetl plik

@@ -1,29 +1,41 @@
package com.iformall.controller; 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.ErrorCode;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.enums.EnumCouponChannelActivityStatus; import com.iformall.enums.EnumCouponChannelActivityStatus;
import com.iformall.enums.EnumCouponChannelType; import com.iformall.enums.EnumCouponChannelType;
import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxCouponService; import com.iformall.service.WxCouponService;
import com.iformall.service.WxMerchantService;
import com.iformall.utils.Constant; import com.iformall.utils.Constant;

import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; 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 @RestController
@RequestMapping("/api/wxCoupon") @RequestMapping("/api/wxCoupon")
@@ -35,6 +47,8 @@ public class WxCouponController extends BaseController {
private WxCouponChannelService wxCouponChannelService; private WxCouponChannelService wxCouponChannelService;
@Autowired @Autowired
private WxCouponService couponService; private WxCouponService couponService;
@Autowired
private WxMerchantService merchantService;


@Autowired @Autowired
@Qualifier("couponDetailRedisTemplate") @Qualifier("couponDetailRedisTemplate")
@@ -79,7 +93,8 @@ public class WxCouponController extends BaseController {
wxCouponCVo.setStatus(couponCVo.getStatus()); wxCouponCVo.setStatus(couponCVo.getStatus());
} else { } else {
// 更新状态 // 更新状态
WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL);
// WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL);
WxCouponCVo couponCVo = generateWxCouponCVo(couponChannelIdL);
if (wxCouponCVo == null) { if (wxCouponCVo == null) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY); return new ResultData(ErrorCode.COUPON_IS_EMPTY);
} }
@@ -91,7 +106,17 @@ public class WxCouponController extends BaseController {
return new ResultData(wxCouponCVo); 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) { if (wxCouponCVo == null) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY); return new ResultData(ErrorCode.COUPON_IS_EMPTY);
} }
@@ -103,7 +128,56 @@ public class WxCouponController extends BaseController {


return new ResultData(wxCouponCVo); 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<WxMerchantVo> chantlist = merchantService.findMerchantVoList(param);
if (null != chantlist && chantlist.size()>0) {
wxcv.setMerchantVoList(chantlist);
}
return wxcv;
}
private void updateActivityStatus(WxCouponCVo wxCouponCVo) { private void updateActivityStatus(WxCouponCVo wxCouponCVo) {
if (wxCouponCVo.getTargetAd() != null && if (wxCouponCVo.getTargetAd() != null &&
wxCouponCVo.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) { wxCouponCVo.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) {


+ 51
- 3
mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java Wyświetl plik

@@ -1,6 +1,7 @@
package com.iformall.controller; package com.iformall.controller;


import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.annotation.RedisCache;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUser; 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.WxCouponOrder;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxCardCVo; import com.iformall.domain.vo.WxCardCVo;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponOrderCVo; import com.iformall.domain.vo.WxCouponOrderCVo;
import com.iformall.enums.EnumCouponChannelActivityStatus; import com.iformall.enums.EnumCouponChannelActivityStatus;
import com.iformall.enums.EnumCouponOrderStatus; import com.iformall.enums.EnumCouponOrderStatus;
import com.iformall.enums.EnumCouponOrderValidStatus; import com.iformall.enums.EnumCouponOrderValidStatus;
import com.iformall.service.MemCouponFromDspService; import com.iformall.service.MemCouponFromDspService;
import com.iformall.service.WxCouponOrderService; import com.iformall.service.WxCouponOrderService;
import com.iformall.service.WxCouponService;
import com.iformall.utils.Constant; import com.iformall.utils.Constant;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -23,10 +26,14 @@ 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.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;


@RestController @RestController
@RequestMapping("/api/couponOrder") @RequestMapping("/api/couponOrder")
@@ -34,15 +41,22 @@ import java.util.*;
public class WxCouponOrderController extends BaseController { public class WxCouponOrderController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());


@Autowired
private WxCouponService wxCouponService;
@Autowired @Autowired
private WxCouponOrderService wxCouponOrderService; private WxCouponOrderService wxCouponOrderService;


@Autowired @Autowired
private MemCouponFromDspService memCouponFromDspService; private MemCouponFromDspService memCouponFromDspService;


@Autowired
@Qualifier("couponDetailRedisTemplate")
RedisTemplate<String, WxCouponCVo> cdRedisTemplate;

@Autowired @Autowired
StringRedisTemplate stringRedisTemplate; StringRedisTemplate stringRedisTemplate;


@RedisCache(expireTime = 100)
@ApiOperation("券包分页列表接口") @ApiOperation("券包分页列表接口")
@GetMapping("list") @GetMapping("list")
@ApiImplicitParams({ @ApiImplicitParams({
@@ -81,6 +95,7 @@ public class WxCouponOrderController extends BaseController {
return new ResultData(page); return new ResultData(page);
} }


@RedisCache(expireTime = 100, dateUnit = TimeUnit.SECONDS)
@ApiOperation(value = "券详情接口") @ApiOperation(value = "券详情接口")
@GetMapping("detail") @GetMapping("detail")
@ApiImplicitParams({ @ApiImplicitParams({
@@ -92,15 +107,48 @@ public class WxCouponOrderController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
} }


WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderId);

WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId);
if (wxCouponOrderCVo == null) { if (wxCouponOrderCVo == null) {
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
} }

if (!wxCouponOrderCVo.getCUserId().equals(getUserId())) { if (!wxCouponOrderCVo.getCUserId().equals(getUserId())) {
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
} }
WxCouponCVo wxCouponCVo = null;
String key = "cd:" + wxCouponOrderCVo.getCouponId();
ValueOperations<String, WxCouponCVo> 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(); Date now = new Date();
if (wxCouponOrderCVo.getValidStartDate() != null && wxCouponOrderCVo.getValidEndDate() != null ) { if (wxCouponOrderCVo.getValidStartDate() != null && wxCouponOrderCVo.getValidEndDate() != null ) {
if (wxCouponOrderCVo.getValidStartDate().getTime() > now.getTime()) { if (wxCouponOrderCVo.getValidStartDate().getTime() > now.getTime()) {


+ 4
- 4
mallinkCApi/src/main/java/com/iformall/controller/WxLiveController.java Wyświetl plik

@@ -27,13 +27,13 @@ public class WxLiveController extends BaseController {
* @return * @return
*/ */
@ApiOperation("获取所有直播间和商品信息") @ApiOperation("获取所有直播间和商品信息")
@RedisCache(expireTime = 30,dateUnit = TimeUnit.MINUTES)
@RedisCache(expireTime = 5, dateUnit = TimeUnit.MINUTES)
@GetMapping("/roomList") @GetMapping("/roomList")
public ResultData getLiveinfos(String appId) {
public ResultData getLiveinfos(String appId, Integer start, Integer limit) {
ResultData resultData = new ResultData(); ResultData resultData = new ResultData();
try { try {
WxMaService wxMaService = getWeappService(appId); WxMaService wxMaService = getWeappService(appId);
resultData.data = wxMaService.getLiveService().getLiveinfos();
resultData.data = wxMaService.getLiveService().getLiveInfo(start,limit);
} catch (WxErrorException e) { } catch (WxErrorException e) {
logger.error("getLiveinfos error", e); logger.error("getLiveinfos error", e);
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR); throw new MallinkException(ErrorCode.SYS_SERVER_ERROR);
@@ -52,7 +52,7 @@ public class WxLiveController extends BaseController {
* @return * @return
*/ */
@ApiOperation("获取直播房间回放数据和商品信息") @ApiOperation("获取直播房间回放数据和商品信息")
@RedisCache(expireTime = 30,dateUnit = TimeUnit.MINUTES)
@RedisCache(expireTime = 5, dateUnit = TimeUnit.MINUTES)
@GetMapping("/replayList") @GetMapping("/replayList")
public ResultData getLiveReplay(Integer room_id, Integer start, Integer limit) { public ResultData getLiveReplay(Integer room_id, Integer start, Integer limit) {
ResultData resultData = new ResultData(); ResultData resultData = new ResultData();


+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java Wyświetl plik

@@ -41,6 +41,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> {


List<WxCouponOrderCVo> findListOfCUser(WxCouponOrder wxCouponOrder); List<WxCouponOrderCVo> findListOfCUser(WxCouponOrder wxCouponOrder);
WxCouponOrderCVo findDetailOfCUser(@Param("id")Long id); WxCouponOrderCVo findDetailOfCUser(@Param("id")Long id);
WxCouponOrderCVo findSimpleDetailOfCUser(@Param("id")Long id);
List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrderBVo wxCouponOrder); List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrderBVo wxCouponOrder);
WxCouponOrderBVo findDetailOfAdmin(@Param("id")Long id); WxCouponOrderBVo findDetailOfAdmin(@Param("id")Long id);




+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java Wyświetl plik

@@ -123,6 +123,8 @@ public interface WxCouponOrderService {
*/ */
WxCouponOrderCVo detailCUserVo(String couponOrderId); WxCouponOrderCVo detailCUserVo(String couponOrderId);


WxCouponOrderCVo simpleDetailCUserVo(String couponOrderId);

/** /**
* C用户查券carlist * C用户查券carlist
* *


+ 3
- 0
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java Wyświetl plik

@@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional; import java.util.Optional;


/** /**
@@ -139,5 +140,7 @@ public interface WxMerchantService {
Optional<WxMerchant> findByName(String name); Optional<WxMerchant> findByName(String name);


PageInfo<WxMerchant> listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); PageInfo<WxMerchant> listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize);
List<WxMerchantVo> findMerchantVoList(Map paramMap);


} }

+ 3
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxBuserTokenServiceImpl.java Wyświetl plik

@@ -30,7 +30,7 @@ public class WxBuserTokenServiceImpl implements WxBuserTokenService {


@Override @Override
public WxBuser getByToken(String token) { public WxBuser getByToken(String token) {
logger.info("获取用户信息start ...");
logger.info("获取B用户信息start ..." + token);
String key = tokenPrev + token; String key = tokenPrev + token;
ValueOperations<String, WxBuser> operations = bUserTokenRedisTemplate.opsForValue(); ValueOperations<String, WxBuser> operations = bUserTokenRedisTemplate.opsForValue();


@@ -39,12 +39,13 @@ public class WxBuserTokenServiceImpl implements WxBuserTokenService {
if (hasKey) { if (hasKey) {
// 从缓存获取用户信息 // 从缓存获取用户信息
WxBuser user = operations.get(key); WxBuser user = operations.get(key);
logger.info("缓存中获取B用户信息End ..." + token);
return user; return user;
} }
WxBuser user = wxBuserMapper.findByToken(token); WxBuser user = wxBuserMapper.findByToken(token);
// 插入缓存 // 插入缓存
operations.set(key, user, 3600, TimeUnit.SECONDS); operations.set(key, user, 3600, TimeUnit.SECONDS);
logger.info("DB中获取B用户信息End ..." + token);
return user; return user;
} }




+ 3
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCUserTokenServiceImpl.java Wyświetl plik

@@ -34,7 +34,7 @@ public class WxCUserTokenServiceImpl implements WxCUserTokenService {


@Override @Override
public WxCUser getByToken(String token) { public WxCUser getByToken(String token) {
logger.info("获取用户信息start ...");
logger.info("获取用户信息start ..." + token);
String key = tokenPrev + token; String key = tokenPrev + token;
ValueOperations<String, WxCUser> operations = cUserTokenRedisTemplate.opsForValue(); ValueOperations<String, WxCUser> operations = cUserTokenRedisTemplate.opsForValue();


@@ -43,12 +43,13 @@ public class WxCUserTokenServiceImpl implements WxCUserTokenService {
if(hasKey) { if(hasKey) {
// 从缓存获取用户信息 // 从缓存获取用户信息
WxCUser user = operations.get(key); WxCUser user = operations.get(key);
logger.info("缓存中获取用户信息End-" + token);
return user; return user;
} }
WxCUser user = wxCUserMapper.findByToken(token); WxCUser user = wxCUserMapper.findByToken(token);
// 插入缓存 // 插入缓存
operations.set(key, user, 3600, TimeUnit.SECONDS); operations.set(key, user, 3600, TimeUnit.SECONDS);
logger.info("DB中获取用户信息End-" + token);
return user; return user;
} }




+ 14
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Wyświetl plik

@@ -32,6 +32,8 @@ 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;
@@ -130,6 +132,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
@Autowired @Autowired
WxPayOrderMapper payOrderMapper; WxPayOrderMapper payOrderMapper;


@Autowired
@Qualifier("couponDetailRedisTemplate")
RedisTemplate<String, WxCouponCVo> cdRedisTemplate;

private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


@Override @Override
@@ -240,6 +246,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
return wxCouponOrderCVo; 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 @Override
public ResultData carListCUserVoAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { public ResultData carListCUserVoAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) {


+ 6
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Wyświetl plik

@@ -789,4 +789,10 @@ public class WxMerchantServiceImpl implements WxMerchantService {
public PageInfo<WxMerchantTradeDetailVo> userTradeDetailList(WxMerchant record, Integer pageIndex, Integer pageSize) { public PageInfo<WxMerchantTradeDetailVo> userTradeDetailList(WxMerchant record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.userTradeDetailList(record)); return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.userTradeDetailList(record));
} }


@Override
public List<WxMerchantVo> findMerchantVoList(Map paramMap) {
return wxCouponMerchantMapper.findMerchantVoList(paramMap);
}
} }

+ 11
- 1
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Wyświetl plik

@@ -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 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
</sql> </sql>


<sql id="simpleCUserCouponOrderDetailColumns">
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
</sql>

<resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxCouponOrderCVo"> <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxCouponOrderCVo">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" /> <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
@@ -941,11 +945,17 @@


<select id="findDetailOfCUser" parameterType="java.lang.Long" resultMap="CVoResultMap"> <select id="findDetailOfCUser" parameterType="java.lang.Long" resultMap="CVoResultMap">
select <include refid="allCUserCouponOrderDetailColumns" /> select <include refid="allCUserCouponOrderDetailColumns" />
from wx_coupon_order co,wx_coupon c
from wx_coupon_order co, wx_coupon c
where co.coupon_id = c.id where co.coupon_id = c.id
and co.id = #{id} and co.id = #{id}
</select> </select>


<select id="findSimpleDetailOfCUser" parameterType="java.lang.Long" resultMap="CVoResultMap">
select <include refid="simpleCUserCouponOrderDetailColumns" />
from wx_coupon_order co
where co.id = #{id}
</select>

<select id="findAvailCouponOrder" parameterType="java.util.Map" resultMap="CVoResultMap"> <select id="findAvailCouponOrder" parameterType="java.util.Map" resultMap="CVoResultMap">
select <include refid="allCUserCouponOrderDetailColumns" /> select <include refid="allCUserCouponOrderDetailColumns" />
from wx_coupon_order co from wx_coupon_order co


Ładowanie…
Anuluj
Zapisz