| @@ -14,6 +14,7 @@ import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.util.CouponCacheUtils; | |||||
| import com.iformall.utils.RedisLock; | import com.iformall.utils.RedisLock; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -24,6 +25,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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| @@ -45,6 +48,10 @@ public class WxCouponChannelController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> redisTemplate; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -86,6 +93,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| if(couponChannel!=null){ | if(couponChannel!=null){ | ||||
| wxCouponChannelService.updateQrCode(couponChannel,couponChannel.getId(),couponChannel.getType()); | wxCouponChannelService.updateQrCode(couponChannel,couponChannel.getId(),couponChannel.getType()); | ||||
| } | } | ||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -109,6 +117,14 @@ public class WxCouponChannelController extends BaseController { | |||||
| String[] channelId = wxCouponChannelDto.getChannelId().split(","); | String[] channelId = wxCouponChannelDto.getChannelId().split(","); | ||||
| ResultData resultData = wxCouponChannelService.addBatch(wxCouponChannelDto.getType(),ids, channelId, getTenantInfo(), | ResultData resultData = wxCouponChannelService.addBatch(wxCouponChannelDto.getType(),ids, channelId, getTenantInfo(), | ||||
| wxCouponChannelDto.getShowBeginTime(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime(),wxCouponChannelDto.getChannelPrice(),wxCouponChannelDto.getChannelStock()); | wxCouponChannelDto.getShowBeginTime(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime(),wxCouponChannelDto.getChannelPrice(),wxCouponChannelDto.getChannelStock()); | ||||
| if (null != channelId && channelId.length > 0 ) { | |||||
| for (String chId: channelId) { | |||||
| if (!StringUtils.isBlank(chId)) { | |||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, Long.parseLong(chId)); | |||||
| } | |||||
| } | |||||
| } | |||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -149,6 +165,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| wxCouponChannelService.setChannelStock(wxCouponChannel, wxCouponChannel.getChannelStock()); | wxCouponChannelService.setChannelStock(wxCouponChannel, wxCouponChannel.getChannelStock()); | ||||
| redisLock.setCouponStock(wxCouponChannel.getCouponId(), coupon.getRemainInventory()); | redisLock.setCouponStock(wxCouponChannel.getCouponId(), coupon.getRemainInventory()); | ||||
| redisLock.setCouponChannelStock(wxCouponChannel.getId(), wxCouponChannel.getChannelStock()); | redisLock.setCouponChannelStock(wxCouponChannel.getId(), wxCouponChannel.getChannelStock()); | ||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||||
| return new ResultData(Result.SUCCESS, "设置成功", ""); | return new ResultData(Result.SUCCESS, "设置成功", ""); | ||||
| }catch(MallinkException e) { | }catch(MallinkException e) { | ||||
| logger.error("setChannelStock error.",e); | logger.error("setChannelStock error.",e); | ||||
| @@ -168,6 +185,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| wxCouponChannelService.releaseChannelStock(wxCouponChannel); | wxCouponChannelService.releaseChannelStock(wxCouponChannel); | ||||
| redisLock.removeCouponStock(wxCouponChannel.getCouponId()); | redisLock.removeCouponStock(wxCouponChannel.getCouponId()); | ||||
| redisLock.removeCouponChannelStock(wxCouponChannel.getId()); | redisLock.removeCouponChannelStock(wxCouponChannel.getId()); | ||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||||
| return new ResultData(Result.SUCCESS, "设置成功", ""); | return new ResultData(Result.SUCCESS, "设置成功", ""); | ||||
| }catch(MallinkException e) { | }catch(MallinkException e) { | ||||
| logger.error("releaseChannelStock error.",e); | logger.error("releaseChannelStock error.",e); | ||||
| @@ -188,6 +206,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| try { | try { | ||||
| wxCouponChannel.updateTenantInfo(getTenantInfo()); | wxCouponChannel.updateTenantInfo(getTenantInfo()); | ||||
| wxCouponChannelService.setChannelPrice(wxCouponChannel); | wxCouponChannelService.setChannelPrice(wxCouponChannel); | ||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||||
| return new ResultData(Result.SUCCESS, "设置成功", ""); | return new ResultData(Result.SUCCESS, "设置成功", ""); | ||||
| }catch(MallinkException e) { | }catch(MallinkException e) { | ||||
| logger.error("setChannelPrice error.",e); | logger.error("setChannelPrice error.",e); | ||||
| @@ -205,6 +224,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| wxCouponChannel.updateTenantInfo(getTenantInfo()); | wxCouponChannel.updateTenantInfo(getTenantInfo()); | ||||
| try { | try { | ||||
| wxCouponChannelService.setChannelPrice(wxCouponChannel); | wxCouponChannelService.setChannelPrice(wxCouponChannel); | ||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||||
| return new ResultData(Result.SUCCESS, "设置成功", ""); | return new ResultData(Result.SUCCESS, "设置成功", ""); | ||||
| }catch(MallinkException e) { | }catch(MallinkException e) { | ||||
| logger.error("releaseSetChannelPrice error.",e); | logger.error("releaseSetChannelPrice error.",e); | ||||
| @@ -21,6 +21,7 @@ import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.WxFlowService; | import com.iformall.service.WxFlowService; | ||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| import com.iformall.service.WxPayAccountService; | import com.iformall.service.WxPayAccountService; | ||||
| import com.iformall.service.util.CouponCacheUtils; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.RedisLock; | import com.iformall.utils.RedisLock; | ||||
| @@ -34,6 +35,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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| @@ -58,6 +61,10 @@ public class WxCouponController extends BaseController { | |||||
| private WxMallService wxMallService; | private WxMallService wxMallService; | ||||
| @Autowired | @Autowired | ||||
| RedisLock redisLock; | RedisLock redisLock; | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> redisTemplate; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -170,6 +177,8 @@ public class WxCouponController extends BaseController { | |||||
| //修改coupon applyStatus状态为审核中 | //修改coupon applyStatus状态为审核中 | ||||
| wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); | wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); | ||||
| } | } | ||||
| CouponCacheUtils.setCouponCache(redisTemplate, wxCoupon.getId(), wxCoupon); | |||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -213,7 +222,10 @@ public class WxCouponController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| return wxCouponService.saveOrUpdate(wxCoupon); | |||||
| ResultData result = wxCouponService.saveOrUpdate(wxCoupon); | |||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); | |||||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); | |||||
| return result; | |||||
| } | } | ||||
| @ApiOperation("根据id更新库存及有效期接口") | @ApiOperation("根据id更新库存及有效期接口") | ||||
| @@ -336,7 +348,7 @@ public class WxCouponController extends BaseController { | |||||
| redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | ||||
| return wxCouponService.updateCouponStockAndEndTime(wxCoupon); | return wxCouponService.updateCouponStockAndEndTime(wxCoupon); | ||||
| } | } | ||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -347,6 +359,8 @@ public class WxCouponController extends BaseController { | |||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | ||||
| wxCouponService.deleteById(id,getTenantInfo().getTenantId()); | wxCouponService.deleteById(id,getTenantInfo().getTenantId()); | ||||
| CouponCacheUtils.removeCouponCache(redisTemplate, id); | |||||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -498,6 +512,9 @@ public class WxCouponController extends BaseController { | |||||
| wxCouponPassword.setCouponId(0L); | wxCouponPassword.setCouponId(0L); | ||||
| } | } | ||||
| couponPasswordService.exportData(request, response, wxCouponPassword); | couponPasswordService.exportData(request, response, wxCouponPassword); | ||||
| if (null != wxCouponPassword.getCouponId()) { | |||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCouponPassword.getCouponId()); | |||||
| } | |||||
| } | } | ||||
| @ApiOperation("根据id获取富文本接口") | @ApiOperation("根据id获取富文本接口") | ||||
| @@ -520,7 +537,9 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(ResultData.ERROR, "缺少validEndDate"); | return new ResultData(ResultData.ERROR, "缺少validEndDate"); | ||||
| } | } | ||||
| return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),getTenantInfo().getTenantId(),wxCoupon.getValidEndDate())); | |||||
| ResultData result = wxCouponService.cardDefer(wxCoupon.getId(),getTenantInfo().getTenantId(),wxCoupon.getValidEndDate()); | |||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); | |||||
| return result; | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,6 +9,8 @@ import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.util.CouponCacheUtils; | |||||
| 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; | ||||
| @@ -17,6 +19,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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| @@ -32,6 +36,10 @@ public class WxCouponChannelController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponChannelService wxCouponChannelService; | private WxCouponChannelService wxCouponChannelService; | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> redisTemplate; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -68,6 +76,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| if(couponChannel!=null){ | if(couponChannel!=null){ | ||||
| wxCouponChannelService.updateQrCode(couponChannel,couponChannel.getId(),couponChannel.getType()); | wxCouponChannelService.updateQrCode(couponChannel,couponChannel.getId(),couponChannel.getType()); | ||||
| } | } | ||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -88,6 +97,13 @@ public class WxCouponChannelController extends BaseController { | |||||
| String[] ids = wxCouponChannelDto.getCouponIds().split(","); | String[] ids = wxCouponChannelDto.getCouponIds().split(","); | ||||
| String[] channelId = wxCouponChannelDto.getChannelId().split(","); | String[] channelId = wxCouponChannelDto.getChannelId().split(","); | ||||
| ResultData resultData = wxCouponChannelService.addBatch(wxCouponChannelDto.getType(),ids, channelId, getTenantInfo(),wxCouponChannelDto.getShowBeginTime(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime(),null,null); | ResultData resultData = wxCouponChannelService.addBatch(wxCouponChannelDto.getType(),ids, channelId, getTenantInfo(),wxCouponChannelDto.getShowBeginTime(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime(),null,null); | ||||
| if (null != channelId && channelId.length > 0 ) { | |||||
| for (String chId: channelId) { | |||||
| if (!StringUtils.isBlank(chId)) { | |||||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, Long.parseLong(chId)); | |||||
| } | |||||
| } | |||||
| } | |||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -17,6 +17,7 @@ import com.iformall.domain.vo.WxCouponStatisVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | import com.iformall.mapper.WxCouponChannelMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.util.CouponCacheUtils; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.RedisLock; | import com.iformall.utils.RedisLock; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -29,6 +30,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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| @@ -55,6 +58,10 @@ public class WxCouponController extends BaseController { | |||||
| private WxMallService wxMallService; | private WxMallService wxMallService; | ||||
| @Autowired | @Autowired | ||||
| RedisLock redisLock; | RedisLock redisLock; | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> redisTemplate; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -217,6 +224,7 @@ public class WxCouponController extends BaseController { | |||||
| //修改coupon applyStatus状态为审核中 | //修改coupon applyStatus状态为审核中 | ||||
| wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); | wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); | ||||
| } | } | ||||
| CouponCacheUtils.setCouponCache(redisTemplate, wxCoupon.getId(), wxCoupon); | |||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -252,7 +260,10 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | ||||
| } | } | ||||
| redisLock.setCouponStock(wxCoupon.getId(), coupon.getRemainInventory()); | redisLock.setCouponStock(wxCoupon.getId(), coupon.getRemainInventory()); | ||||
| return wxCouponService.saveOrUpdate(wxCoupon); | |||||
| ResultData result = wxCouponService.saveOrUpdate(wxCoupon); | |||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); | |||||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); | |||||
| return result; | |||||
| } | } | ||||
| @ApiOperation("根据id更新库存及有效期接口") | @ApiOperation("根据id更新库存及有效期接口") | ||||
| @@ -323,7 +334,9 @@ public class WxCouponController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | ||||
| return wxCouponService.updateCouponStockAndEndTime(wxCoupon); | |||||
| ResultData result = wxCouponService.updateCouponStockAndEndTime(wxCoupon); | |||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); | |||||
| return result; | |||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||
| @@ -335,6 +348,8 @@ public class WxCouponController extends BaseController { | |||||
| } | } | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | ||||
| wxCouponService.deleteById(id,getTenantInfo().getTenantId()); | wxCouponService.deleteById(id,getTenantInfo().getTenantId()); | ||||
| CouponCacheUtils.removeCouponCache(redisTemplate, id); | |||||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -433,6 +448,9 @@ public class WxCouponController extends BaseController { | |||||
| wxCouponPassword.setCouponId(0L); | wxCouponPassword.setCouponId(0L); | ||||
| } | } | ||||
| couponPasswordService.exportData(request, response, wxCouponPassword); | couponPasswordService.exportData(request, response, wxCouponPassword); | ||||
| if (null != wxCouponPassword.getCouponId()) { | |||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCouponPassword.getCouponId()); | |||||
| } | |||||
| } | } | ||||
| @ApiOperation("根据id获取富文本接口") | @ApiOperation("根据id获取富文本接口") | ||||
| @@ -221,10 +221,7 @@ public class WxCouponController extends BaseController { | |||||
| } | } | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||||
| @Deprecated | |||||
| @ApiOperation("根据id(couponChannel)查询接口") | @ApiOperation("根据id(couponChannel)查询接口") | ||||
| @GetMapping("/detail") | @GetMapping("/detail") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -371,32 +368,6 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(wxCouponCVo); | return new ResultData(wxCouponCVo); | ||||
| } | } | ||||
| // @ApiOperation("根据id(couponId)查询接口") | |||||
| // @GetMapping("/getMerchantList") | |||||
| // @ApiImplicitParams({ | |||||
| // @ApiImplicitParam(name = "couponId", value = "couponId", dataType = "String", paramType = "query", required = true) | |||||
| // }) | |||||
| // public ResultData getMerchantList(Long couponId) { | |||||
| // | |||||
| // if (couponId == null) { | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| // } | |||||
| // | |||||
| // String key = Constant.coupon_merchants_key+getTenantInfo().getTenantId()+":"+couponId; | |||||
| // | |||||
| // List<WxMerchantVo> valueList = RedisCacheUtils.getCacheListObject(objectCommonRedisTemplate, key, WxMerchantVo.class); | |||||
| // if(valueList != null && valueList.size() > 0){ | |||||
| // return new ResultData(valueList); | |||||
| // } | |||||
| // valueList = couponService.getCouponMerchantList(getTenantInfo(),couponId); | |||||
| // if(valueList == null || valueList.size() == 0){ | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| // } | |||||
| // | |||||
| // RedisCacheUtils.cache(objectCommonRedisTemplate,key,valueList,3600l); | |||||
| // return new ResultData(valueList); | |||||
| // } | |||||
| private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL,String tenantId) { | private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL,String tenantId) { | ||||
| WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); | WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); | ||||
| if (cc == null) { | if (cc == null) { | ||||
| @@ -19,6 +19,7 @@ import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.util.CouponCacheUtils; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| @@ -26,7 +27,9 @@ 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.context.annotation.Lazy; | import org.springframework.context.annotation.Lazy; | ||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Isolation; | import org.springframework.transaction.annotation.Isolation; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| @@ -143,6 +146,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Autowired | @Autowired | ||||
| WxBrandMapper wxBrandMapper; | WxBrandMapper wxBrandMapper; | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> redisTemplate; | |||||
| @Override | @Override | ||||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -446,6 +453,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxCoupon.updateTenantInfo(wxMerchant); | wxCoupon.updateTenantInfo(wxMerchant); | ||||
| wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); | wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); | ||||
| wxCouponService.saveOrUpdate(wxCoupon); | wxCouponService.saveOrUpdate(wxCoupon); | ||||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, cid); | |||||
| }); | }); | ||||
| } | } | ||||
| } | } | ||||