| @@ -3,7 +3,6 @@ package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.EnumCouponChannelActivityStatus; | |||||
| import com.iformall.enums.EnumWxTopicStatus; | import com.iformall.enums.EnumWxTopicStatus; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -13,7 +12,6 @@ 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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @RestController | @RestController | ||||
| @@ -33,13 +31,12 @@ public class WxTopicController extends BaseController { | |||||
| String tenantId = getTenantId(); | String tenantId = getTenantId(); | ||||
| wxTopic.setTenantId(tenantId); | wxTopic.setTenantId(tenantId); | ||||
| PageInfo<WxTopic> page = wxTopicService.listAsPage(wxTopic, pageNum, pageSize); | PageInfo<WxTopic> page = wxTopicService.listAsPage(wxTopic, pageNum, pageSize); | ||||
| Date now = new Date(); | |||||
| page.getList().stream().forEach(cc->{ | |||||
| if (cc.getEndTime()!=null && now.getTime() > cc.getEndTime().getTime()) { | |||||
| cc.setStatus(EnumWxTopicStatus.INVAILD.getCode()); | |||||
| } | |||||
| }); | |||||
| // Date now = new Date(); | |||||
| // page.getList().stream().forEach(cc->{ | |||||
| // if (cc.getEndTime()!=null && now.getTime() > cc.getEndTime().getTime()) { | |||||
| // cc.setStatus(EnumWxTopicStatus.INVAILD.getCode()); | |||||
| // } | |||||
| // }); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -61,6 +61,17 @@ public class WxTopic implements Serializable { | |||||
| private String statusStr; | private String statusStr; | ||||
| @Transient | @Transient | ||||
| protected List<Integer> statusList; | protected List<Integer> statusList; | ||||
| //查询下架状态 | |||||
| @Transient | |||||
| private boolean queryDownLineStatus; | |||||
| public boolean isQueryDownLineStatus() { | |||||
| return queryDownLineStatus; | |||||
| } | |||||
| public void setQueryDownLineStatus(boolean queryDownLineStatus) { | |||||
| this.queryDownLineStatus = queryDownLineStatus; | |||||
| } | |||||
| public List<Integer> getStatusList() { | public List<Integer> getStatusList() { | ||||
| return statusList; | return statusList; | ||||
| @@ -11,4 +11,5 @@ public interface WxTopicMapper extends CommonMapper<WxTopic, String> { | |||||
| WxTopic show(WxTopic record); | WxTopic show(WxTopic record); | ||||
| void updateStatus(); | |||||
| } | } | ||||
| @@ -8,6 +8,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.domain.po.WxCouponTopic; | import com.iformall.domain.po.WxCouponTopic; | ||||
| import com.iformall.domain.po.WxTopic; | import com.iformall.domain.po.WxTopic; | ||||
| import com.iformall.enums.EnumWxTopicStatus; | |||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.mapper.WxCouponTopicMapper; | import com.iformall.mapper.WxCouponTopicMapper; | ||||
| import com.iformall.mapper.WxTopicMapper; | import com.iformall.mapper.WxTopicMapper; | ||||
| @@ -35,8 +36,26 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponMapper wxCouponMapper; | private WxCouponMapper wxCouponMapper; | ||||
| // public void isQueryDownLineStatus(WxTopic record){ | |||||
| // record.setQueryDownLineStatus(false); | |||||
| // if(record.getStatus().equals(EnumWxTopicStatus.INVAILD.getCode())){ | |||||
| // record.setQueryDownLineStatus(true); | |||||
| // return; | |||||
| // } | |||||
| // if(StringUtils.isNotBlank(record.getStatusStr())){ | |||||
| // String[] array = record.getStatusStr().split(","); | |||||
| // for (String status:array) { | |||||
| // if(status.equals(EnumWxTopicStatus.INVAILD.getCode().toString())){ | |||||
| // record.setQueryDownLineStatus(true); | |||||
| // break; | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| @Override | @Override | ||||
| public PageInfo<WxTopic> listAsPage(WxTopic record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxTopic> listAsPage(WxTopic record, Integer pageIndex, Integer pageSize) { | ||||
| wxTopicMapper.updateStatus(); | |||||
| if(StringUtils.isNotBlank(record.getStatusStr())){ | if(StringUtils.isNotBlank(record.getStatusStr())){ | ||||
| String[] array = record.getStatusStr().split(","); | String[] array = record.getStatusStr().split(","); | ||||
| List<Integer> integerList = new ArrayList<>(); | List<Integer> integerList = new ArrayList<>(); | ||||
| @@ -26,13 +26,9 @@ | |||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and `id` = #{id} | and `id` = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != beginTime "> | <if test=" null != beginTime "> | ||||
| and `begin_time` >= #{beginTime} | and `begin_time` >= #{beginTime} | ||||
| </if> | </if> | ||||
| @@ -45,7 +41,9 @@ | |||||
| #{statusItem} | #{statusItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != name and ''!=name "> | |||||
| and `name` like concat('%',#{name},'%') | |||||
| </if> | |||||
| order by createtime desc | order by createtime desc | ||||
| </sql> | </sql> | ||||
| @@ -60,5 +58,8 @@ | |||||
| order by t.createtime desc limit 1 | order by t.createtime desc limit 1 | ||||
| </select> | </select> | ||||
| <update id="updateStatus"> | |||||
| update wx_topic set status = 2 where now() >= end_time and status !=3 | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||