admin
2020-07-04 9d35ba657fa5e3add766405d76e3ff8c4dcd4ad4
fanli/src/main/java/com/yeshi/fanli/controller/admin/HelpCenterAdminController.java
@@ -9,6 +9,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.yeshi.fanli.entity.accept.AdminAcceptData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -25,7 +26,6 @@
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
import com.yeshi.fanli.exception.config.HelpCenterException;
import com.yeshi.fanli.exception.config.HelpClassException;
import com.yeshi.fanli.exception.homemodule.FloatADException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.help.HelpCenterService;
@@ -83,6 +83,26 @@
      }
   }
   /**
    * 修改状态
    * @param callback
    * @param id
    * @param out
    */
   @RequestMapping(value = "switchState")
   public void switchState(String callback, Long id, PrintWriter out) {
      try {
         helpCenterService.switchState(id);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
      } catch (HelpCenterException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
         e.printStackTrace();
      }
   }
   @RequestMapping(value = "getInfo")
   public void getInfo(String callback, Long id, PrintWriter out) {
@@ -101,6 +121,9 @@
      JSONObject data = new JSONObject();
      data.put("id", crrent.getId());
      data.put("title", crrent.getTitle());
      data.put("state", crrent.getState());
      data.put("weight", crrent.getWeight());
      if (crrent.getStartTime() != null) {
         data.put("startTime", TimeUtil.getWholeTime(crrent.getStartTime().getTime()));
@@ -140,8 +163,8 @@
    * @param out
    */
   @RequestMapping(value = "query")
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long cid, Integer orderMode,
         String version, String platform, PrintWriter out) {
   public void query(AdminAcceptData acceptData, String callback, Integer pageIndex, Integer pageSize, String key, Long cid, Integer orderMode,
                 String version, String platform, Integer state, PrintWriter out) {
      try {
         if (orderMode == null)
            orderMode = 1;
@@ -152,7 +175,7 @@
         if (pageSize == null)
            pageSize = Constant.PAGE_SIZE;
         List<HelpCenter> list = helpCenterService.query(0, Integer.MAX_VALUE, key, cid, orderMode);
         List<HelpCenter> list = helpCenterService.query(0, Integer.MAX_VALUE, key, cid, orderMode, state,acceptData.getSystem());
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
@@ -167,7 +190,7 @@
               if (appVersion != null)
                  versionList.add(appVersion);
            } else {
               List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform);
               List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform,acceptData.getSystem());
               if (appVersionList != null) {
                  versionList.addAll(appVersionList);
               }
@@ -346,7 +369,7 @@
            helpClassService.save(helpClass, null);
         }
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
      } catch (FloatADException e) {
      } catch (HelpClassException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
@@ -354,6 +377,25 @@
      }
   }
   /**
    * 修改状态
    * @param callback
    * @param id
    * @param out
    */
   @RequestMapping(value = "switchStateClass")
   public void switchStateClass(String callback, Long id, PrintWriter out) {
      try {
         helpClassService.switchState(id);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
      } catch (HelpClassException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
         e.printStackTrace();
      }
   }
   /**
    * 修改排序
@@ -362,9 +404,9 @@
    * @param out
    */
   @RequestMapping(value = "updateSort")
   public void updateSort(String callback, Integer moveType, Long id, PrintWriter out) {
   public void updateSort(AdminAcceptData acceptData, String callback, Integer moveType, Long id, PrintWriter out) {
      try {
         helpClassService.updateSort(moveType, id);
         helpClassService.updateSort(moveType, id,acceptData.getSystem());
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
      } catch (HelpClassException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -414,7 +456,7 @@
    * @param out
    */
   @RequestMapping(value = "queryClass")
   public void queryClass(String callback, Integer pageIndex, Integer pageSize, String key, Integer showState,
   public void queryClass(AdminAcceptData acceptData, String callback, Integer pageIndex, Integer pageSize, String key, Integer showState,
         String version, String platform, PrintWriter out) {
      if (pageIndex == null || pageIndex < 1) {
@@ -423,7 +465,7 @@
      pageSize = Integer.MAX_VALUE;
      try {
         List<HelpClass> list = helpClassService.query(0, pageSize, key, showState);
         List<HelpClass> list = helpClassService.query(0, pageSize, key, showState,acceptData.getSystem());
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
@@ -437,7 +479,7 @@
               if (appVersion != null)
                  versionList.add(appVersion);
            } else {
               List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform);
               List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform,acceptData.getSystem());
               if (appVersionList != null) {
                  versionList.addAll(appVersionList);
               }
@@ -510,7 +552,7 @@
    * @param out
    */
   @RequestMapping(value = "getProvidedClass")
   public void getAllClass(String callback, PrintWriter out) {
   public void getAllClass(AdminAcceptData acceptData, String callback, PrintWriter out) {
      try {
         HelpClass helpClass = new HelpClass();
@@ -520,7 +562,7 @@
         List<HelpClass> reslut_list = new ArrayList<HelpClass>();
         reslut_list.add(helpClass);
         List<HelpClass> list = helpClassService.getProvidedClass();
         List<HelpClass> list = helpClassService.getProvidedClass(acceptData.getSystem());
         if (list != null && list.size() > 0) {
            reslut_list.addAll(list);
         }