35个文件已添加
130个文件已修改
46个文件已删除
| | |
| | | <dependency> |
| | | <groupId>com.yeshi</groupId> |
| | | <artifactId>utils</artifactId> |
| | | <version>0.1.4</version> |
| | | <version>0.3.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.tencentcloudapi</groupId> |
| | | <artifactId>tencentcloud-sdk-java</artifactId> |
| | | <!-- go to https://search.maven.org/search?q=tencentcloud-sdk-java and get the latest version. --> |
| | | <!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 --> |
| | | <version>3.1.472</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>io.netty</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>commons-logging</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.google.code.gson</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>javax.xml.bind</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.ini4j</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | |
| | | </dependency> |
| | | |
| | | <!-- 支付宝相关 --> |
| | | <dependency> |
| | | <groupId>com.alipay.sdk</groupId> |
| | |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | <artifactId>jackson-databind</artifactId> |
| | | <version>2.10.1</version> |
| | | </dependency> |
| | | <!--<dependency>--> |
| | | <!--<groupId>com.fasterxml.jackson.core</groupId>--> |
| | | <!--<artifactId>jackson-databind</artifactId>--> |
| | | <!--<version>2.10.1</version>--> |
| | | <!--</dependency>--> |
| | | |
| | | |
| | | <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload --> |
| | |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- 阿里云DNS解析 --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>tea-openapi</artifactId> |
| | | <version>0.0.19</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>alidns20150109</artifactId> |
| | | <version>2.0.1</version> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | package com.yeshi.buwan.aspect; |
| | | |
| | | import java.lang.reflect.Method; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.yeshi.buwan.log.LogHelper; |
| | | import net.sf.ehcache.CacheManager; |
| | | |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import org.springframework.web.context.request.ServletWebRequest; |
| | | |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.log.LogHelper; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import java.lang.reflect.Method; |
| | | |
| | | @Component |
| | | @Aspect() |
| | |
| | | package com.yeshi.buwan.aspect; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @Component |
| | | @Aspect |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.util.*; |
| | | |
| | |
| | | if (!signIsRight(request)) { |
| | | if (out == null) |
| | | out = response.getWriter(); |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | out.print(JsonUtil.loadFalseJson("签名错误3")); |
| | | return null; |
| | | } |
| | | |
| | |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.context.request.RequestAttributes; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.multipart.MultipartResolver; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartResolver; |
| | | import org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | //如果是Android新版本则调用新的签名方法 |
| | | //布丸3.8.7之后调用新的签名方法 |
| | | |
| | | if (acceptData != null && "android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { |
| | | Map<String, String[]> params = request.getParameterMap(); |
| | | List<String> list = new ArrayList<>(); |
| | | String sign = getNewSign(request, "8888B&*@-uWan88/',@@^"); |
| | | |
| | | //签名 |
| | | for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | if ("sign".equalsIgnoreCase(key)) |
| | | continue; |
| | | list.add(key + "=" + params.get(key)[0]); |
| | | } |
| | | |
| | | Collections.sort(list); |
| | | String str = StringUtil.concat(list, "&"); |
| | | String sign = StringUtil.Md5(str + "8888B&*@-uWan88/',@@^"); |
| | | if (!sign.equalsIgnoreCase(acceptData.getSign())) { |
| | | if (out == null) |
| | | out = response.getWriter(); |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | return null; |
| | | } |
| | | |
| | | } else if ("com.hanju.video.ios".equalsIgnoreCase(acceptData.getPackage())) { |
| | | //IOS韩剧签名方式 |
| | | String sign = getNewSign(request, "8888B&*@-hanJu88/',@@^"); |
| | | if (!sign.equalsIgnoreCase(acceptData.getSign())) { |
| | | if (out == null) |
| | | out = response.getWriter(); |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | return null; |
| | | } |
| | | } else { |
| | | if (!Utils.signIsRight(request)) { |
| | | if (out == null) |
| | |
| | | detailSystem = systemService.getDetailSystemByPackage(acceptData.getChildPackage()); |
| | | acceptData.setChildDetailSystem(detailSystem); |
| | | } |
| | | |
| | | |
| | | return joinPoint.proceed(args); |
| | | } |
| | | |
| | | |
| | | public static String getNewSign(HttpServletRequest request, String signKey) { |
| | | Map<String, String[]> params = request.getParameterMap(); |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | //签名 |
| | | for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | if ("sign".equalsIgnoreCase(key)) |
| | | continue; |
| | | list.add(key + "=" + params.get(key)[0]); |
| | | } |
| | | |
| | | Collections.sort(list); |
| | | String str = StringUtil.concat(list, "&"); |
| | | str+=signKey; |
| | | System.out.println("加密前字符串:"+str); |
| | | String sign = StringUtil.Md5(str ); |
| | | return sign; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.wx.WXUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | package com.yeshi.buwan.controller; |
| | | |
| | | import java.io.PrintWriter; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | | |
| | | import com.yeshi.buwan.util.email.MailSenderUtil; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | import java.io.PrintWriter; |
| | | |
| | | @Controller |
| | | @RequestMapping("email") |
| | |
| | | /** |
| | | * 邮件发送 |
| | | * |
| | | * @param fromAccount |
| | | * 源账户名 |
| | | * @param fromPwd |
| | | * 源密码 |
| | | * @param toAccount |
| | | * 目标账号 |
| | | * @param title |
| | | * 标题 |
| | | * @param content |
| | | * 内容 |
| | | * @param res |
| | | * @param request |
| | | * @param fromAccount 源账户名 |
| | | * @param fromPwd 源密码 |
| | | * @param toAccount 目标账号 |
| | | * @param title 标题 |
| | | * @param content 内容 |
| | | */ |
| | | @RequestMapping(value = "sendEmail") |
| | | public void acFunVideo(String fromAccount, String fromPwd, String toAccount, String title, String content, |
| | | PrintWriter out) { |
| | | boolean isS = MailSenderUtil.sendEmail(toAccount, fromAccount, fromPwd, title, content); |
| | | EmailInfo emailInfo = new EmailInfo(); |
| | | emailInfo.setToEmail(toAccount); |
| | | emailInfo.setTitle(title); |
| | | emailInfo.setFromEmail(fromAccount); |
| | | emailInfo.setFormEmailPwd(fromPwd); |
| | | emailInfo.setContent(content); |
| | | emailInfo.setApp("影视"); |
| | | |
| | | boolean isS = false; |
| | | try { |
| | | EmailApiUtil.sendEmail(emailInfo); |
| | | isS = true; |
| | | } catch (MailSendException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | if (isS) { |
| | | data.put("code", 0); |
| | |
| | | package com.yeshi.buwan.controller; |
| | | |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | | import com.yeshi.buwan.util.user.VipUtil; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.security.GeneralSecurityException; |
| | | import java.security.InvalidAlgorithmParameterException; |
| | | import java.security.InvalidKeyException; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.util.SystemUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | private VideoService videoService; |
| | | @Resource |
| | | private SystemService systemService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @RequestMapping(value = "/searchvideo", method = RequestMethod.POST) |
| | | public void searchVideo(String key, PrintWriter out) { |
| | |
| | | out.print(object); |
| | | } |
| | | |
| | | @RequestMapping(value = "/resourceList", method = RequestMethod.POST) |
| | | public void resourceList(String key, HttpSession session, PrintWriter out) { |
| | | List<VideoResource> videoResources = videoResourceService.getResourceList(); |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("data", new Gson().toJson(videoResources)); |
| | | out.print(object); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.controller.admin.api; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.util.EHCacheManager; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.SystemUtil; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import javax.annotation.Resource; |
| | | import java.io.PrintWriter; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/config") |
| | |
| | | package com.yeshi.buwan.controller.admin.api; |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.SuperHomeType; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; |
| | | import com.yeshi.buwan.domain.recommend.SuperHomeRecommendSpecial; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.web.DetailSystemSelect; |
| | | import com.yeshi.buwan.domain.web.HomeTypeAdmin; |
| | | import com.yeshi.buwan.dto.recommend.HomeRecommendSpecialDTO; |
| | | import com.yeshi.buwan.service.imp.HomeTypeService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.SystemUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.web.tag.PageEntity; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.validation.Valid; |
| | | import java.io.PrintWriter; |
| | | import java.io.Serializable; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | package com.yeshi.buwan.controller.admin.api; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.SuperHomeType; |
| | | import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.web.DetailSystemSelect; |
| | | import com.yeshi.buwan.domain.web.HomeTypeAdmin; |
| | | import com.yeshi.buwan.service.imp.HomeTypeService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.SystemUtil; |
| | | import com.yeshi.buwan.util.video.VideoUtil; |
| | | import com.yeshi.buwan.web.tag.PageEntity; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.validation.Valid; |
| | | import java.io.PrintWriter; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.validation.Valid; |
| | | |
| | | import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.SystemUtil; |
| | | import com.yeshi.buwan.util.video.VideoUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.SuperHomeType; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.web.DetailSystemSelect; |
| | | import com.yeshi.buwan.domain.web.HomeTypeAdmin; |
| | | import com.yeshi.buwan.service.imp.HomeTypeService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.web.tag.PageEntity; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/home") |
| | |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.buwan.domain.special.SearchSpecial; |
| | | import com.yeshi.buwan.domain.special.SearchSpecialPosition; |
| | | import com.yeshi.buwan.service.inter.search.SearchSpecialPositionService; |
| | | import com.yeshi.buwan.service.inter.search.SearchSpecialService; |
| | | import com.yeshi.buwan.util.Constant; |
| | |
| | | package com.yeshi.buwan.controller.admin.api; |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.live.SuperTVLiveCategory; |
| | | import com.yeshi.buwan.domain.live.TVLiveCategory; |
| | | import com.yeshi.buwan.domain.special.Special; |
| | | import com.yeshi.buwan.domain.special.SpecialVideo; |
| | | import com.yeshi.buwan.domain.special.SuperSpecial; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.SystemInfo; |
| | | import com.yeshi.buwan.domain.web.DetailSystemSelect; |
| | | import com.yeshi.buwan.domain.web.SpecialAdmin; |
| | | import com.yeshi.buwan.exception.live.TVLiveCategoryException; |
| | | import com.yeshi.buwan.service.imp.SpecialService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveCategoryService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.web.tag.PageEntity; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | |
| | | import com.google.gson.*; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.domain.live.*; |
| | | import com.yeshi.buwan.domain.web.DetailSystemSelect; |
| | | import com.yeshi.buwan.exception.live.TVLiveCategoryException; |
| | | import com.yeshi.buwan.domain.live.TVLiveCategoryChannelMap; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; |
| | | import com.yeshi.buwan.domain.live.TVLiveResource; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveCategoryChannelService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.vo.tvlive.TVLiveChannelResourceMapAdminVO; |
| | | import com.yeshi.buwan.web.tag.PageEntity; |
| | | import net.sf.json.JSONObject; |
| | |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
New file |
| | |
| | | package com.yeshi.buwan.controller.admin.api; |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.vo.video.CommonVideoSearchQuery; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.yeshi.buwan.domain.video.VideoResourceInfoMap; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceInfoMapService; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/video/video_resource_info_map") |
| | | public class VideoResourceInfoMapAdminController { |
| | | |
| | | @Resource |
| | | private VideoResourceInfoMapService videoResourceInfoMapService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | |
| | | private String loadPrint(String callback, String root) { |
| | | return root; |
| | | } |
| | | |
| | | @RequestMapping("list") |
| | | public void list(CommonVideoSearchQuery query, int page, int limit, String callback, PrintWriter out) { |
| | | List<VideoResourceInfoMap> list = videoResourceInfoMapService.listByDetailSystemId(query.getDetailSystemId(), page, limit); |
| | | |
| | | if (list != null) { |
| | | List<String> ridList = new ArrayList<>(); |
| | | for (VideoResourceInfoMap map : list) { |
| | | ridList.add(map.getResourceId() + ""); |
| | | } |
| | | List<VideoResource> resourceList = videoResourceService.getResource(ridList); |
| | | Map<String, VideoResource> map = resourceList.stream().collect(Collectors.toMap(VideoResource::getId, videoResource -> videoResource)); |
| | | for (VideoResourceInfoMap info : list) { |
| | | info.setResource(map.get(info.getResourceId() + "")); |
| | | } |
| | | } |
| | | |
| | | long count = videoResourceInfoMapService.countByDetailSystemId(query.getDetailSystemId()); |
| | | JSONObject data = new JSONObject(); |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | |
| | | @Override |
| | | public JsonElement serialize(Date date, Type type, JsonSerializationContext jsonSerializationContext) { |
| | | return date == null ? new JsonPrimitive("") : new JsonPrimitive(TimeUtil.getGernalTime(date.getTime(), "yyyy.MM.dd HH:mm")); |
| | | } |
| | | }).create(); |
| | | |
| | | data.put("list", gson.toJson(list)); |
| | | data.put("count", count); |
| | | out.print(loadPrint(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | @RequestMapping("delete") |
| | | public void delete(String ids, String callback, PrintWriter out) { |
| | | Type type = new TypeToken<List<String>>() { |
| | | }.getType(); |
| | | List<String> idList = new Gson().fromJson(ids, type); |
| | | videoResourceInfoMapService.delete(idList); |
| | | out.print(loadPrint(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("add") |
| | | public void add(VideoResourceInfoMap bean, HttpSession session, String callback, PrintWriter out) { |
| | | try { |
| | | videoResourceInfoMapService.add(bean); |
| | | out.print(loadPrint(callback, JsonUtil.loadTrueResult(""))); |
| | | } catch (Exception e) { |
| | | out.print(loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping("get") |
| | | public void get(String id, HttpSession session, String callback, PrintWriter out) { |
| | | VideoResourceInfoMap entity = videoResourceInfoMapService.get(id); |
| | | entity.setResource(videoResourceService.getResource(entity.getResourceId() + "")); |
| | | if (entity != null) { |
| | | out.print(loadPrint(callback, JsonUtil.loadTrueResult(entity))); |
| | | } else { |
| | | out.print(loadPrint(callback, JsonUtil.loadFalseResult("ID不存在"))); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping("update") |
| | | public void update(VideoResourceInfoMap bean, HttpSession session, String callback, PrintWriter out) { |
| | | if (bean.getId() == null) { |
| | | out.print(loadPrint(callback, JsonUtil.loadFalseResult("ID不能为空"))); |
| | | } |
| | | try { |
| | | videoResourceInfoMapService.update(bean); |
| | | } catch (Exception e) { |
| | | out.print(loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | } |
| | | out.print(loadPrint(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.yeshi.buwan.controller.parser.*; |
| | | import com.yeshi.buwan.domain.special.SearchSpecial; |
| | | import com.yeshi.buwan.service.imp.UserService; |
| | | import com.yeshi.buwan.service.inter.baidu.BaiDuCPUService; |
| | | import com.yeshi.buwan.service.inter.search.SearchSpecialService; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.Utils; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | otherParser.getNotice(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getRealUrl")) { |
| | | otherParser.getRealUrl(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("kkinstall")) { |
| | | otherParser.kkInstall(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getIntersection")) { |
| | | otherParser.getIntersection(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("test")) { |
| | |
| | | otherParser.getMeiNvZhiBo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getYearList")) { |
| | | otherParser.getYearList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("addContact")) { |
| | | otherParser.addContact(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("adRecommendRight")) { |
| | | otherParser.adRecommendRight(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("playStatistic")) { |
| | |
| | | private ConfigParser configParser; |
| | | |
| | | @Resource |
| | | private UserVideoParser userVideoParser; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @RequestMapping(value = "/ad/{method}", method = RequestMethod.POST) |
| | |
| | | case "getVideoDetail": |
| | | homeParser.getVideoDetail(acceptData, request, out); |
| | | break; |
| | | case "getVideoDetailV2": |
| | | homeParser.getVideoDetailNew(acceptData, request, out); |
| | | break; |
| | | case "isCollect": |
| | | homeParser.isCollected(acceptData, request, out); |
| | | break; |
| | |
| | | otherParser.getNotice(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getRealUrl")) { |
| | | otherParser.getRealUrl(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("kkinstall")) { |
| | | otherParser.kkInstall(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getIntersection")) { |
| | | otherParser.getIntersection(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("test")) { |
| | |
| | | otherParser.getMeiNvZhiBo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getYearList")) { |
| | | otherParser.getYearList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("addContact")) { |
| | | otherParser.addContact(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("adRecommendRight")) { |
| | | otherParser.adRecommendRight(acceptData, request, out); |
| | | } |
| | |
| | | public void attention(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("addAttention")) {// 获取用户编号 |
| | | attentionParser.addAttention(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("cancelAttention")) { |
| | |
| | | out.close(); |
| | | } |
| | | |
| | | |
| | | // 配置类接口 |
| | | @RequestMapping(value = "/uservideo/{method}", method = RequestMethod.POST) |
| | | public void userVideo(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (method.equalsIgnoreCase("collectVideo")) {// 获取配置信息 |
| | | userVideoParser.collectVideo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("cancelCollectVideo")) { |
| | | userVideoParser.cancelCollectVideo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getCollectVideoList")) { |
| | | userVideoParser.getCollectVideoList(acceptData, request, out); |
| | | } |
| | | |
| | | out.close(); |
| | | } |
| | | |
| | | // 配置类接口 |
| | | @RequestMapping(value = "/config/{method}", method = RequestMethod.POST) |
| | | public void config(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | |
| | | |
| | | import com.yeshi.buwan.service.inter.user.UserDPContentWatchStatisticService; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.apache.zookeeper.Login; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import com.yeshi.buwan.service.inter.goldcorn.SignInService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.manager.GoldCornManager; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.goldcorn.GoldCornCouponVideoVO; |
| | | import com.yeshi.buwan.vo.goldcorn.GoldCornRecordVO; |
| | | import com.yeshi.buwan.vo.goldcorn.GoldCornTaskVO; |
| | | import com.yeshi.buwan.vo.goldcorn.SignInInfoVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.solr.common.params.ConfigSetParams; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.yeshi.buwan.controller.EmailController; |
| | | import com.yeshi.buwan.util.COSManager; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.email.MailSenderUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.yeshi.utils.annotation.RequestSerializableByKey; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/v2/help") |
| | |
| | | buffer.append(content); |
| | | buffer.append("\n\r"); |
| | | buffer.append("提供的截图为:" + urlList); |
| | | MailSenderUtil.sendEmail("yesbd@qq.com","buwanysdq@163.com", "weikou2014",title,buffer.toString()); |
| | | |
| | | |
| | | EmailInfo emailInfo = new EmailInfo(); |
| | | emailInfo.setToEmail("yesbd@qq.com"); |
| | | emailInfo.setTitle(title); |
| | | emailInfo.setFromEmail("buwanysdq@163.com"); |
| | | emailInfo.setFormEmailPwd("weikou2014"); |
| | | emailInfo.setContent(buffer.toString()); |
| | | emailInfo.setApp("影视"); |
| | | |
| | | try { |
| | | EmailApiUtil.sendEmail(emailInfo); |
| | | } catch (MailSendException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return JsonUtilV2.loadTrueJson("成功"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("advice") |
| | | @ResponseBody |
| | | public String advice(AcceptData acceptData, HttpServletRequest request) { |
| | | String content = request.getParameter("content"); |
| | | String type = request.getParameter("type"); |
| | | String uid = request.getParameter("uid"); |
| | | logger.info(String.format("\n意见反馈:\n用户ID:%s\n类型:%s\n内容:%s", uid, type, content)); |
| | | return JsonUtilV2.loadTrueJson(""); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.service.manager.VideoPlayStatisticManager; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.google.gson.*; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.buwan.domain.live.*; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.domain.vip.*; |
| | | import com.yeshi.buwan.dto.order.PPTVVideoPrice; |
| | | import com.yeshi.buwan.dto.order.PayWayInfoDTO; |
| | | import com.yeshi.buwan.exception.PPTVException; |
| | | import com.yeshi.buwan.exception.goldcorn.GoldCornException; |
| | | import com.yeshi.buwan.exception.order.OrderException; |
| | | import com.yeshi.buwan.exception.order.PayException; |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.exception.vip.VideoBuyRecordException; |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | import com.yeshi.buwan.live.migu.MiguLiveApiUtil; |
| | | import com.yeshi.buwan.service.inter.LoginUserService; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.live.*; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPPriceService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.videos.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.videos.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.service.inter.live.MiGuLiveService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveCategoryChannelService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveCategoryService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.client.user.UserInfoVO; |
| | | import com.yeshi.buwan.vo.order.OrderInfoVO; |
| | | import com.yeshi.buwan.vo.tvlive.TVLiveChannelVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.annotation.RequestSerializableByKey; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | import com.yeshi.buwan.domain.tb.YouZhiHaoHuoGoods; |
| | | import com.yeshi.buwan.dto.tb.TaoKeAppInfo; |
| | | import com.yeshi.buwan.dto.tb.TaoLiJinDTO; |
| | | import com.yeshi.buwan.exception.taobao.TaoKeApiException; |
| | | import com.yeshi.buwan.exception.taobao.TaoLiJinCreateException; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | | import com.yeshi.buwan.util.tb.DaTaoKeApiUtil; |
| | |
| | | import com.yeshi.buwan.domain.ad.CommonAdPositionAd; |
| | | import com.yeshi.buwan.domain.recommend.CategoryRecommendVideo; |
| | | import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; |
| | | import com.yeshi.buwan.domain.solr.SolrAlbumVideo; |
| | | import com.yeshi.buwan.domain.special.Special; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.dto.search.SolrResultDTO; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.service.manager.search.SolrInternetSearchVideoDataManager; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.videos.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.imp.recommend.CategoryRecommendVideoService; |
| | |
| | | private SolrAlbumVideoDataManager solrAlbumVideoDataManager; |
| | | |
| | | @Resource |
| | | private SolrInternetSearchVideoDataManager solrInternetSearchVideoDataManager; |
| | | |
| | | @Resource |
| | | private SearchService searchService; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private DetailSystemConfigService detailSystemConfigService; |
| | | |
| | | |
| | | private static String[] getAreas(String area) { |
| | | switch (area) { |
| | | case "港台": |
| | | return new String[]{"香港", "台湾"}; |
| | | case "其他国家": |
| | | return new String[]{"澳大利亚", "新加坡", "印度"}; |
| | | case "欧洲": |
| | | return new String[]{"英国", "法国", "德国", "俄罗斯", "意大利", "土耳其"}; |
| | | default: |
| | | return new String[]{area}; |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequireUid |
| | | public void getClass(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | |
| | | |
| | | |
| | | //Android平台3.8.7之后返回VIP |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { |
| | | |
| | | SuperVideoType sty = new SuperVideoType(); |
| | | sty.setCreatetime(0 + ""); |
| | | sty.setPicture(""); |
| | | VideoType vt = new VideoType(Constant.VIDEO_TYPE_VIP); |
| | | vt.setName("VIP"); |
| | | vt.setShow("1"); |
| | | vt.setIcon("https://hbimg.huabanimg.com/4690ea8f8144f3d46c11e417c77daa5debcb71f9201f-WpAbfw_fw658/format/jpg"); |
| | | sty.setType(vt); |
| | | boolean isC = false; |
| | | for (SuperVideoType svt : list) { |
| | | if (svt.getType().getId() == vt.getId()) { |
| | | isC = true; |
| | | break; |
| | | } |
| | | } |
| | | list.add(sty); |
| | | } |
| | | // if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { |
| | | // |
| | | // SuperVideoType sty = new SuperVideoType(); |
| | | // sty.setCreatetime(0 + ""); |
| | | // sty.setPicture(""); |
| | | // VideoType vt = new VideoType(Constant.VIDEO_TYPE_VIP); |
| | | // vt.setName("VIP"); |
| | | // vt.setShow("1"); |
| | | // vt.setIcon("https://hbimg.huabanimg.com/4690ea8f8144f3d46c11e417c77daa5debcb71f9201f-WpAbfw_fw658/format/jpg"); |
| | | // sty.setType(vt); |
| | | // boolean isC = false; |
| | | // for (SuperVideoType svt : list) { |
| | | // if (svt.getType().getId() == vt.getId()) { |
| | | // isC = true; |
| | | // break; |
| | | // } |
| | | // } |
| | | // list.add(sty); |
| | | // } |
| | | |
| | | |
| | | List<VideoType> typelist = new ArrayList<VideoType>(); |
| | |
| | | long typeid = cc.getParent().getCid(); |
| | | if (StringUtil.isNullOrEmpty(order)) |
| | | order = 1 + ""; |
| | | list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, pageIndex, 20, |
| | | Integer.parseInt(order), resourceList, country, |
| | | StringUtil.Md5(typeid + "-" + detailSystem + "-" + pageIndex + "-" + order + "-" + country |
| | | + "-" + CacheUtil.getMD5Long(resourceList))); |
| | | //通过专辑搜索查询 |
| | | List<String> rids = new ArrayList<>(); |
| | | for (Long rid : resourceList) { |
| | | rids.add(rid + ""); |
| | | } |
| | | |
| | | SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); |
| | | filter.setResourceIds(rids); |
| | | filter.setVideoType((int) typeid); |
| | | filter.setAreas(Arrays.asList(getAreas(country))); |
| | | SolrResultDTO result = solrAlbumVideoDataManager.find(filter, pageIndex, 20); |
| | | |
| | | list = new ArrayList<>(); |
| | | for (Object av : result.getVideoList()) { |
| | | list.add(VideoInfoFactory.create((SolrAlbumVideo) av)); |
| | | } |
| | | count = result.getTotalCount() + ""; |
| | | |
| | | if (pageIndex == 1 && result.getTotalCount() == 0) { |
| | | |
| | | solrInternetSearchVideoDataManager.find(filter,pageIndex,20); |
| | | |
| | | } |
| | | |
| | | |
| | | // list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, pageIndex, 20, |
| | | // Integer.parseInt(order), resourceList, country, |
| | | // StringUtil.Md5(typeid + "-" + detailSystem + "-" + pageIndex + "-" + order + "-" + country |
| | | // + "-" + CacheUtil.getMD5Long(resourceList))); |
| | | System.out.println("列表最终数量:" + list.size()); |
| | | count = 1000 + ""; |
| | | // count = 1000 + ""; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 电话号码绑定 |
| | | * |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 绑定QQ |
| | |
| | | package com.yeshi.buwan.controller.parser; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.annotations.Expose; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.dto.config.ADShieldIPConfig; |
| | | import com.yeshi.buwan.dto.log.BaseLog; |
| | | import com.yeshi.buwan.log.LogHelper; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.ad.FloatADService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.service.manager.IPManager; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | | import com.yeshi.buwan.util.log.UserActiveLogFactory; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Controller |
| | | public class ConfigParser { |
| | |
| | | //注销 |
| | | data.put("unRegisterLink", map.get("unregister_link")); |
| | | |
| | | //关于我们链接 |
| | | data.put("aboutUsLink", map.get("about_us_link")); |
| | | //反馈链接 |
| | | data.put("feedBackLink", map.get("feed_back_link")); |
| | | //帮助链接 |
| | | data.put("helpLink", map.get("help_link")); |
| | | //应用链接 |
| | | data.put("appLink", map.get("app_link")); |
| | | |
| | | //是否正在上线 |
| | | |
| | |
| | | import com.yeshi.buwan.dto.log.BaseLog; |
| | | import com.yeshi.buwan.dto.statistic.video.VideoDetailStatisticData; |
| | | import com.yeshi.buwan.exception.video.VideoPlayException; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceInfoMapService; |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.videos.mogotv.MogoTVUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVApiUtil; |
| | |
| | | |
| | | @Resource |
| | | private APPManager appManager; |
| | | |
| | | @Resource |
| | | private VideoResourceInfoMapService videoResourceInfoMapService; |
| | | |
| | | private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser"); |
| | | |
| | |
| | | |
| | | //视频过滤 |
| | | private void filterVideo(AcceptData acceptData, VideoInfo video) { |
| | | //过滤视频资源 |
| | | List<VideoResource> resourceList = videoResourceInfoMapService.filter(acceptData.getDetailSystem().getId(), video.getResourceList()); |
| | | video.setResourceList(resourceList); |
| | | //控制前端列表中的来源显示问题 |
| | | if ("48".equalsIgnoreCase(acceptData.getDetailSystem().getId())) { |
| | | if (video.getArea() != null && video.getArea().contains("韩国")) { |
| | |
| | | //视频过滤 |
| | | filterVideo(acceptData, info); |
| | | |
| | | UserInfo user = userService.getUserInfo(acceptData.getUid()); |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @RequireUid |
| | | public void getVideoDetailNew(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String videoId = request.getParameter("VideoId"); |
| | | if (!NumberUtil.isNumeric(videoId)) { |
| | | String[] cidVid = PPTVUtil.parseCidAndVidFromVisualVideoId(videoId); |
| | | if (cidVid == null) { |
| | | int fromType = VideoUtil.getVideoFromType(videoId); |
| | | //短视频 |
| | | if (fromType == HomeVideo.FROM_TYPE_SHORT) { |
| | | getVideoDetailForShortVideo(acceptData, videoId, request, out); |
| | | return; |
| | | } else if (fromType == HomeVideo.FROM_TYPE_INTERNET) { |
| | | getVideoDetailForInternetSearch(acceptData, videoId, request, out); |
| | | return; |
| | | } |
| | | } |
| | | String cid = cidVid[0]; |
| | | String vid = cidVid[1]; |
| | | |
| | | PPTVSeries series = pptvService.getSeriesDetail(cid); |
| | | if (series == null) { |
| | | series = PPTVApiUtil.getDetail(cid); |
| | | } |
| | | |
| | | if (series != null) { |
| | | JSONObject data = new JSONObject(); |
| | | String playUrl = PPTVUtil.getPlayUrl(series, pptvService.selectProgramById(vid)); |
| | | data.put("videoId", videoId); |
| | | data.put("playUrl", playUrl); |
| | | data.put("name", series.getName()); |
| | | data.put("vip", PPTVUtil.isVIPVideo(series.getFree())); |
| | | JSONObject pptv = new JSONObject(); |
| | | pptv.put("pptv", data); |
| | | out.print(JsonUtil.loadTrueJson(pptv.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseJson("已下线")); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | | String resourceId = request.getParameter("ResourceId"); |
| | | String thirdType = request.getParameter("Type"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String position = request.getParameter("Position"); |
| | | String from = request.getParameter("From"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoId)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传VideoId")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(thirdType)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传Type")); |
| | | return; |
| | | } |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel()); |
| | | |
| | | //获取优先展示的渠道 |
| | | if (StringUtil.isNullOrEmpty(resourceId)) { |
| | | Set<Long> rids = new HashSet<>(); |
| | | rids.addAll(resourceList); |
| | | VideoResource defaultVideoResource = resourceVideoService.getDefaultVideoResource(videoId, rids); |
| | | if (defaultVideoResource != null) { |
| | | resourceId = defaultVideoResource.getId(); |
| | | } |
| | | //视频没有来源 |
| | | if (StringUtil.isNullOrEmpty(resourceId)) { |
| | | CMQManager.getInstance().addVideoResourceDeleteMsg(videoId); |
| | | out.print(JsonUtil.loadFalseJson("视频已下线")); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | int p = 0; |
| | | if (!StringUtil.isNullOrEmpty(position)) { |
| | | p = Integer.parseInt(position); |
| | | } |
| | | |
| | | VideoWatchHistory history = new VideoWatchHistory(); |
| | | history.setDevice(acceptData.getDevice()); |
| | | history.setVideoId(videoId); |
| | | history.setUid(loginUid); |
| | | history.setPosition(p); |
| | | videoWatchHistoryService.add(history); |
| | | } |
| | | }); |
| | | |
| | | userPlayLogger.info(VideoLogFactory.createUserVideoDetailLog(acceptData.getDevice(), acceptData.getUtdId(), loginUid, acceptData.getDetailSystem().getId(), videoId, resourceId, from)); |
| | | |
| | | |
| | | //PPTV网页播放 |
| | | if (!StringUtil.isNullOrEmpty(resourceId) && Integer.parseInt(resourceId) == PPTVUtil.RESOURCE_ID) { |
| | | JSONObject data = new JSONObject(); |
| | | VideoPPTVMap map = pptvService.getVideoPPTVMapByVideoId(videoId); |
| | | int p = 0; |
| | | if (!StringUtil.isNullOrEmpty(position)) { |
| | | p = Integer.parseInt(position); |
| | | } else { |
| | | //取播放记录 |
| | | VideoWatchHistory history = videoWatchHistoryService.getWatchHistory(acceptData.getDevice(), videoId); |
| | | if (history != null && history.getPosition() != null) { |
| | | p = history.getPosition(); |
| | | } |
| | | } |
| | | |
| | | String videoName = ""; |
| | | String playUrl = null; |
| | | |
| | | PPTVSeries series = pptvService.getSeriesDetail(map.getInfoId()); |
| | | |
| | | if (map.getProgramCode() != null) { |
| | | PPTVProgram program = pptvService.selectProgramById(map.getProgramCode()); |
| | | videoName = program.getProgramSetTiltle(); |
| | | playUrl = PPTVUtil.getPlayUrl(series, program); |
| | | } else { |
| | | videoName = series.getName(); |
| | | p = p >= series.getSeries().size() ? 0 : p; |
| | | playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p)); |
| | | } |
| | | |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, videoName, videoId, resourceId); |
| | | data.put("videoId", videoId); |
| | | data.put("playUrl", playUrl); |
| | | data.put("name", videoName); |
| | | data.put("pptv", true); |
| | | data.put("vip", "1".equalsIgnoreCase(series.getFree())); |
| | | data.put("sessionId", sessionId); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createVideoDetail(new BaseLog(acceptData, loginUid), videoId, series.getName(), from)); |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //看PP视频 |
| | | deviceAdStrategyService.watchPPTVVideo(acceptData.getUtdId(), acceptData.getDetailSystem().getId()); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | VideoInfo info = videoDeailUtil.getVideoInfo(detailSystem.getId(), videoId, resourceId, resourceList, |
| | | CacheUtil.getMD5Long(resourceList)); |
| | | LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createVideoDetail(new BaseLog(acceptData, loginUid), videoId, info != null ? info.getName() : "", from)); |
| | | |
| | | List<VideoType> typeList = classService.getVideoTypeList(info.getId()); |
| | | if (typeList != null && typeList.size() > 0) { |
| | | VideoType type = typeList.get(0); |
| | | while (type.getParent() != null) |
| | | type = type.getParent(); |
| | | info.setVideoType(type); |
| | | } |
| | | |
| | | info.setPlayPicture(VideoPictureUtil.getShowPicture(info, acceptData.getPlatform(), acceptData.getVersion() + "")); |
| | | |
| | | if (info.getVideoDetailList() != null) |
| | | for (VideoDetailInfo vd : info.getVideoDetailList()) { |
| | | if (StringUtil.isNullOrEmpty(vd.getExtraId())) |
| | | vd.setExtraId(vd.getId() + ""); |
| | | } |
| | | info.setCommentCount(0); |
| | | |
| | | |
| | | VideoDetailVO.AttentionInfo attention = null; |
| | | if (info.getVideoDetailList() != null) |
| | | if (info.getVideoDetailList().size() > 1) {// 多集,可关注 |
| | | boolean isAttention = false; |
| | | if (!StringUtil.isNullOrEmpty(loginUid)) { |
| | | isAttention = attentionService.isAddAttention(loginUid, info.getId()); |
| | | } |
| | | attention = new VideoDetailVO.AttentionInfo(); |
| | | attention.setName(info.getName()); |
| | | attention.setPicture(info.getPicture()); |
| | | if (StringUtil.isNullOrEmpty(info.getUpdatetime())) { |
| | | attention.setUpdateInfo("更新:" + TimeUtil.getCommentTime(info.getCreatetime())); |
| | | } else { |
| | | attention.setUpdateInfo("更新:" + TimeUtil.getCommentTime(Long.parseLong(info.getUpdatetime()))); |
| | | } |
| | | attention.setAttention(isAttention); |
| | | } |
| | | |
| | | //视频过滤 |
| | | filterVideo(acceptData, info); |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId); |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel(), loginUid, videoId, from), attention, sessionId)))); |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"); |
| | | deviceAdStrategyService.setShortVideoAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), videoId, from, showTime, null); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取视频的剧集列表 |
| | | * |
| | |
| | | |
| | | } |
| | | |
| | | @RequireUid |
| | | public void kkInstall(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | KKInstall kk = new KKInstall(); |
| | | kk.setCreatetime(System.currentTimeMillis() + ""); |
| | | kk.setUser(new UserInfo(acceptData.getUid())); |
| | | kk.setPackageName(acceptData.getPackageName()); |
| | | |
| | | LogUtil.i("用户" + acceptData.getUid() + "安装KK插件"); |
| | | out.print(JsonUtil.loadTrueJson("")); |
| | | out.flush(); |
| | | out.close(); |
| | | return; |
| | | } |
| | | |
| | | public void adRecommendRight(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | |
| | | out.close(); |
| | | } |
| | | |
| | | public void addContact(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String contact = request.getParameter("Contact"); |
| | | if (!StringUtil.isNullOrEmpty(contact)) { |
| | | String da = StringUtil.getFromBase64(contact); |
| | | JSONArray array = JSONArray.fromObject(da); |
| | | for (int i = 0; i < array.size(); i++) { |
| | | JSONObject obj = array.optJSONObject(i); |
| | | otherService.addContact(obj.optString("Name"), obj.optString("Mobile")); |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |
| | | public void playStatistic(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String videoId = request.getParameter("VideoId"); |
| | |
| | | package com.yeshi.buwan.controller.parser; |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.domain.solr.SolrAlbumVideo; |
| | | import com.yeshi.buwan.domain.solr.SolrShortVideo; |
| | | import com.yeshi.buwan.domain.special.SearchSpecial; |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.Collection; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.solr.SolrAlbumVideo; |
| | | import com.yeshi.buwan.domain.solr.SolrShortVideo; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | |
| | | import com.yeshi.buwan.exception.SMSException; |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.exception.user.RegisterUserException; |
| | | import com.yeshi.buwan.service.inter.SMSService; |
| | | import com.yeshi.buwan.videos.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.inter.SMSService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager; |
| | |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.util.annotation.RequireUid; |
| | | import com.yeshi.buwan.util.email.MailSenderUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.util.factory.vo.UserInfoVOFactory; |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | |
| | | import com.yeshi.buwan.util.video.VideoCategoryConstant; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import com.yeshi.buwan.util.video.VideoUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.video.VideoListResultVO; |
| | | import net.sf.json.JSONArray; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | | import redis.clients.jedis.Jedis; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | public class UserParser { |
| | | |
| | | Logger searchKeyLogger = LoggerFactory.getLogger("searchKey"); |
| | | |
| | | Logger logger = LoggerFactory.getLogger(UserParser.class); |
| | | |
| | | |
| | | @Resource |
| | |
| | | VideoInfo vf = new VideoInfo(); |
| | | vf.setId(videoId); |
| | | Collection c = new Collection(); |
| | | if (!StringUtil.isNullOrEmpty(acceptData.getUid())) { |
| | | c.setUser(new UserInfo(acceptData.getUid())); |
| | | } else { |
| | | c.setUser(new UserInfo("1")); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(loginUid)) { |
| | | c.setLoginUser(new LoginUser(loginUid)); |
| | | } |
| | |
| | | } |
| | | |
| | | final String code = StringUtil.getVerifyCode(); |
| | | request.getSession().setAttribute(account, code); |
| | | |
| | | // new Thread(new Runnable() { |
| | | // public void run() { |
| | | // for (int i = 0; i < 3; i++) { |
| | |
| | | content = title; |
| | | } |
| | | |
| | | boolean isS = MailSenderUtil.sendEmail(account, "app_yzm_zc@163.com", "KZKSRTEMDWEQRAQR", title, |
| | | content); |
| | | System.out.println(content); |
| | | |
| | | EmailInfo emailInfo = new EmailInfo(); |
| | | emailInfo.setToEmail(account); |
| | | emailInfo.setTitle(title); |
| | | emailInfo.setFromEmail("app_yzm_zc@163.com"); |
| | | emailInfo.setFormEmailPwd("KZKSRTEMDWEQRAQR"); |
| | | emailInfo.setContent(content); |
| | | emailInfo.setApp("影视"); |
| | | try { |
| | | EmailApiUtil.sendEmail(emailInfo); |
| | | request.getSession().setAttribute(account, code); |
| | | out.print(JsonUtil.loadTrueJson("验证码发送成功")); |
| | | } catch (MailSendException e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseJson("验证码发送失败")); |
| | | } |
| | | // } |
| | | |
| | | // }).start(); |
| | | out.print(JsonUtil.loadTrueJson("验证码发送成功")); |
| | | } |
| | | |
| | | |
| | |
| | | out.print(JsonUtil.loadFalseJson(e.getMessage())); |
| | | return; |
| | | } catch (Exception e) { |
| | | logger.error("短信发送出错", e); |
| | | out.print(JsonUtil.loadFalseJson("短信发送出错,请稍后再试")); |
| | | return; |
| | | } |
| | |
| | | String path = session.getServletContext().getRealPath("upload") + "/" + fileName; |
| | | if (!new File(session.getServletContext().getRealPath("upload") + "/").exists()) |
| | | new File(session.getServletContext().getRealPath("upload") + "/").mkdirs(); |
| | | boolean isS = StringUtil.generateImageFromBase64(base64, path); |
| | | boolean isS = StringUtil.generateImageFromBase64(base64.replace("\n",""), path); |
| | | if (!isS) |
| | | return ""; |
| | | |
| | |
| | | package com.yeshi.buwan.controller.parser; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.uservideo.CollectionVideoV2; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import com.yeshi.buwan.service.imp.AttentionService; |
| | | import com.yeshi.buwan.service.imp.CollectionService; |
| | | import com.yeshi.buwan.service.imp.VideoService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.uservideo.CollectionVideoV2Service; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class UserVideoParser { |
| | |
| | | |
| | | @Resource |
| | | private AttentionService attentionService; |
| | | |
| | | @Resource |
| | | private CollectionVideoV2Service collectionVideoV2Service; |
| | | |
| | | @Resource |
| | | private InternetSearchVideoService internetSearchVideoService; |
| | | |
| | | |
| | | public void getWatchHistory(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | |
| | | if (vi != null) |
| | | videoInfoMap.put(vi.getId(), vi); |
| | | } |
| | | for (int i = 0; i < list.size(); i++) { |
| | | VideoWatchHistory wh = list.get(i); |
| | | if (videoInfoMap.get(list.get(i).getVideoId()) == null) { |
| | | list.remove(i--); |
| | | videoWatchHistoryService.delete(Arrays.asList(new String[]{wh.getId()})); |
| | | } else { |
| | | wh.setVideo(videoInfoMap.get(wh.getVideoId())); |
| | | } |
| | | } |
| | | |
| | | for (VideoWatchHistory wh : list) { |
| | | wh.setVideo(videoInfoMap.get(wh.getVideoId())); |
| | | } |
| | |
| | | } |
| | | |
| | | long collectionCount = collectionService.getCollectVideoCount(acceptData.getUid()); |
| | | long collectionCountNew = collectionVideoV2Service.countByUid(loginUid); |
| | | long attentionCount = attentionService.getAttentionCountByLoginUid(Long.parseLong(loginUid)); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("collectionCount", collectionCount); |
| | | data.put("collectionCount", collectionCount == 0 ? collectionCountNew : collectionCount); |
| | | data.put("attentionCount", attentionCount); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | | |
| | | public void collectVideo(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String videoId = request.getParameter("VideoId"); |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJson("用户未登录")); |
| | | return; |
| | | } |
| | | CollectionVideoV2 v2 = new CollectionVideoV2(); |
| | | v2.setVideoId(videoId); |
| | | v2.setLoginUid(loginUid); |
| | | try { |
| | | collectionVideoV2Service.add(v2); |
| | | } catch (ParamsException e) { |
| | | if (e.getCode() == ParamsException.CODE_EXIST) { |
| | | out.print(JsonUtil.loadFalseJson("已收藏")); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadFalseJson("收藏出错")); |
| | | return; |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | | |
| | | public void cancelCollectVideo(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String videoIds = request.getParameter("VideoId"); |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJson("用户未登录")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoIds)) { |
| | | out.print(JsonUtil.loadFalseJson("未上传视频ID")); |
| | | return; |
| | | } |
| | | |
| | | String[] videoIdArray = videoIds.split(","); |
| | | |
| | | List<String> ids = new ArrayList<>(); |
| | | for (String id : videoIdArray) { |
| | | ids.add(CollectionVideoV2.createId(loginUid, id)); |
| | | } |
| | | collectionVideoV2Service.delete(ids); |
| | | JSONObject data = new JSONObject(); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | | |
| | | |
| | | public void getCollectVideoList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String page = request.getParameter("Page"); |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJson("用户未登录")); |
| | | return; |
| | | } |
| | | |
| | | long count = collectionVideoV2Service.countByUid(loginUid); |
| | | List<CollectionVideoV2> list = collectionVideoV2Service.listByUid(loginUid, Integer.parseInt(page), Constant.pageCount); |
| | | //获取视频详情 |
| | | List<String> localIds = new ArrayList<>(); |
| | | List<String> internetIds = new ArrayList<>(); |
| | | Map<String, Integer> pmap = new HashMap<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | pmap.put(list.get(i).getVideoId(), i); |
| | | if (NumberUtil.isNumeric(list.get(i).getVideoId())) { |
| | | localIds.add(list.get(i).getVideoId()); |
| | | } else { |
| | | internetIds.add(list.get(i).getVideoId()); |
| | | } |
| | | } |
| | | |
| | | VideoInfo[] videoInfos = new VideoInfo[list.size()]; |
| | | //填充本地视频 |
| | | List<VideoInfo> localVideoInfoList = videoService.getVideoInfoList(localIds); |
| | | if (localVideoInfoList != null) { |
| | | for (VideoInfo video : localVideoInfoList) { |
| | | videoInfos[pmap.get(video.getId())] = video; |
| | | } |
| | | } |
| | | //填充全网搜视频 |
| | | List<InternetSearchVideo> internetSearchVideoList = internetSearchVideoService.listByIds(internetIds); |
| | | for (InternetSearchVideo video : internetSearchVideoList) { |
| | | videoInfos[pmap.get(video.getId())] = VideoInfoFactory.create(video); |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count + ""); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < videoInfos.length; i++) { |
| | | videoInfos[i].setIntroduction(""); |
| | | array.add(StringUtil.outPutResultJson(videoInfos[i])); |
| | | } |
| | | data.put("data", array); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.controller.parser.web; |
| | | |
| | | import com.yeshi.buwan.domain.Attention; |
| | | import com.yeshi.buwan.domain.Comment2; |
| | | import com.yeshi.buwan.domain.CommentReply; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.imp.push.PushService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.PrintWriter; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import com.yeshi.buwan.domain.Attention; |
| | | import com.yeshi.buwan.domain.Comment2; |
| | | import com.yeshi.buwan.domain.CommentReply; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.service.imp.AttentionService; |
| | | import com.yeshi.buwan.service.imp.CommentService; |
| | | import com.yeshi.buwan.service.imp.SearchService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.imp.UserService; |
| | | import com.yeshi.buwan.service.imp.push.PushService; |
| | | import com.yeshi.buwan.util.COSManager; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.Utils; |
| | | import com.yeshi.buwan.util.VideoPictureUtil; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.util.email.MailSenderUtil; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | | public class WebUserParser { |
| | |
| | | request.getSession().setAttribute(account, code); |
| | | new Thread(new Runnable() { |
| | | public void run() { |
| | | boolean isS = MailSenderUtil.sendEmail(account, "buwanysdq@163.com", "weikou2014", "布丸社区注册验证码:" + code, |
| | | "布丸社区注册验证码:" + code); |
| | | |
| | | EmailInfo emailInfo = new EmailInfo(); |
| | | emailInfo.setToEmail(account); |
| | | emailInfo.setTitle("布丸社区注册验证码:" + code); |
| | | emailInfo.setFromEmail("buwanysdq@163.com"); |
| | | emailInfo.setFormEmailPwd("weikou2014"); |
| | | emailInfo.setContent("布丸社区注册验证码:" + code); |
| | | emailInfo.setApp("影视"); |
| | | |
| | | try { |
| | | EmailApiUtil.sendEmail(emailInfo); |
| | | } catch (MailSendException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | out.print(JsonUtil.loadTrueJsonNoencript("验证码发送成功")); |
| | |
| | | package com.yeshi.buwan.dao; |
| | | |
| | | import com.yeshi.buwan.dao.base.BaseDao; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.buwan.domain.CategoryVideo; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | package com.yeshi.buwan.dao; |
| | | |
| | | import com.yeshi.buwan.dao.base.BaseDao; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.buwan.domain.HomeNotice; |
| | | |
| | | import java.io.Serializable; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Repository |
| | | public class HomeNoticeDao extends BaseDao<HomeNotice> { |
| | |
| | | package com.yeshi.buwan.dao; |
| | | |
| | | import com.yeshi.buwan.dao.base.BaseDao; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.query.BaseQuery; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationOperation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | |
| | | return tClass; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 聚合查询 |
| | | * |
| | | * @param opts |
| | | * @param output |
| | | * @return |
| | | */ |
| | | public AggregationResults aggregate(List<? extends AggregationOperation> opts, Class output) { |
| | | Aggregation aggregation = Aggregation.newAggregation(opts); |
| | | return mongoTemplate.aggregate(aggregation, this.getEntityClass(), output); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.dao.juhe.hanmi; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShow; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShowEpisode; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.yeshi.buwan.dao.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveCategory; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.query.BaseQuery; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | |
| | | package com.yeshi.buwan.dao.live; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveProgramResource; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveProgramResource; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveProgramResource.TVLiveProgramResourceType; |
| | | |
| | | import java.lang.String; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Repository |
New file |
| | |
| | | package com.yeshi.buwan.dao.recommend; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.recommend.HomeTypeV2; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Repository |
| | | public class HomeTypeV2Dao extends MongodbBaseDao<HomeTypeV2> { |
| | | |
| | | public void updateSelective(HomeTypeV2 bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getName() != null) { |
| | | update.set("name", bean.getName()); |
| | | } |
| | | if (bean.getBeizhu() != null) { |
| | | update.set("beizhu", bean.getBeizhu()); |
| | | } |
| | | if (bean.getOrderby() != null) { |
| | | update.set("orderby", bean.getOrderby()); |
| | | } |
| | | if (bean.getActivity() != null) { |
| | | update.set("activity", bean.getActivity()); |
| | | } |
| | | if (bean.getParams() != null) { |
| | | update.set("params", bean.getParams()); |
| | | } |
| | | if (bean.getHasMore() != null) { |
| | | update.set("hasMore", bean.getHasMore()); |
| | | } |
| | | if (bean.getNeedAd() != null) { |
| | | update.set("needAd", bean.getNeedAd()); |
| | | } |
| | | if (bean.getIosControl() != null) { |
| | | update.set("iosControl", bean.getIosControl()); |
| | | } |
| | | if (bean.getIcon() != null) { |
| | | update.set("icon", bean.getIcon()); |
| | | } |
| | | if (bean.getColumns() != null) { |
| | | update.set("columns", bean.getColumns()); |
| | | } |
| | | if (bean.getNumber() != null) { |
| | | update.set("number", bean.getNumber()); |
| | | } |
| | | if (bean.getRefreshPosition() != null) { |
| | | update.set("refreshPosition", bean.getRefreshPosition()); |
| | | } |
| | | if (bean.getMoreTag() != null) { |
| | | update.set("moreTag", bean.getMoreTag()); |
| | | } |
| | | if (bean.getBigPicture() != null) { |
| | | update.set("bigPicture", bean.getBigPicture()); |
| | | } |
| | | if (bean.getCount() != null) { |
| | | update.set("count", bean.getCount()); |
| | | } |
| | | if (bean.getSystemId() != null) { |
| | | update.set("systemId", bean.getSystemId()); |
| | | } |
| | | if (bean.getVideoTypeId() != null) { |
| | | update.set("videoTypeId", bean.getVideoTypeId()); |
| | | } |
| | | if (bean.getSpecialDataKey() != null) { |
| | | update.set("specialDataKey", bean.getSpecialDataKey()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<HomeTypeV2> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(new Sort(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.systemId != null) { |
| | | andList.add(Criteria.where("systemId").is(daoQuery.systemId)); |
| | | } |
| | | if (daoQuery.videoTypeId != null) { |
| | | andList.add(Criteria.where("videoTypeId").is(daoQuery.videoTypeId)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | | public String systemId; |
| | | public String videoTypeId; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.recommend; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.recommend.HomeVideoV2; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Repository |
| | | public class HomeVideoV2Dao extends MongodbBaseDao<HomeVideoV2> { |
| | | |
| | | public void updateSelective(HomeVideoV2 bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getHomeTypeId() != null) { |
| | | update.set("homeTypeId", bean.getHomeTypeId()); |
| | | } |
| | | if (bean.getVideoId() != null) { |
| | | update.set("videoId", bean.getVideoId()); |
| | | } |
| | | if (bean.getPicture() != null) { |
| | | update.set("picture", bean.getPicture()); |
| | | } |
| | | if (bean.getTag() != null) { |
| | | update.set("tag", bean.getTag()); |
| | | } |
| | | if (bean.getOrderby() != null) { |
| | | update.set("orderby", bean.getOrderby()); |
| | | } |
| | | if (bean.getBigPicture() != null) { |
| | | update.set("bigPicture", bean.getBigPicture()); |
| | | } |
| | | if (bean.getFromType() != null) { |
| | | update.set("fromType", bean.getFromType()); |
| | | } |
| | | if (bean.getVideoName() != null) { |
| | | update.set("videoName", bean.getVideoName()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | if (bean.getBeizhu() != null) { |
| | | update.set("beizhu", bean.getBeizhu()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<HomeVideoV2> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(new Sort(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.homeTypeId != null) { |
| | | andList.add(Criteria.where("homeTypeId").is(daoQuery.homeTypeId)); |
| | | } |
| | | if (daoQuery.videoId != null) { |
| | | andList.add(Criteria.where("videoId").is(daoQuery.videoId)); |
| | | } |
| | | if (daoQuery.fromType != null) { |
| | | andList.add(Criteria.where("fromType").is(daoQuery.fromType)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | | public String homeTypeId; |
| | | public String videoId; |
| | | public Integer fromType; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.uservideo; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.buwan.domain.uservideo.CollectionVideoV2; |
| | | |
| | | import java.lang.String; |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | @Repository |
| | | public class CollectionVideoV2Dao extends MongodbBaseDao<CollectionVideoV2> { |
| | | |
| | | public void updateSelective(CollectionVideoV2 bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getLoginUid() != null) { |
| | | update.set("loginUid", bean.getLoginUid()); |
| | | } |
| | | if (bean.getVideoId() != null) { |
| | | update.set("videoId", bean.getVideoId()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<CollectionVideoV2> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(new Sort(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.loginUid != null) { |
| | | andList.add(Criteria.where("loginUid").is(daoQuery.loginUid)); |
| | | } |
| | | if (daoQuery.videoId != null) { |
| | | andList.add(Criteria.where("videoId").is(daoQuery.videoId)); |
| | | } |
| | | if (daoQuery.minCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | if (daoQuery.maxCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | | public String loginUid; |
| | | public String videoId; |
| | | public Date minCreateTime; |
| | | public Date maxCreateTime; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.dao.video; |
| | | |
| | | import javafx.animation.KeyValue; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.video.StarInfo; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.buwan.domain.video.StarInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | |
| | | import java.util.Date; |
| | | import java.lang.String; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Repository |
| | |
| | | package com.yeshi.buwan.dao.video; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.domain.video.VideoInfoExtra; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
New file |
| | |
| | | package com.yeshi.buwan.dao.video; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.video.VideoInfoV2; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Repository |
| | | public class VideoInfoV2Dao extends MongodbBaseDao<VideoInfoV2> { |
| | | |
| | | public void updateSelective(VideoInfoV2 bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getName() != null) { |
| | | update.set("name", bean.getName()); |
| | | } |
| | | if (bean.getCategory() != null) { |
| | | update.set("category", bean.getCategory()); |
| | | } |
| | | if (bean.getLeafCategorys() != null) { |
| | | update.set("leafCategorys", bean.getLeafCategorys()); |
| | | } |
| | | if (bean.getLeafCategoryIds() != null) { |
| | | update.set("leafCategoryIds", bean.getLeafCategoryIds()); |
| | | } |
| | | if (bean.getResourceIds() != null) { |
| | | update.set("resourceIds", bean.getResourceIds()); |
| | | } |
| | | if (bean.getActors() != null) { |
| | | update.set("actors", bean.getActors()); |
| | | } |
| | | if (bean.getDirectors() != null) { |
| | | update.set("directors", bean.getDirectors()); |
| | | } |
| | | if (bean.getAreas() != null) { |
| | | update.set("areas", bean.getAreas()); |
| | | } |
| | | if (bean.getContentType() != null) { |
| | | update.set("contentType", bean.getContentType()); |
| | | } |
| | | if (bean.getReleaseDate() != null) { |
| | | update.set("releaseDate", bean.getReleaseDate()); |
| | | } |
| | | if (bean.getYear() != null) { |
| | | update.set("year", bean.getYear()); |
| | | } |
| | | if (bean.getFeeType() != null) { |
| | | update.set("feeType", bean.getFeeType()); |
| | | } |
| | | if (bean.getVpicture() != null) { |
| | | update.set("vpicture", bean.getVpicture()); |
| | | } |
| | | if (bean.getHpicture() != null) { |
| | | update.set("hpicture", bean.getHpicture()); |
| | | } |
| | | if (bean.getShow() != null) { |
| | | update.set("show", bean.getShow()); |
| | | } |
| | | if (bean.getScore() != null) { |
| | | update.set("score", bean.getScore()); |
| | | } |
| | | if (bean.getUpdateInfo() != null) { |
| | | update.set("updateInfo", bean.getUpdateInfo()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<VideoInfoV2> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(new Sort(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.name != null) { |
| | | andList.add(Criteria.where("name").regex(daoQuery.name)); |
| | | } |
| | | if (daoQuery.category != null) { |
| | | andList.add(Criteria.where("category").is(daoQuery.category)); |
| | | } |
| | | if (daoQuery.leafCategorys != null && daoQuery.leafCategorys.size() > 0) { |
| | | Long[] ins = new Long[daoQuery.leafCategorys.size()]; |
| | | daoQuery.leafCategorys.toArray(ins); |
| | | andList.add(Criteria.where("leafCategorys").in(ins)); |
| | | } |
| | | |
| | | if (daoQuery.leafCategoryIds != null && daoQuery.leafCategoryIds.size() > 0) { |
| | | Long[] ins = new Long[daoQuery.leafCategoryIds.size()]; |
| | | daoQuery.leafCategoryIds.toArray(ins); |
| | | andList.add(Criteria.where("leafCategoryIds").in(ins)); |
| | | } |
| | | |
| | | if (daoQuery.resourceIds != null && daoQuery.resourceIds.size() > 0) { |
| | | Long[] ins = new Long[daoQuery.resourceIds.size()]; |
| | | daoQuery.resourceIds.toArray(ins); |
| | | andList.add(Criteria.where("resourceIds").in(ins)); |
| | | } |
| | | if (daoQuery.actors != null && daoQuery.actors.size() > 0) { |
| | | String[] ins = new String[daoQuery.actors.size()]; |
| | | daoQuery.actors.toArray(ins); |
| | | andList.add(Criteria.where("actors").in(ins)); |
| | | } |
| | | if (daoQuery.directors != null && daoQuery.directors.size() > 0) { |
| | | Long[] ins = new Long[daoQuery.directors.size()]; |
| | | daoQuery.directors.toArray(ins); |
| | | andList.add(Criteria.where("directors").in(ins)); |
| | | } |
| | | |
| | | if (daoQuery.areas != null && daoQuery.areas.size() > 0) { |
| | | Long[] ins = new Long[daoQuery.areas.size()]; |
| | | daoQuery.areas.toArray(ins); |
| | | andList.add(Criteria.where("areas").in(ins)); |
| | | } |
| | | |
| | | if (daoQuery.contentType != null) { |
| | | andList.add(Criteria.where("contentType").is(daoQuery.contentType)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | | public String name; |
| | | public String category; |
| | | public List<String> leafCategorys; |
| | | public List<Integer> leafCategoryIds; |
| | | public List<Long> resourceIds; |
| | | public List<String> actors; |
| | | public List<String> directors; |
| | | public List<String> areas; |
| | | public Integer contentType; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.video; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.lang.Long; |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.buwan.domain.video.VideoResourceInfoMap; |
| | | |
| | | import java.lang.String; |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | @Repository |
| | | public class VideoResourceInfoMapDao extends MongodbBaseDao<VideoResourceInfoMap> { |
| | | |
| | | public void updateSelective(VideoResourceInfoMap bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getName() != null) { |
| | | update.set("name", bean.getName()); |
| | | } |
| | | if (bean.getIcon() != null) { |
| | | update.set("icon", bean.getIcon()); |
| | | } |
| | | if (bean.getResourceId() != null) { |
| | | update.set("resourceId", bean.getResourceId()); |
| | | } |
| | | if (bean.getDetailSystemId() != null) { |
| | | update.set("detailSystemId", bean.getDetailSystemId()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | public List<VideoResourceInfoMap> list(String detailSystemId, List<Long> ridList) { |
| | | List<Criteria> orList = new ArrayList<>(); |
| | | for (Long rid : ridList) { |
| | | orList.add(Criteria.where("resourceId").is(rid)); |
| | | } |
| | | Criteria[] ors = new Criteria[orList.size()]; |
| | | orList.toArray(ors); |
| | | |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().andOperator(Criteria.where("detailSystemId").is(detailSystemId), new Criteria().orOperator(ors))); |
| | | return findList(query); |
| | | } |
| | | |
| | | |
| | | public List<VideoResourceInfoMap> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(new Sort(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.resourceId != null) { |
| | | andList.add(Criteria.where("resourceId").is(daoQuery.resourceId)); |
| | | } |
| | | if (daoQuery.detailSystemId != null) { |
| | | andList.add(Criteria.where("detailSystemId").is(daoQuery.detailSystemId)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | | public Long resourceId; |
| | | public String detailSystemId; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.dao.video; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.vip.VIPPrice; |
| | | import com.yeshi.buwan.domain.vip.VIPPriceType; |
| | | import javafx.print.Collation; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.yeshi.buwan.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Transient; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 管理人员信息 |
| | |
| | | package com.yeshi.buwan.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.system.SystemInfo; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.Transient; |
| | | import javax.validation.constraints.Pattern; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.system.SystemInfo; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 首页的分类 |
| | |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | |
| | | import java.io.Serializable; |
| | | |
New file |
| | |
| | | package com.yeshi.buwan.domain.recommend; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.yeshi.utils.generater.annotation.admin.DaoQueryCondition; |
| | | |
| | | import javax.validation.constraints.Pattern; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 首页的分类 |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | @Document(collection = "homeTypeV2") |
| | | public class HomeTypeV2 implements Serializable { |
| | | @Id |
| | | @Expose |
| | | private String id; |
| | | |
| | | @Indexed |
| | | @Expose |
| | | private String name; |
| | | |
| | | private String beizhu; |
| | | |
| | | @Indexed |
| | | @Pattern(regexp = "[0-9]+", message = "请输入数字") |
| | | private Integer orderby; |
| | | |
| | | |
| | | @Expose |
| | | private String activity; |
| | | @Expose |
| | | private String params; |
| | | @Expose |
| | | private Boolean hasMore; |
| | | //是否需要填充广告 |
| | | @Expose |
| | | private Boolean needAd; |
| | | @Expose |
| | | private String iosControl; |
| | | @Expose |
| | | private String icon; |
| | | @Expose |
| | | private Integer columns; |
| | | @Expose |
| | | private Integer number;// 显示多少个 |
| | | //刷新的位置 0-无刷新 1-右上角 2-下方 |
| | | @Expose |
| | | private Integer refreshPosition; |
| | | @Expose |
| | | private String moreTag; |
| | | |
| | | |
| | | private Boolean bigPicture; |
| | | //数据总数 |
| | | @Expose |
| | | private Integer count; |
| | | |
| | | @Transient |
| | | private List<HomeVideo> homeVideoList; |
| | | |
| | | @DaoQueryCondition |
| | | @Indexed |
| | | private String systemId; |
| | | |
| | | @DaoQueryCondition |
| | | @Indexed |
| | | private String videoTypeId; |
| | | |
| | | //专题关键字 |
| | | private String specialDataKey; |
| | | @Expose |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public Integer getOrderby() { |
| | | return orderby; |
| | | } |
| | | |
| | | public void setOrderby(Integer orderby) { |
| | | this.orderby = orderby; |
| | | } |
| | | |
| | | public String getActivity() { |
| | | return activity; |
| | | } |
| | | |
| | | public void setActivity(String activity) { |
| | | this.activity = activity; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public Boolean getHasMore() { |
| | | return hasMore; |
| | | } |
| | | |
| | | public void setHasMore(Boolean hasMore) { |
| | | this.hasMore = hasMore; |
| | | } |
| | | |
| | | public Boolean getNeedAd() { |
| | | return needAd; |
| | | } |
| | | |
| | | public void setNeedAd(Boolean needAd) { |
| | | this.needAd = needAd; |
| | | } |
| | | |
| | | public String getIosControl() { |
| | | return iosControl; |
| | | } |
| | | |
| | | public void setIosControl(String iosControl) { |
| | | this.iosControl = iosControl; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public Integer getColumns() { |
| | | return columns; |
| | | } |
| | | |
| | | public void setColumns(Integer columns) { |
| | | this.columns = columns; |
| | | } |
| | | |
| | | public Integer getNumber() { |
| | | return number; |
| | | } |
| | | |
| | | public void setNumber(Integer number) { |
| | | this.number = number; |
| | | } |
| | | |
| | | public Integer getRefreshPosition() { |
| | | return refreshPosition; |
| | | } |
| | | |
| | | public void setRefreshPosition(Integer refreshPosition) { |
| | | this.refreshPosition = refreshPosition; |
| | | } |
| | | |
| | | public String getMoreTag() { |
| | | return moreTag; |
| | | } |
| | | |
| | | public void setMoreTag(String moreTag) { |
| | | this.moreTag = moreTag; |
| | | } |
| | | |
| | | public Boolean getBigPicture() { |
| | | return bigPicture; |
| | | } |
| | | |
| | | public void setBigPicture(Boolean bigPicture) { |
| | | this.bigPicture = bigPicture; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public List<HomeVideo> getHomeVideoList() { |
| | | return homeVideoList; |
| | | } |
| | | |
| | | public void setHomeVideoList(List<HomeVideo> homeVideoList) { |
| | | this.homeVideoList = homeVideoList; |
| | | } |
| | | |
| | | public String getSystemId() { |
| | | return systemId; |
| | | } |
| | | |
| | | public void setSystemId(String systemId) { |
| | | this.systemId = systemId; |
| | | } |
| | | |
| | | public String getVideoTypeId() { |
| | | return videoTypeId; |
| | | } |
| | | |
| | | public void setVideoTypeId(String videoTypeId) { |
| | | this.videoTypeId = videoTypeId; |
| | | } |
| | | |
| | | public String getSpecialDataKey() { |
| | | return specialDataKey; |
| | | } |
| | | |
| | | public void setSpecialDataKey(String specialDataKey) { |
| | | this.specialDataKey = specialDataKey; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.recommend; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.yeshi.utils.generater.annotation.admin.DaoQueryCondition; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.ManyToOne; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 首页分类下面的视频 |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | @Document(collection = "homeVideoV2") |
| | | public class HomeVideoV2 implements Serializable { |
| | | |
| | | //本地视频 |
| | | public final static int FROM_TYPE_LOCAL = 0; |
| | | //全网搜 |
| | | public final static int FROM_TYPE_INTERNET = 1; |
| | | //短视频 |
| | | public final static int FROM_TYPE_SHORT = 2; |
| | | |
| | | |
| | | public HomeVideoV2(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public HomeVideoV2() { |
| | | } |
| | | |
| | | @Id |
| | | @Expose |
| | | private String id; |
| | | |
| | | |
| | | @DaoQueryCondition |
| | | @Indexed |
| | | private String homeTypeId; |
| | | |
| | | |
| | | @DaoQueryCondition |
| | | @Expose |
| | | @Indexed |
| | | private String videoId; |
| | | |
| | | @Expose |
| | | private String picture; |
| | | |
| | | @Expose |
| | | private String tag; |
| | | |
| | | |
| | | @Expose |
| | | private Integer orderby; |
| | | @Expose |
| | | private Boolean bigPicture;//是否为大图显示 |
| | | |
| | | |
| | | @Indexed |
| | | @DaoQueryCondition |
| | | private Integer fromType;//0-本地库 1-全网搜 |
| | | |
| | | private String videoName; |
| | | |
| | | @Expose |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | private String beizhu; |
| | | |
| | | |
| | | @Transient |
| | | @Expose |
| | | private VideoInfo video; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getHomeTypeId() { |
| | | return homeTypeId; |
| | | } |
| | | |
| | | public void setHomeTypeId(String homeTypeId) { |
| | | this.homeTypeId = homeTypeId; |
| | | } |
| | | |
| | | public VideoInfo getVideo() { |
| | | return video; |
| | | } |
| | | |
| | | public void setVideo(VideoInfo video) { |
| | | this.video = video; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public Integer getOrderby() { |
| | | return orderby; |
| | | } |
| | | |
| | | public void setOrderby(Integer orderby) { |
| | | this.orderby = orderby; |
| | | } |
| | | |
| | | public Boolean getBigPicture() { |
| | | return bigPicture; |
| | | } |
| | | |
| | | public void setBigPicture(Boolean bigPicture) { |
| | | this.bigPicture = bigPicture; |
| | | } |
| | | |
| | | public String getVideoId() { |
| | | return videoId; |
| | | } |
| | | |
| | | public void setVideoId(String videoId) { |
| | | this.videoId = videoId; |
| | | } |
| | | |
| | | public Integer getFromType() { |
| | | return fromType; |
| | | } |
| | | |
| | | public void setFromType(Integer fromType) { |
| | | this.fromType = fromType; |
| | | } |
| | | |
| | | public String getVideoName() { |
| | | return videoName; |
| | | } |
| | | |
| | | public void setVideoName(String videoName) { |
| | | this.videoName = videoName; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | } |
| | |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | //首页推荐专题 |
| | |
| | | |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.apache.solr.client.solrj.beans.Field; |
| | | import org.springframework.data.annotation.Id; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import javax.xml.parsers.SAXParserFactory; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import javax.persistence.Entity; |
| | | import java.io.Serializable; |
| | | import java.math.BigInteger; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | import java.util.Date; |
| | | |
New file |
| | |
| | | package com.yeshi.buwan.domain.uservideo; |
| | | |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: CollectionVideoV2 |
| | | * @description: 视频收藏 |
| | | * @date 2022/3/8 18:41 |
| | | */ |
| | | @Document(collection = "collectionVideo") |
| | | public class CollectionVideoV2 { |
| | | |
| | | @Id |
| | | private String id; |
| | | @Indexed |
| | | private String loginUid; |
| | | @Indexed |
| | | private String videoId; |
| | | @Indexed |
| | | private Date createTime; |
| | | |
| | | |
| | | public static String createId(String loginUid, String videoId) { |
| | | return StringUtil.Md5(loginUid + "#" + videoId); |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLoginUid() { |
| | | return loginUid; |
| | | } |
| | | |
| | | public void setLoginUid(String loginUid) { |
| | | this.loginUid = loginUid; |
| | | } |
| | | |
| | | public String getVideoId() { |
| | | return videoId; |
| | | } |
| | | |
| | | public void setVideoId(String videoId) { |
| | | this.videoId = videoId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.video; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoInfoExtraV2 |
| | | * @description: 视频附加信息 |
| | | * @date 2022/3/16 16:28 |
| | | */ |
| | | @Document(collection = "videoInfoExtraV2") |
| | | public class VideoInfoExtraV2 { |
| | | @Id |
| | | private String id; |
| | | //封面横图 |
| | | private String hPosterPicture; |
| | | //封面竖图 |
| | | private String vPosterPicture; |
| | | //简介 |
| | | private String introduction; |
| | | //时长 |
| | | private String duration; |
| | | //豆瓣里面的ID |
| | | private String douBanId; |
| | | |
| | | //视频数量 |
| | | private Integer videoCount; |
| | | |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String gethPosterPicture() { |
| | | return hPosterPicture; |
| | | } |
| | | |
| | | public void sethPosterPicture(String hPosterPicture) { |
| | | this.hPosterPicture = hPosterPicture; |
| | | } |
| | | |
| | | public String getvPosterPicture() { |
| | | return vPosterPicture; |
| | | } |
| | | |
| | | public void setvPosterPicture(String vPosterPicture) { |
| | | this.vPosterPicture = vPosterPicture; |
| | | } |
| | | |
| | | public String getIntroduction() { |
| | | return introduction; |
| | | } |
| | | |
| | | public void setIntroduction(String introduction) { |
| | | this.introduction = introduction; |
| | | } |
| | | |
| | | public String getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(String duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public String getDouBanId() { |
| | | return douBanId; |
| | | } |
| | | |
| | | public void setDouBanId(String douBanId) { |
| | | this.douBanId = douBanId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Integer getVideoCount() { |
| | | return videoCount; |
| | | } |
| | | |
| | | public void setVideoCount(Integer videoCount) { |
| | | this.videoCount = videoCount; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.video; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.yeshi.utils.generater.annotation.admin.DaoQueryCondition; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoInfoV2 |
| | | * @description: 视频信息V2版本 |
| | | * @date 2022/3/16 10:50 |
| | | */ |
| | | @Document(collection = "videoInfoV2") |
| | | public class VideoInfoV2 { |
| | | |
| | | //0-免费 1-VIP 2-用券 |
| | | //免费 |
| | | public final static int FREE_TYPE_FREE = 0; |
| | | //VIP |
| | | public final static int FREE_TYPE_VIP = 1; |
| | | //用券 |
| | | public final static int FREE_TYPE_COUPON = 2; |
| | | |
| | | @Id |
| | | private String id; |
| | | //名称 |
| | | @Indexed |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.contains) |
| | | private String name; |
| | | |
| | | //分类 |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.equal) |
| | | @Indexed |
| | | private String category; |
| | | |
| | | //子分类 |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.contains) |
| | | @Indexed |
| | | private List<String> leafCategorys; |
| | | |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.contains) |
| | | @Indexed |
| | | private List<Integer> leafCategoryIds; |
| | | |
| | | //资源 |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.contains) |
| | | @Indexed |
| | | private List<Long> resourceIds; |
| | | |
| | | //演员 |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.contains) |
| | | @Indexed |
| | | private List<String> actors; |
| | | |
| | | //导演 |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.contains) |
| | | @Indexed |
| | | private List<String> directors; |
| | | |
| | | //地区 |
| | | @DaoQueryCondition(queryType = DaoQueryCondition.QueryType.contains) |
| | | @Indexed |
| | | private List<String> areas; |
| | | |
| | | //内容类型 |
| | | @DaoQueryCondition |
| | | @Indexed |
| | | private Integer contentType; |
| | | |
| | | //上映日期 |
| | | @Indexed |
| | | private Date releaseDate; |
| | | |
| | | //年份 |
| | | @Indexed |
| | | private Integer year; |
| | | |
| | | //标签,后续版本会弃用 |
| | | private String tag; |
| | | |
| | | |
| | | //付费类型 |
| | | @Indexed |
| | | private Integer feeType; |
| | | |
| | | //竖图 |
| | | private String vpicture; |
| | | |
| | | //横图 |
| | | private String hpicture; |
| | | |
| | | //是否显示 |
| | | @Indexed |
| | | private Boolean show; |
| | | //评分 |
| | | private String score; |
| | | //更新信息 |
| | | private VideoUpdateInfo updateInfo; |
| | | //创建时间 |
| | | private Date createTime; |
| | | //更新时间 |
| | | private Date updateTime; |
| | | |
| | | @Transient |
| | | private VideoInfoExtraV2 extra; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setCategory(String category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public List<String> getLeafCategorys() { |
| | | return leafCategorys; |
| | | } |
| | | |
| | | public void setLeafCategorys(List<String> leafCategorys) { |
| | | this.leafCategorys = leafCategorys; |
| | | } |
| | | |
| | | public List<Long> getResourceIds() { |
| | | return resourceIds; |
| | | } |
| | | |
| | | public void setResourceIds(List<Long> resourceIds) { |
| | | this.resourceIds = resourceIds; |
| | | } |
| | | |
| | | public List<String> getActors() { |
| | | return actors; |
| | | } |
| | | |
| | | public void setActors(List<String> actors) { |
| | | this.actors = actors; |
| | | } |
| | | |
| | | public List<String> getDirectors() { |
| | | return directors; |
| | | } |
| | | |
| | | public void setDirectors(List<String> directors) { |
| | | this.directors = directors; |
| | | } |
| | | |
| | | public Date getReleaseDate() { |
| | | return releaseDate; |
| | | } |
| | | |
| | | public void setReleaseDate(Date releaseDate) { |
| | | this.releaseDate = releaseDate; |
| | | } |
| | | |
| | | public Integer getYear() { |
| | | return year; |
| | | } |
| | | |
| | | public void setYear(Integer year) { |
| | | this.year = year; |
| | | } |
| | | |
| | | public String getVpicture() { |
| | | return vpicture; |
| | | } |
| | | |
| | | public void setVpicture(String vpicture) { |
| | | this.vpicture = vpicture; |
| | | } |
| | | |
| | | public String getHpicture() { |
| | | return hpicture; |
| | | } |
| | | |
| | | public void setHpicture(String hpicture) { |
| | | this.hpicture = hpicture; |
| | | } |
| | | |
| | | public Boolean getShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(Boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public String getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(String score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public VideoUpdateInfo getUpdateInfo() { |
| | | return updateInfo; |
| | | } |
| | | |
| | | public void setUpdateInfo(VideoUpdateInfo updateInfo) { |
| | | this.updateInfo = updateInfo; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | |
| | | public List<String> getAreas() { |
| | | return areas; |
| | | } |
| | | |
| | | public void setAreas(List<String> areas) { |
| | | this.areas = areas; |
| | | } |
| | | |
| | | public Integer getContentType() { |
| | | return contentType; |
| | | } |
| | | |
| | | public void setContentType(Integer contentType) { |
| | | this.contentType = contentType; |
| | | } |
| | | |
| | | public Integer getFeeType() { |
| | | return feeType; |
| | | } |
| | | |
| | | public void setFeeType(Integer feeType) { |
| | | this.feeType = feeType; |
| | | } |
| | | |
| | | |
| | | public VideoInfoExtraV2 getExtra() { |
| | | return extra; |
| | | } |
| | | |
| | | public void setExtra(VideoInfoExtraV2 extra) { |
| | | this.extra = extra; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public List<Integer> getLeafCategoryIds() { |
| | | return leafCategoryIds; |
| | | } |
| | | |
| | | public void setLeafCategoryIds(List<Integer> leafCategoryIds) { |
| | | this.leafCategoryIds = leafCategoryIds; |
| | | } |
| | | |
| | | public static class VideoUpdateInfo { |
| | | //最新的集数 |
| | | private String latestEpisode; |
| | | @Indexed |
| | | //剧集更新时间 |
| | | private Date episodeUpdateTime; |
| | | //是否完结 |
| | | private Boolean finish; |
| | | |
| | | public String getLatestEpisode() { |
| | | return latestEpisode; |
| | | } |
| | | |
| | | public void setLatestEpisode(String latestEpisode) { |
| | | this.latestEpisode = latestEpisode; |
| | | } |
| | | |
| | | public Date getEpisodeUpdateTime() { |
| | | return episodeUpdateTime; |
| | | } |
| | | |
| | | public void setEpisodeUpdateTime(Date episodeUpdateTime) { |
| | | this.episodeUpdateTime = episodeUpdateTime; |
| | | } |
| | | |
| | | public Boolean getFinish() { |
| | | return finish; |
| | | } |
| | | |
| | | public void setFinish(Boolean finish) { |
| | | this.finish = finish; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.yeshi.buwan.domain.video; |
| | | |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.yeshi.utils.generater.annotation.admin.AdminController; |
| | | import org.yeshi.utils.generater.annotation.admin.DaoQueryCondition; |
| | | import org.yeshi.utils.generater.annotation.admin.Show; |
| | | import org.yeshi.utils.generater.annotation.admin.form.Img; |
| | | import org.yeshi.utils.generater.annotation.admin.form.Select; |
| | | import org.yeshi.utils.generater.annotation.admin.form.Text; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoResourceInfoMap |
| | | * @description: 视频来源的资源映射,包含图标,名称等 |
| | | * @date 2022/3/22 11:37 |
| | | */ |
| | | @Document(collection = "videoResourceInfoMap") |
| | | @AdminController(mapping = "admin/video/video_resource_info_map", title = "视频资源信息映射", searchForm = VideoResourceInfoMap.SearchForm.class) |
| | | public class VideoResourceInfoMap { |
| | | |
| | | @Id |
| | | @Show(title = "ID") |
| | | private String id; |
| | | |
| | | @Show(title = "资源名称") |
| | | @Text(title = "资源名称") |
| | | private String name; |
| | | |
| | | @Show(title = "图标", showType = Show.ShowType.IMG) |
| | | @Img(title = "图标") |
| | | private String icon; |
| | | |
| | | @DaoQueryCondition |
| | | @Indexed |
| | | private Long resourceId; |
| | | |
| | | @DaoQueryCondition |
| | | @Indexed |
| | | private String detailSystemId; |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | @Transient |
| | | private VideoResource resource; |
| | | |
| | | public static String createId(Long resourceId, String detailSystemId) { |
| | | return detailSystemId + "-" + resourceId; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public Long getResourceId() { |
| | | return resourceId; |
| | | } |
| | | |
| | | public void setResourceId(Long resourceId) { |
| | | this.resourceId = resourceId; |
| | | } |
| | | |
| | | public String getDetailSystemId() { |
| | | return detailSystemId; |
| | | } |
| | | |
| | | public void setDetailSystemId(String detailSystemId) { |
| | | this.detailSystemId = detailSystemId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public VideoResource getResource() { |
| | | return resource; |
| | | } |
| | | |
| | | public void setResource(VideoResource resource) { |
| | | this.resource = resource; |
| | | } |
| | | |
| | | public class SearchForm { |
| | | |
| | | @Select(title = "子系统", apiPath = "/admin/new/api/common/detailsystemlist") |
| | | private String detailSystemId; |
| | | @Text(title = "名称", inputType = Text.Type.TEXT) |
| | | private String key; |
| | | |
| | | public String getDetailSystemId() { |
| | | return detailSystemId; |
| | | } |
| | | |
| | | public void setDetailSystemId(String detailSystemId) { |
| | | this.detailSystemId = detailSystemId; |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dto.mq; |
| | | |
| | | public class VideoDataChangeMQMsg { |
| | | |
| | | |
| | | //视频信息 |
| | | public final static int TYPE_VIDEO_INFO = 1; |
| | | //视频资源 |
| | | public final static int TYPE_VIDEO_RESOURCE = 2; |
| | | //视频分类 |
| | | public final static int TYPE_VIDEO_CATEGORY = 3; |
| | | |
| | | |
| | | //新增 |
| | | public final static String ACTION_ADD = "add"; |
| | | //修改 |
| | | public final static String ACTION_UPDATE = "update"; |
| | | //删除 |
| | | public final static String ACTION_DELETE = "delete"; |
| | | |
| | | public VideoDataChangeMQMsg(int type, String videoIds, String action) { |
| | | this.type = type; |
| | | this.videoIds = videoIds; |
| | | this.action = action; |
| | | } |
| | | |
| | | private int type; |
| | | private String videoIds; |
| | | private String action; |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getVideoIds() { |
| | | return videoIds; |
| | | } |
| | | |
| | | public void setVideoIds(String videoIds) { |
| | | this.videoIds = videoIds; |
| | | } |
| | | |
| | | public String getAction() { |
| | | return action; |
| | | } |
| | | |
| | | public void setAction(String action) { |
| | | this.action = action; |
| | | } |
| | | } |
| | |
| | | |
| | | private String area; |
| | | |
| | | private List<String> areas; |
| | | |
| | | private Integer contentType; |
| | | private Integer videoType; |
| | | private List<String> resourceIds; |
| | |
| | | public void setFuzzy(boolean fuzzy) { |
| | | this.fuzzy = fuzzy; |
| | | } |
| | | |
| | | public List<String> getAreas() { |
| | | return areas; |
| | | } |
| | | |
| | | public void setAreas(List<String> areas) { |
| | | this.areas = areas; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | package com.yeshi.buwan.interceptor; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import com.yeshi.buwan.util.SignUtil; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | public class ApiSignInterceptor implements HandlerInterceptor { |
| | | |
| | |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.domain.vip.OrderRecord; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.util.EHCacheManager; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.AppMarketUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | //10409568 |
| | | @Component |
| | |
| | | import com.google.gson.Gson; |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.domain.system.SystemConfig; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.EHCacheManager; |
| | | import com.yeshi.buwan.util.rank.IqiyiRankUtil; |
| | | import com.yeshi.buwan.util.rank.TencentRankUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.AppMarketUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
New file |
| | |
| | | package com.yeshi.buwan.job.domain; |
| | | |
| | | import com.aliyun.alidns20150109.models.*; |
| | | import com.aliyun.teaopenapi.models.Config; |
| | | import com.google.gson.Gson; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: AliyunDomainParseUtil |
| | | * @description: 阿里云域名解析接口 |
| | | * 相关接口文档:https://next.api.aliyun.com/api/Alidns/2015-01-09/DescribeSubDomainRecords |
| | | * @date 2022/4/16 12:42 |
| | | */ |
| | | public class AliyunDomainParseUtil { |
| | | |
| | | private final static String ACCESS_KEY_ID = "LTAI4FwmTxVCuzTaoZtDiV8z"; |
| | | private final static String ACCESS_KEY_SECRET = "ixWg90QbYFKP6ae5xpAo2P1qwIyll5"; |
| | | |
| | | /** |
| | | * 使用AK&SK初始化账号Client |
| | | * |
| | | * @return Client |
| | | * @throws Exception |
| | | */ |
| | | private static com.aliyun.alidns20150109.Client createClient() throws Exception { |
| | | Config config = new Config() |
| | | // 您的AccessKey ID |
| | | .setAccessKeyId(ACCESS_KEY_ID) |
| | | // 您的AccessKey Secret |
| | | .setAccessKeySecret(ACCESS_KEY_SECRET); |
| | | // 访问的域名 |
| | | config.endpoint = "dns.aliyuncs.com"; |
| | | return new com.aliyun.alidns20150109.Client(config); |
| | | } |
| | | |
| | | //设置IP |
| | | public static void setIP(DescribeSubDomainRecordsResponseBody.DescribeSubDomainRecordsResponseBodyDomainRecordsRecord record, String ip) throws Exception { |
| | | if (record == null) { |
| | | throw new Exception("记录为空"); |
| | | } |
| | | |
| | | com.aliyun.alidns20150109.Client client = createClient(); |
| | | UpdateDomainRecordRequest updateDomainRecordRequest = new UpdateDomainRecordRequest() |
| | | .setRecordId(record.getRecordId()) |
| | | .setRR(record.getRR()) |
| | | .setType(record.getType()) |
| | | .setValue(ip) |
| | | .setTTL(record.getTTL()); |
| | | // 复制代码运行请自行打印 API 的返回值 |
| | | client.updateDomainRecord(updateDomainRecordRequest); |
| | | } |
| | | |
| | | //获取子域名解析记录 |
| | | public static DescribeSubDomainRecordsResponseBody.DescribeSubDomainRecordsResponseBodyDomainRecordsRecord getIP(String domain) throws Exception { |
| | | com.aliyun.alidns20150109.Client client = createClient(); |
| | | DescribeSubDomainRecordsRequest describeSubDomainRecordsRequest = new DescribeSubDomainRecordsRequest() |
| | | .setSubDomain(domain); |
| | | // 复制代码运行请自行打印 API 的返回值 |
| | | DescribeSubDomainRecordsResponse response = client.describeSubDomainRecords(describeSubDomainRecordsRequest); |
| | | DescribeSubDomainRecordsResponseBody.DescribeSubDomainRecordsResponseBodyDomainRecords records = response.getBody().getDomainRecords(); |
| | | DescribeSubDomainRecordsResponseBody.DescribeSubDomainRecordsResponseBodyDomainRecordsRecord record = records.getRecord().get(0); |
| | | return record; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args_) { |
| | | for (int i = 0; i < 10; i++) { |
| | | try { |
| | | DescribeSubDomainRecordsResponseBody.DescribeSubDomainRecordsResponseBodyDomainRecordsRecord record = getIP("api.ysdq.yeshitv.com"); |
| | | System.out.println(new Gson().toJson(record)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | Thread.sleep(5000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.job.domain; |
| | | |
| | | import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponseBody; |
| | | import com.tencentcloudapi.clb.v20180317.models.LoadBalancer; |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; |
| | | import com.yeshi.buwan.domain.live.TVLiveProgramResource; |
| | | import com.yeshi.buwan.domain.live.TVLiveResource; |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | import com.yeshi.buwan.live.migu.MiguLiveApiUtil; |
| | | import com.yeshi.buwan.service.inter.live.MiGuLiveService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveProgramResourceService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.factory.live.TVLiveChannelFactory; |
| | | import com.yeshi.buwan.util.tvlive.DianShiMaoUtil; |
| | | import com.yeshi.buwan.util.tvlive.TVSOUUtil; |
| | | import net.sf.json.JSONArray; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | //10409568 |
| | | @Component |
| | | public class DDOSJob { |
| | | |
| | | //切换被腾讯云封堵的IP |
| | | @XxlJob("ddos-buwan-server-change") |
| | | public ReturnT<String> buwanServerChange(String params) throws Exception { |
| | | LoadBalancer[] balances = TencentCloudCLBUtil.getCLBList("布丸-备用"); |
| | | if (balances == null || balances.length == 0) { |
| | | throw new Exception("腾讯云负载均衡未查询到"); |
| | | } |
| | | |
| | | List<String> blockIPS = new ArrayList<>(); |
| | | List<String> normalIPS = new ArrayList<>(); |
| | | for (LoadBalancer b : balances) { |
| | | if (b.getIsBlock()) { |
| | | blockIPS.add(b.getLoadBalancerVips()[0].trim()); |
| | | } else { |
| | | normalIPS.add(b.getLoadBalancerVips()[0].trim()); |
| | | } |
| | | } |
| | | |
| | | //无封堵 |
| | | if (blockIPS.size() == 0) { |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | //获取阿里云解析的域名 |
| | | DescribeSubDomainRecordsResponseBody.DescribeSubDomainRecordsResponseBodyDomainRecordsRecord record = AliyunDomainParseUtil.getIP("api.ysdq.yeshitv.com"); |
| | | |
| | | String ip = record.getValue().trim(); |
| | | if (!blockIPS.contains(ip)) { |
| | | //如果没有解析封堵的IP就返回 |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | //更换正常的IP |
| | | if (normalIPS.size() == 0) { |
| | | throw new Exception("腾讯云负载均衡IP已全部被封堵,请增加IP"); |
| | | } |
| | | AliyunDomainParseUtil.setIP(record, normalIPS.get(normalIPS.size() - 1)); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | // public static void main(String[] args){ |
| | | // try { |
| | | // new DDOSJob().buwanServerChange(""); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.job.domain; |
| | | |
| | | import com.tencentcloudapi.clb.v20180317.ClbClient; |
| | | import com.tencentcloudapi.clb.v20180317.models.DescribeLoadBalancersRequest; |
| | | import com.tencentcloudapi.clb.v20180317.models.DescribeLoadBalancersResponse; |
| | | import com.tencentcloudapi.clb.v20180317.models.LoadBalancer; |
| | | import com.tencentcloudapi.common.Credential; |
| | | import com.tencentcloudapi.common.exception.TencentCloudSDKException; |
| | | import com.tencentcloudapi.common.profile.ClientProfile; |
| | | import com.tencentcloudapi.common.profile.HttpProfile; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: TencentCloudSLBUtil |
| | | * @description: 腾讯云负载均衡 |
| | | * api:https://console.cloud.tencent.com/api/explorer?Product=clb&Version=2018-03-17&Action=DescribeLoadBalancers&SignVersion= |
| | | * @date 2022/4/16 13:33 |
| | | */ |
| | | public class TencentCloudCLBUtil { |
| | | |
| | | private final static String SECRET_ID = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25"; |
| | | private final static String SECRET_KEY = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo"; |
| | | |
| | | |
| | | /** |
| | | * @return com.tencentcloudapi.clb.v20180317.models.LoadBalancer[] |
| | | * @author hxh |
| | | * @description 获取负载均衡的列表,IsBlock表示是否封堵 |
| | | * @date 13:44 2022/4/16 |
| | | * @param: name |
| | | **/ |
| | | public static LoadBalancer[] getCLBList(String name) throws TencentCloudSDKException { |
| | | // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密 |
| | | // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取 |
| | | Credential cred = new Credential(SECRET_ID, SECRET_KEY); |
| | | // 实例化一个http选项,可选的,没有特殊需求可以跳过 |
| | | HttpProfile httpProfile = new HttpProfile(); |
| | | httpProfile.setEndpoint("clb.tencentcloudapi.com"); |
| | | // 实例化一个client选项,可选的,没有特殊需求可以跳过 |
| | | ClientProfile clientProfile = new ClientProfile(); |
| | | clientProfile.setHttpProfile(httpProfile); |
| | | // 实例化要请求产品的client对象,clientProfile是可选的 |
| | | ClbClient client = new ClbClient(cred, "ap-guangzhou", clientProfile); |
| | | // 实例化一个请求对象,每个接口都会对应一个request对象 |
| | | DescribeLoadBalancersRequest req = new DescribeLoadBalancersRequest(); |
| | | req.setLoadBalancerName(name); |
| | | // 返回的resp是一个DescribeLoadBalancersResponse的实例,与请求对象对应 |
| | | DescribeLoadBalancersResponse resp = client.DescribeLoadBalancers(req); |
| | | |
| | | return resp.getLoadBalancerSet(); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws TencentCloudSDKException { |
| | | LoadBalancer[] bs = TencentCloudCLBUtil.getCLBList("布丸-备用"); |
| | | System.out.println(bs); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.service.imp.ClearService; |
| | | import com.yeshi.buwan.service.imp.VideoTypeService; |
| | | import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class VideoUpdateJob { |
| | | |
| | | @Resource |
| | | private SolrAlbumVideoDataManager solrAlbumDataManager; |
| | | |
| | | @Resource |
| | | private ClearService clearService; |
| | | |
| | | @Resource |
| | | private VideoTypeService videoTypeService; |
| | | |
| | | /** |
| | | * 同步所有专辑 |
| | |
| | | solrAlbumDataManager.syncAllAlbum(); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return com.xxl.job.core.biz.model.ReturnT<java.lang.String> |
| | | * @author hxh |
| | | * @description 删除过期的数据 |
| | | * 查询的数据冗余的分类的sql: SELECT GROUP_CONCAT(a.videotypeid) FROM (SELECT COUNT(*) c,cv.`videotypeid` FROM wk_category_video cv GROUP BY cv.`videotypeid` ORDER BY c DESC) a WHERE a.c>20000 |
| | | * @date 17:09 2022/3/18 |
| | | * @param: param |
| | | **/ |
| | | //删除过期数据 |
| | | @XxlJob("video-update-delete-outofdate-video") |
| | | public ReturnT<String> deleteOutOfDateVideo(String param) throws Exception { |
| | | List<Long> typeList = new ArrayList<>(); |
| | | if (StringUtil.isNullOrEmpty(param)) { |
| | | typeList = Arrays.asList(new Long[]{212L, 213L, 214L, 282L, 283L}); |
| | | } else { |
| | | String[] sts = param.split(","); |
| | | for (String st : sts) { |
| | | typeList.add(Long.parseLong(st)); |
| | | } |
| | | } |
| | | for (Long type : typeList) { |
| | | VideoType videoType = videoTypeService.getVideoType(type); |
| | | while (videoType.getParent() != null) { |
| | | videoType = videoType.getParent(); |
| | | } |
| | | |
| | | int leftNum = 2000; |
| | | //主分类下面的小视频数量留10000 |
| | | if (VideoConstant.isMainCategory(videoType.getId())) { |
| | | leftNum = 10000; |
| | | } |
| | | clearService.clearOldVideo(type, leftNum); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | //删除依赖 |
| | | @XxlJob("video-update-clear-depend-video") |
| | | public ReturnT<String> clearDependVideo(String param) throws Exception { |
| | | clearService.clearDependVideo(); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private boolean isContainsResource(List<Long> resourceList, List<VideoResource> relist) { |
| | | List<Long> targetList = new ArrayList<>(); |
| | | for (VideoResource vr : relist) |
| | | if(!StringUtil.isNullOrEmpty(vr.getId())) { |
| | | targetList.add(Long.parseLong(vr.getId())); |
| | | } |
| | | targetList.retainAll(resourceList); |
| | | return targetList.size() > 0; |
| | | } |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import com.yeshi.buwan.dao.CategoryVideoDao; |
| | | import com.yeshi.buwan.dao.ResourceVideoDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.CategoryVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.dto.mq.VideoDataChangeMQMsg; |
| | | import com.yeshi.buwan.dto.mq.VideoExtraInfoChangeMQMsg; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Query; |
| | | import org.hibernate.Session; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | |
| | | cv.setVideoType(new VideoType(categoryId)); |
| | | categoryVideoDao.save(cv); |
| | | CMQManager.getInstance().addVideoExtraInfoChanged(new VideoExtraInfoChangeMQMsg(VideoExtraInfoChangeMQMsg.TYPE_CATEGORY, videoId, VideoExtraInfoChangeMQMsg.ACTION_ADD)); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_CATEGORY, videoId, VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | } |
| | | |
| | |
| | | return categoryVideoDao.list(hql); |
| | | } |
| | | |
| | | public List<CategoryVideo> getCategoryList(String videoId) { |
| | | String hql = "from CategoryVideo cv where cv.video.id=" + videoId; |
| | | return categoryVideoDao.list(hql); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import java.math.BigInteger; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.buwan.dao.CategoryVideoDao; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.CategoryVideo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.dto.mq.VideoDataChangeMQMsg; |
| | | import com.yeshi.buwan.service.imp.juhe.IqiyiService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import net.sf.json.JSONObject; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.fasterxml.jackson.databind.util.BeanUtil; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.service.imp.juhe.IqiyiService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | import javax.annotation.Resource; |
| | | import java.math.BigInteger; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | //清除数据库中的死数据 |
| | | @Service |
| | |
| | | @Resource |
| | | private VideoInfoDao videoInfoDao; |
| | | |
| | | @Resource |
| | | private CategoryVideoDao categoryVideoDao; |
| | | |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 删除老旧数据 |
| | | * @date 16:49 2022/3/18 |
| | | * @param: typeId |
| | | * @param: leftNumber 留下的数量 |
| | | **/ |
| | | public void clearOldVideo(long typeId, int leftNumber) { |
| | | Long minCreateTime = categoryVideoDao.getHibernateTemplate().execute(new HibernateCallback<Long>() { |
| | | @Override |
| | | public Long doInHibernate(Session session) throws HibernateException { |
| | | Object result = session.createSQLQuery("SELECT v.`createtime` FROM wk_category_video cv LEFT JOIN wk_video_video v ON v.`id`=cv.`videoid` WHERE cv.`videotypeid`=? ORDER BY cv.`id` DESC LIMIT ?,1").setParameter(0, typeId).setParameter(1, leftNumber).uniqueResult(); |
| | | if (result == null) { |
| | | return null; |
| | | } |
| | | return Long.parseLong(result.toString()); |
| | | } |
| | | }); |
| | | if (minCreateTime == null) { |
| | | return; |
| | | } |
| | | clearVideos(new long[]{typeId}, TimeUtil.getGernalTime(minCreateTime, "yyyy-MM-dd")); |
| | | } |
| | | |
| | | |
| | | @SuppressWarnings("rawtypes") |
| | | public void clearVideos(long[] ls, String date) { |
| | | final List<JSONObject> list = new ArrayList<>(); |
| | |
| | | videoInfoDao.excute(new HibernateCallback() { |
| | | public Object doInHibernate(Session session) throws HibernateException { |
| | | for (JSONObject item : list) { |
| | | Object result = session |
| | | .createSQLQuery(String.format( |
| | | "SELECT count(*) FROM wk_category_video cv LEFT JOIN wk_video_video v ON v.`id`=cv.`videoid` WHERE cv.`videotypeid`=%s AND v.`createtime`<%s", |
| | | item.getLong("videotype"), item.getLong("time"))) |
| | | .uniqueResult(); |
| | | int totalCount = Integer.parseInt(result.toString()); |
| | | if (totalCount <= 0) { |
| | | return null; |
| | | } |
| | | int BETCH_SIZE = 1000; |
| | | int page = totalCount / BETCH_SIZE + 1; |
| | | for (int n = 0; n < page; n++) { |
| | | List list = session |
| | | .createSQLQuery(String.format( |
| | | "SELECT cv.`videoid` FROM wk_category_video cv LEFT JOIN wk_video_video v ON v.`id`=cv.`videoid` WHERE cv.`videotypeid`=%s AND v.`createtime`<%s", |
| | | "SELECT cv.id,cv.videoid FROM wk_category_video cv LEFT JOIN wk_video_video v ON v.`id`=cv.`videoid` WHERE cv.`videotypeid`=%s AND v.`createtime`<%s", |
| | | item.getLong("videotype"), item.getLong("time"))) |
| | | .setFirstResult(0).setMaxResults(1000).list(); |
| | | .setFirstResult(0).setMaxResults(BETCH_SIZE).list(); |
| | | session.getTransaction().begin(); |
| | | if (list != null) { |
| | | int pagecount = 50; |
| | | int pages = list.size() % pagecount == 0 ? list.size() / pagecount |
| | | : list.size() / pagecount + 1; |
| | | for (int i = 0; i < pages; i++) { |
| | | String where = ""; |
| | | String ors = ""; |
| | | String cvors = ""; |
| | | |
| | | List<String> videoIds = new ArrayList<>(); |
| | | for (int p = 0; p < pagecount; p++) { |
| | | int pos = i * pagecount + p; |
| | | pos = pos >= list.size() ? list.size() - 1 : pos; |
| | | where += String.format("id=%s or ", list.get(pos) + ""); |
| | | ors += String.format("id=%s or ", ((Object[]) list.get(pos))[1] + ""); |
| | | cvors += String.format("id=%s or ", ((Object[]) list.get(pos))[0] + ""); |
| | | videoIds.add(((Object[]) list.get(pos))[1] + ""); |
| | | } |
| | | if (where.endsWith("or ")) |
| | | where = where.substring(0, where.length() - 3); |
| | | if (ors.endsWith("or ")) |
| | | ors = ors.substring(0, ors.length() - 3); |
| | | |
| | | session.createSQLQuery("delete from wk_video_video where " + where).executeUpdate(); |
| | | if (cvors.endsWith("or ")) |
| | | cvors = cvors.substring(0, cvors.length() - 3); |
| | | |
| | | session.createSQLQuery("delete from wk_video_video where " + ors).executeUpdate(); |
| | | session.createSQLQuery("delete from wk_category_video where " + cvors).executeUpdate(); |
| | | if (videoIds.size() > 0) { |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, org.yeshi.utils.StringUtil.concat(videoIds, ","), VideoDataChangeMQMsg.ACTION_DELETE)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | session.flush(); |
| | | session.getTransaction().commit(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | |
| | | // 清楚依赖VideoInfo的数据 |
| | | @SuppressWarnings("rawtypes") |
| | | public void clearDependVideo() { |
| | | |
| | | |
| | | for (String table : videoTables) { |
| | | clearDependVideoByTable(table); |
| | | } |
| | | } |
| | | |
| | | |
| | | public void clearDependVideoByTable(String table) { |
| | | final String sql = String.format( |
| | | "SELECT vv.id FROM `%s` vv LEFT JOIN wk_video_video v ON v.`id`=vv.`videoid` WHERE v.`id` IS NULL", |
| | | table); |
| | | final String countSql = String.format( |
| | | "SELECT count(*) FROM `%s` vv LEFT JOIN wk_video_video v ON v.`id`=vv.`videoid` WHERE v.`id` IS NULL", |
| | | table); |
| | | |
| | | Object obj = videoInfoDao.excute(new HibernateCallback() { |
| | | public Object doInHibernate(Session session) throws HibernateException { |
| | | return session.createSQLQuery(sql).setFirstResult(0).setMaxResults(1000).list(); |
| | | return session.createSQLQuery(countSql).uniqueResult(); |
| | | } |
| | | }); |
| | | int count = Integer.parseInt(obj.toString()); |
| | | int pageSize = 1000; |
| | | int page = count / pageSize + 1; |
| | | |
| | | for (int p = 0; p < page; p++) { |
| | | obj = videoInfoDao.excute(new HibernateCallback() { |
| | | public Object doInHibernate(Session session) throws HibernateException { |
| | | return session.createSQLQuery(sql).setFirstResult(0).setMaxResults(pageSize).list(); |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | try { |
| | | collectionDao.save(c); |
| | | } catch (Exception e) { |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.persistence.Entity; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.buwan.dao.AdviceDao; |
| | | import com.yeshi.buwan.dao.ContactDao; |
| | | import com.yeshi.buwan.domain.Advice; |
| | | import com.yeshi.buwan.domain.Contact; |
| | | import com.yeshi.buwan.domain.UserInfo; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class OtherService { |
| | | @Resource |
| | | private AdviceDao adviceDao; |
| | | @Resource |
| | | private ContactDao contactDao; |
| | | |
| | | |
| | | // 提交建议 |
| | | public void advice(String uid, String content) { |
| | |
| | | adviceDao.delete(new Advice(id)); |
| | | } |
| | | |
| | | public void addContact(String name, String mobile) { |
| | | Contact ct = new Contact(); |
| | | ct.setCreatetime(System.currentTimeMillis() + ""); |
| | | ct.setMobile(mobile); |
| | | ct.setName(name); |
| | | contactDao.create(ct); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.dao.VideoResourceMapExtraInfoDao; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.VideoResourceMapExtraInfo; |
| | | import com.yeshi.buwan.dto.mq.VideoDataChangeMQMsg; |
| | | import com.yeshi.buwan.dto.mq.VideoExtraInfoChangeMQMsg; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.hibernate.HibernateException; |
| | |
| | | rv.setVideo(new VideoInfo(videoId + "")); |
| | | resourceVideoDao.save(rv); |
| | | CMQManager.getInstance().addVideoExtraInfoChanged(new VideoExtraInfoChangeMQMsg(VideoExtraInfoChangeMQMsg.TYPE_RESOURCE, videoId, VideoExtraInfoChangeMQMsg.ACTION_ADD)); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE,videoId, VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | } |
| | | |
| | |
| | | if (resourceVideo != null) { |
| | | resourceVideoDao.delete(resourceVideo); |
| | | CMQManager.getInstance().addVideoExtraInfoChanged(new VideoExtraInfoChangeMQMsg(VideoExtraInfoChangeMQMsg.TYPE_RESOURCE, videoId, VideoExtraInfoChangeMQMsg.ACTION_DELETE)); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE,videoId, VideoDataChangeMQMsg.ACTION_DELETE)); |
| | | } |
| | | |
| | | VideoResourceMapExtraInfo extraInfo = new VideoResourceMapExtraInfo(videoId, Long.parseLong(resourceId)); |
| | |
| | | import com.yeshi.buwan.dto.config.TencentSMSConfig; |
| | | import com.yeshi.buwan.exception.SMSException; |
| | | import com.yeshi.buwan.service.inter.SMSService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.RedisKeyEnum; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | |
| | | public class StarService { |
| | | @Resource |
| | | private HotStarDao hotStarDao; |
| | | @Resource |
| | | private VideoInfoDao videoInfoDao; |
| | | |
| | | @Resource |
| | | private SuperHotStarDao superHotStarDao; |
| | | |
| | |
| | | |
| | | return hotStarDao.getCount("select count(*) from SuperHotStar s where s.detailSystem.id=?", |
| | | new String[]{detailSystem}); |
| | | } |
| | | |
| | | public List<VideoInfo> getHotStarVideo(String starId, int page) { |
| | | |
| | | List<VideoInfo> list = videoInfoDao.list( |
| | | "select h.video from HotStarVideo as h LEFT JOIN h.video as v where h.video.show='1' and v.id=h.video.id and h.star.id=? order by h.video.updatetime desc", |
| | | (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{starId}); |
| | | return list; |
| | | } |
| | | |
| | | public long getHotStarVideoCount(String starId) { |
| | | |
| | | long count = hotStarDao.getCount( |
| | | "select count(*) from HotStarVideo as h where h.video.show='1' and h.star.id=?", |
| | | new String[]{starId}); |
| | | return count; |
| | | } |
| | | |
| | | public List<HotStar> getStarList() { |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.buwan.util.HibernateSessionFactory; |
| | | import com.yeshi.buwan.dao.CategoryVideoDao; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.dto.mq.VideoDataChangeMQMsg; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import org.hibernate.HibernateException; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.yeshi.buwan.dao.CategoryVideoDao; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.CategoryVideo; |
| | | import com.yeshi.buwan.domain.ResourceVideo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.domain.VideoUrl; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class VideoInfoService { |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public void save(VideoInfo videoInfo) { |
| | | public void saveWithCategoryAndResource(VideoInfo videoInfo) { |
| | | videoInfoDao.save(videoInfo); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, videoInfo.getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | CategoryVideo ca = new CategoryVideo(); |
| | | ca.setVideo(videoInfo); |
| | | ca.setVideoType(videoInfo.getVideoType()); |
| | | categoryVideoDao.create(ca); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_CATEGORY, videoInfo.getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | List<VideoResource> resourceList = videoInfo.getResourceList(); |
| | | ResourceVideo rs = null; |
| | | for (VideoResource videoResource : resourceList) { |
| | |
| | | rs.setVideo(videoInfo); |
| | | resourceVideoService.save(rs); |
| | | } |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE, videoInfo.getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public Serializable save(VideoInfo videoInfo) { |
| | | Serializable id = videoInfoDao.save(videoInfo); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, videoInfo.getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | return id; |
| | | } |
| | | |
| | | @Transactional |
| | | public void update(VideoInfo videoInfo) { |
| | | videoInfoDao.update(videoInfo); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, videoInfo.getId(), VideoDataChangeMQMsg.ACTION_UPDATE)); |
| | | } |
| | | |
| | | public List<VideoDetailInfo> getVideoDetailList(String videoid, VideoResource vr, int page, int pageSize) { |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.OneToMany; |
| | | |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.dao.VideoDetailInfoDao; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.dao.VideoTypeDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService; |
| | | import com.yeshi.buwan.util.LogUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.buwan.dao.VideoDetailInfoDao; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.dao.VideoTypeDao; |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.domain.HomeAd; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.SuperHomeAd; |
| | | import com.yeshi.buwan.domain.VideoBanQuanVideo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoIntersectionVideo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.domain.VideoUrl; |
| | | import com.yeshi.buwan.domain.special.SpecialVideo; |
| | | import com.yeshi.buwan.domain.special.SuperSpecial; |
| | | import com.yeshi.buwan.util.JuheVideoUtil; |
| | | import com.yeshi.buwan.util.LogUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import javax.annotation.Resource; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.OneToMany; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class VideoManager { |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import com.yeshi.buwan.dao.VideoResourceMapExtraInfoDao; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResourceMapExtraInfo; |
| | | import com.yeshi.buwan.service.inter.VideoResourceMapExtraInfoService; |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.buwan.dao.CategoryVideoDao; |
| | | import com.yeshi.buwan.dao.ResourceVideoDao; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.dao.VideoResourceDao; |
| | | import com.yeshi.buwan.domain.CategoryVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class VideoService { |
| | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.ad.DeviceAdStrategy; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.ad.DeviceAdStrategyService; |
| | |
| | | import com.yeshi.buwan.dao.recommend.FloatADDao; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import com.yeshi.buwan.service.inter.ad.FloatADService; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | videoInfo.setVpicture(newVideoInfo.getVpicture()); |
| | | videoInfo.setShow(newVideoInfo.getShow()); |
| | | videoInfo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfoDao.update(videoInfo); |
| | | videoInfoService.update(videoInfo); |
| | | } |
| | | } else {//视频不存在 |
| | | //判断2个视频实体是否为同一视频 |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideoWithTime(newVideoInfo); |
| | | if (oldVideo == null) { |
| | | //添加视频 |
| | | Serializable id = videoInfoDao.save(newVideoInfo); |
| | | Serializable id = videoInfoService.save(newVideoInfo); |
| | | newVideoInfo.setId(id + ""); |
| | | } else {//为同一视频 |
| | | //更新tag |
| | |
| | | oldVideo.setVpicture(newVideoInfo.getVpicture()); |
| | | oldVideo.setShow(newVideoInfo.getShow()); |
| | | oldVideo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfoDao.update(oldVideo); |
| | | videoInfoService.update(oldVideo); |
| | | } |
| | | |
| | | //加入专辑视频映射 |
| | |
| | | DetailSystemConfig config = detailSystemConfigService.getConfigByKey("funshion_sdk_player", acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | //默认SDK播放 |
| | | if (config == null) |
| | | return FunTVUtil2.PLAY_SDK; |
| | | return FunTVUtil2.PLAY_HTML; |
| | | |
| | | String channel = acceptData.getChannel(); |
| | | if (StringUtil.isNullOrEmpty(channel)) { |
| | |
| | | videoInfo.setShow(newVideoInfo.getShow()); |
| | | videoInfo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfo.setUpdatetime(newVideoInfo.getUpdatetime()); |
| | | videoInfoDao.update(videoInfo); |
| | | videoInfoService.update(videoInfo); |
| | | } |
| | | } else {//视频不存在 |
| | | //判断2个视频实体是否为同一视频 |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideoWithTime(newVideoInfo); |
| | | if (oldVideo == null) { |
| | | //添加视频 |
| | | Serializable id = videoInfoDao.save(newVideoInfo); |
| | | Serializable id = videoInfoService.save(newVideoInfo); |
| | | newVideoInfo.setId(id + ""); |
| | | } else {//为同一视频 |
| | | //更新tag |
| | |
| | | oldVideo.setShow(newVideoInfo.getShow()); |
| | | oldVideo.setVideoType(newVideoInfo.getVideoType()); |
| | | oldVideo.setUpdatetime(newVideoInfo.getUpdatetime()); |
| | | videoInfoDao.update(oldVideo); |
| | | videoInfoService.update(oldVideo); |
| | | } |
| | | |
| | | //加入专辑视频映射 |
| | |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | return selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<InternetSearchVideo> listByIds(List<String> ids) { |
| | | if (ids == null || ids.size() == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | Query query = new Query(); |
| | | List<Criteria> orList = new ArrayList<>(); |
| | | for (String id : ids) { |
| | | orList.add(Criteria.where("id").is(id)); |
| | | } |
| | | Criteria[] ors = new Criteria[orList.size()]; |
| | | orList.toArray(ors); |
| | | query.addCriteria(new Criteria().orOperator(ors)); |
| | | return internetSearchVideoDao.findList(query); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | videoInfo.setShow(newVideoInfo.getShow()); |
| | | videoInfo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfo.setUpdatetime(newVideoInfo.getUpdatetime()); |
| | | videoInfoDao.update(videoInfo); |
| | | videoInfoService.update(videoInfo); |
| | | } |
| | | } else {//视频不存在 |
| | | //判断2个视频实体是否为同一视频 |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideoWithTime(newVideoInfo); |
| | | if (oldVideo == null) { |
| | | //添加视频 |
| | | Serializable id = videoInfoDao.save(newVideoInfo); |
| | | Serializable id = videoInfoService.save(newVideoInfo); |
| | | newVideoInfo.setId(id + ""); |
| | | } else {//为同一视频 |
| | | //更新tag |
| | |
| | | oldVideo.setShow(newVideoInfo.getShow()); |
| | | oldVideo.setVideoType(newVideoInfo.getVideoType()); |
| | | oldVideo.setUpdatetime(newVideoInfo.getUpdatetime()); |
| | | videoInfoDao.update(oldVideo); |
| | | videoInfoService.update(oldVideo); |
| | | } |
| | | |
| | | //加入专辑视频映射 |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.buwan.dto.mq.VideoDataChangeMQMsg; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.apache.log4j.Logger; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | |
| | | String id = ""; |
| | | if (same == null) { |
| | | id = session.save(vi).toString(); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, id, VideoDataChangeMQMsg.ACTION_ADD)); |
| | | // if(id!=null) |
| | | // session.createSQLQuery(String.format("CALL |
| | | // copyvideotemp(%s)",id)).executeUpdate(); |
| | |
| | | } |
| | | |
| | | session.update(same);// 更新原来的视频 |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, same.getId(), VideoDataChangeMQMsg.ACTION_UPDATE)); |
| | | |
| | | Object obj = session |
| | | .createQuery( |
| | |
| | | rv.setResource(new VideoResource("13")); |
| | | rv.setVideo(new VideoInfo(same.getId())); |
| | | session.persist(rv); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE, rv.getVideo().getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | |
| | | } |
| | |
| | | rv.setResource(new VideoResource("13")); |
| | | rv.setVideo(new VideoInfo(id)); |
| | | session.persist(rv); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE, rv.getVideo().getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | |
| | | VideoIqiyi vii = new VideoIqiyi(); |
| | |
| | | } |
| | | session.update(list.get(0).getVideo()); |
| | | vid = list.get(0).getVideo().getId(); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, vid, VideoDataChangeMQMsg.ACTION_UPDATE)); |
| | | |
| | | Object obj = session |
| | | .createQuery( |
| | | "select count(*) from ResourceVideo rv where rv.resource.id=? and rv.video.id=?") |
| | |
| | | rv.setResource(new VideoResource("13")); |
| | | rv.setVideo(new VideoInfo(list.get(0).getVideo().getId())); |
| | | session.persist(rv); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE, rv.getVideo().getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | } |
| | | // 更新tag |
| | |
| | | if (same == null) { |
| | | vi.setVideocount(videoDetailCount); |
| | | videoid = session.save(vi).toString(); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, videoid, VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } else |
| | | videoid = same.getId(); |
| | | |
| | |
| | | rv.setResource(new VideoResource("13")); |
| | | rv.setVideo(new VideoInfo(videoid)); |
| | | session.persist(rv); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE, rv.getVideo().getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | |
| | | if (same != null)// 更新内容 |
| | |
| | | + ""); |
| | | session.update(same); |
| | | |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_INFO, videoid, VideoDataChangeMQMsg.ACTION_UPDATE)); |
| | | |
| | | obj = session |
| | | .createQuery( |
| | | "select count(*) from ResourceVideo rv where rv.resource.id=? and rv.video.id=?") |
| | |
| | | rv.setResource(new VideoResource("13")); |
| | | rv.setVideo(same); |
| | | session.persist(rv); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE, rv.getVideo().getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | |
| | | } |
| | |
| | | rv.setResource(new VideoResource("13")); |
| | | rv.setVideo(list.get(0).getVideo()); |
| | | session.persist(rv); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_RESOURCE, rv.getVideo().getId(), VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | vid = list.get(0).getVideo().getId(); |
| | | } |
| | |
| | | videoInfo.setVpicture(newVideoInfo.getVpicture()); |
| | | videoInfo.setShow(newVideoInfo.getShow()); |
| | | videoInfo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfoDao.update(videoInfo); |
| | | videoInfoService.update(videoInfo); |
| | | } |
| | | } else {//视频不存在 |
| | | //判断2个视频实体是否为同一视频 |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideoWithDirector(newVideoInfo); |
| | | if (oldVideo == null) { |
| | | //添加视频 |
| | | Serializable id = videoInfoDao.save(newVideoInfo); |
| | | Serializable id = videoInfoService.save(newVideoInfo); |
| | | newVideoInfo.setId(id + ""); |
| | | } else {//为同一视频 |
| | | //更新tag |
| | |
| | | oldVideo.setVpicture(newVideoInfo.getVpicture()); |
| | | oldVideo.setShow(newVideoInfo.getShow()); |
| | | oldVideo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfoDao.update(oldVideo); |
| | | videoInfoService.update(oldVideo); |
| | | } |
| | | |
| | | //加入专辑视频映射 |
| | |
| | | import com.yeshi.buwan.service.inter.video.VideoInfoExtraService; |
| | | import com.yeshi.buwan.service.manager.search.SolrShortVideoDataManager; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.util.video.VideoUtil; |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.uservideo; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.buwan.domain.uservideo.CollectionVideoV2; |
| | | import com.yeshi.buwan.dao.uservideo.CollectionVideoV2Dao; |
| | | import com.yeshi.buwan.service.inter.uservideo.CollectionVideoV2Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class CollectionVideoV2ServiceImpl implements CollectionVideoV2Service { |
| | | |
| | | @Resource |
| | | private CollectionVideoV2Dao collectionVideoV2Dao; |
| | | |
| | | |
| | | @Override |
| | | public void add(CollectionVideoV2 bean) throws ParamsException { |
| | | if (bean == null || bean.getLoginUid() == null || bean.getVideoId() == null) { |
| | | throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "参数不完整"); |
| | | } |
| | | if (bean.getCreateTime() == null) { |
| | | bean.setCreateTime(new Date()); |
| | | } |
| | | |
| | | bean.setId(CollectionVideoV2.createId(bean.getLoginUid(), bean.getVideoId())); |
| | | if (collectionVideoV2Dao.get(bean.getId()) != null) { |
| | | throw new ParamsException(ParamsException.CODE_EXIST, "已存在"); |
| | | } |
| | | collectionVideoV2Dao.save(bean); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(List<String> ids) { |
| | | for (String id : ids) { |
| | | collectionVideoV2Dao.delete(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<CollectionVideoV2> listByUid(String uid, int page, int pageSize) { |
| | | CollectionVideoV2Dao.DaoQuery daoQuery = new CollectionVideoV2Dao.DaoQuery(); |
| | | daoQuery.loginUid = uid; |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | daoQuery.sortList = Arrays.asList(new Sort.Order(Sort.Direction.DESC, "createTime")); |
| | | return collectionVideoV2Dao.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public long countByUid(String uid) { |
| | | CollectionVideoV2Dao.DaoQuery daoQuery = new CollectionVideoV2Dao.DaoQuery(); |
| | | daoQuery.loginUid = uid; |
| | | return collectionVideoV2Dao.count(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public CollectionVideoV2 selectByUidAndVideoId(String uid, String videoId) { |
| | | String id = CollectionVideoV2.createId(uid, videoId); |
| | | return collectionVideoV2Dao.get(id); |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.service.imp.video; |
| | | |
| | | import com.yeshi.buwan.domain.video.StarInfo; |
| | | import com.yeshi.buwan.dao.video.StarInfoDao; |
| | | import com.yeshi.buwan.service.inter.video.StarInfoService; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import java.util.Date; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | public class StarInfoServiceImpl implements StarInfoService{ |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.video; |
| | | |
| | | import com.yeshi.buwan.dao.video.VideoInfoV2Dao; |
| | | import com.yeshi.buwan.domain.video.VideoInfoV2; |
| | | import com.yeshi.buwan.service.inter.video.VideoInfoV2Service; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationOperation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoInfoV2ServiceImpl |
| | | * @description: TODO |
| | | * @date 2022/3/17 16:02 |
| | | */ |
| | | @Service |
| | | public class VideoInfoV2ServiceImpl implements VideoInfoV2Service { |
| | | |
| | | @Resource |
| | | private VideoInfoV2Dao videoInfoV2Dao; |
| | | |
| | | |
| | | @Override |
| | | public void save(VideoInfoV2 bean) { |
| | | if (videoInfoV2Dao.get(bean.getId()) == null) { |
| | | if (bean.getCreateTime() == null) { |
| | | bean.setCreateTime(new Date()); |
| | | } |
| | | videoInfoV2Dao.save(bean); |
| | | } else { |
| | | videoInfoV2Dao.updateSelective(bean); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public VideoInfoV2 selectById(String id) { |
| | | List<VideoInfoV2> list = listByIds(Arrays.asList(new String[]{id})); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public VideoInfoV2 selectDetailById(String id) { |
| | | List<VideoInfoV2> list = listDetailByIds(Arrays.asList(new String[]{id})); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<VideoInfoV2> listByIds(List<String> ids) { |
| | | Criteria[] ors = new Criteria[ids.size()]; |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("_id").is(ids.get(i)); |
| | | } |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().orOperator(ors)); |
| | | return videoInfoV2Dao.findList(query); |
| | | } |
| | | |
| | | @Override |
| | | public List<VideoInfoV2> listDetailByIds(List<String> ids) { |
| | | Criteria[] ors = new Criteria[ids.size()]; |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("_id").is(ids.get(i)); |
| | | } |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | list.add(Aggregation.match(new Criteria().orOperator(ors))); |
| | | list.add(Aggregation.lookup("videoInfoExtraV2", "_id", "_id", "extra")); |
| | | list.add(Aggregation.unwind("extra", true)); |
| | | AggregationResults<VideoInfoV2> results = videoInfoV2Dao.aggregate(list, VideoInfoV2.class); |
| | | return results.getMappedResults(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.video; |
| | | |
| | | import java.lang.Exception; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import com.yeshi.buwan.dao.video.VideoResourceInfoMapDao; |
| | | import com.yeshi.buwan.domain.video.VideoResourceInfoMap; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceInfoMapService; |
| | | import com.yeshi.buwan.vo.CommonQuery; |
| | | import com.yeshi.buwan.dao.video.VideoResourceInfoMapDao.DaoQuery; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | @Service |
| | | public class VideoResourceInfoMapServiceImpl implements VideoResourceInfoMapService { |
| | | |
| | | @Resource |
| | | private VideoResourceInfoMapDao videoResourceInfoMapDao; |
| | | |
| | | @Override |
| | | public List<VideoResourceInfoMap> listByDetailSystemId(String detailSystemId, int page, int pageSize) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | |
| | | daoQuery.detailSystemId = detailSystemId; |
| | | |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | return videoResourceInfoMapDao.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public long countByDetailSystemId(String detailSystemId) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.detailSystemId = detailSystemId; |
| | | return videoResourceInfoMapDao.count(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public List<VideoResource> filter(String detailSystemId, List<VideoResource> resourceList) { |
| | | if (resourceList == null || resourceList.size() == 0) { |
| | | return resourceList; |
| | | } |
| | | |
| | | List<Long> ridList = new ArrayList<>(); |
| | | for (VideoResource rv : resourceList) { |
| | | ridList.add(Long.parseLong(rv.getId())); |
| | | } |
| | | |
| | | List<VideoResourceInfoMap> list = videoResourceInfoMapDao.list(detailSystemId, ridList); |
| | | Map<Long, VideoResourceInfoMap> map = new HashMap<>(); |
| | | for (VideoResourceInfoMap vr : list) { |
| | | map.put(vr.getResourceId(), vr); |
| | | } |
| | | for (VideoResource vr : resourceList) { |
| | | if (map.get(Long.parseLong(vr.getId())) == null) { |
| | | continue; |
| | | } |
| | | String name = map.get(Long.parseLong(vr.getId())).getName(); |
| | | String icon = map.get(Long.parseLong(vr.getId())).getIcon(); |
| | | if (!StringUtil.isNullOrEmpty(name)) { |
| | | vr.setName(name); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(icon)) { |
| | | vr.setPicture(icon); |
| | | } |
| | | } |
| | | return resourceList; |
| | | } |
| | | |
| | | @Override |
| | | public VideoResourceInfoMap get(String id) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("_id").is(id)); |
| | | return videoResourceInfoMapDao.findOne(query); |
| | | } |
| | | |
| | | @Override |
| | | public void add(VideoResourceInfoMap videoResourceInfoMap) throws Exception { |
| | | |
| | | if (videoResourceInfoMap.getDetailSystemId() == null || videoResourceInfoMap.getResourceId() == null) { |
| | | throw new Exception("参数不完整"); |
| | | } |
| | | |
| | | if (videoResourceInfoMap.getId() == null) { |
| | | videoResourceInfoMap.setId(VideoResourceInfoMap.createId(videoResourceInfoMap.getResourceId(), videoResourceInfoMap.getDetailSystemId())); |
| | | } |
| | | |
| | | |
| | | //查询主键ID是否存在 |
| | | if (videoResourceInfoMapDao.get(videoResourceInfoMap.getId()) != null) { |
| | | throw new Exception("已存在"); |
| | | } |
| | | |
| | | if (videoResourceInfoMap.getCreateTime() == null) { |
| | | videoResourceInfoMap.setCreateTime(new Date()); |
| | | } |
| | | //保存 |
| | | videoResourceInfoMapDao.save(videoResourceInfoMap); |
| | | } |
| | | |
| | | @Override |
| | | public void update(VideoResourceInfoMap videoResourceInfoMap) { |
| | | if (videoResourceInfoMap.getUpdateTime() == null) { |
| | | videoResourceInfoMap.setUpdateTime(new Date()); |
| | | } |
| | | //更新 |
| | | videoResourceInfoMapDao.updateSelective(videoResourceInfoMap); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(List<String> idList) { |
| | | for (String id : idList) { |
| | | videoResourceInfoMapDao.delete(id); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.video; |
| | | |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.domain.video.VideoInfoV2; |
| | | import com.yeshi.buwan.service.imp.CategoryVideoService; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.VideoTypeService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.video.VideoInfoV2Service; |
| | | import com.yeshi.buwan.service.inter.video.VideoV2ConvertService; |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.util.factory.vo.VideoInfoV2Factory; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.lang.model.element.TypeParameterElement; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoV2ConvertServiceImpl |
| | | * @description: TODO |
| | | * @date 2022/3/17 15:34 |
| | | */ |
| | | @Service |
| | | public class VideoV2ConvertServiceImpl implements VideoV2ConvertService { |
| | | |
| | | @Resource |
| | | private VideoInfoV2Service videoInfoV2Service; |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | @Resource |
| | | private InternetSearchVideoService internetSearchVideoService; |
| | | |
| | | @Resource |
| | | private CategoryVideoService categoryVideoService; |
| | | |
| | | @Resource |
| | | private VideoTypeService videoTypeService; |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | |
| | | @Override |
| | | public void asyncOldVideo(String videoId) throws Exception { |
| | | |
| | | if (videoInfoV2Service.selectById(videoId) != null) { |
| | | throw new Exception("已经同步过"); |
| | | } |
| | | |
| | | VideoInfo videoInfo = null; |
| | | if (NumberUtil.isNumeric(videoId)) { |
| | | videoInfo = videoInfoService.getVideoInfo(videoId); |
| | | if (videoInfo == null) { |
| | | throw new Exception("视频不存在"); |
| | | } |
| | | |
| | | List<CategoryVideo> list = categoryVideoService.getCategoryList(videoId); |
| | | List<VideoType> typeList = new ArrayList<>(); |
| | | for (CategoryVideo cv : list) { |
| | | typeList.add(cv.getVideoType()); |
| | | } |
| | | videoInfo.setTypeList(typeList); |
| | | |
| | | //获取根分类 |
| | | if (videoInfo.getVideoType() == null) { |
| | | if (list != null && list.size() > 0) { |
| | | videoInfo.setVideoType(list.get(0).getVideoType()); |
| | | } |
| | | } |
| | | |
| | | //获取资源列表 |
| | | List<ResourceVideo> rvList = resourceVideoService.getResourceList(videoId); |
| | | List<VideoResource> rlist = new ArrayList<>(); |
| | | for (ResourceVideo rv : rvList) { |
| | | rlist.add(rv.getResource()); |
| | | } |
| | | videoInfo.setResourceList(rlist); |
| | | } else { |
| | | InternetSearchVideo internetSearchVideo = internetSearchVideoService.selectByPrimaryKey(videoId); |
| | | if (internetSearchVideo == null) { |
| | | throw new Exception("视频不存在"); |
| | | } |
| | | String[] rs = internetSearchVideo.getResourceIds().split(","); |
| | | List<VideoResource> rList = new ArrayList<>(); |
| | | for (String r : rs) { |
| | | rList.add(new VideoResource(r.trim())); |
| | | } |
| | | VideoType videoType = videoTypeService.getVideoType(internetSearchVideo.getRootType()); |
| | | videoInfo = VideoInfoFactory.create(internetSearchVideo); |
| | | videoInfo.setResourceList(rList); |
| | | videoInfo.setVideoType(videoType); |
| | | } |
| | | VideoInfoV2 v2 = VideoInfoV2Factory.create(videoInfo); |
| | | videoInfoV2Service.save(v2); |
| | | } |
| | | } |
| | |
| | | import com.yeshi.buwan.dao.video.VideoWatchHistoryDao; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | public interface AlbumVideoMapService { |
| | |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.exception.video.IqiyiVideoSolrException; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShow; |
| | | import com.yeshi.buwan.videos.iqiyi.entity.IqiyiAlbum2; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public InternetSearchVideo selectByPrimaryKeyCache(String id); |
| | | |
| | | public List<InternetSearchVideo> listByIds(List<String> ids); |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.exception.vip.VideoBuyRecordException; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface OrderService { |
| | |
| | | package com.yeshi.buwan.service.inter.search; |
| | | |
| | | import com.yeshi.buwan.domain.special.SearchSpecialPosition; |
| | | import com.yeshi.buwan.domain.special.SearchSpecialPositionMap; |
| | | import com.yeshi.buwan.exception.ParamsException; |
| | | |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.uservideo; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.buwan.domain.uservideo.CollectionVideoV2; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CollectionVideoV2Service { |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 添加收藏 |
| | | * @date 19:00 2022/3/8 |
| | | * @param: bean |
| | | **/ |
| | | public void add(CollectionVideoV2 bean) throws ParamsException; |
| | | |
| | | public void delete(List<String> ids); |
| | | |
| | | /** |
| | | * @return java.util.List<com.yeshi.buwan.domain.uservideo.CollectionVideoV2> |
| | | * @author hxh |
| | | * @description 列表 |
| | | * @date 19:02 2022/3/8 |
| | | * @param: uid |
| | | **/ |
| | | public List<CollectionVideoV2> listByUid(String uid, int page, int pageSize); |
| | | |
| | | public long countByUid(String uid); |
| | | |
| | | /** |
| | | * @return com.yeshi.buwan.domain.uservideo.CollectionVideoV2 |
| | | * @author hxh |
| | | * @description 根据用户ID和视频ID查询 |
| | | * @date 10:24 2022/3/9 |
| | | * @param: uid |
| | | * @param: videoId |
| | | **/ |
| | | public CollectionVideoV2 selectByUidAndVideoId(String uid, String videoId); |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.service.inter.video; |
| | | |
| | | import com.yeshi.buwan.domain.video.StarInfo; |
| | | |
| | | public interface StarInfoService { |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.video; |
| | | |
| | | import com.yeshi.buwan.domain.video.VideoInfoV2; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoInfoV2Service |
| | | * @description: TODO |
| | | * @date 2022/3/16 18:36 |
| | | */ |
| | | public interface VideoInfoV2Service { |
| | | |
| | | //保存 |
| | | public void save(VideoInfoV2 bean); |
| | | |
| | | //主键查询 |
| | | public VideoInfoV2 selectById(String id); |
| | | |
| | | //查询详情 |
| | | public VideoInfoV2 selectDetailById(String id); |
| | | |
| | | public List<VideoInfoV2> listByIds(List<String> ids); |
| | | |
| | | public List<VideoInfoV2> listDetailByIds(List<String> ids); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.video; |
| | | |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.video.VideoResourceInfoMap; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface VideoResourceInfoMapService { |
| | | |
| | | /** |
| | | * 获取列表 |
| | | * |
| | | * @param detailSystemId |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<VideoResourceInfoMap> listByDetailSystemId(String detailSystemId, int page, int pageSize); |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public long countByDetailSystemId(String detailSystemId); |
| | | |
| | | |
| | | public List<VideoResource> filter(String detailSystemId, List<VideoResource> resourceList); |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public VideoResourceInfoMap get(String id); |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void add(VideoResourceInfoMap videoResourceInfoMap) throws Exception; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void update(VideoResourceInfoMap videoResourceInfoMap); |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void delete(List<String> idList); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.video; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoV2ConvertService |
| | | * @description: 旧视频信息转到新的视频信息服务 |
| | | * @date 2022/3/17 15:32 |
| | | */ |
| | | public interface VideoV2ConvertService { |
| | | |
| | | //同步旧的视频信息 |
| | | public void asyncOldVideo(String videoId) throws Exception; |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.solr.SolrCommonVideo; |
| | | import com.yeshi.buwan.domain.solr.SolrCommonVideo; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.dto.search.SolrResultDTO; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.service.imp.CategoryVideoService; |
| | |
| | | query.addFilterQuery(new SimpleFilterQuery(Criteria.where("area").contains(filter.getArea()))); |
| | | } |
| | | |
| | | if (filter.getAreas() != null && filter.getAreas().size() > 0) { |
| | | |
| | | Criteria criteria = Criteria.where("area").contains(filter.getAreas().get(0)); |
| | | for (int i = 1; i < filter.getAreas().size(); i++) { |
| | | criteria = criteria.or("area").contains(filter.getAreas().get(i)); |
| | | } |
| | | query.addFilterQuery(new SimpleFilterQuery(criteria)); |
| | | } |
| | | |
| | | |
| | | /** 设置分页开始记录数(第一页) 默认0 */ |
| | | query.setOffset((page - 1) * pageSize); |
| | |
| | | query.addFilterQuery(new SimpleFilterQuery(Criteria.where("area").contains(filter.getArea()))); |
| | | } |
| | | |
| | | if (filter.getAreas() != null&&filter.getAreas().size()>0) { |
| | | Criteria criteria=Criteria.where("area").contains(filter.getAreas().get(0)); |
| | | for(int i=1;i<filter.getAreas().size();i++){ |
| | | criteria= criteria.or("area").contains(filter.getAreas().get(i)); |
| | | } |
| | | query.addFilterQuery(new SimpleFilterQuery(criteria)); |
| | | } |
| | | |
| | | |
| | | /** 设置分页开始记录数(第一页) 默认0 */ |
| | | query.setOffset((page - 1) * pageSize); |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import javax.crypto.*; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.SecureRandom; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.KeyGenerator; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | |
| | | /** |
| | | * AES加密解密 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class AESUtil { |
| | | |
| | |
| | | cipher.init(Cipher.ENCRYPT_MODE, key); |
| | | // 加密 |
| | | byte[] result = cipher.doFinal(byteContent); |
| | | return (new sun.misc.BASE64Encoder()).encode(result); |
| | | return StringUtil.getBase64FromByte(result); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import javax.persistence.Entity; |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import net.sf.json.JSONObject; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.select.Elements; |
| | | import org.yeshi.utils.HttpUtil; |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import javax.persistence.Entity; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Entity |
| | | public class DouBanUtil { |
| | | public static String baseUrl = "https://movie.douban.com/subject_search?cat=102&"; |
| | | public static String baseUrl = "https://www.douban.com/search?cat=1002&"; |
| | | public static int maxCount = 1; |
| | | |
| | | /** |
| | |
| | | public static List<VideoInfo> startSearch(String st) throws IOException { |
| | | Document doc = Jsoup |
| | | .connect( |
| | | baseUrl + "search_text=" |
| | | baseUrl + "q=" |
| | | + URLEncoder.encode(st, "UTF-8")) |
| | | .header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") |
| | | .header("Host", "www.douban.com") |
| | | .header("sec-ch-ua", "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"99\", \"Google Chrome\";v=\"99\"") |
| | | .header("sec-ch-ua-mobile", "?0") |
| | | .header("sec-ch-ua-platform", "\"Windows\"") |
| | | .header("Sec-Fetch-Dest", "document") |
| | | .header("Sec-Fetch-Mode", "navigate") |
| | | .header("Sec-Fetch-Site", "none") |
| | | .header("Sec-Fetch-User", "?1") |
| | | .header("Upgrade-Insecure-Requests", "1") |
| | | .userAgent( |
| | | "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36") |
| | | .timeout(20000).get(); |
| | | Element el = doc.getElementById("content"); |
| | | Elements els = el.getElementsByTag("table"); |
| | | List<VideoInfo> list = new ArrayList<VideoInfo>(); |
| | | Element el = doc.getElementById("content").getElementsByClass("search-result").get(0).getElementsByClass("result-list").get(0); |
| | | Elements els = el.getElementsByClass("result"); |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | int count = els.size() >= maxCount ? maxCount : els.size(); |
| | | |
| | | for (int i = 0; i < count; i++) { |
| | | try { |
| | | String url = els.get(i).getElementsByTag("a").get(0) |
| | | .attr("href"); |
| | | //获取豆瓣ID |
| | | SearchResultItem resultItem = parseSearchResultItem(els.get(i)); |
| | | String url = ""; |
| | | |
| | | LogUtil.i(url); |
| | | Document detailDoc = Jsoup |
| | | .connect(url) |
| | |
| | | Element detail = detailDoc.getElementById("content"); |
| | | Element vinfo = detailDoc.getElementById("info"); |
| | | |
| | | String name = detail.getElementsByTag("h1").get(0) |
| | | .getElementsByTag("span").get(0).text(); |
| | | |
| | | String year = ""; |
| | | String picture = detail.getElementById("mainpic") |
| | |
| | | } |
| | | |
| | | VideoInfo info = new VideoInfo(); |
| | | info.setName(name); |
| | | info.setName(resultItem.getName()); |
| | | info.setBeizhu(beizhu); |
| | | info.setDuration(duration); |
| | | info.setIntroduction(introduction); |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | //解析搜索结果子项 |
| | | public static SearchResultItem parseSearchResultItem(Element ele) throws Exception { |
| | | String url = ele.getElementsByTag("a").get(0) |
| | | .attr("href"); |
| | | Map<String, String> params = HttpUtil.getPramsFromUrl(url); |
| | | String subUrl = params.get("url"); |
| | | subUrl = URLDecoder.decode(subUrl, "UTF-8"); |
| | | String[] sts = subUrl.split("/"); |
| | | |
| | | SearchResultItem resultItem = new SearchResultItem(); |
| | | |
| | | String id = null; |
| | | for (String s : sts) { |
| | | if (NumberUtil.isNumeric(s)) { |
| | | id = s; |
| | | break; |
| | | } |
| | | } |
| | | resultItem.setId(id); |
| | | //获取名称 |
| | | String name = ele.getElementsByClass("title").get(0).getElementsByTag("a").text().trim(); |
| | | resultItem.setName(name); |
| | | |
| | | String cast = ele.getElementsByClass("title").get(0).getElementsByClass("subject-cast").get(0).text().trim(); |
| | | //解析年份 |
| | | sts = cast.split("/"); |
| | | String year = null; |
| | | List<String> subCastList = new ArrayList<>(); |
| | | for (String s : sts) { |
| | | s = s.trim(); |
| | | if (NumberUtil.isNumeric(s)) { |
| | | year = s; |
| | | } else { |
| | | if (s.length() > 1) { |
| | | //演职员表代表 |
| | | subCastList.add(s); |
| | | } |
| | | } |
| | | } |
| | | resultItem.setYear(year); |
| | | resultItem.setSubCastList(subCastList); |
| | | return resultItem; |
| | | } |
| | | |
| | | |
| | | public static void saveSearch(String name, String path) throws Exception { |
| | | Document doc = Jsoup |
| | | .connect( |
| | | baseUrl + "q=" |
| | | + URLEncoder.encode(name, "UTF-8")) |
| | | .header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") |
| | | .header("Host", "www.douban.com") |
| | | .header("sec-ch-ua", "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"99\", \"Google Chrome\";v=\"99\"") |
| | | .header("sec-ch-ua-mobile", "?0") |
| | | .header("sec-ch-ua-platform", "\"Windows\"") |
| | | .header("Sec-Fetch-Dest", "document") |
| | | .header("Sec-Fetch-Mode", "navigate") |
| | | .header("Sec-Fetch-Site", "none") |
| | | .header("Sec-Fetch-User", "?1") |
| | | .header("Upgrade-Insecure-Requests", "1") |
| | | .userAgent( |
| | | "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36") |
| | | .timeout(20000).get(); |
| | | Element el = doc.getElementById("content").getElementsByClass("search-result").get(0).getElementsByClass("result-list").get(0); |
| | | String html = el.html(); |
| | | |
| | | byte[] bs = html.getBytes("UTF-8"); |
| | | FileUtil.saveAsFile(new ByteArrayInputStream(bs), path); |
| | | } |
| | | |
| | | |
| | | private static DouBanStar getStarInfo(Element item) { |
| | | DouBanStar star = new DouBanStar(); |
| | |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public static String getDetail(String id) { |
| | | String url = String.format("https://m.douban.com/rexxar/api/v2/tv/%s?ck=&for_mobile=1", id); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Accept", "application/json"); |
| | | headers.put("Referer", String.format("https://m.douban.com/movie/subject/%s/", id)); |
| | | headers.put("sec-ch-ua", "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"99\", \"Google Chrome\";v=\"99\""); |
| | | headers.put("sec-ch-ua-mobile", "?1"); |
| | | headers.put("sec-ch-ua-platform", "Android"); |
| | | headers.put("User-Agent", "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Mobile Safari/537.36"); |
| | | String result = HttpUtil.get(url, new HashMap<>(), headers); |
| | | return result; |
| | | } |
| | | |
| | | public static void saveDetail(String id) throws Exception { |
| | | String result = getDetail(id); |
| | | JSONObject object = JSONObject.fromObject(result); |
| | | result = object.toString(); |
| | | byte[] bs = result.getBytes("UTF-8"); |
| | | FileUtil.saveAsFile(new ByteArrayInputStream(bs), "F:\\豆瓣影视信息\\" + id + ".json"); |
| | | } |
| | | |
| | | //获取电影的影人信息 |
| | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | getMovieStars("26309788"); |
| | | //搜索结果 |
| | | static class SearchResultItem { |
| | | private String id; |
| | | private String name; |
| | | private String year; |
| | | private List<String> subCastList; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getYear() { |
| | | return year; |
| | | } |
| | | |
| | | public void setYear(String year) { |
| | | this.year = year; |
| | | } |
| | | |
| | | public List<String> getSubCastList() { |
| | | return subCastList; |
| | | } |
| | | |
| | | public void setSubCastList(List<String> subCastList) { |
| | | this.subCastList = subCastList; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | |
| | | |
| | | // DouBanUtil.saveSearch("奔跑吧"); |
| | | // String id = "35400242"; |
| | | // try { |
| | | // DouBanUtil.saveDetail(id); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileReader; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.io.*; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public static boolean appendSave(String content, String path) throws IOException { |
| | | File f = new File(path); |
| | | if (!f.exists()) |
| | | f.createNewFile(); |
| | | BufferedWriter out = null; |
| | | try { |
| | | out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(path), true))); |
| | | out.write(content); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (out != null) { |
| | | out.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public static List<FileName> reNameFile(String dir, String path) { |
| | | if (dir.endsWith("/")) |
| | | dir = dir.substring(0, dir.length() - 1); |
| | |
| | | return f.getPath(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import org.hibernate.Session; |
| | | import org.hibernate.SessionFactory; |
| | | import org.hibernate.cfg.Configuration; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | public class HibernateSessionFactory { |
| | | |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import com.show.api.ShowApiRequest; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.BufferedInputStream; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.show.api.ShowApiRequest; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | public class IPUtil { |
| | | // http://verx.daili666.com/ip/?tid=558287898012218&num=1&operator=2 |
| | |
| | | root.put("Extra", extra1); |
| | | root.put("Extra1", extra2); |
| | | root.put("Error", ""); |
| | | // System.out.print(root.toString()); |
| | | System.out.print(root.toString()); |
| | | String st = DESUtil.encode(root.toString()); |
| | | // LogUtil.i(st); |
| | | return st; |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import com.google.gson.Gson; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import javax.persistence.Entity; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Entity |
| | | public class JsonUtilV2 { |
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.RandomAccessFile; |
| | | import java.security.MessageDigest; |
| | |
| | | doInternetSearchVideoUpdateJob(); |
| | | doUpdateResourceVideoJob(); |
| | | } |
| | | // doUpdateResourceVideoJob(); |
| | | } |
| | | |
| | | private void doSolrJob() { |
| | |
| | | new JobThreadExecutorServiceImpl().run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | System.out.println("消费结束:doUpdateResourceVideoJob"); |
| | | List<UpdateResourceVideoMQMsg> msgList = CMQManager.getInstance().consumeUpdateResourceVideoMsg(16); |
| | | System.out.println("消费结束:doUpdateResourceVideoJob"); |
| | | if (msgList != null) |
| | | for (UpdateResourceVideoMQMsg videoMQMsg : msgList) { |
| | | try { |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import com.google.gson.*; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.lang.reflect.Type; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.text.DateFormat; |
| | | import java.util.Collection; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.google.gson.*; |
| | | |
| | | import com.yeshi.buwan.domain.vip.VIPPriceType; |
| | | import sun.misc.BASE64Decoder; |
| | | import sun.misc.BASE64Encoder; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | if (b != null) { |
| | | s = new BASE64Encoder().encode(b); |
| | | s = Base64.getEncoder().encodeToString(b); |
| | | } |
| | | return s; |
| | | } |
| | |
| | | |
| | | String s = null; |
| | | if (b != null) { |
| | | s = new BASE64Encoder().encode(b); |
| | | s = Base64.getEncoder().encodeToString(b); |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | // 解密 |
| | | public static String getFromBase64(String s) { |
| | | byte[] b = null; |
| | | String result = null; |
| | | if (s != null) { |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | byte[] b = Base64.getDecoder().decode(s); |
| | | try { |
| | | b = decoder.decodeBuffer(s); |
| | | result = new String(b, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | public static byte[] getFromBase64Byte(String s) { |
| | | byte[] b = null; |
| | | if (s != null) { |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | try { |
| | | b = decoder.decodeBuffer(s); |
| | | return b; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return null; |
| | | return Base64.getDecoder().decode(s); |
| | | } |
| | | |
| | | public static String getNumberFromString(String st) { |
| | |
| | | } |
| | | if (imgStr == null) // 图像数据为空 |
| | | return false; |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | try { |
| | | // Base64解码 |
| | | byte[] b = decoder.decodeBuffer(imgStr); |
| | | byte[] b = Base64.getDecoder().decode(imgStr); |
| | | for (int i = 0; i < b.length; ++i) { |
| | | if (b[i] < 0) {// 调整异常数据 |
| | | b[i] += 256; |
| | |
| | | out.close(); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.log4j.Logger; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | |
| | | import com.tencent.xinge.ClickAction; |
| | | import com.tencent.xinge.Message; |
| | | import com.tencent.xinge.MessageIOS; |
| | | import com.tencent.xinge.Style; |
| | | import com.tencent.xinge.XingeApp; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import org.apache.log4j.Logger; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class XingePushUtil { |
| | | static Logger log = Logger.getLogger(XingePushUtil.class); |
| | |
| | | package com.yeshi.buwan.util.crawler; |
| | | |
| | | import com.google.gson.Gson; |
| | | import org.jsoup.Connection; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
New file |
| | |
| | | package com.yeshi.buwan.util.factory.vo; |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.domain.video.VideoInfoV2; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoInfoV2Factory |
| | | * @description: 新版视频信息工厂 |
| | | * @date 2022/3/17 10:32 |
| | | */ |
| | | public class VideoInfoV2Factory { |
| | | public static VideoInfoV2 create(VideoInfo video) { |
| | | VideoInfoV2 v2 = new VideoInfoV2(); |
| | | v2.setId(video.getId()); |
| | | v2.setName(video.getName()); |
| | | |
| | | VideoType rootType = getRootVideoType(video.getVideoType()); |
| | | if (rootType != null) { |
| | | v2.setCategory(rootType.getName()); |
| | | } |
| | | v2.setLeafCategorys(null); |
| | | v2.setLeafCategoryIds(getLeafCategoryIds(video.getTypeList())); |
| | | |
| | | List<Long> resourceIds = new ArrayList<>(); |
| | | for (VideoResource r : video.getResourceList()) { |
| | | resourceIds.add(Long.parseLong(r.getId())); |
| | | } |
| | | v2.setResourceIds(resourceIds); |
| | | v2.setActors(getListFromString(video.getMainActor())); |
| | | v2.setDirectors(getListFromString(video.getDirector())); |
| | | //获取发布日期 |
| | | v2.setReleaseDate(getRealaseDate(video)); |
| | | |
| | | v2.setYear(Integer.parseInt(video.getYear())); |
| | | v2.setVpicture(video.getVpicture()); |
| | | v2.setHpicture(video.getHpicture()); |
| | | v2.setShow("1".equalsIgnoreCase(video.getShow()) ? true : false); |
| | | v2.setScore(video.getScore()); |
| | | v2.setTag(video.getTag()); |
| | | |
| | | VideoInfoV2.VideoUpdateInfo updateInfo = new VideoInfoV2.VideoUpdateInfo(); |
| | | updateInfo.setFinish("1".equalsIgnoreCase(video.getFinish()) ? true : false); |
| | | |
| | | v2.setUpdateInfo(updateInfo); |
| | | v2.setCreateTime(new Date(video.getCreatetime())); |
| | | if (video.getUpdatetime() != null) { |
| | | v2.setUpdateTime(new Date(Long.parseLong(video.getUpdatetime()))); |
| | | } |
| | | v2.setAreas(getListFromString(video.getArea())); |
| | | v2.setContentType(video.getContentType()); |
| | | v2.setFeeType(video.getFree()); |
| | | return v2; |
| | | } |
| | | |
| | | private static List<Integer> getLeafCategoryIds(List<VideoType> typeList) { |
| | | List<Integer> tList = new ArrayList<>(); |
| | | if (typeList != null) |
| | | for (VideoType vt : typeList) { |
| | | tList.add(Integer.parseInt(vt.getId() + "")); |
| | | } |
| | | return tList; |
| | | } |
| | | |
| | | private static Date getRealaseDate(VideoInfo video) { |
| | | if (StringUtil.isNullOrEmpty(video.getYear())) { |
| | | return null; |
| | | } |
| | | |
| | | String date = video.getYear(); |
| | | if (StringUtil.isNullOrEmpty(video.getMonth())) { |
| | | date += "-01"; |
| | | } else { |
| | | if (video.getMonth().trim().length() == 1) { |
| | | date += "-0" + video.getMonth(); |
| | | } else { |
| | | date += "-" + video.getMonth(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(video.getDay())) { |
| | | date += "-01"; |
| | | } else { |
| | | if (video.getDay().trim().length() == 1) { |
| | | date += "-0" + video.getDay().trim(); |
| | | } else { |
| | | date += "-" + video.getDay().trim(); |
| | | } |
| | | } |
| | | return new Date(TimeUtil.convertGernalTime(date, "yyyy-MM-dd")); |
| | | } |
| | | |
| | | |
| | | private static VideoType getRootVideoType(VideoType type) { |
| | | if (type == null) { |
| | | return null; |
| | | } |
| | | while (type.getParent() != null) { |
| | | type = type.getParent(); |
| | | } |
| | | return type; |
| | | } |
| | | |
| | | private static List<String> getListFromString(String st) { |
| | | if (StringUtil.isNullOrEmpty(st)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | String[] sts = null; |
| | | if (st.contains(",")) { |
| | | sts = st.split(","); |
| | | } else { |
| | | sts = st.split(" "); |
| | | } |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | if (sts != null && sts.length > 0) { |
| | | for (String s : sts) { |
| | | if (!StringUtil.isNullOrEmpty(s)) { |
| | | list.add(s.trim()); |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.qcloud.cmq.Message; |
| | | import com.yeshi.buwan.dto.mq.*; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.yeshi.utils.CMQUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class CMQManager { |
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25"; |
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo"; |
| | | private static CMQManager cmqManager; |
| | | private static CMQUtil cmqUtil; |
| | | private static TDMQUtil tdmqUtil; |
| | | |
| | | private final static boolean TDMQ_CONSUMER = true; |
| | | |
| | | // 搜索引擎 |
| | | public static String QUEUENAME_SOLR = "buwan-solr-new"; |
| | | //视频更新-爱奇艺2 |
| | |
| | | |
| | | public static String QUEUENAME_UPDATE_RESOURCE_VIDEO = "buwan-video-update-resource-video"; |
| | | |
| | | |
| | | //同步V2版本的视频信息 |
| | | public static String QUEUENAME_VIDEO_SYNCDATA_V2 = "buwan-video-syncdata-v2"; |
| | | |
| | | |
| | | private static String TOPIC_VIDEO_EXTRAINFO = "buwan_topic_video_extrainfo_change"; |
| | | |
| | | //视频信息修改 |
| | | private static String TOPIC_VIDEO_INFO_CHANGE = "buwan_topic_video_info_change"; |
| | | |
| | | |
| | | static { |
| | | cmqUtil = CMQUtil.getInstance(secretId, secretKey); |
| | | |
| | | tdmqUtil = TDMQUtil.getInstance(); |
| | | tdmqUtil.init(secretId, secretKey, true); |
| | | |
| | | |
| | | // 最大消息为1M |
| | | cmqUtil.createQueue(QUEUENAME_SOLR, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_IQIYI_2, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_FUNTV_2, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_PPTV, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_VIDEO_RESOURCE_DELETE, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_UPDATE_VIDEO_EXTRAINFO, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_UPDATE_INTERNET_SEARCH, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_UPDATE_RESOURCE_VIDEO, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_SOLR, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_IQIYI_2, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_FUNTV_2, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_PPTV, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_VIDEO_RESOURCE_DELETE, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_UPDATE_VIDEO_EXTRAINFO, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_UPDATE_INTERNET_SEARCH, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_UPDATE_RESOURCE_VIDEO, 1024 * 1024); |
| | | tdmqUtil.createQueue(QUEUENAME_VIDEO_SYNCDATA_V2, 1024 * 1024); |
| | | |
| | | //创建主题 |
| | | cmqUtil.createTopic(TOPIC_VIDEO_EXTRAINFO); |
| | | tdmqUtil.createTopic(TOPIC_VIDEO_EXTRAINFO); |
| | | tdmqUtil.createTopic(TOPIC_VIDEO_INFO_CHANGE); |
| | | //订阅主题 |
| | | try { |
| | | List<String> filters = new ArrayList<>(); |
| | | filters.add("resource"); |
| | | filters.add("category"); |
| | | cmqUtil.subscribeTopic(TOPIC_VIDEO_EXTRAINFO, StringUtil.Md5(TOPIC_VIDEO_EXTRAINFO + "#" + QUEUENAME_UPDATE_VIDEO_EXTRAINFO), QUEUENAME_UPDATE_VIDEO_EXTRAINFO, filters); |
| | | tdmqUtil.subscribeTopic(TOPIC_VIDEO_EXTRAINFO, "subscribe_" + StringUtil.Md5(TOPIC_VIDEO_EXTRAINFO + "#" + QUEUENAME_UPDATE_VIDEO_EXTRAINFO), QUEUENAME_UPDATE_VIDEO_EXTRAINFO, filters); |
| | | tdmqUtil.subscribeTopic(TOPIC_VIDEO_INFO_CHANGE, "subscribe_" + StringUtil.Md5(TOPIC_VIDEO_INFO_CHANGE + "#" + QUEUENAME_VIDEO_SYNCDATA_V2), QUEUENAME_VIDEO_SYNCDATA_V2); |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | |
| | | |
| | | //添加专辑更新消息 |
| | | public void addIqiyiAlbumUpdateMsg(Long id) { |
| | | cmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_IQIYI_2, id + ""); |
| | | tdmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_IQIYI_2, id + ""); |
| | | } |
| | | |
| | | //消费专辑更新消息 |
| | | public List<IqiyiAlbum2MQMsg> consumeIqiyiAlbumUpdateMsg(int count) { |
| | | List<IqiyiAlbum2MQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_IQIYI_2); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_IQIYI_2) : cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_IQIYI_2); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | IqiyiAlbum2MQMsg mm = new IqiyiAlbum2MQMsg(); |
| | |
| | | |
| | | //删除专辑更新消息 |
| | | public void deleteIqiyiAlbumUpdateMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_IQIYI_2, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_IQIYI_2, handler); |
| | | } |
| | | } |
| | | |
| | | |
| | | //添加专辑更新消息 |
| | | public void addFunTVAlbumUpdateMsg(String id) { |
| | | cmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_FUNTV_2, id); |
| | | tdmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_FUNTV_2, id); |
| | | } |
| | | |
| | | //消费专辑更新消息 |
| | | public List<FunTVAlbum2MQMsg> consumeFunTVAlbumUpdateMsg(int count) { |
| | | List<FunTVAlbum2MQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_FUNTV_2); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_FUNTV_2) : cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_FUNTV_2); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | FunTVAlbum2MQMsg mm = new FunTVAlbum2MQMsg(); |
| | |
| | | |
| | | //删除专辑更新消息 |
| | | public void deleteFunTVAlbumUpdateMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_FUNTV_2, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_FUNTV_2, handler); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | //添加专辑更新消息 |
| | | public void addPPTVSeriesUpdateMsg(PPTVMQMsg msg) { |
| | | cmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_PPTV, new Gson().toJson(msg)); |
| | | tdmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_PPTV, new Gson().toJson(msg)); |
| | | } |
| | | |
| | | //消费专辑更新消息 |
| | | public List<PPTVMQMsg> consumePPTVSeriesUpdateMsg(int count) { |
| | | List<PPTVMQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_PPTV); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_PPTV) : cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_PPTV); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | PPTVMQMsg mm = new Gson().fromJson(msg.msgBody, PPTVMQMsg.class); |
| | |
| | | |
| | | //删除专辑更新消息 |
| | | public void deletePPTVSeriesUpdateMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_PPTV, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_PPTV, handler); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | * @param id |
| | | */ |
| | | public void addSolrMsg(String id) { |
| | | cmqUtil.sendMsg(QUEUENAME_SOLR, id); |
| | | tdmqUtil.sendMsg(QUEUENAME_SOLR, id); |
| | | } |
| | | |
| | | public List<SolrVideoMQMsg> consumeSolrMsg(int count) { |
| | | List<SolrVideoMQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_SOLR); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_SOLR) : cmqUtil.recieveMsg(count, QUEUENAME_SOLR); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | SolrVideoMQMsg mm = new SolrVideoMQMsg(); |
| | |
| | | |
| | | |
| | | public void deleteSolrMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_SOLR, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_SOLR, handler); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | |
| | | public void addVideoResourceDeleteMsg(String videoId) { |
| | | cmqUtil.sendMsg(QUEUENAME_VIDEO_RESOURCE_DELETE, videoId); |
| | | tdmqUtil.sendMsg(QUEUENAME_VIDEO_RESOURCE_DELETE, videoId); |
| | | } |
| | | |
| | | public List<CMQResult> consumeVideoResourceDeleteMsg(int count) { |
| | | List<CMQResult> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_RESOURCE_DELETE); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_VIDEO_RESOURCE_DELETE) : cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_RESOURCE_DELETE); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | CMQResult mm = new CMQResult(); |
| | |
| | | |
| | | |
| | | public void deleteVideoResourceDeleteMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_VIDEO_RESOURCE_DELETE, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_VIDEO_RESOURCE_DELETE, handler); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | public void addVideoExtraInfoChanged(VideoExtraInfoChangeMQMsg msg) { |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(msg.getType()); |
| | | cmqUtil.publishTopicMessage(TOPIC_VIDEO_EXTRAINFO, new Gson().toJson(msg), list); |
| | | tdmqUtil.publishTopicMessage(TOPIC_VIDEO_EXTRAINFO, list, new Gson().toJson(msg)); |
| | | } |
| | | |
| | | |
| | | public List<CMQResult> consumeUpdateVideoExtraInfoMsg(int count) { |
| | | List<CMQResult> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_UPDATE_VIDEO_EXTRAINFO); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_UPDATE_VIDEO_EXTRAINFO) : cmqUtil.recieveMsg(count, QUEUENAME_UPDATE_VIDEO_EXTRAINFO); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | CMQResult mm = new CMQResult(); |
| | |
| | | } |
| | | |
| | | public void deleteUpdateVideoExtraInfoMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_UPDATE_VIDEO_EXTRAINFO, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_UPDATE_VIDEO_EXTRAINFO, handler); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | |
| | | public void addInternetSearchVideoUpdateMsg(InternetSearchVideoMQMsg msg) { |
| | | cmqUtil.sendMsg(QUEUENAME_UPDATE_INTERNET_SEARCH, new Gson().toJson(msg)); |
| | | tdmqUtil.sendMsg(QUEUENAME_UPDATE_INTERNET_SEARCH, new Gson().toJson(msg)); |
| | | } |
| | | |
| | | public List<InternetSearchVideoMQMsg> consumeInternetSearchVideoUpdateMsg(int count) { |
| | | Gson gson = new Gson(); |
| | | List<InternetSearchVideoMQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_UPDATE_INTERNET_SEARCH); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_UPDATE_INTERNET_SEARCH) : cmqUtil.recieveMsg(count, QUEUENAME_UPDATE_INTERNET_SEARCH); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | InternetSearchVideoMQMsg mm = gson.fromJson(msg.msgBody, InternetSearchVideoMQMsg.class); |
| | |
| | | |
| | | |
| | | public void deleteInternetSearchVideoUpdateMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_UPDATE_INTERNET_SEARCH, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_UPDATE_INTERNET_SEARCH, handler); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param msg |
| | | */ |
| | | public void addUpdateResourceVideoMsg(UpdateResourceVideoMQMsg msg) { |
| | | cmqUtil.sendMsg(QUEUENAME_UPDATE_RESOURCE_VIDEO, new Gson().toJson(msg)); |
| | | tdmqUtil.sendMsg(QUEUENAME_UPDATE_RESOURCE_VIDEO, new Gson().toJson(msg)); |
| | | } |
| | | |
| | | public void deleteUpdateResourceVideoMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_UPDATE_RESOURCE_VIDEO, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_UPDATE_RESOURCE_VIDEO, handler); |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<UpdateResourceVideoMQMsg> consumeUpdateResourceVideoMsg(int count) { |
| | | Gson gson = new Gson(); |
| | | List<UpdateResourceVideoMQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_UPDATE_RESOURCE_VIDEO); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_UPDATE_RESOURCE_VIDEO) : cmqUtil.recieveMsg(count, QUEUENAME_UPDATE_RESOURCE_VIDEO); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | try { |
| | | UpdateResourceVideoMQMsg mm = gson.fromJson(msg.msgBody, UpdateResourceVideoMQMsg.class); |
| | | mm.setHandler(msg.receiptHandle); |
| | | list.add(mm); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | JSONObject jsonObject = JSONObject.fromObject(msg.msgBody); |
| | | jsonObject.remove("date"); |
| | | UpdateResourceVideoMQMsg mm = gson.fromJson(jsonObject.toString(), UpdateResourceVideoMQMsg.class); |
| | | mm.setHandler(msg.receiptHandle); |
| | | list.add(mm); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | //视频数据更改 |
| | | public void addVideoDataChanged(VideoDataChangeMQMsg msg) { |
| | | tdmqUtil.publishTopicMessage(TOPIC_VIDEO_INFO_CHANGE, new Gson().toJson(msg)); |
| | | } |
| | | |
| | | |
| | | public Map<String, VideoDataChangeMQMsg> consumeVideoSyncV2DataMsg(int count) { |
| | | Gson gson = new Gson(); |
| | | Map<String, VideoDataChangeMQMsg> map = new HashMap<>(); |
| | | List<Message> msgList = TDMQ_CONSUMER ? tdmqUtil.recieveMsg(count, QUEUENAME_UPDATE_INTERNET_SEARCH) : cmqUtil.recieveMsg(count, QUEUENAME_UPDATE_INTERNET_SEARCH); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | map.put(msg.receiptHandle, gson.fromJson(msg.msgBody, VideoDataChangeMQMsg.class)); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | public void deleteVideoSyncV2DataMsg(String handler) { |
| | | if (TDMQ_CONSUMER) { |
| | | tdmqUtil.deleteMsg(QUEUENAME_VIDEO_SYNCDATA_V2, handler); |
| | | } else { |
| | | cmqUtil.deleteMsg(QUEUENAME_VIDEO_SYNCDATA_V2, handler); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.util.mq; |
| | | |
| | | import com.qcloud.cmq.Account; |
| | | import com.qcloud.cmq.Message; |
| | | import com.tencentcloudapi.common.Credential; |
| | | import com.tencentcloudapi.common.exception.TencentCloudSDKException; |
| | | import com.tencentcloudapi.common.profile.ClientProfile; |
| | | import com.tencentcloudapi.common.profile.HttpProfile; |
| | | import com.tencentcloudapi.tdmq.v20200217.TdmqClient; |
| | | import com.tencentcloudapi.tdmq.v20200217.models.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | //腾讯CMQ消息 |
| | | public class TDMQUtil { |
| | | |
| | | private static TDMQUtil cmqUtil; |
| | | |
| | | public static TDMQUtil getInstance() { |
| | | if (cmqUtil == null) { |
| | | cmqUtil = new TDMQUtil(); |
| | | } |
| | | return cmqUtil; |
| | | } |
| | | |
| | | private String secretId = ""; |
| | | private String secretKey = ""; |
| | | private String region = "ap-guangzhou"; |
| | | // 内网 http://gz.mqadapter.cmq.tencentyun.com |
| | | // 公网 https://cmq-gz.public.tencenttdmq.com |
| | | private static String endpoint = "http://gz.mqadapter.cmq.tencentyun.com"; |
| | | // private static String endpoint = |
| | | // "http://cmq-queue-gz.api.tencentyun.com"; |
| | | |
| | | private Account account; |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 初始化 |
| | | * @date 17:00 2022/3/21 |
| | | * @param: secretId |
| | | * @param: secretKey |
| | | * @param: region 区域,如: ap-guangzhou |
| | | * @param: apiRegion 接口区域,如: gz |
| | | * @param: isPub 是否为公网 |
| | | **/ |
| | | public void init(String secretId, String secretKey, String region, String apiRegion, boolean isPub) { |
| | | this.secretId = secretId; |
| | | this.secretKey = secretKey; |
| | | this.region = region; |
| | | String ep; |
| | | if (isPub) { |
| | | ep = String.format("https://cmq-%s.public.tencenttdmq.com", apiRegion); |
| | | } else { |
| | | ep = String.format("http://%s.mqadapter.cmq.tencentyun.com", apiRegion); |
| | | } |
| | | endpoint = ep; |
| | | account = new Account(endpoint, this.secretId, this.secretKey); |
| | | } |
| | | |
| | | |
| | | public void init(String secretId, String secretKey, boolean isPub) { |
| | | this.secretId = secretId; |
| | | this.secretKey = secretKey; |
| | | String ep; |
| | | if (isPub) { |
| | | ep = String.format("https://cmq-%s.public.tencenttdmq.com", "gz"); |
| | | } else { |
| | | ep = String.format("http://%s.mqadapter.cmq.tencentyun.com", "gz"); |
| | | } |
| | | endpoint = ep; |
| | | account = new Account(endpoint, this.secretId, this.secretKey); |
| | | } |
| | | |
| | | private TdmqClient getClient() { |
| | | return getClient(this.region); |
| | | } |
| | | |
| | | private TdmqClient getClient(String region) { |
| | | Credential cred = new Credential(secretId, secretKey); |
| | | // 实例化一个 http 选项,可选的,没有特殊需求可以跳过 |
| | | HttpProfile httpProfile = new HttpProfile(); |
| | | httpProfile.setEndpoint("tdmq.tencentcloudapi.com"); |
| | | // 实例化一个client选项,可选的,没有特殊需求可以跳过 |
| | | ClientProfile clientProfile = new ClientProfile(); |
| | | clientProfile.setHttpProfile(httpProfile); |
| | | // 实例化要请求产品的 client 对象,clientProfile 是可选的 |
| | | TdmqClient client = new TdmqClient(cred, region, clientProfile); |
| | | return client; |
| | | } |
| | | |
| | | private TdmqClient getMsgClient() { |
| | | return getClient(this.region); |
| | | } |
| | | |
| | | |
| | | public boolean existQueue(String queueName) { |
| | | if (getQueue(queueName) != null) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // 创建队列 |
| | | public boolean createQueue(String queueName) { |
| | | return this.createQueue(queueName, 10L, 5 * 60L, 65536L); |
| | | } |
| | | |
| | | // 创建队列 |
| | | public boolean createQueue(String queueName, int maxMsgSize) { |
| | | return this.createQueue(queueName, 10L, 5 * 60L, maxMsgSize); |
| | | } |
| | | |
| | | /** |
| | | * 指定参数创建队列 |
| | | * |
| | | * @param queueName |
| | | * @param pollingWaitSeconds -长轮训等待时间 |
| | | * @param visibilityTimeout -消息消费后再次可见的时间 |
| | | * @return |
| | | */ |
| | | public boolean createQueue(String queueName, long pollingWaitSeconds, long visibilityTimeout, long maxMsgSize) { |
| | | |
| | | if (existQueue(queueName)) { |
| | | return true; |
| | | } |
| | | CreateCmqQueueRequest request = new CreateCmqQueueRequest(); |
| | | request.setQueueName(queueName); |
| | | request.setPollingWaitSeconds(pollingWaitSeconds); |
| | | request.setVisibilityTimeout(visibilityTimeout); |
| | | request.setMaxMsgSize(maxMsgSize); |
| | | request.setMsgRetentionSeconds(345600L); |
| | | try { |
| | | getClient().CreateCmqQueue(request); |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return false; |
| | | |
| | | |
| | | } |
| | | |
| | | // 删除队列 |
| | | public boolean deleteQueue(String queueName) { |
| | | DeleteCmqQueueRequest request = new DeleteCmqQueueRequest(); |
| | | request.setQueueName(queueName); |
| | | try { |
| | | getClient().DeleteCmqQueue(request); |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // 获取队列列表 |
| | | public List<CmqQueue> getQueueNameList(String key) { |
| | | DescribeCmqQueuesRequest request = new DescribeCmqQueuesRequest(); |
| | | request.setOffset(0L); |
| | | request.setLimit(1000L); |
| | | try { |
| | | DescribeCmqQueuesResponse response = getClient().DescribeCmqQueues(request); |
| | | CmqQueue[] queues = response.getQueueList(); |
| | | return Arrays.asList(queues); |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // 获取队列 |
| | | public CmqQueue getQueue(String queueName) { |
| | | DescribeCmqQueueDetailRequest req = new DescribeCmqQueueDetailRequest(); |
| | | req.setQueueName(queueName); |
| | | // 返回的 resp 是一个 CreateCmqQueueResponse 的实例,与请求对象对应 |
| | | try { |
| | | DescribeCmqQueueDetailResponse resp = getClient().DescribeCmqQueueDetail(req); |
| | | return resp.getQueueDescribe(); |
| | | } catch (TencentCloudSDKException e) { |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | // 发送消息 |
| | | public String sendMsg(String queueName, String msg, long delaySeconds) { |
| | | SendCmqMsgRequest request = new SendCmqMsgRequest(); |
| | | request.setQueueName(queueName); |
| | | request.setMsgContent(msg); |
| | | request.setDelaySeconds(delaySeconds); |
| | | try { |
| | | SendCmqMsgResponse response = getMsgClient().SendCmqMsg(request); |
| | | return response.getMsgId(); |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String sendMsg(String queueName, String msg) { |
| | | return this.sendMsg(queueName, msg, 0L); |
| | | } |
| | | |
| | | |
| | | // 消费消息 |
| | | public Message recieveMsg(String queueName) throws Exception { |
| | | com.qcloud.cmq.Queue queue = account.getQueue(queueName); |
| | | return queue.receiveMessage(); |
| | | } |
| | | |
| | | /** |
| | | * 消费消息 |
| | | * |
| | | * @param count 1-16 |
| | | * @param queueName 队列名字 |
| | | * @return |
| | | */ |
| | | public List<Message> recieveMsg(int count, String queueName) { |
| | | com.qcloud.cmq.Queue queue = account.getQueue(queueName); |
| | | |
| | | if (queue == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Message> msgList = null; |
| | | try { |
| | | msgList = queue.batchReceiveMessage(count); |
| | | return msgList; |
| | | } catch (Exception e) { |
| | | if (e.getMessage() != null && !e.getMessage().contains("no message")) |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // 删除消息 |
| | | public boolean deleteMsg(String queueName, String receiptHandle) { |
| | | try { |
| | | com.qcloud.cmq.Queue queue = account.getQueue(queueName); |
| | | queue.deleteMessage(receiptHandle); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 订阅消息相关 |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 主题名称是否已经存在 |
| | | * |
| | | * @param topicName |
| | | * @return |
| | | */ |
| | | private boolean topicNameExist(String topicName) { |
| | | DescribeCmqTopicDetailRequest req = new DescribeCmqTopicDetailRequest(); |
| | | req.setTopicName(topicName); |
| | | try { |
| | | getClient().DescribeCmqTopicDetail(req); |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建订阅主题 |
| | | * |
| | | * @param topicName-主题名称 |
| | | * @param maxMsgSize-消息最大长度 |
| | | * @param filterType-过滤类型 |
| | | * @return |
| | | */ |
| | | public boolean createTopic(String topicName, Long maxMsgSize, Long filterType) { |
| | | if (topicNameExist(topicName)) { |
| | | return true; |
| | | } |
| | | CreateCmqTopicRequest req = new CreateCmqTopicRequest(); |
| | | if (filterType != null) { |
| | | req.setFilterType(filterType); |
| | | } |
| | | |
| | | if (maxMsgSize != null) { |
| | | req.setMaxMsgSize(maxMsgSize); |
| | | } |
| | | req.setTopicName(topicName); |
| | | try { |
| | | getClient().CreateCmqTopic(req); |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //刪除主題 |
| | | public boolean deleteTopic(String topicName) { |
| | | DeleteCmqTopicRequest req = new DeleteCmqTopicRequest(); |
| | | req.setTopicName(topicName); |
| | | try { |
| | | getClient().DeleteCmqTopic(req); |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 创建默认参数的主题 |
| | | * |
| | | * @param topicName |
| | | * @return |
| | | */ |
| | | public boolean createTopic(String topicName) { |
| | | return createTopic(topicName, null, null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否已经订阅 |
| | | * |
| | | * @param topicName |
| | | * @param subscriptionName |
| | | * @return |
| | | */ |
| | | private boolean isAlreadySubscribe(String topicName, String subscriptionName) { |
| | | DescribeCmqSubscriptionDetailRequest req = new DescribeCmqSubscriptionDetailRequest(); |
| | | req.setSubscriptionName(subscriptionName); |
| | | req.setTopicName(topicName); |
| | | req.setLimit(1L); |
| | | req.setOffset(0L); |
| | | try { |
| | | DescribeCmqSubscriptionDetailResponse response = getClient().DescribeCmqSubscriptionDetail(req); |
| | | if (response.getTotalCount() > 0) |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 订阅主题 |
| | | * |
| | | * @param topicName-主题名称 |
| | | * @param subscriptionName-订阅名称 |
| | | * @param queueName-接受消息的队列名称 |
| | | * @return |
| | | */ |
| | | public boolean subscribeTopic(String topicName, String subscriptionName, String queueName) { |
| | | return subscribeTopic(topicName, subscriptionName, queueName, null); |
| | | } |
| | | |
| | | public boolean subscribeTopic(String topicName, String subscriptionName, String queueName, List<String> filterTags) { |
| | | |
| | | try { |
| | | if (isAlreadySubscribe(topicName, subscriptionName)) { |
| | | return true; |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | CreateCmqSubscribeRequest req = new CreateCmqSubscribeRequest(); |
| | | req.setTopicName(topicName); |
| | | req.setEndpoint(queueName); |
| | | req.setSubscriptionName(subscriptionName); |
| | | req.setProtocol("queue"); |
| | | req.setNotifyContentFormat("SIMPLIFIED"); |
| | | if (filterTags != null && filterTags.size() > 0) { |
| | | String[] tags = new String[filterTags.size()]; |
| | | filterTags.toArray(tags); |
| | | req.setFilterTag(tags); |
| | | } |
| | | try { |
| | | getClient().CreateCmqSubscribe(req); |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除订阅 |
| | | * |
| | | * @param topicName |
| | | * @param subscriptionName |
| | | * @return |
| | | */ |
| | | public boolean deleteSubscribeTopic(String topicName, String subscriptionName) { |
| | | DeleteCmqSubscribeRequest req = new DeleteCmqSubscribeRequest(); |
| | | req.setSubscriptionName(subscriptionName); |
| | | req.setTopicName(topicName); |
| | | try { |
| | | getClient().DeleteCmqSubscribe(req); |
| | | return true; |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 发布订阅消息 |
| | | * |
| | | * @param topicName |
| | | * @param message |
| | | * @return |
| | | */ |
| | | public String publishTopicMessage(String topicName, String message) { |
| | | |
| | | return publishTopicMessage(topicName, null, message); |
| | | } |
| | | |
| | | /** |
| | | * 发布订阅消息 |
| | | * |
| | | * @param topicName |
| | | * @param tagList -标签 |
| | | * @param message |
| | | * @return |
| | | */ |
| | | public String publishTopicMessage(String topicName, List<String> tagList, String message) { |
| | | PublishCmqMsgRequest req = new PublishCmqMsgRequest(); |
| | | req.setMsgContent(message); |
| | | req.setTopicName(topicName); |
| | | if (tagList != null && tagList.size() > 0) { |
| | | String[] tags = new String[tagList.size()]; |
| | | tagList.toArray(tags); |
| | | req.setMsgTag(tags); |
| | | } |
| | | try { |
| | | PublishCmqMsgResponse response = getMsgClient().PublishCmqMsg(req); |
| | | return response.getMsgId(); |
| | | } catch (TencentCloudSDKException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | TDMQUtil.getInstance().init("AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25", "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo", true); |
| | | |
| | | String queueName = "test1"; |
| | | String topicName = "topic_test"; |
| | | |
| | | //创建 |
| | | TDMQUtil.getInstance().createQueue(queueName); |
| | | |
| | | //发送消息 |
| | | TDMQUtil.getInstance().sendMsg(queueName, "测试消息"); |
| | | |
| | | //创建主题 |
| | | TDMQUtil.getInstance().createTopic(topicName); |
| | | |
| | | //创建订阅 |
| | | TDMQUtil.getInstance().subscribeTopic(topicName, topicName + queueName, queueName); |
| | | |
| | | //发送订阅消息 |
| | | TDMQUtil.getInstance().publishTopicMessage(topicName, "主题消息"); |
| | | |
| | | //消费消息 |
| | | try { |
| | | Message message = TDMQUtil.getInstance().recieveMsg(queueName); |
| | | System.out.println("接受到的消息:" + message.msgBody); |
| | | TDMQUtil.getInstance().deleteMsg(queueName, message.receiptHandle); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | List<Message> messages = TDMQUtil.getInstance().recieveMsg(10, queueName); |
| | | for (Message message : messages) { |
| | | System.out.println("批量接受到的消息:" + message.msgBody); |
| | | TDMQUtil.getInstance().deleteMsg(queueName, message.receiptHandle); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | //删除订阅 |
| | | TDMQUtil.getInstance().deleteSubscribeTopic(topicName, topicName + queueName); |
| | | |
| | | //删除主题 |
| | | TDMQUtil.getInstance().deleteTopic(topicName); |
| | | |
| | | //删除队列 |
| | | TDMQUtil.getInstance().deleteQueue(queueName); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.util.rank; |
| | | |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.crawler.JsoupJavasciptUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | |
| | | package com.yeshi.buwan.util.tb; |
| | | |
| | | import com.yeshi.buwan.dto.tb.TaoBaoGoodsBrief; |
| | | import com.yeshi.buwan.dto.tb.TaoKeAppInfo; |
| | | import com.yeshi.buwan.dto.tb.TaoLiJinDTO; |
| | | import com.yeshi.buwan.exception.taobao.TaoKeApiException; |
| | |
| | | import org.yeshi.utils.entity.wx.WXPlaceOrderParams; |
| | | import org.yeshi.utils.wx.WXPayV3Util; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Properties; |
| | |
| | | package com.yeshi.buwan.util.video; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | public class VideoConstant { |
| | | |
| | | |
| | |
| | | package com.yeshi.buwan.util.video; |
| | | |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.exception.video.VideoPlayException; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.videos.acFun.AcFunUtil; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.videos.mogotv.MogoTVUtil; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.exception.video.VideoPlayException; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.imp.juhe.FunTVService; |
| | | import com.yeshi.buwan.service.imp.juhe.IqiyiService; |
| | | import com.yeshi.buwan.service.imp.juhe.SoHuService; |
| | | import com.yeshi.buwan.service.inter.juhe.*; |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.service.manager.search.SolrShortVideoDataManager; |
| | | import com.yeshi.buwan.videos.sohu.SoHuUtil; |
| | | import com.yeshi.buwan.videos.tencent.TencentVideoUtil; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.log.VideoLogFactory; |
| | | import com.yeshi.buwan.videos.acFun.AcFunUtil; |
| | | import com.yeshi.buwan.videos.bilibili.BilibiliUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.videos.mogotv.MogoTVUtil; |
| | | import com.yeshi.buwan.videos.sohu.SoHuUtil; |
| | | import com.yeshi.buwan.videos.tencent.TencentVideoUtil; |
| | | import com.yeshi.buwan.videos.youku.YouKuUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.slf4j.Logger; |
| | |
| | | List<VideoResource> resourList = new ArrayList<VideoResource>(); |
| | | resourList.add(new VideoResource("21")); |
| | | videoInfo.setResourceList(resourList); |
| | | videoInfoService.save(videoInfo); |
| | | videoInfoService.saveWithCategoryAndResource(videoInfo); |
| | | acfunVideoNewService.addAcfunVideoMap(id, Long.parseLong(videoInfo.getId())); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.vo; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: CommonQuery |
| | | * @description: TODO |
| | | * @date 2022/3/22 11:51 |
| | | */ |
| | | public class CommonQuery { |
| | | } |
| | |
| | | package com.yeshi.buwan.vo.tvlive; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.tvlive.TVChannelUtil; |
| | | |
| | | import java.util.Date; |
New file |
| | |
| | | package com.yeshi.buwan.vo.video; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: CommonVideoQuery |
| | | * @description: TODO |
| | | * @date 2022/3/22 14:53 |
| | | */ |
| | | public class CommonVideoSearchQuery { |
| | | private String detailSystemId; |
| | | private String kw; |
| | | |
| | | |
| | | public String getDetailSystemId() { |
| | | return detailSystemId; |
| | | } |
| | | |
| | | public void setDetailSystemId(String detailSystemId) { |
| | | this.detailSystemId = detailSystemId; |
| | | } |
| | | |
| | | public String getKw() { |
| | | return kw; |
| | | } |
| | | |
| | | public void setKw(String kw) { |
| | | this.kw = kw; |
| | | } |
| | | } |
| | |
| | | <dubbo:parameter key="qos.port" value="33333"></dubbo:parameter> |
| | | </dubbo:application> |
| | | |
| | | <!--<dubbo:registry address="zookeeper://172.16.16.46:2181"/>--> |
| | | <dubbo:registry address="zookeeper://172.16.16.46:2181"/> |
| | | |
| | | <dubbo:registry address="zookeeper://193.112.35.168:2182"/> |
| | | <!--<dubbo:registry address="zookeeper://193.112.35.168:2182"/>--> |
| | | |
| | | <dubbo:annotation package="com"/> |
| | | |
| | |
| | | <mapping resource="domain/Advice.hbm.xml"/> |
| | | <mapping resource="domain/Collection.hbm.xml"/> |
| | | <mapping resource="domain/system/DetailSystemConfig.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreCollect.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreOpen.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreRule.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreSaveVideo.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreShare.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreWatch.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreContinueWatch.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreEvaluate.hbm.xml"/> |
| | | <mapping resource="domain/GetScoreHistory.hbm.xml"/> |
| | | <mapping resource="domain/HomeAd.hbm.xml"/> |
| | | <mapping resource="domain/HomeType.hbm.xml"/> |
| | | <mapping resource="domain/HomeVideo.hbm.xml"/> |
| | | <mapping resource="domain/HotSearch.hbm.xml"/> |
| | | <mapping resource="domain/HotStar.hbm.xml"/> |
| | | <mapping resource="domain/HotStarVideo.hbm.xml"/> |
| | | <mapping resource="domain/SearchHistory.hbm.xml"/> |
| | | <mapping resource="domain/ScoreHistory.hbm.xml"/> |
| | | <mapping resource="domain/system/SystemInfo.hbm.xml"/> |
| | |
| | | <mapping resource="domain/WXStatistics.hbm.xml"/> |
| | | <mapping resource="domain/ShareContent.hbm.xml"/> |
| | | <mapping resource="domain/system/DetailSystem.hbm.xml"/> |
| | | <mapping resource="domain/VideoPlayError.hbm.xml"/> |
| | | <mapping resource="domain/DeviceInfo.hbm.xml"/> |
| | | <mapping resource="domain/HomeNotice.hbm.xml"/> |
| | | <mapping resource="domain/WeiXinInfo.hbm.xml"/> |
| | | <mapping resource="domain/WeiXinImage.hbm.xml"/> |
| | | <mapping resource="domain/ImageInfo.hbm.xml"/> |
| | | <mapping resource="domain/KKInstall.hbm.xml"/> |
| | | <mapping resource="domain/HotVideoType.hbm.xml"/> |
| | | <mapping resource="domain/VideoTypeStatistics.hbm.xml"/> |
| | | <mapping resource="domain/VideoIntersection.hbm.xml"/> |
| | |
| | | <mapping resource="domain/YSDQVideoUrl.hbm.xml"/> |
| | | <mapping resource="domain/ad/YouDaoStatistics.hbm.xml"/> |
| | | <mapping resource="domain/BiliBiliUrlId.hbm.xml"/> |
| | | <mapping resource="domain/Contact.hbm.xml"/> |
| | | <mapping resource="domain/YouKuVideoUrl.hbm.xml"/> |
| | | <mapping resource="domain/AdRecommendRight.hbm.xml"/> |
| | | <mapping resource="domain/VideoPlayStatistics.hbm.xml"/> |
| | |
| | | <mapping resource="domain/video/zhibo/ZhiBoStatistics.hbm.xml"/> |
| | | <mapping resource="domain/video/zhibo/LiveType.hbm.xml"/> |
| | | |
| | | |
| | | <!-- 下载 --> |
| | | <mapping resource="domain/DownLoadVideoInfo.hbm.xml"/> |
| | | <mapping resource="domain/DownLoadVersionVideo.hbm.xml"/> |
| | | <mapping resource="domain/DownLoadUserInfo.hbm.xml"/> |
| | | <mapping resource="domain/DownLoadCollect.hbm.xml"/> |
| | | <mapping resource="domain/DownLoadVideoType.hbm.xml"/> |
| | | <mapping resource="domain/DownLoadTypeVideo.hbm.xml"/> |
| | | <mapping resource="domain/DownLoadVideoUrl.hbm.xml"/> |
| | | |
| | | <mapping resource="domain/ResourceVideo.hbm.xml"/> |
| | | <mapping resource="domain/CategoryVideo.hbm.xml"/> |
| | |
| | | <url></url> |
| | | </secondNav> |
| | | |
| | | |
| | | <secondNav url="video_resource_info_map_list.html" name="视频来源信息"> |
| | | <!-- 网页链接 --> |
| | | <url></url> |
| | | </secondNav> |
| | | |
| | | |
| | | |
| | | </topNav> |
| | | |
| | | <topNav url="vip-user-list.html" name="用户"> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>新增视频资源信息映射</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="./css/font.css"> |
| | | <link rel="stylesheet" href="./css/xadmin.css"> |
| | | <script type="text/javascript" src="./layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="./js/xadmin.js"></script> |
| | | <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!-- 让IE8/9支持媒体查询,从而兼容栅格 --> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <![endif]--> |
| | | </head> |
| | | <body> |
| | | <div class="layui-fluid"> |
| | | <div class="layui-row"> |
| | | <form class="layui-form" lay-filter="add"> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 选择系统</label> |
| | | <div class="layui-input-block"> |
| | | <select class="layui-input" name="detailSystemId" required></select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 选择资源</label> |
| | | <div class="layui-input-block"> |
| | | <select class="layui-input" name="resourceId" required></select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 资源名称</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 图标</label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" type="text" name="icon" placeholder="请输入图片链接"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_remarks" class="layui-form-label"></label> |
| | | <button class="layui-btn" lay-filter="add" lay-submit="">确定</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | //初始化上传控件 |
| | | var uploadTool = { |
| | | callback: null, |
| | | chooseImage: {}, |
| | | uploadArray: new Array(), |
| | | init: function (upload) { |
| | | this.uploadArray = new Array(); |
| | | this.uploadArray.push(upload.render({ |
| | | elem: '#upload_icon', //绑定元素 |
| | | url: '', //上传接口 |
| | | auto: false, |
| | | accept: 'images', |
| | | acceptMime: 'image/*', |
| | | field: "file_icon", |
| | | choose: function (obj) { |
| | | //将每次选择的文件追加到文件队列 |
| | | var files = obj.pushFile(); |
| | | //预读本地文件,如果是多文件,则会遍历。(不支持ie8/9) |
| | | obj.preview(function (index, file, result) { |
| | | console.log(index); //得到文件索引 |
| | | console.log(file); //得到文件对象 |
| | | console.log(result); //得到文件base64编码,比如图片 |
| | | $("#img_icon").attr("src", result); |
| | | //记录选中的文件 |
| | | uploadTool.chooseImage["icon"] = "1"; |
| | | }); |
| | | }, |
| | | before: function (obj) { |
| | | layer.load(); |
| | | }, |
| | | done: function (res, index, upload) { |
| | | layer.closeAll('loading'); //关闭loading |
| | | //上传完毕后删除 |
| | | if (res.code == 0) { |
| | | //获取链接 |
| | | $("input[name='icon']").val(res.data.url); |
| | | delete chooseImage["icon"]; |
| | | if (Object.keys(chooseImage).length == 0) { |
| | | //全部上传成功 |
| | | callback(); |
| | | } |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, |
| | | error: function (index, upload) { |
| | | layer.msg("图标上传出错"); |
| | | layer.closeAll('loading'); //关闭loading |
| | | } |
| | | })); |
| | | |
| | | }, |
| | | upload: function (result) { |
| | | if (this.uploadArray.length > 0) { |
| | | this.callback = result; |
| | | //同时上传 |
| | | for (var i = 0; i < this.uploadArray.length; i++) { |
| | | this.uploadArray[i].upload(); |
| | | } |
| | | } else { |
| | | result(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'layer', 'jquery', 'upload'], function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | upload = layui.upload; |
| | | |
| | | var verify = {}; |
| | | //自定义验证规则 |
| | | form.verify(verify); |
| | | |
| | | //渲染上传控件 |
| | | uploadTool.init(upload); |
| | | |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //转换json对象 |
| | | for (key in data.field) { |
| | | if (key.indexOf(".") > -1) { |
| | | var value = data.field[key]; |
| | | delete data.field[key]; |
| | | var onkeys = key.split("."); |
| | | //创建对象 |
| | | if (data.field[onkeys[0]] == undefined) { |
| | | data.field[onkeys[0]] = {}; |
| | | } |
| | | data.field[onkeys[0]][onkeys[1]] = value; |
| | | } |
| | | } |
| | | // uploadTool.upload(function () { |
| | | //发异步,把数据提交给php |
| | | ysdqapp.post('api/video/video_resource_info_map/add', data.field, function (res) { |
| | | if (res.code == 0) { |
| | | layer.alert("增加成功", { |
| | | icon: 6 |
| | | }, |
| | | function () { |
| | | //关闭当前frame |
| | | xadmin.close(); |
| | | // 可以对父窗口进行刷新 |
| | | // xadmin.father_reload(); |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | // }); |
| | | return false; |
| | | }); |
| | | //请求select的数据API |
| | | |
| | | |
| | | $.post('api/common/resourceList', {}, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=resourceId]").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | var html = "<option value='" + res.data[i].id + "'>"; |
| | | html += res.data[i].name + "</option>"; |
| | | $("select[name=resourceId]").append(html); |
| | | } |
| | | //重新渲染表单 |
| | | form.render(); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, 'json'); |
| | | |
| | | $.post('api/common/detailsystemlist', {}, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=detailSystemId]").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | var html = "<option value='" + res.data[i].id + "'>"; |
| | | html += res.data[i].name + "</option>"; |
| | | $("select[name=detailSystemId]").append(html); |
| | | } |
| | | //重新渲染表单 |
| | | form.render(); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, 'json'); |
| | | |
| | | }) |
| | | ; |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>视频资源信息映射列表</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | |
| | | <link href="css/bootstrap.min.css" rel="stylesheet"> |
| | | <link href="css/maincontent.css" rel="stylesheet"> |
| | | |
| | | <link rel="stylesheet" href="./css/font.css"> |
| | | <link rel="stylesheet" href="./css/xadmin.css"> |
| | | <script src="layui/layui.js" charset="utf-8"></script> |
| | | <link rel="stylesheet" href="./css/theme3049.min.css"> |
| | | <script src="./js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="./js/xadmin.js"></script> |
| | | <script src="./js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | |
| | | |
| | | <![endif]--> |
| | | <script src="./js/utils.js"></script> |
| | | </head> |
| | | |
| | | <body> |
| | | |
| | | <nav class="navbar navbar-default navbar-fixed-top"> |
| | | |
| | | </nav> |
| | | <div id="mainbody"> |
| | | <div id="sidebar"> |
| | | |
| | | </div> |
| | | <div id="neirong"> |
| | | <div class="x-nav"> |
| | | <span class="layui-breadcrumb"> |
| | | <a href="">###</a> |
| | | <a> |
| | | <cite>###</cite></a> |
| | | </span> |
| | | <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" |
| | | onclick="location.reload()" title="刷新"> |
| | | <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i> |
| | | </a> |
| | | </div> |
| | | <div class="layui-fluid" id="app"> |
| | | <div class="layui-row layui-col-space15"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <form class="layui-form layui-col-space5"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <select name="detailSystemId" lay-verify="required"> |
| | | </select></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="key" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button id="search" class="layui-btn" lay-submit="" lay-filter="search"> |
| | | <i class="layui-icon"></i></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | <div class="layui-card-body "> |
| | | <table class="layui-table" id="table_list" lay-filter="app"> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </body> |
| | | <script src="js/nav.js"></script> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn" onclick="xadmin.open('添加视频资源信息映射','video_resource_info_map_add.html',500,580)"><i |
| | | class="layui-icon"></i>添加 |
| | | </button> |
| | | <button class="layui-btn layui-btn-danger" lay-event="delete"> |
| | | <i class="layui-icon"></i> |
| | | 删除 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="optContainer"> |
| | | <div class="layui-btn-container"> |
| | | <a title="修改" onclick="xadmin.open('修改视频资源信息映射','video_resource_info_map_update.html?id={{d.id}}',500,580)" |
| | | href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | <a title="删除" onclick="member_del(this,{{d.LAY_INDEX }},'{{d.id}}')" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="statusContainer"> |
| | | <div class="layui-btn-container"> |
| | | {{# if(d.status==0){ }} |
| | | <span class="layui-btn layui-btn-mini"> |
| | | 正常 |
| | | </span> |
| | | {{# }else{ }} |
| | | <span class="layui-btn layui-btn-danger layui-btn-mini"> |
| | | 已删除 |
| | | </span> |
| | | {{# } }} |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <!-- 这里的checked的状态只是演示 --> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id== |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="imgshow"> |
| | | <!-- 这里的checked的状态只是演示 --> |
| | | <img src="{{d.}}"/> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id== |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.delete(obj, index, id); |
| | | }); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | var app = null; |
| | | $(function () { |
| | | app = new Vue({ |
| | | el: "#app", |
| | | data: { |
| | | key: '', |
| | | start: '', |
| | | end: '', |
| | | appList: [] |
| | | }, |
| | | watch: {}, |
| | | created: function () { |
| | | |
| | | }, |
| | | methods: { |
| | | init: function () { |
| | | //初始化 |
| | | layui.use(['laydate', 'form', 'table'], function () { |
| | | var laydate = layui.laydate, |
| | | form = layui.form, |
| | | table = layui.table; |
| | | //渲染日期输入框 |
| | | //搜索条件 |
| | | form.on('submit(search)', function (data) { |
| | | app.search(data.field); |
| | | return false; |
| | | }); |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#table_list', |
| | | url: "api/video/video_resource_info_map/list", |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [[{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 120, sort: false, title: "ID"}, |
| | | { |
| | | field: 'resource', width: 120, sort: false, title: "资源", templet: function (res) { |
| | | return res.resource.name; |
| | | } |
| | | }, |
| | | {field: 'name', width: 120, sort: false, title: "资源名称"}, |
| | | { |
| | | field: 'icon', width: 120, sort: false, title: "图标", templet: function (res) { |
| | | return "<img src='" + res.icon + "' style='height:25px;'>"; |
| | | } |
| | | }, |
| | | {fixed: 'right', width: 80, title: "操作", toolbar: '#optContainer'}]], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | if (res.code != 0) |
| | | return; |
| | | if (res.data.list == null) |
| | | return; |
| | | console.log(res.data.list) |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.count, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | }, |
| | | error: function (e, msg) { |
| | | // ksapp.tableError(e) |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | table.on('toolbar(app)', |
| | | function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch (obj.event) { |
| | | case 'delete': |
| | | var data = checkStatus.data; |
| | | if (data == null || data.length == 0) { |
| | | layer.msg("未选择选项"); |
| | | return; |
| | | } |
| | | var ids = new Array(); |
| | | for (var i = 0; i < data.length; i++) |
| | | ids.push(data[i].id); |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.deleteList(ids, function () { |
| | | layer.msg("删除成功"); |
| | | $("form").submit(); |
| | | }); |
| | | }); |
| | | |
| | | break; |
| | | } |
| | | ; |
| | | }); |
| | | //请求搜索表单中需要的数据 |
| | | |
| | | var requestCount = 0; |
| | | requestCount++; |
| | | var params = {}; |
| | | |
| | | $.post('api/common/detailsystemlist', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=detailSystemId]").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | var html = "<option value='" + res.data[i].id + "'>"; |
| | | html += res.data[i].name + "</option>"; |
| | | $("select[name=detailSystemId]").append(html); |
| | | } |
| | | //重新渲染表单 |
| | | form.render(); |
| | | |
| | | requestCount--; |
| | | if (requestCount <= 0) { |
| | | //搜索 |
| | | $('#search').trigger("click"); |
| | | } |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, 'json'); |
| | | }); |
| | | |
| | | }, |
| | | delete: function (obj, index, id) { |
| | | var ids = new Array(); |
| | | ids.push(id); |
| | | app.deleteList(ids, function () { |
| | | $(obj).parents("tr").remove(); |
| | | layer.msg('已删除!', {icon: 1, time: 1000}); |
| | | }); |
| | | }, |
| | | deleteList: function (ids, success) { |
| | | ysdqapp.post("api/video/video_resource_info_map/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | search: function (params) { |
| | | //数据重载 |
| | | tableIns.reload({ |
| | | where: params, |
| | | page: { |
| | | curr: 1 //重新从第 1 页开始 |
| | | } |
| | | }); |
| | | }, |
| | | } |
| | | }); |
| | | app.init(); |
| | | }); |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | </script> |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>修改视频资源信息映射</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="./css/font.css"> |
| | | <link rel="stylesheet" href="./css/xadmin.css"> |
| | | <script type="text/javascript" src="./layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="./js/xadmin.js"></script> |
| | | <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!-- 让IE8/9支持媒体查询,从而兼容栅格 --> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <![endif]--> |
| | | </head> |
| | | <body> |
| | | <div class="layui-fluid"> |
| | | <div class="layui-row"> |
| | | <form class="layui-form" lay-filter="update"> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 资源</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="resource_name" lay-verify="" placeholder="" readonly="readonly" disabled autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 资源名称</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 图标</label> |
| | | <div class="layui-input-block"> |
| | | <img src=""> |
| | | |
| | | <img src="" /> |
| | | |
| | | <input class="layui-input" type="text" name="icon" placeholder="请输入图片链接"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_remarks" class="layui-form-label"></label> |
| | | <button class="layui-btn" lay-filter="update" lay-submit="">确定修改</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | //初始化上传控件 |
| | | var uploadTool = { |
| | | callback: null, |
| | | chooseImage: {}, |
| | | uploadArray: new Array(), |
| | | init: function (upload) { |
| | | this.uploadArray = new Array(); |
| | | this.uploadArray.push(upload.render({ |
| | | elem: '#upload_icon', //绑定元素 |
| | | url: '', //上传接口 |
| | | auto: false, |
| | | accept: 'images', |
| | | acceptMime: 'image/*', |
| | | field: "file_icon", |
| | | choose: function (obj) { |
| | | //将每次选择的文件追加到文件队列 |
| | | var files = obj.pushFile(); |
| | | //预读本地文件,如果是多文件,则会遍历。(不支持ie8/9) |
| | | obj.preview(function (index, file, result) { |
| | | console.log(index); //得到文件索引 |
| | | console.log(file); //得到文件对象 |
| | | console.log(result); //得到文件base64编码,比如图片 |
| | | $("#img_icon").attr("src", result); |
| | | //记录选中的文件 |
| | | uploadTool.chooseImage["icon"] = "1"; |
| | | }); |
| | | }, |
| | | before: function (obj) { |
| | | layer.load(); |
| | | }, |
| | | done: function (res, index, upload) { |
| | | layer.closeAll('loading'); //关闭loading |
| | | //上传完毕后删除 |
| | | if (res.code == 0) { |
| | | //获取链接 |
| | | $("input[name='icon']").val(res.data.url); |
| | | delete chooseImage["icon"]; |
| | | if (Object.keys(chooseImage).length == 0) { |
| | | //全部上传成功 |
| | | callback(); |
| | | } |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, |
| | | error: function (index, upload) { |
| | | layer.msg("图标上传出错"); |
| | | layer.closeAll('loading'); //关闭loading |
| | | } |
| | | })); |
| | | |
| | | }, |
| | | upload: function (result) { |
| | | if (this.uploadArray.length > 0) { |
| | | this.callback = result; |
| | | //同时上传 |
| | | for (var i = 0; i < this.uploadArray.length; i++) { |
| | | this.uploadArray[i].upload(); |
| | | } |
| | | } else { |
| | | result(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | //填充数据 |
| | | function fillData(form) { |
| | | var id = ysdqapp.getQueryParam("id"); |
| | | if (id) { |
| | | } else { |
| | | layer.msg("id为空"); |
| | | return; |
| | | } |
| | | |
| | | ysdqapp.post('api/video/video_resource_info_map/get', {id: id}, function (res) { |
| | | if (res.code == 0) { |
| | | var data=res.data; |
| | | data["resource_name"]=data["resource"]["name"]; |
| | | form.val("update", data); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, function (res) { |
| | | layer.msg("详情获取失败"); |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'layer', 'jquery', 'upload'], function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | upload = layui.upload; |
| | | |
| | | var verify = {}; |
| | | //自定义验证规则 |
| | | form.verify(verify); |
| | | |
| | | //渲染上传控件 |
| | | uploadTool.init(upload); |
| | | |
| | | //填充表单数据 |
| | | //请求数据 |
| | | //form.data(); |
| | | |
| | | |
| | | //监听提交 |
| | | form.on('submit(update)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //转换json对象 |
| | | for (key in data.field) { |
| | | if (key.indexOf(".") > -1) { |
| | | var value = data.field[key]; |
| | | delete data.field[key]; |
| | | var onkeys = key.split("."); |
| | | //创建对象 |
| | | if (data.field[onkeys[0]] == undefined) { |
| | | data.field[onkeys[0]] = {}; |
| | | } |
| | | data.field[onkeys[0]][onkeys[1]] = value; |
| | | } |
| | | } |
| | | // uploadTool.upload(function () { |
| | | //发异步,把数据提交给php |
| | | var params = data.field; |
| | | params.id = ysdqapp.getQueryParam("id"); |
| | | |
| | | ysdqapp.post('api/video/video_resource_info_map/update', data.field, function (res) { |
| | | if (res.code == 0) { |
| | | layer.alert("修改成功", { |
| | | icon: 6 |
| | | }, |
| | | function () { |
| | | //关闭当前frame |
| | | xadmin.close(); |
| | | // 可以对父窗口进行刷新 |
| | | // xadmin.father_reload(); |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (e) { |
| | | layer.msg("更新出错"); |
| | | }); |
| | | // }); |
| | | return false; |
| | | }); |
| | | //请求select的数据API |
| | | |
| | | fillData(form) |
| | | }) |
| | | ; |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.util.BaiDuCPUUtil; |
| | | import com.yeshi.buwan.vo.baidu.BaiDuCPUTypeVO; |
| | | import org.junit.Test; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.buwan.job.video.VideoUpdateJob; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.junit.Test; |
| | |
| | | @Resource |
| | | public ClearService clearService; |
| | | |
| | | @Test |
| | | public void main() { |
| | | // ClearService clearService = BeanUtil.getBean(ClearService.class); |
| | | // for (int i = 0; i < 1000; i++) { |
| | | // clearService.clearDependVideo(); |
| | | // } |
| | | @Resource |
| | | private VideoUpdateJob videoUpdateJob; |
| | | |
| | | for (int i = 0; i < 300; i++) { |
| | | long[] typeIds = new long[]{299, 242, 216, 249, 290, 219}; |
| | | for (long id : typeIds) { |
| | | clearService.clearVideos(new long[]{id}, "2021-02-01"); |
| | | } |
| | | } |
| | | // } |
| | | @Test |
| | | public void main() throws Exception { |
| | | videoUpdateJob.deleteOutOfDateVideo(null); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.dao.system.DetailSystemConfigDao; |
| | | import com.yeshi.buwan.dao.system.SystemConfigDao; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.domain.system.SystemConfig; |
| | | import com.yeshi.buwan.dto.order.PPTVVideoPrice; |
| | | import com.yeshi.buwan.job.AdJob; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.rank.IqiyiRankUtil; |
| | | import com.yeshi.buwan.vo.ad.BannerVO; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.util.Date; |
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.util.HashSet; |
| | | import java.util.Scanner; |
| | | import java.util.Set; |
| | |
| | | public class DES { |
| | | @org.junit.Test |
| | | public void test1() { |
| | | String st = "iDp+mknN2uptRUo51EW28wcdP2q0yp6iFgzTe1sLzcs/jyg32plI0rWA5ixujhGdNWb8QJY1JUs="; |
| | | String st = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsBhPMkixAysNg2DZ9i+GKm9I3ghM2n+Hblt8frlqOqy9WyuKBJYan9rKU+dY8dpyINl7NT9ZM1/sxUOpCZYRqewXfO7csXUtRja5PaHCXBO7b23mdwY/YezI51deZjbGSpvsNYeP9NYzDdczVBQ/c+8RaWISN1JmYGDyjYWbVWGXWg5hmpP5SNInhiaI0ikbbwnV+FizRDqHeD7/iIMWZS9+TLwc7epMdQgHX0QaW7T0EDhwclOKBDqEuKWyM/dm+4BboAHZPUDIv3L/9Fk/jhV5dpHVj52qvBDGqW/co3cutnscZRcj74tVcSr4TzqG/"; |
| | | System.out.println(DESUtil.decode(st)); |
| | | } |
| | | |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.user.LoginUserExtra; |
| | | import org.junit.Test; |
| | | import org.yeshi.utils.generater.SpringComponentGenerater; |
| | | import org.yeshi.utils.generater.entity.MongoDBDaoData; |
| | | |
| | | public class DaoTest { |
| | | |
| | | @Test |
| | | public void createDao() { |
| | | |
| | | try { |
| | | SpringComponentGenerater.createMongoDao(new MongoDBDaoData.Builder().setBaseDaoClass(MongodbBaseDao.class).setDaoPackageName("com.yeshi.buwan.dao.user").setEntityClass(LoginUserExtra.class).create(),"D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\dao\\user"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.util.email.MailSenderUtil; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | | |
| | | public class EmailTest { |
| | | |
| | | @org.junit.Test |
| | | public void test() { |
| | | for (int i = 0; i < 1; i++) { |
| | | boolean isS = MailSenderUtil.sendEmail("1101184511@qq.com", "app_yzm_zc@163.com", "KZKSRTEMDWEQRAQR", |
| | | "布丸社区注册验证码:" + 123, "布丸社区注册验证码:" + 123); |
| | | EmailInfo emailInfo = new EmailInfo(); |
| | | emailInfo.setToEmail("1101184511@qq.com"); |
| | | emailInfo.setTitle("布丸社区注册验证码:" + 123); |
| | | emailInfo.setFromEmail("app_yzm_zc@163.com"); |
| | | emailInfo.setFormEmailPwd("KZKSRTEMDWEQRAQR"); |
| | | emailInfo.setContent("布丸社区注册验证码:" + 123); |
| | | emailInfo.setApp("影视"); |
| | | |
| | | try { |
| | | EmailApiUtil.sendEmail(emailInfo); |
| | | } catch (MailSendException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.dao.live.TVLiveProgramResourceDao; |
| | | import com.yeshi.buwan.dao.video.VideoResourceVersionMapDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveProgramResource; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.domain.video.StarInfo; |
| | | import com.yeshi.buwan.domain.video.VideoResourceVersionMap; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; |
| | | import com.yeshi.buwan.dao.video.VideoResourceInfoMapDao; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.recommend.HomeTypeV2; |
| | | import com.yeshi.buwan.domain.recommend.HomeVideoV2; |
| | | import com.yeshi.buwan.domain.video.VideoInfoV2; |
| | | import com.yeshi.buwan.domain.video.VideoResourceInfoMap; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceInfoMapService; |
| | | import com.yeshi.buwan.vo.CommonQuery; |
| | | import org.junit.Test; |
| | | import org.yeshi.utils.generater.SpringComponentGenerater; |
| | | import org.yeshi.utils.generater.entity.MongoDBDaoData; |
| | | import org.yeshi.utils.generater.entity.ServiceData; |
| | | |
| | | import java.io.File; |
| | | import org.yeshi.utils.generater.GeneraterManager; |
| | | import org.yeshi.utils.generater.entity.ClassInfo; |
| | | |
| | | public class GeneralTest { |
| | | |
| | | private String packageBaseName = "com.yeshi.buwan"; |
| | | private Class mongoBaseDao = MongodbBaseDao.class; |
| | | private String PROJECT_PATH = "D:\\workspace\\BuWan"; |
| | | @Test |
| | | public void createVideoInfoV2() { |
| | | GeneraterManager.getInstance().init("D:\\workspace\\BuWan\\src\\main\\java", VideoInfoV2.class); |
| | | try { |
| | | GeneraterManager.getInstance().createDao("com.yeshi.buwan.dao.video"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void generalMongoDaoAndService() throws ClassNotFoundException { |
| | | /************可更改区域开始*************/ |
| | | Class entityClass = StarInfo.class; |
| | | //dao的相对包名 |
| | | String daoRelativePackageName = "dao.video"; |
| | | String serviceRelativePackageName = "service.inter.video"; |
| | | String serviceImplRelativePackageName = "service.imp.video"; |
| | | /************可更改区结束*************/ |
| | | |
| | | |
| | | String daoPackageName = packageBaseName + "." + daoRelativePackageName; |
| | | String daoClassName = daoPackageName + "." + entityClass.getSimpleName() + "Dao"; |
| | | |
| | | //生成dao |
| | | MongoDBDaoData.Builder daoBuilder = new MongoDBDaoData.Builder(); |
| | | daoBuilder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(daoPackageName); |
| | | daoBuilder.setEntityClass(entityClass); |
| | | public void createHomeTypeV2() { |
| | | GeneraterManager.getInstance().init("D:\\workspace\\BuWan\\src\\main\\java", HomeTypeV2.class); |
| | | try { |
| | | String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + daoPackageName.replace(".", "\\") + "\\"; |
| | | if (!new File(targetDir).exists()) |
| | | new File(targetDir).mkdirs(); |
| | | SpringComponentGenerater.createMongoDao(daoBuilder.create(), targetDir); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //生成服务接口 |
| | | String servicePackageName = packageBaseName + "." + serviceRelativePackageName; |
| | | String serviceClassName = servicePackageName + "." + entityClass.getSimpleName() + "Service"; |
| | | ServiceData.Builder builder = new ServiceData.Builder(); |
| | | builder.setPackageName(servicePackageName); |
| | | builder.setDaoClass(Class.forName(daoClassName)); |
| | | builder.setEntityClass(entityClass); |
| | | try { |
| | | String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + servicePackageName.replace(".", "\\") + "\\"; |
| | | if (!new File(targetDir).exists()) |
| | | new File(targetDir).mkdirs(); |
| | | SpringComponentGenerater.createService(builder.build(), targetDir); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //生成服务实现接口 |
| | | String serviceImplPackageName = packageBaseName + "." + serviceImplRelativePackageName; |
| | | builder = new ServiceData.Builder(); |
| | | builder.setPackageName(serviceImplPackageName).setServiceClass(Class.forName(serviceClassName)).setDaoClass(Class.forName(daoClassName)).setEntityClass(entityClass); |
| | | |
| | | try { |
| | | String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + serviceImplPackageName.replace(".", "\\") + "\\"; |
| | | if (!new File(targetDir).exists()) |
| | | new File(targetDir).mkdirs(); |
| | | SpringComponentGenerater.createServiceImpl(builder.build(), targetDir); |
| | | GeneraterManager.getInstance().createDao("com.yeshi.buwan.dao.recommend"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @org.junit.Test |
| | | public void createDao() { |
| | | MongoDBDaoData.Builder builder = new MongoDBDaoData.Builder(); |
| | | builder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(packageBaseName + ".dao.user"); |
| | | builder.setEntityClass(UserDPContentWatchStatistic.class); |
| | | @Test |
| | | public void createHomeVideoV2() { |
| | | GeneraterManager.getInstance().init("D:\\workspace\\BuWan\\src\\main\\java", HomeVideoV2.class); |
| | | try { |
| | | SpringComponentGenerater.createMongoDao(builder.create(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\dao\\user\\"); |
| | | GeneraterManager.getInstance().createDao("com.yeshi.buwan.dao.recommend"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // |
| | | @org.junit.Test |
| | | public void createService() { |
| | | ServiceData.Builder builder = new ServiceData.Builder(); |
| | | builder.setPackageName(packageBaseName + ".service.inter.live"); |
| | | builder.setDaoClass(TVLiveProgramResourceDao.class); |
| | | builder.setEntityClass(TVLiveProgramResource.class); |
| | | try { |
| | | SpringComponentGenerater.createService(builder.build(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\service\\inter\\goldcorn\\"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // |
| | | // |
| | | @org.junit.Test |
| | | public void createServiceImpl() { |
| | | try { |
| | | SpringComponentGenerater.createServiceImpl(new ServiceData.Builder().setPackageName("com.yeshi.buwan.service.impl.video").setServiceClass(VideoResourceVersionMapService.class).setDaoClass(VideoResourceVersionMapDao.class).setEntityClass(VideoResourceVersionMap.class).build(), "D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\service\\imp\\video\\"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // |
| | | // @org.junit.Test |
| | | // public void createException() { |
| | | @Test |
| | | public void createViideoResourceInfoMap() throws Exception { |
| | | GeneraterManager.getInstance().init("D:\\workspace\\BuWan\\src\\main\\java", VideoResourceInfoMap.class); |
| | | // try { |
| | | // SpringComponentGenerater.createException(new ExceptionData.Builder().setPackageName("com.yeshi.buwan.exception.video").setBaseClass(BaseException.class).setEntityClass(LuckySponsorMoneyRecord.class).build(), "D:\\workspace\\DayLucky\\facade-lucky\\src\\main\\java\\com\\ks\\lucky\\exception\\"); |
| | | // GeneraterManager.getInstance().createDao("com.yeshi.buwan.dao.video"); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | |
| | | // GeneraterManager.getInstance().createService("com.yeshi.buwan.service.inter.video", "com.yeshi.buwan.service.imp.video", ClassInfo.create(CommonQuery.class), ClassInfo.create(VideoResourceInfoMapDao.class)); |
| | | |
| | | |
| | | GeneraterManager.getInstance().createAdmin("com.yeshi.buwan.controller.admin.api","D:\\workspace\\BuWan\\src\\main\\webapp\\admin\\new",ClassInfo.create(CommonQuery.class),ClassInfo.create(VideoResourceInfoMapService.class)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import org.junit.Test; |
| | | import org.yeshi.utils.push.entity.PushAppInfo; |
| | | import org.yeshi.utils.push.entity.PushMessage; |
| | | import org.yeshi.utils.push.exception.MeiZuPushException; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.util.SolrUtil; |
| | | import org.junit.Test; |
| | | import org.yeshi.utils.LinuxRemoteCommandUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import org.junit.Test; |
| | | |
| | | import com.yeshi.buwan.util.SolrUtil; |
| | | import org.yeshi.utils.AppMarketUtil; |
| | | import org.yeshi.utils.LinuxRemoteCommandUtil; |
| | | |
| | | public class Solr { |
| | | |
| | |
| | | import com.yeshi.buwan.dto.search.SolrResultDTO; |
| | | import com.yeshi.buwan.dto.search.SolrShortVideoSearchFilter; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.job.video.ShortVideoUpdateJob; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.search.SolrInternetSearchVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.search.SolrShortVideoDataManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.service.imp.BanQuanService; |
| | | import com.yeshi.buwan.service.imp.ClassService; |
| | | import com.yeshi.buwan.util.BeanUtil; |
| | | import com.yeshi.buwan.util.CacheUtil; |
| | | import com.yeshi.buwan.util.SolrUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.VideoPictureUtil; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.util.video.VideoDetailUtil; |
| | | import org.json.JSONArray; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | |
| | | public class Test { |
| | | |
| | |
| | | System.out.print(Pattern.matches(regex, "http://www.baidu.com")); |
| | | } |
| | | |
| | | |
| | | @org.junit.Test |
| | | public void test40() { |
| | | File f=new File("E:\\工作\\文网文视频\\美女封面"); |
| | | f.listFiles(); |
| | | Runtime runtime = Runtime.getRuntime(); |
| | | |
| | | int count=0; |
| | | JSONArray array=new JSONArray(); |
| | | for(File ff:f.listFiles()){ |
| | | count++; |
| | | if(count<300) { |
| | | array.put(ff.getName()); |
| | | // System.out.println(ff.getName()); |
| | | } |
| | | // try { |
| | | // runtime.exec(String.format("ffmpeg -i \"E:\\工作\\文网文视频\\美女视频\\%s\" -vframes 1 -ss 00:00:01 -f mjpeg -s 720*1280 -an \"E:/工作/文网文视频/美女封面/%s\"",ff.getName(),ff.getName().replace(".mp4",".jpg"))); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | } |
| | | |
| | | System.out.println(array.toString()); |
| | | } |
| | | } |
| | |
| | | package com.hxh.spring.test.goldcorn; |
| | | |
| | | import com.ks.goldcorn.pojo.DO.GoldCornGetSource; |
| | | import com.yeshi.buwan.dao.goldcorn.GoldCornTaskActionDetailDao; |
| | | import com.yeshi.buwan.domain.goldcorn.CodeCornGetSourceType; |
| | | import com.yeshi.buwan.domain.goldcorn.GoldCornTaskActionDetail; |
New file |
| | |
| | | package com.hxh.spring.test.mq; |
| | | |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.junit.Test; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: MQTest |
| | | * @description: TODO |
| | | * @date 2022/3/22 10:33 |
| | | */ |
| | | public class MQTest { |
| | | |
| | | @Test |
| | | public void init(){ |
| | | |
| | | CMQManager.getInstance(); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hxh.spring.test.video; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.util.DouBanUtil; |
| | | import com.yeshi.buwan.util.FileUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import org.junit.Test; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Scanner; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: DouBanTest |
| | | * @description: TODO |
| | | * @date 2022/3/16 14:59 |
| | | */ |
| | | //@RunWith(SpringJUnit4ClassRunner.class) |
| | | //@ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | //@WebAppConfiguration |
| | | public class DouBanTest { |
| | | |
| | | @Resource |
| | | private AlbumVideoMapDao albumVideoMapDao; |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | @Resource |
| | | private InternetSearchVideoService internetSearchVideoService; |
| | | |
| | | |
| | | @Test |
| | | public void saveSearchResult() throws Exception { |
| | | //读取视频名称 |
| | | Scanner scanner = new Scanner(new FileInputStream(new File("F:\\影视信息\\片名.txt"))); |
| | | int sleepTime = 1; |
| | | List<String> nameList = new ArrayList<>(); |
| | | while (scanner.hasNextLine()) { |
| | | String st = scanner.nextLine(); |
| | | VideoInfo videoInfo = new Gson().fromJson(st, VideoInfo.class); |
| | | String name = videoInfo.getName(); |
| | | nameList.add(name); |
| | | } |
| | | scanner.close(); |
| | | |
| | | Collections.shuffle(nameList); |
| | | for (String name : nameList) { |
| | | File f = new File("F:\\影视信息\\豆瓣影视搜索信息\\" + name + ".html"); |
| | | if (!f.exists()) { |
| | | try { |
| | | DouBanUtil.saveSearch(name, f.getAbsolutePath()); |
| | | if (sleepTime > 1) { |
| | | sleepTime--; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | sleepTime++; |
| | | } |
| | | Thread.sleep(sleepTime * 1000); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Test |
| | | public void saveVideoInfo() throws IOException { |
| | | List<AlbumVideoMap> mapList = albumVideoMapDao.listAll(6690, 40000); |
| | | int page = mapList.size() % 20 == 0 ? mapList.size() / 20 : mapList.size() / 20 + 1; |
| | | for (int i = 0; i < page; i++) { |
| | | int start = i * 20; |
| | | int end = mapList.size() > i * 20 + 20 ? i * 20 + 20 : mapList.size(); |
| | | List<AlbumVideoMap> subList = mapList.subList(start, end); |
| | | List<String> localIdList = new ArrayList<>(); |
| | | List<String> internetIdList = new ArrayList<>(); |
| | | for (AlbumVideoMap map : subList) { |
| | | String videoId = map.getVideoId(); |
| | | if (org.yeshi.utils.NumberUtil.isNumeric(videoId)) { |
| | | localIdList.add(videoId); |
| | | } else { |
| | | internetIdList.add(videoId); |
| | | } |
| | | } |
| | | List<VideoInfo> videoInfoList = new ArrayList<>(); |
| | | if (localIdList.size() > 0) { |
| | | videoInfoList.addAll(videoInfoService.listByVideoIds(localIdList)); |
| | | } |
| | | |
| | | if (internetIdList.size() > 0) { |
| | | List<InternetSearchVideo> ivideoList = internetSearchVideoService.listByIds(internetIdList); |
| | | if (ivideoList.size() > 0) { |
| | | for (InternetSearchVideo searchVideo : ivideoList) { |
| | | videoInfoList.add(VideoInfoFactory.create(searchVideo)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (VideoInfo videoInfo : videoInfoList) { |
| | | videoInfo.setIntroduction(""); |
| | | FileUtil.appendSave(new Gson().toJson(videoInfo) + "\n", "F:\\影视信息\\片名.txt"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.yeshi.buwan.dao.search.SearchSpecialDao; |
| | | import com.yeshi.buwan.domain.solr.SolrShortVideo; |
| | | import com.yeshi.buwan.domain.special.SearchSpecial; |
| | | import com.yeshi.buwan.domain.special.SearchSpecialPosition; |
| | | import com.yeshi.buwan.domain.special.SearchSpecialPositionMap; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | // |
| | | @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
New file |
| | |
| | | package com.hxh.spring.test.video; |
| | | |
| | | import com.yeshi.buwan.dao.VideoResourceMapExtraInfoDao; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.video.VideoResourceInfoMap; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceInfoMapService; |
| | | 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 javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoInfoMapTest |
| | | * @description: TODO |
| | | * @date 2022/3/22 14:00 |
| | | */ |
| | | |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class VideoInfoMapTest { |
| | | |
| | | @Resource |
| | | private VideoResourceInfoMapService videoResourceInfoMapService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @Test |
| | | public void add() throws Exception { |
| | | VideoResourceInfoMap map = new VideoResourceInfoMap(); |
| | | map.setDetailSystemId("51"); |
| | | map.setName("爱奇艺"); |
| | | map.setResourceId(22L); |
| | | map.setIcon("https://www.baidu.com"); |
| | | videoResourceInfoMapService.add(map); |
| | | } |
| | | |
| | | @Test |
| | | public void filter() throws Exception { |
| | | List<VideoResource> resourceList = videoResourceService.getResourceList(); |
| | | resourceList = videoResourceInfoMapService.filter("51", resourceList); |
| | | System.out.println(resourceList); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap; |
| | | import com.yeshi.buwan.domain.video.VideoResourceVersionMap; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void addHJIOS() { |
| | | String[] resourceIds = null; |
| | | resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; |
| | | for (String rid : resourceIds) { |
| | | try { |
| | | videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("51", 1, rid, null)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void addHJMZ() { |
| | | String[] resourceIds = null; |
| | |
| | | package com.hxh.spring.test.video; |
| | | |
| | | import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap; |
| | | import com.yeshi.buwan.domain.video.VideoResourceVersionMap; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; |
| | | import org.junit.Test; |
| | |
| | | } |
| | | |
| | | @Test |
| | | public void addHJIOS() { |
| | | String[] resourceIds = null; |
| | | resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; |
| | | for (String rid : resourceIds) { |
| | | try { |
| | | videoResourceVersionMapService.add(new VideoResourceVersionMap("51", 1, rid, null)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void addHJAndroidOnLine() { |
| | | String[] resourceIds = null; |
| | | resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27", "25"}; |
New file |
| | |
| | | package com.hxh.spring.test.video; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.dao.video.VideoInfoV2Dao; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.video.VideoInfoV2; |
| | | import com.yeshi.buwan.service.inter.video.VideoV2ConvertService; |
| | | 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 javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Scanner; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: VideoV2Test |
| | | * @description: 视频测试 |
| | | * @date 2022/3/16 17:18 |
| | | */ |
| | | @RunWith(SpringJUnit4ClassRunner.class) |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class VideoV2Test { |
| | | @Resource |
| | | private VideoInfoV2Dao videoInfoV2Dao; |
| | | |
| | | @Resource |
| | | private VideoV2ConvertService videoV2ConvertService; |
| | | |
| | | |
| | | @Test |
| | | public void save() { |
| | | VideoInfoV2 infoV2 = new VideoInfoV2(); |
| | | infoV2.setId("123456789"); |
| | | infoV2.setActors(Arrays.asList(new String[]{"沈腾", "马丽", "章宇"})); |
| | | |
| | | infoV2 = new VideoInfoV2(); |
| | | infoV2.setId("12345678"); |
| | | infoV2.setActors(Arrays.asList(new String[]{"沈腾", "测试", "测试2"})); |
| | | |
| | | videoInfoV2Dao.save(infoV2); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void query() { |
| | | VideoInfoV2Dao.DaoQuery query = new VideoInfoV2Dao.DaoQuery(); |
| | | query.actors = Arrays.asList(new String[]{"测试", "沈腾"}); |
| | | query.count = 10; |
| | | |
| | | List<VideoInfoV2> list = videoInfoV2Dao.list(query); |
| | | System.out.println(list); |
| | | } |
| | | |
| | | |
| | | //同步老数据到新数据 |
| | | @Test |
| | | public void syncVideo() throws FileNotFoundException { |
| | | Scanner scanner = new Scanner(new FileInputStream(new File("F:\\影视信息\\片名.txt"))); |
| | | List<String> idList = new ArrayList<>(); |
| | | while (scanner.hasNextLine()) { |
| | | String st = scanner.nextLine(); |
| | | VideoInfo videoInfo = new Gson().fromJson(st, VideoInfo.class); |
| | | idList.add(videoInfo.getId()); |
| | | } |
| | | scanner.close(); |
| | | for (int i = 23000; i < idList.size(); i++) { |
| | | try { |
| | | videoV2ConvertService.asyncOldVideo(idList.get(i)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void syncSingleVideo() throws Exception { |
| | | videoV2ConvertService.asyncOldVideo("228351"); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.exception.vip.VideoBuyRecordException; |
| | | import com.yeshi.buwan.job.OrderJob; |
| | | import com.yeshi.buwan.util.user.VipUtil; |
| | | import com.yeshi.buwan.util.vip.VIPOrderUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVVipManager; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPPriceService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.service.inter.vip.VideoBuyRecordService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import com.yeshi.buwan.util.user.VipUtil; |
| | | import com.yeshi.buwan.util.vip.VIPOrderUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVVipManager; |
| | | 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.alipay.AlipayH5PayUtil; |
| | | import org.yeshi.utils.wx.WXPayV3Util; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |