From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/config/HotSearchServiceImpl.java | 265 +++++++++++++++++++++++++++------------------------- 1 files changed, 138 insertions(+), 127 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/HotSearchServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/HotSearchServiceImpl.java index 3d28ecd..b6bb21d 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/HotSearchServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/HotSearchServiceImpl.java @@ -1,127 +1,138 @@ -package com.yeshi.fanli.service.impl.config; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; - -import org.apache.commons.beanutils.PropertyUtils; -import org.springframework.stereotype.Service; - -import com.yeshi.fanli.dao.mybatis.goods.HotSearchMapper; -import com.yeshi.fanli.entity.bus.search.HotSearch; -import com.yeshi.fanli.entity.bus.su.search.SuperHotSearch; -import com.yeshi.fanli.entity.system.BusinessSystem; -import com.yeshi.fanli.service.inter.config.BusinessSystemService; -import com.yeshi.fanli.service.inter.config.HotSearchService; -import com.yeshi.fanli.service.inter.config.SuperHotSearchService; - -@Service -public class HotSearchServiceImpl implements HotSearchService { - - @Resource - private HotSearchMapper hotSearchMapper; - - @Resource - private BusinessSystemService businessSystemService; - - @Resource - private SuperHotSearchService superHotSearchService; - - - public void addHotSearch(HotSearch hotSearch) { - hotSearch.setCreatetime(java.lang.System.currentTimeMillis()); - hotSearchMapper.insert(hotSearch); - } - - public void deleteHotSearch(long[] hsids) { - for (long hsid : hsids) { - - // superHotSearchService.deleteSuper(id, systemId) - - hotSearchMapper.deleteByPrimaryKey(hsid); - } - } - - public void updateHotSearch(HotSearch hotSearch) { - HotSearch updateSearch = new HotSearch(hotSearch.getId()); - updateSearch.setName(hotSearch.getName()); - updateSearch.setOrderby(hotSearch.getOrderby()); - updateSearch.setUseType(hotSearch.getUseType()); - hotSearchMapper.updateByPrimaryKeySelective(updateSearch); - } - - - - @Override - public List<HotSearch> listQuery(int start, int count, String key, Long systemId, Integer useType) throws Exception { - - List<HotSearch> listObj = hotSearchMapper.listQuery(start, count, key, systemId, useType); - - if (listObj == null || listObj.size() == 0) { - return null; - } - - List<Long> listId = new ArrayList<>(); - for (HotSearch hotSearch : listObj) { - listId.add(hotSearch.getId()); - } - - - List<BusinessSystem> systemList = businessSystemService.getBusinessSystems(); - - List<SuperHotSearch> listSuper = superHotSearchService.listSuperHotSearch(listId); - - if (listSuper == null || listSuper.size() == 0) { - for (HotSearch hotSearch : listObj) { - hotSearch.setSystemList(systemList); - } - } else { - for (HotSearch hotSearch : listObj) { - Long id = hotSearch.getId(); - List<BusinessSystem> newList = new ArrayList<BusinessSystem>(); - - // 鏄惁鏈夊叧鑱旂郴缁熼�夐」 - for (BusinessSystem dsystem : systemList) { - BusinessSystem newsystem = new BusinessSystem(); - - try { - PropertyUtils.copyProperties(newsystem, dsystem); - } catch (Exception e) { - e.printStackTrace(); - } - - if (listSuper != null && listSuper.size() > 0) { - - Long superSystemId = newsystem.getId(); - - for (SuperHotSearch superHotSearch : listSuper) { - HotSearch search = superHotSearch.getHotSearch(); - BusinessSystem system = superHotSearch.getSystem(); - - // 褰撳墠涓撻 銆佸綋鍓嶇郴缁� - if (search != null && system != null && id == search.getId() && superSystemId == system.getId()) { - newsystem.setCheck(1); - break; - } - } - } - - if (newsystem.getCheck() != 1) { - newsystem.setCheck(0); - } - newList.add(newsystem); - } - hotSearch.setSystemList(newList); - } - } - - return listObj; - } - - @Override - public int countList(String key, Long systemId, Integer useType) { - return hotSearchMapper.countQuery(key, systemId, useType); - } - -} +package com.yeshi.fanli.service.impl.config; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + +import com.yeshi.fanli.entity.SystemEnum; +import org.apache.commons.beanutils.PropertyUtils; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import com.yeshi.fanli.dao.mybatis.goods.HotSearchMapper; +import com.yeshi.fanli.entity.bus.search.HotSearch; +import com.yeshi.fanli.entity.bus.su.search.SuperHotSearch; +import com.yeshi.fanli.entity.system.BusinessSystem; +import com.yeshi.fanli.service.inter.config.BusinessSystemService; +import com.yeshi.fanli.service.inter.config.HotSearchService; +import com.yeshi.fanli.service.inter.config.SuperHotSearchService; + +@Service +public class HotSearchServiceImpl implements HotSearchService { + + @Resource + private HotSearchMapper hotSearchMapper; + + @Resource + private BusinessSystemService businessSystemService; + + @Resource + private SuperHotSearchService superHotSearchService; + + + public void addHotSearch(HotSearch hotSearch) { + hotSearch.setCreatetime(java.lang.System.currentTimeMillis()); + hotSearchMapper.insert(hotSearch); + } + + public void deleteHotSearch(Long[] hsids) { + for (Long hsid : hsids) { + + // superHotSearchService.deleteSuper(id, systemId) + + hotSearchMapper.deleteByPrimaryKey(hsid); + } + } + + public void updateHotSearch(HotSearch hotSearch) { + HotSearch updateSearch = new HotSearch(hotSearch.getId()); + updateSearch.setName(hotSearch.getName()); + updateSearch.setOrderby(hotSearch.getOrderby()); + updateSearch.setUseType(hotSearch.getUseType()); + hotSearchMapper.updateByPrimaryKeySelective(updateSearch); + } + + + + @Override + public List<HotSearch> listQuery(int start, int count, String key, Long systemId, Integer useType, SystemEnum system) throws Exception { + + List<HotSearch> listObj = hotSearchMapper.listQuery(start, count, key, systemId, useType,system); + + if (listObj == null || listObj.size() == 0) { + return null; + } + + List<Long> listId = new ArrayList<>(); + for (HotSearch hotSearch : listObj) { + listId.add(hotSearch.getId()); + } + + + List<BusinessSystem> systemList = businessSystemService.getBusinessSystems(); + + List<SuperHotSearch> listSuper = superHotSearchService.listSuperHotSearch(listId); + + if (listSuper == null || listSuper.size() == 0) { + for (HotSearch hotSearch : listObj) { + hotSearch.setSystemList(systemList); + } + } else { + for (HotSearch hotSearch : listObj) { + Long id = hotSearch.getId(); + List<BusinessSystem> newList = new ArrayList<BusinessSystem>(); + + // 鏄惁鏈夊叧鑱旂郴缁熼�夐」 + for (BusinessSystem dsystem : systemList) { + BusinessSystem newsystem = new BusinessSystem(); + + try { + PropertyUtils.copyProperties(newsystem, dsystem); + } catch (Exception e) { + e.printStackTrace(); + } + + if (listSuper != null && listSuper.size() > 0) { + + Long superSystemId = newsystem.getId(); + + for (SuperHotSearch superHotSearch : listSuper) { + HotSearch search = superHotSearch.getHotSearch(); + BusinessSystem s = superHotSearch.getSystem(); + + // 褰撳墠涓撻 銆佸綋鍓嶇郴缁� + if (search != null && system != null && id == search.getId() && superSystemId == s.getId()) { + newsystem.setCheck(1); + break; + } + } + } + + if (newsystem.getCheck() != 1) { + newsystem.setCheck(0); + } + newList.add(newsystem); + } + hotSearch.setSystemList(newList); + } + } + + return listObj; + } + + @Override + public int countList(String key, Long systemId, Integer useType, SystemEnum system) { + return hotSearchMapper.countQuery(key, systemId, useType,system); + } + + + @Override + @Cacheable(value = "crgCache", key = "'getHotSearchCache-' + #useType+'-'+#system") + public List<HotSearch> getHotSearchCache(Integer useType, SystemEnum system) { + return hotSearchMapper.getHotSearchList(useType,system); + } + + + +} -- Gitblit v1.8.0