|  | @ -1,12 +1,17 @@
 | 
												
													
														
															|  | package cn.stylefeng.guns.zjxl.cnotroller;
 |  | package cn.stylefeng.guns.zjxl.cnotroller;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
 |  | import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
 | 
												
													
														
															|  | 
 |  | import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
 | 
												
													
														
															|  | import cn.stylefeng.guns.zjxl.service.ZjxlArticleContentService;
 |  | import cn.stylefeng.guns.zjxl.service.ZjxlArticleContentService;
 | 
												
													
														
															|  | 
 |  | import cn.stylefeng.guns.zjxl.service.ZjxlSystemDictService;
 | 
												
													
														
															|  | import cn.stylefeng.guns.zjxlUtil.BaseController;
 |  | import cn.stylefeng.guns.zjxlUtil.BaseController;
 | 
												
													
														
															|  | import cn.stylefeng.guns.zjxlUtil.PageUtil;
 |  | import cn.stylefeng.guns.zjxlUtil.PageUtil;
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | import io.swagger.annotations.Api;
 |  | import io.swagger.annotations.Api;
 | 
												
													
														
															|  | import io.swagger.annotations.ApiOperation;
 |  | import io.swagger.annotations.ApiOperation;
 | 
												
													
														
															|  | import io.swagger.annotations.ApiParam;
 |  | import io.swagger.annotations.ApiParam;
 | 
												
													
														
															|  | 
 |  | import jdk.nashorn.internal.ir.WithNode;
 | 
												
													
														
															|  | 
 |  | import io.swagger.models.auth.In;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
													
														
															|  | import org.slf4j.Logger;
 |  | import org.slf4j.Logger;
 | 
												
													
														
															|  | import org.slf4j.LoggerFactory;
 |  | import org.slf4j.LoggerFactory;
 | 
												
											
												
													
														
															|  | @ -37,6 +42,9 @@ public class ZjxlArticleContentController extends BaseController {
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private ZjxlArticleContentService articleContentService;
 |  |     private ZjxlArticleContentService articleContentService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private ZjxlSystemDictService systemDictService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @RequestMapping(value = "/findArticleContentById", method = RequestMethod.GET)
 |  |     @RequestMapping(value = "/findArticleContentById", method = RequestMethod.GET)
 | 
												
													
														
															|  |     @ApiOperation(value = "查询文章管理列表")
 |  |     @ApiOperation(value = "查询文章管理列表")
 | 
												
													
														
															|  |     public String findArticleContentById(@ApiParam(name = "id", value = "文章id", required = false) @RequestParam(value = "id", required = false)String id,
 |  |     public String findArticleContentById(@ApiParam(name = "id", value = "文章id", required = false) @RequestParam(value = "id", required = false)String id,
 | 
												
											
												
													
														
															|  | @ -68,12 +76,13 @@ public class ZjxlArticleContentController extends BaseController {
 | 
												
													
														
															|  |         try {
 |  |         try {
 | 
												
													
														
															|  |             ZjxlArticleContent articleContent = new ZjxlArticleContent();
 |  |             ZjxlArticleContent articleContent = new ZjxlArticleContent();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             List<ZjxlArticleContent> list = articleContentService.findArticleAll();
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<ZjxlArticleContent> list = articleContentService.findArticleAll(null);
 | 
												
													
														
															|  |             if (list.size() > 0){
 |  |             if (list.size() > 0){
 | 
												
													
														
															|  |                 Iterator<ZjxlArticleContent> iterator = list.iterator();
 |  |                 Iterator<ZjxlArticleContent> iterator = list.iterator();
 | 
												
													
														
															|  |                 while (iterator.hasNext()){
 |  |                 while (iterator.hasNext()){
 | 
												
													
														
															|  |                     if (articleContentTitle.equals(iterator.next()));
 |  | 
 | 
												
													
														
															|  |                     return write(-1,"改文章已存在");
 |  | 
 | 
												
													
														
															|  | 
 |  |                     if (articleContentTitle.equals(iterator.next().getArticleContentTitle())){
 | 
												
													
														
															|  | 
 |  |                         return write(-1,"改文章已存在");
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -160,7 +169,20 @@ public class ZjxlArticleContentController extends BaseController {
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             logger.info("内容类型:articleContentType====="+articleContentType);
 |  |             logger.info("内容类型:articleContentType====="+articleContentType);
 | 
												
													
														
															|  |             logger.info("分类:articleContentClassify====="+articleContentClassify);
 |  |             logger.info("分类:articleContentClassify====="+articleContentClassify);
 | 
												
													
														
															|  |             return write(200,"操作成功","data",articleContentService.getArticleContentSubclassify(articleContentType,articleContentClassify));
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<ZjxlArticleContent> list = articleContentService.getArticleContentSubclassify(articleContentType,articleContentClassify);
 | 
												
													
														
															|  | 
 |  |             if (list.size() > 0){
 | 
												
													
														
															|  | 
 |  |                 return write(200,"操作成功","data",list);
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 ZjxlArticleContent content = new ZjxlArticleContent();
 | 
												
													
														
															|  | 
 |  |                 List<ZjxlSystemDict> systemDictList = systemDictService.findNewsTypeA(new Integer(articleContentType),articleContentClassify);
 | 
												
													
														
															|  | 
 |  |                 if (systemDictList.size() > 0){
 | 
												
													
														
															|  | 
 |  |                     for (int i=0;i<systemDictList.size();i++){
 | 
												
													
														
															|  | 
 |  |                         content.setArticleContentSubclassify(systemDictList.get(i).getSystemDictSubclassify());
 | 
												
													
														
															|  | 
 |  |                         list.add(content);
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |              return write(200,"操作成功","data",list);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |         }catch (Exception e){
 |  |         }catch (Exception e){
 | 
												
													
														
															|  |             e.printStackTrace();
 |  |             e.printStackTrace();
 | 
												
													
														
															|  |             return write(-1,"操作失败");
 |  |             return write(-1,"操作失败");
 | 
												
											
												
													
														
															|  | @ -209,12 +231,48 @@ public class ZjxlArticleContentController extends BaseController {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @RequestMapping(value = "/findArticleAll", method = RequestMethod.GET)
 |  |     @RequestMapping(value = "/findArticleAll", method = RequestMethod.GET)
 | 
												
													
														
															|  |     @ApiOperation(value = "获取所有文章")
 |  |     @ApiOperation(value = "获取所有文章")
 | 
												
													
														
															|  |     public String findArticleAll(){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public String findArticleAll(@ApiParam(name = "articleContentType", value = "子分类") @RequestParam(value = "articleContentType", required = false) String articleContentType){
 | 
												
													
														
															|  |         try {
 |  |         try {
 | 
												
													
														
															|  |             return write(200,"查询成功","data", articleContentService.findArticleAll());
 |  | 
 | 
												
													
														
															|  | 
 |  |             return write(200,"查询成功","data", articleContentService.findArticleAll(articleContentType));
 | 
												
													
														
															|  |         }catch (Exception e){
 |  |         }catch (Exception e){
 | 
												
													
														
															|  |             e.printStackTrace();
 |  |             e.printStackTrace();
 | 
												
													
														
															|  |             return write(-1,"查询失败");
 |  |             return write(-1,"查询失败");
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  |     @RequestMapping(value = "updateArticleAllInfo",method = RequestMethod.POST)
 | 
												
													
														
															|  | 
 |  |     @ApiOperation("修改文章信息")
 | 
												
													
														
															|  | 
 |  |     public String updateArticleAllInfo(@ApiParam(name="id",value = "文章id",required = true)@RequestParam(value = "id",required = true)String id,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentTitle", value = "文章标题", required = false) @RequestParam(value = "articleContentTitle", required = false)String articleContentTitle,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentCover", value = "封面", required = false) @RequestParam(value = "articleContentCover", required = false)String articleContentCover,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentAbstract", value = "摘要", required = false) @RequestParam(value = "articleContentAbstract", required = false) String articleContentAbstract,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentContent", value = "内容", required = false) @RequestParam(value = "articleContentContent", required = false) String articleContentContent,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentType", value = "内容类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们", required = false) @RequestParam(value = "articleContentType", required = false)Integer articleContentType,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentClassify", value = "分类", required = false) @RequestParam(value = "articleContentClassify", required = false)String articleContentClassify,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentSubclassify", value = "子分类", required = false) @RequestParam(value = "articleContentSubclassify", required = false)String articleContentSubclassify,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentSort", value = "排序", required = false) @RequestParam(value = "articleContentSort", required = false)Integer articleContentSort,
 | 
												
													
														
															|  | 
 |  |                                        @ApiParam(name = "articleContentIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "articleContentIsLine", required = false)Integer articleContentIsLine){
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             ZjxlArticleContent zjxlArticleContent = new ZjxlArticleContent();
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentId(id);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentTitle(articleContentTitle);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentCover(articleContentCover);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentAbstract(articleContentAbstract);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentContent(articleContentContent);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentType(articleContentType);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentClassify(articleContentClassify);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentSubclassify(articleContentSubclassify);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentSort(articleContentSort);
 | 
												
													
														
															|  | 
 |  |             zjxlArticleContent.setArticleContentIsLine(articleContentIsLine);
 | 
												
													
														
															|  | 
 |  |             JSONObject result = articleContentService.updateArticleAllInfo(zjxlArticleContent);
 | 
												
													
														
															|  | 
 |  |             if (result.getInteger("status")==-1){
 | 
												
													
														
															|  | 
 |  |                 return write(-1,"修改失败");
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             return write(200,"修改成功","data",result.getJSONObject("articleInfo"));
 | 
												
													
														
															|  | 
 |  |         }catch (Exception e){
 | 
												
													
														
															|  | 
 |  |             e.printStackTrace();
 | 
												
													
														
															|  | 
 |  |             return write(-1,"修改失败");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |