yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SpecialCardAdminController.java
@@ -19,6 +19,7 @@
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
import com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo;
import com.yeshi.fanli.entity.bus.homemodule.Special;
import com.yeshi.fanli.entity.bus.homemodule.SpecialCard;
import com.yeshi.fanli.exception.homemodule.SpecialCardException;
@@ -30,6 +31,7 @@
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.vo.homemodule.SpecialVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -76,6 +78,31 @@
      }
   }
   /**
    * 查询
    *
    * @param callback
    * @param pageIndex
    * @param pageSize
    * @param key
    *            模糊查询:说明、标识
    * @param out
    */
   @RequestMapping(value = "queryActivity")
   public void queryActivity(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
           PrintWriter out) {
      List<Long> listPid = new ArrayList<Long>();
      listPid.add(15L);
      listPid.add(16L);
      listPid.add(17L);
      queryList(callback, pageIndex, pageSize, key, sort, listPid, out);
   }
   /**
    * 查询
    * 
@@ -88,6 +115,11 @@
    */
   @RequestMapping(value = "query")
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort, PrintWriter out) {
      queryList(callback, pageIndex, pageSize, key, sort, null, out);
   }
   public void queryList(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
         List<Long> listPid, PrintWriter out) {
      if (pageIndex == null || pageIndex < 1) {
         pageIndex = 1;
@@ -98,14 +130,14 @@
      }
      try {
         List<SpecialCard> list = specialCardService.listQuery((pageIndex - 1) * pageSize, pageSize, key, sort);
         List<SpecialCard> list = specialCardService.listQuery((pageIndex - 1) * pageSize, pageSize, key, sort, listPid);
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
         }
         long count = specialCardService.countlistQuery(key);
         long count = specialCardService.countlistQuery(key, listPid);
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -124,7 +156,6 @@
      }
   }
   /**
    * 删除
    * 
@@ -164,16 +195,16 @@
    * @param out
    */
   @RequestMapping(value = "saveSpecial")
   public void saveSpecial(String callback, Special record, String jumpType, HttpServletRequest request,
   public void saveSpecial(String callback, Special record, String jumpType, CommonShareInfo extra, HttpServletRequest request,
         PrintWriter out) {
      try {
         // 1. 先判断httpRequest 是否含有文件类型
         if (request instanceof MultipartHttpServletRequest) {
            MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
            specialService.saveObject(fileRequest.getFile("file"), fileRequest.getFile("file2"),
                  fileRequest.getFile("file3"), record, jumpType);
                  fileRequest.getFile("file3"), record, jumpType, extra);
         } else {
            specialService.saveObject(null, null, null, record, jumpType);
            specialService.saveObject(null, null, null, record, jumpType, extra);
         }
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
@@ -281,20 +312,18 @@
      try {
         List<Special> list = specialService.listQueryByCard((pageIndex - 1) * pageSize, pageSize, cardId, key, sex);
         long count = specialService.countlistQueryByCard(cardId, key, sex);
         // 获取有效的专题
         List<SpecialVO> list = specialService.listQueryByCard((pageIndex - 1) * pageSize, pageSize, cardId, key, sex);
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
         }
         long count = specialService.countlistQueryByCard(cardId, key, sex);
         // 过滤
         if (versionList != null) {
            if (versionList.size() > 0) {
               List<Long> sourceIdList = new ArrayList<>();
               for (Special special : list) {
               for (SpecialVO special : list) {
                  sourceIdList.add(special.getId());
               }
               List<Long> versionIdList = new ArrayList<>();
@@ -324,9 +353,7 @@
         JSONObject data = new JSONObject();
         data.put("pe", pe);
         data.put("result_list", gson.toJson(list));
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
         e.printStackTrace();