admin
2021-03-01 d73687bc6115007145b4aab050e4e29ff87fd8ae
布丸代码优化
29个文件已删除
78个文件已修改
4个文件已添加
15247 ■■■■ 已修改文件
src/main/java/com/yeshi/buwan/aspect/LoginAspect.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/aspect/SignAspect.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/BanQuanController.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/ClassAdminController.java 443 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/HomeAdAdminController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/HomeTypeAdminController.java 770 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/HotSearchAdminController.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/HotStarAdminController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/SpecialAdminController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/UserBannerAdminController.java 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/VideoController.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/VideoTypeController.java 767 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/ClassController.java 586 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/HomeBannerController.java 336 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/HomeTypeController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/HotSearchController.java 214 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/HotStarController.java 265 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/SpecialController.java 457 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/SystemController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/VideoAdminController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/VideoTypeAdminController.java 320 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/api/PushController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/AdParser.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/AttentionParser.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/CommentParser.java 91 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/NewsParser.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/UserParser.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/web/WebUserParser.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/push/PushDeviceToken.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/special/Special.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/user/LoginUserExtra.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dto/search/SolrVideoSearchFilter.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dto/user/LoginInfoDto.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dto/user/QQUserInfo.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/exception/LoginUserException.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/exception/user/LoginUserException.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/exception/user/RegisterUserException.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/AdService.java 745 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/AdminUserService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/AttentionService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/BanQuanService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/CategoryAreaService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/CategoryVideoRecommendService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/ClassService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/CollectionService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/CommentService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/ConfigService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/HomeAdService.java 440 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/HomeNoticeService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/HotVideoTypeService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/ImageService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/IntersectionService.java 203 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/LoginUserServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/OtherService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/RecommendService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/SearchService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/ShareService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/SpecialService.java 465 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/StarService.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/SystemService.java 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/UserBannerService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/UserService.java 261 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/VideoService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/WeiXinService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/juhe/IqiyiService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/juhe/SoHuService.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/news/NewsService.java 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/news/SouGouService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/push/PushService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/recommend/CategoryRecommendVideoService.java 390 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/inter/LoginUserService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/manager/SolrAlbumDataManager.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/sohu/SoHuUtil.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/SystemUtil.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/news/SouGouParser.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/push/PushUtil.java 431 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/AdminUserAction.java 222 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/BanQuanAction.java 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/CategoryRecommendVideoAction.java 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/CommonAdAction.java 301 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/ConfigAction.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/HomeAdAction.java 364 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/HomeNoticeAction.java 271 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/HomeTypeAction.java 306 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/HomeVideoAction.java 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/HotSearchAction.java 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/HotStarAction.java 287 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/LoginAction.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/PictureCheckCodeServlet.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/PushAction.java 236 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/RecommendAdAction.java 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/ShareAction.java 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/SpecialAction.java 296 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/SpecialVideoAction.java 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/StatisticsAction.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/SystemAction.java 347 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/TypeAction.java 224 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/UserBannerAction.java 247 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/VideoDetailAction.java 277 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/VideoIntersectionAction.java 274 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/VideoTypeAction.java 281 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/VideosAction.java 443 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/web/action/WXAdAction.java 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/domain/special/Special.hbm.xml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/env-dev/logback.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/struts.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/admin/new/fenqu.html 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/hxh/spring/test/GeneralTest.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/hxh/spring/test/HelloWordTest.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/aspect/LoginAspect.java
@@ -25,10 +25,10 @@
        ServletRequestAttributes servletContainer = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
        
        HttpServletRequest request = servletContainer.getRequest();
//        AdminInfo admin = (AdminInfo) request.getSession().getAttribute(Constant.ADMIN);
//        if(admin==null){
//            return null;
//        }
        AdminInfo admin = (AdminInfo) request.getSession().getAttribute(Constant.ADMIN);
        if(admin==null){
            return null;
        }
        Object[] args = joinPoint.getArgs();
        Object obj = null;
        try {
src/main/java/com/yeshi/buwan/aspect/SignAspect.java
@@ -11,12 +11,14 @@
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.yeshi.utils.StringUtil;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
@Component
@Aspect
@@ -33,11 +35,11 @@
        HttpServletRequest request = servletContainer.getRequest();
        HttpServletResponse response = servletContainer.getResponse();
        PrintWriter out = null;
        AcceptData acceptData = null;
        Object[] args = joinPoint.getArgs();
        for (Object obj : args) {
            if (obj instanceof AcceptData) {
                AcceptData acceptData = (AcceptData) obj;
                acceptData = (AcceptData) obj;
                if (acceptData != null) {
                    if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
                        acceptData.setChannel("appstore");
@@ -52,11 +54,36 @@
            }
        }
        if (!Utils.signIsRight(request)) {
            if (out == null)
                out = response.getWriter();
            out.print(JsonUtil.loadFalseJson("签名错误"));
            return null;
        //如果是Android新版本则调用新的签名方法
        //布丸3.8.7之后调用新的签名方法
        if (acceptData != null && "android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) {
            Map<String, String[]> params = request.getParameterMap();
            //签名
            List<String> list = new ArrayList<>();
            for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) {
                String key = its.next();
                if ("sign".equalsIgnoreCase(key))
                    continue;
                list.add(key + "=" + params.get(key)[0]);
            }
            Collections.sort(list);
            String str = StringUtil.concat(list, "&");
            String sign = StringUtil.Md5(str + "8888B&*@-uWan88/',@@^");
            if (!sign.equalsIgnoreCase(acceptData.getSign())) {
                if (out == null)
                    out = response.getWriter();
                System.out.println("签名错误");
                out.print(JsonUtil.loadFalseJson("签名错误"));
            }
        } else {
            if (!Utils.signIsRight(request)) {
                if (out == null)
                    out = response.getWriter();
                out.print(JsonUtil.loadFalseJson("签名错误"));
                return null;
            }
        }
        Object obj = null;
src/main/java/com/yeshi/buwan/controller/admin/BanQuanController.java
@@ -74,77 +74,6 @@
    @Resource
    private HomeNoticeService homeNoticeService;
    public BanQuanService getBanQuanService() {
        return banQuanService;
    }
    public void setBanQuanService(BanQuanService banQuanService) {
        this.banQuanService = banQuanService;
    }
    public HomeAdService getHomeAdService() {
        return homeAdService;
    }
    public void setHomeAdService(HomeAdService homeAdService) {
        this.homeAdService = homeAdService;
    }
    public HomeTypeService getHomeTypeService() {
        return homeTypeService;
    }
    public void setHomeTypeService(HomeTypeService homeTypeService) {
        this.homeTypeService = homeTypeService;
    }
    public ClassService getClassService() {
        return classService;
    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
    public AdService getAdService() {
        return adService;
    }
    public void setAdService(AdService adService) {
        this.adService = adService;
    }
    public SearchService getSearchService() {
        return searchService;
    }
    public void setSearchService(SearchService searchService) {
        this.searchService = searchService;
    }
    public HotVideoTypeService getHotVideoTypeService() {
        return hotVideoTypeService;
    }
    public void setHotVideoTypeService(HotVideoTypeService hotVideoTypeService) {
        this.hotVideoTypeService = hotVideoTypeService;
    }
    public UserBannerService getUserBannerService() {
        return userBannerService;
    }
    public void setUserBannerService(UserBannerService userBannerService) {
        this.userBannerService = userBannerService;
    }
    public HomeNoticeService getHomeNoticeService() {
        return homeNoticeService;
    }
    public void setHomeNoticeService(HomeNoticeService homeNoticeService) {
        this.homeNoticeService = homeNoticeService;
    }
    @RequestMapping(value = "/BanQuanServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest request, PrintWriter out) {
src/main/java/com/yeshi/buwan/controller/admin/ClassAdminController.java
@@ -1,295 +1,242 @@
package com.yeshi.buwan.controller.admin;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.HomeVideo;
import com.yeshi.buwan.domain.HotVideoType;
import com.yeshi.buwan.domain.SuperHotType;
import com.yeshi.buwan.domain.SuperVideoType;
import com.yeshi.buwan.domain.VideoType;
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.domain.web.CategoryRecommendVideoAdmin;
import com.yeshi.buwan.service.imp.ClassService;
import com.yeshi.buwan.service.imp.HomeTypeService;
import com.yeshi.buwan.service.imp.HotVideoTypeService;
import com.yeshi.buwan.service.imp.SystemService;
import com.yeshi.buwan.service.imp.recommend.CategoryRecommendVideoService;
import com.yeshi.buwan.util.Constant;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.SystemUtil;
import com.yeshi.buwan.web.tag.PageEntity;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("")
public class ClassAdminController {
    @Resource
    private HotVideoTypeService hotVideoTypeService;
    @Resource
    private HotVideoTypeService hotVideoTypeService;
    @Resource
    private ClassService classService;
    @Resource
    private ClassService classService;
    @Resource
    private HomeTypeService homeTypeService;
    @Resource
    private CategoryRecommendVideoService categoryRecommendVideoService;
    @Resource
    private SystemService systemService;
    private String key;
    private int pageIndex;
    private int detailsystem;
    public CategoryRecommendVideoService getCategoryRecommendVideoService() {
        return categoryRecommendVideoService;
    }
    @Resource
    private HomeTypeService homeTypeService;
    public void setCategoryRecommendVideoService(
            CategoryRecommendVideoService categoryRecommendVideoService) {
        this.categoryRecommendVideoService = categoryRecommendVideoService;
    }
    @Resource
    private CategoryRecommendVideoService categoryRecommendVideoService;
    public SystemService getSystemService() {
        return systemService;
    }
    private String key;
    private int pageIndex;
    private int detailsystem;
    public void setSystemService(SystemService systemService) {
        this.systemService = systemService;
    }
    public String getKey() {
        return key;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public int getPageIndex() {
        return pageIndex;
    }
    public int getPageIndex() {
        return pageIndex;
    }
    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }
    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }
    public int getDetailsystem() {
        return detailsystem;
    }
    public int getDetailsystem() {
        return detailsystem;
    }
    public void setDetailsystem(int detailsystem) {
        this.detailsystem = detailsystem;
    }
    public void setDetailsystem(int detailsystem) {
        this.detailsystem = detailsystem;
    }
    public HotVideoTypeService getHotVideoTypeService() {
        return hotVideoTypeService;
    }
    public void setHotVideoTypeService(HotVideoTypeService hotVideoTypeService) {
        this.hotVideoTypeService = hotVideoTypeService;
    }
    @RequestMapping(value = "/ClassAdminServlet", method = RequestMethod.GET)
    public String get(HttpServletRequest req, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String type = req.getParameter("type");
        System.out.println("type--" + type);
        if (type.equalsIgnoreCase("deleteHotType")) {
            hotVideoTypeService.deleteHotType(new HotVideoType(req.getParameter("id")));
    public ClassService getClassService() {
        return classService;
    }
            return "hottype_list";
        } else if (type.equalsIgnoreCase("getVideoType")) {
            String parentId = req.getParameter("parentId");
            java.util.List<VideoType> list = classService.getFirstTypeList(parentId);
            JSONArray array = new JSONArray();
            for (VideoType t : list) {
                JSONObject object = new JSONObject();
                object.put("Id", t.getId());
                object.put("Name", t.getName());
                array.add(object);
            }
            Gson gson = new Gson();
            gson.toJson(array);
            out.print(gson.toJson(array));
            out.close();
        } else if (type.equalsIgnoreCase("deleteVideoTypeAll")) {
            String ids = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(ids)) {
                if (ids.endsWith(","))
                    ids = ids.substring(0, ids.length() - 1);
            }
            String[] idss = ids.split(",");
            for (String st : idss) {
                classService.deleteVideoType(st);
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("addSuperVideoType")) {// 分类分派
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            String icon = req.getParameter("pictures");
            SuperVideoType svt = new SuperVideoType();
            svt.setCreatetime(System.currentTimeMillis() + "");
            svt.setDetailSystem(new DetailSystem(system));
            svt.setPicture(icon);
            svt.setType(new VideoType(Long.parseLong(ids)));
            classService.addSuperVideoType(svt);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteSuperVideoType")) {
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            classService.deleteVideoTypeAdmin(ids, system);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteHotTypeAll")) {
            String ids = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(ids)) {
                if (ids.endsWith(","))
                    ids = ids.substring(0, ids.length() - 1);
            }
            String[] idss = ids.split(",");
            for (String st : idss) {
                hotVideoTypeService.deleteHotType(new HotVideoType(st));
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("addSuperHotType")) {// 分类分派
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            SuperHotType svt = new SuperHotType();
            svt.setCreatetime(System.currentTimeMillis() + "");
            svt.setDetailSystem(new DetailSystem(system));
            svt.setHotType(new HotVideoType(ids));
            hotVideoTypeService.addSuperHotType(svt);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteSuperHotType")) {
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            classService.deleteHotTypeAdmin(ids, system);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("changeHomeVideoPicture")) {
            String homevideid = req.getParameter("id");
            String picture = req.getParameter("picture");
            HomeVideo hv = homeTypeService.getHomeVideoById(homevideid);
            hv.setPicture(picture);
            homeTypeService.updateHomeVideo(hv);
            out.print("SUCCESS");
        }
        return "";
    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
    @RequestMapping(value = "/ClassAdminServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    public HomeTypeService getHomeTypeService() {
        return homeTypeService;
    }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addHotType")) {
            String step1 = req.getParameter("step1");
            String step2 = req.getParameter("step2");
            HotVideoType hotType = new HotVideoType();
            hotType.setAddType(1);
            hotType.setCreatetime(System.currentTimeMillis() + "");
            if (!StringUtil.isNullOrEmpty(step2)) {
                hotType.setType(new VideoType(Long.parseLong(step2)));
                hotVideoTypeService.addHotType(hotType);
            } else if (!StringUtil.isNullOrEmpty(step1)) {
                hotType.setType(new VideoType(Long.parseLong(step1)));
                hotVideoTypeService.addHotType(hotType);
            }
    public void setHomeTypeService(HomeTypeService homeTypeService) {
        this.homeTypeService = homeTypeService;
    }
            return "hottype_add";
        }
        return "";
    }
    @RequestMapping(value = "/ClassAdminServlet", method = RequestMethod.GET)
    public String get(HttpServletRequest req, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String type = req.getParameter("type");
        System.out.println("type--"+type);
        if (type.equalsIgnoreCase("deleteHotType")) {
            hotVideoTypeService.deleteHotType(new HotVideoType(req.getParameter("id")));
    /**
     * 关键字搜索列表
     *
     * @return
     */
    @RequestMapping("/search")
    public void categoryRecommendVideoList(HttpServletRequest request, HttpSession session, PrintWriter out) {
        if (pageIndex == 0)
            pageIndex = 1;
        key = request.getParameter("key");
        String videotype = request.getParameter("videotype");
        videotype = StringUtil.isNullOrEmpty(videotype) ? "150" : videotype;
            return "hottype_list";
        } else if (type.equalsIgnoreCase("getVideoType")) {
            String parentId = req.getParameter("parentId");
            java.util.List<VideoType> list = classService.getFirstTypeList(parentId);
            JSONArray array = new JSONArray();
            for (VideoType t : list) {
                JSONObject object = new JSONObject();
                object.put("Id", t.getId());
                object.put("Name", t.getName());
                array.add(object);
            }
            Gson gson = new Gson();
            gson.toJson(array);
            out.print(gson.toJson(array));
            out.close();
        } else if (type.equalsIgnoreCase("deleteVideoTypeAll")) {
            String ids = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(ids)) {
                if (ids.endsWith(","))
                    ids = ids.substring(0, ids.length() - 1);
            }
            String[] idss = ids.split(",");
            for (String st : idss) {
                classService.deleteVideoType(st);
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("addSuperVideoType")) {// 分类分派
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            String icon = req.getParameter("pictures");
            SuperVideoType svt = new SuperVideoType();
            svt.setCreatetime(System.currentTimeMillis() + "");
            svt.setDetailSystem(new DetailSystem(system));
            svt.setPicture(icon);
            svt.setType(new VideoType(Long.parseLong(ids)));
            classService.addSuperVideoType(svt);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteSuperVideoType")) {
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            classService.deleteVideoTypeAdmin(ids, system);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteHotTypeAll")) {
            String ids = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(ids)) {
                if (ids.endsWith(","))
                    ids = ids.substring(0, ids.length() - 1);
            }
            String[] idss = ids.split(",");
            for (String st : idss) {
                hotVideoTypeService.deleteHotType(new HotVideoType(st));
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("addSuperHotType")) {// 分类分派
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            SuperHotType svt = new SuperHotType();
            svt.setCreatetime(System.currentTimeMillis() + "");
            svt.setDetailSystem(new DetailSystem(system));
            svt.setHotType(new HotVideoType(ids));
            hotVideoTypeService.addSuperHotType(svt);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteSuperHotType")) {
            String ids = req.getParameter("ids");
            String system = req.getParameter("system");
            classService.deleteHotTypeAdmin(ids, system);
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("changeHomeVideoPicture")) {
            String homevideid = req.getParameter("id");
            String picture = req.getParameter("picture");
            HomeVideo hv = homeTypeService.getHomeVideoById(homevideid);
            hv.setPicture(picture);
            homeTypeService.updateHomeVideo(hv);
            out.print("SUCCESS");
        }
        return "";
    }
    @RequestMapping(value = "/ClassAdminServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addHotType")) {
            String step1 = req.getParameter("step1");
            String step2 = req.getParameter("step2");
            HotVideoType hotType = new HotVideoType();
            hotType.setAddType(1);
            hotType.setCreatetime(System.currentTimeMillis() + "");
            if (!StringUtil.isNullOrEmpty(step2)) {
                hotType.setType(new VideoType(Long.parseLong(step2)));
                hotVideoTypeService.addHotType(hotType);
            } else if (!StringUtil.isNullOrEmpty(step1)) {
                hotType.setType(new VideoType(Long.parseLong(step1)));
                hotVideoTypeService.addHotType(hotType);
            }
            return "hottype_add";
        }
        return "";
    }
    /**
     * 关键字搜索列表
     *
     * @return
     */
    @RequestMapping("/search")
    public void categoryRecommendVideoList(HttpServletRequest request,PrintWriter out) {
        if (pageIndex == 0)
            pageIndex = 1;
        key = request.getParameter("key");
        String videotype = request.getParameter("videotype");
        videotype = StringUtil.isNullOrEmpty(videotype) ? "150" : videotype;
        List<CategoryRecommendVideoAdmin> list = categoryRecommendVideoService.getCategoryRecommendVideoAdmin(key,
                Integer.parseInt(videotype), detailsystem, pageIndex);
        long count = categoryRecommendVideoService.getCategoryRecommendVideoAdminCount(key, Integer.parseInt(videotype),
                detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(1);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        map.put("videotype", videotype + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        Gson gson=new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        JSONObject root = new JSONObject();
        root.put("code", "0");
        root.put("pageEntity", pe);
        String json = gson.toJson(list);
        root.put("crv", json);
        List<CategoryRecommendVideoAdmin> list = categoryRecommendVideoService.getCategoryRecommendVideoAdmin(key,
                Integer.parseInt(videotype), SystemUtil.getAdminSelectedSystemId(session), detailsystem, pageIndex);
        long count = categoryRecommendVideoService.getCategoryRecommendVideoAdminCount(key, Integer.parseInt(videotype),
                SystemUtil.getAdminSelectedSystemId(session), detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(1);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        map.put("videotype", videotype + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        JSONObject root = new JSONObject();
        root.put("code", "0");
        root.put("pageEntity", pe);
        String json = gson.toJson(list);
        root.put("crv", json);
//        for (CategoryRecommendVideoAdmin categoryRecommendVideoAdmin : list) {
//            System.out.println(categoryRecommendVideoAdmin.getCategoryRecommendVideo().getCategoryRecommendVideo());
//            root.put("categoryRecommendVideoAdmin", gson.toJson(categoryRecommendVideoAdmin.getCategoryRecommendVideo().getCategoryRecommendVideo()));
//        }
        System.out.println(root.toString());
        out.print(root);
        System.out.println(root.toString());
        out.print(root);
//        dataMap.put("categoryRecommendVideoAdminList", list);
        List<DetailSystem> detailSystemList = systemService.getDetailSystemList();
//        dataMap.put("detailSystemList", detailSystemList);
        List<VideoType> typeList = classService.getFirstTypeList("");
//        dataMap.put("videoTypeList", typeList);
//        json.put("data", data);
//        System.out.println("jsonStr---------"+jsonStr);
//        out.print(jsonStr);
    }
    }
}
src/main/java/com/yeshi/buwan/controller/admin/HomeAdAdminController.java
@@ -23,13 +23,6 @@
    @Resource
    private HomeAdService homeAdService;
    public HomeAdService getHomeAdService() {
        return homeAdService;
    }
    public void setHomeAdService(HomeAdService homeAdService) {
        this.homeAdService = homeAdService;
    }
    @RequestMapping(value = "/HomeAdAdminServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
src/main/java/com/yeshi/buwan/controller/admin/HomeTypeAdminController.java
@@ -10,7 +10,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -45,431 +47,379 @@
@RequestMapping("")
public class HomeTypeAdminController {
    @Resource
    private HomeTypeService homeTypeService;
    @Resource
    private ClassService classService;
    @Resource
    private IntersectionService intersectionService;
    @Resource
    private HomeAdService homeAdService;
    @Resource
    private WeiXinService weiXinService;
    @Resource
    private HomeNoticeService homeNoticeService;
    @Resource
    private HomeTypeService homeTypeService;
    @Resource
    private ClassService classService;
    @Resource
    private IntersectionService intersectionService;
    @Resource
    private HomeAdService homeAdService;
    @Resource
    private WeiXinService weiXinService;
    @Resource
    private HomeNoticeService homeNoticeService;
    @Resource
    private AdService adService;
    @Resource
    private AdService adService;
    public HomeTypeService getHomeTypeService() {
        return homeTypeService;
    }
    public void setHomeTypeService(HomeTypeService homeTypeService) {
        this.homeTypeService = homeTypeService;
    }
    @RequestMapping(value = "/HomeTypeAdminServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addSuperHomeType")) {// 获取来源列表
            String detailSystem = req.getParameter("system");
            String classid = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(classid)) {
                SuperHomeType sz = new SuperHomeType();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setHomeType(new HomeType(classid));
                homeTypeService.addSuperHomeType(sz);
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteSuperHomeType")) {// 获取下级分类
            String detailSystem = req.getParameter("system");
            String classid = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(classid)) {
                homeTypeService.deleteHomeTypeAdmin(classid, detailSystem);
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("getAllParentType")) {// 根据子分类得到所有的上级分类
            String id = req.getParameter("id");
            if (!StringUtil.isNullOrEmpty(id)) {
                List<Long> idsList = new ArrayList<>();
                if (StringUtil.isNullOrEmpty(id) || id.contains("undefined") || Long.parseLong(id) == 0)
                    id = "1";
                VideoType vt = classService.getTypeById(Long.parseLong(id));
                idsList.add(vt.getId());
                while (vt.getParent() != null) {
                    vt = vt.getParent();
                    idsList.add(vt.getId());
                }
                // 将list倒序
                Collections.reverse(idsList);
                JSONArray array = new JSONArray();
    public ClassService getClassService() {
        return classService;
    }
                for (int i = 0; i < idsList.size(); i++) {
                    JSONArray carray = new JSONArray();
                    long parentId = 0;
                    if (i == 0) {
                        parentId = 0;
                    } else {
                        parentId = idsList.get(i - 1);
                    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
                    List<VideoType> vts = classService.getFirstTypeList(parentId + "");
                    for (VideoType vty : vts) {
                        JSONObject object = new JSONObject();
                        object.put("Name", vty.getName());
                        object.put("Id", vty.getId());
                        if (vty.getId() == idsList.get(i)) {
                            object.put("Selected", "1");
                        } else {
                            object.put("Selected", "0");
                        }
                        carray.add(object);
                    }
                    array.add(carray);
    public IntersectionService getIntersectionService() {
        return intersectionService;
    }
                }
                out.print(array.toString());
            }
    public void setIntersectionService(IntersectionService intersectionService) {
        this.intersectionService = intersectionService;
    }
        }
    }
    public HomeAdService getHomeAdService() {
        return homeAdService;
    }
    @RequestMapping(value = "/HomeTypeAdminServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, HttpSession session, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    public void setHomeAdService(HomeAdService homeAdService) {
        this.homeAdService = homeAdService;
    }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addHomeType")) {
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
            HomeType homeType = new HomeType();
            homeType.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
            homeType.setName(name);
            homeType.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setNumber(Integer.parseInt(number));
            homeType.setActivity(activity);
            homeType.setParams(params);
            if (StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(3);
            else
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeType.setSystem(SystemUtil.getAdminSelectedSystem(session));
            homeTypeService.addHomeType(homeType);
            return "hometype_add";
        } else if (type.equalsIgnoreCase("updateHomeType")) {
            String id = req.getParameter("id");
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
            HomeType homeType = homeTypeService.getHomeTypeById(id);
            homeType.setName(name);
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setActivity(activity);
            homeType.setParams(params);
            homeType.setNumber(Integer.parseInt(number));
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            if (!StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeTypeService.updateHomeType(homeType);
            return "hometype_edit";
        } else if (type.equalsIgnoreCase("addHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = new HomeAd();
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                if (ad.getAdmin() == null)
                    ad.setAdmin(new AdminInfo("1"));
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
    public WeiXinService getWeiXinService() {
        return weiXinService;
    }
                ad.setLinkType(Integer.parseInt(linktype));
                ad.setVideo(new VideoInfo("1"));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    VideoIntersection se = intersectionService.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
    public void setWeiXinService(WeiXinService weiXinService) {
        this.weiXinService = weiXinService;
    }
                ad.setSystem(SystemUtil.getAdminSelectedSystem(session));
    public HomeNoticeService getHomeNoticeService() {
        return homeNoticeService;
    }
                homeAdService.addHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homead_add";
        } else if (type.equalsIgnoreCase("addHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = new WXAd();
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
    public void setHomeNoticeService(HomeNoticeService homeNoticeService) {
        this.homeNoticeService = homeNoticeService;
    }
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
    public AdService getAdService() {
        return adService;
    }
                adService.addWX(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homewx_add";
        } else if (type.equalsIgnoreCase("updateHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = homeAdService.getHomeAdById(req.getParameter("id"));
                ad.setLinkType(Integer.parseInt(linktype));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    VideoIntersection se = intersectionService.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
    public void setAdService(AdService adService) {
        this.adService = adService;
    }
                ad.setBeizhu((String) map.get("beizhu"));
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
                ad.setSystem(new SystemInfo(map.get("system")));
                homeAdService.updateHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homead_edit";
        } else if (type.equalsIgnoreCase("updateHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = adService.getWXAd(req.getParameter("id"));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
    @RequestMapping(value = "/HomeTypeAdminServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addSuperHomeType")) {// 获取来源列表
            String detailSystem = req.getParameter("system");
            String classid = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(classid)) {
                SuperHomeType sz = new SuperHomeType();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setHomeType(new HomeType(classid));
                homeTypeService.addSuperHomeType(sz);
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("deleteSuperHomeType")) {// 获取下级分类
            String detailSystem = req.getParameter("system");
            String classid = req.getParameter("ids");
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(classid)) {
                homeTypeService.deleteHomeTypeAdmin(classid, detailSystem);
            }
            out.print("SUCCESS");
        } else if (type.equalsIgnoreCase("getAllParentType")) {// 根据子分类得到所有的上级分类
            String id = req.getParameter("id");
            if (!StringUtil.isNullOrEmpty(id)) {
                List<Long> idsList = new ArrayList<>();
                if (StringUtil.isNullOrEmpty(id) || id.contains("undefined") || Long.parseLong(id) == 0)
                    id = "1";
                VideoType vt = classService.getTypeById(Long.parseLong(id));
                idsList.add(vt.getId());
                while (vt.getParent() != null) {
                    vt = vt.getParent();
                    idsList.add(vt.getId());
                }
                // 将list倒序
                Collections.reverse(idsList);
                JSONArray array = new JSONArray();
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
                ad.setSystem(new SystemInfo(map.get("system")));
                adService.updateWXAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homewx_edit";
        } else if (type.equalsIgnoreCase("updateAdVideo")) {
            String videoId = req.getParameter("id");
            String adId = req.getParameter("homead");
            HomeAd ad = homeAdService.getHomeAdById(adId);
            VideoInfo info = new VideoInfo();
            info.setId(videoId);
            ad.setVideo(info);
            homeAdService.updateHomeAd(ad);
            return "video_list";
        } else if (type.equalsIgnoreCase("addHomeNotice")) {
            HomeNotice ad = new HomeNotice();
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setCreatetime(System.currentTimeMillis() + "");
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.addHomeNotice(ad);
            return "homenotice_list";
        } else if (type.equalsIgnoreCase("updateHomeNotice")) {
            String id = req.getParameter("id");
            HomeNotice ad = homeNoticeService.getHomeNotice(id);
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setStarttime(req.getParameter("starttime"));
            ad.setEndtime(req.getParameter("endtime"));
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.updateHomeNotice(ad);
            req.setAttribute("id", id);
            return "homenotice_edit";
        } else if (type.equalsIgnoreCase("updateWeiXin")) {
            String id = req.getParameter("id");
            WeiXinInfo info = weiXinService.getWeiXinInfo(id);
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            if (!StringUtil.isNullOrEmpty(req.getParameter("portrait")))
                info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
            weiXinService.updateWeiXinInfo(info, req.getParameter("wximg"));
            req.setAttribute("id", id);
            return "weixin_edit";
        } else if (type.equalsIgnoreCase("addWeiXin")) {
            WeiXinInfo info = new WeiXinInfo();
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
            info.setCreatetime(System.currentTimeMillis() + "");
            info = weiXinService.addWeiXinInfo(info);
            weiXinService.addWeiXinImage(info, req.getParameter("wximg"));
            return "weixin_add";
        } else if (type.equalsIgnoreCase("updateHomeVideo")) {
            String id = req.getParameter("id");
            String picture = req.getParameter("picture");
            HomeVideo video = homeTypeService.getHomeVideoById(id);
            video.setPicture(picture);
            homeTypeService.updateHomeVideo(video);
            req.setAttribute("id", id);
            return "homevideo_update";
        }
        return "";
                for (int i = 0; i < idsList.size(); i++) {
                    JSONArray carray = new JSONArray();
                    long parentId = 0;
                    if (i == 0) {
                        parentId = 0;
                    } else {
                        parentId = idsList.get(i - 1);
                    }
                    List<VideoType> vts = classService.getFirstTypeList(parentId + "");
                    for (VideoType vty : vts) {
                        JSONObject object = new JSONObject();
                        object.put("Name", vty.getName());
                        object.put("Id", vty.getId());
                        if (vty.getId() == idsList.get(i)) {
                            object.put("Selected", "1");
                        } else {
                            object.put("Selected", "0");
                        }
                        carray.add(object);
                    }
                    array.add(carray);
                }
                out.print(array.toString());
            }
        }
    }
    @RequestMapping(value = "/HomeTypeAdminServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addHomeType")) {
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
            HomeType homeType = new HomeType();
            homeType.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
            homeType.setName(name);
            homeType.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setNumber(Integer.parseInt(number));
            homeType.setActivity(activity);
            homeType.setParams(params);
            if (StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(3);
            else
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeTypeService.addHomeType(homeType);
            return "hometype_add";
        } else if (type.equalsIgnoreCase("updateHomeType")) {
            String id = req.getParameter("id");
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
            HomeType homeType = homeTypeService.getHomeTypeById(id);
            homeType.setName(name);
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setActivity(activity);
            homeType.setParams(params);
            homeType.setNumber(Integer.parseInt(number));
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            if (!StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeTypeService.updateHomeType(homeType);
            return "hometype_edit";
        } else if (type.equalsIgnoreCase("addHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = new HomeAd();
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                if (ad.getAdmin() == null)
                    ad.setAdmin(new AdminInfo("1"));
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
                ad.setLinkType(Integer.parseInt(linktype));
                ad.setVideo(new VideoInfo("1"));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    VideoIntersection se = intersectionService.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
                homeAdService.addHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homead_add";
        } else if (type.equalsIgnoreCase("addHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = new WXAd();
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
                adService.addWX(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homewx_add";
        } else if (type.equalsIgnoreCase("updateHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = homeAdService.getHomeAdById(req.getParameter("id"));
                ad.setLinkType(Integer.parseInt(linktype));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    VideoIntersection se = intersectionService.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
                ad.setBeizhu((String) map.get("beizhu"));
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
                ad.setSystem(new SystemInfo(map.get("system")));
                homeAdService.updateHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homead_edit";
        } else if (type.equalsIgnoreCase("updateHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = adService.getWXAd(req.getParameter("id"));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
                ad.setSystem(new SystemInfo(map.get("system")));
                adService.updateWXAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homewx_edit";
        } else if (type.equalsIgnoreCase("updateAdVideo")) {
            String videoId = req.getParameter("id");
            String adId = req.getParameter("homead");
            HomeAd ad = homeAdService.getHomeAdById(adId);
            VideoInfo info = new VideoInfo();
            info.setId(videoId);
            ad.setVideo(info);
            homeAdService.updateHomeAd(ad);
            return "video_list";
        } else if (type.equalsIgnoreCase("addHomeNotice")) {
            HomeNotice ad = new HomeNotice();
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setCreatetime(System.currentTimeMillis() + "");
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.addHomeNotice(ad);
            return "homenotice_list";
        } else if (type.equalsIgnoreCase("updateHomeNotice")) {
            String id = req.getParameter("id");
            HomeNotice ad = homeNoticeService.getHomeNotice(id);
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setStarttime(req.getParameter("starttime"));
            ad.setEndtime(req.getParameter("endtime"));
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.updateHomeNotice(ad);
            req.setAttribute("id", id);
            return "homenotice_edit";
        } else if (type.equalsIgnoreCase("updateWeiXin")) {
            String id = req.getParameter("id");
            WeiXinInfo info = weiXinService.getWeiXinInfo(id);
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            if (!StringUtil.isNullOrEmpty(req.getParameter("portrait")))
                info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
            weiXinService.updateWeiXinInfo(info, req.getParameter("wximg"));
            req.setAttribute("id", id);
            return "weixin_edit";
        } else if (type.equalsIgnoreCase("addWeiXin")) {
            WeiXinInfo info = new WeiXinInfo();
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
            info.setCreatetime(System.currentTimeMillis() + "");
            info = weiXinService.addWeiXinInfo(info);
            weiXinService.addWeiXinImage(info, req.getParameter("wximg"));
            return "weixin_add";
        } else if (type.equalsIgnoreCase("updateHomeVideo")) {
            String id = req.getParameter("id");
            String picture = req.getParameter("picture");
            HomeVideo video = homeTypeService.getHomeVideoById(id);
            video.setPicture(picture);
            homeTypeService.updateHomeVideo(video);
            req.setAttribute("id", id);
            return "homevideo_update";
        }
        return "";
    }
    }
}
src/main/java/com/yeshi/buwan/controller/admin/HotSearchAdminController.java
@@ -10,7 +10,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -68,62 +70,6 @@
    @Resource
    private HomeNoticeService homeNoticeService;
    public SearchService getSearchService() {
        return searchService;
    }
    public void setSearchService(SearchService searchService) {
        this.searchService = searchService;
    }
    public ClassService getClassService() {
        return classService;
    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
    public HomeTypeService getHomeTypeService() {
        return homeTypeService;
    }
    public void setHomeTypeService(HomeTypeService homeTypeService) {
        this.homeTypeService = homeTypeService;
    }
    public AdService getAdService() {
        return adService;
    }
    public void setAdService(AdService adService) {
        this.adService = adService;
    }
    public WeiXinService getWeiXinService() {
        return weiXinService;
    }
    public void setWeiXinService(WeiXinService weiXinService) {
        this.weiXinService = weiXinService;
    }
    public HomeAdService getHomeAdService() {
        return homeAdService;
    }
    public void setHomeAdService(HomeAdService homeAdService) {
        this.homeAdService = homeAdService;
    }
    public HomeNoticeService getHomeNoticeService() {
        return homeNoticeService;
    }
    public void setHomeNoticeService(HomeNoticeService homeNoticeService) {
        this.homeNoticeService = homeNoticeService;
    }
    @RequestMapping(value = "/HotSearchAdminServlet", method = RequestMethod.GET)
    public String get(HttpServletRequest req, PrintWriter out) {
@@ -197,7 +143,7 @@
    }
    @RequestMapping(value = "/HotSearchAdminServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, PrintWriter out) {
    public String post(HttpServletRequest req, HttpServletResponse resp, HttpSession session, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
@@ -236,6 +182,7 @@
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeType.setSystem(SystemUtil.getAdminSelectedSystem(session));
            homeTypeService.addHomeType(homeType);
            return "hometype_add";
@@ -277,6 +224,7 @@
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = new HomeAd();
                ad.setSystem(SystemUtil.getAdminSelectedSystem(session));
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                ad.setSystem(new SystemInfo(map.get("system")));
src/main/java/com/yeshi/buwan/controller/admin/HotStarAdminController.java
@@ -23,14 +23,6 @@
    @Resource
    private StarService starService;
    public StarService getStarService() {
        return starService;
    }
    public void setStarService(StarService starService) {
        this.starService = starService;
    }
    @RequestMapping(value = "/HotStarAdminServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
        try {
src/main/java/com/yeshi/buwan/controller/admin/SpecialAdminController.java
@@ -23,13 +23,6 @@
    @Resource
    private SpecialService specialService;
    public SpecialService getSpecialService() {
        return specialService;
    }
    public void setSpecialService(SpecialService specialService) {
        this.specialService = specialService;
    }
    @RequestMapping(value = "/SpecialAdminServlet", method = RequestMethod.GET)
    public String get(HttpServletRequest req, PrintWriter out) {
src/main/java/com/yeshi/buwan/controller/admin/UserBannerAdminController.java
@@ -10,7 +10,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -67,61 +69,6 @@
    @Resource
    private HomeNoticeService homeNoticeService;
    public UserBannerService getUserBannerService() {
        return userBannerService;
    }
    public void setUserBannerService(UserBannerService userBannerService) {
        this.userBannerService = userBannerService;
    }
    public ClassService getClassService() {
        return classService;
    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
    public HomeTypeService getHomeTypeService() {
        return homeTypeService;
    }
    public void setHomeTypeService(HomeTypeService homeTypeService) {
        this.homeTypeService = homeTypeService;
    }
    public HomeAdService getHomeAdService() {
        return homeAdService;
    }
    public void setHomeAdService(HomeAdService homeAdService) {
        this.homeAdService = homeAdService;
    }
    public AdService getAdService() {
        return adService;
    }
    public void setAdService(AdService adService) {
        this.adService = adService;
    }
    public WeiXinService getWeiXinService() {
        return weiXinService;
    }
    public void setWeiXinService(WeiXinService weiXinService) {
        this.weiXinService = weiXinService;
    }
    public HomeNoticeService getHomeNoticeService() {
        return homeNoticeService;
    }
    public void setHomeNoticeService(HomeNoticeService homeNoticeService) {
        this.homeNoticeService = homeNoticeService;
    }
    @RequestMapping(value = "/UserBannerAdminServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
@@ -194,7 +141,7 @@
    }
    @RequestMapping(value = "/UserBannerAdminServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, PrintWriter out) {
    public String post(HttpServletRequest req, HttpServletResponse resp, HttpSession session, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
@@ -233,6 +180,7 @@
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeType.setSystem(SystemUtil.getAdminSelectedSystem(session));
            homeTypeService.addHomeType(homeType);
            return "hometype_add";
@@ -274,6 +222,10 @@
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = new HomeAd();
                ad.setSystem(SystemUtil.getAdminSelectedSystem(session));
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                ad.setSystem(new SystemInfo(map.get("system")));
src/main/java/com/yeshi/buwan/controller/admin/VideoController.java
@@ -10,7 +10,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -35,10 +37,6 @@
import com.yeshi.buwan.service.imp.VideoManager;
import com.yeshi.buwan.service.imp.VideoService;
import com.yeshi.buwan.service.imp.WeiXinService;
import com.yeshi.buwan.util.DouBanUtil;
import com.yeshi.buwan.util.FileUtil;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.TimeUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -65,53 +63,6 @@
    @Resource
    private VideoService videoService;
    public VideoManager getVideoManager() {
        return videoManager;
    }
    public void setVideoManager(VideoManager videoManager) {
        this.videoManager = videoManager;
    }
    public HomeTypeService getHomeTypeService() {
        return homeTypeService;
    }
    public void setHomeTypeService(HomeTypeService homeTypeService) {
        this.homeTypeService = homeTypeService;
    }
    public HomeAdService getHomeAdService() {
        return homeAdService;
    }
    public void setHomeAdService(HomeAdService homeAdService) {
        this.homeAdService = homeAdService;
    }
    public WeiXinService getWeiXinService() {
        return weiXinService;
    }
    public void setWeiXinService(WeiXinService weiXinService) {
        this.weiXinService = weiXinService;
    }
    public AdService getAdService() {
        return adService;
    }
    public void setAdService(AdService adService) {
        this.adService = adService;
    }
    public HomeNoticeService getHomeNoticeService() {
        return homeNoticeService;
    }
    public void setHomeNoticeService(HomeNoticeService homeNoticeService) {
        this.homeNoticeService = homeNoticeService;
    }
    @RequestMapping(value = "/VideoServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
@@ -180,7 +131,7 @@
    }
    @RequestMapping(value = "/VideoServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, PrintWriter out) {
    public String post(HttpServletRequest req, HttpServletResponse resp, HttpSession session, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
@@ -219,6 +170,7 @@
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeType.setSystem(SystemUtil.getAdminSelectedSystem(session));
            homeTypeService.addHomeType(homeType);
            return "hometype_add";
        } else if (type.equalsIgnoreCase("updateHomeType")) {
@@ -259,6 +211,10 @@
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = new HomeAd();
                ad.setSystem(SystemUtil.getAdminSelectedSystem(session));
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                ad.setSystem(new SystemInfo(map.get("system")));
src/main/java/com/yeshi/buwan/controller/admin/VideoTypeController.java
@@ -10,7 +10,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -44,444 +46,393 @@
@RequestMapping("")
public class VideoTypeController {
    @Resource
    private VideoResourceService videoResourceService;
    @Resource
    private VideoResourceService videoResourceService;
    @Resource
    private ClassService classService;
    @Resource
    private HomeTypeService homeTypeService;
    @Resource
    private HomeAdService homeAdService;
    @Resource
    private ClassService classService;
    @Resource
    private HomeTypeService homeTypeService;
    @Resource
    private HomeAdService homeAdService;
    @Resource
    private AdService adService;
    @Resource
    private AdService adService;
    @Resource
    private HomeNoticeService homeNoticeService;
    @Resource
    private HomeNoticeService homeNoticeService;
    @Resource
    private WeiXinService weiXinService;
    @Resource
    private WeiXinService weiXinService;
    public VideoResourceService getVideoResourceService() {
        return videoResourceService;
    }
    public void setVideoResourceService(VideoResourceService videoResourceService) {
        this.videoResourceService = videoResourceService;
    }
    @RequestMapping(value = "/VideoTypeServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("getResource")) {// 获取来源列表
            out.print(videoResourceService.resourceListToJson(videoResourceService.getResourceList(), null));
        } else if (type.equalsIgnoreCase("getNextVideoTypeList")) {// 获取下级分类
            String id = req.getParameter("id");
            List<VideoType> list = classService.getFirstTypeList(id);
            JSONArray array = new JSONArray();
            for (VideoType vt : list) {
                JSONObject obj = new JSONObject();
                obj.put("Name", vt.getName());
                obj.put("Id", vt.getId());
                array.add(obj);
            }
            out.print(array.toString());
            out.close();
        } else if (type.equalsIgnoreCase("getAllParentType")) {// 根据子分类得到所有的上级分类
            String id = req.getParameter("id");
            if (!StringUtil.isNullOrEmpty(id)) {
                List<Long> idsList = new ArrayList<Long>();
                if (StringUtil.isNullOrEmpty(id) || id.contains("undefined") || Long.parseLong(id) == 0)
                    id = "151";
                VideoType vt = classService.getTypeById(Long.parseLong(id));
                if (vt != null)
                    idsList.add(vt.getId());
                if (vt != null)
                    while (vt.getParent() != null) {
                        vt = vt.getParent();
                        idsList.add(vt.getId());
                    }
                // 将list倒序
                Collections.reverse(idsList);
                JSONArray array = new JSONArray();
    public ClassService getClassService() {
        return classService;
    }
                for (int i = 0; i < idsList.size(); i++) {
                    JSONArray carray = new JSONArray();
                    long parentId = 0;
                    if (i == 0) {
                        parentId = 0;
                    } else {
                        parentId = idsList.get(i - 1);
                    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
                    List<VideoType> vts = classService.getFirstTypeList(parentId + "");
                    for (VideoType vty : vts) {
                        JSONObject object = new JSONObject();
                        object.put("Name", vty.getName());
                        object.put("Id", vty.getId());
                        if (vty.getId() == idsList.get(i)) {
                            object.put("Selected", "1");
                        } else {
                            object.put("Selected", "0");
                        }
                        carray.add(object);
                    }
                    array.add(carray);
                }
                out.print(array.toString());
                out.close();
            }
    public HomeTypeService getHomeTypeService() {
        return homeTypeService;
    }
        }
    }
    public void setHomeTypeService(HomeTypeService homeTypeService) {
        this.homeTypeService = homeTypeService;
    }
    @RequestMapping(value = "/VideoTypeServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, HttpSession session, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    public HomeAdService getHomeAdService() {
        return homeAdService;
    }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addHomeType")) {
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
    public void setHomeAdService(HomeAdService homeAdService) {
        this.homeAdService = homeAdService;
    }
            HomeType homeType = new HomeType();
            homeType.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
    public AdService getAdService() {
        return adService;
    }
            homeType.setName(name);
            homeType.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setNumber(Integer.parseInt(number));
            homeType.setActivity(activity);
            homeType.setParams(params);
            if (StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(3);
            else
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeType.setSystem(SystemUtil.getAdminSelectedSystem(session));
            homeTypeService.addHomeType(homeType);
            return "hometype_add";
        } else if (type.equalsIgnoreCase("updateHomeType")) {
            String id = req.getParameter("id");
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
            HomeType homeType = homeTypeService.getHomeTypeById(id);
            homeType.setName(name);
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setActivity(activity);
            homeType.setParams(params);
            homeType.setNumber(Integer.parseInt(number));
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            if (!StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeTypeService.updateHomeType(homeType);
    public void setAdService(AdService adService) {
        this.adService = adService;
    }
            return "hometype_edit";
        } else if (type.equalsIgnoreCase("addHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = new HomeAd();
    public HomeNoticeService getHomeNoticeService() {
        return homeNoticeService;
    }
                ad.setSystem(SystemUtil.getAdminSelectedSystem(session));
    public void setHomeNoticeService(HomeNoticeService homeNoticeService) {
        this.homeNoticeService = homeNoticeService;
    }
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
    public WeiXinService getWeiXinService() {
        return weiXinService;
    }
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
    public void setWeiXinService(WeiXinService weiXinService) {
        this.weiXinService = weiXinService;
    }
                ad.setLinkType(Integer.parseInt(linktype));
                ad.setVideo(new VideoInfo("1"));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    IntersectionService iservice = new IntersectionService();
                    VideoIntersection se = iservice.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
    @RequestMapping(value = "/VideoTypeServlet", method = RequestMethod.GET)
    public void get(HttpServletRequest req, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("getResource")) {// 获取来源列表
            out.print(videoResourceService.resourceListToJson(videoResourceService.getResourceList(), null));
        } else if (type.equalsIgnoreCase("getNextVideoTypeList")) {// 获取下级分类
            String id = req.getParameter("id");
            List<VideoType> list = classService.getFirstTypeList(id);
            JSONArray array = new JSONArray();
            for (VideoType vt : list) {
                JSONObject obj = new JSONObject();
                obj.put("Name", vt.getName());
                obj.put("Id", vt.getId());
                array.add(obj);
            }
            out.print(array.toString());
            out.close();
        } else if (type.equalsIgnoreCase("getAllParentType")) {// 根据子分类得到所有的上级分类
            String id = req.getParameter("id");
            if (!StringUtil.isNullOrEmpty(id)) {
                List<Long> idsList = new ArrayList<Long>();
                if (StringUtil.isNullOrEmpty(id) || id.contains("undefined") || Long.parseLong(id) == 0)
                    id = "151";
                VideoType vt = classService.getTypeById(Long.parseLong(id));
                if (vt != null)
                    idsList.add(vt.getId());
                if (vt != null)
                    while (vt.getParent() != null) {
                        vt = vt.getParent();
                        idsList.add(vt.getId());
                    }
                // 将list倒序
                Collections.reverse(idsList);
                JSONArray array = new JSONArray();
                homeAdService.addHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
                for (int i = 0; i < idsList.size(); i++) {
                    JSONArray carray = new JSONArray();
                    long parentId = 0;
                    if (i == 0) {
                        parentId = 0;
                    } else {
                        parentId = idsList.get(i - 1);
                    }
            return "homead_add";
        } else if (type.equalsIgnoreCase("addHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = new WXAd();
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
                    List<VideoType> vts = classService.getFirstTypeList(parentId + "");
                    for (VideoType vty : vts) {
                        JSONObject object = new JSONObject();
                        object.put("Name", vty.getName());
                        object.put("Id", vty.getId());
                        if (vty.getId() == idsList.get(i)) {
                            object.put("Selected", "1");
                        } else {
                            object.put("Selected", "0");
                        }
                        carray.add(object);
                    }
                    array.add(carray);
                }
                out.print(array.toString());
                out.close();
            }
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
        }
    }
                adService.addWX(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
    @RequestMapping(value = "/VideoTypeServlet", method = RequestMethod.POST)
    public String post(HttpServletRequest req, HttpServletResponse resp, PrintWriter out) {
        try {
            req.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
            return "homewx_add";
        } else if (type.equalsIgnoreCase("updateHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = homeAdService.getHomeAdById(req.getParameter("id"));
                ad.setLinkType(Integer.parseInt(linktype));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    IntersectionService iservice = new IntersectionService();
                    VideoIntersection se = iservice.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
        String type = req.getParameter("type");
        if (type.equalsIgnoreCase("addHomeType")) {
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
                ad.setBeizhu((String) map.get("beizhu"));
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
                ad.setSystem(new SystemInfo(map.get("system")));
                homeAdService.updateHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            HomeType homeType = new HomeType();
            homeType.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
            return "homead_edit";
        } else if (type.equalsIgnoreCase("updateHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = adService.getWXAd(req.getParameter("id"));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
            homeType.setName(name);
            homeType.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setNumber(Integer.parseInt(number));
            homeType.setActivity(activity);
            homeType.setParams(params);
            if (StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(3);
            else
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeTypeService.addHomeType(homeType);
            return "hometype_add";
        } else if (type.equalsIgnoreCase("updateHomeType")) {
            String id = req.getParameter("id");
            String name = req.getParameter("name");
            String orderby = req.getParameter("orderby");
            String beizhu = req.getParameter("beizhu");
            String activity = req.getParameter("activity");
            String params = req.getParameter("params");
            String number = req.getParameter("number");
            HomeType homeType = homeTypeService.getHomeTypeById(id);
            homeType.setName(name);
            homeType.setOrderby(orderby);
            homeType.setBeizhu(beizhu);
            homeType.setActivity(activity);
            homeType.setParams(params);
            homeType.setNumber(Integer.parseInt(number));
            String hasMore = req.getParameter("hasmore");
            String clumns = req.getParameter("clumns");
            if (!StringUtil.isNullOrEmpty(clumns))
                homeType.setColumns(Integer.parseInt(clumns));
            if (!StringUtil.isNullOrEmpty(hasMore)) {
                if (hasMore.equalsIgnoreCase("on"))
                    homeType.setHasMore(true);
                else
                    homeType.setHasMore(false);
            } else
                homeType.setHasMore(false);
            homeTypeService.updateHomeType(homeType);
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
                ad.setSystem(new SystemInfo(map.get("system")));
                adService.updateWXAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "hometype_edit";
        } else if (type.equalsIgnoreCase("addHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = new HomeAd();
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
            return "homewx_edit";
        } else if (type.equalsIgnoreCase("updateAdVideo")) {
            String videoId = req.getParameter("id");
            String adId = req.getParameter("homead");
            HomeAd ad = homeAdService.getHomeAdById(adId);
            VideoInfo info = new VideoInfo();
            info.setId(videoId);
            ad.setVideo(info);
            homeAdService.updateHomeAd(ad);
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
            return "video_list";
        } else if (type.equalsIgnoreCase("addHomeNotice")) {
            HomeNotice ad = new HomeNotice();
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setCreatetime(System.currentTimeMillis() + "");
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.addHomeNotice(ad);
                ad.setLinkType(Integer.parseInt(linktype));
                ad.setVideo(new VideoInfo("1"));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    IntersectionService iservice = new IntersectionService();
                    VideoIntersection se = iservice.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
            return "homenotice_list";
        } else if (type.equalsIgnoreCase("updateHomeNotice")) {
            String id = req.getParameter("id");
            HomeNotice ad = homeNoticeService.getHomeNotice(id);
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setStarttime(req.getParameter("starttime"));
            ad.setEndtime(req.getParameter("endtime"));
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.updateHomeNotice(ad);
            req.setAttribute("id", id);
            return "homenotice_edit";
        } else if (type.equalsIgnoreCase("updateWeiXin")) {
            String id = req.getParameter("id");
            WeiXinInfo info = weiXinService.getWeiXinInfo(id);
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            if (!StringUtil.isNullOrEmpty(req.getParameter("portrait")))
                info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
            weiXinService.updateWeiXinInfo(info, req.getParameter("wximg"));
            req.setAttribute("id", id);
            return "weixin_edit";
        } else if (type.equalsIgnoreCase("addWeiXin")) {
            WeiXinInfo info = new WeiXinInfo();
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
                homeAdService.addHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            info.setCreatetime(System.currentTimeMillis() + "");
            info = weiXinService.addWeiXinInfo(info);
            weiXinService.addWeiXinImage(info, req.getParameter("wximg"));
            return "homead_add";
        } else if (type.equalsIgnoreCase("addHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = new WXAd();
                ad.setAdmin((AdminInfo) req.getSession().getAttribute("ADMIN_INFO"));
                ad.setSystem(new SystemInfo(map.get("system")));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
            return "weixin_add";
        } else if (type.equalsIgnoreCase("updateHomeVideo")) {
            String id = req.getParameter("id");
            String picture = req.getParameter("picture");
            HomeVideo video = homeTypeService.getHomeVideoById(id);
            video.setPicture(picture);
            homeTypeService.updateHomeVideo(video);
            req.setAttribute("id", id);
            return "homevideo_update";
        }
        return "";
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
                adService.addWX(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homewx_add";
        } else if (type.equalsIgnoreCase("updateHomeAd")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                String linktype = map.get("olinktype");
                String ourl = map.get("ourl");
                String ovideoid = map.get("ovideoid");
                String ointersection = map.get("ointersection");
                HomeAd ad = homeAdService.getHomeAdById(req.getParameter("id"));
                ad.setLinkType(Integer.parseInt(linktype));
                if (ad.getLinkType() == 1) {
                    ad.setVideo(new VideoInfo(ovideoid));
                } else if (ad.getLinkType() == 2) {
                    JSONObject obj = new JSONObject();
                    obj.put("url", ourl);
                    ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
                    ad.setParams(obj.toString());
                } else if (ad.getLinkType() == 3) {
                    JSONObject obj = new JSONObject();
                    obj.put("id", ointersection);
                    IntersectionService iservice = new IntersectionService();
                    VideoIntersection se = iservice.getIntersectionById(ointersection);
                    if (se != null) {
                        obj.put("title", se.getName());
                    }
                    ad.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
                    ad.setParams(obj.toString());
                }
                ad.setBeizhu((String) map.get("beizhu"));
                if (!StringUtil.isNullOrEmpty((String) map.get("pictureurl")))
                    ad.setPicture((String) map.get("pictureurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("picture")))
                    ad.setPicture((String) map.get("picture"));
                ad.setSystem(new SystemInfo(map.get("system")));
                homeAdService.updateHomeAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homead_edit";
        } else if (type.equalsIgnoreCase("updateHomeWx")) {
            FileUtil f = new FileUtil();
            try {
                Map<String, String> map = f.getTextAndFile(2, req);
                WXAd ad = adService.getWXAd(req.getParameter("id"));
                ad.setBeizhu((String) map.get("beizhu"));
                ad.setLink((String) map.get("link"));
                ad.setContent((String) map.get("content"));
                ad.setCreatetime((new StringBuilder(String.valueOf(System.currentTimeMillis()))).toString());
                if (!StringUtil.isNullOrEmpty((String) map.get("imageurl")))
                    ad.setImageUrl((String) map.get("imageurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("image")))
                    ad.setImageUrl((String) map.get("image"));
                if (!StringUtil.isNullOrEmpty((String) map.get("iconurl")))
                    ad.setIcon((String) map.get("iconurl"));
                else if (!StringUtil.isNullOrEmpty((String) map.get("icon")))
                    ad.setIcon((String) map.get("icon"));
                ad.setSystem(new SystemInfo(map.get("system")));
                adService.updateWXAd(ad);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "homewx_edit";
        } else if (type.equalsIgnoreCase("updateAdVideo")) {
            String videoId = req.getParameter("id");
            String adId = req.getParameter("homead");
            HomeAd ad = homeAdService.getHomeAdById(adId);
            VideoInfo info = new VideoInfo();
            info.setId(videoId);
            ad.setVideo(info);
            homeAdService.updateHomeAd(ad);
            return "video_list";
        } else if (type.equalsIgnoreCase("addHomeNotice")) {
            HomeNotice ad = new HomeNotice();
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setCreatetime(System.currentTimeMillis() + "");
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.addHomeNotice(ad);
            return "homenotice_list";
        } else if (type.equalsIgnoreCase("updateHomeNotice")) {
            String id = req.getParameter("id");
            HomeNotice ad = homeNoticeService.getHomeNotice(id);
            ad.setBeizhu(req.getParameter("beizhu"));
            ad.setContent(req.getParameter("content"));
            ad.setStarttime(req.getParameter("starttime"));
            ad.setEndtime(req.getParameter("endtime"));
            String show = req.getParameter("show");
            if (show != null && show.equalsIgnoreCase("on"))
                ad.setShow("1");
            else
                ad.setShow("0");
            ad.setSystem(new SystemInfo(req.getParameter("system")));
            ad.setUrl(req.getParameter("url"));
            homeNoticeService.updateHomeNotice(ad);
            req.setAttribute("id", id);
            return "homenotice_edit";
        } else if (type.equalsIgnoreCase("updateWeiXin")) {
            String id = req.getParameter("id");
            WeiXinInfo info = weiXinService.getWeiXinInfo(id);
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            if (!StringUtil.isNullOrEmpty(req.getParameter("portrait")))
                info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
            weiXinService.updateWeiXinInfo(info, req.getParameter("wximg"));
            req.setAttribute("id", id);
            return "weixin_edit";
        } else if (type.equalsIgnoreCase("addWeiXin")) {
            WeiXinInfo info = new WeiXinInfo();
            info.setAddress(req.getParameter("address"));
            info.setNickName(req.getParameter("nickname"));
            info.setPortrait(req.getParameter("portrait"));
            info.setSex(req.getParameter("sex"));
            info.setSign(req.getParameter("sign"));
            info.setType(req.getParameter("wtype"));
            info.setWeight(Integer.parseInt(req.getParameter("weight")));
            info.setWeiXinId(req.getParameter("weixinid"));
            info.setCreatetime(System.currentTimeMillis() + "");
            info = weiXinService.addWeiXinInfo(info);
            weiXinService.addWeiXinImage(info, req.getParameter("wximg"));
            return "weixin_add";
        } else if (type.equalsIgnoreCase("updateHomeVideo")) {
            String id = req.getParameter("id");
            String picture = req.getParameter("picture");
            HomeVideo video = homeTypeService.getHomeVideoById(id);
            video.setPicture(picture);
            homeTypeService.updateHomeVideo(video);
            req.setAttribute("id", id);
            return "homevideo_update";
        }
        return "";
    }
    }
}
src/main/java/com/yeshi/buwan/controller/admin/api/ClassController.java
@@ -7,8 +7,10 @@
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -32,325 +34,309 @@
import com.yeshi.buwan.service.imp.HomeTypeService;
import com.yeshi.buwan.service.imp.SystemService;
import com.yeshi.buwan.service.imp.recommend.CategoryRecommendVideoService;
import com.yeshi.buwan.util.Constant;
import com.yeshi.buwan.util.EhcacheUtil;
import com.yeshi.buwan.util.JsonUtil;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.web.tag.PageEntity;
@Controller
@RequestMapping("admin/new/api/class")
public class ClassController {
    @Resource
    private ClassService classService;
    @Resource
    private ClassService classService;
    @Resource
    private HomeTypeService homeTypeService;
    @Resource
    private HomeTypeService homeTypeService;
    @Resource
    private CategoryRecommendVideoService categoryRecommendVideoService;
    @Resource
    private CategoryRecommendVideoService categoryRecommendVideoService;
    @Resource
    private SystemService systemService;
    @Resource
    private CategoryAreaService categoryAreaService;
    @Resource
    private SystemService systemService;
    @RequestMapping(value = "/getnextclass", method = RequestMethod.POST)
    public void getNextClass(int pid, PrintWriter out) {
        System.out.println("pid--" + pid);
        List<VideoType> list;
        if (pid <= 0)
            list = classService.getNextTypeList("");
        else
            list = classService.getNextTypeList(pid + "");
    @Resource
    private CategoryAreaService categoryAreaService;
        JSONArray array = new JSONArray();
        if (list != null)
            for (VideoType type : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", type.getId());
                obj.put("name", type.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
    @RequestMapping("getAllFirstClass")
    public void getAllFirstClass(PrintWriter out){
        List<VideoType> list = classService.getAllVideoType();
        JSONArray array = new JSONArray();
        if (list != null)
            for (VideoType type : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", type.getId());
                obj.put("name", type.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
    @RequestMapping(value = "/getnextclass", method = RequestMethod.POST)
    public void getNextClass(int pid, PrintWriter out) {
        System.out.println("pid--" + pid);
        List<VideoType> list;
        if (pid <= 0)
            list = classService.getNextTypeList("");
        else
            list = classService.getNextTypeList(pid + "");
    @RequestMapping(value = "/gethometypelist", method = RequestMethod.POST)
    public void getHomeTypeList(int pid, PrintWriter out) {
        List<HomeType> list = homeTypeService.getHomeType();
        JSONArray array = new JSONArray();
        if (list != null)
            for (VideoType type : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", type.getId());
                obj.put("name", type.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
        JSONArray array = new JSONArray();
        if (list != null)
            for (HomeType type : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", type.getId());
                obj.put("name", type.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
    @RequestMapping("getAllFirstClass")
    public void getAllFirstClass(PrintWriter out) {
        List<VideoType> list = classService.getAllVideoType();
        JSONArray array = new JSONArray();
        if (list != null)
            for (VideoType type : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", type.getId());
                obj.put("name", type.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
    @RequestMapping(value = "/addhomevideos", method = RequestMethod.POST)
    public void addHomeVideos(int hometypeid, String videos, String pictures,
            String tags, PrintWriter out) {
        String[] videoStr = videos.split(",");
        String[] pictureStr = pictures.split(",");
        String[] tagStr = tags.split(",");
    @RequestMapping(value = "/gethometypelist", method = RequestMethod.POST)
    public void getHomeTypeList(int pid, PrintWriter out) {
        List<HomeType> list = homeTypeService.getHomeType();
        List<HomeVideo> list = new ArrayList<HomeVideo>();
        for (int i = 0; i < videoStr.length; i++) {
            HomeVideo hv = new HomeVideo();
            hv.setCreatetime(System.currentTimeMillis() + "");
            hv.setTag(tagStr[i]);
            hv.setPicture(pictureStr[i]);
            hv.setType(new HomeType(hometypeid + ""));
            hv.setVideo(new VideoInfo(videoStr[i]));
        }
        JSONArray array = new JSONArray();
        if (list != null)
            for (HomeType type : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", type.getId());
                obj.put("name", type.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
        homeTypeService.addHomeTypeVideo(list);
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
    /**
     * 搜索
     * @param key
     * @param detailsystem
     * @param videotype
     * @param page
     * @param out
     */
    @RequestMapping(value = "/getseachList",method=RequestMethod.POST)
    public void categoryRecommendVideoList(String key, String detailsystem,
            String videotype, String page, PrintWriter out) {
        if(detailsystem==null || "".equals(detailsystem.trim())){
            detailsystem="0";
        }
        if(page==null || "".equals(page.trim())){
            page="1";
        }
        int pageIndex = Integer.parseInt(page);
        if (pageIndex == 0)
            pageIndex = 1;
    @RequestMapping(value = "/addhomevideos", method = RequestMethod.POST)
    public void addHomeVideos(int hometypeid, String videos, String pictures,
                              String tags, PrintWriter out) {
        String[] videoStr = videos.split(",");
        String[] pictureStr = pictures.split(",");
        String[] tagStr = tags.split(",");
        videotype = StringUtil.isNullOrEmpty(videotype) ? "150" : videotype;
        List<CategoryRecommendVideoAdmin> list = categoryRecommendVideoService
                .getCategoryRecommendVideoAdmin(key,
                        Integer.parseInt(videotype), Integer.parseInt(detailsystem), pageIndex);
        long count = categoryRecommendVideoService
                .getCategoryRecommendVideoAdminCount(key,
                        Integer.parseInt(videotype), Integer.parseInt(detailsystem));
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        map.put("videotype", videotype + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
                .create();
        JSONObject root = new JSONObject();
        root.put("code", "0");
        root.put("pageEntity", pe);
        String json = gson.toJson(list);
        root.put("crv", json);
        // for (CategoryRecommendVideoAdmin categoryRecommendVideoAdmin : list)
        // {
        // System.out.println(categoryRecommendVideoAdmin.getCategoryRecommendVideo().getCategoryRecommendVideo());
        // root.put("categoryRecommendVideoAdmin",
        // gson.toJson(categoryRecommendVideoAdmin.getCategoryRecommendVideo().getCategoryRecommendVideo()));
        // }
        System.out.println(root.toString());
        out.print(root);
        // dataMap.put("categoryRecommendVideoAdminList", list);
//        List<DetailSystem> detailSystemList = systemService
//                .getDetailSystemList();
        // dataMap.put("detailSystemList", detailSystemList);
//        List<VideoType> typeList = classService.getFirstTypeList("");
        // dataMap.put("videoTypeList", typeList);
        // json.put("data", data);
        // System.out.println("jsonStr---------"+jsonStr);
        // out.print(jsonStr);
    }
    @RequestMapping(value="/deleteCategoryRecommendVideo",method=RequestMethod.POST)
    public void deleteCategoryRecommendVideo(String ids,PrintWriter out) {
        if(ids == null || ids.trim().length()==0){
            return;
        }
        String[] idArr = ids.split(",");
        for (String id : idArr) {
            System.out.println(id);
            categoryRecommendVideoService.deleteCategoryRecommendVideo(new CategoryRecommendVideo(id));
        }
        out.print("yes");
    }
    @RequestMapping(value="/getCategoryRecommendVideo",method=RequestMethod.POST)
    public void getCategoryRecommendVideo(String id,PrintWriter out) {
        List<HomeVideo> list = new ArrayList<HomeVideo>();
        for (int i = 0; i < videoStr.length; i++) {
            HomeVideo hv = new HomeVideo();
            hv.setCreatetime(System.currentTimeMillis() + "");
            hv.setTag(tagStr[i]);
            hv.setPicture(pictureStr[i]);
            hv.setType(new HomeType(hometypeid + ""));
            hv.setVideo(new VideoInfo(videoStr[i]));
        }
        homeTypeService.addHomeTypeVideo(list);
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
    /**
     * 搜索
     *
     * @param key
     * @param detailsystem
     * @param videotype
     * @param page
     * @param out
     */
    @RequestMapping(value = "/getseachList", method = RequestMethod.POST)
    public void categoryRecommendVideoList(String key, String detailsystem,
                                           String videotype, String page, HttpSession session, PrintWriter out) {
        if (detailsystem == null || "".equals(detailsystem.trim())) {
            detailsystem = "0";
        }
        if (page == null || "".equals(page.trim())) {
            page = "1";
        }
        int pageIndex = Integer.parseInt(page);
        if (pageIndex == 0)
            pageIndex = 1;
        videotype = StringUtil.isNullOrEmpty(videotype) ? "150" : videotype;
        List<CategoryRecommendVideoAdmin> list = categoryRecommendVideoService
                .getCategoryRecommendVideoAdmin(key,
                        Integer.parseInt(videotype), SystemUtil.getAdminSelectedSystemId(session), Integer.parseInt(detailsystem), pageIndex);
        long count = categoryRecommendVideoService
                .getCategoryRecommendVideoAdminCount(key,
                        Integer.parseInt(videotype), SystemUtil.getAdminSelectedSystemId(session), Integer.parseInt(detailsystem));
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        map.put("videotype", videotype + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
                .create();
        JSONObject root = new JSONObject();
        root.put("code", "0");
        root.put("pageEntity", pe);
        String json = gson.toJson(list);
        root.put("crv", json);
        System.out.println(root.toString());
        out.print(root);
    }
    @RequestMapping(value = "/deleteCategoryRecommendVideo", method = RequestMethod.POST)
    public void deleteCategoryRecommendVideo(String ids, PrintWriter out) {
        if (ids == null || ids.trim().length() == 0) {
            return;
        }
        String[] idArr = ids.split(",");
        for (String id : idArr) {
            System.out.println(id);
            categoryRecommendVideoService.deleteCategoryRecommendVideo(new CategoryRecommendVideo(id));
        }
        out.print("yes");
    }
    @RequestMapping(value = "/getCategoryRecommendVideo", method = RequestMethod.POST)
    public void getCategoryRecommendVideo(String id, PrintWriter out) {
//        id = StringUtil.isNullOrEmpty(id) ? request.getAttribute("id").toString() : id;
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
                .create();
        JSONObject root = new JSONObject();
        CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id);
        if(categoryRecommendVideo != null){
            String json = gson.toJson(categoryRecommendVideo);
            root.put("code", "0");
            root.put("crv", json);
        }else{
            root.put("code", "1");
            root.put("crv", null);
        }
        out.print(root);
        //request.setAttribute("videoTypeList", classService.getFirstTypeList(""));
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
                .create();
        JSONObject root = new JSONObject();
        CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id);
        if (categoryRecommendVideo != null) {
            String json = gson.toJson(categoryRecommendVideo);
            root.put("code", "0");
            root.put("crv", json);
        } else {
            root.put("code", "1");
            root.put("crv", null);
        }
        out.print(root);
        //request.setAttribute("videoTypeList", classService.getFirstTypeList(""));
//        request.setAttribute("systemList", systemService.getSystemList());
//        request.setAttribute("categoryRecommendVideo", categoryRecommendVideo);
        return ;
    }
    @RequestMapping(value="/setCategoryRecommendVideo",method=RequestMethod.POST)
    public void updateCategoryRecommendVideo(String id,String beizhu,String desc,int orderby,String picture,String videoid,String videotype,PrintWriter out) {
        //id为空则新加
        if(id == null || "".equals(id.trim())){
            CategoryRecommendVideo newCategoryRecommendVideo=new CategoryRecommendVideo();
            newCategoryRecommendVideo.setBeizhu(beizhu);
            newCategoryRecommendVideo.setCreatetime(System.currentTimeMillis() + "");
            newCategoryRecommendVideo.setDesc(desc);
//            categoryRecommendVideo.setJpos(jpos);
            newCategoryRecommendVideo.setOrderby(orderby);
            newCategoryRecommendVideo.setPicture(picture);
            newCategoryRecommendVideo.setVideoInfo(new VideoInfo(videoid));
            newCategoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype)));
            categoryRecommendVideoService.addCategoryRecommendVideo(newCategoryRecommendVideo);
            SuperCategoryRecommendVideo sz=null;
            List<DetailSystem> list = systemService.getDetailSystemList();
            for (DetailSystem ds : list) {
                sz= new SuperCategoryRecommendVideo();
                sz.setDetailSystem(new DetailSystem(ds.getId()));
                sz.setCategoryRecommendVideo(newCategoryRecommendVideo);
                categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz);
            }
            out.print("yes");
            return;
        }
        CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id);
        categoryRecommendVideo.setBeizhu(beizhu);
        categoryRecommendVideo.setCreatetime(System.currentTimeMillis() + "");
        categoryRecommendVideo.setDesc(desc);
        return;
    }
    @RequestMapping(value = "/setCategoryRecommendVideo", method = RequestMethod.POST)
    public void updateCategoryRecommendVideo(String id, String beizhu, String desc, int orderby, String picture, String videoid, String videotype, HttpSession session, PrintWriter out) {
        //id为空则新加
        if (id == null || "".equals(id.trim())) {
            CategoryRecommendVideo newCategoryRecommendVideo = new CategoryRecommendVideo();
            newCategoryRecommendVideo.setBeizhu(beizhu);
            newCategoryRecommendVideo.setCreatetime(System.currentTimeMillis() + "");
            newCategoryRecommendVideo.setDesc(desc);
            newCategoryRecommendVideo.setOrderby(orderby);
            newCategoryRecommendVideo.setPicture(picture);
            newCategoryRecommendVideo.setVideoInfo(new VideoInfo(videoid));
            newCategoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype)));
            newCategoryRecommendVideo.setSystem(SystemUtil.getAdminSelectedSystem(session));
            categoryRecommendVideoService.addCategoryRecommendVideo(newCategoryRecommendVideo);
            SuperCategoryRecommendVideo sz = null;
            List<DetailSystem> list = systemService.getDetailSystemList(SystemUtil.getAdminSelectedSystem(session).getId());
            for (DetailSystem ds : list) {
                sz = new SuperCategoryRecommendVideo();
                sz.setDetailSystem(new DetailSystem(ds.getId()));
                sz.setCategoryRecommendVideo(newCategoryRecommendVideo);
                categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz);
            }
            out.print("yes");
            return;
        }
        CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id);
        categoryRecommendVideo.setBeizhu(beizhu);
        categoryRecommendVideo.setCreatetime(System.currentTimeMillis() + "");
        categoryRecommendVideo.setDesc(desc);
//        categoryRecommendVideo.setJpos(jpos);
        categoryRecommendVideo.setOrderby(orderby);
        categoryRecommendVideo.setPicture(picture);
        categoryRecommendVideo.setVideoInfo(new VideoInfo(videoid));
        categoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype)));
        categoryRecommendVideoService.updateCategoryRecommendVideo(categoryRecommendVideo);
        out.print("yes");
        return ;
    }
    @RequestMapping(value = "/CategoryRecommendVideoAdminServlet", method = RequestMethod.POST)
    public void set(String type, String id, String systemid,PrintWriter out) {
        System.out.println("type--"+type);
        System.out.println("id--"+id);
        System.out.println("systemid--"+systemid);
        if ("add".equalsIgnoreCase(type)) {// 获取来源列表
            if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) {
                SuperCategoryRecommendVideo sz=new SuperCategoryRecommendVideo();
                sz.setDetailSystem(new DetailSystem(systemid));
                sz.setCategoryRecommendVideo(new CategoryRecommendVideo(id));
                categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz);
            }
            out.print("yes");
        } else if ("delete".equalsIgnoreCase(type)) {
            if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) {
                categoryRecommendVideoService.deleteCategoryRecommendVideoAdmin(id, systemid);
            }
            out.print("yes");
        }
    }
    @RequestMapping("getAreaList")
    public void getAreaList(long cid,PrintWriter out){
        List<CategoryContry> list = categoryAreaService.getCategoryContryListByCid(cid+"");
        if(list.size() ==0){
            out.print( JsonUtil.loadFalseAdmin("加载错误"));
             return;
        }
        List<CategoryContry> categoryContryList = categoryAreaService.categoryContryList(list.get(0).getId()+"");
        PageEntity pe = new PageEntity();
        pe.setPageIndex(1);
        pe.setPageSize(categoryContryList.size());
        pe.setTotalCount(categoryContryList.size());
        JSONObject data = new JSONObject();
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        data.put("pe", pe);
        data.put("list", gson.toJson(categoryContryList));
        String json = JsonUtil.loadTrueAdmin(data);
        out.print(json);
    }
    @RequestMapping("getArea")
    public void getArea(long id,PrintWriter out){
        CategoryContry area = categoryAreaService.getCategoryArea(id+"");
        if(area == null){
            out.print(JsonUtil.loadFalseAdmin(""));
            return;
        }
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        out.print(JsonUtil.loadTrueAdmin(gson.toJson(area)));
    }
    @RequestMapping("updateArea")
    public void updateArea(long id,int orderBy,PrintWriter out){
        CategoryContry area = categoryAreaService.getCategoryArea(id+"");
        if(area == null){
            out.print(JsonUtil.loadFalseAdmin(""));
            return;
        }
        area.setOrderby(orderBy);
        categoryAreaService.updateArea(area);
        out.print(JsonUtil.loadTrueAdmin(""));
    }
        categoryRecommendVideo.setOrderby(orderby);
        categoryRecommendVideo.setPicture(picture);
        categoryRecommendVideo.setVideoInfo(new VideoInfo(videoid));
        categoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype)));
        categoryRecommendVideoService.updateCategoryRecommendVideo(categoryRecommendVideo);
        out.print("yes");
        return;
    }
    @RequestMapping(value = "/CategoryRecommendVideoAdminServlet", method = RequestMethod.POST)
    public void set(String type, String id, String systemid, PrintWriter out) {
        System.out.println("type--" + type);
        System.out.println("id--" + id);
        System.out.println("systemid--" + systemid);
        if ("add".equalsIgnoreCase(type)) {// 获取来源列表
            if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) {
                SuperCategoryRecommendVideo sz = new SuperCategoryRecommendVideo();
                sz.setDetailSystem(new DetailSystem(systemid));
                sz.setCategoryRecommendVideo(new CategoryRecommendVideo(id));
                categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz);
            }
            out.print("yes");
        } else if ("delete".equalsIgnoreCase(type)) {
            if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) {
                categoryRecommendVideoService.deleteCategoryRecommendVideoAdmin(id, systemid);
            }
            out.print("yes");
        }
    }
    @RequestMapping("getAreaList")
    public void getAreaList(long cid, PrintWriter out) {
        List<CategoryContry> list = categoryAreaService.getCategoryContryListByCid(cid + "");
        if (list.size() == 0) {
            out.print(JsonUtil.loadFalseAdmin("加载错误"));
            return;
        }
        List<CategoryContry> categoryContryList = categoryAreaService.categoryContryList(list.get(0).getId() + "");
        PageEntity pe = new PageEntity();
        pe.setPageIndex(1);
        pe.setPageSize(categoryContryList.size());
        pe.setTotalCount(categoryContryList.size());
        JSONObject data = new JSONObject();
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        data.put("pe", pe);
        data.put("list", gson.toJson(categoryContryList));
        String json = JsonUtil.loadTrueAdmin(data);
        out.print(json);
    }
    @RequestMapping("getArea")
    public void getArea(long id, PrintWriter out) {
        CategoryContry area = categoryAreaService.getCategoryArea(id + "");
        if (area == null) {
            out.print(JsonUtil.loadFalseAdmin(""));
            return;
        }
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        out.print(JsonUtil.loadTrueAdmin(gson.toJson(area)));
    }
    @RequestMapping("updateArea")
    public void updateArea(long id, int orderBy, PrintWriter out) {
        CategoryContry area = categoryAreaService.getCategoryArea(id + "");
        if (area == null) {
            out.print(JsonUtil.loadFalseAdmin(""));
            return;
        }
        area.setOrderby(orderBy);
        categoryAreaService.updateArea(area);
        out.print(JsonUtil.loadTrueAdmin(""));
    }
}
src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java
@@ -4,7 +4,9 @@
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -47,8 +49,8 @@
    }
    @RequestMapping(value = "/detailsystemlist", method = RequestMethod.POST)
    public void detailSystemList(String key, PrintWriter out) {
        List<DetailSystem> list = systemService.getDetailSystemList();
    public void detailSystemList(String key, HttpSession session, PrintWriter out) {
        List<DetailSystem> list = systemService.getDetailSystemList(SystemUtil.getAdminSelectedSystem(session).getId());
        JSONArray array = new JSONArray();
        if (list != null)
            for (DetailSystem system : list) {
src/main/java/com/yeshi/buwan/controller/admin/api/HomeBannerController.java
@@ -5,7 +5,9 @@
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -33,189 +35,189 @@
@Controller
@RequestMapping("admin/new/api/homebanner")
public class HomeBannerController {
    @Resource
    private HomeAdService homeAdService;
    @Resource
    private SpecialService specialService;
    @Resource
    private HomeAdService homeAdService;
    @Resource
    private SpecialService specialService;
    @RequestMapping(value = "/gethomeadlistadmin", method = RequestMethod.POST)
    public void getHomeBannerListAdmin(int page, int detailsystem, String key, PrintWriter out) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
    @RequestMapping(value = "/gethomeadlistadmin", method = RequestMethod.POST)
    public void getHomeBannerListAdmin(int page, int detailsystem, String key, HttpSession session, PrintWriter out) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
        List<HomeAdAdmin> list = homeAdService.getHomeAdAdmin(key, detailsystem, page);
        List<HomeAdAdmin> list = homeAdService.getHomeAdAdmin(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem, page);
        long count = homeAdService.getHomeAdAdminCount(key, detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(page);
        pe.setPageSize(Constant.pageCount);
        pe.setTotalCount((int) count);
        JSONArray array = new JSONArray();
        Gson gson = new GsonBuilder().create();
        for (HomeAdAdmin ht : list) {
            JSONObject root = new JSONObject();
            ht.getHomeAd().getHomeAd().setSystem(null);
            ht.getHomeAd().getHomeAd().setTag(null);
            ht.getHomeAd().getHomeAd().setAdmin(null);
            ht.getHomeAd().getHomeAd().setVideo(null);
            root.put("homeAd", gson.toJson(ht.getHomeAd().getHomeAd()));
            JSONArray darray = new JSONArray();
            for (DetailSystemSelect dss : ht.getDetailSystemList()) {
                dss.getDetailSystem().setSystem(null);
                darray.add(gson.toJson(dss));
            }
            root.put("detailSystemList", darray);
            array.add(root);
        }
        long count = homeAdService.getHomeAdAdminCount(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(page);
        pe.setPageSize(Constant.pageCount);
        pe.setTotalCount((int) count);
        JSONArray array = new JSONArray();
        Gson gson = new GsonBuilder().create();
        for (HomeAdAdmin ht : list) {
            JSONObject root = new JSONObject();
            ht.getHomeAd().getHomeAd().setSystem(null);
            ht.getHomeAd().getHomeAd().setTag(null);
            ht.getHomeAd().getHomeAd().setAdmin(null);
            ht.getHomeAd().getHomeAd().setVideo(null);
            root.put("homeAd", gson.toJson(ht.getHomeAd().getHomeAd()));
            JSONArray darray = new JSONArray();
            for (DetailSystemSelect dss : ht.getDetailSystemList()) {
                dss.getDetailSystem().setSystem(null);
                darray.add(gson.toJson(dss));
            }
            root.put("detailSystemList", darray);
            array.add(root);
        }
        JSONObject data = new JSONObject();
        data.put("pageEntity", gson.toJson(pe));
        data.put("data", array);
        JSONObject data = new JSONObject();
        data.put("pageEntity", gson.toJson(pe));
        data.put("data", array);
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", data);
        out.print(object);
    }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", data);
        out.print(object);
    }
    @RequestMapping(value = "/deletesuperhomead", method = RequestMethod.POST)
    public void deleteSuperHomeAd(long id, int detailsystem, PrintWriter out) {
        homeAdService.deleteHomeAdAdmin(id + "", detailsystem + "");
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "删除成功");
        out.print(object);
    }
    @RequestMapping(value = "/deletesuperhomead", method = RequestMethod.POST)
    public void deleteSuperHomeAd(long id, int detailsystem, PrintWriter out) {
        homeAdService.deleteHomeAdAdmin(id + "", detailsystem + "");
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "删除成功");
        out.print(object);
    }
    @RequestMapping(value = "/addsuperhomead", method = RequestMethod.POST)
    public void addSuperHomeAd(long id, int detailsystem, PrintWriter out) {
        SuperHomeAd sht = new SuperHomeAd();
        sht.setCreatetime(System.currentTimeMillis() + "");
        sht.setDetailSystem(new DetailSystem(detailsystem + ""));
        sht.setHomeAd(new HomeAd(id + ""));
        homeAdService.addSuperHomeAd(sht);
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
    @RequestMapping(value = "/addsuperhomead", method = RequestMethod.POST)
    public void addSuperHomeAd(long id, int detailsystem, PrintWriter out) {
        SuperHomeAd sht = new SuperHomeAd();
        sht.setCreatetime(System.currentTimeMillis() + "");
        sht.setDetailSystem(new DetailSystem(detailsystem + ""));
        sht.setHomeAd(new HomeAd(id + ""));
        homeAdService.addSuperHomeAd(sht);
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
    @RequestMapping(value = "/deletehomead", method = RequestMethod.POST)
    public void deleteHomeAd(String ids, PrintWriter out) {
        String[] idStrs = ids.split(",");
        for (String id : idStrs) {
            homeAdService.deleteHomeAd(id);
        }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "删除成功");
        out.print(object);
    }
    @RequestMapping(value = "/deletehomead", method = RequestMethod.POST)
    public void deleteHomeAd(String ids, PrintWriter out) {
        String[] idStrs = ids.split(",");
        for (String id : idStrs) {
            homeAdService.deleteHomeAd(id);
        }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "删除成功");
        out.print(object);
    }
    @RequestMapping(value = "/gethomead", method = RequestMethod.POST)
    public void getHomeAd(String id, PrintWriter out) {
        HomeAd ht = homeAdService.getHomeAdById(id);
        String linkValue = "";
        switch (ht.getLinkType()) {
        case 1:
            linkValue = ht.getVideo().getId();
            break;
        case 2:
            linkValue = JSONObject.fromObject(ht.getParams()).optString("id");
            break;
        case 3:
            linkValue = JSONObject.fromObject(ht.getParams()).optString("id");
            break;
        }
        ht.setVideo(null);
        ht.setAdmin(null);
        ht.setSystem(null);
        Gson gson = new GsonBuilder().create();
        JSONObject obj = JSONObject.fromObject(gson.toJson(ht));
        obj.put("linkValue", linkValue);
    @RequestMapping(value = "/gethomead", method = RequestMethod.POST)
    public void getHomeAd(String id, PrintWriter out) {
        HomeAd ht = homeAdService.getHomeAdById(id);
        String linkValue = "";
        switch (ht.getLinkType()) {
            case 1:
                linkValue = ht.getVideo().getId();
                break;
            case 2:
                linkValue = JSONObject.fromObject(ht.getParams()).optString("id");
                break;
            case 3:
                linkValue = JSONObject.fromObject(ht.getParams()).optString("id");
                break;
        }
        ht.setVideo(null);
        ht.setAdmin(null);
        ht.setSystem(null);
        Gson gson = new GsonBuilder().create();
        JSONObject obj = JSONObject.fromObject(gson.toJson(ht));
        obj.put("linkValue", linkValue);
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", obj);
        out.print(object);
    }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", obj);
        out.print(object);
    }
    @RequestMapping(value = "/updatehomead", method = RequestMethod.POST)
    public void updateHomeAd(HomeAd homeAd, String linkValue, PrintWriter out) {
        HomeAd ht = homeAdService.getHomeAdById(homeAd.getId());
        ht.setClazz(homeAd.getClazz());
        ht.setIntroduction(homeAd.getIntroduction());
        ht.setLinkType(homeAd.getLinkType());
        ht.setOrderby(homeAd.getOrderby());
        ht.setPicture(homeAd.getPicture());
        if (homeAd.getLinkType() == 1) {
            ht.setVideo(new VideoInfo(linkValue));
        } else if (homeAd.getLinkType() == 2) {
            JSONObject obj = new JSONObject();
            obj.put("url", linkValue);
            ht.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
            ht.setVideo(new VideoInfo("1"));
            ht.setParams(obj.toString());
        } else if (homeAd.getLinkType() == 3) {
            JSONObject obj = new JSONObject();
            obj.put("id", linkValue);
            Special se = specialService.getSpecial(linkValue);
            if (se != null) {
                obj.put("title", se.getName());
            }
            ht.setVideo(new VideoInfo("1"));
            ht.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
            ht.setParams(obj.toString());
        }
    @RequestMapping(value = "/updatehomead", method = RequestMethod.POST)
    public void updateHomeAd(HomeAd homeAd, String linkValue, PrintWriter out) {
        HomeAd ht = homeAdService.getHomeAdById(homeAd.getId());
        ht.setClazz(homeAd.getClazz());
        ht.setIntroduction(homeAd.getIntroduction());
        ht.setLinkType(homeAd.getLinkType());
        ht.setOrderby(homeAd.getOrderby());
        ht.setPicture(homeAd.getPicture());
        if (homeAd.getLinkType() == 1) {
            ht.setVideo(new VideoInfo(linkValue));
        } else if (homeAd.getLinkType() == 2) {
            JSONObject obj = new JSONObject();
            obj.put("url", linkValue);
            ht.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
            ht.setVideo(new VideoInfo("1"));
            ht.setParams(obj.toString());
        } else if (homeAd.getLinkType() == 3) {
            JSONObject obj = new JSONObject();
            obj.put("id", linkValue);
            Special se = specialService.getSpecial(linkValue);
            if (se != null) {
                obj.put("title", se.getName());
            }
            ht.setVideo(new VideoInfo("1"));
            ht.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
            ht.setParams(obj.toString());
        }
        homeAdService.updateHomeAd(ht);
        homeAdService.updateHomeAd(ht);
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "更改成功");
        out.print(object);
    }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "更改成功");
        out.print(object);
    }
    @RequestMapping(value = "/addhomead", method = RequestMethod.POST)
    public void addHomeAd(HomeAd homeAd, String linkValue, String detailsystemids, PrintWriter out) {
        if (homeAd.getLinkType() == 1) {
            homeAd.setVideo(new VideoInfo(linkValue));
        } else if (homeAd.getLinkType() == 2) {
            JSONObject obj = new JSONObject();
            obj.put("url", linkValue);
            homeAd.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
            homeAd.setVideo(new VideoInfo("1"));
            homeAd.setParams(obj.toString());
        } else if (homeAd.getLinkType() == 3) {
            JSONObject obj = new JSONObject();
            obj.put("id", linkValue);
            Special se = specialService.getSpecial(linkValue);
            if (se != null) {
                obj.put("title", se.getName());
            }
            homeAd.setVideo(new VideoInfo("1"));
            homeAd.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
            homeAd.setParams(obj.toString());
        }
        homeAd.setCreatetime(System.currentTimeMillis() + "");
    @RequestMapping(value = "/addhomead", method = RequestMethod.POST)
    public void addHomeAd(HomeAd homeAd, String linkValue, String detailsystemids, PrintWriter out) {
        if (homeAd.getLinkType() == 1) {
            homeAd.setVideo(new VideoInfo(linkValue));
        } else if (homeAd.getLinkType() == 2) {
            JSONObject obj = new JSONObject();
            obj.put("url", linkValue);
            homeAd.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity");
            homeAd.setVideo(new VideoInfo("1"));
            homeAd.setParams(obj.toString());
        } else if (homeAd.getLinkType() == 3) {
            JSONObject obj = new JSONObject();
            obj.put("id", linkValue);
            Special se = specialService.getSpecial(linkValue);
            if (se != null) {
                obj.put("title", se.getName());
            }
            homeAd.setVideo(new VideoInfo("1"));
            homeAd.setClazz("com.weikou.beibeivideo.ui.common.MVideosActivity");
            homeAd.setParams(obj.toString());
        }
        homeAd.setCreatetime(System.currentTimeMillis() + "");
        Serializable id = homeAdService.addHomeAd(homeAd);
        Serializable id = homeAdService.addHomeAd(homeAd);
        if (id != null && !StringUtil.isNullOrEmpty(detailsystemids)) {
            homeAd.setId(id + "");
            String[] dss = detailsystemids.split(",");
            for (String did : dss) {
                SuperHomeAd sht = new SuperHomeAd();
                sht.setCreatetime(System.currentTimeMillis() + "");
                sht.setDetailSystem(new DetailSystem(did));
                sht.setHomeAd(new HomeAd(homeAd.getId()));
                homeAdService.addSuperHomeAd(sht);
            }
        }
        if (id != null && !StringUtil.isNullOrEmpty(detailsystemids)) {
            homeAd.setId(id + "");
            String[] dss = detailsystemids.split(",");
            for (String did : dss) {
                SuperHomeAd sht = new SuperHomeAd();
                sht.setCreatetime(System.currentTimeMillis() + "");
                sht.setDetailSystem(new DetailSystem(did));
                sht.setHomeAd(new HomeAd(homeAd.getId()));
                homeAdService.addSuperHomeAd(sht);
            }
        }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
}
src/main/java/com/yeshi/buwan/controller/admin/api/HomeTypeController.java
@@ -6,8 +6,10 @@
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import com.yeshi.buwan.util.SystemUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -55,11 +57,11 @@
    }
    @RequestMapping(value = "/gethometypelistadmin", method = RequestMethod.POST)
    public void getHomeTypeListAdmin(int page, int detailsystem, String key, PrintWriter out) {
    public void getHomeTypeListAdmin(int page, int detailsystem, String key, HttpSession session, PrintWriter out) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
        List<HomeTypeAdmin> list = homeTypeService.getHomeTypeAdmin(key, detailsystem, page);
        long count = homeTypeService.getHomeTypeAdminCount(key, detailsystem);
        List<HomeTypeAdmin> list = homeTypeService.getHomeTypeAdmin(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem, page);
        long count = homeTypeService.getHomeTypeAdminCount(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(page);
        pe.setPageSize(Constant.pageCount);
@@ -68,6 +70,7 @@
        Gson gson = new GsonBuilder().create();
        for (HomeTypeAdmin ht : list) {
            JSONObject root = new JSONObject();
            ht.getHomeType().getHomeType().getSystem().setAdmin(null);
            root.put("homeType", gson.toJson(ht.getHomeType().getHomeType()));
            JSONArray darray = new JSONArray();
            for (DetailSystemSelect dss : ht.getDetailSystemList()) {
src/main/java/com/yeshi/buwan/controller/admin/api/HotSearchController.java
@@ -6,7 +6,9 @@
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
@@ -28,115 +30,117 @@
@Controller
@RequestMapping("admin/new/api/hotSearch")
public class HotSearchController {
    @Resource
    private SearchService searchService;
    @Resource
    private SystemService systemService;
    @RequestMapping("hotSearchList")
    public void hotSearchList(int pageIndex,int detailsystem,String key,PrintWriter out) {
        if (pageIndex == 0)
            pageIndex = 1;
    @Resource
    private SearchService searchService;
    @Resource
    private SystemService systemService;
        List<HotSearchAdmin> list = searchService.getHotSearchAdmin(key, detailsystem, pageIndex);
        Gson gson =new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        long count = searchService.getHotSearchAdminCount(key, detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        JSONObject json =new JSONObject();
        json.put("code", "0");
        json.put("hotSearchAdminList", gson.toJson(list));
        json.put("pageEntity", pe);
    @RequestMapping("hotSearchList")
    public void hotSearchList(int pageIndex, int detailsystem, String key, HttpSession session, PrintWriter out) {
        if (pageIndex == 0)
            pageIndex = 1;
        List<HotSearchAdmin> list = searchService.getHotSearchAdmin(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem, pageIndex);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        long count = searchService.getHotSearchAdminCount(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("hotSearchAdminList", gson.toJson(list));
        json.put("pageEntity", pe);
//        List<DetailSystem> detailSystemList = systemService.getDetailSystemList();
//        request.setAttribute("detailSystemList", detailSystemList);
        System.out.println(json);
        out.print(json);
        return;
    }
    @RequestMapping(value = "/setSearchDetailSystem", method = RequestMethod.POST)
    public void set(String id, String type,String detailSystem, PrintWriter out) {
        if ("add".equalsIgnoreCase(type)) {// 获取来源列表
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                SuperHotSearch sz = new SuperHotSearch();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setHotSearch(new HotSearch(id));
                searchService.addSuperHotSearch(sz);
            }
            out.print("yes");
        } else if ("delete".equalsIgnoreCase(type)) {// 获取下级分类
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                searchService.deleteHotSearchAdmin(id, detailSystem);
            }
            out.print("yes");
        }
        return;
    }
    @RequestMapping(value="deleteHotSearchList",method=RequestMethod.POST)
    public void deleteHotSearchList(String ids,PrintWriter out) {
        String[] idArr = ids.split(",");
        for (String st : idArr) {
            System.out.println("id---"+st);
            searchService.deleteHotSearch(new HotSearch(st));
        }
        out.print("yes");
        return;
    }
        System.out.println(json);
        out.print(json);
        return;
    }
    @RequestMapping(value="addHotSearch",method=RequestMethod.POST)
    public void addHotSearch(String name,String beizhu,String detailsystems,PrintWriter out ) {
        System.out.println("name-"+name);
        System.out.println("beizhu-"+beizhu);
        System.out.println("detailsystems-"+detailsystems);
        HotSearch hotSearch = new HotSearch();
        hotSearch.setCreatetime(System.currentTimeMillis() + "");
        hotSearch.setName(name);
        hotSearch.setBeizhu(beizhu);
        searchService.addHotSearch(hotSearch);
        if (!StringUtil.isNullOrEmpty(detailsystems)) {
            String[] idst = detailsystems.split(",");
            for (String st : idst) {
                SuperHotSearch sz = new SuperHotSearch();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(st));
                sz.setHotSearch(hotSearch);
                searchService.addSuperHotSearch(sz);
            }
        }
        out.print("yes");
        return ;
    }
    @RequestMapping(value="updateHotSearch",method=RequestMethod.POST)
    public void updateHotSearch(String id,String name,String beizhu,PrintWriter out) {
        HotSearch hotSearch = searchService.getHotSearch(id);
        hotSearch.setBeizhu(beizhu);
        hotSearch.setName(name);
        searchService.updateHotSearch(hotSearch);
        out.print("yes");
        return ;
    }
    @RequestMapping(value = "/setSearchDetailSystem", method = RequestMethod.POST)
    public void set(String id, String type, String detailSystem, PrintWriter out) {
        if ("add".equalsIgnoreCase(type)) {// 获取来源列表
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                SuperHotSearch sz = new SuperHotSearch();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setHotSearch(new HotSearch(id));
                searchService.addSuperHotSearch(sz);
            }
            out.print("yes");
        } else if ("delete".equalsIgnoreCase(type)) {// 获取下级分类
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                searchService.deleteHotSearchAdmin(id, detailSystem);
            }
            out.print("yes");
        }
        return;
    }
    @RequestMapping(value="getHotSearch",method=RequestMethod.POST)
    public void getHotSearch(String id,PrintWriter out) {
        HotSearch hotSearch = searchService.getHotSearch(id);
        JSONObject json=new JSONObject();
        json.put("code", "0");
        json.put("hotSearch", hotSearch);
        out.print(json);
        return ;
    }
    @RequestMapping(value = "deleteHotSearchList", method = RequestMethod.POST)
    public void deleteHotSearchList(String ids, PrintWriter out) {
        String[] idArr = ids.split(",");
        for (String st : idArr) {
            System.out.println("id---" + st);
            searchService.deleteHotSearch(new HotSearch(st));
        }
        out.print("yes");
        return;
    }
    @RequestMapping(value = "addHotSearch", method = RequestMethod.POST)
    public void addHotSearch(String name, String beizhu, String detailsystems, HttpSession session, PrintWriter out) {
        System.out.println("name-" + name);
        System.out.println("beizhu-" + beizhu);
        System.out.println("detailsystems-" + detailsystems);
        HotSearch hotSearch = new HotSearch();
        hotSearch.setCreatetime(System.currentTimeMillis() + "");
        hotSearch.setName(name);
        hotSearch.setBeizhu(beizhu);
        hotSearch.setSystem(SystemUtil.getAdminSelectedSystem(session));
        searchService.addHotSearch(hotSearch);
        if (!StringUtil.isNullOrEmpty(detailsystems)) {
            String[] idst = detailsystems.split(",");
            for (String st : idst) {
                SuperHotSearch sz = new SuperHotSearch();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(st));
                sz.setHotSearch(hotSearch);
                searchService.addSuperHotSearch(sz);
            }
        }
        out.print("yes");
        return;
    }
    @RequestMapping(value = "updateHotSearch", method = RequestMethod.POST)
    public void updateHotSearch(String id, String name, String beizhu, PrintWriter out) {
        HotSearch hotSearch = searchService.getHotSearch(id);
        hotSearch.setBeizhu(beizhu);
        hotSearch.setName(name);
        searchService.updateHotSearch(hotSearch);
        out.print("yes");
        return;
    }
    @RequestMapping(value = "getHotSearch", method = RequestMethod.POST)
    public void getHotSearch(String id, PrintWriter out) {
        HotSearch hotSearch = searchService.getHotSearch(id);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("hotSearch", hotSearch);
        out.print(json);
        return;
    }
}
src/main/java/com/yeshi/buwan/controller/admin/api/HotStarController.java
@@ -9,7 +9,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
@@ -31,139 +33,140 @@
@Controller
@RequestMapping("admin/new/api/hotstar")
public class HotStarController {
    @Resource
    private StarService starService;
    @Resource
    private SystemService systemService;
    @Resource
    private StarService starService;
    @Resource
    private SystemService systemService;
    @RequestMapping(value = "/hotStarList", method = RequestMethod.POST)
    public void hotStarList(int pageIndex, String key, int detailsystem,
            PrintWriter out) {
        if (pageIndex <= 0) {
            pageIndex = 1;
        }
        List<HotStarAdmin> list = starService.getHotStarAdmin(key,
                detailsystem, pageIndex);
        long count = starService.getHotStarAdminCount(key, detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
    @RequestMapping(value = "/hotStarList", method = RequestMethod.POST)
    public void hotStarList(int pageIndex, String key, int detailsystem, HttpSession session,
                            PrintWriter out) {
        if (pageIndex <= 0) {
            pageIndex = 1;
        }
        List<HotStarAdmin> list = starService.getHotStarAdmin(key, SystemUtil.getAdminSelectedSystemId(session),
                detailsystem, pageIndex);
        long count = starService.getHotStarAdminCount(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("pageEntity", pe);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
                .create();
        json.put("hotStarAdminList", gson.toJson(list));
        // List<DetailSystem> detailSystemList = .getDetailSystemList();
        // json.put("detailSystemList", gson.toJson(detailSystemList));
        out.print(json);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("pageEntity", pe);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
                .create();
        json.put("hotStarAdminList", gson.toJson(list));
        // List<DetailSystem> detailSystemList = .getDetailSystemList();
        // json.put("detailSystemList", gson.toJson(detailSystemList));
        out.print(json);
        return;
    }
        return;
    }
    @RequestMapping("/getHotStar")
    public void getHotStar(String id, PrintWriter out) {
        HotStar hotStar = starService.getStar(id);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        Gson gson = new Gson();
        json.put("hotStar", gson.toJson(hotStar));
        System.out.println(json.toString());
        out.print(json);
        return;
    }
    @RequestMapping("/updateHotStar")
    public void updateHotStar(String id, String beizhu, String country,
            String job, String name, String orderby, String works,
            String portrait, PrintWriter out) {
        HotStar hotStar = starService.getStar(id);
        if(hotStar == null){
            out.print("no");
            return;
        }
        hotStar.setBeizhu(beizhu);
        hotStar.setCreatetime(System.currentTimeMillis() + "");
        hotStar.setCountry(country);
        hotStar.setJob(job);
        hotStar.setName(name);
        orderby = StringUtil.isNullOrEmpty(orderby) ? "0" : orderby;
        hotStar.setOrderby(Integer.parseInt(orderby));
        hotStar.setPortrait(portrait);
        hotStar.setWorks(works);
        starService.updateStar(hotStar);
        out.print("yes");
        return;
    }
    @RequestMapping("/addHotStar")
    public void addHotStar(String detailSystems,String beizhu,String country,String job,String name,String orderby,String portrait,String works,PrintWriter out) {
        List<String> sysList = new ArrayList<>();
        if (!StringUtil.isNullOrEmpty(detailSystems)) {
            if (detailSystems.contains(",")) {
                for (String st : detailSystems.split(","))
                    sysList.add(st);
            } else
                sysList.add(detailSystems);
        }
        HotStar hotStar = new HotStar();
        hotStar.setBeizhu(beizhu);
        hotStar.setCreatetime(System.currentTimeMillis() + "");
        hotStar.setCountry(country);
        hotStar.setJob(job);
        hotStar.setName(name);
        orderby = StringUtil.isNullOrEmpty(orderby) ? "0" : orderby;
        hotStar.setOrderby(Integer.parseInt(orderby));
        hotStar.setPortrait(portrait);
        hotStar.setWorks(works);
        hotStar = starService.addStar(hotStar);
        for (String ds : sysList) {
            SuperHotStar ss = new SuperHotStar();
            ss.setDetailSystem(new DetailSystem(ds));
            ss.setHotStar(hotStar);
            ss.setCreatetime(System.currentTimeMillis() + "");
            starService.addSuperHotStar(ss);
        }
        out.print("yes");
        return ;
    }
    @RequestMapping(value="/deleteHotStarList",method=RequestMethod.POST)
    public void deleteHotStarList(String ids,PrintWriter out) {
        String[] idArr = ids.split(",");
        for (String st : idArr) {
            starService.deleteStar(new HotStar(st));
            System.out.println(st);
        }
        out.print("yes");
        return;
    }
    @RequestMapping("setStarDetailSystem")
    public void setStarDetailSystem(String type,String detailSystem,String id, PrintWriter out) {
        System.out.println("type-"+type);
        System.out.println("detailSystem-"+detailSystem);
        System.out.println("id-"+id);
        if ("add".equalsIgnoreCase(type)) {
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                SuperHotStar sz = new SuperHotStar();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setHotStar(new HotStar(id));
                starService.addSuperHotStar(sz);
            }
            out.print("yes");
        } else if ("delete".equalsIgnoreCase(type)) {// 获取下级分类
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                starService.deleteHotStarAdmin(id, detailSystem);
            }
            out.print("yes");
        }
    }
    @RequestMapping("/getHotStar")
    public void getHotStar(String id, PrintWriter out) {
        HotStar hotStar = starService.getStar(id);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        Gson gson = new Gson();
        json.put("hotStar", gson.toJson(hotStar));
        System.out.println(json.toString());
        out.print(json);
        return;
    }
    @RequestMapping("/updateHotStar")
    public void updateHotStar(String id, String beizhu, String country,
                              String job, String name, String orderby, String works,
                              String portrait, PrintWriter out) {
        HotStar hotStar = starService.getStar(id);
        if (hotStar == null) {
            out.print("no");
            return;
        }
        hotStar.setBeizhu(beizhu);
        hotStar.setCreatetime(System.currentTimeMillis() + "");
        hotStar.setCountry(country);
        hotStar.setJob(job);
        hotStar.setName(name);
        orderby = StringUtil.isNullOrEmpty(orderby) ? "0" : orderby;
        hotStar.setOrderby(Integer.parseInt(orderby));
        hotStar.setPortrait(portrait);
        hotStar.setWorks(works);
        starService.updateStar(hotStar);
        out.print("yes");
        return;
    }
    @RequestMapping("/addHotStar")
    public void addHotStar(String detailSystems, String beizhu, String country, String job, String name, String orderby, String portrait, String works, HttpSession session, PrintWriter out) {
        List<String> sysList = new ArrayList<>();
        if (!StringUtil.isNullOrEmpty(detailSystems)) {
            if (detailSystems.contains(",")) {
                for (String st : detailSystems.split(","))
                    sysList.add(st);
            } else
                sysList.add(detailSystems);
        }
        HotStar hotStar = new HotStar();
        hotStar.setBeizhu(beizhu);
        hotStar.setCreatetime(System.currentTimeMillis() + "");
        hotStar.setCountry(country);
        hotStar.setJob(job);
        hotStar.setName(name);
        orderby = StringUtil.isNullOrEmpty(orderby) ? "0" : orderby;
        hotStar.setOrderby(Integer.parseInt(orderby));
        hotStar.setPortrait(portrait);
        hotStar.setWorks(works);
        hotStar.setSystem(SystemUtil.getAdminSelectedSystem(session));
        hotStar = starService.addStar(hotStar);
        for (String ds : sysList) {
            SuperHotStar ss = new SuperHotStar();
            ss.setDetailSystem(new DetailSystem(ds));
            ss.setHotStar(hotStar);
            ss.setCreatetime(System.currentTimeMillis() + "");
            starService.addSuperHotStar(ss);
        }
        out.print("yes");
        return;
    }
    @RequestMapping(value = "/deleteHotStarList", method = RequestMethod.POST)
    public void deleteHotStarList(String ids, PrintWriter out) {
        String[] idArr = ids.split(",");
        for (String st : idArr) {
            starService.deleteStar(new HotStar(st));
            System.out.println(st);
        }
        out.print("yes");
        return;
    }
    @RequestMapping("setStarDetailSystem")
    public void setStarDetailSystem(String type, String detailSystem, String id, PrintWriter out) {
        System.out.println("type-" + type);
        System.out.println("detailSystem-" + detailSystem);
        System.out.println("id-" + id);
        if ("add".equalsIgnoreCase(type)) {
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                SuperHotStar sz = new SuperHotStar();
                sz.setCreatetime(System.currentTimeMillis() + "");
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setHotStar(new HotStar(id));
                starService.addSuperHotStar(sz);
            }
            out.print("yes");
        } else if ("delete".equalsIgnoreCase(type)) {// 获取下级分类
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                starService.deleteHotStarAdmin(id, detailSystem);
            }
            out.print("yes");
        }
    }
}
src/main/java/com/yeshi/buwan/controller/admin/api/SpecialController.java
@@ -9,7 +9,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -35,241 +37,246 @@
@RequestMapping("admin/new/api/special")
public class SpecialController {
    @Resource
    private SpecialService specialService;
    @Resource
    private SpecialService specialService;
    @Resource
    private SystemService systemService;
    @RequestMapping(value = "/getspeciallist", method = RequestMethod.POST)
    public void getSpecialList(PrintWriter out) {
        List<Special> list = specialService.getSpecialList();
        JSONArray array = new JSONArray();
        if (list != null)
            for (Special special : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", special.getId());
                obj.put("name", special.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
    @Resource
    private SystemService systemService;
    @RequestMapping(value = "/addspecialvideo", method = RequestMethod.POST)
    public void addSpecialVideo(String specialid, String videos, PrintWriter out) {
        String[] videoStr = videos.split(",");
        String[] sps = specialid.split(",");
        for (String videoid : videoStr) {
            for (String sp : sps) {
                SpecialVideo sv = new SpecialVideo();
                sv.setCreatetime(System.currentTimeMillis() + "");
                sv.setOrderby(0);
                sv.setSpecial(new Special(sp));
                sv.setVideo(new VideoInfo(videoid));
                specialService.addSpecialVideo(sv);
            }
        }
    @RequestMapping(value = "/getspeciallist", method = RequestMethod.POST)
    public void getSpecialList(PrintWriter out) {
        List<Special> list = specialService.getSpecialList();
        JSONArray array = new JSONArray();
        if (list != null)
            for (Special special : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", special.getId());
                obj.put("name", special.getName());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
    /**
     * 关键字搜索列表
     *
     * @return
     */
    @RequestMapping(value = "/specialList", method = RequestMethod.POST)
    public void specialList(int pageIndex,String key,int detailsystem,PrintWriter out) {
    @RequestMapping(value = "/addspecialvideo", method = RequestMethod.POST)
    public void addSpecialVideo(String specialid, String videos, PrintWriter out) {
        String[] videoStr = videos.split(",");
        String[] sps = specialid.split(",");
        for (String videoid : videoStr) {
            for (String sp : sps) {
                SpecialVideo sv = new SpecialVideo();
                sv.setCreatetime(System.currentTimeMillis() + "");
                sv.setOrderby(0);
                sv.setSpecial(new Special(sp));
                sv.setVideo(new VideoInfo(videoid));
                specialService.addSpecialVideo(sv);
            }
        }
        if (pageIndex == 0)
            pageIndex = 1;
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("msg", "添加成功");
        out.print(object);
    }
        List<SpecialAdmin> list = specialService.getSpecialAdmin(key, detailsystem, pageIndex);
        long count = specialService.getSpecialAdminCount(key, detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        Gson gson =  new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        JSONObject root = new JSONObject();
        root.put("code", "0");
        root.put("pageEntity", pe);
        root.put("SpecialAdminList", gson.toJson(list));
        System.out.println(root.toString());
        out.print(root);
        return ;
    }
    @RequestMapping(value = "/delSpecial", method = RequestMethod.POST)
    public void delSpecial(String ids,PrintWriter out) {
        if(ids!=null && !"".equals(ids.trim())){
            String[] idArr = ids.split(",");
            for (String id : idArr) {
                specialService.deleteSpecial(new Special(id));
                System.out.println(id);
            }
            out.print("yes");
        }
    }
    @RequestMapping(value = "/setSpecialApp", method = RequestMethod.POST)
    public void set(String type,String detailSystem, String id,PrintWriter out) {
        System.out.println("type="+type);
        System.out.println("detailSystem="+detailSystem);
        if ("add".equalsIgnoreCase(type)) {// 获取来源列表
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                SuperSpecial sz = new SuperSpecial();
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setSpecial(new Special(id));
                specialService.addSuperSpecial(sz);
                out.print("yes");
            }
        } else if ("delete".equalsIgnoreCase(type)) {// 获取下级分类
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                specialService.deleteSpecialAdmin(id, detailSystem);
                out.print("yes");
            }
        }
    }
    @RequestMapping(value = "/getSpecial", method = RequestMethod.POST)
    public void getSpecial(String id,PrintWriter out) {
        Special special = specialService.getSpecial(id);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("data", new Gson().toJson(special));
        out.print(json);
        return ;
    }
    @RequestMapping(value = "/updateSpecial", method = RequestMethod.POST)
    public void updateSpecial(String id,String introduction,String name,int orderby,String picture,String show,String showonmain,PrintWriter out) {
        System.out.println("id:"+id);
        System.out.println("name:"+name);
        System.out.println("show:"+show);
        System.out.println("showonmain:"+showonmain);
        System.out.println("picture:"+picture);
        System.out.println("orderby:"+orderby);
        System.out.println("introduction:"+introduction);
        Special special = specialService.getSpecial(id);
        special.setIntroduction(introduction);
        special.setName(name);
        special.setOrderby(orderby);
        special.setPicture(picture);
        if ("on".equalsIgnoreCase(show))
            special.setShow(true);
        else
            special.setShow(false);
    /**
     * 关键字搜索列表
     *
     * @return
     */
    @RequestMapping(value = "/specialList", method = RequestMethod.POST)
    public void specialList(int pageIndex, String key, int detailsystem, HttpSession session, PrintWriter out) {
        if ("on".equalsIgnoreCase(showonmain))
            special.setShowonmain(true);
        else
            special.setShowonmain(false);
        specialService.updateSpecial(special);
        out.print("yes");
        return ;
    }
    @RequestMapping(value = "/addSpecial", method = RequestMethod.POST)
    public void addSpecial(String detailSystems,String introduction,String name,int orderby,String picture,String show,String showonmain,PrintWriter out) {
        System.out.println("name:"+name);
        System.out.println("detailSystems:"+detailSystems);
        System.out.println("show:"+show);
        System.out.println("showonmain:"+showonmain);
        System.out.println("picture:"+picture);
        System.out.println("orderby:"+orderby);
        System.out.println("introduction:"+introduction);
        List<String> sysList = new ArrayList<String>();
        if (!StringUtil.isNullOrEmpty(detailSystems)) {
            if (detailSystems.contains(",")) {
                for (String st : detailSystems.split(","))
                    sysList.add(st);
            } else
                sysList.add(detailSystems);
        }
        if (pageIndex == 0)
            pageIndex = 1;
        Special special = new Special();
        special.setIntroduction(introduction);
        special.setName(name);
        special.setOrderby(orderby);
        special.setPicture(picture);
        special.setCreatetime(System.currentTimeMillis() + "");
        if ("on".equalsIgnoreCase(show))
            special.setShow(true);
        else
            special.setShow(false);
        List<SpecialAdmin> list = specialService.getSpecialAdmin(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem, pageIndex);
        long count = specialService.getSpecialAdminCount(key, SystemUtil.getAdminSelectedSystemId(session), detailsystem);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        JSONObject root = new JSONObject();
        root.put("code", "0");
        root.put("pageEntity", pe);
        root.put("SpecialAdminList", gson.toJson(list));
        System.out.println(root.toString());
        out.print(root);
        return;
    }
        if ("on".equalsIgnoreCase(showonmain))
            special.setShowonmain(true);
        else
            special.setShowonmain(false);
    @RequestMapping(value = "/delSpecial", method = RequestMethod.POST)
    public void delSpecial(String ids, PrintWriter out) {
        if (ids != null && !"".equals(ids.trim())) {
            String[] idArr = ids.split(",");
            for (String id : idArr) {
                specialService.deleteSpecial(new Special(id));
                System.out.println(id);
            }
            out.print("yes");
        }
    }
        specialService.addSpecial(special);
    @RequestMapping(value = "/setSpecialApp", method = RequestMethod.POST)
    public void set(String type, String detailSystem, String id, PrintWriter out) {
        for (String ds : sysList) {
            SuperSpecial ss = new SuperSpecial();
            ss.setDetailSystem(new DetailSystem(ds));
            ss.setSpecial(special);
            specialService.addSuperSpecial(ss);
        }
        out.print("yes");
        return ;
    }
    @RequestMapping(value = "/specialVideoList", method = RequestMethod.POST)
    public void specialVideoList(String key,String specialId,int pageIndex,PrintWriter out) {
        System.out.println("key=="+key);
        System.out.println("specialId=="+specialId);
        System.out.println("type=" + type);
        System.out.println("detailSystem=" + detailSystem);
        long count = specialService.getSpecialVideoListCount(specialId, key);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("specialId", specialId);
        pe.setParams(map);
        pe.setTotalCount((int) count);
        JSONObject json=new JSONObject();
        json.put("code", "0");
        json.put("pageEntity", pe);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        List<SpecialVideo> list = specialService.getSpecialVideoList(specialId,pe, key);
        json.put("specialVideoList", gson.toJson(list));
        out.print(json);
        return ;
    }
    @RequestMapping(value = "/deleteSpecialVideoList", method = RequestMethod.POST)
    public void deleteSpecialVideoList(String ids,PrintWriter out) {
        if(!StringUtil.isNullOrEmpty(ids)){
            String[] idArr = ids.split(",");
            for (String id : idArr) {
                specialService.deleteSpecialVideo(id);
                System.out.println("iiid--"+id);
            }
            out.print("yes");
        }
        return;
    }
        if ("add".equalsIgnoreCase(type)) {// 获取来源列表
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                SuperSpecial sz = new SuperSpecial();
                sz.setDetailSystem(new DetailSystem(detailSystem));
                sz.setSpecial(new Special(id));
                specialService.addSuperSpecial(sz);
                out.print("yes");
            }
        } else if ("delete".equalsIgnoreCase(type)) {// 获取下级分类
            if (!StringUtil.isNullOrEmpty(detailSystem) && !StringUtil.isNullOrEmpty(id)) {
                specialService.deleteSpecialAdmin(id, detailSystem);
                out.print("yes");
            }
        }
    }
    @RequestMapping(value = "/getSpecial", method = RequestMethod.POST)
    public void getSpecial(String id, PrintWriter out) {
        Special special = specialService.getSpecial(id);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("data", new Gson().toJson(special));
        out.print(json);
        return;
    }
    @RequestMapping(value = "/updateSpecial", method = RequestMethod.POST)
    public void updateSpecial(String id, String introduction, String name, int orderby, String picture, String show, String showonmain, PrintWriter out) {
        System.out.println("id:" + id);
        System.out.println("name:" + name);
        System.out.println("show:" + show);
        System.out.println("showonmain:" + showonmain);
        System.out.println("picture:" + picture);
        System.out.println("orderby:" + orderby);
        System.out.println("introduction:" + introduction);
        Special special = specialService.getSpecial(id);
        special.setIntroduction(introduction);
        special.setName(name);
        special.setOrderby(orderby);
        special.setPicture(picture);
        if ("on".equalsIgnoreCase(show))
            special.setShow(true);
        else
            special.setShow(false);
        if ("on".equalsIgnoreCase(showonmain))
            special.setShowonmain(true);
        else
            special.setShowonmain(false);
        specialService.updateSpecial(special);
        out.print("yes");
        return;
    }
    @RequestMapping(value = "/addSpecial", method = RequestMethod.POST)
    public void addSpecial(String detailSystems, String introduction, String name, int orderby, String picture, String show, String showonmain, HttpSession session, PrintWriter out) {
        System.out.println("name:" + name);
        System.out.println("detailSystems:" + detailSystems);
        System.out.println("show:" + show);
        System.out.println("showonmain:" + showonmain);
        System.out.println("picture:" + picture);
        System.out.println("orderby:" + orderby);
        System.out.println("introduction:" + introduction);
        List<String> sysList = new ArrayList<String>();
        if (!StringUtil.isNullOrEmpty(detailSystems)) {
            if (detailSystems.contains(",")) {
                for (String st : detailSystems.split(","))
                    sysList.add(st);
            } else
                sysList.add(detailSystems);
        }
        Special special = new Special();
        special.setIntroduction(introduction);
        special.setName(name);
        special.setOrderby(orderby);
        special.setPicture(picture);
        special.setCreatetime(System.currentTimeMillis() + "");
        if ("on".equalsIgnoreCase(show))
            special.setShow(true);
        else
            special.setShow(false);
        if ("on".equalsIgnoreCase(showonmain))
            special.setShowonmain(true);
        else
            special.setShowonmain(false);
        special.setSystem(SystemUtil.getAdminSelectedSystem(session));
        specialService.addSpecial(special);
        for (String ds : sysList) {
            SuperSpecial ss = new SuperSpecial();
            ss.setDetailSystem(new DetailSystem(ds));
            ss.setSpecial(special);
            specialService.addSuperSpecial(ss);
        }
        out.print("yes");
        return;
    }
    @RequestMapping(value = "/specialVideoList", method = RequestMethod.POST)
    public void specialVideoList(String key, String specialId, int pageIndex, PrintWriter out) {
        System.out.println("key==" + key);
        System.out.println("specialId==" + specialId);
        long count = specialService.getSpecialVideoListCount(specialId, key);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", key);
        map.put("specialId", specialId);
        pe.setParams(map);
        pe.setTotalCount((int) count);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("pageEntity", pe);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        List<SpecialVideo> list = specialService.getSpecialVideoList(specialId, pe, key);
        json.put("specialVideoList", gson.toJson(list));
        out.print(json);
        return;
    }
    @RequestMapping(value = "/deleteSpecialVideoList", method = RequestMethod.POST)
    public void deleteSpecialVideoList(String ids, PrintWriter out) {
        if (!StringUtil.isNullOrEmpty(ids)) {
            String[] idArr = ids.split(",");
            for (String id : idArr) {
                specialService.deleteSpecialVideo(id);
                System.out.println("iiid--" + id);
            }
            out.print("yes");
        }
        return;
    }
}
src/main/java/com/yeshi/buwan/controller/admin/api/SystemController.java
@@ -7,7 +7,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
@@ -37,10 +39,10 @@
     * @return
     */
    @RequestMapping("detailSystemList")
    public void detailSystemList(int pageIndex,String key,PrintWriter out) {
    public void detailSystemList(int pageIndex, String key, HttpSession session, PrintWriter out) {
        pageIndex = pageIndex <= 0 ? 1 : pageIndex;
        List<DetailSystem> list = systemService.getDetailSystemList(key, pageIndex);
        long count = systemService.getDetailSystemListCount(key);
        List<DetailSystem> list = systemService.getDetailSystemList(key, SystemUtil.getAdminSelectedSystem(session).getId(), pageIndex);
        long count = systemService.getDetailSystemListCount(key,SystemUtil.getAdminSelectedSystem(session).getId());
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
src/main/java/com/yeshi/buwan/controller/admin/api/VideoAdminController.java
@@ -85,7 +85,12 @@
    }
    @RequestMapping(value = "/videolist", method = RequestMethod.POST)
    public void videoList(int videotype, int page, String key, String resourceIds, int contenttype, PrintWriter out) {
    public void videoList(int videotype, int page, String key, String type, String resourceIds, int contenttype, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(type)) {
            type = "name";
        }
        List<VideoInfo> list = null;
        long count = 0;
@@ -93,7 +98,20 @@
        //正片搜索
        if (contenttype == 1) {
            SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
            filter.setKey(key);
            switch (type) {
                case "name":
                    filter.setKey(key);
                    break;
                case "actor":
                    filter.setActor(key);
                    break;
                case "director":
                    filter.setDirector(key);
                    break;
            }
            filter.setVideoType(videotype == 0 ? null : videotype);
            filter.setContentType(1);
            if (!StringUtil.isNullOrEmpty(resourceIds)) {
src/main/java/com/yeshi/buwan/controller/admin/api/VideoTypeAdminController.java
@@ -11,7 +11,9 @@
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.yeshi.buwan.util.SystemUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
@@ -34,165 +36,165 @@
@Controller
@RequestMapping("admin/new/api/videoType")
public class VideoTypeAdminController {
    @Resource
    private ClassService classService;
    @Resource
    private SystemService systemService;
    private static final String IMGPATH="/upload/class";
    @RequestMapping("videoTypeList")
    public void videoTypeList(int pageIndex,int detailsystem,int pid,PrintWriter out) {
        if (pageIndex == 0)
            pageIndex = 1;
        List<com.yeshi.buwan.domain.web.VideoTypeAdmin> list = classService.getVideoTypeAdmin(detailsystem, pid,
                pageIndex);
    @Resource
    private ClassService classService;
        long count = classService.getVideoTypeAdminCount(detailsystem, pid);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("pid", pid + "");
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        JSONObject json=new JSONObject();
        json.put("code", "0");
        json.put("pageEntity", pe);
        Gson gson =new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        json.put("videoTypeAdminList",gson.toJson(list));
        out.print(json);
        return ;
    }
    @RequestMapping("getAllVideoType")
    public void getAllVideoType(PrintWriter out){
        List<VideoType> list = classService.getAllVideoType();
        Gson gson =new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        JSONObject json=new JSONObject();
        json.put("code", "0");
        json.put("list", gson.toJson(list));
        out.print(json);
    }
    @RequestMapping("setSuperVideoType")
    public void set(String type,String id,String icon,String detailSystem,PrintWriter out){
        if("add".equals(type)){
            SuperVideoType svt = new SuperVideoType();
            svt.setCreatetime(System.currentTimeMillis() + "");
            svt.setDetailSystem(new DetailSystem(detailSystem));
            svt.setPicture(icon.trim());
            svt.setType(new VideoType(Long.parseLong(id)));
            classService.addSuperVideoType(svt);
            out.print("yes");
        }else if("delete".equals(type)){
            classService.deleteVideoTypeAdmin(id, detailSystem);
            out.print("yes");
        }
    }
    @RequestMapping("getVideoType")
    public void getVideoType(String id,PrintWriter out) {
        VideoType vt = classService.getType(Long.parseLong(id));
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("videoType", vt);
        out.print(json);
        return ;
    }
    @RequestMapping("updateVideoType")
    public void updateVideoType(String id,String orderby,String name,String beizhu,String iconFile,String iconUrl,String show,String showTitle,PrintWriter out) {
        VideoType vt = classService.getType(Long.parseLong(id));
        vt.setOrderby(Integer.parseInt(orderby));
        if (iconFile != null && !"".equals(iconFile.trim())) {// 保存图片
                vt.setIcon(iconFile);
        } else {
            if (!StringUtil.isNullOrEmpty(iconUrl))
                vt.setIcon(iconUrl);
        }
        vt.setName(name);
        vt.setBeizhu(beizhu);
        vt.setShow(show);
        vt.setShowTitle(showTitle);
        classService.updateType(vt);
        out.print("yes");
        return ;
    }
    @RequestMapping("addVideoType")
    public void addVideoType(String pid,String orderby,String name,String beizhu,String iconFile,String iconUrl,String show,String showTitle,PrintWriter out) {
        VideoType vt = new VideoType();
        if (iconFile != null && !"".equals(iconFile.trim())) {// 保存图片
            vt.setIcon(iconFile);
    } else {
        if (!StringUtil.isNullOrEmpty(iconUrl))
            vt.setIcon(iconUrl);
    }
        vt.setName(name);
        vt.setBeizhu(beizhu);
        vt.setOrderby(Integer.parseInt(orderby));
        vt.setShow(show);
        vt.setCreatetime(String.valueOf(new Date().getTime()));
        vt.setShowTitle(showTitle);
        if (!StringUtil.isNullOrEmpty(pid) && !pid.equalsIgnoreCase("0")) {
            vt.setParent(new VideoType(Long.parseLong(pid)));
        }
        System.out.println("vt.getIcon()--"+vt.getIcon());
        classService.createType(vt);
        out.print("yes");
        return ;
    }
    @RequestMapping(value="updateVideoTypeFile",method=RequestMethod.POST)
    public void updateVideoTypeFile(@RequestParam("file") CommonsMultipartFile file,HttpServletRequest request,PrintWriter out){
        ServletContext servletContext = request.getSession().getServletContext();
        JSONObject json=new JSONObject();
        if(file != null){
            String root=servletContext.getRealPath(IMGPATH);
            if (!new File(root).exists()){
                new File(root).mkdirs();
            }
             File newFile=new File(root+"/"+file.getOriginalFilename());
            //通过CommonsMultipartFile的方法直接写文件(注意这个时候)
             try {
                file.transferTo(newFile);
                 json.put("code", "0");
                 json.put("path", IMGPATH+"/"+newFile.getName());
            } catch (IllegalStateException e) {
                e.printStackTrace();
                json.put("code", "2");
            } catch (IOException e) {
                e.printStackTrace();
                json.put("code", "2");
            }finally{
                out.print(json);
            }
        }else{
             json.put("code", "1");
             out.print(json);
        }
    }
    @RequestMapping("deleteVideoType")
    public void deleteVideoType(String ids,PrintWriter out) {
        String[] idArr = ids.split(",");
        for (String id : idArr) {
            System.out.println("id=="+id);
            if("310".equals(id)){ //310做特殊处理不删除 20170915
                continue;
            }
            classService.deleteVideoType(id);
        }
        out.print("yes");
        return;
    }
    @Resource
    private SystemService systemService;
    private static final String IMGPATH = "/upload/class";
    @RequestMapping("videoTypeList")
    public void videoTypeList(int pageIndex, int detailsystem, int pid, HttpSession session, PrintWriter out) {
        if (pageIndex == 0)
            pageIndex = 1;
        List<com.yeshi.buwan.domain.web.VideoTypeAdmin> list = classService.getVideoTypeAdmin(SystemUtil.getAdminSelectedSystemId(session), detailsystem, pid,
                pageIndex);
        long count = classService.getVideoTypeAdminCount(detailsystem, pid);
        PageEntity pe = new PageEntity();
        pe.setPageIndex(pageIndex);
        pe.setPageSize(Constant.pageCount);
        Map<String, String> map = new HashMap<String, String>();
        map.put("pid", pid + "");
        map.put("detailsystem", detailsystem + "");
        pe.setParams(map);
        pe.setTotalCount((int) count);
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("pageEntity", pe);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        json.put("videoTypeAdminList", gson.toJson(list));
        out.print(json);
        return;
    }
    @RequestMapping("getAllVideoType")
    public void getAllVideoType(PrintWriter out) {
        List<VideoType> list = classService.getAllVideoType();
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("list", gson.toJson(list));
        out.print(json);
    }
    @RequestMapping("setSuperVideoType")
    public void set(String type, String id, String icon, String detailSystem, PrintWriter out) {
        if ("add".equals(type)) {
            SuperVideoType svt = new SuperVideoType();
            svt.setCreatetime(System.currentTimeMillis() + "");
            svt.setDetailSystem(new DetailSystem(detailSystem));
            svt.setPicture(icon.trim());
            svt.setType(new VideoType(Long.parseLong(id)));
            classService.addSuperVideoType(svt);
            out.print("yes");
        } else if ("delete".equals(type)) {
            classService.deleteVideoTypeAdmin(id, detailSystem);
            out.print("yes");
        }
    }
    @RequestMapping("getVideoType")
    public void getVideoType(String id, PrintWriter out) {
        VideoType vt = classService.getType(Long.parseLong(id));
        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("videoType", vt);
        out.print(json);
        return;
    }
    @RequestMapping("updateVideoType")
    public void updateVideoType(String id, String orderby, String name, String beizhu, String iconFile, String iconUrl, String show, String showTitle, PrintWriter out) {
        VideoType vt = classService.getType(Long.parseLong(id));
        vt.setOrderby(Integer.parseInt(orderby));
        if (iconFile != null && !"".equals(iconFile.trim())) {// 保存图片
            vt.setIcon(iconFile);
        } else {
            if (!StringUtil.isNullOrEmpty(iconUrl))
                vt.setIcon(iconUrl);
        }
        vt.setName(name);
        vt.setBeizhu(beizhu);
        vt.setShow(show);
        vt.setShowTitle(showTitle);
        classService.updateType(vt);
        out.print("yes");
        return;
    }
    @RequestMapping("addVideoType")
    public void addVideoType(String pid, String orderby, String name, String beizhu, String iconFile, String iconUrl, String show, String showTitle, PrintWriter out) {
        VideoType vt = new VideoType();
        if (iconFile != null && !"".equals(iconFile.trim())) {// 保存图片
            vt.setIcon(iconFile);
        } else {
            if (!StringUtil.isNullOrEmpty(iconUrl))
                vt.setIcon(iconUrl);
        }
        vt.setName(name);
        vt.setBeizhu(beizhu);
        vt.setOrderby(Integer.parseInt(orderby));
        vt.setShow(show);
        vt.setCreatetime(String.valueOf(new Date().getTime()));
        vt.setShowTitle(showTitle);
        if (!StringUtil.isNullOrEmpty(pid) && !pid.equalsIgnoreCase("0")) {
            vt.setParent(new VideoType(Long.parseLong(pid)));
        }
        System.out.println("vt.getIcon()--" + vt.getIcon());
        classService.createType(vt);
        out.print("yes");
        return;
    }
    @RequestMapping(value = "updateVideoTypeFile", method = RequestMethod.POST)
    public void updateVideoTypeFile(@RequestParam("file") CommonsMultipartFile file, HttpServletRequest request, PrintWriter out) {
        ServletContext servletContext = request.getSession().getServletContext();
        JSONObject json = new JSONObject();
        if (file != null) {
            String root = servletContext.getRealPath(IMGPATH);
            if (!new File(root).exists()) {
                new File(root).mkdirs();
            }
            File newFile = new File(root + "/" + file.getOriginalFilename());
            //通过CommonsMultipartFile的方法直接写文件(注意这个时候)
            try {
                file.transferTo(newFile);
                json.put("code", "0");
                json.put("path", IMGPATH + "/" + newFile.getName());
            } catch (IllegalStateException e) {
                e.printStackTrace();
                json.put("code", "2");
            } catch (IOException e) {
                e.printStackTrace();
                json.put("code", "2");
            } finally {
                out.print(json);
            }
        } else {
            json.put("code", "1");
            out.print(json);
        }
    }
    @RequestMapping("deleteVideoType")
    public void deleteVideoType(String ids, PrintWriter out) {
        String[] idArr = ids.split(",");
        for (String id : idArr) {
            System.out.println("id==" + id);
            if ("310".equals(id)) { //310做特殊处理不删除 20170915
                continue;
            }
            classService.deleteVideoType(id);
        }
        out.print("yes");
        return;
    }
}
src/main/java/com/yeshi/buwan/controller/api/PushController.java
@@ -35,13 +35,13 @@
     */
    @RequestMapping("bindDeviceToken")
    @ResponseBody
    public String bindDeviceToken(AcceptData acceptData, String loginUid, @NotEmpty(message = "type不能为空") String type, @NotEmpty(message = "regId不能为空") String regId, BindingResult bindingResult) {
    public String bindDeviceToken(AcceptData acceptData, String loginUid, @NotEmpty(message = "type不能为空") String type, @NotEmpty(message = "regId不能为空") String regId, String model, String androidVersion, BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            String msg = bindingResult.getFieldError().getDefaultMessage();
            return JsonUtil.loadFalseJson(msg);
        }
        if(StringUtil.isNullOrEmpty(acceptData.getUtdId())){
        if (StringUtil.isNullOrEmpty(acceptData.getUtdId())) {
            return JsonUtil.loadFalseJson("utdId为空");
        }
@@ -53,6 +53,8 @@
        token.setToken(regId);
        token.setVersion(acceptData.getVersion());
        token.setLoginUid(loginUid);
        token.setBuildModel(model);
        token.setBuildVersion(androidVersion);
        try {
            pushDeviceTokenService.addDeviceToken(token);
            return JsonUtil.loadTrueJson("");
src/main/java/com/yeshi/buwan/controller/parser/AdParser.java
@@ -24,14 +24,6 @@
    @Resource
    private AdService adService;
    public AdService getAdService() {
        return adService;
    }
    public void setAdService(AdService adService) {
        this.adService = adService;
    }
    @RequireUid
    public void getMineAdList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        String key = request.getParameter("Key");
src/main/java/com/yeshi/buwan/controller/parser/AttentionParser.java
@@ -25,13 +25,6 @@
    @Resource
    private AttentionService attentionService;
    public AttentionService getAttentionService() {
        return attentionService;
    }
    public void setAttentionService(AttentionService attentionService) {
        this.attentionService = attentionService;
    }
src/main/java/com/yeshi/buwan/controller/parser/CommentParser.java
@@ -3,8 +3,11 @@
import com.google.gson.GsonBuilder;
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.domain.user.LoginUser;
import com.yeshi.buwan.exception.LoginUserException;
import com.yeshi.buwan.dto.user.LoginInfoDto;
import com.yeshi.buwan.dto.user.QQUserInfo;
import com.yeshi.buwan.exception.user.LoginUserException;
import com.yeshi.buwan.exception.SMSException;
import com.yeshi.buwan.exception.user.RegisterUserException;
import com.yeshi.buwan.service.imp.CommentService;
import com.yeshi.buwan.service.imp.MaskKeyService;
import com.yeshi.buwan.service.imp.SystemService;
@@ -85,17 +88,50 @@
            return;
        }
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        LoginUser lu = userService.getLoginUser(openid, detailSystem.getId(), Integer.parseInt(loginType), portrait,
                name, UserParser.getIp(request) + ":" + request.getRemotePort());
        if (lu != null) {
            JSONObject object = new JSONObject();
            object.put("LoginUid", lu.getId());
            out.print(JsonUtil.loadTrueJson(object.toString()));
        } else {
            out.print(JsonUtil.loadFalseJson("登录失败"));
        LoginInfoDto loginInfoDto = new LoginInfoDto();
        loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId());
        int loginTypeInt = Integer.parseInt(loginType);
        loginInfoDto.setLoginType(loginTypeInt);
        switch (loginTypeInt) {
            case LoginUser.LOGIN_TYPE_EMAIL:
                loginInfoDto.setEmail(openid);
                break;
            case LoginUser.LOGIN_TYPE_QQ:
                QQUserInfo qqUserInfo = new QQUserInfo();
                qqUserInfo.setName(name);
                qqUserInfo.setOpenId(openid);
                qqUserInfo.setPortrait(portrait);
                qqUserInfo.setSex(sex);
                loginInfoDto.setQqUserInfo(qqUserInfo);
                break;
        }
        try {
            LoginUser lu = userService.login(loginInfoDto);
            if (lu != null) {
                JSONObject object = new JSONObject();
                object.put("LoginUid", lu.getId());
                out.print(JsonUtil.loadTrueJson(object.toString()));
            } else {
                out.print(JsonUtil.loadFalseJson("登录失败"));
            }
        } catch (LoginUserException e) {
            //用户不存在
            if (e.getCode() == LoginUserException.CODE_NO_USER && loginTypeInt == LoginUser.LOGIN_TYPE_EMAIL) {
                //注册
                try {
                    userService.register(loginInfoDto);
                } catch (RegisterUserException e1) {
                    out.print(JsonUtil.loadFalseJson("登录失败"));
                }
            } else {
                out.print(JsonUtil.loadFalseJson(e.getMessage()));
            }
        }
    }
@@ -113,19 +149,34 @@
            return;
        }
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        LoginInfoDto loginInfoDto = new LoginInfoDto();
        loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId());
        loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_WX);
        loginInfoDto.setWeiXinUser(weiXinUser);
        LoginUser lu = userService.getLoginUser(weiXinUser.getOpenid(), detailSystem.getId(), 2, weiXinUser.getHeadimgurl(),
                weiXinUser.getNickname(), UserParser.getIp(request) + ":" + request.getRemotePort());
        if (lu != null) {
            JSONObject object = new JSONObject();
            object.put("user", new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(lu));
            out.print(JsonUtil.loadTrueJson(object.toString()));
        } else {
            out.print(JsonUtil.loadFalseJson("登录失败"));
        try {
            LoginUser lu = userService.login(loginInfoDto);
            if (lu != null) {
                JSONObject object = new JSONObject();
                object.put("user", new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(lu));
                out.print(JsonUtil.loadTrueJson(object.toString()));
            } else {
                out.print(JsonUtil.loadFalseJson("登录失败"));
            }
        } catch (LoginUserException e) {
            //用户不存在
            if (e.getCode() == LoginUserException.CODE_NO_USER) {
                //注册
                try {
                    userService.register(loginInfoDto);
                } catch (RegisterUserException e1) {
                    out.print(JsonUtil.loadFalseJson("登录失败"));
                }
            } else {
                out.print(JsonUtil.loadFalseJson(e.getMessage()));
            }
        }
    }
    /**
src/main/java/com/yeshi/buwan/controller/parser/NewsParser.java
@@ -24,21 +24,7 @@
    @Resource
    private NewsService newsService;
    public NewsService getNewsService() {
        return newsService;
    }
    public void setNewsService(NewsService newsService) {
        this.newsService = newsService;
    }
    public SystemService getSystemService() {
        return systemService;
    }
    public void setSystemService(SystemService systemService) {
        this.systemService = systemService;
    }
    public void getNewsTypeList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
src/main/java/com/yeshi/buwan/controller/parser/UserParser.java
@@ -3,6 +3,9 @@
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.domain.Collection;
import com.yeshi.buwan.domain.user.LoginUser;
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.service.imp.*;
import com.yeshi.buwan.service.manager.SolrAlbumDataManager;
import com.yeshi.buwan.util.*;
@@ -755,24 +758,22 @@
        if (StringUtil.isNullOrEmpty(nickName))
            nickName = "无名氏";
        DetailSystem ds = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        // 注册 --用户名,昵称,密码
        LoginUser user = new LoginUser();
        user.setCreatetime(System.currentTimeMillis() + "");
        user.setDetailsystem(ds.getId());
        user.setDevice(acceptData.getDevice());
        user.setLoginType(3);
        user.setName(nickName);
        user.setOpenid(account);
        user.setPwd(StringUtil.Md5(pwd));
        user.setPortrait(savePortrait(portrait, request.getSession()));
        user.setIpinfo(ip + ":" + port);
        String result = userService.registerByEmail(user);
        if (result.contains("成功"))
        LoginInfoDto loginInfoDto = new LoginInfoDto();
        loginInfoDto.setEmail(account);
        loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId());
        loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_EMAIL);
        loginInfoDto.setPwd(StringUtil.Md5(pwd));
        loginInfoDto.setIpInfo(ip + ":" + port);
        loginInfoDto.setNickName(nickName);
        try {
            userService.register(loginInfoDto);
            out.print(JsonUtil.loadTrueJson("注册成功"));
        else
            out.print(JsonUtil.loadFalseJson(result));
        } catch (RegisterUserException e) {
            out.print(JsonUtil.loadFalseJson(e.getMessage()));
        }
    }
    /**
@@ -829,17 +830,17 @@
        // systemService.getDetailSystemByPackage(packageName);
        // 注册 --用户名,昵称,密码
        LoginUser user = new LoginUser();
        user.setDevice(acceptData.getDevice());
        user.setLoginType(3);
        user.setOpenid(account);
        user.setPwd(StringUtil.Md5(pwd));
        user.setPortrait("http://buwan-1255749512.file.myqcloud.com/resource/ic_portrait_default.png");
        user = userService.loginByEmail(user);
        if (user == null || user.getState() != LoginUser.STATE_NORMAL)
            out.print(JsonUtil.loadFalseJson("账号或密码错误"));
        else
        LoginInfoDto loginInfoDto = new LoginInfoDto();
        loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_EMAIL);
        loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId());
        loginInfoDto.setEmail(account);
        loginInfoDto.setPwd(StringUtil.Md5(pwd));
        try {
            LoginUser user = userService.login(loginInfoDto);
            out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(user)));
        } catch (LoginUserException e) {
            out.print(JsonUtil.loadFalseJson(e.getMessage()));
        }
    }
    /**
src/main/java/com/yeshi/buwan/controller/parser/web/WebUserParser.java
@@ -263,17 +263,17 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName);
        LoginUser lu = userService.getLoginUser(openid, detailSystem.getId(), Integer.parseInt(loginType), portrait,
                name,UserParser.getIp(request)+":"+request.getRemotePort());
        if (lu != null) {
            JSONObject object = new JSONObject();
            object.put("LoginUid", lu.getId());
            object.put("Name", lu.getName());
            object.put("Portrait", lu.getPortrait());
            out.print(JsonUtil.loadTrueJsonNoencript(object.toString()));
        } else {
//        LoginUser lu = userService.getLoginUser(openid, detailSystem.getId(), Integer.parseInt(loginType), portrait,
//                name,UserParser.getIp(request)+":"+request.getRemotePort());
//        if (lu != null) {
//            JSONObject object = new JSONObject();
//            object.put("LoginUid", lu.getId());
//            object.put("Name", lu.getName());
//            object.put("Portrait", lu.getPortrait());
//            out.print(JsonUtil.loadTrueJsonNoencript(object.toString()));
//        } else {
            out.print(JsonUtil.loadFalseJsonNoencript("登录失败"));
        }
//        }
    }
    private String savePortrait(HttpServletRequest request) {
src/main/java/com/yeshi/buwan/domain/push/PushDeviceToken.java
@@ -25,6 +25,8 @@
    private Date createTime;
    private Date updateTime;
    private Integer version;
    private String buildModel;//手机型号
    private String buildVersion;//手机系统版本
    private String loginUid;
@@ -107,4 +109,21 @@
    public void setType(String type) {
        this.type = type;
    }
    public String getBuildModel() {
        return buildModel;
    }
    public void setBuildModel(String buildModel) {
        this.buildModel = buildModel;
    }
    public String getBuildVersion() {
        return buildVersion;
    }
    public void setBuildVersion(String buildVersion) {
        this.buildVersion = buildVersion;
    }
}
src/main/java/com/yeshi/buwan/domain/special/Special.java
@@ -3,6 +3,7 @@
import java.io.Serializable;
import com.google.gson.annotations.Expose;
import com.yeshi.buwan.domain.SystemInfo;
import com.yeshi.buwan.domain.ad.CommonAd;
public class Special implements Serializable{
@@ -32,6 +33,18 @@
    @Expose
    private CommonAd commonAd;// 常规广告
    private SystemInfo system;
    public SystemInfo getSystem() {
        return system;
    }
    public void setSystem(SystemInfo system) {
        this.system = system;
    }
    public CommonAd getCommonAd() {
        return commonAd;
    }
src/main/java/com/yeshi/buwan/domain/user/LoginUserExtra.java
@@ -35,6 +35,14 @@
    private Date createTime;
    private Date updateTime;
    public LoginUserExtra() {
    }
    public LoginUserExtra(String id) {
        this.id = id;
    }
    public String getEmail() {
        return email;
    }
src/main/java/com/yeshi/buwan/dto/search/SolrVideoSearchFilter.java
@@ -2,11 +2,33 @@
public class SolrVideoSearchFilter {
    private String key;
    //演员
    private String actor;
    //导演
    private String director;
    private Integer contentType;
    private Integer videoType;
    private String[] resourceIds;
    private String sortKey;
    public String getDirector() {
        return director;
    }
    public void setDirector(String director) {
        this.director = director;
    }
    public String getActor() {
        return actor;
    }
    public void setActor(String actor) {
        this.actor = actor;
    }
    public String getSortKey() {
        return sortKey;
    }
src/main/java/com/yeshi/buwan/dto/user/LoginInfoDto.java
New file
@@ -0,0 +1,99 @@
package com.yeshi.buwan.dto.user;
import org.yeshi.utils.entity.wx.WeiXinUser;
public class LoginInfoDto {
    private String systemId;
    private int loginType;
    private QQUserInfo qqUserInfo;
    private WeiXinUser weiXinUser;
    private String email;
    private String pwd;
    private String phone;
    private String smsCode;
    //注册时使用
    private String ipInfo;
    private String nickName;
    public String getIpInfo() {
        return ipInfo;
    }
    public void setIpInfo(String ipInfo) {
        this.ipInfo = ipInfo;
    }
    public String getNickName() {
        return nickName;
    }
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    public String getSystemId() {
        return systemId;
    }
    public void setSystemId(String systemId) {
        this.systemId = systemId;
    }
    public int getLoginType() {
        return loginType;
    }
    public void setLoginType(int loginType) {
        this.loginType = loginType;
    }
    public QQUserInfo getQqUserInfo() {
        return qqUserInfo;
    }
    public void setQqUserInfo(QQUserInfo qqUserInfo) {
        this.qqUserInfo = qqUserInfo;
    }
    public WeiXinUser getWeiXinUser() {
        return weiXinUser;
    }
    public void setWeiXinUser(WeiXinUser weiXinUser) {
        this.weiXinUser = weiXinUser;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getPwd() {
        return pwd;
    }
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getSmsCode() {
        return smsCode;
    }
    public void setSmsCode(String smsCode) {
        this.smsCode = smsCode;
    }
}
src/main/java/com/yeshi/buwan/dto/user/QQUserInfo.java
New file
@@ -0,0 +1,41 @@
package com.yeshi.buwan.dto.user;
public class QQUserInfo {
    private String name;
    private String portrait;
    private String openId;
    private String sex;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPortrait() {
        return portrait;
    }
    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
}
src/main/java/com/yeshi/buwan/exception/LoginUserException.java
File was deleted
src/main/java/com/yeshi/buwan/exception/user/LoginUserException.java
New file
@@ -0,0 +1,44 @@
package com.yeshi.buwan.exception.user;
public class LoginUserException extends Exception {
    //参数不完整
    public final static int CODE_PARAMS_NOT_ENOUGH = 1;
    //密码错误
    public final static int CODE_PWD_WRONG = 10;
    //用户不存在
    public final static int CODE_NO_USER = 20;
    //用户被封禁
    public final static int CODE_FORBIDDEN = 101;
    private int code;
    private String msg;
    public LoginUserException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public LoginUserException(String msg) {
        this.msg = msg;
    }
    public String getMsg() {
        return msg;
    }
    public int getCode() {
        return code;
    }
    @Override
    public String getMessage() {
        return msg;
    }
}
src/main/java/com/yeshi/buwan/exception/user/RegisterUserException.java
New file
@@ -0,0 +1,40 @@
package com.yeshi.buwan.exception.user;
public class RegisterUserException extends Exception {
    //参数不完整
    public final static int CODE_PARAMS_NOT_ENOUGH = 1;
    //用户已存在
    public final static int CODE_USER_EXIST = 20;
    //用户被封禁
    public final static int CODE_FORBIDDEN = 101;
    private int code;
    private String msg;
    public RegisterUserException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public RegisterUserException(String msg) {
        this.msg = msg;
    }
    public String getMsg() {
        return msg;
    }
    public int getCode() {
        return code;
    }
    @Override
    public String getMessage() {
        return msg;
    }
}
src/main/java/com/yeshi/buwan/service/imp/AdService.java
@@ -40,472 +40,401 @@
@Service
public class AdService {
    @Resource
    private RecommendAdDao recommendAdDao;
    @Resource
    private MineAdDao mineAdDao;
    @Resource
    private AdStatisticsDao adStatisticsDao;
    @Resource
    private WXAdDao wxAdDao;
    @Resource
    private WXStatisticsDao wxStatisticsDao;
    @Resource
    private SuperRecommendAdDao superRecommendAdDao;
    @Resource
    private CommonAdPositionAdDao commonAdPositionAdDao;
    @Resource
    private CommonAdStatisticsDao commonAdStatisticsDao;
    @Resource
    private CommonAdDao commonAdDao;
    @Resource
    private RecommendAdDao recommendAdDao;
    @Resource
    private MineAdDao mineAdDao;
    @Resource
    private AdStatisticsDao adStatisticsDao;
    @Resource
    private WXAdDao wxAdDao;
    @Resource
    private WXStatisticsDao wxStatisticsDao;
    @Resource
    private SuperRecommendAdDao superRecommendAdDao;
    @Resource
    private CommonAdPositionAdDao commonAdPositionAdDao;
    @Resource
    private CommonAdStatisticsDao commonAdStatisticsDao;
    @Resource
    private CommonAdDao commonAdDao;
    @Resource
    private CommonAdPositionDao commonAdPositionDao;
    @Resource
    private CommonAdPositionDao commonAdPositionDao;
    public CommonAdDao getCommonAdDao() {
        return commonAdDao;
    }
    public void setCommonAdDao(CommonAdDao commonAdDao) {
        this.commonAdDao = commonAdDao;
    }
    // 获取广告
    public List<RecommendAd> getRecommendAdList() {
    public CommonAdStatisticsDao getCommonAdStatisticsDao() {
        return commonAdStatisticsDao;
    }
        return recommendAdDao.list("from RecommendAd");
    }
    public void setCommonAdStatisticsDao(CommonAdStatisticsDao commonAdStatisticsDao) {
        this.commonAdStatisticsDao = commonAdStatisticsDao;
    }
    public List<RecommendAd> getRecommendAdList(int type) {
    public CommonAdPositionAdDao getCommonAdPositionAdDao() {
        return commonAdPositionAdDao;
    }
        return recommendAdDao.list("from RecommendAd a where a.platform=3 or a.platform=" + type);
    }
    public void setCommonAdPositionAdDao(CommonAdPositionAdDao commonAdPositionAdDao) {
        this.commonAdPositionAdDao = commonAdPositionAdDao;
    }
    public RecommendAd getAdById(String id) {
    public SuperRecommendAdDao getSuperRecommendAdDao() {
        return superRecommendAdDao;
    }
        return recommendAdDao.find(RecommendAd.class, id);
    }
    public void setSuperRecommendAdDao(SuperRecommendAdDao superRecommendAdDao) {
        this.superRecommendAdDao = superRecommendAdDao;
    }
    public void updateRecommendAd(RecommendAd ad) {
    public WXStatisticsDao getWxStatisticsDao() {
        return wxStatisticsDao;
    }
        recommendAdDao.update(ad);
    }
    public void setWxStatisticsDao(WXStatisticsDao wxStatisticsDao) {
        this.wxStatisticsDao = wxStatisticsDao;
    }
    public void addRecommendAd(RecommendAd ad) {
        recommendAdDao.create(ad);
    }
    public WXAdDao getWxAdDao() {
        return wxAdDao;
    }
    @SuppressWarnings("unchecked")
    public void deleteRecommendAd(final String id) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<SuperRecommendAd> list = session
                            .createQuery("from SuperRecommendAd sv where sv.recommendAd.id=?").setParameter(0, id)
                            .list();
                    for (SuperRecommendAd sv : list)
                        session.delete(sv);
                    session.delete(new RecommendAd(id));
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    public void setWxAdDao(WXAdDao wxAdDao) {
        this.wxAdDao = wxAdDao;
    }
    }
    public AdStatisticsDao getAdStatisticsDao() {
        return adStatisticsDao;
    }
    public List<MineAd> getMineAdList(String key) {
        return mineAdDao.list(
                "from MineAd ma where ma.open=1 and ma.adKey.key=? order by ma.first desc,ma.percent desc",
                new String[]{key});
    }
    public void setAdStatisticsDao(AdStatisticsDao adStatisticsDao) {
        this.adStatisticsDao = adStatisticsDao;
    }
    /**
     * 后台操作
     */
    public MineAdDao getMineAdDao() {
        return mineAdDao;
    }
    @SuppressWarnings("unchecked")
    public List<RecommendAdAdmin> getRecommendAdAdmin(final String key, final int detailSystem, final int page) {
        return (List<RecommendAdAdmin>) recommendAdDao.excute(new HibernateCallback<List<RecommendAdAdmin>>() {
            public List<RecommendAdAdmin> doInHibernate(Session session) throws HibernateException {
                List<RecommendAdAdmin> zhiBoClassList = new ArrayList<RecommendAdAdmin>();
                try {
                    List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list();
                    String sql = "";
                    if (detailSystem > 0)
                        sql = "select sh.recommendAd from SuperRecommendAd sh where  sh.detailSystem.id=" + detailSystem
                                + " order by  sh.recommendAd.createtime desc";
                    else
                        sql = "from RecommendAd zb order by zb.createtime desc";
    public void setMineAdDao(MineAdDao mineAdDao) {
        this.mineAdDao = mineAdDao;
    }
                    List<RecommendAd> list = session.createQuery(sql).setFirstResult((page - 1) * Constant.pageCount)
                            .setMaxResults(Constant.pageCount).list();
                    for (RecommendAd vb : list) {
                        List<DetailSystem> detailSystemS = session
                                .createQuery(
                                        "select vb.detailSystem from SuperRecommendAd vb where vb.recommendAd.id=?")
                                .setParameter(0, vb.getId()).list();
    public RecommendAdDao getRecommendAdDao() {
        return recommendAdDao;
    }
                        List<DetailSystemSelect> dssList = new ArrayList<DetailSystemSelect>();
    public void setRecommendAdDao(RecommendAdDao recommendAdDao) {
        this.recommendAdDao = recommendAdDao;
    }
                        for (DetailSystem ds : detailSystemList) {
                            DetailSystemSelect dss = new DetailSystemSelect();
                            dss.setDetailSystem(ds);
                            dss.setSelected(false);
                            dssList.add(dss);
                        }
    // 获取广告
    public List<RecommendAd> getRecommendAdList() {
                        // 设置已经存在的
                        for (DetailSystem ds : detailSystemS) {
                            for (DetailSystemSelect dss : dssList) {
                                if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                                    dss.setSelected(true);
                                    break;
                                }
                            }
                        }
                        SuperRecommendAd sz = new SuperRecommendAd();
                        sz.setDetailSystem(null);
                        sz.setRecommendAd(vb);
                        zhiBoClassList.add(new RecommendAdAdmin(sz, dssList));
                    }
        return recommendAdDao.list("from RecommendAd");
    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return zhiBoClassList;
            }
        });
    public List<RecommendAd> getRecommendAdList(int type) {
    }
        return recommendAdDao.list("from RecommendAd a where a.platform=3 or a.platform=" + type);
    }
    public long getRecommendAdAdminCount(String key, int detailSystem) {
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_recommendad zb left join wk_ad_recommend c on c.id=zb.recommendadid where zb.detailsystem="
                    + detailSystem + " group by zb.recommendadid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_super_recommendad zb left join wk_ad_recommend c on c.id=zb.recommendadid  group by zb.recommendadid) s";
    public RecommendAd getAdById(String id) {
        return recommendAdDao.getCountSQL(sql);
    }
        return recommendAdDao.find(RecommendAd.class, id);
    }
    @SuppressWarnings("rawtypes")
    public void addRecommendAdAdmin(final String classid, final String detailSystemId) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List list = session
                            .createQuery("from SuperRecommendAd vb where vb.recommendAd.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classid).setParameter(1, detailSystemId).list();
                    if (list == null || list.size() == 0) {
                        SuperRecommendAd vb = new SuperRecommendAd();
                        vb.setCreatetime(System.currentTimeMillis() + "");
                        vb.setDetailSystem(new DetailSystem(detailSystemId));
                        vb.setRecommendAd(new RecommendAd(classid));
                        session.persist(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
    public void updateRecommendAd(RecommendAd ad) {
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
        recommendAdDao.update(ad);
    }
    }
    public void addRecommendAd(RecommendAd ad) {
        recommendAdDao.create(ad);
    }
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void deleteRecommendAdAdmin(final String classId, final String detailSystemId) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<SuperRecommendAd> list = session
                            .createQuery("from SuperRecommendAd vb where vb.recommendAd.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classId).setParameter(1, detailSystemId).list();
                    if (list != null && list.size() > 0) {
                        for (SuperRecommendAd vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    @SuppressWarnings("unchecked")
    public void deleteRecommendAd(final String id) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<SuperRecommendAd> list = session
                            .createQuery("from SuperRecommendAd sv where sv.recommendAd.id=?").setParameter(0, id)
                            .list();
                    for (SuperRecommendAd sv : list)
                        session.delete(sv);
                    session.delete(new RecommendAd(id));
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    }
    public void AddStatistics(String key, String platform, int type) {
        AdStatistics ad = new AdStatistics();
        ad.setKey(key);
        ad.setPlatformId(platform);
        ad.setTime(System.currentTimeMillis() + "");
        ad.setType(type);
        adStatisticsDao.create(ad);
    }
    public List<MineAd> getMineAdList(String key) {
        return mineAdDao.list(
                "from MineAd ma where ma.open=1 and ma.adKey.key=? order by ma.first desc,ma.percent desc",
                new String[] { key });
    }
    /**
     * 获取微信广告
     *
     * @return
     */
    public List<WXAd> getWinAd(SystemInfo system) {
        List<WXAd> list = wxAdDao.list("from WXAd w where w.system.id=" + system.getId());
        return list;
    }
    /**
     * 后台操作
     */
    public List<WXAd> getWinAd() {
        List<WXAd> list = wxAdDao.list("from WXAd");
        return list;
    }
    @SuppressWarnings("unchecked")
    public List<RecommendAdAdmin> getRecommendAdAdmin(final String key, final int detailSystem, final int page) {
        return (List<RecommendAdAdmin>) recommendAdDao.excute(new HibernateCallback<List<RecommendAdAdmin>>() {
            public List<RecommendAdAdmin> doInHibernate(Session session) throws HibernateException {
                List<RecommendAdAdmin> zhiBoClassList = new ArrayList<RecommendAdAdmin>();
                try {
                    List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list();
                    String sql = "";
                    if (detailSystem > 0)
                        sql = "select sh.recommendAd from SuperRecommendAd sh where  sh.detailSystem.id=" + detailSystem
                                + " order by  sh.recommendAd.createtime desc";
                    else
                        sql = "from RecommendAd zb order by zb.createtime desc";
    /**
     * 添加微信广告
     *
     * @param ad
     */
    public void addWX(WXAd ad) {
        wxAdDao.create(ad);
    }
                    List<RecommendAd> list = session.createQuery(sql).setFirstResult((page - 1) * Constant.pageCount)
                            .setMaxResults(Constant.pageCount).list();
                    for (RecommendAd vb : list) {
                        List<DetailSystem> detailSystemS = session
                                .createQuery(
                                        "select vb.detailSystem from SuperRecommendAd vb where vb.recommendAd.id=?")
                                .setParameter(0, vb.getId()).list();
    public void deleteWX(WXAd ad) {
        wxAdDao.delete(ad);
    }
                        List<DetailSystemSelect> dssList = new ArrayList<DetailSystemSelect>();
    public WXAd getWXAd(Serializable id) {
        return wxAdDao.find(WXAd.class, id);
    }
                        for (DetailSystem ds : detailSystemList) {
                            DetailSystemSelect dss = new DetailSystemSelect();
                            dss.setDetailSystem(ds);
                            dss.setSelected(false);
                            dssList.add(dss);
                        }
    public void updateWXAd(WXAd ad) {
        wxAdDao.update(ad);
    }
                        // 设置已经存在的
                        for (DetailSystem ds : detailSystemS) {
                            for (DetailSystemSelect dss : dssList) {
                                if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                                    dss.setSelected(true);
                                    break;
                                }
                            }
                        }
                        SuperRecommendAd sz = new SuperRecommendAd();
                        sz.setDetailSystem(null);
                        sz.setRecommendAd(vb);
                        zhiBoClassList.add(new RecommendAdAdmin(sz, dssList));
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return zhiBoClassList;
            }
        });
    }
    public long getRecommendAdAdminCount(String key, int detailSystem) {
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_recommendad zb left join wk_ad_recommend c on c.id=zb.recommendadid where zb.detailsystem="
                    + detailSystem + " group by zb.recommendadid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_super_recommendad zb left join wk_ad_recommend c on c.id=zb.recommendadid  group by zb.recommendadid) s";
        return recommendAdDao.getCountSQL(sql);
    }
    @SuppressWarnings("rawtypes")
    public void addRecommendAdAdmin(final String classid, final String detailSystemId) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List list = session
                            .createQuery("from SuperRecommendAd vb where vb.recommendAd.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classid).setParameter(1, detailSystemId).list();
                    if (list == null || list.size() == 0) {
                        SuperRecommendAd vb = new SuperRecommendAd();
                        vb.setCreatetime(System.currentTimeMillis() + "");
                        vb.setDetailSystem(new DetailSystem(detailSystemId));
                        vb.setRecommendAd(new RecommendAd(classid));
                        session.persist(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
    }
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void deleteRecommendAdAdmin(final String classId, final String detailSystemId) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<SuperRecommendAd> list = session
                            .createQuery("from SuperRecommendAd vb where vb.recommendAd.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classId).setParameter(1, detailSystemId).list();
                    if (list != null && list.size() > 0) {
                        for (SuperRecommendAd vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    public void AddStatistics(String key, String platform, int type) {
        AdStatistics ad = new AdStatistics();
        ad.setKey(key);
        ad.setPlatformId(platform);
        ad.setTime(System.currentTimeMillis() + "");
        ad.setType(type);
        adStatisticsDao.create(ad);
    }
    /**
     * 获取微信广告
     *
     * @return
     */
    public List<WXAd> getWinAd(SystemInfo system) {
        List<WXAd> list = wxAdDao.list("from WXAd w where w.system.id=" + system.getId());
        return list;
    }
    public List<WXAd> getWinAd() {
        List<WXAd> list = wxAdDao.list("from WXAd");
        return list;
    }
    /**
     * 添加微信广告
     *
     * @param ad
     */
    public void addWX(WXAd ad) {
        wxAdDao.create(ad);
    }
    public void deleteWX(WXAd ad) {
        wxAdDao.delete(ad);
    }
    public WXAd getWXAd(Serializable id) {
        return wxAdDao.find(WXAd.class, id);
    }
    public void updateWXAd(WXAd ad) {
        wxAdDao.update(ad);
    }
    /**
     * 插入微信统计代码
     *
     * @param bean
     */
    public void insertWXStatistics(WXStatistics bean) {
        wxStatisticsDao.create(bean);
    }
    /**
     * 插入微信统计代码
     *
     * @param bean
     */
    public void insertWXStatistics(WXStatistics bean) {
        wxStatisticsDao.create(bean);
    }
    /**
     * 推荐广告条
     */
    @Cacheable(value = "homeCache",key="'getRecommendAdList'+'-'+#detailSystem")
    public List<RecommendAd> getRecommendAdList(String detailSystem) {
        return recommendAdDao
                .list("select hs.recommendAd FROM SuperRecommendAd hs where hs.detailSystem.id=" + detailSystem);
    }
    /**
     * 推荐广告条
     */
    @Cacheable(value = "homeCache", key = "'getRecommendAdList'+'-'+#detailSystem")
    public List<RecommendAd> getRecommendAdList(String detailSystem) {
        return recommendAdDao
                .list("select hs.recommendAd FROM SuperRecommendAd hs where hs.detailSystem.id=" + detailSystem);
    }
    public void addRecommendAd(SuperRecommendAd sv) {
        List<SuperRecommendAd> list = superRecommendAdDao.list("from SuperRecommendAd sv where sv.recommendAd.id="
                + sv.getRecommendAd().getId() + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superRecommendAdDao.create(sv);
    }
    public void addRecommendAd(SuperRecommendAd sv) {
        List<SuperRecommendAd> list = superRecommendAdDao.list("from SuperRecommendAd sv where sv.recommendAd.id="
                + sv.getRecommendAd().getId() + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superRecommendAdDao.create(sv);
    }
    public void updateSuperRecommendAd(SuperRecommendAd hotSearch) {
        superRecommendAdDao.update(hotSearch);
    }
    public void updateSuperRecommendAd(SuperRecommendAd hotSearch) {
        superRecommendAdDao.update(hotSearch);
    }
    public void deleteSuperRecommendAd(SuperRecommendAd hotSearch) {
        superRecommendAdDao.delete(hotSearch);
    }
    public void deleteSuperRecommendAd(SuperRecommendAd hotSearch) {
        superRecommendAdDao.delete(hotSearch);
    }
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void updateSuperRecommendAdList(final String detailSystemId, final List<SuperRecommendAd> typeList) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<SuperRecommendAd> list = session
                            .createQuery("from SuperRecommendAd sh where sh.detailSystem.id=" + detailSystemId).list();
                    for (SuperRecommendAd ad : list) {
                        session.delete(ad);
                    }
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void updateSuperRecommendAdList(final String detailSystemId, final List<SuperRecommendAd> typeList) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<SuperRecommendAd> list = session
                            .createQuery("from SuperRecommendAd sh where sh.detailSystem.id=" + detailSystemId).list();
                    for (SuperRecommendAd ad : list) {
                        session.delete(ad);
                    }
                    for (SuperRecommendAd videoType : typeList) {
                        session.persist(videoType);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
                    for (SuperRecommendAd videoType : typeList) {
                        session.persist(videoType);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    }
    @Cacheable(value = "classCache",key="'getCommonAdByPid'+'-'+#pid")
    public List<CommonAdPositionAd> getCommonAdByPid(String pid) {
        return commonAdPositionAdDao.list("from CommonAdPositionAd pa where pa.adPosition.id=?",
                new Serializable[] { pid + "" });
    }
    @Cacheable(value = "classCache", key = "'getCommonAdByPid'+'-'+#pid")
    public List<CommonAdPositionAd> getCommonAdByPid(String pid) {
        return commonAdPositionAdDao.list("from CommonAdPositionAd pa where pa.adPosition.id=?",
                new Serializable[]{pid + ""});
    }
    // 添加广告统计
    public void addCommonAdStatistics(int type, String pid, String commonAdid, String device) {
        CommonAdStatistics cas = new CommonAdStatistics();
        cas.setCommonAd(new CommonAd(commonAdid));
        cas.setCreatetime(System.currentTimeMillis() + "");
        cas.setType(type);
        cas.setPositionid(pid);
        cas.setDevice(device);
        commonAdStatisticsDao.create(cas);
    }
    // 添加广告统计
    public void addCommonAdStatistics(int type, String pid, String commonAdid, String device) {
        CommonAdStatistics cas = new CommonAdStatistics();
        cas.setCommonAd(new CommonAd(commonAdid));
        cas.setCreatetime(System.currentTimeMillis() + "");
        cas.setType(type);
        cas.setPositionid(pid);
        cas.setDevice(device);
        commonAdStatisticsDao.create(cas);
    }
    public List<CommonAdPosition> getCommonAdPositionList() {
        return (List<CommonAdPosition>) commonAdPositionDao.list("from CommonAdPosition");
    }
    public List<CommonAdPosition> getCommonAdPositionList() {
        return (List<CommonAdPosition>) commonAdPositionDao.list("from CommonAdPosition");
    }
    public List<CommonAdPositionAd> getCommonAdPositionAd(String key, int pid, int pageIndex) {
        List<CommonAdPositionAd> adList = new ArrayList<CommonAdPositionAd>();
        adList = commonAdPositionAdDao.list("from CommonAdPositionAd ca where ca.adPosition.id=" + pid + "",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount, null);
    public List<CommonAdPositionAd> getCommonAdPositionAd(String key, int pid, int pageIndex) {
        List<CommonAdPositionAd> adList = new ArrayList<CommonAdPositionAd>();
        adList = commonAdPositionAdDao.list("from CommonAdPositionAd ca where ca.adPosition.id=" + pid + "",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount, null);
        for (CommonAdPositionAd ad : adList) {
            ad.setCommonAdPositionList(commonAdPositionDao
                    .list("select pa.adPosition from CommonAdPositionAd pa where pa.ad.id=" + ad.getAd().getId()));
        for (CommonAdPositionAd ad : adList) {
            ad.setCommonAdPositionList(commonAdPositionDao
                    .list("select pa.adPosition from CommonAdPositionAd pa where pa.ad.id=" + ad.getAd().getId()));
        }
        return adList;
    }
        }
        return adList;
    }
    public long getCommonAdPositionAdCount(String key, int pid) {
        return commonAdPositionAdDao
                .getCount("select count(*) from CommonAdPositionAd ca where ca.adPosition.id=" + pid + "");
    }
    public long getCommonAdPositionAdCount(String key, int pid) {
        return commonAdPositionAdDao
                .getCount("select count(*) from CommonAdPositionAd ca where ca.adPosition.id=" + pid + "");
    }
    public Serializable addCommonAd(CommonAd commonAd) {
        return commonAdDao.save(commonAd);
    }
    public Serializable addCommonAd(CommonAd commonAd) {
        return commonAdDao.save(commonAd);
    }
    public void addCommonAdPositionAd(CommonAdPositionAd commonAdPositionAd) {
        commonAdPositionAdDao.create(commonAdPositionAd);
    }
    public void addCommonAdPositionAd(CommonAdPositionAd commonAdPositionAd) {
        commonAdPositionAdDao.create(commonAdPositionAd);
    }
    public CommonAd getCommonAdById(String id) {
        return commonAdDao.find(CommonAd.class, id);
    }
    public CommonAd getCommonAdById(String id) {
        return commonAdDao.find(CommonAd.class, id);
    }
    // 更新
    public void updateCommonAd(CommonAd commonAd) {
        commonAdDao.update(commonAd);
    }
    // 更新
    public void updateCommonAd(CommonAd commonAd) {
        commonAdDao.update(commonAd);
    }
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void deleteCommonAd(final CommonAd ca) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<CommonAdPositionAd> list = session
                            .createQuery("from CommonAdPositionAd cp where cp.ad.id=" + ca.getId()).list();
                    for (CommonAdPositionAd cp : list) {
                        session.delete(cp);
                    }
                    session.delete(ca);
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    if (session.getTransaction().isActive())
                        session.getTransaction().rollback();
                }
                return null;
            }
        });
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void deleteCommonAd(final CommonAd ca) {
        recommendAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    List<CommonAdPositionAd> list = session
                            .createQuery("from CommonAdPositionAd cp where cp.ad.id=" + ca.getId()).list();
                    for (CommonAdPositionAd cp : list) {
                        session.delete(cp);
                    }
                    session.delete(ca);
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    if (session.getTransaction().isActive())
                        session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    }
    public void deleteCommonAdPositionAd(CommonAdPositionAd ad) {
        commonAdPositionAdDao.delete(ad);
    }
    public void deleteCommonAdPositionAd(CommonAdPositionAd ad) {
        commonAdPositionAdDao.delete(ad);
    }
    public void deleteCommonAdPositionAd(String adid, String pid) {
        List<CommonAdPositionAd> list = commonAdPositionAdDao
                .list("from CommonAdPositionAd ca where ca.ad.id=" + adid + " and ca.adPosition.id=" + pid);
        for (CommonAdPositionAd ca : list)
            deleteCommonAdPositionAd(ca);
    }
    public void deleteCommonAdPositionAd(String adid, String pid) {
        List<CommonAdPositionAd> list = commonAdPositionAdDao
                .list("from CommonAdPositionAd ca where ca.ad.id=" + adid + " and ca.adPosition.id=" + pid);
        for (CommonAdPositionAd ca : list)
            deleteCommonAdPositionAd(ca);
    }
}
src/main/java/com/yeshi/buwan/service/imp/AdminUserService.java
@@ -16,14 +16,6 @@
    @Resource
    private AdminUserDao adminUserDao;
    public AdminUserDao getAdminUserDao() {
        return adminUserDao;
    }
    public void setAdminUserDao(AdminUserDao adminUserDao) {
        this.adminUserDao = adminUserDao;
    }
    /**
     * 用户登录
     * 
src/main/java/com/yeshi/buwan/service/imp/AttentionService.java
@@ -35,22 +35,6 @@
    @Resource
    private LoginUserDao loginUserDao;
    public VideoDetailUtil getVideoDetailUtil() {
        return videoDetailUtil;
    }
    public void setVideoDetailUtil(VideoDetailUtil videoDetailUtil) {
        this.videoDetailUtil = videoDetailUtil;
    }
    public AttentionDao getAttentionDao() {
        return attentionDao;
    }
    public void setAttentionDao(AttentionDao attentionDao) {
        this.attentionDao = attentionDao;
    }
    @SuppressWarnings("unchecked")
    @Caching(evict = {
            @CacheEvict(value = "attentionCache", key = "'isAddAttention'+'-'+#attention.loginUser.id+'-'+#attention.videoInfo.id"),
src/main/java/com/yeshi/buwan/service/imp/BanQuanService.java
@@ -37,22 +37,6 @@
    @Resource
    private WebVideoDao webVideoDao;
    public VideoBanQuanVideoDao getVideoBanQuanVideoDao() {
        return videoBanQuanVideoDao;
    }
    public void setVideoBanQuanVideoDao(VideoBanQuanVideoDao videoBanQuanVideoDao) {
        this.videoBanQuanVideoDao = videoBanQuanVideoDao;
    }
    public VideoBanQuanDao getVideoBanQuanDao() {
        return videoBanQuanDao;
    }
    public void setVideoBanQuanDao(VideoBanQuanDao videoBanQuanDao) {
        this.videoBanQuanDao = videoBanQuanDao;
    }
    @SuppressWarnings("unchecked")
    @CacheEvict(value = "topCache", allEntries = true)
    public void addBanQuanVideo(final List<VideoBanQuanVideo> list) {
src/main/java/com/yeshi/buwan/service/imp/CategoryAreaService.java
@@ -29,22 +29,6 @@
    @Resource
    private CategoryContryDao categoryContryDao;
    public CategoryContryDao getCategoryContryDao() {
        return categoryContryDao;
    }
    public void setCategoryContryDao(CategoryContryDao categoryContryDao) {
        this.categoryContryDao = categoryContryDao;
    }
    public ClassService getClassService() {
        return classService;
    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
    @Cacheable(value = "classCache", key = "'categoryContryList'+'-'+#cid")
    public List<CategoryContry> categoryContryList(String cid) {
src/main/java/com/yeshi/buwan/service/imp/CategoryVideoRecommendService.java
@@ -18,22 +18,6 @@
    @Resource
    private CategoryRecommendCacheVideoNumberDao categoryRecommendCacheVideoNumberDao;
    public CategoryRecommendCacheVideoNumberDao getCategoryRecommendCacheVideoNumberDao() {
        return categoryRecommendCacheVideoNumberDao;
    }
    public void setCategoryRecommendCacheVideoNumberDao(
            CategoryRecommendCacheVideoNumberDao categoryRecommendCacheVideoNumberDao) {
        this.categoryRecommendCacheVideoNumberDao = categoryRecommendCacheVideoNumberDao;
    }
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
    // 分区榜首数量
    public int getRankVideoNumber(long videotype) {
src/main/java/com/yeshi/buwan/service/imp/ClassService.java
@@ -234,7 +234,7 @@
        if (StringUtil.isNullOrEmpty(type)) {
            return getVideoInfoData(videoInfoDao.sqlList(
                    "select v.id,v.`name`,v.`tag`,v.`picture`,v.`hpicture`,v.`latest_hpicture`,v.watchcount,v.commentcount from wk_video_video v INNER JOIN  (SELECT  DISTINCT(v.id) FROM wk_category_video ca LEFT JOIN wk_video_video v ON v.id= ca.videoid LEFT JOIN wk_resource_video rv ON rv.`videoid`= v.`id`  AND( ? ) WHERE v.show= 1 and ca.id is not null AND rv.`resourceid` IS NOT NULL ? ) a using(id)",
                    (page - 1) * pageCount, pageCount, new Serializable[]{resourceWhere, orderby,}),resourceList);
                    (page - 1) * pageCount, pageCount, new Serializable[]{resourceWhere, orderby,}), resourceList);
        }
        List<VideoInfo> list = new ArrayList<VideoInfo>();
@@ -264,7 +264,7 @@
        });
        System.out.println("查询SQL费时:" + (System.currentTimeMillis() - startTime));
        return getVideoInfoData(list,resourceList);
        return getVideoInfoData(list, resourceList);
    }
    public List<VideoInfo> getVideoInfoData(List list, List<Long> resourceIdList) {
@@ -579,7 +579,7 @@
     */
    @SuppressWarnings("unchecked")
    public List<com.yeshi.buwan.domain.web.VideoTypeAdmin> getVideoTypeAdmin(final int detailSystem, final int pid,
    public List<com.yeshi.buwan.domain.web.VideoTypeAdmin> getVideoTypeAdmin(final String systemId, final int detailSystem, final int pid,
                                                                             final int page) {
        return (List<com.yeshi.buwan.domain.web.VideoTypeAdmin>) videoTypeDao
                .excute(new HibernateCallback<List<com.yeshi.buwan.domain.web.VideoTypeAdmin>>() {
@@ -587,7 +587,7 @@
                            throws HibernateException {
                        List<com.yeshi.buwan.domain.web.VideoTypeAdmin> hotTypeList = new ArrayList<com.yeshi.buwan.domain.web.VideoTypeAdmin>();
                        try {
                            List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list();
                            List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem ds where ds.system.id=" + systemId).list();
                            String where = "";
                            List<VideoType> list = null;
src/main/java/com/yeshi/buwan/service/imp/CollectionService.java
@@ -30,22 +30,6 @@
    @Resource
    private VideoInfoDao videoInfoDao;
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
    public CollectionDao getCollectionDao() {
        return collectionDao;
    }
    public void setCollectionDao(CollectionDao collectionDao) {
        this.collectionDao = collectionDao;
    }
    @SuppressWarnings("rawtypes")
    @Cacheable(value = "userCache", key = "'getCollectVideo'+'-'+#uid+'-'+#page")
    public List<VideoInfo> getCollectVideo(String uid, String loginUid, int page) {
src/main/java/com/yeshi/buwan/service/imp/CommentService.java
@@ -29,22 +29,6 @@
    @Resource
    private CommentReplyDao commentReplyDao;
    public CommentReplyDao getCommentReplyDao() {
        return commentReplyDao;
    }
    public void setCommentReplyDao(CommentReplyDao commentReplyDao) {
        this.commentReplyDao = commentReplyDao;
    }
    public CommentDao getCommentDao() {
        return commentDao;
    }
    public void setCommentDao(CommentDao commentDao) {
        this.commentDao = commentDao;
    }
    public void addComment2(Comment2 c) {
        commentDao.create(c);
src/main/java/com/yeshi/buwan/service/imp/ConfigService.java
@@ -19,14 +19,6 @@
    @Resource
    private ConfigDao configDao;
    public ConfigDao getConfigDao() {
        return configDao;
    }
    public void setConfigDao(ConfigDao configDao) {
        this.configDao = configDao;
    }
    // 获取配置文件
    public List<Config> getConfig(Long systemId, int version) {
        return configDao.listBySystemIdAndMaxVersion(systemId, version);
src/main/java/com/yeshi/buwan/service/imp/HomeAdService.java
@@ -25,262 +25,246 @@
@Service
public class HomeAdService {
    @Resource
    private HomeAdDao homeAdDao;
    @Resource
    private SuperHomeAdDao superHomeAdDao;
    @Resource
    private HomeAdDao homeAdDao;
    @Resource
    private SuperHomeAdDao superHomeAdDao;
    public SuperHomeAdDao getSuperHomeAdDao() {
        return superHomeAdDao;
    }
    public List<HomeAd> getHomeAdList(SystemInfo system) {
        List<HomeAd> list = homeAdDao
                .list("from HomeAd h where h.system.id=" + system.getId() + " order by  h.orderby desc");
        return list;
    }
    public void setSuperHomeAdDao(SuperHomeAdDao superHomeAdDao) {
        this.superHomeAdDao = superHomeAdDao;
    }
    @Cacheable(value = "homeCache", key = "'getHomeAdList'+'-'+#detailSystem.id")
    public List<HomeAd> getHomeAdList(DetailSystem detailSystem) {
        List<HomeAd> list = homeAdDao.list("select h.homeAd from SuperHomeAd h where h.detailSystem.id="
                + detailSystem.getId() + " order by h.homeAd.orderby desc");
        return list;
    }
    public HomeAdDao getHomeAdDao() {
        return homeAdDao;
    }
    public static List<HomeAd> getIOSTestHomeAdList() {
        List<HomeAd> list = new ArrayList<>();
        HomeAd ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01a5a7562499216ac7254878995802.jpg");
        VideoInfo info = new VideoInfo();
        info.setId("161850");
        info.setName("【摔杯为号】赵家班父子摔杯演闹剧");
        info.setPicture("http://img2.funshion.com/pictures/poseidon01/418/985/4189850_v_still.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
    public void setHomeAdDao(HomeAdDao homeAdDao) {
        this.homeAdDao = homeAdDao;
    }
        ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01ac60563acca86ac7259e0fe92cae.jpg");
        info = new VideoInfo();
        info.setId("161334");
        info.setName("【冯巩】冯巩,牛莉《夫妻日记》");
        info.setPicture("http://img.zcool.cn/community/01ac60563acca86ac7259e0fe92cae.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
    public List<HomeAd> getHomeAdList(SystemInfo system) {
        List<HomeAd> list = homeAdDao
                .list("from HomeAd h where h.system.id=" + system.getId() + " order by  h.orderby desc");
        return list;
    }
        ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01ae2b563accb032f87512f63f63ad.jpg");
        info = new VideoInfo();
        info.setId("163707");
        info.setName("【郭德纲于谦】《谦哥带儿子见世面》");
        info.setPicture("http://img.zcool.cn/community/01cdfb563acca06ac7259e0fb69676.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
    @Cacheable(value = "homeCache", key = "'getHomeAdList'+'-'+#detailSystem.id")
    public List<HomeAd> getHomeAdList(DetailSystem detailSystem) {
        List<HomeAd> list = homeAdDao.list("select h.homeAd from SuperHomeAd h where h.detailSystem.id="
                + detailSystem.getId() + " order by h.homeAd.orderby desc");
        return list;
    }
        ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01ae2b563accb032f87512f63f63ad.jpg");
        info = new VideoInfo();
        info.setId("161339");
        info.setName("【欢乐喜剧人】开心麻花《感染者》");
        info.setPicture("http://img2.funshion.com/pictures/poseidon01/418/985/4189850_v_still.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
    public static List<HomeAd> getIOSTestHomeAdList() {
        List<HomeAd> list = new ArrayList<>();
        HomeAd ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01a5a7562499216ac7254878995802.jpg");
        VideoInfo info = new VideoInfo();
        info.setId("161850");
        info.setName("【摔杯为号】赵家班父子摔杯演闹剧");
        info.setPicture("http://img2.funshion.com/pictures/poseidon01/418/985/4189850_v_still.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
        return list;
    }
        ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01ac60563acca86ac7259e0fe92cae.jpg");
        info = new VideoInfo();
        info.setId("161334");
        info.setName("【冯巩】冯巩,牛莉《夫妻日记》");
        info.setPicture("http://img.zcool.cn/community/01ac60563acca86ac7259e0fe92cae.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
    public List<HomeAd> getHomeAdList() {
        ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01ae2b563accb032f87512f63f63ad.jpg");
        info = new VideoInfo();
        info.setId("163707");
        info.setName("【郭德纲于谦】《谦哥带儿子见世面》");
        info.setPicture("http://img.zcool.cn/community/01cdfb563acca06ac7259e0fb69676.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
        List<HomeAd> list = homeAdDao.list("from HomeAd ha order by ha.orderby desc");
        return list;
    }
        ad = new HomeAd();
        ad.setPicture("http://img.zcool.cn/community/01ae2b563accb032f87512f63f63ad.jpg");
        info = new VideoInfo();
        info.setId("161339");
        info.setName("【欢乐喜剧人】开心麻花《感染者》");
        info.setPicture("http://img2.funshion.com/pictures/poseidon01/418/985/4189850_v_still.jpg");
        info.setThirdType("0");
        info.setShare("0");
        ad.setVideo(info);
        list.add(ad);
    @SuppressWarnings("unchecked")
    public void deleteHomeAd(final String id) {
        homeAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperHomeAd> list = session.createQuery("from SuperHomeAd sh where sh.homeAd.id=?")
                            .setParameter(0, id).list();
                    session.getTransaction().begin();
                    for (SuperHomeAd shd : list)
                        session.delete(shd);
                    session.createQuery("delete from HomeAd ha where ha.id=?").setParameter(0, id).executeUpdate();
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
        return list;
    }
    }
    public List<HomeAd> getHomeAdList() {
    public Serializable addHomeAd(HomeAd ad) {
        return homeAdDao.save(ad);
    }
        List<HomeAd> list = homeAdDao.list("from HomeAd ha order by ha.orderby desc");
        return list;
    }
    public HomeAd getHomeAdById(String id) {
    @SuppressWarnings("unchecked")
    public void deleteHomeAd(final String id) {
        homeAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperHomeAd> list = session.createQuery("from SuperHomeAd sh where sh.homeAd.id=?")
                            .setParameter(0, id).list();
                    session.getTransaction().begin();
                    for (SuperHomeAd shd : list)
                        session.delete(shd);
                    session.createQuery("delete from HomeAd ha where ha.id=?").setParameter(0, id).executeUpdate();
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
        return homeAdDao.find(HomeAd.class, id);
    }
    }
    public void updateHomeAd(HomeAd ad) {
        homeAdDao.update(ad);
    }
    public Serializable addHomeAd(HomeAd ad) {
        return homeAdDao.save(ad);
    }
    // 后台操作
    @SuppressWarnings("unchecked")
    public List<HomeAdAdmin> getHomeAdAdmin(final String key, final String systemId, final int detailSystem, final int page) {
        return (List<HomeAdAdmin>) homeAdDao.excute(new HibernateCallback<List<HomeAdAdmin>>() {
            public List<HomeAdAdmin> doInHibernate(Session session) throws HibernateException {
                List<HomeAdAdmin> zhiBoClassList = new ArrayList<>();
                try {
                    List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem ds where ds.system.id=" + systemId).list();
                    String sql = "";
                    if (detailSystem > 0)
                        sql = "select sh.homeAd from SuperHomeAd sh where  sh.detailSystem.id=" + detailSystem
                                + " order by  sh.homeAd.createtime desc";
                    else
                        sql = "from HomeAd zb where zb.system.id=" + systemId + " order by zb.createtime desc";
    public HomeAd getHomeAdById(String id) {
                    List<HomeAd> list = session.createQuery(sql).setFirstResult((page - 1) * Constant.pageCount)
                            .setMaxResults(Constant.pageCount).list();
                    for (HomeAd vb : list) {
                        List<DetailSystem> detailSystemS = session
                                .createQuery("select vb.detailSystem from SuperHomeAd vb where vb.homeAd.id=?")
                                .setParameter(0, vb.getId()).list();
        return homeAdDao.find(HomeAd.class, id);
    }
                        List<DetailSystemSelect> dssList = new ArrayList<>();
    public void updateHomeAd(HomeAd ad) {
        homeAdDao.update(ad);
    }
                        for (DetailSystem ds : detailSystemList) {
                            DetailSystemSelect dss = new DetailSystemSelect();
                            dss.setDetailSystem(ds);
                            dss.setSelected(false);
                            dssList.add(dss);
                        }
    // 后台操作
    @SuppressWarnings("unchecked")
    public List<HomeAdAdmin> getHomeAdAdmin(final String key, final int detailSystem, final int page) {
        return (List<HomeAdAdmin>) homeAdDao.excute(new HibernateCallback<List<HomeAdAdmin>>() {
            public List<HomeAdAdmin> doInHibernate(Session session) throws HibernateException {
                List<HomeAdAdmin> zhiBoClassList = new ArrayList<>();
                try {
                    List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list();
                    String sql = "";
                    if (detailSystem > 0)
                        sql = "select sh.homeAd from SuperHomeAd sh where  sh.detailSystem.id=" + detailSystem
                                + " order by  sh.homeAd.createtime desc";
                    else
                        sql = "from HomeAd zb order by zb.createtime desc";
                        // 设置已经存在的
                        for (DetailSystem ds : detailSystemS) {
                            for (DetailSystemSelect dss : dssList) {
                                if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                                    dss.setSelected(true);
                                    break;
                                }
                            }
                        }
                        SuperHomeAd sz = new SuperHomeAd();
                        sz.setDetailSystem(null);
                        sz.setHomeAd(vb);
                        zhiBoClassList.add(new HomeAdAdmin(sz, dssList));
                    }
                    List<HomeAd> list = session.createQuery(sql).setFirstResult((page - 1) * Constant.pageCount)
                            .setMaxResults(Constant.pageCount).list();
                    for (HomeAd vb : list) {
                        List<DetailSystem> detailSystemS = session
                                .createQuery("select vb.detailSystem from SuperHomeAd vb where vb.homeAd.id=?")
                                .setParameter(0, vb.getId()).list();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return zhiBoClassList;
            }
        });
    }
                        List<DetailSystemSelect> dssList = new ArrayList<>();
    public long getHomeAdAdminCount(String key, String systemId, int detailSystem) {
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_homead zb left join wk_video_homead c on c.id=zb.homeadid where zb.detailsystemid="
                    + detailSystem + " group by zb.homeadid) s";
        else
            sql = "select count(*) from  wk_video_homead where system="+systemId;
        return homeAdDao.getCountSQL(sql);
    }
                        for (DetailSystem ds : detailSystemList) {
                            DetailSystemSelect dss = new DetailSystemSelect();
                            dss.setDetailSystem(ds);
                            dss.setSelected(false);
                            dssList.add(dss);
                        }
    @SuppressWarnings("unchecked")
    public void deleteHomeAdAdmin(final String classId, final String detailSystemId) {
        homeAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperHomeAd> list = session
                            .createQuery("from SuperHomeAd vb where vb.homeAd.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classId).setParameter(1, detailSystemId).list();
                    session.getTransaction().begin();
                    if (list != null && list.size() > 0) {
                        for (SuperHomeAd vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
                        // 设置已经存在的
                        for (DetailSystem ds : detailSystemS) {
                            for (DetailSystemSelect dss : dssList) {
                                if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                                    dss.setSelected(true);
                                    break;
                                }
                            }
                        }
                        SuperHomeAd sz = new SuperHomeAd();
                        sz.setDetailSystem(null);
                        sz.setHomeAd(vb);
                        zhiBoClassList.add(new HomeAdAdmin(sz, dssList));
                    }
    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return zhiBoClassList;
            }
        });
    }
    public List<HomeAd> getSuperHomeAdList(String detailSystemId) {
        return homeAdDao.list("select sh.homeAd from SuperHomeAd sh where sh.detailSystem.id=" + detailSystemId);
    }
    public long getHomeAdAdminCount(String key, int detailSystem) {
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_homead zb left join wk_video_homead c on c.id=zb.homeadid where zb.detailsystemid="
                    + detailSystem + " group by zb.homeadid) s";
        else
            sql = "select count(*) from  wk_video_homead";
        return homeAdDao.getCountSQL(sql);
    }
    // 更新广告列表
    @SuppressWarnings("unchecked")
    public void updateSuperHomeAdList(final String detailSystemId, final List<HomeAd> adList) {
        homeAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperHomeAd> list = session
                            .createQuery("from SuperHomeAd sh where sh.detailSystem.id=" + detailSystemId).list();
                    session.getTransaction().begin();
                    for (SuperHomeAd ad : list) {
                        session.delete(ad);
                    }
    @SuppressWarnings("unchecked")
    public void deleteHomeAdAdmin(final String classId, final String detailSystemId) {
        homeAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperHomeAd> list = session
                            .createQuery("from SuperHomeAd vb where vb.homeAd.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classId).setParameter(1, detailSystemId).list();
                    session.getTransaction().begin();
                    if (list != null && list.size() > 0) {
                        for (SuperHomeAd vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
                    for (HomeAd homeAd : adList) {
                        SuperHomeAd shd = new SuperHomeAd();
                        shd.setCreatetime(System.currentTimeMillis() + "");
                        shd.setDetailSystem(new DetailSystem(detailSystemId));
                        shd.setHomeAd(homeAd);
                        session.persist(shd);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    }
    public List<HomeAd> getSuperHomeAdList(String detailSystemId) {
        return homeAdDao.list("select sh.homeAd from SuperHomeAd sh where sh.detailSystem.id=" + detailSystemId);
    }
    // 更新广告列表
    @SuppressWarnings("unchecked")
    public void updateSuperHomeAdList(final String detailSystemId, final List<HomeAd> adList) {
        homeAdDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperHomeAd> list = session
                            .createQuery("from SuperHomeAd sh where sh.detailSystem.id=" + detailSystemId).list();
                    session.getTransaction().begin();
                    for (SuperHomeAd ad : list) {
                        session.delete(ad);
                    }
                    for (HomeAd homeAd : adList) {
                        SuperHomeAd shd = new SuperHomeAd();
                        shd.setCreatetime(System.currentTimeMillis() + "");
                        shd.setDetailSystem(new DetailSystem(detailSystemId));
                        shd.setHomeAd(homeAd);
                        session.persist(shd);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    public void addSuperHomeAd(SuperHomeAd sv) {
        List<SuperHomeAd> list = superHomeAdDao.list("from SuperHomeAd sv where sv.homeAd.id=" + sv.getHomeAd().getId()
                + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superHomeAdDao.create(sv);
    }
    public void addSuperHomeAd(SuperHomeAd sv) {
        List<SuperHomeAd> list = superHomeAdDao.list("from SuperHomeAd sv where sv.homeAd.id=" + sv.getHomeAd().getId()
                + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superHomeAdDao.create(sv);
    }
}
src/main/java/com/yeshi/buwan/service/imp/HomeNoticeService.java
@@ -34,30 +34,6 @@
    @Resource
    private SuperHomeNoticeDao superHomeNoticeDao;
    public SuperHomeNoticeDao getSuperHomeNoticeDao() {
        return superHomeNoticeDao;
    }
    public void setSuperHomeNoticeDao(SuperHomeNoticeDao superHomeNoticeDao) {
        this.superHomeNoticeDao = superHomeNoticeDao;
    }
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
    public HomeNoticeDao getHomeNoticeDao() {
        return homeNoticeDao;
    }
    public void setHomeNoticeDao(HomeNoticeDao homeNoticeDao) {
        this.homeNoticeDao = homeNoticeDao;
    }
    // 首页公告
    public List<HomeNotice> getHomeNoticeList(SystemInfo system) {
        List<HomeNotice> list = homeNoticeDao
src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java
@@ -437,19 +437,19 @@
     */
    @SuppressWarnings("unchecked")
    public List<HomeTypeAdmin> getHomeTypeAdmin(final String key, final int detailSystem, final int page) {
    public List<HomeTypeAdmin> getHomeTypeAdmin(final String key, final String systemId, final int detailSystem, final int page) {
        return (List<HomeTypeAdmin>) homeTypeDao.excute(new HibernateCallback<List<HomeTypeAdmin>>() {
            public List<HomeTypeAdmin> doInHibernate(Session session) throws HibernateException {
                List<HomeTypeAdmin> zhiBoClassList = new ArrayList<>();
                try {
                    List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list();
                    List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem ds where ds.system.id=" + systemId).list();
                    String sql = "";
                    if (detailSystem > 0)
                        sql = "select sh.homeType from SuperHomeType sh where sh.homeType.name like ? and sh.detailSystem.id="
                                + detailSystem + " order by  sh.homeType.orderby desc";
                    else
                        sql = "from HomeType zb where zb.name like ? order by zb.orderby desc";
                        sql = "from HomeType zb where zb.name like ? and zb.system.id=" + systemId + " order by zb.orderby desc";
                    List<HomeType> list = session.createQuery(sql).setParameter(0, "%" + key + "%")
                            .setFirstResult((page - 1) * Constant.pageCount).setMaxResults(Constant.pageCount).list();
@@ -491,14 +491,14 @@
    }
    public long getHomeTypeAdminCount(String key, int detailSystem) {
    public long getHomeTypeAdminCount(String key, String systemId,int detailSystem) {
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where zb.detailsystemid="
                    + detailSystem + " and c.name like '%" + key + "%' group by zb.hometypeid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where  c.name like '%"
                    + key + "%' group by zb.hometypeid) s";
                    + key + "%' and c.system="+systemId+" group by zb.hometypeid) s";
        return homeTypeDao.getCountSQL(sql);
    }
src/main/java/com/yeshi/buwan/service/imp/HotVideoTypeService.java
@@ -26,22 +26,6 @@
    @Resource
    private SuperHotTypeDao superHotTypeDao;
    public SuperHotTypeDao getSuperHotTypeDao() {
        return superHotTypeDao;
    }
    public void setSuperHotTypeDao(SuperHotTypeDao superHotTypeDao) {
        this.superHotTypeDao = superHotTypeDao;
    }
    public HotTypeDao getHotTypeDao() {
        return hotTypeDao;
    }
    public void setHotTypeDao(HotTypeDao hotTypeDao) {
        this.hotTypeDao = hotTypeDao;
    }
    // 获取热门频道
    public List<HotVideoType> getHotTypeList() {
src/main/java/com/yeshi/buwan/service/imp/ImageService.java
@@ -15,14 +15,6 @@
    @Resource
    private ImageInfoDao imageInfoDao;
    public ImageInfoDao getImageInfoDao() {
        return imageInfoDao;
    }
    public void setImageInfoDao(ImageInfoDao imageInfoDao) {
        this.imageInfoDao = imageInfoDao;
    }
    public void addImage(ImageInfo image) {
        imageInfoDao.create(image);
src/main/java/com/yeshi/buwan/service/imp/IntersectionService.java
@@ -16,133 +16,118 @@
@Service
public class IntersectionService {
    @Resource
    private VideoIntersectionDao videoIntersectionDao;
    @Resource
    private VideoIntersectionVideoDao videoIntersectionVideoDao;
    @Resource
    private VideoIntersectionDao videoIntersectionDao;
    @Resource
    private VideoIntersectionVideoDao videoIntersectionVideoDao;
    public VideoIntersectionVideoDao getVideoIntersectionVideoDao() {
        return videoIntersectionVideoDao;
    }
    public void setVideoIntersectionVideoDao(VideoIntersectionVideoDao videoIntersectionVideoDao) {
        this.videoIntersectionVideoDao = videoIntersectionVideoDao;
    }
    // 添加合集
    public void addIntersection(VideoIntersection section) {
        videoIntersectionDao.create(section);
    }
    public VideoIntersectionDao getVideoIntersectionDao() {
        return videoIntersectionDao;
    }
    public void updateIntersection(VideoIntersection section) {
        videoIntersectionDao.update(section);
    }
    public void setVideoIntersectionDao(VideoIntersectionDao videoIntersectionDao) {
        this.videoIntersectionDao = videoIntersectionDao;
    }
    public void deleteIntersection(VideoIntersection section) {
        videoIntersectionDao.delete(section);
    }
    // 添加合集
    public void addIntersection(VideoIntersection section) {
        videoIntersectionDao.create(section);
    }
    public void deleteIntersectionVideo(VideoIntersectionVideo section) {
        videoIntersectionVideoDao.delete(section);
    }
    public void updateIntersection(VideoIntersection section) {
        videoIntersectionDao.update(section);
    }
    // 添加合集视频
    public void addIntersectionVideo(VideoIntersectionVideo sectionVideo) {
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.intersection.id=? and v.video.id=?",
                new String[]{sectionVideo.getIntersection().getId(), sectionVideo.getVideo().getId()});
        if (list == null || list.size() == 0)
            videoIntersectionVideoDao.create(sectionVideo);
    }
    public void deleteIntersection(VideoIntersection section) {
        videoIntersectionDao.delete(section);
    }
    public List<VideoIntersection> getIntersectionList() {
        return videoIntersectionDao.list("from VideoIntersection");
    }
    public void deleteIntersectionVideo(VideoIntersectionVideo section) {
        videoIntersectionVideoDao.delete(section);
    }
    public List<VideoIntersection> getIntersectionList(String key, int pageIndex) {
        return videoIntersectionDao.list("from VideoIntersection vi where vi.name like ? ",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount, new String[]{"%" + key + "%"});
    }
    // 添加合集视频
    public void addIntersectionVideo(VideoIntersectionVideo sectionVideo) {
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.intersection.id=? and v.video.id=?",
                new String[] { sectionVideo.getIntersection().getId(), sectionVideo.getVideo().getId() });
        if (list == null || list.size() == 0)
            videoIntersectionVideoDao.create(sectionVideo);
    }
    public long getIntersectionListCount(String key) {
        return videoIntersectionDao.getCount("select count(*)  from VideoIntersection vi where vi.name like ? ",
                new String[]{"%" + key + "%"});
    }
    public List<VideoIntersection> getIntersectionList() {
        return videoIntersectionDao.list("from VideoIntersection");
    }
    public List<VideoIntersection> getIntersectionListByPage(int page) {
        return videoIntersectionDao.list("from VideoIntersection", Constant.pageCount * (page - 1), Constant.pageCount,
                new String[]{});
    }
    public List<VideoIntersection> getIntersectionList(String key, int pageIndex) {
        return videoIntersectionDao.list("from VideoIntersection vi where vi.name like ? ",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount, new String[] { "%" + key + "%" });
    }
    public long getIntersectionListPage() {
        return videoIntersectionDao.getCount("select count(*)  from VideoIntersection");
    }
    public long getIntersectionListCount(String key) {
        return videoIntersectionDao.getCount("select count(*)  from VideoIntersection vi where vi.name like ? ",
                new String[] { "%" + key + "%" });
    }
    public VideoIntersection getIntersectionById(String id) {
        return videoIntersectionDao.find(VideoIntersection.class, id);
    }
    public List<VideoIntersection> getIntersectionListByPage(int page) {
        return videoIntersectionDao.list("from VideoIntersection", Constant.pageCount * (page - 1), Constant.pageCount,
                new String[] {});
    }
    public List<VideoInfo> getIntersectionVideoList(String intersectionId) {
        List<VideoInfo> videoList = new ArrayList<VideoInfo>();
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=?",
                new String[]{intersectionId});
        for (VideoIntersectionVideo vi : list)
            if (vi.getVideo() != null)
                videoList.add(vi.getVideo());
        return videoList;
    }
    public long getIntersectionListPage() {
        return videoIntersectionDao.getCount("select count(*)  from VideoIntersection");
    }
    public VideoIntersectionVideo getIntersectionVideoById(String id) {
        return videoIntersectionVideoDao.find(VideoIntersectionVideo.class, id);
    }
    public VideoIntersection getIntersectionById(String id) {
        return videoIntersectionDao.find(VideoIntersection.class, id);
    }
    public List<VideoInfo> getIntersectionVideoList(String intersectionId, String key, int pageIndex) {
        List<VideoInfo> videoList = new ArrayList<VideoInfo>();
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount,
                new String[]{intersectionId, "%" + key + "%"});
        for (VideoIntersectionVideo vi : list)
            if (vi.getVideo() != null)
                videoList.add(vi.getVideo());
        return videoList;
    }
    public List<VideoInfo> getIntersectionVideoList(String intersectionId) {
        List<VideoInfo> videoList = new ArrayList<VideoInfo>();
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=?",
                new String[] { intersectionId });
        for (VideoIntersectionVideo vi : list)
            if (vi.getVideo() != null)
                videoList.add(vi.getVideo());
        return videoList;
    }
    public long getIntersectionVideoListCount(String intersectionId, String key) {
        return videoIntersectionVideoDao.getCount(
                "select count(*)  from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                new String[]{intersectionId, "%" + key + "%"});
    }
    public VideoIntersectionVideo getIntersectionVideoById(String id) {
        return videoIntersectionVideoDao.find(VideoIntersectionVideo.class, id);
    }
    public List<VideoIntersectionVideo> getIntersectionVideoListByInersection(String intersectionId) {
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=?",
                new String[]{intersectionId});
        return list;
    }
    public List<VideoInfo> getIntersectionVideoList(String intersectionId, String key, int pageIndex) {
        List<VideoInfo> videoList = new ArrayList<VideoInfo>();
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount,
                new String[] { intersectionId, "%" + key + "%" });
        for (VideoIntersectionVideo vi : list)
            if (vi.getVideo() != null)
                videoList.add(vi.getVideo());
        return videoList;
    }
    public List<VideoIntersectionVideo> getIntersectionVideoListByInersection(String intersectionId, String key,
                                                                              int pageIndex) {
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount,
                new String[]{intersectionId, "%" + key + "%"});
        return list;
    }
    public long getIntersectionVideoListCount(String intersectionId, String key) {
        return videoIntersectionVideoDao.getCount(
                "select count(*)  from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                new String[] { intersectionId, "%" + key + "%" });
    }
    public List<VideoIntersectionVideo> getIntersectionVideoListByInersection(String intersectionId) {
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=?",
                new String[] { intersectionId });
        return list;
    }
    public List<VideoIntersectionVideo> getIntersectionVideoListByInersection(String intersectionId, String key,
            int pageIndex) {
        List<VideoIntersectionVideo> list = videoIntersectionVideoDao.list(
                "from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount,
                new String[] { intersectionId, "%" + key + "%" });
        return list;
    }
    public long getIntersectionVideoListByInersectionCount(String intersectionId, String key) {
        return videoIntersectionVideoDao.getCount(
                "select count(*)  from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                new String[] { intersectionId, "%" + key + "%" });
    }
    public long getIntersectionVideoListByInersectionCount(String intersectionId, String key) {
        return videoIntersectionVideoDao.getCount(
                "select count(*)  from VideoIntersectionVideo v where v.video.show=1 and v.intersection.id=? and v.video.name like ?",
                new String[]{intersectionId, "%" + key + "%"});
    }
}
src/main/java/com/yeshi/buwan/service/imp/LoginUserServiceImpl.java
@@ -4,13 +4,12 @@
import com.yeshi.buwan.dao.user.LoginUserExtraDao;
import com.yeshi.buwan.domain.user.LoginUser;
import com.yeshi.buwan.domain.user.LoginUserExtra;
import com.yeshi.buwan.exception.LoginUserException;
import com.yeshi.buwan.exception.user.LoginUserException;
import com.yeshi.buwan.exception.PPTVException;
import com.yeshi.buwan.pptv.PPTVApiUtil;
import com.yeshi.buwan.pptv.PPTVUtil;
import com.yeshi.buwan.service.inter.LoginUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.StringUtil;
import org.yeshi.utils.entity.wx.WeiXinUser;
src/main/java/com/yeshi/buwan/service/imp/OtherService.java
@@ -21,22 +21,6 @@
    @Resource
    private ContactDao contactDao;
    public ContactDao getContactDao() {
        return contactDao;
    }
    public void setContactDao(ContactDao contactDao) {
        this.contactDao = contactDao;
    }
    public AdviceDao getAdviceDao() {
        return adviceDao;
    }
    public void setAdviceDao(AdviceDao adviceDao) {
        this.adviceDao = adviceDao;
    }
    // 提交建议
    public void advice(String uid, String content) {
        Advice advice = new Advice();
src/main/java/com/yeshi/buwan/service/imp/RecommendService.java
@@ -33,22 +33,6 @@
    @Resource
    private CategoryContryDao categoryContryDao;
    public BanQuanService getBanQuanService() {
        return banQuanService;
    }
    public void setBanQuanService(BanQuanService banQuanService) {
        this.banQuanService = banQuanService;
    }
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
    @Cacheable(value = "userCache", key = "'guessLike'+'-'+#videoId+'-'+#detailSystem+'-'+#cachemd5")
    public List<VideoInfo> guessLike(String videoId, String detailSystem, List<Long> resourceList, String cachemd5) {
        String resourceWhere = "";
src/main/java/com/yeshi/buwan/service/imp/SearchService.java
@@ -466,16 +466,16 @@
    }
    @SuppressWarnings("unchecked")
    public List<HotSearchAdmin> getHotSearchAdmin(String key, int detailSystem, int page) {
    public List<HotSearchAdmin> getHotSearchAdmin(String key, String systemId, int detailSystem, int page) {
        List<HotSearchAdmin> zhiBoClassList = new ArrayList<>();
        try {
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem");
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem ds where ds.system.id=" + systemId);
            String sql = "";
            if (detailSystem > 0)
                sql = "select sh.hotSearch from SuperHotSearch sh where sh.hotSearch.name like ? and sh.detailSystem.id="
                        + detailSystem + " order by  sh.createtime desc";
            else
                sql = "from HotSearch zb where zb.name like ? order by zb.createtime desc";
                sql = "from HotSearch zb where zb.name like ? and zb.system.id=" + systemId + " order by zb.createtime desc";
            List<HotSearch> list = hotSearchDao.list(sql, (page - 1) * Constant.pageCount, Constant.pageCount,
                    new Serializable[]{"%" + key + "%"});
@@ -513,13 +513,13 @@
        return zhiBoClassList;
    }
    public long getHotSearchAdminCount(String key, int detailSystem) {
    public long getHotSearchAdminCount(String key,String systemId, int detailSystem) {
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_hotsearch zb left join wk_video_hotsearch c on c.id=zb.hotsearchid where zb.detailsystem="
                    + detailSystem + " and c.name like '%" + key + "%' group by zb.hotsearchid) s";
        else
            sql = "select count(*) from wk_video_hotsearch h where h.name like '%" + key + "%'";
            sql = "select count(*) from wk_video_hotsearch h where h.name like '%" + key + "%' and h.system="+systemId;
        return videoBanQuanVideoDao.getCountSQL(sql);
    }
src/main/java/com/yeshi/buwan/service/imp/ShareService.java
@@ -16,14 +16,6 @@
    @Resource
    private ShareContentDao shareContentDao;
    public ShareContentDao getShareContentDao() {
        return shareContentDao;
    }
    public void setShareContentDao(ShareContentDao shareContentDao) {
        this.shareContentDao = shareContentDao;
    }
    /**
     * 添加分享内容
     * 
src/main/java/com/yeshi/buwan/service/imp/SpecialService.java
@@ -30,294 +30,263 @@
@Service
public class SpecialService {
    @Resource
    private SpecialDao specialDao;
    @Resource
    private SpecialVideoDao specialVideoDao;
    @Resource
    private VideoInfoDao videoInfoDao;
    @Resource
    private SuperSpecialDao superSpecialDao;
    @Resource
    private DetailSystemDao detailSystemDao;
    @Resource
    private SpecialDao specialDao;
    @Resource
    private SpecialVideoDao specialVideoDao;
    @Resource
    private VideoInfoDao videoInfoDao;
    @Resource
    private SuperSpecialDao superSpecialDao;
    @Resource
    private DetailSystemDao detailSystemDao;
    public SuperSpecialDao getSuperSpecialDao() {
        return superSpecialDao;
    }
    public void setSuperSpecialDao(SuperSpecialDao superSpecialDao) {
        this.superSpecialDao = superSpecialDao;
    }
    @Cacheable(value = "classCache", key = "'getSpecialList'+'-'+#detailSystemId+'-'+#page")
    public List<Special> getSpecialList(String detailSystemId, int page) {
        return specialDao.list(
                "select ss.special from SuperSpecial ss where ss.detailSystem.id=? and ss.special.show=1 order by ss.special.orderby desc",
                (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{detailSystemId});
    }
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
    public List<Special> getSpecialList(String detailSystemId) {
        return specialDao.list(
                "select ss.special from SuperSpecial ss where ss.detailSystem.id=? order by ss.special.orderby desc",
                new String[]{detailSystemId});
    }
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
    public List<Special> getSpecialList() {
        return specialDao.list("from Special");
    }
    public SpecialVideoDao getSpecialVideoDao() {
        return specialVideoDao;
    }
    @Cacheable(value = "classCache", key = "'getSpecialCount'+'-'+#detailSystemId")
    public long getSpecialCount(String detailSystemId) {
        return specialDao.getCount("select count(*)  from SuperSpecial ss where ss.detailSystem.id=?",
                new String[]{detailSystemId});
    }
    public void setSpecialVideoDao(SpecialVideoDao specialVideoDao) {
        this.specialVideoDao = specialVideoDao;
    }
    @Cacheable(value = "classCache", key = "'getSpecial'+'-'+#id")
    public Special getSpecial(String id) {
        return specialDao.find(Special.class, id);
    }
    public SpecialDao getSpecialDao() {
        return specialDao;
    }
    public void addSpecial(Special special) {
        specialDao.save(special);
    }
    public void setSpecialDao(SpecialDao specialDao) {
        this.specialDao = specialDao;
    }
    @SuppressWarnings("rawtypes")
    public void deleteSpecial(final Special special) {
        if (special != null) {
            specialDao.excute(new HibernateCallback() {
                public Object doInHibernate(Session session) throws HibernateException {
                    try {
                        @SuppressWarnings("unchecked")
                        List<SuperSpecial> list = session.createQuery("from SuperSpecial sh where sh.special.id=?")
                                .setParameter(0, special.getId()).list();
                        session.getTransaction().begin();
                        for (SuperSpecial sh : list)
                            session.delete(sh);
                        session.delete(special);
                        session.flush();
                        session.getTransaction().commit();
                    } catch (Exception e) {
                        e.printStackTrace();
                        session.getTransaction().rollback();
                    }
                    return null;
                }
            });
    @Cacheable(value = "classCache",key="'getSpecialList'+'-'+#detailSystemId+'-'+#page")
    public List<Special> getSpecialList(String detailSystemId, int page) {
        return specialDao.list(
                "select ss.special from SuperSpecial ss where ss.detailSystem.id=? and ss.special.show=1 order by ss.special.orderby desc",
                (page - 1) * Constant.pageCount, Constant.pageCount, new String[] { detailSystemId });
    }
        }
    }
    public List<Special> getSpecialList(String detailSystemId) {
        return specialDao.list(
                "select ss.special from SuperSpecial ss where ss.detailSystem.id=? order by ss.special.orderby desc",
                new String[] { detailSystemId });
    }
    public void updateSpecial(Special special) {
        specialDao.update(special);
    }
    public List<Special> getSpecialList() {
        return specialDao.list("from Special");
    }
    public void addSpecialVideo(SpecialVideo sv) {
        specialVideoDao.create(sv);
    }
    @Cacheable(value = "classCache",key="'getSpecialCount'+'-'+#detailSystemId")
    public long getSpecialCount(String detailSystemId) {
        return specialDao.getCount("select count(*)  from SuperSpecial ss where ss.detailSystem.id=?",
                new String[] { detailSystemId });
    }
    @Cacheable(value = "classCache", key = "'getSpecialVideoList'+'-'+#specialId")
    public List<VideoInfo> getSpecialVideoList(String specialId) {
        return videoInfoDao.list(
                "select sv.video from SpecialVideo sv where sv.special.id=? and sv.video.show=1 order by sv.orderby desc",
                new String[]{specialId});
    }
    @Cacheable(value = "classCache",key="'getSpecial'+'-'+#id")
    public Special getSpecial(String id) {
        return specialDao.find(Special.class, id);
    }
    public void deleteSpecialVideo(String specialVideoId) {
        specialVideoDao.delete(new SpecialVideo(specialVideoId));
    }
    public void addSpecial(Special special) {
        specialDao.save(special);
    }
    public long getSpecialVideoListCount(String specialId) {
    @SuppressWarnings("rawtypes")
    public void deleteSpecial(final Special special) {
        if (special != null) {
            specialDao.excute(new HibernateCallback() {
                public Object doInHibernate(Session session) throws HibernateException {
                    try {
                        @SuppressWarnings("unchecked")
                        List<SuperSpecial> list = session.createQuery("from SuperSpecial sh where sh.special.id=?")
                                .setParameter(0, special.getId()).list();
                        session.getTransaction().begin();
                        for (SuperSpecial sh : list)
                            session.delete(sh);
                        session.delete(special);
                        session.flush();
                        session.getTransaction().commit();
                    } catch (Exception e) {
                        e.printStackTrace();
                        session.getTransaction().rollback();
                    }
                    return null;
                }
            });
        return videoInfoDao.getCount("select sv.video from SpecialVideo sv where sv.special.id=?",
                new String[]{specialId});
    }
        }
    }
    public List<SpecialVideo> getSpecialVideoList(String specialId, String key) {
        return specialVideoDao.list("from SpecialVideo sv where sv.special.id=? and sv.video.name like ?",
                new String[]{specialId, "%" + key + "%"});
    }
    public void updateSpecial(Special special) {
        specialDao.update(special);
    }
    public List<SpecialVideo> getSpecialVideoList(String specialId, PageEntity pg, String key) {
        return specialVideoDao.list("from SpecialVideo sv where sv.special.id=? and sv.video.name like ?", ((pg.getPageIndex() - 1) * pg.getPageSize()), pg.getPageSize(),
                new String[]{specialId, "%" + key + "%"});
    }
    public void addSpecialVideo(SpecialVideo sv) {
        specialVideoDao.create(sv);
    }
    public long getSpecialVideoListCount(String specialId, String key) {
        return specialVideoDao.getCount(
                "select count(*)  from SpecialVideo sv where sv.special.id=? and sv.video.name like ?",
                new String[]{specialId, "%" + key + "%"});
    }
    @Cacheable(value = "classCache",key="'getSpecialVideoList'+'-'+#specialId")
    public List<VideoInfo> getSpecialVideoList(String specialId) {
        return videoInfoDao.list(
                "select sv.video from SpecialVideo sv where sv.special.id=? and sv.video.show=1 order by sv.orderby desc",
                new String[] { specialId });
    }
    @SuppressWarnings("unchecked")
    public List<SpecialAdmin> getSpecialAdmin(String key, String systemId, int detailSystem, int page) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
        List<SpecialAdmin> zhiBoClassList = new ArrayList<>();
    public void deleteSpecialVideo(String specialVideoId) {
        specialVideoDao.delete(new SpecialVideo(specialVideoId));
    }
        try {
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem ds where ds.system.id=" + systemId);
            String sql = "";
            if (detailSystem > 0)
                sql = "select sh.special from SuperSpecial sh where sh.special.name like ? and  sh.detailSystem.id="
                        + detailSystem + " order by  sh.special.orderby desc";
            else
                sql = "from Special zb where zb.name like ? and zb.system.id=" + systemId + " order by zb.orderby desc";
    public long getSpecialVideoListCount(String specialId) {
            List<Special> list = specialDao.list(sql, (page - 1) * Constant.pageCount, Constant.pageCount,
                    new Serializable[]{"%" + key + "%"});
            for (Special vb : list) {
                List<DetailSystem> detailSystemS = detailSystemDao
                        .list("select vb.detailSystem from SuperSpecial vb where vb.special.id=" + vb.getId());
        return videoInfoDao.getCount("select sv.video from SpecialVideo sv where sv.special.id=?",
                new String[] { specialId });
    }
                List<DetailSystemSelect> dssList = new ArrayList<>();
    public List<SpecialVideo> getSpecialVideoList(String specialId, String key) {
        return specialVideoDao.list("from SpecialVideo sv where sv.special.id=? and sv.video.name like ?",
                new String[] { specialId, "%" + key + "%" });
    }
    public List<SpecialVideo> getSpecialVideoList(String specialId,PageEntity pg, String key) {
        return specialVideoDao.list("from SpecialVideo sv where sv.special.id=? and sv.video.name like ?",((pg.getPageIndex()-1)*pg.getPageSize()),pg.getPageSize(),
                new String[] { specialId, "%" + key + "%" });
    }
                for (DetailSystem ds : detailSystemList) {
                    DetailSystemSelect dss = new DetailSystemSelect();
                    dss.setDetailSystem(ds);
                    dss.setSelected(false);
                    dssList.add(dss);
                }
    public long getSpecialVideoListCount(String specialId, String key) {
        return specialVideoDao.getCount(
                "select count(*)  from SpecialVideo sv where sv.special.id=? and sv.video.name like ?",
                new String[] { specialId, "%" + key + "%" });
    }
                for (DetailSystem ds : detailSystemS) {
                    for (DetailSystemSelect dss : dssList) {
                        if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                            dss.setSelected(true);
                            break;
                        }
                    }
                }
                SuperSpecial sz = new SuperSpecial();
                sz.setDetailSystem(null);
                sz.setSpecial(vb);
                zhiBoClassList.add(new SpecialAdmin(sz, dssList));
            }
    @SuppressWarnings("unchecked")
    public List<SpecialAdmin> getSpecialAdmin(String key, int detailSystem, int page) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
        List<SpecialAdmin> zhiBoClassList = new ArrayList<>();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return zhiBoClassList;
    }
        try {
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem");
            String sql = "";
            if (detailSystem > 0)
                sql = "select sh.special from SuperSpecial sh where sh.special.name like ? and  sh.detailSystem.id="
                        + detailSystem + " order by  sh.special.orderby desc";
            else
                sql = "from Special zb where zb.name like ? order by zb.orderby desc";
    public long getSpecialAdminCount(String key, String systemId, int detailSystem) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
            List<Special> list = specialDao.list(sql, (page - 1) * Constant.pageCount, Constant.pageCount,
                    new Serializable[] { "%" + key + "%" });
            for (Special vb : list) {
                List<DetailSystem> detailSystemS = detailSystemDao
                        .list("select vb.detailSystem from SuperSpecial vb where vb.special.id=" + vb.getId());
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_special zb left join wk_video_special c on c.id=zb.specialid where zb.detailsystemid="
                    + detailSystem + " and c.name like '%" + key + "%' group by zb.specialid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_super_special zb left join wk_video_special c on c.id=zb.specialid where c.system=" + systemId + " and c.name like '%"
                    + key + "%'  group by zb.specialid) s";
                List<DetailSystemSelect> dssList = new ArrayList<>();
        return specialVideoDao.getCountSQL(sql);
    }
                for (DetailSystem ds : detailSystemList) {
                    DetailSystemSelect dss = new DetailSystemSelect();
                    dss.setDetailSystem(ds);
                    dss.setSelected(false);
                    dssList.add(dss);
                }
    @SuppressWarnings("unchecked")
    public void deleteSpecialAdmin(final String classId, final String detailSystemId) {
        specialDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                for (DetailSystem ds : detailSystemS) {
                    for (DetailSystemSelect dss : dssList) {
                        if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                            dss.setSelected(true);
                            break;
                        }
                    }
                }
                SuperSpecial sz = new SuperSpecial();
                sz.setDetailSystem(null);
                sz.setSpecial(vb);
                zhiBoClassList.add(new SpecialAdmin(sz, dssList));
            }
                    List<SuperSpecial> list = session
                            .createQuery("from SuperSpecial vb where vb.special.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classId).setParameter(1, detailSystemId).list();
                    session.getTransaction().begin();
                    if (list != null && list.size() > 0) {
                        for (SuperSpecial vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return zhiBoClassList;
    }
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    public long getSpecialAdminCount(String key, int detailSystem) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
    }
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_special zb left join wk_video_special c on c.id=zb.specialid where zb.detailsystemid="
                    + detailSystem + " and c.name like '%" + key + "%' group by zb.specialid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_super_special zb left join wk_video_special c on c.id=zb.specialid where c.name like '%"
                    + key + "%'  group by zb.specialid) s";
    /**
     * 专题
     */
        return specialVideoDao.getCountSQL(sql);
    }
    public List<SuperSpecial> getSuperSpecialList(String detailSystem) {
        return superSpecialDao.list(
                "FROM SuperSpecial hs where hs.detailSystem.id=" + detailSystem + " order by hs.Special.orderby desc");
    }
    @SuppressWarnings("unchecked")
    public void deleteSpecialAdmin(final String classId, final String detailSystemId) {
        specialDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
    public void addSuperSpecial(SuperSpecial sv) {
        List<SuperSpecial> list = superSpecialDao.list("from SuperSpecial sv where sv.special.id="
                + sv.getSpecial().getId() + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superSpecialDao.create(sv);
    }
                    List<SuperSpecial> list = session
                            .createQuery("from SuperSpecial vb where vb.special.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classId).setParameter(1, detailSystemId).list();
                    session.getTransaction().begin();
                    if (list != null && list.size() > 0) {
                        for (SuperSpecial vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
    public void updateSuperSpecial(SuperSpecial hotSearch) {
        superSpecialDao.update(hotSearch);
    }
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    public void deleteSuperSpecial(SuperSpecial hotSearch) {
        superSpecialDao.delete(hotSearch);
    }
    }
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void updateSuperSpecialList(final String detailSystemId, final List<SuperSpecial> typeList) {
        specialDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperSpecial> list = session
                            .createQuery("from SuperSpecial sh where sh.detailSystem.id=" + detailSystemId).list();
                    session.getTransaction().begin();
                    for (SuperSpecial ad : list) {
                        session.delete(ad);
                    }
    /**
     * 专题
     */
                    for (SuperSpecial videoType : typeList) {
                        session.persist(videoType);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    public List<SuperSpecial> getSuperSpecialList(String detailSystem) {
        return superSpecialDao.list(
                "FROM SuperSpecial hs where hs.detailSystem.id=" + detailSystem + " order by hs.Special.orderby desc");
    }
    }
    public void addSuperSpecial(SuperSpecial sv) {
        List<SuperSpecial> list = superSpecialDao.list("from SuperSpecial sv where sv.special.id="
                + sv.getSpecial().getId() + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superSpecialDao.create(sv);
    }
    public void updateSuperSpecial(SuperSpecial hotSearch) {
        superSpecialDao.update(hotSearch);
    }
    public void deleteSuperSpecial(SuperSpecial hotSearch) {
        superSpecialDao.delete(hotSearch);
    }
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void updateSuperSpecialList(final String detailSystemId, final List<SuperSpecial> typeList) {
        specialDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperSpecial> list = session
                            .createQuery("from SuperSpecial sh where sh.detailSystem.id=" + detailSystemId).list();
                    session.getTransaction().begin();
                    for (SuperSpecial ad : list) {
                        session.delete(ad);
                    }
                    for (SuperSpecial videoType : typeList) {
                        session.persist(videoType);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    @Cacheable(value = "foundCache",key="'getSpecialOnMain'+'-'+#detailSystem")
    public List<Special> getSpecialOnMain(String detailSystem) {
        return specialDao.list("SELECT hs.special FROM SuperSpecial hs where hs.detailSystem.id=" + detailSystem
                + " and  hs.special.show=1 and  hs.special.showonmain=1 order by hs.special.orderby desc");
    }
    @Cacheable(value = "foundCache", key = "'getSpecialOnMain'+'-'+#detailSystem")
    public List<Special> getSpecialOnMain(String detailSystem) {
        return specialDao.list("SELECT hs.special FROM SuperSpecial hs where hs.detailSystem.id=" + detailSystem
                + " and  hs.special.show=1 and  hs.special.showonmain=1 order by hs.special.orderby desc");
    }
}
src/main/java/com/yeshi/buwan/service/imp/StarService.java
@@ -47,30 +47,6 @@
    @Resource
    private VideoResourceMapExtraInfoService videoResourceMapExtraInfoService;
    public SuperHotStarDao getSuperHotStarDao() {
        return superHotStarDao;
    }
    public void setSuperHotStarDao(SuperHotStarDao superHotStarDao) {
        this.superHotStarDao = superHotStarDao;
    }
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
    public HotStarDao getHotStarDao() {
        return hotStarDao;
    }
    public void setHotStarDao(HotStarDao hotStarDao) {
        this.hotStarDao = hotStarDao;
    }
    public StarService() {
    }
@@ -239,18 +215,18 @@
    }
    @SuppressWarnings("unchecked")
    public List<HotStarAdmin> getHotStarAdmin(String key, int detailSystem, int page) {
    public List<HotStarAdmin> getHotStarAdmin(String key, String systemId, int detailSystem, int page) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
        List<HotStarAdmin> zhiBoClassList = new ArrayList<>();
        try {
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem");
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem ds where ds.system.id=" + systemId);
            String sql = "";
            if (detailSystem > 0)
                sql = "select sh.hotStar from SuperHotStar sh where  sh.detailSystem.id=" + detailSystem
                        + " and sh.hotStar.name like ?  order by  sh.hotStar.orderby desc";
            else
                sql = "from HotStar zb where zb.name like ? order by zb.orderby desc";
                sql = "from HotStar zb where zb.name like ? and zb.system.id=" + systemId + " order by zb.orderby desc";
            List<HotStar> list = hotStarDao.list(sql, (page - 1) * Constant.pageCount, Constant.pageCount,
                    new Serializable[]{"%" + key + "%"});
@@ -287,7 +263,7 @@
        return zhiBoClassList;
    }
    public long getHotStarAdminCount(String key, int detailSystem) {
    public long getHotStarAdminCount(String key, String systemId, int detailSystem) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
        String sql = "";
@@ -296,7 +272,7 @@
                    + detailSystem + " and c.name like '%" + key + "%' group by zb.hotstarid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_hotstar zb left join wk_video_hotstar c on c.id=zb.id where c.name like '%"
                    + key + "%'  group by zb.id) s";
                    + key + "%' and zb.system=" + systemId + "  group by zb.id) s";
        return hotStarDao.getCountSQL(sql);
    }
src/main/java/com/yeshi/buwan/service/imp/SystemService.java
@@ -1,9 +1,11 @@
package com.yeshi.buwan.service.imp;
import java.util.List;
import javax.annotation.Resource;
import com.yeshi.buwan.dao.DetailSystemDao;
import com.yeshi.buwan.dao.SystemInfoDao;
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.domain.special.Special;
import com.yeshi.buwan.domain.special.SuperSpecial;
import com.yeshi.buwan.util.Constant;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Session;
@@ -11,32 +13,8 @@
import org.springframework.orm.hibernate4.HibernateCallback;
import org.springframework.stereotype.Service;
import com.yeshi.buwan.dao.DetailSystemDao;
import com.yeshi.buwan.dao.SystemInfoDao;
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.HomeAd;
import com.yeshi.buwan.domain.HomeType;
import com.yeshi.buwan.domain.HotSearch;
import com.yeshi.buwan.domain.HotStar;
import com.yeshi.buwan.domain.HotVideoType;
import com.yeshi.buwan.domain.ShareContent;
import com.yeshi.buwan.domain.SuperHomeAd;
import com.yeshi.buwan.domain.SuperHomeNotice;
import com.yeshi.buwan.domain.SuperHomeType;
import com.yeshi.buwan.domain.SuperHotSearch;
import com.yeshi.buwan.domain.SuperHotStar;
import com.yeshi.buwan.domain.SuperHotType;
import com.yeshi.buwan.domain.SuperRecommendAd;
import com.yeshi.buwan.domain.SuperUserBanner;
import com.yeshi.buwan.domain.SuperVideoType;
import com.yeshi.buwan.domain.SystemInfo;
import com.yeshi.buwan.domain.UserBanner;
import com.yeshi.buwan.domain.VideoBanQuan;
import com.yeshi.buwan.domain.VideoBanQuanVideo;
import com.yeshi.buwan.domain.VideoType;
import com.yeshi.buwan.domain.special.Special;
import com.yeshi.buwan.domain.special.SuperSpecial;
import com.yeshi.buwan.util.Constant;
import javax.annotation.Resource;
import java.util.List;
/**
 * 系统分类服务
@@ -58,61 +36,21 @@
    @Resource
    private SpecialService specialService;
    public ClassService getClassService() {
        return classService;
    }
    public void setClassService(ClassService classService) {
        this.classService = classService;
    }
    public StarService getStarService() {
        return starService;
    }
    public void setStarService(StarService starService) {
        this.starService = starService;
    }
    public SpecialService getSpecialService() {
        return specialService;
    }
    public void setSpecialService(SpecialService specialService) {
        this.specialService = specialService;
    }
    public SystemInfoDao getSystemInfoDao() {
        return systemInfoDao;
    }
    public void setSystemInfoDao(SystemInfoDao systemInfoDao) {
        this.systemInfoDao = systemInfoDao;
    }
    public DetailSystemDao getDetailSystemDao() {
        return detailSystemDao;
    }
    public void setDetailSystemDao(DetailSystemDao detailSystemDao) {
        this.detailSystemDao = detailSystemDao;
    }
    public List<DetailSystem> getDetailSystemList() {
        List<DetailSystem> list = detailSystemDao.list("from DetailSystem");
    public List<DetailSystem> getDetailSystemList(String systemId) {
        List<DetailSystem> list = detailSystemDao.list("from DetailSystem ds where ds.system.id=?", systemId);
        return list;
    }
    public List<DetailSystem> getDetailSystemList(String key, int pageIndex) {
    public List<DetailSystem> getDetailSystemList(String key, String systemId, int pageIndex) {
        List<DetailSystem> list = detailSystemDao.list(
                "from DetailSystem ds where ds.appName like ? order by ds.createtime desc",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount, new String[]{"%" + key + "%"});
                "from DetailSystem ds where ds.appName like ? and ds.system.id=? order by ds.createtime desc",
                (pageIndex - 1) * Constant.pageCount, Constant.pageCount, new String[]{"%" + key + "%", systemId});
        return list;
    }
    public long getDetailSystemListCount(String key) {
        return detailSystemDao.getCount("select count(*)  from DetailSystem d where d.appName like ?",
                new String[]{"%" + key + "%"});
    public long getDetailSystemListCount(String key, String systemId) {
        return detailSystemDao.getCount("select count(*)  from DetailSystem d where d.appName like ? and d.system.id=?",
                new String[]{"%" + key + "%", systemId});
    }
    @Cacheable(value = "homeCache", key = "'getDetailSystemByPackage'+'-'+#packageName")
src/main/java/com/yeshi/buwan/service/imp/UserBannerService.java
@@ -27,21 +27,6 @@
    @Resource
    private SuperUserBannerDao superUserBannerDao;
    public SuperUserBannerDao getSuperUserBannerDao() {
        return superUserBannerDao;
    }
    public void setSuperUserBannerDao(SuperUserBannerDao superUserBannerDao) {
        this.superUserBannerDao = superUserBannerDao;
    }
    public UserBannerDao getUserBannerDao() {
        return userBannerDao;
    }
    public void setUserBannerDao(UserBannerDao userBannerDao) {
        this.userBannerDao = userBannerDao;
    }
    public List<UserBanner> getUserBanner() {
        List<UserBanner> list = userBannerDao.list("from UserBanner");
src/main/java/com/yeshi/buwan/service/imp/UserService.java
@@ -1,10 +1,17 @@
package com.yeshi.buwan.service.imp;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import com.yeshi.buwan.dao.user.LoginUserExtraDao;
import com.yeshi.buwan.domain.user.LoginUserExtra;
import com.yeshi.buwan.dto.user.LoginInfoDto;
import com.yeshi.buwan.dto.user.QQUserInfo;
import com.yeshi.buwan.exception.user.LoginUserException;
import com.yeshi.buwan.exception.user.RegisterUserException;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.cache.annotation.Cacheable;
@@ -20,6 +27,7 @@
import com.yeshi.buwan.domain.UserInfo;
import com.yeshi.buwan.util.Constant;
import com.yeshi.buwan.util.StringUtil;
import org.yeshi.utils.entity.wx.WeiXinUser;
@Service
public class UserService {
@@ -34,13 +42,9 @@
    @Resource
    private LoginUserDao loginUserDao;
    public UserDao getUserDao() {
        return userDao;
    }
    @Resource
    private LoginUserExtraDao loginUserExtraDao;
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
    // 用户操作
    public List<UserInfo> getUserList(int system, int page) {
@@ -155,52 +159,219 @@
    /**
     * 登录
     *
     * @param openid
     * @param detailSystem
     * @param type 1-QQ 2-微信
     * @param portrait
     * @param name
     * @param ipInfo
     * @param dto
     * @return
     * @throws LoginUserException
     */
    @SuppressWarnings("unchecked")
    public LoginUser getLoginUser(final String openid, final String detailSystem, final int type, final String portrait,
                                  final String name, final String ipInfo) {
        return (LoginUser) userDao.excute(new HibernateCallback<LoginUser>() {
            public LoginUser doInHibernate(Session session) throws HibernateException {
                try {
                    List<LoginUser> list = session
                            .createQuery("from LoginUser lu where lu.openid=? and  lu.loginType=?")
                            .setParameter(0, openid).setParameter(1, type).list();
    public LoginUser login(LoginInfoDto dto) throws LoginUserException {
                    if (list != null && list.size() > 0)
                        return list.get(0);
                    else {
                        session.getTransaction().begin();
                        LoginUser lu = new LoginUser();
                        lu.setCreatetime(System.currentTimeMillis() + "");
                        lu.setDetailsystem(detailSystem);
                        lu.setLoginType(type);
                        lu.setName(name);
                        lu.setOpenid(openid);
                        lu.setPortrait(portrait);
                        lu.setIpinfo(ipInfo);
                        lu.setState(LoginUser.STATE_NORMAL);
                        session.save(lu);
                        session.flush();
                        session.getTransaction().commit();
                        return lu;
                    }
        LoginUser loginUser = null;
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
        LoginUserExtra loginUserExtra = null;
        switch (dto.getLoginType()) {
            case LoginUser.LOGIN_TYPE_EMAIL: {
                if (StringUtil.isNullOrEmpty(dto.getEmail()) || StringUtil.isNullOrEmpty(dto.getPwd())) {
                    throw new LoginUserException(LoginUserException.CODE_PARAMS_NOT_ENOUGH, "邮箱和密码不能为空");
                }
                return null;
            }
        });
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.email=? and lu.state=?", dto.getSystemId(), dto.getEmail(), LoginUser.STATE_NORMAL);
                if (userList == null || userList.size() == 0) {
                    throw new LoginUserException(LoginUserException.CODE_NO_USER, "用户不存在");
                }
                if (!dto.getPwd().equalsIgnoreCase(userList.get(0).getPwd())) {
                    throw new LoginUserException(LoginUserException.CODE_PWD_WRONG, "密码错误");
                }
                loginUser = userList.get(0);
                loginUserExtra = new LoginUserExtra(loginUser.getId());
                loginUserExtra.setEmail(dto.getEmail());
            }
            break;
            case LoginUser.LOGIN_TYPE_QQ: {
                if (dto.getQqUserInfo() == null || StringUtil.isNullOrEmpty(dto.getQqUserInfo().getOpenId())) {
                    throw new LoginUserException(LoginUserException.CODE_PARAMS_NOT_ENOUGH, "QQ授权信息为空");
                }
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.qqOpenId=? and lu.state=?", dto.getSystemId(), dto.getQqUserInfo().getOpenId(), LoginUser.STATE_NORMAL);
                if (userList == null || userList.size() == 0) {
                    throw new LoginUserException(LoginUserException.CODE_NO_USER, "用户不存在");
                }
                loginUser = userList.get(0);
                loginUserExtra = new LoginUserExtra(loginUser.getId());
                loginUserExtra.setQqPortrait(dto.getQqUserInfo().getPortrait());
                loginUserExtra.setQqOpenId(dto.getQqUserInfo().getOpenId());
                loginUserExtra.setQqNickName(dto.getQqUserInfo().getName());
            }
            break;
            case LoginUser.LOGIN_TYPE_WX: {
                if (dto.getWeiXinUser() == null || StringUtil.isNullOrEmpty(dto.getWeiXinUser().getOpenid())) {
                    throw new LoginUserException(LoginUserException.CODE_PARAMS_NOT_ENOUGH, "微信授权信息为空");
                }
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.wxOpenId=? and lu.state=?", dto.getSystemId(), dto.getWeiXinUser().getOpenid(), LoginUser.STATE_NORMAL);
                if (userList == null || userList.size() == 0) {
                    throw new LoginUserException(LoginUserException.CODE_NO_USER, "用户不存在");
                }
                loginUser = userList.get(0);
                //更新微信信息
                loginUser.setWxUnionId(dto.getWeiXinUser().getUnionid());
                loginUserExtra = new LoginUserExtra(loginUser.getId());
                loginUserExtra.setWxPortrait(dto.getWeiXinUser().getHeadimgurl());
                loginUserExtra.setWxOpenId(dto.getWeiXinUser().getOpenid());
                loginUserExtra.setWxNickName(dto.getWeiXinUser().getNickname());
                loginUserExtra.setWxSex(dto.getWeiXinUser().getSex());
                loginUserExtra.setWxUnionId(dto.getWeiXinUser().getUnionid());
            }
            break;
            case LoginUser.LOGIN_TYPE_PHONE: {
                if (StringUtil.isNullOrEmpty(dto.getPhone())) {
                    throw new LoginUserException(LoginUserException.CODE_PARAMS_NOT_ENOUGH, "手机号为空");
                }
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.phone=? and lu.state=?", dto.getSystemId(), dto.getPhone(), LoginUser.STATE_NORMAL);
                if (userList == null || userList.size() == 0) {
                    throw new LoginUserException(LoginUserException.CODE_NO_USER, "用户不存在");
                }
                loginUser = userList.get(0);
                loginUserExtra = new LoginUserExtra(loginUser.getId());
            }
            break;
        }
        if (loginUser != null) {
            loginUser.setLoginType(dto.getLoginType());
            loginUserDao.update(loginUser);
        }
        if (loginUserExtra != null) {
            loginUserExtraDao.updateSelective(loginUserExtra);
        }
        return loginUser;
    }
    /**
     * 注册
     *
     * @param dto
     */
    public void register(LoginInfoDto dto) throws RegisterUserException {
        LoginUser loginUser = null;
        LoginUserExtra loginUserExtra = null;
        switch (dto.getLoginType()) {
            case LoginUser.LOGIN_TYPE_EMAIL: {
                if (StringUtil.isNullOrEmpty(dto.getEmail()) || StringUtil.isNullOrEmpty(dto.getPwd())) {
                    throw new RegisterUserException(RegisterUserException.CODE_PARAMS_NOT_ENOUGH, "邮箱和密码不能为空");
                }
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.email=? and lu.state=?", dto.getSystemId(), dto.getEmail(), LoginUser.STATE_NORMAL);
                if (userList != null && userList.size() > 0) {
                    throw new RegisterUserException(RegisterUserException.CODE_USER_EXIST, "用户已存在");
                }
                loginUser = new LoginUser();
                loginUser.setLoginType(LoginUser.LOGIN_TYPE_EMAIL);
                loginUser.setEmail(dto.getEmail());
                loginUser.setPwd(dto.getPwd());
                loginUser.setName(dto.getNickName());
                loginUser.setState(LoginUser.STATE_NORMAL);
                loginUser.setSystemId(dto.getSystemId());
                loginUserExtra = new LoginUserExtra();
                loginUserExtra.setEmail(dto.getEmail());
            }
            break;
            case LoginUser.LOGIN_TYPE_QQ: {
                if (dto.getQqUserInfo() == null || StringUtil.isNullOrEmpty(dto.getQqUserInfo().getOpenId())) {
                    throw new RegisterUserException(RegisterUserException.CODE_PARAMS_NOT_ENOUGH, "QQ授权信息为空");
                }
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.qqOpenId=? and lu.state=?", dto.getSystemId(), dto.getQqUserInfo().getOpenId(), LoginUser.STATE_NORMAL);
                if (userList != null && userList.size() > 0) {
                    throw new RegisterUserException(RegisterUserException.CODE_USER_EXIST, "用户已存在");
                }
                loginUser = new LoginUser();
                loginUser.setLoginType(LoginUser.LOGIN_TYPE_QQ);
                loginUser.setQqOpenId(dto.getQqUserInfo().getOpenId());
                loginUser.setName(dto.getQqUserInfo().getName());
                loginUserExtra = new LoginUserExtra();
                loginUserExtra.setQqPortrait(dto.getQqUserInfo().getPortrait());
                loginUserExtra.setQqOpenId(dto.getQqUserInfo().getOpenId());
                loginUserExtra.setQqNickName(dto.getQqUserInfo().getName());
            }
            break;
            case LoginUser.LOGIN_TYPE_WX: {
                if (dto.getWeiXinUser() == null || StringUtil.isNullOrEmpty(dto.getWeiXinUser().getOpenid())) {
                    throw new RegisterUserException(RegisterUserException.CODE_PARAMS_NOT_ENOUGH, "微信授权信息为空");
                }
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.wxOpenId=? and lu.state=?", dto.getSystemId(), dto.getWeiXinUser().getOpenid(), LoginUser.STATE_NORMAL);
                if (userList != null && userList.size() > 0) {
                    throw new RegisterUserException(RegisterUserException.CODE_USER_EXIST, "用户已存在");
                }
                loginUser = new LoginUser();
                loginUser.setLoginType(LoginUser.LOGIN_TYPE_WX);
                loginUser.setWxUnionId(dto.getWeiXinUser().getUnionid());
                loginUser.setName(dto.getWeiXinUser().getNickname());
                loginUser.setWxOpenId(dto.getWeiXinUser().getOpenid());
                loginUserExtra = new LoginUserExtra();
                loginUserExtra.setWxPortrait(dto.getWeiXinUser().getHeadimgurl());
                loginUserExtra.setWxOpenId(dto.getWeiXinUser().getOpenid());
                loginUserExtra.setWxNickName(dto.getWeiXinUser().getNickname());
                loginUserExtra.setWxSex(dto.getWeiXinUser().getSex());
                loginUserExtra.setWxUnionId(dto.getWeiXinUser().getUnionid());
            }
            break;
            case LoginUser.LOGIN_TYPE_PHONE: {
                if (StringUtil.isNullOrEmpty(dto.getPhone())) {
                    throw new RegisterUserException(RegisterUserException.CODE_PARAMS_NOT_ENOUGH, "手机号为空");
                }
                List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.phone=? and lu.state=?", dto.getSystemId(), dto.getPhone(), LoginUser.STATE_NORMAL);
                if (userList != null && userList.size() > 0) {
                    throw new RegisterUserException(RegisterUserException.CODE_USER_EXIST, "用户已存在");
                }
                loginUser = new LoginUser();
                loginUser.setLoginType(LoginUser.LOGIN_TYPE_PHONE);
                loginUser.setName(null);
                loginUser.setPhone(dto.getPhone());
                loginUserExtra = new LoginUserExtra();
            }
            break;
        }
        if (loginUser == null) {
            throw new RegisterUserException(RegisterUserException.CODE_PARAMS_NOT_ENOUGH, "注册类型出错");
        }
        loginUser.setIpinfo(dto.getIpInfo());
        loginUser.setState(LoginUser.STATE_NORMAL);
        loginUser.setSystemId(dto.getSystemId());
        loginUser.setCreatetime(System.currentTimeMillis() + "");
        Serializable uid = loginUserDao.save(loginUser);
        loginUser.setId(uid + "");
        if (StringUtil.isNullOrEmpty(loginUser.getName())) {
            //设置默认用户昵称
            String nickName = "无名氏";
            LoginUser update = new LoginUser();
            update.setId(uid + "");
            update.setName(nickName);
            loginUserDao.updateSelective(update);
        }
        loginUserExtra.setId(loginUser.getId());
        loginUserExtra.setCreateTime(new Date());
        loginUserExtraDao.save(loginUserExtra);
    }
    public LoginUser getLoginUser(String id) {
src/main/java/com/yeshi/buwan/service/imp/VideoService.java
@@ -31,37 +31,10 @@
    private VideoResourceDao videoResourceDao;
    @Resource
    private ResourceVideoDao resourceVideoDao;
    @Resource
    private ClassService classServcie;
    @Resource
    private CategoryVideoDao categoryVideoDao;
    public CategoryVideoDao getCategoryVideoDao() {
        return categoryVideoDao;
    }
    public void setCategoryVideoDao(CategoryVideoDao categoryVideoDao) {
        this.categoryVideoDao = categoryVideoDao;
    }
    public ClassService getClassServcie() {
        return classServcie;
    }
    public void setClassServcie(ClassService classServcie) {
        this.classServcie = classServcie;
    }
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
    public VideoService() {
src/main/java/com/yeshi/buwan/service/imp/WeiXinService.java
@@ -32,37 +32,6 @@
    @Resource
    private ImageInfoDao imageInfoDao;
    public ImageInfoDao getImageInfoDao() {
        return imageInfoDao;
    }
    public void setImageInfoDao(ImageInfoDao imageInfoDao) {
        this.imageInfoDao = imageInfoDao;
    }
    public ImageService getImageService() {
        return imageService;
    }
    public void setImageService(ImageService imageService) {
        this.imageService = imageService;
    }
    public WeiXinImageDao getWeiXinImageDao() {
        return weiXinImageDao;
    }
    public void setWeiXinImageDao(WeiXinImageDao weiXinImageDao) {
        this.weiXinImageDao = weiXinImageDao;
    }
    public WeiXinInfoDao getWeiXinInfoDao() {
        return weiXinInfoDao;
    }
    public void setWeiXinInfoDao(WeiXinInfoDao weiXinInfoDao) {
        this.weiXinInfoDao = weiXinInfoDao;
    }
    public void addWeiXinImage(WeiXinInfo info, String lastPic) {
        if (info.getType().equalsIgnoreCase("1")) {// 个人号
@@ -191,15 +160,9 @@
    }
    ConfigService configService;
    public ConfigService getConfigService() {
        return configService;
    }
    public void setConfigService(ConfigService configService) {
        this.configService = configService;
    }
    @Resource
    private ConfigService configService;
    private WeiXinInfo getWeiXin(List<WeiXinInfo> list) {
        OtherService service = new OtherService();
src/main/java/com/yeshi/buwan/service/imp/juhe/IqiyiService.java
@@ -53,37 +53,6 @@
    @Resource
    private ResourceVideoDao resourceVideoDao;
    public PushService getPushService() {
        return pushService;
    }
    public void setPushService(PushService pushService) {
        this.pushService = pushService;
    }
    public StatisticsService getStatisticsService() {
        return statisticsService;
    }
    public void setStatisticsService(StatisticsService statisticsService) {
        this.statisticsService = statisticsService;
    }
    public VideoIqiyiDao getVideoIqiyiDao() {
        return videoIqiyiDao;
    }
    public void setVideoIqiyiDao(VideoIqiyiDao videoIqiyiDao) {
        this.videoIqiyiDao = videoIqiyiDao;
    }
    public IqiyiVideoInfoDao getIqiyiVideoInfoDao() {
        return iqiyiVideoInfoDao;
    }
    public void setIqiyiVideoInfoDao(IqiyiVideoInfoDao iqiyiVideoInfoDao) {
        this.iqiyiVideoInfoDao = iqiyiVideoInfoDao;
    }
    static {
        // PropertyConfigurator.configure(".\\src\\log4j.properties");
src/main/java/com/yeshi/buwan/service/imp/juhe/SoHuService.java
@@ -44,38 +44,6 @@
    @Resource
    private CategoryVideoDao categoryVideoDao;
    public PushService getPushService() {
        return pushService;
    }
    public void setPushService(PushService pushService) {
        this.pushService = pushService;
    }
    public StatisticsService getStatisticsService() {
        return statisticsService;
    }
    public void setStatisticsService(StatisticsService statisticsService) {
        this.statisticsService = statisticsService;
    }
    public SoHuVideoDao getSoHuVideoDao() {
        return soHuVideoDao;
    }
    public void setSoHuVideoDao(SoHuVideoDao soHuVideoDao) {
        this.soHuVideoDao = soHuVideoDao;
    }
    public SoHuAlbumDao getSoHuAlbumDao() {
        return soHuAlbumDao;
    }
    public void setSoHuAlbumDao(SoHuAlbumDao soHuAlbumDao) {
        this.soHuAlbumDao = soHuAlbumDao;
    }
    @SuppressWarnings("unchecked")
    public String addAlbum(final SoHuAlbum album) {
        // 对VideoList去重
src/main/java/com/yeshi/buwan/service/imp/news/NewsService.java
@@ -1,17 +1,7 @@
package com.yeshi.buwan.service.imp.news;
import java.io.Serializable;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.buwan.dao.news.FoundNewsDao;
import com.yeshi.buwan.dao.news.NewsDao;
import com.yeshi.buwan.dao.news.NewsImageDao;
import com.yeshi.buwan.dao.news.NewsTypeContentDao;
import com.yeshi.buwan.dao.news.NewsTypeDao;
import com.yeshi.buwan.dao.news.SuperFoundNewsDao;
import com.yeshi.buwan.domain.news.FoundNews;
@@ -19,6 +9,12 @@
import com.yeshi.buwan.domain.news.NewsType;
import com.yeshi.buwan.domain.news.SuperFoundNews;
import com.yeshi.buwan.util.Constant;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
@Service
public class NewsService {
@@ -27,53 +23,10 @@
    @Resource
    private NewsTypeDao newsTypeDao;
    @Resource
    private NewsImageDao newsImageDao;
    @Resource
    private NewsTypeContentDao newsTypeContentDao;
    @Resource
    private FoundNewsDao foundNewsDao;
    @Resource
    private SuperFoundNewsDao superFoundNewsDao;
    public FoundNewsDao getFoundNewsDao() {
        return foundNewsDao;
    }
    public void setFoundNewsDao(FoundNewsDao foundNewsDao) {
        this.foundNewsDao = foundNewsDao;
    }
    public NewsDao getNewsDao() {
        return newsDao;
    }
    public void setNewsDao(NewsDao newsDao) {
        this.newsDao = newsDao;
    }
    public NewsTypeDao getNewsTypeDao() {
        return newsTypeDao;
    }
    public void setNewsTypeDao(NewsTypeDao newsTypeDao) {
        this.newsTypeDao = newsTypeDao;
    }
    public NewsImageDao getNewsImageDao() {
        return newsImageDao;
    }
    public void setNewsImageDao(NewsImageDao newsImageDao) {
        this.newsImageDao = newsImageDao;
    }
    public NewsTypeContentDao getNewsTypeContentDao() {
        return newsTypeContentDao;
    }
    public void setNewsTypeContentDao(NewsTypeContentDao newsTypeContentDao) {
        this.newsTypeContentDao = newsTypeContentDao;
    }
    // 获取发现页面的图文数据
    @Cacheable(value = "foundCache",key="'getNewsOnMain'+'-'+#detailSystemId")
src/main/java/com/yeshi/buwan/service/imp/news/SouGouService.java
@@ -26,13 +26,6 @@
    @Resource
    private NewsService newsService;
    public NewsDao getNewsDao() {
        return newsDao;
    }
    public void setNewsDao(NewsDao newsDao) {
        this.newsDao = newsDao;
    }
    @SuppressWarnings("unchecked")
    public String addWeiXinArticle(final News wx, final List<NewsImage> imgList) {
src/main/java/com/yeshi/buwan/service/imp/push/PushService.java
@@ -22,13 +22,6 @@
    @Resource
    private CommentService commentService;
    public VideoPushHistoryDao getVideoPushHistoryDao() {
        return videoPushHistoryDao;
    }
    public void setVideoPushHistoryDao(VideoPushHistoryDao videoPushHistoryDao) {
        this.videoPushHistoryDao = videoPushHistoryDao;
    }
    public void addVideoPushHistory(VideoPushHistory vh) {
        videoPushHistoryDao.create(vh);
src/main/java/com/yeshi/buwan/service/imp/recommend/CategoryRecommendVideoService.java
@@ -28,237 +28,231 @@
@Service
public class CategoryRecommendVideoService {
    @Resource
    private CategoryRecommendVideoDao categoryRecommendVideoDao;
    @Resource
    private SuperCategoryRecommendVideoDao superCategoryRecommendVideoDao;
    @Resource
    private CategoryRecommendCacheVideoNumberDao categoryRecommendCacheVideoNumberDao;
    @Resource
    private CategoryRecommendVideoDao categoryRecommendVideoDao;
    @Resource
    private SuperCategoryRecommendVideoDao superCategoryRecommendVideoDao;
    @Resource
    private CategoryRecommendCacheVideoNumberDao categoryRecommendCacheVideoNumberDao;
    // 获取大区推荐的Banner
    @Cacheable(value = "classCache",key="'getCategoryRecommendVideoBannerList'+'-'+#detailSystemId+'-'+#videoTypeId")
    public List<CategoryRecommendVideo> getCategoryRecommendVideoBannerList(String detailSystemId, long videoTypeId) {
        return categoryRecommendVideoDao.list(
                "select sc.categoryRecommendVideo from SuperCategoryRecommendVideo sc where  sc.categoryRecommendVideo is not null and sc.categoryRecommendVideo.videoInfo is not null and sc.detailSystem.id=? and sc.categoryRecommendVideo.videoType.id=?  order by sc.categoryRecommendVideo.orderby desc",
                new Serializable[] { detailSystemId, videoTypeId });
    }
    // 获取大区推荐的Banner
    @Cacheable(value = "classCache", key = "'getCategoryRecommendVideoBannerList'+'-'+#detailSystemId+'-'+#videoTypeId")
    public List<CategoryRecommendVideo> getCategoryRecommendVideoBannerList(String detailSystemId, long videoTypeId) {
        return categoryRecommendVideoDao.list(
                "select sc.categoryRecommendVideo from SuperCategoryRecommendVideo sc where  sc.categoryRecommendVideo is not null and sc.categoryRecommendVideo.videoInfo is not null and sc.detailSystem.id=? and sc.categoryRecommendVideo.videoType.id=?  order by sc.categoryRecommendVideo.orderby desc",
                new Serializable[]{detailSystemId, videoTypeId});
    }
    public void addSuperCategoryRecommendVideoBanner(SuperCategoryRecommendVideo sc) {
    public void addSuperCategoryRecommendVideoBanner(SuperCategoryRecommendVideo sc) {
        superCategoryRecommendVideoDao.create(sc);
        superCategoryRecommendVideoDao.create(sc);
    }
    }
    public void deleteSuperCategoryRecommendVideo(String id) {
    public void deleteSuperCategoryRecommendVideo(String id) {
        superCategoryRecommendVideoDao.delete(new SuperCategoryRecommendVideo(id));
        superCategoryRecommendVideoDao.delete(new SuperCategoryRecommendVideo(id));
    }
    }
    public void addCategoryRecommendVideo(CategoryRecommendVideo crv) {
        categoryRecommendVideoDao.create(crv);
    }
    public void addCategoryRecommendVideo(CategoryRecommendVideo crv) {
        categoryRecommendVideoDao.create(crv);
    }
    public CategoryRecommendVideo getCategoryRecommendVideoById(String id) {
        return categoryRecommendVideoDao.find(CategoryRecommendVideo.class, id);
    }
    public CategoryRecommendVideo getCategoryRecommendVideoById(String id) {
        return categoryRecommendVideoDao.find(CategoryRecommendVideo.class, id);
    }
    public void updateCategoryRecommendVideo(CategoryRecommendVideo crv) {
        categoryRecommendVideoDao.update(crv);
    }
    public void updateCategoryRecommendVideo(CategoryRecommendVideo crv) {
        categoryRecommendVideoDao.update(crv);
    }
    @SuppressWarnings("rawtypes")
    public void deleteCategoryRecommendVideo(final CategoryRecommendVideo crv) {
        categoryRecommendVideoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    session.createQuery("delete from SuperCategoryRecommendVideo s where s.categoryRecommendVideo.id=?")
                            .setParameter(0, crv.getId()).executeUpdate();
                    session.delete(crv);
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    @SuppressWarnings("rawtypes")
    public void deleteCategoryRecommendVideo(final CategoryRecommendVideo crv) {
        categoryRecommendVideoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    session.createQuery("delete from SuperCategoryRecommendVideo s where s.categoryRecommendVideo.id=?")
                            .setParameter(0, crv.getId()).executeUpdate();
                    session.delete(crv);
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    }
    }
    // 分区榜首数量
    @Cacheable(value = "classCache",key="'getRankVideoNumber'+'-'+#videotype")
    public int getRankVideoNumber(int videotype) {
        List<CategoryRecommendCacheVideoNumber> list = categoryRecommendCacheVideoNumberDao
                .list("from CategoryRecommendCacheVideoNumber cr where  cr.videoType.id=" + videotype);
        if (list != null && list.size() > 0)
            return list.get(0).getNumber();
        else
            return 32;
    }
    // 分区榜首数量
    @Cacheable(value = "classCache", key = "'getRankVideoNumber'+'-'+#videotype")
    public int getRankVideoNumber(int videotype) {
        List<CategoryRecommendCacheVideoNumber> list = categoryRecommendCacheVideoNumberDao
                .list("from CategoryRecommendCacheVideoNumber cr where  cr.videoType.id=" + videotype);
        if (list != null && list.size() > 0)
            return list.get(0).getNumber();
        else
            return 32;
    }
    // 后台操作
    @SuppressWarnings({ "unchecked" })
    public List<CategoryRecommendVideoAdmin> getCategoryRecommendVideoAdmin(final String key, final int videoTypeId,
            final int detailSystem, final int page) {
        return (List<CategoryRecommendVideoAdmin>) categoryRecommendVideoDao
                .excute(new HibernateCallback<List<CategoryRecommendVideoAdmin>>() {
                    public List<CategoryRecommendVideoAdmin> doInHibernate(Session session) throws HibernateException {
                        List<CategoryRecommendVideoAdmin> zhiBoClassList = new ArrayList<>();
                        try {
                            List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list();
                            String sql = "";
                            if (detailSystem > 0)
                                // on sh.categoryRecommendVideo.videoInfo= vi.id
                                sql = "select sh.categoryRecommendVideo from SuperCategoryRecommendVideo sh  where sh.categoryRecommendVideo.videoType.id="
                                        + videoTypeId + " and  sh.detailSystem.id=" + detailSystem + " and sh.categoryRecommendVideo.videoInfo.name like '%"+key+"%'"
                                        + " order by  sh.categoryRecommendVideo.createtime desc";
                            else
    // 后台操作
    @SuppressWarnings({"unchecked"})
    public List<CategoryRecommendVideoAdmin> getCategoryRecommendVideoAdmin(final String key, final int videoTypeId, final String systemId,
                                                                            final int detailSystem, final int page) {
        return (List<CategoryRecommendVideoAdmin>) categoryRecommendVideoDao
                .excute(new HibernateCallback<List<CategoryRecommendVideoAdmin>>() {
                    public List<CategoryRecommendVideoAdmin> doInHibernate(Session session) throws HibernateException {
                        List<CategoryRecommendVideoAdmin> zhiBoClassList = new ArrayList<>();
                        try {
                            List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem ds where ds.system.id=" + systemId).list();
                            String sql = "";
                            if (detailSystem > 0)
                                // on sh.categoryRecommendVideo.videoInfo= vi.id
                                sql = "select sh.categoryRecommendVideo from SuperCategoryRecommendVideo sh  where sh.categoryRecommendVideo.videoType.id="
                                        + videoTypeId + " and  sh.detailSystem.id=" + detailSystem + " and sh.categoryRecommendVideo.videoInfo.name like '%" + key + "%'"
                                        + " order by  sh.categoryRecommendVideo.createtime desc";
                            else
//                                sql = "from CategoryRecommendVideo zb where zb.videoType.id=" + videoTypeId + " and sh.categoryRecommendVideo.videoInfo.name like '%"+key+"%'"
//                                        + " order by zb.createtime desc";
                                sql = "from CategoryRecommendVideo zb   where zb.videoType.id=" + videoTypeId + " and zb.videoInfo.name like '%"+key+"%'"
                                        + " order by zb.createtime desc";
                                sql = "from CategoryRecommendVideo zb   where zb.videoType.id=" + videoTypeId + " and zb.system.id=" + systemId + " and zb.videoInfo.name like '%" + key + "%'"
                                        + " order by zb.createtime desc";
                            List<CategoryRecommendVideo> list = session.createQuery(sql)
                                    .setFirstResult((page - 1) * Constant.pageCount).setMaxResults(Constant.pageCount)
                                    .list();
                            for (CategoryRecommendVideo vb : list) {
                                List<DetailSystem> detailSystemS = session
                                        .createQuery(
                                                "select vb.detailSystem from SuperCategoryRecommendVideo vb where vb.categoryRecommendVideo.id=?")
                                        .setParameter(0, vb.getId()).list();
                            List<CategoryRecommendVideo> list = session.createQuery(sql)
                                    .setFirstResult((page - 1) * Constant.pageCount).setMaxResults(Constant.pageCount)
                                    .list();
                            for (CategoryRecommendVideo vb : list) {
                                List<DetailSystem> detailSystemS = session
                                        .createQuery(
                                                "select vb.detailSystem from SuperCategoryRecommendVideo vb where vb.categoryRecommendVideo.id=?")
                                        .setParameter(0, vb.getId()).list();
                                List<DetailSystemSelect> dssList = new ArrayList<>();
                                List<DetailSystemSelect> dssList = new ArrayList<>();
                                for (DetailSystem ds : detailSystemList) {
                                    DetailSystemSelect dss = new DetailSystemSelect();
                                    dss.setDetailSystem(ds);
                                    dss.setSelected(false);
                                    dssList.add(dss);
                                }
                                for (DetailSystem ds : detailSystemList) {
                                    DetailSystemSelect dss = new DetailSystemSelect();
                                    dss.setDetailSystem(ds);
                                    dss.setSelected(false);
                                    dssList.add(dss);
                                }
                                // 设置已经存在的
                                for (DetailSystem ds : detailSystemS) {
                                    for (DetailSystemSelect dss : dssList) {
                                        if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                                            dss.setSelected(true);
                                            break;
                                        }
                                    }
                                }
                                SuperCategoryRecommendVideo sz = new SuperCategoryRecommendVideo();
                                sz.setDetailSystem(null);
                                sz.setCategoryRecommendVideo(vb);
                                zhiBoClassList.add(new CategoryRecommendVideoAdmin(sz, dssList));
                            }
                                // 设置已经存在的
                                for (DetailSystem ds : detailSystemS) {
                                    for (DetailSystemSelect dss : dssList) {
                                        if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                                            dss.setSelected(true);
                                            break;
                                        }
                                    }
                                }
                                SuperCategoryRecommendVideo sz = new SuperCategoryRecommendVideo();
                                sz.setDetailSystem(null);
                                sz.setCategoryRecommendVideo(vb);
                                zhiBoClassList.add(new CategoryRecommendVideoAdmin(sz, dssList));
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        return zhiBoClassList;
                    }
                });
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        return zhiBoClassList;
                    }
                });
    }
    }
    public long getCategoryRecommendVideoAdminCount(String key, int videoTypeId, int detailSystem) {
        String sql = "";
        //sql = "select count(*) from  (select count(*) from wk_video_super_recommend_category_video zb left join wk_recommend_category_video c on c.id=zb.rcvid where c.videotypeid="
        //+ videoTypeId + " and zb.detailsystemid=" + detailSystem + " group by zb.rcvid) s";
        if (detailSystem > 0)
//            sql = "select count(*) from  (select count(*) from wk_video_super_recommend_category_video zb left join wk_recommend_category_video c on c.id=zb.rcvid left join wk_video_video vi on vi.id=c.videoid  where c.videotypeid="
//                    + videoTypeId + " and zb.detailsystemid=" + detailSystem + "  and vi.name like '%"+key+"%' group by zb.rcvid) s";
            sql = "select count(*) from  (select count(*) from wk_video_super_recommend_category_video zb left join wk_recommend_category_video c on c.id=zb.rcvid where c.videotypeid="
            + videoTypeId + " and zb.detailsystemid=" + detailSystem + " group by zb.rcvid) s";
            else
//            sql = "select count(*) from wk_video_super_recommend_category_video zb left join wk_recommend_category_video c on c.id=zb.rcvid left join wk_video_video vi on vi.id=c.videoid where c.videotypeid="
//                    + videoTypeId + " and vi.name like '%"+key+"%'";
            sql = "select count(*) from  (select count(*) from wk_video_super_recommend_category_video zb left join wk_recommend_category_video c on c.id=zb.rcvid where c.videotypeid="
            + videoTypeId + "  group by zb.rcvid) s";
        return categoryRecommendVideoDao.getCountSQL(sql);
    }
    public long getCategoryRecommendVideoAdminCount(String key, int videoTypeId,String systemId, int detailSystem) {
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_recommend_category_video zb left join wk_recommend_category_video c on c.id=zb.rcvid where c.videotypeid="
                    + videoTypeId + " and zb.detailsystemid=" + detailSystem + " group by zb.rcvid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_super_recommend_category_video zb left join wk_recommend_category_video c on c.id=zb.rcvid where c.videotypeid="
                    + videoTypeId + " and c.system="+systemId+" group by zb.rcvid) s";
    @SuppressWarnings("unchecked")
    public void deleteCategoryRecommendVideoAdmin(final String crvid, final String detailSystemId) {
        categoryRecommendVideoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
        return categoryRecommendVideoDao.getCountSQL(sql);
    }
                    List<SuperCategoryRecommendVideo> list = session
                            .createQuery(
                                    "from SuperCategoryRecommendVideo vb where vb.categoryRecommendVideo.id=? and vb.detailSystem.id=?")
                            .setParameter(0, crvid).setParameter(1, detailSystemId).list();
                    session.getTransaction().begin();
                    if (list != null && list.size() > 0) {
                        for (SuperCategoryRecommendVideo vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
    @SuppressWarnings("unchecked")
    public void deleteCategoryRecommendVideoAdmin(final String crvid, final String detailSystemId) {
        categoryRecommendVideoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
                    List<SuperCategoryRecommendVideo> list = session
                            .createQuery(
                                    "from SuperCategoryRecommendVideo vb where vb.categoryRecommendVideo.id=? and vb.detailSystem.id=?")
                            .setParameter(0, crvid).setParameter(1, detailSystemId).list();
                    session.getTransaction().begin();
                    if (list != null && list.size() > 0) {
                        for (SuperCategoryRecommendVideo vb : list)
                            session.delete(vb);
                    }
                    session.flush();
                    session.getTransaction().commit();
    }
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    public List<CategoryRecommendVideo> getSuperCategoryRecommendVideoList(String detailSystemId) {
        return categoryRecommendVideoDao
                .list("select sh.categoryRecommendVideo from SuperCategoryRecommendVideo sh where sh.detailSystem.id="
                        + detailSystemId);
    }
    }
    // 更新广告列表
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void updateSuperCategoryRecommendVideoList(final String detailSystemId,
            final List<CategoryRecommendVideo> adList) {
        categoryRecommendVideoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperCategoryRecommendVideo> list = session
                            .createQuery(
                                    "from SuperCategoryRecommendVideo sh where sh.detailSystem.id=" + detailSystemId)
                            .list();
                    session.getTransaction().begin();
                    for (SuperCategoryRecommendVideo ad : list) {
                        session.delete(ad);
                    }
    public List<CategoryRecommendVideo> getSuperCategoryRecommendVideoList(String detailSystemId) {
        return categoryRecommendVideoDao
                .list("select sh.categoryRecommendVideo from SuperCategoryRecommendVideo sh where sh.detailSystem.id="
                        + detailSystemId);
    }
                    for (CategoryRecommendVideo categoryRecommendVideo : adList) {
                        SuperCategoryRecommendVideo shd = new SuperCategoryRecommendVideo();
                        shd.setDetailSystem(new DetailSystem(detailSystemId));
                        shd.setCategoryRecommendVideo(categoryRecommendVideo);
                        session.persist(shd);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    // 更新广告列表
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void updateSuperCategoryRecommendVideoList(final String detailSystemId,
                                                      final List<CategoryRecommendVideo> adList) {
        categoryRecommendVideoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperCategoryRecommendVideo> list = session
                            .createQuery(
                                    "from SuperCategoryRecommendVideo sh where sh.detailSystem.id=" + detailSystemId)
                            .list();
                    session.getTransaction().begin();
                    for (SuperCategoryRecommendVideo ad : list) {
                        session.delete(ad);
                    }
    }
                    for (CategoryRecommendVideo categoryRecommendVideo : adList) {
                        SuperCategoryRecommendVideo shd = new SuperCategoryRecommendVideo();
                        shd.setDetailSystem(new DetailSystem(detailSystemId));
                        shd.setCategoryRecommendVideo(categoryRecommendVideo);
                        session.persist(shd);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
    public void addSuperCategoryRecommendVideo(SuperCategoryRecommendVideo sv) {
        List<SuperCategoryRecommendVideo> list = superCategoryRecommendVideoDao
                .list("from SuperCategoryRecommendVideo sv where sv.categoryRecommendVideo.id="
                        + sv.getCategoryRecommendVideo().getId() + " and sv.detailSystem.id="
                        + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superCategoryRecommendVideoDao.create(sv);
    }
    }
    public void addSuperCategoryRecommendVideo(SuperCategoryRecommendVideo sv) {
        List<SuperCategoryRecommendVideo> list = superCategoryRecommendVideoDao
                .list("from SuperCategoryRecommendVideo sv where sv.categoryRecommendVideo.id="
                        + sv.getCategoryRecommendVideo().getId() + " and sv.detailSystem.id="
                        + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superCategoryRecommendVideoDao.create(sv);
    }
}
src/main/java/com/yeshi/buwan/service/inter/LoginUserService.java
@@ -2,7 +2,7 @@
import com.yeshi.buwan.domain.user.LoginUser;
import com.yeshi.buwan.domain.user.LoginUserExtra;
import com.yeshi.buwan.exception.LoginUserException;
import com.yeshi.buwan.exception.user.LoginUserException;
import com.yeshi.buwan.exception.PPTVException;
import org.yeshi.utils.entity.wx.WeiXinUser;
src/main/java/com/yeshi/buwan/service/manager/SolrAlbumDataManager.java
@@ -12,15 +12,13 @@
import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.factory.SolrVideoFactory;
import net.sf.ehcache.search.expression.BaseCriteria;
import org.apache.solr.client.solrj.response.UpdateResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Sort;
import org.springframework.data.solr.core.SolrTemplate;
import org.springframework.data.solr.core.query.Criteria;
import org.springframework.data.solr.core.query.Query;
import org.springframework.data.solr.core.query.SimpleQuery;
import org.springframework.data.solr.core.query.SolrDataQuery;
import org.springframework.data.solr.core.query.*;
import org.springframework.data.solr.core.query.result.ScoredPage;
import org.springframework.stereotype.Component;
@@ -100,18 +98,36 @@
    }
    public SolrResultDTO find(SolrVideoSearchFilter filter, int page, int pageSize) {
        if (filter.getKey() == null) {
            filter.setKey("");
        }
        logger.info(filter.getKey() + "#" + page);
        Query query = new SimpleQuery("name:\"" + filter.getKey() + "\"");
        Query query = null;
        if (!StringUtil.isNullOrEmpty(filter.getKey())) {
            //solr精准检索需要带引号
            query = new SimpleQuery("name:\"" + filter.getKey() + "\"");
        } else {
            query = new SimpleQuery();
        }
        Criteria criteria = new Criteria("contenttype").is(filter.getContentType());
        if (filter.getVideoType() != null) {
            criteria = criteria.and("root_video_type").is(filter.getVideoType());
        }
        if (filter.getActor() != null) {
            criteria = criteria.and("mainactor").expression("\""+filter.getActor()+"\"");
        }
        if (filter.getDirector() != null) {
            criteria = criteria.and("director").expression("\""+filter.getDirector()+"\"");
        }
        if (filter.getResourceIds() != null && filter.getResourceIds().length > 0) {
            criteria = criteria.and("resourceIds").contains(filter.getResourceIds());
        }
        /** 添加条件 */
        if (criteria != null)
            query.addCriteria(criteria);
src/main/java/com/yeshi/buwan/sohu/SoHuUtil.java
@@ -49,21 +49,6 @@
    @Resource
    private VideoResourceDao videoResourceDao;
    public SoHuVideoDao getSoHuVideoDao() {
        return soHuVideoDao;
    }
    public void setSoHuVideoDao(SoHuVideoDao soHuVideoDao) {
        this.soHuVideoDao = soHuVideoDao;
    }
    public SoHuService getSoHuService() {
        return soHuService;
    }
    public void setSoHuService(SoHuService soHuService) {
        this.soHuService = soHuService;
    }
    public static List<RootCategory> getCategory() {
        List<RootCategory> list = SoHuApi.rootCategoryList();
src/main/java/com/yeshi/buwan/util/SystemUtil.java
@@ -37,6 +37,11 @@
        return systemInfo;
    }
    public static String getAdminSelectedSystemId(HttpSession session) {
        return getAdminSelectedSystem(session).getId();
    }
    /**
     * 保存System
     *
src/main/java/com/yeshi/buwan/util/news/SouGouParser.java
@@ -28,14 +28,6 @@
    @Resource
    private SouGouService souGouService;
    public SouGouService getSouGouService() {
        return souGouService;
    }
    public void setSouGouService(SouGouService souGouService) {
        this.souGouService = souGouService;
    }
    public static String REMEN = "http://weixin.sogou.com/wapindex/wap/0612/wap_0/#.html";// 热门
    public static String TUIJIAN = "http://weixin.sogou.com/wapindex/wap/0612/wap_1/#.html";// 推荐
    public static String DUANZISHOU = "http://weixin.sogou.com/wapindex/wap/0612/wap_2/#.html";// 段子手
src/main/java/com/yeshi/buwan/util/push/PushUtil.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/AdminUserAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/BanQuanAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/CategoryRecommendVideoAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/CommonAdAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/ConfigAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/HomeAdAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/HomeNoticeAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/HomeTypeAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/HomeVideoAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/HotSearchAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/HotStarAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/LoginAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/PictureCheckCodeServlet.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/PushAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/RecommendAdAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/ShareAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/SpecialAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/SpecialVideoAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/StatisticsAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/SystemAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/TypeAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/UserBannerAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/VideoDetailAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/VideoIntersectionAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/VideoTypeAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/VideosAction.java
File was deleted
src/main/java/com/yeshi/buwan/web/action/WXAdAction.java
File was deleted
src/main/resources/domain/special/Special.hbm.xml
@@ -1,25 +1,22 @@
<?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.special">
    <class name="Special" table="wk_video_special">
        <id name="id" column="id">
            <generator class="native"></generator>
        </id>
    <class name="Special" table="wk_video_special">
        <id name="id" column="id">
            <generator class="native"></generator>
        </id>
        <property name="createtime" type="string"></property>
        <property name="name" type="string"></property>
        <property name="picture" type="string"></property>
        <property name="introduction" type="string"></property>
        <property name="orderby" type="integer"></property>
        <property name="show" column="`show`" type="boolean"></property>
        <property name="showonmain" column="`showonmain`" type="boolean"></property>
    </class>
        <property name="createtime" type="string"></property>
        <property name="name" type="string"></property>
        <property name="picture" type="string"></property>
        <property name="introduction" type="string"></property>
        <property name="orderby" type="integer"></property>
        <property name="show" column="`show`" type="boolean"></property>
        <property name="showonmain" column="`showonmain`" type="boolean"></property>
        <many-to-one name="system" column="system" lazy="false"></many-to-one>
    </class>
</hibernate-mapping>
src/main/resources/env-dev/logback.xml
@@ -179,7 +179,10 @@
    <logger name="org.hibernate.type" level="ALL" />
    <logger name="org.hibernate" level="DEBUG" />
    <logger name="org.springframework.transaction" level="DEBUG" />
    <logger name="org.springframework.transaction" level="INFO" />
    <logger name="org.springframework.data.solr" level="DEBUG" />
    <!-- 一切logger都会继承自root,root默认的层级level为debug -->
src/main/resources/struts.xml
@@ -908,56 +908,6 @@
        </action>
        <!-- 热门明星 -->
        <action name="hotStarList" class="com.yeshi.buwan.web.action.HotStarAction"
            method="hotStarList">
            <result name="success">/admin/frontedit/hotstar_list.jsp</result>
            <interceptor-ref name="mydefault" />
        </action>
        <action name="getHotStarDetailSystem" class="com.yeshi.buwan.web.action.HotStarAction"
            method="getHotStarDetailSystem">
            <result name="success">/admin/frontedit/hotstar_add.jsp</result>
            <interceptor-ref name="mydefault" />
        </action>
        <action name="getHotStar" class="com.yeshi.buwan.web.action.HotStarAction"
            method="getHotStar">
            <result name="success">/admin/frontedit/hotstar_edit.jsp</result>
            <interceptor-ref name="mydefault" />
        </action>
        <action name="updateHotStar" class="com.yeshi.buwan.web.action.HotStarAction"
            method="updateHotStar">
            <result name="success" type="chain">getHotStar</result>
            <interceptor-ref name="mydefault" />
        </action>
        <action name="addHotStar" class="com.yeshi.buwan.web.action.HotStarAction"
            method="addHotStar">
            <result name="success" type="chain">getHotStarDetailSystem
            </result>
            <interceptor-ref name="mydefault" />
        </action>
        <action name="deleteHotStar" class="com.yeshi.buwan.web.action.HotStarAction"
            method="deleteHotStar">
            <result name="success" type="chain">hotStarList</result>
            <interceptor-ref name="mydefault" />
        </action>
        <action name="deleteHotStarList" class="com.yeshi.buwan.web.action.HotStarAction"
            method="deleteHotStarList">
            <result name="success" type="chain">hotStarList</result>
            <interceptor-ref name="mydefault" />
        </action>
        <!-- 专题 -->
        <action name="specialList" class="com.yeshi.buwan.web.action.SpecialAction"
src/main/webapp/admin/new/fenqu.html
@@ -100,7 +100,7 @@
            </select>
            <select name="select" class="form-control search resourceIds">
                <option value="0">全部</option>
                <option value="0">全部来源</option>
                <option value="24">风行2</option>
                <option value="19">风行</option>
                <option value="13">爱奇艺</option>
@@ -108,6 +108,13 @@
                <option value="21">Acfun</option>
                <option value="25">PPTV</option>
            </select>
            <select name="select" class="form-control search type">
                <option value="name" selected>片名</option>
                <option value="actor">主演</option>
                <option value="director">导演</option>
            </select>
            <div class="form-group search" role="search">
                <input type="text" class="form-control search" id="kw" style="width: 200px;" placeholder="搜索">
            </div>
@@ -582,6 +589,7 @@
                "page": page,
                "videotype": $(".search-div .videotypes select:last").val(),
                "detailsystem": $(".search-div .select-detailsystem").val(),
                "type": $(".search-div .type").val(),
                "contenttype": $(".contenttype").val(),
                "key": $("#kw").val(),
                "resourceIds": JSON.stringify(resourceIds)
src/test/java/com/hxh/spring/test/GeneralTest.java
@@ -5,7 +5,6 @@
import com.yeshi.buwan.domain.video.VideoResourceVersionMap;
import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService;
import org.yeshi.utils.generater.SpringComponentGenerater;
import org.yeshi.utils.generater.entity.ExceptionData;
import org.yeshi.utils.generater.entity.MongoDBDaoData;
import org.yeshi.utils.generater.entity.ServiceData;
src/test/java/com/hxh/spring/test/HelloWordTest.java
@@ -1,25 +1,16 @@
package com.hxh.spring.test;
import java.io.File;
import java.util.List;
import com.yeshi.buwan.dao.UserDao;
import com.yeshi.buwan.domain.AdminInfo;
import com.yeshi.buwan.domain.UserInfo;
import com.yeshi.buwan.util.BeanUtil;
import com.yeshi.buwan.util.TimeUtil;
import com.yeshi.buwan.util.news.SouGouParser;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.hibernate.Session;
import com.yeshi.buwan.dao.UserDao;
import com.yeshi.buwan.domain.AdminInfo;
import com.yeshi.buwan.domain.HomeType;
import com.yeshi.buwan.domain.UserInfo;
import com.yeshi.buwan.service.imp.AttentionService;
import com.yeshi.buwan.service.imp.HomeTypeService;
import com.yeshi.buwan.util.BeanUtil;
import com.yeshi.buwan.util.CacheUtil;
import com.yeshi.buwan.util.OSSManager;
import com.yeshi.buwan.util.TimeUtil;
import com.yeshi.buwan.util.JuHe.VideoResourceUtil;
import com.yeshi.buwan.util.email.MailSenderUtil;
import com.yeshi.buwan.util.news.SouGouParser;
import java.util.List;
public class HelloWordTest {