From b37275dba6b782bf3bb3817c4504f6cdef1bef7c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 18 三月 2021 18:38:51 +0800 Subject: [PATCH] APP首页顶部标签兼容 --- src/main/resources/domain/HomeAd.hbm.xml | 53 src/main/java/com/yeshi/buwan/dao/recommend/HomeRecommendSpecialDao.java | 18 src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java | 9 src/test/java/com/hxh/spring/test/vip/VIPTest.java | 12 src/main/webapp/admin/new/js/navsetting.xml | 10 src/test/java/com/hxh/spring/test/ConfigTest.java | 35 src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java | 2 src/main/java/com/yeshi/buwan/dao/system/DetailSystemConfigDao.java | 5 src/main/webapp/admin/new/edit-tuijian-home-labels.html | 136 +++ src/main/java/com/yeshi/buwan/util/VersionUtil.java | 6 src/main/java/com/yeshi/buwan/service/imp/SearchService.java | 14 src/main/java/com/yeshi/buwan/pptv/PPTVApiUtil.java | 34 src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java | 37 src/main/webapp/admin/new/tuijian-home-labels.html | 285 +++++++ src/main/java/com/yeshi/buwan/service/imp/recommend/HomeRecommendSpecialServiceImpl.java | 91 ++ src/main/java/com/yeshi/buwan/service/inter/recommend/HomeRecommendSpecialService.java | 32 src/main/resources/domain/HomeType.hbm.xml | 75 - src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java | 12 src/main/java/com/yeshi/buwan/util/log/VideoLogFactory.java | 4 src/test/java/com/hxh/spring/test/AlipayTest.java | 4 src/main/java/com/yeshi/buwan/controller/admin/api/ConfigController.java | 36 src/main/java/com/yeshi/buwan/service/inter/system/SystemConfigService.java | 7 src/main/webapp/admin/new/systemcanshu.html | 279 +++--- src/main/webapp/admin/new/add-tuijian-home-labels.html | 162 ++++ src/main/java/com/yeshi/buwan/dao/recommend/SuperHomeRecommendSpecialDao.java | 19 src/main/java/com/yeshi/buwan/aspect/LoginAspect.java | 2 src/main/resources/env-pro/logback.xml | 25 src/main/java/com/yeshi/buwan/aspect/SignAspect.java | 10 src/main/java/com/yeshi/buwan/domain/jump/JumpDetail.java | 10 src/test/java/com/hxh/spring/test/LogTest.java | 64 + src/main/java/com/yeshi/buwan/controller/admin/api/HomeRecommendSpecialController.java | 209 +++++ src/main/java/com/yeshi/buwan/aspect/MuGuaSignAspect.java | 9 src/main/java/com/yeshi/buwan/dto/recommend/HomeRecommendSpecialDTO.java | 30 src/test/java/com/hxh/spring/test/PPTVTest.java | 106 ++ src/main/java/com/yeshi/buwan/controller/parser/UserParser.java | 13 src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java | 4 src/main/java/com/yeshi/buwan/domain/HomeType.java | 77 + src/main/java/com/yeshi/buwan/controller/api/VIPController.java | 10 src/main/java/com/yeshi/buwan/util/Constant.java | 4 src/main/java/com/yeshi/buwan/domain/HomeAd.java | 290 +++--- src/main/java/com/yeshi/buwan/domain/recommend/HomeRecommendSpecial.java | 18 41 files changed, 1,815 insertions(+), 443 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/aspect/LoginAspect.java b/src/main/java/com/yeshi/buwan/aspect/LoginAspect.java index 8b575a1..d294b97 100644 --- a/src/main/java/com/yeshi/buwan/aspect/LoginAspect.java +++ b/src/main/java/com/yeshi/buwan/aspect/LoginAspect.java @@ -20,7 +20,7 @@ @Around("execution(public * com.yeshi.buwan.controller.admin.api.*.*(..))") - public Object verifyLoginState(ProceedingJoinPoint joinPoint) throws IOException { + public Object verifyLoginState(ProceedingJoinPoint joinPoint) throws Throwable { ServletRequestAttributes servletContainer = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); diff --git a/src/main/java/com/yeshi/buwan/aspect/MuGuaSignAspect.java b/src/main/java/com/yeshi/buwan/aspect/MuGuaSignAspect.java index aaeadc1..f37e6aa 100644 --- a/src/main/java/com/yeshi/buwan/aspect/MuGuaSignAspect.java +++ b/src/main/java/com/yeshi/buwan/aspect/MuGuaSignAspect.java @@ -28,7 +28,7 @@ //绛惧悕楠岃瘉 @Around("execution(public * com.yeshi.buwan.controller.api.mugua.*.*(..))") - public Object verifySign(ProceedingJoinPoint joinPoint) throws IOException { + public Object verifySign(ProceedingJoinPoint joinPoint) throws Throwable { ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = servletContainer.getRequest(); HttpServletResponse response = servletContainer.getResponse(); @@ -51,12 +51,7 @@ return null; } - Object obj = null; - try { - obj = joinPoint.proceed(args); - } catch (Throwable e) { - e.printStackTrace(); - } + Object obj = joinPoint.proceed(args); return obj; } diff --git a/src/main/java/com/yeshi/buwan/aspect/SignAspect.java b/src/main/java/com/yeshi/buwan/aspect/SignAspect.java index af2cd03..6d9561f 100644 --- a/src/main/java/com/yeshi/buwan/aspect/SignAspect.java +++ b/src/main/java/com/yeshi/buwan/aspect/SignAspect.java @@ -30,7 +30,7 @@ //绛惧悕楠岃瘉 @Around("execution(public * com.yeshi.buwan.controller.api.*.*(..))") - public Object verifySign(ProceedingJoinPoint joinPoint) throws IOException { + public Object verifySign(ProceedingJoinPoint joinPoint) throws Throwable { ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = servletContainer.getRequest(); HttpServletResponse response = servletContainer.getResponse(); @@ -86,13 +86,7 @@ } } - Object obj = null; - try { - obj = joinPoint.proceed(args); - } catch (Throwable e) { - e.printStackTrace(); - } - return obj; + return joinPoint.proceed(args); } diff --git a/src/main/java/com/yeshi/buwan/controller/admin/api/ConfigController.java b/src/main/java/com/yeshi/buwan/controller/admin/api/ConfigController.java index 509d32a..3ed11a1 100644 --- a/src/main/java/com/yeshi/buwan/controller/admin/api/ConfigController.java +++ b/src/main/java/com/yeshi/buwan/controller/admin/api/ConfigController.java @@ -28,41 +28,31 @@ private EHCacheManager ehCacheManager; @RequestMapping("configList") - public void configList(PrintWriter out) { - - List<DetailSystemConfig> list = configService.getConfig(SystemUtil.getDetailSystemId(), SystemUtil.getDefaultVersion()); + public void configList(Long detailSystemId, String key, PrintWriter out) { + key = StringUtil.isNullOrEmpty(key) ? "" : key.trim(); + List<DetailSystemConfig> list = configService.listConfig(detailSystemId, key); JSONObject json = new JSONObject(); json.put("code", "0"); JSONArray listJson = new JSONArray(list); json.put("configList", listJson); - - System.out.println("Json--" + json); - System.out.println("JsonS--" + json.toString()); - out.print(json); - return; } @RequestMapping(value = "updateConfig", method = RequestMethod.POST) - public void updateConfig(String vals, PrintWriter out) { - List<DetailSystemConfig> list = configService.getConfig(SystemUtil.getDetailSystemId(), SystemUtil.getDefaultVersion()); + public void updateConfig(String id, String value, PrintWriter out) { + DetailSystemConfig config = configService.getConfig(Integer.parseInt(id)); + JSONObject json = new JSONObject(); - System.out.println("vals----" + vals); - JSONObject json = new JSONObject(vals); - for (DetailSystemConfig cf : list) { - String key = cf.getKey(); - cf.setValue(json.getString(key)); -// configService.updateConfig(cf); - } - boolean b = configService.updateConfigList(list); - if (b) { - out.print("yes"); + if (config == null) { + json.put("code", 1); + json.put("msg", "閰嶇疆涓嶅瓨鍦�"); } else { - out.print("no"); + config.setValue(value); + configService.saveConfig(config); + json.put("code", 0); } - - + out.print(json); return; } diff --git a/src/main/java/com/yeshi/buwan/controller/admin/api/HomeRecommendSpecialController.java b/src/main/java/com/yeshi/buwan/controller/admin/api/HomeRecommendSpecialController.java new file mode 100644 index 0000000..85dfff3 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/controller/admin/api/HomeRecommendSpecialController.java @@ -0,0 +1,209 @@ +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; + +@Controller +@RequestMapping("admin/new/api/homerecommend") +public class HomeRecommendSpecialController { + + @Resource + private HomeRecommendSpecialService homeRecommendSpecialService; + + private Gson getGson() { + + Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { + @Override + public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) { + if (value == null) { + return new JsonPrimitive(""); + } else { + return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy.MM.dd HH:mm")); + } + } + }).create(); + + return gson; + } + + /** + * 鑾峰彇涓撻鍒楄〃 + * + * @param session + * @param out + */ + @RequestMapping(value = "/getSpcialList", method = RequestMethod.POST) + public void getSpcialList(HttpSession session, String detailSystemId, String key, int page, PrintWriter out) { + + key = StringUtil.isNullOrEmpty(key) ? null : key.trim(); + detailSystemId = StringUtil.isNullOrEmpty(detailSystemId) ? null : detailSystemId.trim(); + + if (detailSystemId != null && detailSystemId.equalsIgnoreCase("0")) + detailSystemId = null; + + String systemId = SystemUtil.getAdminSelectedSystemId(session); + + List<HomeRecommendSpecialDTO> list = homeRecommendSpecialService.list(systemId, detailSystemId, key, page, Constant.pageCount); + if (list != null) + for (HomeRecommendSpecialDTO dto : list) { + List<DetailSystemSelect> dssList = dto.getDetailSystemSelectList(); + for (DetailSystemSelect select : dssList) { + select.getDetailSystem().setSystem(null); + select.getDetailSystem().setInfo(null); + } + + } + long count = homeRecommendSpecialService.count(systemId, detailSystemId, key); + JSONObject data = new JSONObject(); + data.put("data", getGson().toJson(list)); + data.put("count", count); + data.put("pageEntity", new PageEntity(page, Constant.pageCount, (int) count)); + + JSONObject object = new JSONObject(); + object.put("code", 0); + object.put("data", data); + out.print(object); + } + + + @RequestMapping(value = "/getSpecial", method = RequestMethod.POST) + public void getSpecial(String id, PrintWriter out) { + HomeRecommendSpecial special = homeRecommendSpecialService.getSpecial(id); + JSONObject object = new JSONObject(); + if (special != null) { + object.put("code", 0); + object.put("data", new Gson().toJson(special)); + } else { + object.put("code", 1); + object.put("msg", "涓撻涓嶅瓨鍦�"); + } + + out.print(object); + } + + + @RequestMapping(value = "/addSpecial", method = RequestMethod.POST) + public void addSpecial(String name, int weight, String bannerSizeRate, String dataKey, String detailsystemids, HttpSession session, PrintWriter out) { + HomeRecommendSpecial special = new HomeRecommendSpecial(); + special.setName(name); + special.setWeight(weight); + special.setDataKey(dataKey); + special.setBannerSizeRate(new BigDecimal(bannerSizeRate)); + special.setSystemId(SystemUtil.getAdminSelectedSystemId(session)); + JSONObject object = new JSONObject(); + try { + homeRecommendSpecialService.addSpecial(special); + + //涓婚敭 + if (!StringUtil.isNullOrEmpty(detailsystemids)) { + String[] ds = detailsystemids.split(","); + for (String d : ds) { + SuperHomeRecommendSpecial s = new SuperHomeRecommendSpecial(); + s.setSpecialId(special.getId()); + s.setSpecial(special); + s.setDetailSystemId(d); + homeRecommendSpecialService.addSuperSpecial(s); + } + } + object.put("code", 0); + } catch (Exception e) { + object.put("code", 1); + object.put("msg", e.getMessage()); + } + out.print(object); + } + + + @RequestMapping(value = "/deleteSpcial", method = RequestMethod.POST) + public void deleteSpecial(String ids, PrintWriter out) { + String[] sts = ids.split(","); + for (String id : sts) { + homeRecommendSpecialService.deleteSpecial(id); + } + + JSONObject object = new JSONObject(); + object.put("code", 0); + object.put("msg", "鎿嶄綔鎴愬姛"); + out.print(object); + } + + + @RequestMapping(value = "/updateSpecial", method = RequestMethod.POST) + public void updateSpecial(String id, String name, int weight, String bannerSizeRate, HttpSession session, PrintWriter out) { + HomeRecommendSpecial special = new HomeRecommendSpecial(); + special.setId(id); + special.setName(name); + special.setWeight(weight); + special.setBannerSizeRate(new BigDecimal(bannerSizeRate)); + JSONObject object = new JSONObject(); + try { + homeRecommendSpecialService.updateSpecial(special); + object.put("code", 0); + } catch (Exception e) { + object.put("code", 1); + object.put("msg", e.getMessage()); + } + out.print(object); + } + + + @RequestMapping(value = "/addSuperSpecial", method = RequestMethod.POST) + public void addSuperSpecial(String id, String detailSystemId, HttpSession session, PrintWriter out) { + SuperHomeRecommendSpecial superHomeRecommendSpecial = new SuperHomeRecommendSpecial(); + superHomeRecommendSpecial.setSpecialId(id); + superHomeRecommendSpecial.setDetailSystemId(detailSystemId); + JSONObject object = new JSONObject(); + try { + homeRecommendSpecialService.addSuperSpecial(superHomeRecommendSpecial); + object.put("code", 0); + } catch (Exception e) { + object.put("code", 1); + object.put("msg", e.getMessage()); + } + out.print(object); + } + + + @RequestMapping(value = "/deleteSuperSpecial", method = RequestMethod.POST) + public void deleteSuperSpecial(String id, String detailSystemId, PrintWriter out) { + homeRecommendSpecialService.deleteSuperSpecial(id, detailSystemId); + JSONObject object = new JSONObject(); + object.put("code", 0); + object.put("msg", "鎿嶄綔鎴愬姛"); + out.print(object); + } + +} diff --git a/src/main/java/com/yeshi/buwan/controller/api/VIPController.java b/src/main/java/com/yeshi/buwan/controller/api/VIPController.java index 88c03e2..e1d6c43 100644 --- a/src/main/java/com/yeshi/buwan/controller/api/VIPController.java +++ b/src/main/java/com/yeshi/buwan/controller/api/VIPController.java @@ -1,6 +1,7 @@ package com.yeshi.buwan.controller.api; import com.google.gson.*; +import com.yeshi.buwan.domain.system.SystemConfig; import com.yeshi.buwan.domain.user.LoginUser; import com.yeshi.buwan.domain.vip.UserVIPInfo; import com.yeshi.buwan.domain.vip.VIPOrderRecord; @@ -8,6 +9,7 @@ import com.yeshi.buwan.domain.vip.VIPPriceType; import com.yeshi.buwan.exception.vip.VIPException; import com.yeshi.buwan.service.inter.LoginUserService; +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.*; @@ -47,6 +49,9 @@ @Resource private VIPPriceService vipPriceService; + @Resource + private SystemConfigService systemConfigService; + @RequestMapping("getVIPPriceList") @ResponseBody @@ -72,6 +77,11 @@ userInfoVO.setId(user.getId()); userInfoVO.setNickName(user.getName()); userInfoVO.setPortrait(user.getPortrait()); + if (StringUtil.isNullOrEmpty(userInfoVO.getPortrait())) { + String portrait = systemConfigService.getConfigValueByKeyCache("default_portrait"); + userInfoVO.setPortrait(portrait); + } + if (vipInfo != null && vipInfo.getExpireDate() != null) userInfoVO.setVipExpireTime(vipInfo.getExpireDate().getTime()); root.put("user", new Gson().toJson(userInfoVO)); diff --git a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java b/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java index 3103027..d590cf0 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java @@ -299,6 +299,8 @@ typelist.add(vo); } + typelist.get(0).setDataKey("recommend"); + HomeClassVO vo = new HomeClassVO(); vo.setDataType(HomeClassVO.DATA_TYPE_NOVEL); diff --git a/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java b/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java index 68b8801..36d846f 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java @@ -212,6 +212,10 @@ data.put("adNew", adNew); //PPTV鍏嶅箍鍛婃潈鐩婃椂闀�,鏆傛椂璁剧疆涓�3灏忔椂 data.put("pptvNoAdRewardHour", 3); + //璁剧疆缃戦〉鍔犻�熷煙鍚� + data.put("webSpeedUpHost",map.get("web_speed_up_host")); + + out.print(JsonUtil.loadTrueJson(data.toString())); diff --git a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java index c04f028..4028002 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java @@ -2,12 +2,16 @@ import java.io.IOException; import java.io.PrintWriter; +import java.math.BigDecimal; import java.util.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.google.gson.Gson; import com.yeshi.buwan.domain.*; +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.DetailSystem; import com.yeshi.buwan.domain.video.VideoWatchHistory; @@ -79,7 +83,7 @@ @Resource private VideoWatchHistoryService videoWatchHistoryService; - private final Logger playLogger = LoggerFactory.getLogger("videoPlay"); + private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser"); @RequireUid public void getHomeAd(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { @@ -190,6 +194,20 @@ e.printStackTrace(); } } + + if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion())) { + DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion()); + if (adContent != null && adPosition != null) { + HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class); + int adP = Integer.parseInt(adPosition.getValue()); + if (adP < list.size()) { + HomeType homeType = new HomeType(); + homeType.setAd(ad); + list.add(adP, homeType); + } + } + } } if (acceptData.getPlatform().equalsIgnoreCase("ios")) { @@ -222,13 +240,14 @@ JSONArray array = new JSONArray(); for (HomeType ht : list) { - for (int i = 0; i < ht.getHomeVideoList().size(); i++) { - //鏀瑰彉鍥剧墖 - if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailSystem.getId())) { - ht.getHomeVideoList().remove(i); - i--; + if (ht.getHomeVideoList() != null) + for (int i = 0; i < ht.getHomeVideoList().size(); i++) { + //鏀瑰彉鍥剧墖 + if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailSystem.getId())) { + ht.getHomeVideoList().remove(i); + i--; + } } - } } for (int i = 0; i < list.size(); i++) @@ -236,7 +255,6 @@ object.put("data", array); out.print(JsonUtil.loadTrueJson(object.toString())); } - public HomeType convertHomeVideoList(HomeType type) { @@ -365,7 +383,7 @@ } }); - playLogger.info(VideoLogFactory.createUserVideoDetailLog(acceptData.getDevice(), loginUid, acceptData.getDetailSystem().getId(), videoId, resourceId, from)); + userPlayLogger.info(VideoLogFactory.createUserVideoDetailLog(acceptData.getDevice(), acceptData.getUtdId(), loginUid, acceptData.getDetailSystem().getId(), videoId, resourceId, from)); //PPTV缃戦〉鎾斁 @@ -388,6 +406,7 @@ String playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p)); data.put("videoId", videoId); data.put("playUrl", playUrl); + data.put("name", series.getName()); data.put("pptv", true); out.print(JsonUtil.loadTrueJson(data.toString())); return; diff --git a/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java b/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java index 1f3fd7e..bde84a6 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java @@ -7,6 +7,7 @@ import com.yeshi.buwan.dto.user.LoginInfoDto; import com.yeshi.buwan.exception.user.LoginUserException; import com.yeshi.buwan.exception.user.RegisterUserException; +import com.yeshi.buwan.pptv.PPTVUtil; import com.yeshi.buwan.service.imp.*; import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager; import com.yeshi.buwan.util.*; @@ -199,7 +200,7 @@ private List<VideoDetailInfo> createSearchVideoDetailsVO(VideoInfo video) { List<VideoDetailInfo> detailList = new ArrayList<>(); if (video.getVideoType() != null && (Integer.parseInt(video.getVideoType().getId() + "") == VideoCategoryConstant.CATEGORY_DIANSHIJU || Integer.parseInt(video.getVideoType().getId() + "") == VideoCategoryConstant.CATEGORY_DONGMAN)) { - if (video.getVideocount()!=null&& video.getVideocount() <= 5) { + if (video.getVideocount() != null && video.getVideocount() <= 5) { for (int i = 0; i < video.getVideocount(); i++) { VideoDetailInfo detail = new VideoDetailInfo(); detail.setTag((i + 1) + ""); @@ -355,11 +356,14 @@ } List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); + + String cacheMD5 = "0"; if (resourceList != null && resourceList.size() > 0) for (Long l : resourceList) cacheMD5 += "#" + l; cacheMD5 = StringUtil.Md5(cacheMD5); + VideoListResultVO videoListResultVO = searchService.searchNew(acceptData.getDetailSystem().getId(), request.getRemoteAddr(), acceptData.getUid(), key, pageIndex, Integer.parseInt(type), @@ -417,6 +421,13 @@ typeList.add(vt); } } + + vt = new VideoType(); + vt.setId(Constant.SEARCH_RESULT_TYPE_HIGH_DEFINITION); + vt.setName("楂樻竻"); + typeList.add(vt); + + JSONArray array1 = new JSONArray(); for (VideoType vt1 : typeList) array1.add(StringUtil.outPutResultJson(vt1)); diff --git a/src/main/java/com/yeshi/buwan/dao/recommend/HomeRecommendSpecialDao.java b/src/main/java/com/yeshi/buwan/dao/recommend/HomeRecommendSpecialDao.java index 01cba23..7e5cfd8 100644 --- a/src/main/java/com/yeshi/buwan/dao/recommend/HomeRecommendSpecialDao.java +++ b/src/main/java/com/yeshi/buwan/dao/recommend/HomeRecommendSpecialDao.java @@ -35,12 +35,16 @@ return findList(query); } - public List<HomeRecommendSpecial> list(DaoQuery daoQuery) { + private Query getQuery(DaoQuery daoQuery) { Query query = new Query(); List<Criteria> andList = new ArrayList<>(); if (daoQuery.systemId != null) { andList.add(Criteria.where("systemId").is(daoQuery.systemId)); + } + + if (daoQuery.key != null) { + andList.add(Criteria.where("name").regex(daoQuery.key)); } Criteria criteria = new Criteria(); @@ -51,12 +55,21 @@ } query.addCriteria(criteria); + return query; + } + public List<HomeRecommendSpecial> list(DaoQuery daoQuery) { + Query query = getQuery(daoQuery); query.skip(daoQuery.start); query.limit(daoQuery.count); query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "weight"))); - return findList(query); + } + + + public long count(DaoQuery daoQuery) { + Query query = getQuery(daoQuery); + return count(query); } public void updateSelective(HomeRecommendSpecial bean) { @@ -87,6 +100,7 @@ public String systemId; public int start; public int count; + public String key; } diff --git a/src/main/java/com/yeshi/buwan/dao/recommend/SuperHomeRecommendSpecialDao.java b/src/main/java/com/yeshi/buwan/dao/recommend/SuperHomeRecommendSpecialDao.java index 35065b2..fd2ef12 100644 --- a/src/main/java/com/yeshi/buwan/dao/recommend/SuperHomeRecommendSpecialDao.java +++ b/src/main/java/com/yeshi/buwan/dao/recommend/SuperHomeRecommendSpecialDao.java @@ -16,7 +16,7 @@ public class SuperHomeRecommendSpecialDao extends MongodbBaseDao<SuperHomeRecommendSpecial> { - public List<SuperHomeRecommendSpecial> list(SuperHomeRecommendSpecialDao.DaoQuery daoQuery) { + private Query getQuery(SuperHomeRecommendSpecialDao.DaoQuery daoQuery) { Query query = new Query(); List<Criteria> andList = new ArrayList<>(); @@ -26,6 +26,10 @@ if (daoQuery.detailSystemId != null) { andList.add(Criteria.where("detailSystemId").is(daoQuery.detailSystemId)); + } + + if (daoQuery.showName != null) { + andList.add(Criteria.where("showName").regex(daoQuery.showName)); } @@ -38,11 +42,23 @@ query.addCriteria(criteria); + return query; + + } + + public List<SuperHomeRecommendSpecial> list(SuperHomeRecommendSpecialDao.DaoQuery daoQuery) { + Query query = getQuery(daoQuery); query.skip(daoQuery.start); query.limit(daoQuery.count); query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "weight"))); return findList(query); + } + + + public long count(SuperHomeRecommendSpecialDao.DaoQuery daoQuery) { + Query query = getQuery(daoQuery); + return count(query); } public void updateSelective(SuperHomeRecommendSpecial bean) { @@ -71,6 +87,7 @@ public static class DaoQuery { public String specialId; public String detailSystemId; + public String showName; public int start; public int count; } diff --git a/src/main/java/com/yeshi/buwan/dao/system/DetailSystemConfigDao.java b/src/main/java/com/yeshi/buwan/dao/system/DetailSystemConfigDao.java index 4d24c98..26eca76 100644 --- a/src/main/java/com/yeshi/buwan/dao/system/DetailSystemConfigDao.java +++ b/src/main/java/com/yeshi/buwan/dao/system/DetailSystemConfigDao.java @@ -5,6 +5,7 @@ import com.yeshi.buwan.domain.system.DetailSystemConfig; +import java.math.BigInteger; import java.util.List; @Repository @@ -30,4 +31,8 @@ return null; } + public List<DetailSystemConfig> list(Long systemId, String searchKey) { + return list("from DetailSystemConfig c where c.systemId=? and c.beizhu like ?", new BigInteger( systemId+""), "%" + searchKey + "%"); + } + } \ No newline at end of file diff --git a/src/main/java/com/yeshi/buwan/domain/HomeAd.java b/src/main/java/com/yeshi/buwan/domain/HomeAd.java index a2fc530..6dff52d 100644 --- a/src/main/java/com/yeshi/buwan/domain/HomeAd.java +++ b/src/main/java/com/yeshi/buwan/domain/HomeAd.java @@ -10,190 +10,198 @@ /** * 棣栭〉骞垮憡 - * + * * @author Administrator - * */ @Entity -public class HomeAd implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 1L; +public class HomeAd implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; - public HomeAd(String id) { - this.id = id; - } + public HomeAd(String id) { + this.id = id; + } - public HomeAd() { + public HomeAd() { - } + } - @Expose - private String id; - @Expose - private AdTag tag; - private AdminInfo admin; - @Expose - private String picture; - @Expose - private String createtime; - @Expose - private VideoInfo video; - private String starttime; - private String endtime; - @Expose - private String title; - @Expose - private String introduction; + @Expose + private String id; + @Expose + private AdTag tag; + private AdminInfo admin; + @Expose + private String picture; + @Expose + private String createtime; + @Expose + private VideoInfo video; + private String starttime; + private String endtime; + @Expose + private String title; + @Expose + private String introduction; - private SystemInfo system;// 绯荤粺 + private SystemInfo system;// 绯荤粺 + public String getIntroduction() { + return introduction; + } - public String getIntroduction() { - return introduction; - } + public void setIntroduction(String introduction) { + this.introduction = introduction; + } - public void setIntroduction(String introduction) { - this.introduction = introduction; - } + private String beizhu; + // 璺宠浆鍒扮殑绫� + @Expose + private String clazz; + // 浼犵殑鍙傛暟 + @Expose + private String params; + @Expose + private int linkType; - private String beizhu; - // 璺宠浆鍒扮殑绫� - @Expose - private String clazz; - // 浼犵殑鍙傛暟 - @Expose - private String params; - @Expose - private int linkType; - - private int orderby; + private int orderby; - public int getOrderby() { - return orderby; - } + //涓撻鍏抽敭瀛� + private String specialDataKey; - public void setOrderby(int orderby) { - this.orderby = orderby; - } + public String getSpecialDataKey() { + return specialDataKey; + } - public int getLinkType() { - return linkType; - } + public void setSpecialDataKey(String specialDataKey) { + this.specialDataKey = specialDataKey; + } - public void setLinkType(int linkType) { - this.linkType = linkType; - } + public int getOrderby() { + return orderby; + } - public String getClazz() { - return clazz; - } + public void setOrderby(int orderby) { + this.orderby = orderby; + } - public void setClazz(String clazz) { - this.clazz = clazz; - } + public int getLinkType() { + return linkType; + } - public String getParams() { - return params; - } + public void setLinkType(int linkType) { + this.linkType = linkType; + } - public void setParams(String params) { - this.params = params; - } + public String getClazz() { + return clazz; + } + + public void setClazz(String clazz) { + this.clazz = clazz; + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + public SystemInfo getSystem() { + return system; + } - public SystemInfo getSystem() { - return system; - } + public void setSystem(SystemInfo system) { + this.system = system; + } - public void setSystem(SystemInfo system) { - this.system = system; - } + public String getId() { + return id; + } - public String getId() { - return id; - } + public void setId(String id) { + this.id = id; + } - public void setId(String id) { - this.id = id; - } + @ManyToOne + public AdTag getTag() { + return tag; + } - @ManyToOne - public AdTag getTag() { - return tag; - } + public void setTag(AdTag tag) { + this.tag = tag; + } - public void setTag(AdTag tag) { - this.tag = tag; - } + @ManyToOne + public AdminInfo getAdmin() { + return admin; + } - @ManyToOne - public AdminInfo getAdmin() { - return admin; - } + public void setAdmin(AdminInfo admin) { + this.admin = admin; + } - public void setAdmin(AdminInfo admin) { - this.admin = admin; - } + public String getPicture() { + return picture; + } - public String getPicture() { - return picture; - } + public void setPicture(String picture) { + this.picture = picture; + } - public void setPicture(String picture) { - this.picture = picture; - } + public String getCreatetime() { + return createtime; + } - public String getCreatetime() { - return createtime; - } + public void setCreatetime(String createtime) { + this.createtime = createtime; + } - public void setCreatetime(String createtime) { - this.createtime = createtime; - } + @ManyToOne + public VideoInfo getVideo() { + return video; + } - @ManyToOne - public VideoInfo getVideo() { - return video; - } + public void setVideo(VideoInfo video) { + this.video = video; + } - public void setVideo(VideoInfo video) { - this.video = video; - } + public String getStarttime() { + return starttime; + } - public String getStarttime() { - return starttime; - } + public void setStarttime(String starttime) { + this.starttime = starttime; + } - public void setStarttime(String starttime) { - this.starttime = starttime; - } + public String getEndtime() { + return endtime; + } - public String getEndtime() { - return endtime; - } + public void setEndtime(String endtime) { + this.endtime = endtime; + } - public void setEndtime(String endtime) { - this.endtime = endtime; - } + public String getTitle() { + return title; + } - public String getTitle() { - return title; - } + public void setTitle(String title) { + this.title = title; + } - public void setTitle(String title) { - this.title = title; - } + public String getBeizhu() { + return beizhu; + } - public String getBeizhu() { - return beizhu; - } - - public void setBeizhu(String beizhu) { - this.beizhu = beizhu; - } + public void setBeizhu(String beizhu) { + this.beizhu = beizhu; + } } diff --git a/src/main/java/com/yeshi/buwan/domain/HomeType.java b/src/main/java/com/yeshi/buwan/domain/HomeType.java index ca79f8f..da930cf 100644 --- a/src/main/java/com/yeshi/buwan/domain/HomeType.java +++ b/src/main/java/com/yeshi/buwan/domain/HomeType.java @@ -1,13 +1,17 @@ package com.yeshi.buwan.domain; import java.io.Serializable; +import java.math.BigDecimal; import java.util.List; 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; /** @@ -56,6 +60,24 @@ @Expose private int number;// 鏄剧ず澶氬皯涓� + @Expose + @Transient + private HomeTypeAd ad; + + private SystemInfo system; + + private VideoType videoType; //20170914 + + //涓撻鍏抽敭瀛� + private String specialDataKey; + + public HomeTypeAd getAd() { + return ad; + } + + public void setAd(HomeTypeAd ad) { + this.ad = ad; + } public boolean isNeedAd() { return needAd; @@ -65,9 +87,6 @@ this.needAd = needAd; } - private SystemInfo system; - - private VideoType videoType; //20170914 public String getIcon() { return icon; @@ -224,4 +243,56 @@ public void setSystem(SystemInfo system) { this.system = system; } + + + public String getSpecialDataKey() { + return specialDataKey; + } + + public void setSpecialDataKey(String specialDataKey) { + this.specialDataKey = specialDataKey; + } + + public static class HomeTypeAd { + @Expose + private String picture; + @Expose + private BigDecimal pictureRate; + @Expose + private JumpDetail jumpDetail; + @Expose + private String params; + + public String getPicture() { + return picture; + } + + public void setPicture(String picture) { + this.picture = picture; + } + + public BigDecimal getPictureRate() { + return pictureRate; + } + + public void setPictureRate(BigDecimal pictureRate) { + this.pictureRate = pictureRate; + } + + public JumpDetail getJumpDetail() { + return jumpDetail; + } + + public void setJumpDetail(JumpDetail jumpDetail) { + this.jumpDetail = jumpDetail; + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + } } diff --git a/src/main/java/com/yeshi/buwan/domain/jump/JumpDetail.java b/src/main/java/com/yeshi/buwan/domain/jump/JumpDetail.java index 9f6d259..095fcea 100644 --- a/src/main/java/com/yeshi/buwan/domain/jump/JumpDetail.java +++ b/src/main/java/com/yeshi/buwan/domain/jump/JumpDetail.java @@ -17,6 +17,8 @@ @Expose @Field private String controller; + @Expose + private Boolean needLogin; public JumpTypeEnum getType() { @@ -42,4 +44,12 @@ public void setController(String controller) { this.controller = controller; } + + public Boolean getNeedLogin() { + return needLogin; + } + + public void setNeedLogin(Boolean needLogin) { + this.needLogin = needLogin; + } } diff --git a/src/main/java/com/yeshi/buwan/domain/recommend/HomeRecommendSpecial.java b/src/main/java/com/yeshi/buwan/domain/recommend/HomeRecommendSpecial.java index d0220e6..e73195a 100644 --- a/src/main/java/com/yeshi/buwan/domain/recommend/HomeRecommendSpecial.java +++ b/src/main/java/com/yeshi/buwan/domain/recommend/HomeRecommendSpecial.java @@ -24,11 +24,29 @@ //banner鐨勫楂樻瘮 @NotNull(message = "杞挱鍥剧殑姣斾緥涓嶈兘涓虹┖") private BigDecimal bannerSizeRate; + + //鍏抽敭璇� + + private String dataKey; //鏉冮噸 private Integer weight; private Date createTime; private Date updateTime; + public String getDataKey() { + return dataKey; + } + + public void setDataKey(String dataKey) { + this.dataKey = dataKey; + } + + public HomeRecommendSpecial() { + } + + public HomeRecommendSpecial(String id) { + this.id = id; + } public String getId() { return id; diff --git a/src/main/java/com/yeshi/buwan/dto/recommend/HomeRecommendSpecialDTO.java b/src/main/java/com/yeshi/buwan/dto/recommend/HomeRecommendSpecialDTO.java new file mode 100644 index 0000000..6a061f4 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/dto/recommend/HomeRecommendSpecialDTO.java @@ -0,0 +1,30 @@ +package com.yeshi.buwan.dto.recommend; + +import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; +import com.yeshi.buwan.domain.web.DetailSystemSelect; + +import java.util.List; + +public class HomeRecommendSpecialDTO { + + private HomeRecommendSpecial special; + + private List<DetailSystemSelect> detailSystemSelectList; + + + public HomeRecommendSpecial getSpecial() { + return special; + } + + public void setSpecial(HomeRecommendSpecial special) { + this.special = special; + } + + public List<DetailSystemSelect> getDetailSystemSelectList() { + return detailSystemSelectList; + } + + public void setDetailSystemSelectList(List<DetailSystemSelect> detailSystemSelectList) { + this.detailSystemSelectList = detailSystemSelectList; + } +} diff --git a/src/main/java/com/yeshi/buwan/pptv/PPTVApiUtil.java b/src/main/java/com/yeshi/buwan/pptv/PPTVApiUtil.java index 20dd816..bdac890 100644 --- a/src/main/java/com/yeshi/buwan/pptv/PPTVApiUtil.java +++ b/src/main/java/com/yeshi/buwan/pptv/PPTVApiUtil.java @@ -1,6 +1,7 @@ package com.yeshi.buwan.pptv; import com.google.gson.Gson; +import com.yeshi.buwan.pptv.entity.PPTVProgram; import com.yeshi.buwan.pptv.entity.PPTVSeries; import com.yeshi.buwan.util.StringUtil; import com.yeshi.buwan.util.TimeUtil; @@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory; import org.yeshi.utils.HttpUtil; +import java.lang.reflect.Field; import java.net.URLEncoder; import java.util.*; @@ -144,11 +146,37 @@ } public static PPTVSeries getDetail(String seriesCodes) { + Gson gson = new Gson(); Map<String, String> params = new HashMap<>(); params.put("seriesCodes", seriesCodes); String result = baseRequest(params, "pptv.channel.content.detail"); - System.out.println(result); - return null; + JSONObject resultJSON = JSONObject.fromObject(result); + JSONArray array = resultJSON.optJSONObject("response").optJSONObject("body").optJSONArray("contentInfos"); + List<PPTVProgram> programList = new ArrayList<>(); + PPTVSeries pptvSeries = null; + for (int i = 0; i < array.size(); i++) { + JSONObject item = array.optJSONObject(i); + if (pptvSeries == null) + pptvSeries = gson.fromJson(item.toString(), PPTVSeries.class); + + List<String> keys = new ArrayList<>(); + for (Iterator<String> its = item.keys(); its.hasNext(); ) { + String key = its.next(); + if (!key.contains("series_")) { + keys.add(key); + } + } + + for (String key : keys) { + item.remove(key); + } + + String itemStr = item.toString().replace("series_", ""); + PPTVProgram program = gson.fromJson(itemStr, PPTVProgram.class); + programList.add(program); + } + pptvSeries.setSeries(programList); + return pptvSeries; } @@ -185,7 +213,7 @@ * @param code */ public static boolean login(String code) { - String url = String.format("https://coapi.pptv.com/coapi-web/api/getUserToken/%s/%s.htm", APP_KEY,URLEncoder.encode(code)); + String url = String.format("https://coapi.pptv.com/coapi-web/api/getUserToken/%s/%s.htm", APP_KEY, URLEncoder.encode(code)); String result = HttpUtil.get(url); System.out.println(result); JSONObject resultJSON = JSONObject.fromObject(result); diff --git a/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java b/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java index 8065df3..70949f5 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java @@ -24,6 +24,18 @@ return configDao.listBySystemIdAndMaxVersion(systemId, version); } + public DetailSystemConfig getConfig(int id) { + return configDao.find(DetailSystemConfig.class, id); + } + + public void saveConfig(DetailSystemConfig config) { + configDao.save(config); + } + + public List<DetailSystemConfig> listConfig(Long systemId, String key) { + return configDao.list(systemId, key); + } + @Cacheable(value = "configCache", key = "'getConfigAsMap-'+#system.id+'-'+#version") public Map<String, String> getConfigAsMap(DetailSystem system, int version) { Map<String, String> map = new HashMap<String, String>(); diff --git a/src/main/java/com/yeshi/buwan/service/imp/SearchService.java b/src/main/java/com/yeshi/buwan/service/imp/SearchService.java index 69a83a7..57b6482 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/SearchService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/SearchService.java @@ -9,6 +9,7 @@ import com.yeshi.buwan.domain.web.HotSearchAdmin; import com.yeshi.buwan.dto.search.SolrResultDTO; import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; +import com.yeshi.buwan.pptv.PPTVUtil; import com.yeshi.buwan.service.inter.video.VideoInfoExtraService; import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager; import com.yeshi.buwan.util.*; @@ -17,6 +18,8 @@ import com.yeshi.buwan.vo.video.VideoListResultVO; import org.hibernate.HibernateException; import org.hibernate.Session; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.cache.annotation.Cacheable; import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; @@ -28,6 +31,9 @@ @Service public class SearchService { + private Logger logger= LoggerFactory.getLogger(SearchService.class); + + @Resource private SearchDao searchDao; @Resource @@ -285,7 +291,11 @@ SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); filter.setKey(key); - filter.setVideoType(videoType == 0 ? null : videoType); + if (videoType == Constant.SEARCH_RESULT_TYPE_HIGH_DEFINITION) { + filter.setResourceIds(new String[]{PPTVUtil.RESOURCE_ID + ""}); + logger.info("楂樻竻鎼滅储# key锛歿}",key); + } else + filter.setVideoType(videoType == 0 ? null : videoType); filter.setContentType(1); SolrResultDTO solrResultDTO = solrAlbumDataManager.find(filter, page, pageSize); @@ -335,7 +345,7 @@ localList.add(vi); } } - }catch(Exception e){ + } catch (Exception e) { } } diff --git a/src/main/java/com/yeshi/buwan/service/imp/recommend/HomeRecommendSpecialServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/recommend/HomeRecommendSpecialServiceImpl.java index fa1dc5d..d665510 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/recommend/HomeRecommendSpecialServiceImpl.java +++ b/src/main/java/com/yeshi/buwan/service/imp/recommend/HomeRecommendSpecialServiceImpl.java @@ -4,7 +4,11 @@ import com.yeshi.buwan.dao.recommend.SuperHomeRecommendSpecialDao; 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.dto.recommend.HomeRecommendSpecialDTO; import com.yeshi.buwan.exception.ParamsException; +import com.yeshi.buwan.service.imp.SystemService; import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; import com.yeshi.buwan.util.StringUtil; import org.springframework.stereotype.Service; @@ -23,6 +27,55 @@ @Resource private SuperHomeRecommendSpecialDao superHomeRecommendSpecialDao; + @Resource + private SystemService systemService; + + + @Override + public List<HomeRecommendSpecialDTO> list(String systemId, String detailSystemId, String key, int page, int pageSize) { + List<HomeRecommendSpecialDTO> dtoList = new ArrayList<>(); + List<DetailSystem> detailSystemList = systemService.getDetailSystemList(systemId); + List<HomeRecommendSpecial> list = null; + if (!StringUtil.isNullOrEmpty(detailSystemId)) { + list = listSpecialByDetailSystemId(detailSystemId, key, page, pageSize); + } else { + list = listSpecialBySystemId(systemId, key, page, pageSize); + } + + for (HomeRecommendSpecial special : list) { + + List<DetailSystemSelect> selects = new ArrayList<>(); + HomeRecommendSpecialDTO dto = new HomeRecommendSpecialDTO(); + //鏌ヨsuper + List<SuperHomeRecommendSpecial> superHomeRecommendSpecialList = listSuperSpecialBySpecialId(special.getId()); + for (DetailSystem detailSystem : detailSystemList) { + detailSystem.setInfo(null); + DetailSystemSelect select = new DetailSystemSelect(); + select.setDetailSystem(detailSystem); + for (SuperHomeRecommendSpecial s : superHomeRecommendSpecialList) { + if (s.getDetailSystemId().equalsIgnoreCase(detailSystem.getId())) { + select.setSelected(true); + break; + } + } + selects.add(select); + } + + dto.setDetailSystemSelectList(selects); + dto.setSpecial(special); + dtoList.add(dto); + } + return dtoList; + } + + @Override + public long count(String systemId, String detailSystemId, String key) { + if (!StringUtil.isNullOrEmpty(detailSystemId)) { + return countSpecialByDetailSystemId(detailSystemId, key); + } else { + return countSpecialBySystemId(systemId, key); + } + } @Validated @Override @@ -48,18 +101,35 @@ } @Override - public List<HomeRecommendSpecial> listSpecialBySystemId(String systemId) { + public HomeRecommendSpecial getSpecial(String id) { + return homeRecommendSpecialDao.get(id); + } + + @Override + public List<HomeRecommendSpecial> listSpecialBySystemId(String systemId, String key, int page, int pageSize) { HomeRecommendSpecialDao.DaoQuery query = new HomeRecommendSpecialDao.DaoQuery(); query.systemId = systemId; - query.count = Integer.MAX_VALUE; + query.key = key; + query.start = (page - 1) * pageSize; + query.count = pageSize; return homeRecommendSpecialDao.list(query); } @Override - public List<HomeRecommendSpecial> listSpecialByDetailSystemId(String detailSystemId) { + public long countSpecialBySystemId(String systemId, String key) { + HomeRecommendSpecialDao.DaoQuery query = new HomeRecommendSpecialDao.DaoQuery(); + query.systemId = systemId; + query.key = key; + return homeRecommendSpecialDao.count(query); + } + + @Override + public List<HomeRecommendSpecial> listSpecialByDetailSystemId(String detailSystemId, String key, int page, int pageSize) { SuperHomeRecommendSpecialDao.DaoQuery query = new SuperHomeRecommendSpecialDao.DaoQuery(); query.detailSystemId = detailSystemId; - query.count = Integer.MAX_VALUE; + query.showName = key; + query.start = (page - 1) * pageSize; + query.count = pageSize; List<SuperHomeRecommendSpecial> list = superHomeRecommendSpecialDao.list(query); List<String> specialIds = new ArrayList<>(); for (SuperHomeRecommendSpecial special : list) { @@ -92,6 +162,14 @@ } @Override + public long countSpecialByDetailSystemId(String detailSystemId, String key) { + SuperHomeRecommendSpecialDao.DaoQuery query = new SuperHomeRecommendSpecialDao.DaoQuery(); + query.detailSystemId = detailSystemId; + query.showName = key; + return superHomeRecommendSpecialDao.count(query); + } + + @Override public void deleteSpecial(String specialId) { List<SuperHomeRecommendSpecial> list = listSuperSpecialBySpecialId(specialId); @@ -116,6 +194,11 @@ if (superSpecial.getWeight() == null) { superSpecial.setWeight(special.getWeight()); } + + if (superSpecial.getShowName() == null) { + superSpecial.setShowName(special.getName()); + } + if (superSpecial.getCreateTime() == null) superSpecial.setCreateTime(new Date()); superHomeRecommendSpecialDao.save(superSpecial); diff --git a/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java index 3d15e00..0783713 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java +++ b/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java @@ -25,4 +25,13 @@ public SystemConfig getConfigByKeyCache(String key) { return getConfigByKey(key); } + + @Cacheable(value = "configCache", key = "'system-getConfigValueByKey'+'-'+#key") + @Override + public String getConfigValueByKeyCache(String key) { + SystemConfig config = getConfigByKeyCache(key); + if (config == null) + return null; + return config.getValue(); + } } diff --git a/src/main/java/com/yeshi/buwan/service/inter/recommend/HomeRecommendSpecialService.java b/src/main/java/com/yeshi/buwan/service/inter/recommend/HomeRecommendSpecialService.java index c29bdb6..28eb8c5 100644 --- a/src/main/java/com/yeshi/buwan/service/inter/recommend/HomeRecommendSpecialService.java +++ b/src/main/java/com/yeshi/buwan/service/inter/recommend/HomeRecommendSpecialService.java @@ -2,12 +2,27 @@ import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; import com.yeshi.buwan.domain.recommend.SuperHomeRecommendSpecial; +import com.yeshi.buwan.dto.recommend.HomeRecommendSpecialDTO; import com.yeshi.buwan.exception.ParamsException; import javax.validation.Valid; import java.util.List; public interface HomeRecommendSpecialService { + + + /** + * 鍒楄〃 + * + * @param systemId + * @param detailSystemId + * @param key + * @return + */ + public List<HomeRecommendSpecialDTO> list(String systemId, String detailSystemId, String key, int page, int pageSize); + + public long count(String systemId, String detailSystemId, String key); + /** * 娣诲姞涓撻 @@ -26,12 +41,23 @@ public void updateSpecial(HomeRecommendSpecial special) throws Exception; /** + * 鑾峰彇涓撻 + * + * @param id + * @return + */ + public HomeRecommendSpecial getSpecial(String id); + + /** * 鏍规嵁绯荤粺ID妫�绱� * * @param systemId * @return */ - public List<HomeRecommendSpecial> listSpecialBySystemId(String systemId); + public List<HomeRecommendSpecial> listSpecialBySystemId(String systemId, String key, int page, int pageSize); + + + public long countSpecialBySystemId(String systemId, String key); /** * 鏍规嵁瀛愮郴缁烮D妫�绱� @@ -39,7 +65,9 @@ * @param detailSystemId * @return */ - public List<HomeRecommendSpecial> listSpecialByDetailSystemId(String detailSystemId); + public List<HomeRecommendSpecial> listSpecialByDetailSystemId(String detailSystemId, String key, int page, int pageSize); + + public long countSpecialByDetailSystemId(String detailSystemId, String key); /** diff --git a/src/main/java/com/yeshi/buwan/service/inter/system/SystemConfigService.java b/src/main/java/com/yeshi/buwan/service/inter/system/SystemConfigService.java index 1072682..5a9cac6 100644 --- a/src/main/java/com/yeshi/buwan/service/inter/system/SystemConfigService.java +++ b/src/main/java/com/yeshi/buwan/service/inter/system/SystemConfigService.java @@ -8,5 +8,10 @@ public SystemConfig getConfigByKeyCache(String key); - + /** + * 鑾峰彇鍊� + * @param key + * @return + */ + public String getConfigValueByKeyCache(String key); } diff --git a/src/main/java/com/yeshi/buwan/util/Constant.java b/src/main/java/com/yeshi/buwan/util/Constant.java index 9fcf2c5..71ce8fd 100644 --- a/src/main/java/com/yeshi/buwan/util/Constant.java +++ b/src/main/java/com/yeshi/buwan/util/Constant.java @@ -110,6 +110,10 @@ //鍔ㄦ极 public final static int VIDEO_TYPE_VIP_CARTOON = 100005; + + //鎼滅储鎺ュ彛杩斿洖鐨勯珮娓呯墖婧� + public final static int SEARCH_RESULT_TYPE_HIGH_DEFINITION = 9999; + public final static Integer[] vipTypes = new Integer[]{ VIDEO_TYPE_VIP, VIDEO_TYPE_VIP_MOVIE, VIDEO_TYPE_VIP_TV, VIDEO_TYPE_VIP_SHOW, VIDEO_TYPE_VIP_CARTOON }; diff --git a/src/main/java/com/yeshi/buwan/util/VersionUtil.java b/src/main/java/com/yeshi/buwan/util/VersionUtil.java index 3f81c02..33020cc 100644 --- a/src/main/java/com/yeshi/buwan/util/VersionUtil.java +++ b/src/main/java/com/yeshi/buwan/util/VersionUtil.java @@ -15,4 +15,10 @@ else return false; } + + public static boolean isGraterThan387(String platform, int version) { + if ("android".equalsIgnoreCase(platform) && version >= 106) + return true; + return false; + } } diff --git a/src/main/java/com/yeshi/buwan/util/log/VideoLogFactory.java b/src/main/java/com/yeshi/buwan/util/log/VideoLogFactory.java index 03eee8d..79a098c 100644 --- a/src/main/java/com/yeshi/buwan/util/log/VideoLogFactory.java +++ b/src/main/java/com/yeshi/buwan/util/log/VideoLogFactory.java @@ -53,8 +53,8 @@ * @param resourceId * @return */ - public static String createUserVideoDetailLog(String device, String loginUid, String detailSystemId, String videoId, String resourceId, String from) { - return String.format("getUserVideoDetail:%s#%s#%s#%s#%s#", device, loginUid, detailSystemId, videoId, resourceId, from); + public static String createUserVideoDetailLog(String device,String utdId, String loginUid, String detailSystemId, String videoId, String resourceId, String from) { + return String.format("getUserVideoDetail:%s#%s#%s#%s#%s#%s#", device,utdId, loginUid, detailSystemId, videoId, resourceId, from); } diff --git a/src/main/resources/domain/HomeAd.hbm.xml b/src/main/resources/domain/HomeAd.hbm.xml index 9985c71..d49affe 100644 --- a/src/main/resources/domain/HomeAd.hbm.xml +++ b/src/main/resources/domain/HomeAd.hbm.xml @@ -1,35 +1,32 @@ <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-mapping PUBLIC - "-//Hibernate/Hibernate Mapping DTD 3.0//EN" - "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.yeshi.buwan.domain"> - <class name="HomeAd" lazy="false" table="wk_video_homead"> - <id name="id" column="Id"> - <generator class="native"></generator> - </id> + <class name="HomeAd" lazy="false" table="wk_video_homead"> + <id name="id" column="Id"> + <generator class="native"></generator> + </id> - <property name="introduction" type="string"></property> - <property name="createtime" type="string"></property> - <property name="picture" type="string"></property> - <property name="endtime" type="string"></property> - <property name="beizhu" type="string"></property> - <property name="starttime" type="string"></property> - <property name="title" type="string"></property> - <property name="clazz" type="string"></property> - <property name="params" type="string"></property> - <property name="linkType" column="linktype" type="int"></property> - <property name="orderby" column="orderby" type="int"></property> - <many-to-one name="tag" column="tagid"></many-to-one> - <many-to-one name="admin" column="adminid"></many-to-one> - <many-to-one name="system" column="system" lazy="false"></many-to-one> - <many-to-one name="video" not-null="false"> - <column name="videoid" default="1"></column> - </many-to-one> - </class> - - - - + <property name="introduction" type="string"></property> + <property name="createtime" type="string"></property> + <property name="picture" type="string"></property> + <property name="endtime" type="string"></property> + <property name="beizhu" type="string"></property> + <property name="starttime" type="string"></property> + <property name="title" type="string"></property> + <property name="clazz" type="string"></property> + <property name="params" type="string"></property> + <property name="linkType" column="linktype" type="int"></property> + <property name="orderby" column="orderby" type="int"></property> + <property name="specialDataKey" column="special_data_key" type="string"></property> + <many-to-one name="tag" column="tagid"></many-to-one> + <many-to-one name="admin" column="adminid"></many-to-one> + <many-to-one name="system" column="system" lazy="false"></many-to-one> + <many-to-one name="video" not-null="false"> + <column name="videoid" default="1"></column> + </many-to-one> + </class> </hibernate-mapping> \ No newline at end of file diff --git a/src/main/resources/domain/HomeType.hbm.xml b/src/main/resources/domain/HomeType.hbm.xml index 1e7be5e..61a6818 100644 --- a/src/main/resources/domain/HomeType.hbm.xml +++ b/src/main/resources/domain/HomeType.hbm.xml @@ -1,48 +1,47 @@ <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-mapping PUBLIC - "-//Hibernate/Hibernate Mapping DTD 3.0//EN" - "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.yeshi.buwan.domain"> - <class name="HomeType" table="wk_video_hometype"> - <id name="id" column="id"> - <generator class="native"></generator> - </id> + <class name="HomeType" table="wk_video_hometype"> + <id name="id" column="id"> + <generator class="native"></generator> + </id> - <property name="createtime" type="string"></property> - <property name="name" type="string"></property> - <property name="orderby" type="string"></property> - <property name="beizhu" type="string"></property> - <property name="columns" type="int"> - <column name="columns" default="3"></column> - </property> - <property name="activity" type="string"></property> - <property name="iosControl" column="ioscontrol" type="string"></property> - <property name="params" type="string"></property> - <property name="hasMore" column="hasmore" type="boolean"></property> - <property name="needAd" column="need_ad" type="boolean"></property> - <property name="number" column="number" type="int"></property> - <many-to-one name="admin" column="adminid"></many-to-one> - <property name="icon" type="string"></property> - <list name="homeVideoList" lazy="false" inverse="true" cascade="delete"> - <key column="videoid"></key> - <index column="id"></index> - <one-to-many class="HomeVideo" /> - </list> - - <list name="itemTypeList" lazy="false" inverse="true" cascade="delete"> - <key column="parentid"></key> - <index column="id"></index> - <one-to-many class="HomeTypeItem" /> - </list> - <many-to-one name="videoType" column="vtid" class="VideoType"> - </many-to-one> - <many-to-one name="system" column="system"> - </many-to-one> - </class> + <property name="createtime" type="string"></property> + <property name="name" type="string"></property> + <property name="orderby" type="string"></property> + <property name="beizhu" type="string"></property> + <property name="columns" type="int"> + <column name="columns" default="3"></column> + </property> + <property name="activity" type="string"></property> + <property name="iosControl" column="ioscontrol" type="string"></property> + <property name="params" type="string"></property> + <property name="hasMore" column="hasmore" type="boolean"></property> + <property name="needAd" column="need_ad" type="boolean"></property> + <property name="number" column="number" type="int"></property> + <many-to-one name="admin" column="adminid"></many-to-one> + <property name="icon" type="string"></property> + <property name="specialDataKey" type="string" column="special_data_key"></property> + <list name="homeVideoList" lazy="false" inverse="true" cascade="delete"> + <key column="videoid"></key> + <index column="id"></index> + <one-to-many class="HomeVideo"/> + </list> - + <list name="itemTypeList" lazy="false" inverse="true" cascade="delete"> + <key column="parentid"></key> + <index column="id"></index> + <one-to-many class="HomeTypeItem"/> + </list> + <many-to-one name="videoType" column="vtid" class="VideoType"> + </many-to-one> + <many-to-one name="system" column="system"> + </many-to-one> + </class> </hibernate-mapping> \ No newline at end of file diff --git a/src/main/resources/env-pro/logback.xml b/src/main/resources/env-pro/logback.xml index 8c6f462..71081d7 100644 --- a/src/main/resources/env-pro/logback.xml +++ b/src/main/resources/env-pro/logback.xml @@ -112,6 +112,23 @@ </appender> + <appender name="videoPlayUserAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.filePath}/video/video_play_user.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${log.filePath}/video/video_play_user.%d{yyyy-MM-dd}.log.gz</fileNamePattern> + <maxHistory>${log.maxHistory}</maxHistory> + </rollingPolicy> + <encoder> + <pattern>${log.pattern}</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>INFO</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + </appender> + + <appender name="testAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.filePath}/test/test.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> @@ -153,11 +170,19 @@ <appender-ref ref="searchAppender"></appender-ref> </logger> + <logger name="com.yeshi.buwan.service.imp.SearchService" level="INFO" additivity="true"> + <appender-ref ref="searchAppender"></appender-ref> + </logger> + <logger name="videoPlay" level="INFO" additivity="true"> <appender-ref ref="videoPlayAppender"></appender-ref> </logger> + <logger name="videoPlayUser" level="INFO" additivity="true"> + <appender-ref ref="videoPlayUserAppender"></appender-ref> + </logger> + <logger name="com.yeshi.buwan" level="ERROR" additivity="true"> <appender-ref ref="ERROR_FILE"></appender-ref> diff --git a/src/main/webapp/admin/new/add-tuijian-home-labels.html b/src/main/webapp/admin/new/add-tuijian-home-labels.html new file mode 100644 index 0000000..852e2e4 --- /dev/null +++ b/src/main/webapp/admin/new/add-tuijian-home-labels.html @@ -0,0 +1,162 @@ +<html lang="zh-cn"> + +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="referrer" content="never"> + <title>娣诲姞椤堕儴鏍囩</title> + <link href="css/bootstrap.min.css" rel="stylesheet"> + <link href="css/maincontent.css" rel="stylesheet"> + <link href="css/tablestyle.css" rel="stylesheet"> + <style> + .form-group { + margin-bottom: 30px; + } + + .checkbox input[type=checkbox] { + top: 6px; + } + </style> +</head> + +<body> +<nav class="navbar navbar-default navbar-fixed-top"> +</nav> +<div id="mainbody"> + <div id="sidebar"> + <dl> + </dl> + </div> + <div id="neirong"> + <div class="erjidh"> + <ol class="breadcrumb"> + <li> + <a href="tuijian-home-labels.html">椤堕儴鏍囩</a> + </li> + <li class="active">娣诲姞鍐呭</li> + </ol> + </div> + <form class="form-horizontal" role="form"> + <div class="form-group"> + <label for="input1" class="changdu1 control-label">鍚嶇О</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="name" placeholder="蹇呴』濉啓"> + </div> + </div> + + <div class="form-group"> + <label for="input2" class="changdu1 control-label">鏉冮噸</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="weight" placeholder="蹇呴』濉啓"> + </div> + </div> + + + <div class="form-group"> + <label for="input2" class="changdu1 control-label">杞挱鍥炬瘮渚�</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="bannerSizeRate" placeholder="蹇呴』濉啓(澶ф瘮渚�0.56 灏忔瘮渚� 0.4375)"> + </div> + </div> + + <div class="form-group"> + <label for="input2" class="changdu1 control-label">鍞竴鏍囪瘑</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="dataKey" placeholder="蹇呴』濉啓"> + </div> + </div> + + <div class="form-group"> + <label for="input7" class="changdu1 control-label">濯掍綋</label> + <div class="col-sm-7 detailsystem"> + + </div> + </div> + <div class="button0"> + <div class="button"> + <button type="button" class="btn btn-primary save">淇濆瓨</button> + </div> + <div class="button"> + <input type="reset" class="btn btn-default" value="閲嶇疆"/> + </div> + </div> + </form> + + </div> +</div> + +<script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script> +<script src="js/bootstrap.min.js"></script> +<script src="js/nav.js"></script> +<script src="js/common.js"></script> +<script src="layer/layer.js"></script> +<script> + $(function () { + + $.post('api/videoType/getAllVideoType', function (data) { + if (data.code == 0) { + var list = data.list; + for (var i = 0; i < list.length; i++) { + var vt = list[i]; + var vid = vt.id; + $("#classtype").append("<option key='" + vid + "'>" + vt.name + "</option>") + } + } + + }, 'json') + + $.post('api/common/detailsystemlist', function (data) { + if (data.code == 0) { + var dsStr = ""; + data.data.forEach(function (ds) { + dsStr += "<div class='checkbox '><label>"; + dsStr += "<input type='checkbox' value=" + ds.id + ">"; + dsStr += " " + ds.name; + dsStr += "</label></div>"; + }); + $(".detailsystem").html(dsStr); + } + }, 'json'); + + $(".save").click(function () { + + var $detailsystems = $(".detailsystem input[type=checkbox]"); + var dess = ""; + for (var i = 0; i < $detailsystems.length; i++) { + if ($detailsystems.eq(i).is(":checked")) { + dess += $detailsystems.eq(i).val() + ","; + } + } + if (dess.length > 0) + dess = dess.substr(0, dess.length - 1); + + var index = layer.load(0, { + 'shade': false + }); + $.post('api/homerecommend/addSpecial', { + 'name': $("#name").val(), + 'weight': $("#weight").val(), + 'bannerSizeRate': $("#bannerSizeRate").val(), + 'dataKey': $("#dataKey").val(), + 'detailsystemids': dess, + }, function (data) { + layer.close(index); + if (data.code == 0) { + layer.msg("娣诲姞鎴愬姛"); + } else { + layer.msg(data.msg); + } + + doResponse(data, function () { + + }); + }, 'json'); + + }); + + }); +</script> +</body> + +</html> \ No newline at end of file diff --git a/src/main/webapp/admin/new/edit-tuijian-home-labels.html b/src/main/webapp/admin/new/edit-tuijian-home-labels.html new file mode 100644 index 0000000..4f73a9d --- /dev/null +++ b/src/main/webapp/admin/new/edit-tuijian-home-labels.html @@ -0,0 +1,136 @@ +<html lang="zh-cn"> + +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="referrer" content="never"> + <title>缂栬緫鏍忕洰</title> + <link href="css/bootstrap.min.css" rel="stylesheet"> + <link href="css/maincontent.css" rel="stylesheet"> + <link href="css/tablestyle.css" rel="stylesheet"> + <style> + .form-group { + margin-bottom: 30px; + } + + .checkbox input[type=checkbox] { + top: 6px; + } + </style> +</head> + +<body> +<nav class="navbar navbar-default navbar-fixed-top"> +</nav> +<div id="mainbody"> + <div id="sidebar"> + <dl> + </dl> + </div> + <div id="neirong"> + <div class="erjidh"> + <ol class="breadcrumb"> + <li> + <a href="tuijian-home-labels.html">椤堕儴鏍囩</a> + </li> + <li class="active">淇敼鍐呭</li> + </ol> + </div> + <form class="form-horizontal" role="form"> + <div class="form-group"> + <label class="changdu1 control-label">鍚嶇О</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="name" placeholder="" v-bind:value="special.name"> + </div> + </div> + + + <div class="form-group"> + <label class="changdu1 control-label">鏉冮噸</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="weight" placeholder="" v-bind:value="special.weight"> + </div> + </div> + + <div class="form-group"> + <label class="changdu1 control-label">杞挱鍥炬瘮渚�</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="bannerSizeRate" placeholder="锛�0-1锛�" + v-bind:value="special.bannerSizeRate"> + </div> + </div> + + + </form> + <div class="button0"> + <div class="button"> + <button type="button" class="btn btn-primary save" v-on:click="updateSpecial">淇濆瓨</button> + </div> + <div class="button"> + <a href="tuijian-home-labels.html" class="btn btn-default" role="button">鍙栨秷</a> + </div> + </div> + </div> +</div> + +<script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script> +<script src="js/bootstrap.min.js"></script> +<script src="js/nav.js"></script> +<script src="js/vue.min.js"></script> +<script src="js/common.js"></script> +<script src="layer/layer.js"></script> +<script> + function getQueryString(name) { + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); + var r = window.location.search.substr(1).match(reg); + if (r != null) return unescape(r[2]); + return null; + } + + $(function () { + var app = new Vue({ + el: "#neirong", + data: { + special: {} + }, + methods: { + requestSpecial() { + var index = layer.load(0, { + 'shade': false + }); + //鑾峰彇鍙傛暟 + var id = getQueryString("id"); + $.post('api/homerecommend/getSpecial', { + 'id': id + }, function (data) { + layer.close(index); + if (data.code == 0) { + app.special = data.data; + } else { + layer.msg("鏁版嵁鍔犺浇澶辫触"); + } + }, 'json'); + }, + updateSpecial() { + $.post('api/homerecommend/updateSpecial', { + id: app.special.id, + name: $("#name").val(), + weight: $("#weight").val(), + bannerSizeRate: $("#bannerSizeRate").val() + }, function (data) { + if (data.code == 0) { + layer.msg("淇敼鎴愬姛"); + } else { + layer.msg("鏁版嵁鍔犺浇澶辫触"); + } + }, 'json'); + } + } + }); + app.requestSpecial(); + }); +</script> +</body> + +</html> \ No newline at end of file diff --git a/src/main/webapp/admin/new/js/navsetting.xml b/src/main/webapp/admin/new/js/navsetting.xml index 1856af0..088d037 100644 --- a/src/main/webapp/admin/new/js/navsetting.xml +++ b/src/main/webapp/admin/new/js/navsetting.xml @@ -27,11 +27,19 @@ </topNav> <topNav url="tuijian-lanmuneirong.html" name="鎺ㄨ崘"> <!--浜岀骇鑿滃崟涓嬮潰鐨勪笢瑗� --> + + <secondNav url="tuijian-home-labels.html" name="椤堕儴鏍囩"> + <!-- 缃戦〉閾炬帴 --> + <url>add-tuijian-home-labels.html</url> + <url>edit-tuijian-home-labels.html</url> + <url>tuijian-home-labels.html</url> + </secondNav> + <secondNav url="tuijian-lanmuneirong.html" name="鏍忕洰鍐呭"> <!-- 缃戦〉閾炬帴 --> <url>add-lmneirong.html</url> <url>edit-lmneirong.html</url> - <url>tuijian-lanmuneirong-videos.html</url> + <url>tuijian-lanmuneirong.html</url> </secondNav> <secondNav url="tuijian-banner.html" name="鎺ㄨ崘Banner"> <!-- 缃戦〉閾炬帴 --> diff --git a/src/main/webapp/admin/new/systemcanshu.html b/src/main/webapp/admin/new/systemcanshu.html index 9e2425d..560d2b4 100644 --- a/src/main/webapp/admin/new/systemcanshu.html +++ b/src/main/webapp/admin/new/systemcanshu.html @@ -1,161 +1,152 @@ <html lang="zh-cn"> <head> -<meta charset="utf-8"> -<meta http-equiv="X-UA-Compatible" content="IE=edge"> -<meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="referrer" content="never"> -<title>绯荤粺鍙傛暟</title> -<link href="css/bootstrap.min.css" rel="stylesheet"> -<link href="css/maincontent.css" rel="stylesheet"> -<link href="css/tablestyle.css" rel="stylesheet"> -<!--[if lt IE 9]> - <script src="js/html5shiv.js"></script> - <script src="js/respond.min.js"></script> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="referrer" content="never"> + <title>绯荤粺鍙傛暟</title> + <link href="css/bootstrap.min.css" rel="stylesheet"> + <link href="css/maincontent.css" rel="stylesheet"> + <link href="css/tablestyle.css" rel="stylesheet"> + <!--[if lt IE 9]> + <script src="js/html5shiv.js"></script> + <script src="js/respond.min.js"></script> <![endif]--> </head> <body> -<nav class="navbar navbar-default navbar-fixed-top" role="navigation"> - <div class="container-fluid"> - <!-- Brand and toggle get grouped for better mobile display --> - <div class="navbar-header"> - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> - <a class="navbar-brand" href="#"> 瑙� 棰� 鍚� 鍙� 绠� 鐞� 绯� 缁� </a> </div> - - <!-- Collect the nav links, forms, and other content for toggling --> - <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> - <!-- <ul class="nav navbar-nav"> - <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">甯冧父瑙嗛<span class="caret"></span></a> - <ul class="dropdown-menu" role="menu"> - <li><a href="#">甯冧父瑙嗛</a></li> - <li class="divider"></li> - <li><a href="#">甯冧父褰辫澶у叏</a></li> - </ul> - </li> - </ul>--> - - <ul class="nav navbar-nav navbar-left"> - <li><a href="#">鏁版嵁</a></li> - <li><a href="tuijian-lanmuneirong.html">鎺ㄨ崘</a></li> - <li><a href="fenqu.html">鍒嗗尯</a></li> - <li><a href="faxian.html">鍙戠幇</a></li> - <li class="active"><a href="shezhi.html">璁剧疆</a></li> - </ul> - <ul class="nav navbar-nav navbar-right"> - <li class="hover"><a href="#">璐︽埛</a></li> - <li><a href="#">閫�鍑虹櫥褰�</a></li> - </ul> - </div> - <!-- /.navbar-collapse --> - </div> - <!-- /.container-fluid --> +<nav class="navbar navbar-default navbar-fixed-top"> + </nav> <div id="mainbody"> -<div id="sidebar"> - <dl> - <!-- <dt> - <div class="tubiao"><span class="glyphicon glyphicon-pencil"></span></div> - 鏁版嵁</dt>--> - <dd><a href="shezhi.html"> - <div class="cebiandh">TOP閫氱煡鏍�</div> - </a></dd> - <dd><a href="send-message.html"> - <div class="cebiandh">娑堟伅鎺ㄩ��</div> - </a></dd> - <dd><a href="share.html"> - <div class="cebiandh">鍒嗕韩鍐呭</div> - </a></dd> - <dd><a href="production.html"> - <div class="cebiandh">浜у搧淇℃伅</div> - </a></dd> - <dd><a href="systemlist.html"> - <div class="cebiandh">绯荤粺鍒楄〃</div> - </a></dd> - <dd><a href="systemcanshu.html"> - <div class="cebiandh1">绯荤粺鍙傛暟</div> - </a></dd> - </dl> -</div> -<div id="neirong"> - <div class="header"> - <h4 class="shujutitle">绯荤粺鍙傛暟璁剧疆</h4> - <div class="fenge"></div> - </div> - <table class="table canshu"> - <tbody> - <tr> - <td><form class="form-horizontal" role="form"> - <div class="form-group"> - <label for="input1" class="changdu3 control-label"></label> - <div class="col-sm-7"> - <input type="text" class="form-control" id="input1" placeholder=""> - </div> - </div> - </form></td> - </tr> - </tbody> - </table> - <div class="button0"> - <div class="button"> - <button type="button" name="save" class="btn btn-primary">淇濆瓨</button> + <div id="sidebar"> </div> - </div> + <div id="neirong"> + <div> + <div class="erjidh search-div" style="padding: 10px;display: flex;"> + + <div class="col-lg-2"> + <select name="select" class="form-control search detailsystem col-lg-2"> + <option v-for="item in apps" v-bind:value="item.id">{{item.name}}</option> + </select> + </div> + + <div class="form-group search col-lg-2" role="search" style="display: flex;"> + <input type="text" class="form-control search" id="kw" style="width: 200px;" placeholder="璇疯緭鍏ュ悕绉�"> + <button type="button" class="btn btn-default search-button" v-on:click="requestData">鎼滅储 + </button> + </div> + + + <div class="tianjia col-lg-8" style="text-align: right;display: none;"> + <a href="add-tuijian-home-labels.html" class="btn btn-primary" role="button">娣诲姞閰嶇疆 +</a> + </div> + + </div> + <div class="zhuti"> + <div> + <div v-for="item in configs" style="display: flex;margin-top: 10px;"> + <label class="col-lg-2" style="text-align: right">{{item.beizhu}}</label> + <div class="col-lg-6"> + <input type="text" :value="item.value" class="form-control content" + v-if="item.value.length<120"/> + <textarea class="form-control content" rows="5" v-else>{{item.value}}</textarea> + </div> + <div class="col-lg-1"> + <button class="form-control btn-primary" v-on:click="save(item,$event)">淇濆瓨</button> + </div> + </div> + </div> + </div> + </div> + </div> </div> -<script src="js/jquery.min.js"></script> +<script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="layer/layer.js"></script> <script src="js/nav.js"></script> +<script src="js/vue.min.js"></script> <script src="js/common.js"></script> <script type="text/javascript"> - - $(function(){ - var htmltemp = $(".canshu").prop("outerHTML"); - $(".canshu").remove(".canshu"); - - $.post("api/config/configList",{},function(data){ - if(data.code==0){ - var configList = data.configList; - for (var ii=0,mm =1;ii<configList.length;ii++,mm++) { - if(ii==0){ - $(".header").after(htmltemp); - }else{ - $(".canshu:last").after(htmltemp); - } - $(".canshu:last").find("label").text(configList[ii].beizhu); - $(".canshu:last").find("input").attr("key",configList[ii].key); - $(".canshu:last").find("input").attr("id",configList[ii].key); - $(".canshu:last").find("input").val(configList[ii].value); - } - }else{ - layer.msg("鑾峰彇淇℃伅澶辫触锛�"); - } - },"json"); - - $("button[name='save']").bind("click",function(){ - var vals ={}; - $(".canshu").each(function(){ - var key = $(this).find("input").attr("key"); - var values = $(this).find("input").val(); - vals[key]= values; - }); - $.post("api/config/updateConfig",{"vals":JSON.stringify(vals)},function(data){ - if(data == "yes") { - layer.alert('淇濆瓨鎴愬姛锛�', { - icon: 1, - skin: 'layer-ext-seaing' - }) - }else{ - layer.alert('淇濆瓨澶辫触锛�', { - icon: 2, - skin: 'layer-ext-seaing' - }) - } - },"text"); - }); - - }); - - - + + + $(function () { + var app = new Vue({ + el: "#neirong", + data: { + apps: [], + configs: [] + }, + methods: { + getDetailSystemList: function () { + $.post('api/common/detailsystemlist', function (data) { + if (data.code == 0) { + app.apps = data.data; + } + }, 'json'); + }, + requestData: function () { + $.post("api/config/configList", { + detailSystemId: $(".detailsystem").val(), + key: $("#kw").val() + }, function (data) { + if (data.code == 0) { + app.configs = data.configList; + } else { + layer.msg("鑾峰彇淇℃伅澶辫触锛�"); + } + }, "json"); + }, + save: function (config, e) { + $.post("api/config/updateConfig", { + id: config.id, + value: $(e.target).parent().parent().find(".content").val() + }, function (data) { + if (data.code == 0) { + layer.alert('淇濆瓨鎴愬姛锛�', { + icon: 1, + skin: 'layer-ext-seaing' + }) + } else { + layer.alert(data.msg, { + icon: 2, + skin: 'layer-ext-seaing' + }) + } + }, "json"); + } + } + }); + app.getDetailSystemList(); + setTimeout(function () { + app.requestData(); + }, 2000); + + + // $("button[name='save']").bind("click", function () { + // var vals = {}; + // $(".canshu").each(function () { + // var key = $(this).find("input").attr("key"); + // var values = $(this).find("input").val(); + // vals[key] = values; + // }); + // $.post("api/config/updateConfig", {"vals": JSON.stringify(vals)}, function (data) { + // if (data == "yes") { + // layer.alert('淇濆瓨鎴愬姛锛�', { + // icon: 1, + // skin: 'layer-ext-seaing' + // }) + // } else { + // layer.alert('淇濆瓨澶辫触锛�', { + // icon: 2, + // skin: 'layer-ext-seaing' + // }) + // } + // }, "text"); + // }); + + }); + + </script> </body> </html> \ No newline at end of file diff --git a/src/main/webapp/admin/new/tuijian-home-labels.html b/src/main/webapp/admin/new/tuijian-home-labels.html new file mode 100644 index 0000000..0cf0ac4 --- /dev/null +++ b/src/main/webapp/admin/new/tuijian-home-labels.html @@ -0,0 +1,285 @@ +<html lang="zh-cn"> + +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="referrer" content="never"> + <title>鎺ㄨ崘-鏍忕洰鍐呭</title> + <link href="css/bootstrap.min.css" rel="stylesheet"> + <link href="css/maincontent.css" rel="stylesheet"> + <style> + .search { + display: inline; + width: auto; + } + </style> + +</head> + +<body> +<nav class="navbar navbar-default navbar-fixed-top"> + +</nav> +<div id="mainbody"> + <div id="sidebar"> + + </div> + <div id="neirong"> + <div class="erjidh search-div" style="padding: 10px;"> + + <select name="select" class="form-control search select-detailsystem"> + + </select> + + <div class="form-group search" role="search"> + <input type="text" class="form-control search" id="kw" style="width: 200px;" placeholder="鎼滅储"> + </div> + <button type="button" class="btn btn-default search-button">鎼滅储</button> + + <div class="tianjia" class="search"> + <a href="add-tuijian-home-labels.html" class="btn btn-primary" role="button">娣诲姞鏍囩 +</a> + </div> + + </div> + <div class="zhuti"> + <div class="zhutisousuo"> + <table class="table"> + <thead> + <th width="5%">閫夋嫨</th> + <th width="10%">缂栧彿</th> + <th width="9%">鏍囩鍚嶇О</th> + <th width="20%">APP鍚嶇О</th> + <th width="8%">杞挱鍥鹃珮瀹芥瘮</th> + <th width="8%">涓撻鍏抽敭璇�</th> + <th width="10%">鎺掑簭鍊�</th> + <th width="12%">鍒涘缓鏃堕棿</th> + <th width="12%">鏇存柊鏃堕棿</th> + <th width="5%">鍒犻櫎</th> + <th width="5%">缂栬緫</th> + </thead> + + <tbody> + <tr v-for="(item,index) in list"> + <td> + <div class="xuanze"> + <label> + <input type="checkbox" class="check-item" v-bind:keys="item.special.id" + value="#"> + </label> + </div> + </td> + <td> + <div class="bianhao">{{item.special.id}}</div> + </td> + <td> + <div class="bianhao name"> + <a href="#">{{item.special.name}}</a> + </div> + </td> + + <td class="apps"> + <div class="appname" v-for="ds in item.detailSystemSelectList"> + <div class="checkbox"> + <label> + <input type="checkbox" value="#" v-bind:checked="ds.selected" + v-on:click="changeSuper(item.special.id,ds.detailSystem.id,$event)"> + {{ds.detailSystem.appName}}</label> + </div> + </div> + </td> + <td style="text-align:center;line-height:105px;">{{item.special.bannerSizeRate}}</td> + <td style="text-align:center;line-height:105px;">{{item.special.dataKey}}</td> + <td style="text-align:center;line-height:105px;">{{item.special.weight}}</td> + <td style="text-align:center;line-height:105px;" class="">{{item.special.createTime}}</td> + <td style="text-align:center;line-height:105px;" class="">{{item.special.updateTime}}</td> + <td> + <div class="anniu"><img src="image/dustbin.png" class="delete" + v-on:click="deleteSpecial(item.special.id,index)"> + </div> + </td> + <td> + <div class="anniu"> + <a v-bind:keys="item.special.id" href="javascript:void(0)" class="edit" + v-on:click="edit(item.special.id)"><img + src="image/bianji.png"></a> + </div> + </td> + </tr> + </tbody> + + </table> + </div> + </div> + <div class="bottom"> + <div class="qx"> + <div class="checkbox"> + <label> + <input type="checkbox" class="check-all" value="#"> + 鍏ㄩ��</label> + </div> + </div> + <button class="btn btn-warning pl-del" type="button">鎵归噺鍒犻櫎</button> + <div class="page"> + <ul class="pagination"> + <li class="disabled pre"> + <a href="#">«</a> + </li> + <li class="active"> + <a href="#">1</a> + </li> + <li> + <a href="#">2</a> + </li> + <li> + <a href="#" class="next">»</a> + </li> + </ul> + <div class="form-group"> + <div class="tzan"> + <button type="button" class="btn btn-primary">璺宠浆</button> + </div> + <div class="tz"> + <input class="form-control" type="text" placeholder="椤垫暟"> + </div> + </div> + </div> + + </div> + </div> + <script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script> + <script src="js/bootstrap.min.js"></script> + <script src="js/page.js"></script> + <script src="js/nav.js"></script> + <script src="js/common.js"></script> + <script src="js/vue.min.js"></script> + <script src="layer/layer.js"></script> + <script> + $(function () { + + var app = new Vue({ + el: "#neirong", + data: { + list: [], + }, + methods: { + specialList: function (page) { + var index = layer.load(1, { + shade: false + }) + $.post('api/homerecommend/getSpcialList', { + "page": page, + "detailSystemId": $(".search-div .select-detailsystem").val(), + "key": $("#kw").val() + }, function (data) { + layer.close(index); + if (data.code != 0) + return; + app.list = data.data.data; + + fillPage(data.data.pageEntity, function (pageIndex) { + app.specialList(pageIndex); + }); + }, 'json'); + }, + changeSuper: function (id, detailSystemId, e) { + if ($(e.target).is(":checked")) { + $.post('api/homerecommend/addSuperSpecial', { + "id": id, + "detailSystemId": detailSystemId + }, function (data) { + if (data.code != 0) { + layer.msg(data.msg); + } else { + layer.msg("鎿嶄綔鎴愬姛"); + } + }, 'json'); + } else { + $.post('api/homerecommend/deleteSuperSpecial', { + "id": id, + "detailSystemId": detailSystemId + }, function (data) { + if (data.code != 0) { + layer.msg(data.msg); + } else { + layer.msg("鎿嶄綔鎴愬姛"); + } + }, 'json'); + } + }, + deleteSpecial: function (id, index) { + var indexDialog = layer.confirm('鏄惁鍒犻櫎璇ユ潯鐩紵', { + btn: ['鏄�', '鍚�'] //鎸夐挳 + }, function () { + $.post('api/homerecommend/deleteSpcial', { + 'ids': id + }, function (data) { + layer.close(indexDialog); + if (data.code == 0) { + if (index > -1) { + app.list.splice(index, 1); + } else { + var ids = id.split(","); + console.log(ids); + for (var i = 0; i < ids.length; i++) { + for (var j = 0; j < app.list.length; j++) { + console.log(app.list[j].special.id + ":" + ids[i]) + if (app.list[j].special.id == ids[i]) { + app.list.splice(j, 1); + break; + } + } + } + } + layer.msg("鍒犻櫎鎴愬姛"); + } else { + layer.msg(data.msg); + } + }, 'json'); + }, function () { + + }); + }, + edit: function (id) { + window.location.href = "edit-tuijian-home-labels.html?id=" + id; + } + } + + + }); + + $(".search-div .search-button").click(function () { + app.specialList(1); + }); + + app.specialList(1); + + function getCheckedItems() { + var ids = ""; + for (var i = 0; i < $(".check-item").length; i++) { + if ($(".check-item").eq(i).is(':checked')) { + ids += $(".check-item").eq(i).attr("keys") + ","; + } + } + if (ids.length > 0) + ids = ids.substr(0, ids.length - 1); + return ids; + } + + $(".pl-del").click(function () { + var ids = getCheckedItems(); + if (ids.length < 1) { + layer.msg("璇烽�夋嫨鏍忕洰"); + return; + } + + app.deleteSpecial(ids, -1); + + }); + + }); + </script> + +</body> + +</html> \ No newline at end of file diff --git a/src/test/java/com/hxh/spring/test/AlipayTest.java b/src/test/java/com/hxh/spring/test/AlipayTest.java index 205aa75..dd3466c 100644 --- a/src/test/java/com/hxh/spring/test/AlipayTest.java +++ b/src/test/java/com/hxh/spring/test/AlipayTest.java @@ -85,9 +85,9 @@ @Test public void refound() { - String orderNo = "buwan_vip_80"; + String orderNo = "buwan_vip_107"; try { - AlipayH5PayUtil.refund(getAppInfo(), orderNo, null, new BigDecimal("14.8"), orderNo+"_1"); + AlipayH5PayUtil.refund(getAppInfo(), orderNo, null, new BigDecimal("15"), orderNo+"_1"); } catch (AlipayApiException e) { e.printStackTrace(); } diff --git a/src/test/java/com/hxh/spring/test/ConfigTest.java b/src/test/java/com/hxh/spring/test/ConfigTest.java index ce101e0..2470804 100644 --- a/src/test/java/com/hxh/spring/test/ConfigTest.java +++ b/src/test/java/com/hxh/spring/test/ConfigTest.java @@ -1,8 +1,15 @@ package com.hxh.spring.test; +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.job.AdJob; +import com.yeshi.buwan.service.imp.DetailSystemConfigService; import com.yeshi.buwan.service.inter.system.SystemConfigService; import org.json.JSONObject; import org.junit.Test; @@ -12,6 +19,8 @@ import org.springframework.test.context.web.WebAppConfiguration; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.BigInteger; import java.util.Date; @RunWith(SpringJUnit4ClassRunner.class) @@ -24,6 +33,8 @@ @Resource private SystemConfigDao systemConfigDao; + @Resource + private DetailSystemConfigDao detailSystemConfigDao; @Test @@ -36,6 +47,30 @@ systemConfig.setCreateTime(new Date()); systemConfig.setId(SystemConfig.createId(systemConfig.getKey())); systemConfigDao.save(systemConfig); + + systemConfig = new SystemConfig(); + systemConfig.setBeizhu(""); + systemConfig.setKey("default_portrait"); + systemConfig.setName("榛樿澶村儚"); + systemConfig.setValue("https://buwan-1255749512.cos.ap-guangzhou.myqcloud.com/resource/ic_portrait_default.png"); + systemConfig.setCreateTime(new Date()); + systemConfig.setId(SystemConfig.createId(systemConfig.getKey())); + systemConfigDao.save(systemConfig); + } + + + @Test + public void addConfig() { + + DetailSystemConfig config = new DetailSystemConfig(); + config.setKey("web_speed_up_host"); + config.setValue("vip.ysdq.yeshitv.com"); + config.setBeizhu("缃戦〉鍔犻�熷煙鍚�"); + config.setSystemId(new BigInteger(44 + "")); + config.setMinVersion(106); + config.setCreatetime(System.currentTimeMillis() + ""); + detailSystemConfigDao.save(config); + } diff --git a/src/test/java/com/hxh/spring/test/LogTest.java b/src/test/java/com/hxh/spring/test/LogTest.java index b6126f8..6a14b9d 100644 --- a/src/test/java/com/hxh/spring/test/LogTest.java +++ b/src/test/java/com/hxh/spring/test/LogTest.java @@ -6,7 +6,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.util.Scanner; +import java.util.*; public class LogTest { @@ -16,14 +16,72 @@ public void testLog() throws FileNotFoundException { int count = 0; String path = ""; - Scanner scanner = new Scanner(new FileInputStream("C:\\Users\\Administrator\\Desktop\\鏃ュ織\\甯冧父鎾斁\\video_play.2021-03-05.log")); + Scanner scanner = new Scanner(new FileInputStream("C:\\Users\\Administrator\\Desktop\\鏃ュ織\\甯冧父鎾斁\\video_play.2021-03-12.log")); while (scanner.hasNextLine()) { String text = scanner.nextLine(); - if (text != null && text.contains("getVideoDetail:")) { + if (text != null && text.contains("getUserVideoDetail:")) { + String content = text.split("getUserVideoDetail:")[1]; + content = content.replace("##", "# #"); + String[] sts = content.split("#"); + // device,utdId, loginUid, detailSystemId, videoId, resourceId, from + resource(sts[4]); + video(sts[3]); + count++; } } scanner.close(); System.out.println(count); + printMap(resourceMap); + printMap(videoMap); } + + Map<String, Integer> resourceMap = new HashMap<>(); + + + private void resource(String resourceId) { + Integer r = resourceMap.get(resourceId); + if (r == null) { + resourceMap.put(resourceId, 0); + } + resourceMap.put(resourceId, resourceMap.get(resourceId) + 1); + } + + Map<String, Integer> videoMap = new HashMap<>(); + + private void video(String videoId) { + Integer r = videoMap.get(videoId); + if (r == null) { + videoMap.put(videoId, 0); + } + videoMap.put(videoId, videoMap.get(videoId) + 1); + } + + private void printMap(Map<String, Integer> map) { + //list鎺掑簭 + TreeMap<Integer, Set<String>> ordersMap = new TreeMap<>(Comparator.reverseOrder()); + for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) { + String key = its.next(); + Integer value = map.get(key); + if (ordersMap.get(value) == null) { + ordersMap.put(value, new HashSet<>()); + } + ordersMap.get(value).add(key); + } + + + + + + int p = 0; + for (Iterator<Integer> its = ordersMap.keySet().iterator(); its.hasNext(); ) { + Integer key = its.next(); + System.out.println(key + ":" + ordersMap.get(key)); + p++; + if (p > 100) { + break; + } + } + } + } diff --git a/src/test/java/com/hxh/spring/test/PPTVTest.java b/src/test/java/com/hxh/spring/test/PPTVTest.java index 3bdc1b5..03cc422 100644 --- a/src/test/java/com/hxh/spring/test/PPTVTest.java +++ b/src/test/java/com/hxh/spring/test/PPTVTest.java @@ -7,7 +7,14 @@ import com.yeshi.buwan.pptv.entity.PPTVSeries; import com.yeshi.buwan.service.inter.LoginUserService; import com.yeshi.buwan.service.inter.juhe.PPTVService; +import com.yeshi.buwan.util.StringUtil; import com.yeshi.buwan.util.log.LoggerUtil; +import jxl.Sheet; +import jxl.Workbook; +import jxl.write.Label; +import jxl.write.WritableCell; +import jxl.write.WritableSheet; +import jxl.write.WritableWorkbook; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.data.mongodb.core.query.Criteria; @@ -18,7 +25,9 @@ import org.yeshi.utils.HtmlToolUtil; import javax.annotation.Resource; -import java.util.List; +import java.io.File; +import java.io.FileInputStream; +import java.util.*; @RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 @@ -42,7 +51,7 @@ @Test public void saveAll() { List<PPTVSeries> list = PPTVApiUtil.getTotalList(); - pptvService.save(list); +// pptvService.save(list); } @Test @@ -58,11 +67,6 @@ } } - @Test - public void getDetail() { - PPTVSeries pptvSeries = pptvService.getSeriesDetail("201161"); - System.out.println(pptvSeries); - } @Test public void test() { @@ -143,7 +147,7 @@ } @Test - public void reAddVideo(){ + public void reAddVideo() { reAdd("姝︽灄澶栦紶"); } @@ -164,10 +168,94 @@ } } + private List<String[]> getPPTVVideos(File f, int sheetNum) { + List<String[]> videoList = new ArrayList<>(); + try { + jxl.Workbook rwb = Workbook.getWorkbook(new FileInputStream(f)); + Sheet sheet = rwb.getSheet(sheetNum); + for (int c = 1; c < sheet.getRows(); c++) { + String infoId = sheet.getCell(0, c).getContents().trim(); + String name = sheet.getCell(2, c).getContents().trim(); + String del = sheet.getCell(21, c).getContents().trim(); + if (!StringUtil.isNullOrEmpty(infoId) && StringUtil.isNullOrEmpty(del)) { + videoList.add(new String[]{infoId, name, del}); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return videoList; + } + + + @Test + public void checkPPTVVideos() { + List<String[]> list1 = getPPTVVideos(new File("C:\\Users\\Administrator\\Desktop\\鍏ㄩ噺.xls"), 0); + List<String[]> list2 = getPPTVVideos(new File("C:\\Users\\Administrator\\Desktop\\鍏ㄩ噺.xls"), 1); + Map<String, String[]> map = new TreeMap<>(); + for (String[] sts : list1) { + map.put(sts[0], sts); + } + + for (String[] sts : list2) { + map.put(sts[0], sts); + } + + List<PPTVSeries> list = pptvSeriesDao.list(0, 10000); + Set<String> infoIds = new HashSet<>(); + for (PPTVSeries s : list) { + infoIds.add(s.getInfoID()); + } + + for (String infoId : infoIds) { + map.remove(infoId); + } + + try { + save(map); + } catch (Exception e) { + e.printStackTrace(); + } + + System.out.println(map); + } + + private void save(Map<String, String[]> data) throws Exception { + WritableWorkbook wwb = Workbook.createWorkbook(new File("C:\\Users\\Administrator\\Desktop\\甯冧父杈撳嚭鐗囧崟_缂哄け.xls")); + WritableSheet sheet = wwb.createSheet("缂哄け", 0); + sheet.addCell((WritableCell) new Label(0, 0, "鐧剧ID")); + sheet.addCell((WritableCell) new Label(1, 0, "鍚嶇О")); + int row = 1; + for (Iterator<String> its = data.keySet().iterator(); its.hasNext(); ) { + String key = its.next(); + sheet.addCell((WritableCell) new Label(0, row, key)); + sheet.addCell((WritableCell) new Label(1, row, data.get(key)[1])); + row++; + } + wwb.write(); + wwb.close(); + } + @Test public void logs() { - LoggerUtil.getVIPLogger().info("123123"); +// LoggerUtil.getVIPLogger().info("123123"); + + Map<String, String[]> data = new TreeMap<>(); + data.put("4234234", new String[]{"4234234", "娴嬭瘯"}); + try { + save(data); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void getDetail() { + PPTVSeries series = PPTVApiUtil.getDetail("32385373"); + pptvService.save(series); + System.out.println(series); } diff --git a/src/test/java/com/hxh/spring/test/vip/VIPTest.java b/src/test/java/com/hxh/spring/test/vip/VIPTest.java index f263daf..96922ce 100644 --- a/src/test/java/com/hxh/spring/test/vip/VIPTest.java +++ b/src/test/java/com/hxh/spring/test/vip/VIPTest.java @@ -53,8 +53,7 @@ @Test public void addVIPPrice() { VIPPrice price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("8.8")); - price.setActualPrice(new BigDecimal("14.8")); + price.setActualPrice(new BigDecimal("8.8")); price.setPrice(new BigDecimal("14.8")); price.setType(VIPPriceType.month); price.setPptvGoodsNo("DA7559531560894"); @@ -66,8 +65,7 @@ } price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("22.8")); - price.setActualPrice(new BigDecimal("37.8")); + price.setActualPrice(new BigDecimal("22.8")); price.setPrice(new BigDecimal("37.8")); price.setType(VIPPriceType.season); price.setPptvGoodsNo("DA7559574625089"); @@ -80,8 +78,7 @@ price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("42")); - price.setActualPrice(new BigDecimal("68.8")); + price.setActualPrice(new BigDecimal("42")); price.setPrice(new BigDecimal("68.8")); price.setType(VIPPriceType.halfYear); price.setPptvGoodsNo("DA6989580247516"); @@ -94,8 +91,7 @@ price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("77.8")); - price.setActualPrice(new BigDecimal("128.8")); + price.setActualPrice(new BigDecimal("77.8")); price.setPrice(new BigDecimal("128.8")); price.setType(VIPPriceType.year); price.setPptvGoodsNo("DA8129574268091"); -- Gitblit v1.8.0