| | |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager; |
| | | import com.yeshi.buwan.util.SolrUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.LinuxRemoteCommandUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | |
| | | /** |
| | |
| | | @Component |
| | | public class SolrJob { |
| | | |
| | | @Resource |
| | | private SolrAlbumVideoDataManager solrAlbumDataManager; |
| | | |
| | | @Resource |
| | | private SolrCommonVideoDataManager solrCommonVideoDataManager; |
| | | |
| | | @XxlJob("solr-watch") |
| | | public ReturnT<String> reStartSolr(String param) throws Exception { |
| | | String solrIP = "172.16.16.12"; |
| | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 同步专辑 |
| | | * |
| | | * @param param |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @XxlJob("solr-syncAlbum") |
| | | public ReturnT<String> syncAlbum(String param) throws Exception { |
| | | solrAlbumDataManager.syncAllAlbum(); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 同步常规搜索 |
| | | * |
| | | * @param param |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @XxlJob("solr-syncVideoCore") |
| | | public ReturnT<String> syncCore(String param) throws Exception { |
| | | //同步视频 |
| | | SolrUtil.dataimportVideo(param); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | @XxlJob("solr-syncCommonVideo") |
| | | public ReturnT<String> syncCommonVideo(String param) throws Exception { |
| | | Long minId = null; |
| | | if (!StringUtil.isNullOrEmpty(param)) { |
| | | minId = Long.parseLong(param); |
| | | } |
| | | //同步视频 |
| | | solrCommonVideoDataManager.syncAllVideo(minId); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | } |