2 커밋 51a45311c8 ... f2e68b7824

작성자 SHA1 메시지 날짜
  Twelve615 f2e68b7824 :package: 页面资源管理、获取新闻顶部资源接口 1 년 전
  Twelve615 91b607b945 :package: 新闻列表、新闻分页接口修改 1 년 전

+ 2 - 1
jlsb-vue/src/components/jeecg/JFormContainer.vue

@@ -37,6 +37,7 @@
 <style>
   .jeecg-form-container-disabled{
     cursor: not-allowed;
+    z-index: 20;
   }
   .jeecg-form-container-disabled fieldset[disabled] {
     -ms-pointer-events: none;
@@ -60,6 +61,6 @@
   }
   /*解决tinymce富文本编辑器在禁用状态下无法滚动文本框的问题*/
   .jeecg-form-container-disabled .tox .tox-sidebar-wrap {
-    z-index: 11;
+    z-index: 25;
   }
 </style>

+ 2 - 2
jlsb-vue/src/views/aa/AaNewsList.vue

@@ -34,12 +34,12 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
-      <a-button type="primary" icon="download" @click="handleExportXls('新闻列表')">导出</a-button>
+<!--      <a-button type="primary" icon="download" @click="handleExportXls('新闻列表')">导出</a-button>-->
 <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
 <!--        <a-button type="primary" icon="import">导入</a-button>-->
 <!--      </a-upload>-->
       <!-- 高级查询区域 -->
-      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+<!--      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
           <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>

+ 8 - 2
jlsb-vue/src/views/aa/modules/AaNewsForm.vue

@@ -64,7 +64,7 @@
 <script>
 
   import { httpAction, getAction } from '@/api/manage'
-  import { validateDuplicateValue } from '@/utils/util'
+  import { pushIfNotExist, validateDuplicateValue } from '@/utils/util'
 
   export default {
     name: 'AaNewsForm',
@@ -138,7 +138,13 @@
         this.edit(this.modelDefault);
       },
       edit (record) {
-        this.model = Object.assign({}, record);
+        getAction(this.url.queryById,{id:record.id}).then(res=>{
+          if (res.success) {
+            this.model = res.result;
+          } else {
+            this.model = Object.assign({}, record);
+          }
+        })
         this.visible = true;
       },
       submitForm () {

+ 19 - 8
jlsb-vue/src/views/aa/modules/AaPosterForm.vue

@@ -4,16 +4,19 @@
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
         <a-row>
           <a-col :span="24">
-            <a-form-model-item label="海报名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
+            <a-form-model-item label="资源名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
               <a-input v-model="model.name" placeholder="请输入海报名称"  ></a-input>
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
-            <a-form-model-item label="海报图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cover">
-              <j-image-upload isMultiple  v-model="model.cover" ></j-image-upload>
+            <a-form-model-item label="资源文件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cover">
+              <j-upload v-model="model.cover" :reNewFile="true" :multiple="false" :beforeUpload="this.beforeUploadHandler" ></j-upload>
+              <template slot="extra">
+                <span>推荐比例16:9</span>
+              </template>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+<!--          <a-col :span="24">
             <a-form-model-item label="链接" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="link">
               <a-input v-model="model.link" placeholder="请输入链接"  ></a-input>
             </a-form-model-item>
@@ -22,7 +25,7 @@
             <a-form-model-item label="权重" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sort">
               <a-input-number v-model="model.sort" placeholder="请输入权重" style="width: 100%" />
             </a-form-model-item>
-          </a-col>
+          </a-col>-->
         </a-row>
       </a-form-model>
     </j-form-container>
@@ -61,10 +64,10 @@
         confirmLoading: false,
         validatorRules: {
            name: [
-              { required: true, message: '请输入海报名称!'},
+              { required: true, message: '请输入资源名称!'},
            ],
            cover: [
-              { required: true, message: '请输入海报图!'},
+              { required: true, message: '请上传资源文件!'},
            ],
         },
         url: {
@@ -117,9 +120,17 @@
               that.confirmLoading = false;
             })
           }
-         
+
         })
       },
+      beforeUploadHandler(file) {
+        let fileType = file.type;
+        if(fileType.indexOf('image')<0 && fileType.indexOf('video')<0){
+          this.$message.warning('请上传图片或视频');
+          return false;
+        }
+        return true;
+      },
     }
   }
 </script>

+ 5 - 1
jlsb/jeecg-boot-module-system/pom.xml

@@ -69,6 +69,10 @@
             <version>1.4.32</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.jsoup</groupId>
+            <artifactId>jsoup</artifactId>
+        </dependency>
 
     </dependencies>
 
@@ -111,4 +115,4 @@
     <!--			</plugin>-->
     <!--		</plugins>-->
     <!--	</build>-->
-</project>
+</project>

+ 24 - 11
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/controller/APIIndexenterController.java

@@ -17,10 +17,7 @@ import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.util.RedisUtil;
-import org.jeecg.modules.aa.dto.AaCommodityDTO;
-import org.jeecg.modules.aa.dto.AaCommodityDTO2;
-import org.jeecg.modules.aa.dto.AaNewsQueryDTO;
-import org.jeecg.modules.aa.dto.SMDTO;
+import org.jeecg.modules.aa.dto.*;
 import org.jeecg.modules.aa.entity.*;
 import org.jeecg.modules.aa.service.*;
 import org.jeecg.modules.base.service.BaseCommonService;
@@ -442,18 +439,34 @@ public class APIIndexenterController {
             return result;
         }
     }
+    @ApiOperationSupport(order = 31)
+    @ApiOperation(value = "获取新闻页顶部资源", notes = "获取新闻页顶部资源")
+    @PostMapping(value = "/getNewsHeadAssets")
+    public Result<AaPoster> getNewsHeadAssets() {
+        AaPoster byId = aaPosterService.getById("1734144586119450625");
+        byId.setCover(host + "/sys/common/static/" + byId.getCover());
+        return Result.OK(byId);
+    }
+
 
     @ApiOperationSupport(order = 30)
     @ApiOperation(value="获取新闻分页列表", notes="获取新闻分页列表")
-    @GetMapping(value = "/getNewsPageList")
-    public Result<IPage<AaNews>> queryPageList(AaNews aaNews,
-                                               @ApiParam(name="pageNo",value="页数") @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-                                               @ApiParam(name="pageSize",value="每页数量") @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+    @PostMapping(value = "/getNewsPageList")
+    public Result<IPage<AaNews>> queryPageList(@RequestBody AaNewsDTO aaNews,
                                                HttpServletRequest req) {
-        if (aaNews!=null && !Strings.isNullOrEmpty(aaNews.getTitle())){
-            aaNews.setTitle("*"+aaNews.getTitle()+"*");
+        Integer pageNo = aaNews.getPageNo();
+        if (pageNo ==null) {
+            pageNo = 1;
+        }
+        Integer pageSize = aaNews.getPageSize();
+        if (pageSize == null) {
+            pageSize = 10;
+        }
+        QueryWrapper<AaNews> queryWrapper = new QueryWrapper<>();
+        if (!Strings.isNullOrEmpty(aaNews.getTypeId())){
+            queryWrapper.eq("type_id",aaNews.getTypeId());
         }
-        QueryWrapper<AaNews> queryWrapper = QueryGenerator.initQueryWrapper(aaNews, req.getParameterMap());
+        queryWrapper.select("id,pic,title,title_english,des,des_english,weight,type_id,create_time");
         queryWrapper.orderByDesc("create_time");
         Page<AaNews> page = new Page<AaNews>(pageNo, pageSize);
         IPage<AaNews> pageList = aaNewsService.page(page, queryWrapper);

+ 9 - 8
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/controller/AaNewsController.java

@@ -49,7 +49,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 public class AaNewsController extends JeecgController<AaNews, IAaNewsService> {
 	@Autowired
 	private IAaNewsService aaNewsService;
-	
+
 	/**
 	 * 分页列表查询
 	 *
@@ -67,11 +67,12 @@ public class AaNewsController extends JeecgController<AaNews, IAaNewsService> {
 								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 								   HttpServletRequest req) {
 		QueryWrapper<AaNews> queryWrapper = QueryGenerator.initQueryWrapper(aaNews, req.getParameterMap());
+		queryWrapper.select("id,pic,title,weight,type_id,create_time");
 		Page<AaNews> page = new Page<AaNews>(pageNo, pageSize);
 		IPage<AaNews> pageList = aaNewsService.page(page, queryWrapper);
 		return Result.OK(pageList);
 	}
-	
+
 	/**
 	 *   添加
 	 *
@@ -82,10 +83,10 @@ public class AaNewsController extends JeecgController<AaNews, IAaNewsService> {
 	@ApiOperation(value="新闻列表-添加", notes="新闻列表-添加")
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody AaNews aaNews) {
-		aaNewsService.save(aaNews);
+		aaNewsService.saveNews(aaNews);
 		return Result.OK("添加成功!");
 	}
-	
+
 	/**
 	 *  编辑
 	 *
@@ -96,10 +97,10 @@ public class AaNewsController extends JeecgController<AaNews, IAaNewsService> {
 	@ApiOperation(value="新闻列表-编辑", notes="新闻列表-编辑")
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
 	public Result<String> edit(@RequestBody AaNews aaNews) {
-		aaNewsService.updateById(aaNews);
+		aaNewsService.updateNewsById(aaNews);
 		return Result.OK("编辑成功!");
 	}
-	
+
 	/**
 	 *   通过id删除
 	 *
@@ -113,7 +114,7 @@ public class AaNewsController extends JeecgController<AaNews, IAaNewsService> {
 		aaNewsService.removeById(id);
 		return Result.OK("删除成功!");
 	}
-	
+
 	/**
 	 *  批量删除
 	 *
@@ -127,7 +128,7 @@ public class AaNewsController extends JeecgController<AaNews, IAaNewsService> {
 		this.aaNewsService.removeByIds(Arrays.asList(ids.split(",")));
 		return Result.OK("批量删除成功!");
 	}
-	
+
 	/**
 	 * 通过id查询
 	 *

+ 27 - 0
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/dto/AaNewsDTO.java

@@ -0,0 +1,27 @@
+package org.jeecg.modules.aa.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @author 王葆权
+ * @Title:
+ * @Package org.jeecg.modules.aa.dto
+ * @Description:
+ * @date 2023/12/12 10:38
+ */
+@Data
+@ApiModel(value="新闻列表分页查询对象", description="新闻列表分页查询对象")
+public class AaNewsDTO {
+    @ApiModelProperty(value = "页数")
+    Integer pageNo;
+    @ApiModelProperty(value = "每页大小")
+    Integer pageSize;
+    @ApiModelProperty(value = "分类id")
+    String typeId;
+}

+ 12 - 0
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/entity/AaNews.java

@@ -51,6 +51,18 @@ public class AaNews implements Serializable {
 	@Excel(name = "新闻标题德语", width = 15)
     @ApiModelProperty(value = "新闻标题德语")
     private String titleGerman;
+    /**新闻内容*/
+    @Excel(name = "新闻摘要", width = 15)
+    @ApiModelProperty(value = "新闻内容")
+    private String des;
+    /**新闻内容英语*/
+    @Excel(name = "新闻摘要英语", width = 15)
+    @ApiModelProperty(value = "新闻内容英语")
+    private String desEnglish;
+    ///**新闻内容德语*/
+    //@Excel(name = "新闻内容德语", width = 15)
+    //@ApiModelProperty(value = "新闻内容德语")
+    //private String desGerman;
 	/**新闻内容*/
 	@Excel(name = "新闻内容", width = 15)
     @ApiModelProperty(value = "新闻内容")

+ 8 - 8
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/entity/AaPoster.java

@@ -27,7 +27,7 @@ import lombok.experimental.Accessors;
 @TableName("aa_poster")
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
-@ApiModel(value="aa_poster对象", description="海报管理")
+@ApiModel(value="aa_poster对象", description="页面资源管理")
 public class AaPoster implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -36,21 +36,21 @@ public class AaPoster implements Serializable {
     @ApiModelProperty(value = "id")
     private String id;
 	/**海报名称*/
-	@Excel(name = "海报名称", width = 15)
-    @ApiModelProperty(value = "海报名称")
+	@Excel(name = "资源名称", width = 15)
+    @ApiModelProperty(value = "资源名称")
     private String name;
 	/**海报图*/
-	@Excel(name = "海报图", width = 15)
+	@Excel(name = "资源连接", width = 15)
     @ApiModelProperty(value = "海报图")
     private String cover;
 	/**链接*/
-	@Excel(name = "链接", width = 15)
+/*	@Excel(name = "链接", width = 15)
     @ApiModelProperty(value = "链接")
-    private String link;
+    private String link;*/
 	/**权重*/
-	@Excel(name = "权重", width = 15)
+/*	@Excel(name = "权重", width = 15)
     @ApiModelProperty(value = "权重")
-    private Integer sort;
+    private Integer sort;*/
 	/**创建时间*/
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")

+ 11 - 0
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/service/IAaNewsService.java

@@ -11,4 +11,15 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IAaNewsService extends IService<AaNews> {
 
+    /**
+     * 保存新闻
+     * @param aaNews
+     */
+    void saveNews(AaNews aaNews);
+
+    /**
+     * 修改新闻
+     * @param aaNews
+     */
+    void updateNewsById(AaNews aaNews);
 }

+ 38 - 0
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/service/impl/AaNewsServiceImpl.java

@@ -1,8 +1,11 @@
 package org.jeecg.modules.aa.service.impl;
 
+import cn.hutool.http.HtmlUtil;
+import com.google.common.base.Strings;
 import org.jeecg.modules.aa.entity.AaNews;
 import org.jeecg.modules.aa.mapper.AaNewsMapper;
 import org.jeecg.modules.aa.service.IAaNewsService;
+import org.jsoup.Jsoup;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -16,4 +19,39 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class AaNewsServiceImpl extends ServiceImpl<AaNewsMapper, AaNews> implements IAaNewsService {
 
+    @Override
+    public void saveNews(AaNews aaNews) {
+        aaNews.setDes(getDes(aaNews.getContent()));
+        aaNews.setDesEnglish(getDes(aaNews.getContentEnglish()));
+        save(aaNews);
+    }
+
+    @Override
+    public void updateNewsById(AaNews aaNews) {
+        aaNews.setDes(getDes(aaNews.getContent()));
+        aaNews.setDesEnglish(getDes(aaNews.getContentEnglish()));
+        updateById(aaNews);
+    }
+
+    /**
+     * 获取摘要
+     * 将html标签换行等内容去除,只留下纯文本内容
+     * @param content 富文本
+     * @return 文本字符
+     */
+    private String getDes(String content) {
+        if (Strings.isNullOrEmpty(content)) {
+            return null;
+        }
+        String text = Jsoup.parse(content).text();
+        if (Strings.isNullOrEmpty(text)) {
+            return null;
+        } else {
+            if (text.length() > 200) {
+                return text.substring(0,200);
+            } else {
+                return text;
+            }
+        }
+    }
 }

+ 6 - 0
jlsb/pom.xml

@@ -50,6 +50,7 @@
 		<!-- Log4j2爆雷漏洞 -->
 		<log4j2.version>2.17.0</log4j2.version>
 		<logback.version>1.2.9</logback.version>
+		<jsoup.version>1.10.2</jsoup.version>
 	</properties>
 
 	<modules>
@@ -296,6 +297,11 @@
 					</exclusion>
 				</exclusions>
 			</dependency>
+			<dependency>
+				<groupId>org.jsoup</groupId>
+				<artifactId>jsoup</artifactId>
+				<version>${jsoup.version}</version>
+			</dependency>
 		</dependencies>
 	</dependencyManagement>