winter 4 месяцев назад
Родитель
Сommit
a7aaa2da0c
3 измененных файлов: 63 добавлений и 35 удалений
  1. +34
    -27
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
  3. +28
    -7
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java

+ 34
- 27
mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java Просмотреть файл

@@ -60,7 +60,7 @@ public class WxCouponChannelController extends BaseController {
wxCouponChannel.updateTenantInfo(getTenantInfo()); wxCouponChannel.updateTenantInfo(getTenantInfo());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode());
logger.info(">>>>>>>:{}",JSON.toJSONString(wxCouponChannel));
//logger.info(">>>>>>>:{}",JSON.toJSONString(wxCouponChannel));


// if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ // if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){
// //
@@ -79,37 +79,44 @@ public class WxCouponChannelController extends BaseController {
PageInfo<WxCouponChannelVo> page = RedisCacheUtils.getCacheObject(redisTemplate, key, PageInfo.class); PageInfo<WxCouponChannelVo> page = RedisCacheUtils.getCacheObject(redisTemplate, key, PageInfo.class);
//logger.info("WxCouponChannelController.chache.get:{} page:{}",key,page); //logger.info("WxCouponChannelController.chache.get:{} page:{}",key,page);
if (null == page ) { if (null == page ) {
page = wxCouponChannelService.newListPageVo(wxCouponChannel, pageNum, pageSize);
page = wxCouponChannelService.newListPageVo(wxCouponChannel, pageNum, pageSize,false);
if(page.getList() != null && page.getList().size() > 0){
filterTimed(wxCouponChannel, page);
RedisCacheUtils.cache(redisTemplate, key, page, 600);
}
}
return new ResultData(page);
}
//@RedisCache
@ApiOperation("积分商城分页列表接口")
@GetMapping("creditProductList")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true),
@ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)})
public ResultData creditProductList(@ModelAttribute WxCouponChannel wxCouponChannel,Integer pageNum, Integer pageSize) {
if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel();
wxCouponChannel.updateTenantInfo(getTenantInfo());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode());
logger.info(">>>>>>>:{}",JSON.toJSONString(wxCouponChannel));

wxCouponChannel.setShowBeginTime(new Date());

String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage()
+ wxCouponChannel.getTenantId() + "_"
+ wxCouponChannel.getTargetAd() + "_"
+ wxCouponChannel.getBusiness() + "_"
+ pageNum + ":"+ pageNum + ":";
PageInfo<WxCouponChannelVo> page = RedisCacheUtils.getCacheObject(redisTemplate, key, PageInfo.class);
//logger.info("WxCouponChannelController.chache.get:{} page:{}",key,page);
if (null == page ) {
page = wxCouponChannelService.newListPageVo(wxCouponChannel, pageNum, pageSize,true);
if(page.getList() != null && page.getList().size() > 0){ if(page.getList() != null && page.getList().size() > 0){
filterTimed(wxCouponChannel, page); filterTimed(wxCouponChannel, page);
RedisCacheUtils.cache(redisTemplate, key, page, 600); RedisCacheUtils.cache(redisTemplate, key, page, 600);
} }
} }
// if(EnumCouponChannelType.COUPON_CHANNEL_ID_CARD.getCode().equals(wxCouponChannel.getTargetAd())
// || EnumCouponChannelType.COUPON_CHANNEL_ID_CREDIT.getCode().equals(wxCouponChannel.getTargetAd())){
//
//
// PageInfo<WxCouponChannelVo> page = wxCouponChannelService.newListPageVo(wxCouponChannel, pageNum, pageSize);
// if(page.getList() != null && page.getList().size() > 0){
// filterTimed(wxCouponChannel, page);
// }
// return new ResultData(page);
// }
//
// String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage()
// + wxCouponChannel.getTenantId() + "_"
// + wxCouponChannel.getTargetAd() + "_"
// + wxCouponChannel.getBusiness() + "_"
// + pageNum + ":"+ pageNum + ":";
// PageInfo<WxCouponChannelVo> page = RedisCacheUtils.getCacheObject(redisTemplate, key, PageInfo.class);
// logger.info("WxCouponChannelController.chache.get:{} page:{}",key,page);
// if (null == page ) {
// page = wxCouponChannelService.newListPageVo(wxCouponChannel, pageNum, pageSize);
// if(page.getList() != null && page.getList().size() > 0){
// filterTimed(wxCouponChannel, page);
// RedisCacheUtils.cache(redisTemplate, key, page, 100);
// }
// }
return new ResultData(page); return new ResultData(page);
} }


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java Просмотреть файл

@@ -66,7 +66,7 @@ public interface WxCouponChannelService {


List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel); List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel);


PageInfo<WxCouponChannelVo> newListPageVo(WxCouponChannel record, Integer pageIndex, Integer pageSize);
PageInfo<WxCouponChannelVo> newListPageVo(WxCouponChannel record, Integer pageIndex, Integer pageSize,boolean isCreditQuery);
PageInfo<WxCoupon> liveHomePage(WxCouponChannel record, Integer pageIndex, Integer pageSize); PageInfo<WxCoupon> liveHomePage(WxCouponChannel record, Integer pageIndex, Integer pageSize);


+ 28
- 7
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -21,6 +21,7 @@ import com.iformall.service.*;
import com.iformall.service.pay.PayServiceFactory; import com.iformall.service.pay.PayServiceFactory;
import com.iformall.utils.Constant; import com.iformall.utils.Constant;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
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;
@@ -450,7 +451,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
* @param wxCouponChannel * @param wxCouponChannel
* @return * @return
*/ */
private List<Long> handleCouponParam(WxCouponChannel wxCouponChannel){
private List<Long> handleCouponParam(WxCouponChannel wxCouponChannel,boolean isCreditQuery){
WxCoupon couponQ = new WxCoupon(); WxCoupon couponQ = new WxCoupon();
couponQ.updateTenantInfo(wxCouponChannel); couponQ.updateTenantInfo(wxCouponChannel);
couponQ.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); couponQ.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode());
@@ -466,12 +467,21 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
if(wxCouponChannel.getSupportTransfer() != null){ if(wxCouponChannel.getSupportTransfer() != null){
couponQ.setSupportTransfer(wxCouponChannel.getSupportTransfer()); couponQ.setSupportTransfer(wxCouponChannel.getSupportTransfer());
} }
if (isCreditQuery) {
if (StringUtils.isNotBlank(wxCouponChannel.getSortOrder()) && "asc".equals(wxCouponChannel.getSortOrder())) {
couponQ.setSortColumns(" credit_price asc");
}else if(StringUtils.isNotBlank(wxCouponChannel.getSortOrder()) && "desc".equals(wxCouponChannel.getSortOrder())){
couponQ.setSortColumns(" credit_price desc");
}else {
//do nothing
}
}
List<Long> cids = wxCouponMapper.findIdList(couponQ); List<Long> cids = wxCouponMapper.findIdList(couponQ);
return cids; return cids;
} }


private void handleCouponIds(WxCouponChannel wxCouponChannel){
List<Long> cids =handleCouponParam(wxCouponChannel);
private void handleCouponIds(WxCouponChannel wxCouponChannel,boolean isCreditQuery){
List<Long> cids =handleCouponParam(wxCouponChannel,isCreditQuery);
if(cids == null || cids.isEmpty()){ if(cids == null || cids.isEmpty()){
wxCouponChannel.setId(-999L); wxCouponChannel.setId(-999L);
return; return;
@@ -498,6 +508,17 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
return; return;
} }
wxCouponChannel.setCouponIds(cids); wxCouponChannel.setCouponIds(cids);
if (isCreditQuery) {
StringBuffer sb = new StringBuffer("");
for (int i = 0 ; i < cids.size(); i++) {
if (i < cids.size()-1) {
sb.append(cids.get(i)).append(",");
}else {
sb.append(cids.get(i));
}
}
wxCouponChannel.setSortColumns("FIELD(coupon_id,"+sb.toString()+")");
}
} }


private List<WxCouponChannelVo> handleWxCouponChannelVo(List<WxCouponChannel> list, TenantEntity tenantEntity){ private List<WxCouponChannelVo> handleWxCouponChannelVo(List<WxCouponChannel> list, TenantEntity tenantEntity){
@@ -528,7 +549,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {


@Override @Override
public List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel) { public List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel) {
handleCouponIds(wxCouponChannel);
handleCouponIds(wxCouponChannel,false);
if(wxCouponChannel.getId() != null && wxCouponChannel.getId().equals(-999L)){ if(wxCouponChannel.getId() != null && wxCouponChannel.getId().equals(-999L)){
return new ArrayList<>(); return new ArrayList<>();
} }
@@ -544,9 +565,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
* @return * @return
*/ */
@Override @Override
public PageInfo<WxCouponChannelVo> newListPageVo(WxCouponChannel record, Integer pageIndex, Integer pageSize) {
public PageInfo<WxCouponChannelVo> newListPageVo(WxCouponChannel record, Integer pageIndex, Integer pageSize,boolean isCreditQuery) {


handleCouponIds(record);
handleCouponIds(record,isCreditQuery);
if(record.getId() != null && record.getId().equals(-999L)){ if(record.getId() != null && record.getId().equals(-999L)){
return new PageInfo<WxCouponChannelVo>(); return new PageInfo<WxCouponChannelVo>();
} }
@@ -916,7 +937,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {


@Override @Override
public PageInfo<TtCouponChannelVo> ttChannelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { public PageInfo<TtCouponChannelVo> ttChannelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) {
handleCouponIds(ttChannelVo);
handleCouponIds(ttChannelVo,false);
if(ttChannelVo.getId() != null && ttChannelVo.getId().equals(-999L)){ if(ttChannelVo.getId() != null && ttChannelVo.getId().equals(-999L)){
return new PageInfo<TtCouponChannelVo>(); return new PageInfo<TtCouponChannelVo>();
} }


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