| | |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | |
| | | * @param show |
| | | * @return |
| | | */ |
| | | public List<FloatAD> list(Boolean show, int start, int count) { |
| | | public List<FloatAD> list(Boolean show, Date showTime, int start, int count) { |
| | | Query query = new Query(); |
| | | Criteria criteria = null; |
| | | if (show != null) |
| | | query.addCriteria(Criteria.where("show").is(show)); |
| | | criteria = Criteria.where("show").is(show); |
| | | |
| | | if (showTime != null) { |
| | | criteria = criteria.andOperator(Criteria.where("endShowTime").gt(showTime), Criteria.where("startShowTime").lte(showTime)); |
| | | } |
| | | |
| | | query.addCriteria(criteria); |
| | | List<Sort.Order> orders = new ArrayList<>(); |
| | | orders.add(new Sort.Order(Sort.Direction.DESC, "weight")); |
| | | query.with(new Sort(orders)); |
| | |
| | | private Boolean show;//是否显示 |
| | | |
| | | @Field |
| | | private Date showStartTime;//展示开始时间 |
| | | |
| | | @Field |
| | | private Date showEndTime;//展示结束时间 |
| | | |
| | | |
| | | @Field |
| | | private Date createTime;//创建时间 |
| | | |
| | | @Field |
| | | private Date updateTime;//更新时间 |
| | | |
| | | |
| | | public Date getShowStartTime() { |
| | | return showStartTime; |
| | | } |
| | | |
| | | public void setShowStartTime(Date showStartTime) { |
| | | this.showStartTime = showStartTime; |
| | | } |
| | | |
| | | public Date getShowEndTime() { |
| | | return showEndTime; |
| | | } |
| | | |
| | | public void setShowEndTime(Date showEndTime) { |
| | | this.showEndTime = showEndTime; |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | |
| | | updateVersionConfig(channel, config, version); |
| | | |
| | | //删除缓存 |
| | | ehCacheManager.removeCacheByCacheName("configCache"); |
| | | ehCacheManager.clearCacheByCacheName("configCache"); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | |
| | | @Override |
| | | public List<FloatAD> listShowAD(int page, int pageSize) { |
| | | return floatADDao.list(true, (page - 1) * pageSize, pageSize); |
| | | return floatADDao.list(true, new Date(), (page - 1) * pageSize, pageSize); |
| | | } |
| | | } |
| | |
| | | * |
| | | * @param cacheName |
| | | */ |
| | | public void removeCacheByCacheName(String cacheName) { |
| | | ehCacheCacheManager.getCacheManager().removeCache(cacheName); |
| | | public void clearCacheByCacheName(String cacheName) { |
| | | Cache cache = ehCacheCacheManager.getCacheManager().getCache(cacheName); |
| | | cache.removeAll(); |
| | | } |
| | | |
| | | /** |
| | |
| | | public class DES { |
| | | @org.junit.Test |
| | | public void test1() { |
| | | String content = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsJzQ3UJcF2YVWOKa55S9JLX9Y2szf7GuFiEGM418zI+M="; |
| | | String content = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsTxe0hnynmQH+utoyj8ZggxDJEPReIgrf6FnSrxRjzV+wAgBYINqPqcWWZ6pPO1HkXg52Y5au+U3gHLqGYjdHSh2cy10asiC2mmphz5KhUBx6b05Kgfl6QbmFGe/zHLW7hAnvinMmlCQGpUqH6atUirKRqCdBvaHChMjinB1gL7xMeD6hHDwa7IO7P2Xsyme3TT9Bd6lWvSRGHhqCSuCQuO+XJlqWQU6ZGiRu8uq1qvOuTEHMre6h9tTucWfJk5RkCNXeasUbPbiP1o4wXdE0N6toS5Udt5NyKXj48g8w9qrh74rgMgGPWbz7iIYtTXX3mvdpR2+6wYRzF100L9URxBugz3roOxFz2r6ItNkCG7CkLuD7ywaHVMkalytDU1ts"; |
| | | System.out.println(DESUtil.decode(content)); } |
| | | } |
| | |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.json.JSONObject; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | |
| | | ad.setWeight(1); |
| | | floatADDao.save(ad); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void getFloatAd() { |
| | | floatADDao.list(true, new Date(), 1, 1); |
| | | } |
| | | } |