Просмотр исходного кода

[修改][首页列表缓存][优化代码]

release_toaliyun_real
luozukai 6 лет назад
Родитель
Сommit
fff84506d1
3 измененных файлов: 28 добавлений и 4 удалений
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java
  2. +22
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java
  3. +5
    -1
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 1
- 1
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


+ 22
- 2
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<String, PageInfo<WxCouponChannelVo>> 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,7 +291,11 @@ public class WxFlowServiceImpl implements WxFlowService {
wxCoupon.setRemainInventory(remainInventory);
wxCoupon.setType(type);
wxCoupon.setValidType(validType);
wxCoupon.setTenantId(wxCoupon.getTenantId());
wxCouponService.updateCouponStockAndEndTime(wxCoupon);

//清除缓存
clearCache(wxCoupon.getTenantId());
}
}else if(EnumCouponAppType.CANCLE.getCode().equals(operateType)){
wxCoupon.setCancleApplyStatus(applyStatus);
@@ -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<String,Object> mallUserInfoToMap(MallUserInfo userInfo){
try {
Map<String, Object> map = new HashMap<>();


+ 5
- 1
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
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory}
</update>




Загрузка…
Отмена
Сохранить