Browse Source

Merge branch 'master' of http://192.168.1.220:10080/Amoy2/guns-separation

chenyue 4 years ago
parent
commit
ce464b87a2

+ 24 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlArticleContentController.java

@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/***
@ -66,6 +67,16 @@ public class ZjxlArticleContentController extends BaseController {
            @ApiParam(name = "articleContentIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "articleContentIsLine", required = false)Integer articleContentIsLine){
        try {
            ZjxlArticleContent articleContent = new ZjxlArticleContent();
            List<ZjxlArticleContent> list = articleContentService.findArticleAll();
            if (list.size() > 0){
                Iterator<ZjxlArticleContent> iterator = list.iterator();
                while (iterator.hasNext()){
                    if (articleContentTitle.equals(iterator.next()));
                    return write(-1,"改文章已存在");
                }
            }
            articleContent.setArticleContentTitle(articleContentTitle);
            articleContent.setArticleContentCover(articleContentCover);
            articleContent.setArticleContentAbstract(articleContentAbstract);
@ -86,6 +97,8 @@ public class ZjxlArticleContentController extends BaseController {
        }
    }
    @RequestMapping(value = "/deleteArticleContent", method = RequestMethod.POST)
    @ApiOperation(value = "删除文章管理")
    public String deleteArticleContent(@ApiParam(name = "id", value = "文章id") @RequestParam(value = "id") String id){
@ -193,4 +206,15 @@ public class ZjxlArticleContentController extends BaseController {
            return write(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/findArticleAll", method = RequestMethod.GET)
    @ApiOperation(value = "获取所有文章")
    public String findArticleAll(){
        try {
            return write(200,"查询成功","data", articleContentService.findArticleAll());
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");
        }
    }
}

+ 81 - 8
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlBannerCnotroller.java

@ -1,6 +1,7 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.config.FastDFSConfig;
import cn.stylefeng.guns.sys.modular.user.param.SysUserParam;
import cn.stylefeng.guns.zjxl.model.UploadModel;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlBanner;
@ -12,19 +13,20 @@ import cn.stylefeng.guns.zjxl.service.ZjxlBannerService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import cn.stylefeng.guns.zjxlUtil.FastDFSUtil;
import cn.stylefeng.guns.zjxlUtil.PageUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@ -32,6 +34,7 @@ import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@ -80,12 +83,21 @@ public class ZjxlBannerCnotroller extends BaseController {
    public String addBanner(@ApiParam(name = "bannerName", value = "bannerName", required = false) @RequestParam(value = "bannerName", required = false)String bannerName,
                            @ApiParam(name = "bannerImage", value = "图片", required = false) @RequestParam(value = "bannerImage", required = false)String bannerImage,
                            @ApiParam(name = "bannerType", value = "跳转方式: 0-无  1-站内文章  2-外部链接", required = false) @RequestParam(value = "bannerType", required = false)Integer bannerType,
                            @ApiParam(name = "bannerTypeUrl", value = "跳转链接", required = false) @RequestParam(value = "bannerTypeUrl", required = false)String bannerTypeUrl,
                            @ApiParam(name = "bannerTypeUrl", value = "跳转链接(如果是站内文章,传文章id)", required = false) @RequestParam(value = "bannerTypeUrl", required = false)String bannerTypeUrl,
                            @ApiParam(name = "bannerSort", value = "排序", required = false) @RequestParam(value = "bannerSort", required = false)Integer bannerSort,
                            @ApiParam(name = "bannerIsLine", value = "是否上线", required = false,defaultValue = "0") @RequestParam(value = "bannerIsLine", required = false)Integer bannerIsLine){
        ZjxlBanner banner = new ZjxlBanner();
        banner.setBannerImage(bannerImage);//String
        banner.setBannerIsLine(bannerIsLine);//integer
        List<ZjxlBanner> bannerList = bannerService.findBannerAll();
        if (bannerList.size() > 0){
            Iterator<ZjxlBanner> bannerIterator = bannerList.iterator();
            while (bannerIterator.hasNext()){
                if (bannerIterator.next().getBannerName().equals(bannerName)){
                    return write(-1,"该名称已存在");
                }
            }
        }
        banner.setBannerName(bannerName);//string
        banner.setBannerSort(bannerSort);
        banner.setBannerType(bannerType);
@ -96,12 +108,15 @@ public class ZjxlBannerCnotroller extends BaseController {
            object.put("articleContentType",articleContentList.get(0).getArticleContentType());
            object.put("articleContentClassify",articleContentList.get(0).getArticleContentClassify());
            object.put("articleContentSubclassify",articleContentList.get(0).getArticleContentSubclassify());
            object.put("articleContentTitle",articleContentList.get(0).getArticleContentTitle());
            banner.setBannerTypeUrl(object.toString());
        }else {
            banner.setBannerTypeUrl(bannerTypeUrl);
        }
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
        banner.setBannerCreateTime(df.format(new Date()));// new Date()为获取当前系统时间
        //设置日期格式
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // new Date()为获取当前系统时间
        banner.setBannerCreateTime(df.format(new Date()));
        try {
            logger.info("执行banner添加,参数:"+banner);
            return write(200,"添加成功","data",bannerService.addBanner(banner));
@ -127,7 +142,8 @@ public class ZjxlBannerCnotroller extends BaseController {
    @RequestMapping(value = "/updateIsLine", method = RequestMethod.POST)
    @ApiOperation(value = "修改是否上线")
    public String updateIsLine(String id,Integer isLine){
    public String updateIsLine(String id,
                               Integer isLine){
        try {
            logger.info("修改是否上线:id====="+id+",isLine===="+isLine);
            if (id == null || isLine == null){
@ -140,6 +156,63 @@ public class ZjxlBannerCnotroller extends BaseController {
        }
    }
    @RequestMapping(value = "/updataBanner", method = RequestMethod.POST)
    @ApiOperation(value = "编辑banner")
    public String updataBanner(@ApiParam(name = "bannerId", value = "bannerId", required = false) @RequestParam(value = "bannerId", required = true)String bannerId,
                               @ApiParam(name = "bannerName", value = "bannerName", required = false) @RequestParam(value = "bannerName", required = false)String bannerName,
                               @ApiParam(name = "bannerImage", value = "图片", required = false) @RequestParam(value = "bannerImage", required = false)String bannerImage,
                               @ApiParam(name = "bannerType", value = "跳转方式: 0-无  1-站内文章  2-外部链接", required = false) @RequestParam(value = "bannerType", required = false)Integer bannerType,
                               @ApiParam(name = "bannerTypeUrl", value = "跳转链接(如果是站内文章,传文章id)", required = false) @RequestParam(value = "bannerTypeUrl", required = false)String bannerTypeUrl,
                               @ApiParam(name = "bannerSort", value = "排序", required = false) @RequestParam(value = "bannerSort", required = false)Integer bannerSort,
                               @ApiParam(name = "bannerIsLine", value = "是否上线", required = false,defaultValue = "0") @RequestParam(value = "bannerIsLine", required = false)Integer bannerIsLine){
        ZjxlBanner banner = new ZjxlBanner();
        banner.setBannerId(bannerId);
        if (bannerType != null){
            banner.setBannerType(bannerType);
        }
        if (bannerType != null){
            if (bannerType == 1){
                List<ZjxlArticleContent> articleContentList = articleContentService.findArticleContentById(bannerTypeUrl);
                JSONObject object = new JSONObject();
                object.put("articleContentId",articleContentList.get(0).getArticleContentId());
                object.put("articleContentType",articleContentList.get(0).getArticleContentType());
                object.put("articleContentClassify",articleContentList.get(0).getArticleContentClassify());
                object.put("articleContentSubclassify",articleContentList.get(0).getArticleContentSubclassify());
                object.put("articleContentTitle",articleContentList.get(0).getArticleContentTitle());
                banner.setBannerTypeUrl(object.toString());
            }else {
                banner.setBannerTypeUrl(bannerTypeUrl);
            }
        }
        if (bannerSort != null){
            banner.setBannerSort(bannerSort);
        }
        List<ZjxlBanner> bannerList = bannerService.findBannerAll();
        if (bannerList.size() > 0){
            Iterator<ZjxlBanner> bannerIterator = bannerList.iterator();
            while (bannerIterator.hasNext()){
                if (bannerIterator.next().getBannerName().equals(bannerName)){
                    return write(-1,"该名称已存在");
                }
            }
        }
        if (bannerName != null){
            banner.setBannerName(bannerName);
        }
        if (bannerImage != null){
            banner.setBannerImage(bannerImage);
        }
        if (bannerIsLine != null){
            banner.setBannerIsLine(bannerIsLine);
        }
        try {
            return write(200,"修改成功","data",bannerService.updateBanner(banner));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"修改失败");
        }
    }
    /**
     * 聊天附件上传
     *

+ 19 - 2
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlCompanyCaseController.java

@ -1,9 +1,12 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlCompanyCase;
import cn.stylefeng.guns.zjxl.service.ZjxlArticleContentService;
import cn.stylefeng.guns.zjxl.service.ZjxlCompanyCaseService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import cn.stylefeng.guns.zjxlUtil.PageUtil;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -34,6 +37,8 @@ public class ZjxlCompanyCaseController extends BaseController {
    @Autowired
    private ZjxlCompanyCaseService companyCaseService;
    @Autowired
    private ZjxlArticleContentService articleContentService;
    @RequestMapping(value = "/findCompanyCaseById", method = RequestMethod.GET)
    @ApiOperation(value = "查看CompanyCase")
@ -57,7 +62,7 @@ public class ZjxlCompanyCaseController extends BaseController {
            @ApiParam(name = "companyDescribe", value = "案例描述", required = false) @RequestParam(value = "companyDescribe", required = false)String companyDescribe,
            @ApiParam(name = "companyDefaultImg", value = "默认图片", required = false) @RequestParam(value = "companyDefaultImg", required = false)String companyDefaultImg,
            @ApiParam(name = "companyExchangeImg", value = "交互图片", required = false) @RequestParam(value = "companyExchangeImg", required = false)String companyExchangeImg,
            @ApiParam(name = "companyAssociatedCase", value = "关联案例", required = false) @RequestParam(value = "companyAssociatedCase", required = false)String companyAssociatedCase,
            @ApiParam(name = "companyAssociatedCase", value = "关联案例(对应的文章id)", required = false) @RequestParam(value = "companyAssociatedCase", required = false)String companyAssociatedCase,
            @ApiParam(name = "companyJumpUrl", value = "跳转链接", required = false) @RequestParam(value = "companyJumpUrl", required = false)String companyJumpUrl,
            @ApiParam(name = "companySort", value = "排序", required = false) @RequestParam(value = "companySort", required = false)Integer companySort,
            @ApiParam(name = "companyIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "companyIsLine", required = false)Integer companyIsLine,
@ -68,12 +73,24 @@ public class ZjxlCompanyCaseController extends BaseController {
            companyCase.setCompanyDescribe(companyDescribe);
            companyCase.setCompanyDefaultImg(companyDefaultImg);
            companyCase.setCompanyExchangeImg(companyExchangeImg);
            companyCase.setCompanyAssociatedCase(companyAssociatedCase);
            companyCase.setCompanyJumpUrl(companyJumpUrl);
            companyCase.setCompanySort(companySort);
            companyCase.setCompanyIsLine(companyIsLine);
            companyCase.setCompanyTestBannerId(companyTestBannerId);
            List<ZjxlArticleContent> caseA = articleContentService.findArticleContentById(companyAssociatedCase);
            if (caseA.size()>0){
                JSONObject object = new JSONObject();
                object.put("articleContentId",caseA.get(0).getArticleContentId());
                object.put("articleContentType",caseA.get(0).getArticleContentType());
                object.put("articleContentClassify",caseA.get(0).getArticleContentClassify());
                object.put("articleContentSubclassify",caseA.get(0).getArticleContentSubclassify());
                object.put("articleContentTitle",caseA.get(0).getArticleContentTitle());
                companyCase.setCompanyAssociatedCase(object.toString());
            }else {
                return write(-1,"添加案例不存在");
            }
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            companyCase.setCompanyCreateTime(df.format(new Date()));// new Date()为获取当前系统时间

+ 7 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlArticleContentService.java

@ -122,4 +122,11 @@ public class ZjxlArticleContentService extends BaseService {
        return articleContentList;
    }
    public List<ZjxlArticleContent> findArticleAll(){
        String sql = "select * from zjxl_article_content where article_content_is_line = 1";
        sql += " order by concat(article_content_sort,article_content_create_time) desc ";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
}

+ 30 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlBannerService.java

@ -1,9 +1,11 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlBannerDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlBanner;
import cn.stylefeng.guns.zjxl.model.ret.BannerCompanyCaseRet;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -66,6 +68,28 @@ public class ZjxlBannerService extends BaseService {
        return bannerDao.updateIsLine(id,isLine);
    }
    public int updateBanner(ZjxlBanner banner){
        String sql = "update zjxl_banner SET banner_id = '"+banner.getBannerId()+"'";
        if (StringUtils.isNotEmpty(banner.getBannerImage())){
            sql += ",banner_image = '"+banner.getBannerImage()+"'";
        }
        if (banner.getBannerType() != null){
            sql += ",banner_type = "+banner.getBannerType()+"";
        }
        if (banner.getBannerSort() != null){
            sql += ",banner_sort = "+banner.getBannerSort()+"";
        }
        if (StringUtils.isNotEmpty(banner.getBannerName())){
            sql += ",banner_name = '"+banner.getBannerName()+"'";
        }
        if (banner.getBannerIsLine() != null){
            sql += ",banner_is_line = "+banner.getBannerIsLine()+"";
        }
        sql += " where banner_id = '"+banner.getBannerId()+"'";
        int update = jdbcTemplate.update(sql);
        return update;
    }
    public List<BannerCompanyCaseRet> finfBannerCompanyCaseById(String id){
        String sql = "SELECT * FROM zjxl_banner b, zjxl_company_case cc WHERE b.banner_id = '"+id+"' AND b.banner_id = cc.test_banner_id";
        List<BannerCompanyCaseRet> caseRet = jdbcTemplate.query(sql, new BeanPropertyRowMapper(BannerCompanyCaseRet.class));
@ -84,4 +108,10 @@ public class ZjxlBannerService extends BaseService {
        Integer allCount = jdbcTemplate.queryForObject(sql, Integer.class);;
        return allCount;
    }
    public List<ZjxlBanner> findBannerAll(){
        String sql = "SELECT * FROM `guns-separation`.zjxl_banner WHERE banner_is_line=1";
        List<ZjxlBanner> bannerList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ZjxlBanner.class));
        return bannerList;
    }
}

+ 1 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlCompanyCaseService.java

@ -35,7 +35,7 @@ public class ZjxlCompanyCaseService extends BaseService {
            sql += " and company_id = '"+id+"'";
        }
        if (StringUtils.isNotEmpty(name)){
            sql += " and company_name = '"+name+"'";
            sql += " and company_name like '%"+name+"%'";
        }
        sql += " order by concat(company_sort,company_create_time) desc limit "+page+" , "+pagesize+"";
        List<ZjxlCompanyCase> companyCaseList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlCompanyCase.class));