diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index d412b944f..8087f87f7 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; -/**w +/** * @author gongbiao */ @RestController diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 6b1e9be95..fe9ee7adf 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -13,6 +13,7 @@ import com.iformall.domain.po.msg.WxMsgRecord; import com.iformall.domain.vo.FlowUserVo; import com.iformall.domain.vo.UserTaskVo; import com.iformall.domain.vo.WxBillAll; +import com.iformall.domain.vo.WxCouponChannelVo; import com.iformall.enums.*; import com.iformall.mapper.*; import com.iformall.mq.MqBaseProducer; @@ -38,6 +39,8 @@ import org.flowable.task.api.TaskQuery; 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; @@ -90,6 +93,9 @@ public class WxFlowServiceImpl implements WxFlowService { private WxBillSettleMapper wxBillSettleMapper; @Autowired private WxBillSettleService wxBillSettleService; + @Autowired + @Qualifier("couponChannelRedisTemplate") + RedisTemplate> cdRedisTemplate; /** * 获取流程key @@ -250,8 +256,7 @@ public class WxFlowServiceImpl implements WxFlowService { || EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType) || EnumFlowKey.NEW_GROUP_UPLINE.getCode().equals(flowType) || EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)) { - WxCoupon wxCoupon = new WxCoupon(); - wxCoupon.setId(businessId); + WxCoupon wxCoupon = wxCouponMapper.selectByPrimaryKey(businessId); wxCoupon.setUpdateDate(new Date()); if(EnumCouponAppType.PUT.getCode().equals(operateType)){ @@ -286,6 +291,7 @@ public class WxFlowServiceImpl implements WxFlowService { wxCoupon.setRemainInventory(remainInventory); wxCoupon.setType(type); wxCoupon.setValidType(validType); + wxCoupon.setTenantId(wxCoupon.getTenantId()); wxCouponService.updateCouponStockAndEndTime(wxCoupon); } }else if(EnumCouponAppType.CANCLE.getCode().equals(operateType)){ @@ -298,6 +304,9 @@ public class WxFlowServiceImpl implements WxFlowService { } wxCoupon.setApprovalType(operateType); wxCouponMapper.updateByPrimaryKeySelective(wxCoupon); + + //清除缓存 + clearCache(wxCoupon.getTenantId()); }else if(EnumFlowKey.SETTLE.getCode().equals(flowType)){ WxBillSettle wxBillSettle = new WxBillSettle(); wxBillSettle.setId(businessId); @@ -324,6 +333,17 @@ public class WxFlowServiceImpl implements WxFlowService { } } + /** + * 清除c端首页卷列表缓存 + * @param tenantId + */ + public void clearCache(String tenantId){ + for (int i = 1; i <=5 ; i++) { + String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage()+tenantId+"_" + i + ":"; + cdRedisTemplate.delete(key); + } + } + public Map mallUserInfoToMap(MallUserInfo userInfo){ try { Map map = new HashMap<>(); diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 2a192f5f6..505fa69c4 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -271,7 +271,11 @@ SET `remain_inventory` = #{remainInventory}, `inventory` = #{inventory}, `valid_type` = #{validType}, `valid_end_date` = #{validEndDate}, `valid_days` = #{validDays} - WHERE `tenant_id` = #{tenantId} and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory} + WHERE 1=1 + + and `tenant_id` = #{tenantId} + + and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory}