tjf 3 лет назад
Родитель
Сommit
3b7d6431b3
18 измененных файлов с 74 добавлено и 12 удалено
  1. 1 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ColumnNewsController.java
  2. 2 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FriendLinkController.java
  3. 2 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ImageDataController.java
  4. 2 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/QueryConfigController.java
  5. 34 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/QueryController.java
  6. 2 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ReportDetailController.java
  7. 2 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ReportQueryLogController.java
  8. 13 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java
  9. 2 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ColumnNews.java
  10. 0 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  11. 4 4
      ruoyi-system/src/main/resources/mapper/system/ColumnNewsMapper.xml
  12. 1 0
      ruoyi-system/src/main/resources/mapper/system/FriendLinkMapper.xml
  13. 2 0
      ruoyi-system/src/main/resources/mapper/system/ImageDataMapper.xml
  14. 1 0
      ruoyi-system/src/main/resources/mapper/system/InspectInforMapper.xml
  15. 1 0
      ruoyi-system/src/main/resources/mapper/system/QueryConfigMapper.xml
  16. 1 0
      ruoyi-system/src/main/resources/mapper/system/ReportDetailMapper.xml
  17. 1 0
      ruoyi-system/src/main/resources/mapper/system/ReportQueryLogMapper.xml
  18. 3 7
      ruoyi-ui/src/views/system/news/index.vue

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ColumnNewsController.java

@@ -90,6 +90,7 @@ public class ColumnNewsController extends BaseController
     @PutMapping
     public AjaxResult edit(@Validated @RequestBody ColumnNews columnNews)
     {
+        columnNews.setUpdateBy(getUsername());
         return toAjax(columnNewsService.updateColumnNews(columnNews));
     }
 

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FriendLinkController.java

@@ -77,6 +77,7 @@ public class FriendLinkController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody FriendLink friendLink)
     {
+        friendLink.setCreateBy(getUsername());
         return toAjax(friendLinkService.insertFriendLink(friendLink));
     }
 
@@ -88,6 +89,7 @@ public class FriendLinkController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody FriendLink friendLink)
     {
+        friendLink.setUpdateBy(getUsername());
         return toAjax(friendLinkService.updateFriendLink(friendLink));
     }
 

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ImageDataController.java

@@ -78,6 +78,7 @@ public class ImageDataController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody ImageDatas imageDatas)
     {
+        imageDatas.setCreateBy(getUsername());
         return toAjax(imageDataService.insertImageData(imageDatas));
     }
 
@@ -89,6 +90,7 @@ public class ImageDataController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody ImageDatas imageDatas)
     {
+        imageDatas.setUpdateBy(getUsername());
         return toAjax(imageDataService.updateImageData(imageDatas));
     }
 

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/QueryConfigController.java

@@ -77,6 +77,7 @@ public class QueryConfigController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody QueryConfig queryConfig)
     {
+        queryConfig.setCreateBy(getUsername());
         return toAjax(queryConfigService.insertQueryConfig(queryConfig));
     }
 
@@ -88,6 +89,7 @@ public class QueryConfigController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody QueryConfig queryConfig)
     {
+        queryConfig.setUpdateBy(getUsername());
         return toAjax(queryConfigService.updateQueryConfig(queryConfig));
     }
 

+ 34 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/QueryController.java

@@ -1,17 +1,21 @@
 package com.ruoyi.web.controller.system;
 
 import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.ColumnNavigationBar;
 import com.ruoyi.common.core.domain.entity.ColumnNews;
 import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.framework.config.ServerConfig;
 import com.ruoyi.system.domain.*;
 import com.ruoyi.system.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
@@ -45,6 +49,10 @@ public class QueryController extends BaseController {
     @Autowired
     private IInspectInforService inspectInforService;
 
+
+    @Autowired
+    private ServerConfig serverConfig;
+
     /**
      * 门户查询报告信息
      */
@@ -173,4 +181,30 @@ public class QueryController extends BaseController {
     {
         return queryService.sendSms(reportQueryLog);
     }
+
+    /**
+     * 门户上传请求
+     */
+    @PostMapping("/common/upload")
+    public AjaxResult uploadFile(MultipartFile file) throws Exception
+    {
+        try
+        {
+            // 上传文件路径
+            String filePath = RuoYiConfig.getUploadPath();
+            // 上传并返回新文件名称
+            String fileName = FileUploadUtils.upload(filePath, file);
+            String originalFilename = file.getOriginalFilename();
+            String url = serverConfig.getUrl() + fileName;
+            AjaxResult ajax = AjaxResult.success();
+            ajax.put("fileName", fileName);
+            ajax.put("originalFilename", originalFilename);
+            ajax.put("url", url);
+            return ajax;
+        }
+        catch (Exception e)
+        {
+            return AjaxResult.error(e.getMessage());
+        }
+    }
 }

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ReportDetailController.java

@@ -83,6 +83,7 @@ public class ReportDetailController extends BaseController
         {
             return AjaxResult.error("新增报告信息'" + reportDetail.getReportNumber() + "'失败,报告编号已存在");
         }
+        reportDetail.setCreateBy(getUsername());
         return toAjax(reportDetailService.insertReportDetail(reportDetail));
     }
 
@@ -98,6 +99,7 @@ public class ReportDetailController extends BaseController
         {
             return AjaxResult.error("修改报告信息'" + reportDetail.getReportNumber() + "'失败,报告编号已存在");
         }
+        reportDetail.setUpdateBy(getUsername());
         return toAjax(reportDetailService.updateReportDetail(reportDetail));
     }
 

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ReportQueryLogController.java

@@ -78,6 +78,7 @@ public class ReportQueryLogController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody ReportQueryLog reportQueryLog)
     {
+        reportQueryLog.setCreateBy(getUsername());
         return toAjax(reportQueryLogService.insertReportQueryLog(reportQueryLog));
     }
 
@@ -89,6 +90,7 @@ public class ReportQueryLogController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody ReportQueryLog reportQueryLog)
     {
+        reportQueryLog.setUpdateBy(getUsername());
         return toAjax(reportQueryLogService.updateReportQueryLog(reportQueryLog));
     }
 

+ 13 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java

@@ -22,6 +22,10 @@ public class TreeSelect implements Serializable
 
     /** 节点名称 */
     private String label;
+    /**
+     * 展开方式
+     */
+    private String openMode;
 
     /** 子节点 */
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
@@ -49,6 +53,7 @@ public class TreeSelect implements Serializable
     public TreeSelect(ColumnNavigationBar columnNavigationBar) {
         this.id = columnNavigationBar.getColumnId();
         this.label = columnNavigationBar.getColumnName();
+        this.openMode = columnNavigationBar.getOpenMode();
         this.children = columnNavigationBar.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
     }
 
@@ -81,4 +86,12 @@ public class TreeSelect implements Serializable
     {
         this.children = children;
     }
+
+    public String getOpenMode() {
+        return openMode;
+    }
+
+    public void setOpenMode(String openMode) {
+        this.openMode = openMode;
+    }
 }

+ 2 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ColumnNews.java

@@ -1,5 +1,6 @@
 package com.ruoyi.common.core.domain.entity;
 
+import com.ruoyi.common.xss.Xss;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -92,6 +93,7 @@ public class ColumnNews extends BaseEntity
         this.newsTitle = newsTitle;
     }
 
+    @Xss(message = "标题不能包含脚本字符")
     public String getNewsTitle() 
     {
         return newsTitle;

+ 0 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -113,7 +113,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
                 .antMatchers("/gateway/query/**").anonymous()
-                .antMatchers("/common/upload/**").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 4 - 4
ruoyi-system/src/main/resources/mapper/system/ColumnNewsMapper.xml

@@ -40,7 +40,7 @@
             <if test="columnName != null  and columnName != ''">and c.column_name = #{columnName}</if>
             <if test="isTop != null  and isTop != ''">and n.is_top = #{isTop}</if>
 
-        order by n.create_time,n.update_time
+        order by n.create_time DESC , n.update_time DESC
     </select>
 
     <select id="selectColumnNewsListMenHu" parameterType="ColumnNews" resultMap="ColumnNewsResult">
@@ -54,7 +54,7 @@
         <if test="columnId != null  and columnId != ''">and n.column_id = #{columnId}</if>
         <if test="isTop != null  and isTop != ''">and n.is_top = #{isTop}</if>
 
-        order by n.create_time,n.update_time
+        order by n.create_time DESC,n.update_time DESC
     </select>
 
     <select id="selectColumnNewsListMenHuByColumnId" parameterType="Long" resultMap="ColumnNewsResult">
@@ -63,7 +63,7 @@
         n.status = '0'
         and n.is_del = 'N'
         <if test="columnId != null  and columnId != ''">and n.column_id = #{columnId}</if>
-        order by n.create_time,n.update_time limit 6
+        order by n.create_time DESC,n.update_time DESC limit 6
     </select>
 
     <select id="selectColumnNewsByNewsId" parameterType="Integer" resultMap="ColumnNewsResult">
@@ -73,7 +73,7 @@
 
     <select id="selectColumnNewsDetailMenHu" parameterType="Integer" resultMap="ColumnNewsResult">
         select n.news_id, n.news_title, n.column_id, n.news_content, n.status,  n.reason, n.create_by, n.create_time, n.update_by, n.update_time, n.remark,n.news_image from column_news n
-        where n.news_id = #{newsId}
+        where n.news_id = #{newsId}  order by n.create_time DESC,n.update_time DESC
     </select>
 
     <insert id="insertColumnNews" parameterType="ColumnNews" useGeneratedKeys="true" keyProperty="newsId">

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/FriendLinkMapper.xml

@@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="linkSpace != null  and linkSpace != ''"> and link_space = #{linkSpace}</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
 
+        order by create_time DESC
     </select>
     
     <select id="selectFriendLinkByLinkId" parameterType="Long" resultMap="FriendLinkResult">

+ 2 - 0
ruoyi-system/src/main/resources/mapper/system/ImageDataMapper.xml

@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         is_del = 'N'
         <if test="imageName != null  and imageName != ''"> and image_name like concat('%', #{imageName}, '%')</if>
         <if test="type != null  and type != ''"> and type = #{type}</if>
+        order by create_time DESC
     </select>
 
     <select id="selectImageDatasListMenHu" parameterType="ImageDatas" resultMap="ImageDataResult">
@@ -38,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         and status = '0'
         <if test="imageName != null  and imageName != ''"> and image_name like concat('%', #{imageName}, '%')</if>
         <if test="type != null  and type != ''"> and type = #{type}</if>
+        order by create_time DESC
     </select>
     
     <select id="selectImageDatasByImageId" parameterType="Long" resultMap="ImageDataResult">

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/InspectInforMapper.xml

@@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="manufacturerPhone != null  and manufacturerPhone != ''"> and manufacturer_phone = #{manufacturerPhone}</if>
             <if test="inspectedName != null  and inspectedName != ''"> and inspected_name like concat('%', #{inspectedName}, '%')</if>
             <if test="inspectedPhone != null  and inspectedPhone != ''"> and inspected_phone = #{inspectedPhone}</if>
+        order by create_time DESC
     </select>
     
     <select id="selectInspectInforByInspectId" parameterType="Long" resultMap="InspectInforResult">

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/QueryConfigMapper.xml

@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and is_del = 'N'
             <if test="queryType != null  and queryType != ''"> and query_type = #{queryType}</if>
             <if test="queryMode != null  and queryMode != ''"> and query_mode = #{queryMode}</if>
+        order by create_time DESC
     </select>
 
     <select id="selectQueryConfigByConfigId" parameterType="Long" resultMap="QueryConfigResult">

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/ReportDetailMapper.xml

@@ -43,6 +43,7 @@
             </if>
             <if test="isQualify != null  and isQualify != ''">and is_qualify = #{isQualify}</if>
             <if test="reportUrl != null  and reportUrl != ''">and report_url = #{reportUrl}</if>
+        order by create_time DESC
     </select>
 
     <select id="selectReportDetailByReportId" parameterType="Long" resultMap="ReportDetailResult">

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/ReportQueryLogMapper.xml

@@ -42,6 +42,7 @@
         <if test="queryType != null  and queryType != ''">and query_type = #{queryType}</if>
         <if test="queryMode != null  and queryMode != ''">and query_mode = #{queryMode}</if>
         <if test="queryNum != null  and queryNum != ''">and query_num = #{queryNum}</if>
+        order by create_time DESC
     </select>
 
     <select id="selectReportQueryLogByLogId" parameterType="Long" resultMap="ReportQueryLogResult">

+ 3 - 7
ruoyi-ui/src/views/system/news/index.vue

@@ -160,7 +160,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="文章内容" prop="newsContent">
+        <el-form-item label="文章内容">
           <editor v-model="form.newsContent" :min-height="192"/>
         </el-form-item>
 <!--        <el-form-item label="文章状态">
@@ -224,7 +224,6 @@ export default {
         pageNum: 1,
         pageSize: 10,
         newsTitle: null,
-        newsContent: null,
         columnId: null,
         status: null,
         isDel: null,
@@ -241,10 +240,7 @@ export default {
         ],
         isTop: [
           { required: true, message: "是否头条不能为空", trigger: "blur" }
-        ],
-        newsContent: [
-          { required: true, message: "文章内容不能为空", trigger: "blur" }
-        ],
+        ]
       },
       boh:{}  //驳回原因
     };
@@ -273,7 +269,7 @@ export default {
         newsId: null,
         newsTitle: null,
         columnId: null,
-        newsContent: null,
+        newsContent: undefined,
         status: "0",
         isTop: null,
         isDel: null,