소스 검색

Merge branch 'master' of liubing/guns-separation into master

liubing 4 년 전
부모
커밋
f5cbbef6e5

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

@ -6,9 +6,11 @@ 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.PageUtil;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.slf4j.Logger;
@ -237,4 +239,40 @@ public class ZjxlArticleContentController extends BaseController {
            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,"修改失败");
        }
    }
}

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

@ -127,7 +127,7 @@ public class ZjxlBannerCnotroller extends BaseController {
    @RequestMapping(value = "/deleteBannerById", method = RequestMethod.POST)
    @ApiOperation(value = "删除banner")
    public String deleteBannerById(String id){
    public String deleteBannerById(@RequestParam(value = "id",required=true) String id){
        try {
            logger.info("删除banner,参数"+id);
            if(id == null){

+ 29 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlSystemDictController.java

@ -4,6 +4,7 @@ import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import cn.stylefeng.guns.zjxl.service.ZjxlSystemDictService;
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;
@ -69,7 +70,7 @@ public class ZjxlSystemDictController extends BaseController {
            if (systemDictClassifyList>0){
                return write(-1,"该分类已存在,请勿重复添加");
            }
            if (systemDictClassifyList > 0 && systemDictSubclassifyList>0){
            if (systemDictSubclassifyList>0){
                return write(-1,"该子分类已存在,请勿重复添加");
            }
            systemDict.setSystemDictClassify(systemDictClassify);
@ -141,4 +142,31 @@ public class ZjxlSystemDictController extends BaseController {
        }
    }
    @RequestMapping(value = "/updateSystemDictInfo", method = RequestMethod.POST)
    @ApiOperation("修改字典表信息")
    public String updateSystemDictInfo(
            @ApiParam(name = "id", value = "字典ID", required = true)@RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "systemDictType", value = "类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们", required = false)@RequestParam(value = "systemDictType", required = false) Integer systemDictType,
            @ApiParam(name = "systemDictClassify", value = "分类", required = false)@RequestParam(value = "systemDictClassify", required = false) String systemDictClassify,
            @ApiParam(name = "systemDictSubclassify", value = "子分类", required = false)@RequestParam(value = "systemDictSubclassify", required = false) String systemDictSubclassify,
            @ApiParam(name = "systemDictSort", value = "排序", required = false)@RequestParam(value = "systemDictSort", required = false) Integer systemDictSort,
            @ApiParam(name = "systemDictIsLine", value = "是否上线", required = false, defaultValue = "0")@RequestParam(value = "systemDictIsLine", required = false) Integer systemDictIsLine){
        try {
            JSONObject result = systemDictService.updateSystemDictInfo(id,systemDictType,systemDictClassify,systemDictSubclassify,systemDictSort,systemDictIsLine);
            if (result.getInteger("status")==0){
                return write(-1,"该分类已存在,请勿重复添加","data","");
            }
            if (result.getInteger("status")==-1){
                return write(-1,"该字典ID不存在","data","");
            }
            if (result.getInteger("status")==-2){
                return write(-1,"传入参数不符合,存在空字符串","data","");
            }
            return write(200,"修改成功","data",result.getJSONObject("dictInfo"));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"添加失败");
        }
    }
}

+ 3 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlArticleContentDao.java

@ -21,4 +21,7 @@ public interface ZjxlArticleContentDao extends PagingAndSortingRepository<ZjxlAr
    @Modifying
    @Query("update ZjxlArticleContent a set a.articleContentIsLine = ?2 where a.articleContentId = ?1 ")
    int updateByArticleContentId(String id,Integer isLine);
    @Query("select a from ZjxlArticleContent a where a.articleContentId=?1")
    ZjxlArticleContent findById(String articleContentId);
}

+ 3 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlSystemDictDao.java

@ -22,4 +22,7 @@ public interface ZjxlSystemDictDao extends PagingAndSortingRepository<ZjxlSystem
    @Modifying
    @Query("update ZjxlSystemDict a set a.systemDictIsLine = ?2 where a.systemDictId = ?1")
    int updateBySystemDictId(String id, Integer isLine);
    @Query(" select a from ZjxlSystemDict a where a.systemDictId = ?1")
    ZjxlSystemDict findBySystemDictId(String systemDictId);
}

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

@ -3,6 +3,8 @@ package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlArticleContentDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -12,6 +14,8 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/***
@ -135,4 +139,20 @@ public class ZjxlArticleContentService extends BaseService {
        return articleContentList;
    }
    public JSONObject updateArticleAllInfo(ZjxlArticleContent zjxlArticleContent){
        ZjxlArticleContent tmp = articleContentDao.findById(zjxlArticleContent.getArticleContentId());
        JSONObject result = new JSONObject();
        if (tmp==null){
            result.put("status",-1);
        }
        else{
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            zjxlArticleContent.setArticleContentCreateTime(df.format(new Date()));
            articleContentDao.save(zjxlArticleContent);
            result.put("status",1);
        }
        result.put("articleInfo", JSON.toJSONString(zjxlArticleContent));
        return result;
    }
}

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

@ -26,7 +26,7 @@ import java.util.List;
 * @Date: 2020/10/30 17:26
 */
@Component
@Transactional(rollbackFor = Exception.class)
@Transactional
public class ZjxlBannerService extends BaseService {
    @Autowired

+ 37 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlSystemDictService.java

@ -4,6 +4,9 @@ import cn.stylefeng.guns.zjxl.dao.ZjxlSystemDictDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import jdk.nashorn.internal.ir.ReturnNode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -11,6 +14,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/***
@ -87,6 +92,38 @@ public class ZjxlSystemDictService extends BaseService {
        return systemDictList;
    }
    public JSONObject updateSystemDictInfo(String systemDictId,Integer systemDictType,String systemDictClassify,String systemDictSubclassify,Integer systemDictSort,Integer systemDictIsLine){
        JSONObject result = new JSONObject();
        ZjxlSystemDict zjxlSystemDict = systemDictDao.findBySystemDictId(systemDictId);
        if (zjxlSystemDict ==null){
            result.put("status",-1);
        }
        int systemDictClassifyList = findSystemDictClassify(systemDictClassify);
        //查询子分类是否存在
        int systemDictSubclassifyList = findSystemDictSubclassify(systemDictSubclassify);
        if (systemDictClassifyList>0&&systemDictSubclassifyList>0){
            result.put("status",0);
        }
        else{
            if (StringUtils.isBlank(systemDictClassify)||StringUtils.isBlank(systemDictSubclassify)){
                result.put("status",-2);
            }
            else{
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
                zjxlSystemDict.setSystemDictCreateTime(df.format(new Date()));
                zjxlSystemDict.setSystemDictType(systemDictType);
                zjxlSystemDict.setSystemDictClassify(systemDictClassify);
                zjxlSystemDict.setSystemDictSubclassify(systemDictSubclassify);
                zjxlSystemDict.setSystemDictSort(systemDictSort);
                zjxlSystemDict.setSystemDictIsLine(systemDictIsLine);
                systemDictDao.save(zjxlSystemDict);
                result.put("status",1);
            }
        }
        result.put("dictInfo", JSON.toJSONString(zjxlSystemDict));
        return result;
    }
    public List<ZjxlSystemDict> findAllType(){
        String sql = "select * from zjxl_system_dict where system_dict_is_line = 1 group by system_dict_type";
        List<ZjxlSystemDict> systemDictList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlSystemDict.class));