src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java
@@ -54,6 +54,7 @@ .antMatchers("/api/orderCoin/findCollect").permitAll() .antMatchers("/api/orderCoin/findCollect").permitAll() .antMatchers("/api/documentary/getFollowTraderProfitInfo").permitAll() .antMatchers("/api/helpCenter/**").permitAll() .anyRequest().authenticated() .and().apply(securityConfiguereAdapter()); } src/main/java/com/xcong/excoin/modules/helpCenter/controller/HelpCenterController.java
New file @@ -0,0 +1,67 @@ package com.xcong.excoin.modules.helpCenter.controller; import javax.annotation.Resource; import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.helpCenter.dto.ImportantNoticePageDto; import com.xcong.excoin.modules.helpCenter.dto.NewNoticePageDto; import com.xcong.excoin.modules.helpCenter.service.HelpCenterService; import com.xcong.excoin.modules.helpCenter.vo.ImportantNoticeVo; import com.xcong.excoin.modules.helpCenter.vo.NewNoticeInfoVo; import com.xcong.excoin.modules.helpCenter.vo.NoticeInfoVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import lombok.extern.slf4j.Slf4j; @RestController @Slf4j @RequestMapping(value = "/api/helpCenter") @Api(value = "HelpCenterController", tags = "帮助中心") public class HelpCenterController { @Resource HelpCenterService helpCenterService; /** * 最新公告 */ @ApiOperation(value="最新公告", notes="最新公告") @ApiResponses({@ApiResponse( code = 200, message = "success", response = NewNoticeInfoVo.class)}) @PostMapping(value = "/getNewNoticeList") public Result getNewNoticeList(@RequestBody @Valid NewNoticePageDto newNoticePageDto) { return helpCenterService.getNewNoticeList(newNoticePageDto); } /** * 重要公告 */ @ApiOperation(value="重要公告", notes="重要公告") @ApiResponses({@ApiResponse( code = 200, message = "success", response = ImportantNoticeVo.class)}) @PostMapping(value = "/getImportantNoticeList") public Result getImportantNoticeList(@RequestBody @Valid ImportantNoticePageDto importantNoticePageDto) { return helpCenterService.getImportantNoticeList(importantNoticePageDto); } /** * 公告详情 */ @ApiOperation(value="公告详情", notes="公告详情") @ApiResponses({@ApiResponse( code = 200, message = "success", response = NoticeInfoVo.class)}) @GetMapping(value = "/getNoticeInfo") public Result getNoticeInfo(@ApiParam(name = "Id", value = "ID", example = "1") @RequestParam(value = "Id", required = false) long Id) { return helpCenterService.getNoticeInfo(Id); } } src/main/java/com/xcong/excoin/modules/helpCenter/dao/HelpCenterArticleDao.java
New file @@ -0,0 +1,8 @@ package com.xcong.excoin.modules.helpCenter.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity; public interface HelpCenterArticleDao extends BaseMapper<HelpCenterArticleEntity> { } src/main/java/com/xcong/excoin/modules/helpCenter/dao/HelpCenterNoticeDao.java
New file @@ -0,0 +1,18 @@ package com.xcong.excoin.modules.helpCenter.dao; import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity; public interface HelpCenterNoticeDao extends BaseMapper<HelpCenterNoticeEntity> { IPage<HelpCenterNoticeEntity> getNewNoticeList(Page<HelpCenterNoticeEntity> page, @Param("record")HelpCenterNoticeEntity helpCenterNoticeEntity); IPage<HelpCenterNoticeEntity> getImportantNoticeList(Page<HelpCenterNoticeEntity> page, @Param("record")HelpCenterNoticeEntity helpCenterNoticeEntity); } src/main/java/com/xcong/excoin/modules/helpCenter/dao/HelpCenterTypeDao.java
New file @@ -0,0 +1,8 @@ package com.xcong.excoin.modules.helpCenter.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.helpCenter.entity.HelpCenterTypeEntity; public interface HelpCenterTypeDao extends BaseMapper<HelpCenterTypeEntity> { } src/main/java/com/xcong/excoin/modules/helpCenter/dto/ImportantNoticePageDto.java
New file @@ -0,0 +1,27 @@ package com.xcong.excoin.modules.helpCenter.dto; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "ImportantNoticePageDto", description = "参数接受类") public class ImportantNoticePageDto { @NotNull @Min(1) @ApiModelProperty(value = "第几页", example = "1") private int pageNum; @NotNull @ApiModelProperty(value = "每页数量", example = "10") private int pageSize; @NotNull @ApiModelProperty(value = "类型1:中文2:英文", example = "1") private int type; } src/main/java/com/xcong/excoin/modules/helpCenter/dto/NewNoticePageDto.java
New file @@ -0,0 +1,27 @@ package com.xcong.excoin.modules.helpCenter.dto; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "NewNoticePageDto", description = "参数接受类") public class NewNoticePageDto { @NotNull @Min(1) @ApiModelProperty(value = "第几页", example = "1") private int pageNum; @NotNull @ApiModelProperty(value = "每页数量", example = "10") private int pageSize; @NotNull @ApiModelProperty(value = "类型1:中文2:英文", example = "1") private int type; } src/main/java/com/xcong/excoin/modules/helpCenter/dto/NoticeInfoDto.java
New file @@ -0,0 +1,19 @@ package com.xcong.excoin.modules.helpCenter.dto; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "NoticeInfoDto", description = "参数接受类") public class NoticeInfoDto { @NotNull @ApiModelProperty(value = "文章id", example = "10") private Long id; @NotNull @ApiModelProperty(value = "类型1:中文2:英文", example = "1") private int type; } src/main/java/com/xcong/excoin/modules/helpCenter/entity/HelpCenterArticleEntity.java
New file @@ -0,0 +1,43 @@ package com.xcong.excoin.modules.helpCenter.entity; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; /** * 文章内容 */ @Data @TableName("help_center_article") public class HelpCenterArticleEntity { @TableId(value = "id",type = IdType.AUTO) private Long id; /** * 创建者 */ private String createBy; /** * 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; /** * 语言类型(1:简体中文2:英文) */ private int typeLanguage; /** * 标题 */ private String title; /** * 内容 */ private String content; } src/main/java/com/xcong/excoin/modules/helpCenter/entity/HelpCenterNoticeEntity.java
New file @@ -0,0 +1,51 @@ package com.xcong.excoin.modules.helpCenter.entity; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; /** * 帮助中心公告 */ @Data @TableName("help_center_notice") public class HelpCenterNoticeEntity { @TableId(value = "id",type = IdType.AUTO) private Long id; /** * 创建者 */ private String createBy; /** * 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; /** * 所属类别(1:最新公告2:重要公告) */ private int articleNotice; /** * 文章id */ private Long articleId; /** *文章标题 */ private String articleTitle; /** * 文章id */ private Long articleIdUs; /** *文章标题 */ private String articleTitleUs; } src/main/java/com/xcong/excoin/modules/helpCenter/entity/HelpCenterTypeEntity.java
New file @@ -0,0 +1,35 @@ package com.xcong.excoin.modules.helpCenter.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * 帮助中心类别 */ @Data @TableName("help_center_type") public class HelpCenterTypeEntity { @TableId(value = "id",type = IdType.AUTO) private Long id; /** * 所属类别(1:公告类型2:语言类型) */ private int status; /** * 类型标识 */ private int type; /** * 语言类型(1:简体中文2:英文) */ private int typeLanguage; /** *类型内容 */ private String content; } src/main/java/com/xcong/excoin/modules/helpCenter/service/HelpCenterService.java
New file @@ -0,0 +1,21 @@ package com.xcong.excoin.modules.helpCenter.service; import javax.validation.Valid; import com.baomidou.mybatisplus.extension.service.IService; import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.helpCenter.dto.ImportantNoticePageDto; import com.xcong.excoin.modules.helpCenter.dto.NewNoticePageDto; import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity; public interface HelpCenterService extends IService<HelpCenterNoticeEntity> { Result getNewNoticeList(@Valid NewNoticePageDto newNoticePageDto); Result getImportantNoticeList(@Valid ImportantNoticePageDto importantNoticePageDto); Result getNoticeInfo(long id); } src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java
New file @@ -0,0 +1,164 @@ package com.xcong.excoin.modules.helpCenter.service.impl; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.annotation.Resource; import javax.validation.Valid; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.helpCenter.dao.HelpCenterArticleDao; import com.xcong.excoin.modules.helpCenter.dao.HelpCenterNoticeDao; import com.xcong.excoin.modules.helpCenter.dto.ImportantNoticePageDto; import com.xcong.excoin.modules.helpCenter.dto.NewNoticePageDto; import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity; import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity; import com.xcong.excoin.modules.helpCenter.service.HelpCenterService; import com.xcong.excoin.modules.helpCenter.vo.ImportantNoticeVo; import com.xcong.excoin.modules.helpCenter.vo.NewNoticeInfoVo; import com.xcong.excoin.modules.helpCenter.vo.NoticeInfoVo; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import lombok.extern.slf4j.Slf4j; @Slf4j @Service public class HelpCenterServiceImpl extends ServiceImpl<HelpCenterNoticeDao, HelpCenterNoticeEntity> implements HelpCenterService { @Resource private HelpCenterArticleDao helpCenterArticleDao; @Resource private HelpCenterNoticeDao helpCenterNoticeDao; @Override public Result getNewNoticeList(@Valid NewNoticePageDto newNoticePageDto) { List<NewNoticeInfoVo> arrayList = new ArrayList<>(); Page<HelpCenterNoticeEntity> page = new Page<>(newNoticePageDto.getPageNum(), newNoticePageDto.getPageSize()); //获取【帮助中心公告】 HelpCenterNoticeEntity helpCenterNoticeEntity = new HelpCenterNoticeEntity(); IPage<HelpCenterNoticeEntity> HelpCenterNoticeEntitys = helpCenterNoticeDao.getNewNoticeList(page, helpCenterNoticeEntity); List<HelpCenterNoticeEntity> records = HelpCenterNoticeEntitys.getRecords(); if(CollUtil.isNotEmpty(records)) { for(HelpCenterNoticeEntity helpCenterNotice : records) { NewNoticeInfoVo newNoticeInfoVo = new NewNoticeInfoVo(); Long id = helpCenterNotice.getId(); newNoticeInfoVo.setId(id); String createBy = helpCenterNotice.getCreateBy(); newNoticeInfoVo.setCreateBy(createBy); Date createTime = helpCenterNotice.getCreateTime(); newNoticeInfoVo.setCreateTime(createTime); int articleNotice = helpCenterNotice.getArticleNotice(); newNoticeInfoVo.setArticleNotice(articleNotice); int type = newNoticePageDto.getType(); if(type == 2) { Long articleIdUs = helpCenterNotice.getArticleIdUs(); newNoticeInfoVo.setArticleId(articleIdUs); String articleTitleUs = helpCenterNotice.getArticleTitleUs(); newNoticeInfoVo.setArticleTitle(articleTitleUs); }else { Long articleId = helpCenterNotice.getArticleId(); newNoticeInfoVo.setArticleId(articleId); String articleTitle = helpCenterNotice.getArticleTitle(); newNoticeInfoVo.setArticleTitle(articleTitle); } arrayList.add(newNoticeInfoVo); } } return Result.ok(arrayList); } @Override public Result getImportantNoticeList(@Valid ImportantNoticePageDto importantNoticePageDto) { List<ImportantNoticeVo> arrayList = new ArrayList<>(); Page<HelpCenterNoticeEntity> page = new Page<>(importantNoticePageDto.getPageNum(), importantNoticePageDto.getPageSize()); //获取【帮助中心公告】 HelpCenterNoticeEntity helpCenterNoticeEntity = new HelpCenterNoticeEntity(); IPage<HelpCenterNoticeEntity> HelpCenterNoticeEntitys = helpCenterNoticeDao.getImportantNoticeList(page, helpCenterNoticeEntity); List<HelpCenterNoticeEntity> records = HelpCenterNoticeEntitys.getRecords(); if(CollUtil.isNotEmpty(records)) { for(HelpCenterNoticeEntity helpCenterNotice : records) { ImportantNoticeVo noticeInfoVo = new ImportantNoticeVo(); Long id = helpCenterNotice.getId(); noticeInfoVo.setId(id); String createBy = helpCenterNotice.getCreateBy(); noticeInfoVo.setCreateBy(createBy); Date createTime = helpCenterNotice.getCreateTime(); noticeInfoVo.setCreateTime(createTime); int articleNotice = helpCenterNotice.getArticleNotice(); noticeInfoVo.setArticleNotice(articleNotice); int type = importantNoticePageDto.getType(); if(type == 2) { Long articleIdUs = helpCenterNotice.getArticleIdUs(); noticeInfoVo.setArticleId(articleIdUs); String articleTitleUs = helpCenterNotice.getArticleTitleUs(); noticeInfoVo.setArticleTitle(articleTitleUs); }else { Long articleId = helpCenterNotice.getArticleId(); noticeInfoVo.setArticleId(articleId); String articleTitle = helpCenterNotice.getArticleTitle(); noticeInfoVo.setArticleTitle(articleTitle); } arrayList.add(noticeInfoVo); } } return Result.ok(arrayList); } @Override public Result getNoticeInfo(long id) { HelpCenterArticleEntity helpCenterArticleEntity = helpCenterArticleDao.selectById(id); NoticeInfoVo noticeInfoVo = new NoticeInfoVo(); if(ObjectUtil.isNotEmpty(helpCenterArticleEntity)) { String content = helpCenterArticleEntity.getContent(); noticeInfoVo.setContent(content); String createBy = helpCenterArticleEntity.getCreateBy(); noticeInfoVo.setCreateBy(createBy); Date createTime = helpCenterArticleEntity.getCreateTime(); noticeInfoVo.setCreateTime(createTime); String title = helpCenterArticleEntity.getTitle(); noticeInfoVo.setTitle(title); int typeLanguage = helpCenterArticleEntity.getTypeLanguage(); noticeInfoVo.setTypeLanguage(typeLanguage); noticeInfoVo.setId(id); } return Result.ok(noticeInfoVo); } } src/main/java/com/xcong/excoin/modules/helpCenter/vo/ImportantNoticeVo.java
New file @@ -0,0 +1,44 @@ package com.xcong.excoin.modules.helpCenter.vo; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "ImportantNoticeVo", description = "参数返回类") public class ImportantNoticeVo { @ApiModelProperty("ID") private Long id; /** * 创建者 */ @ApiModelProperty("创建者") private String createBy; /** * 创建时间 */ @ApiModelProperty("创建时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; /** * 所属类别(1:最新公告2:重要公告) */ @ApiModelProperty("所属类别(1:最新公告2:重要公告)") private int articleNotice; /** * 文章id */ @ApiModelProperty("文章id") private Long articleId; /** *文章标题 */ @ApiModelProperty("文章标题") private String articleTitle; } src/main/java/com/xcong/excoin/modules/helpCenter/vo/NewNoticeInfoVo.java
New file @@ -0,0 +1,44 @@ package com.xcong.excoin.modules.helpCenter.vo; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "NewNoticeInfoVo", description = "参数返回类") public class NewNoticeInfoVo { @ApiModelProperty("ID") private Long id; /** * 创建者 */ @ApiModelProperty("创建者") private String createBy; /** * 创建时间 */ @ApiModelProperty("创建时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; /** * 所属类别(1:最新公告2:重要公告) */ @ApiModelProperty("所属类别(1:最新公告2:重要公告)") private int articleNotice; /** * 文章id */ @ApiModelProperty("文章id") private Long articleId; /** *文章标题 */ @ApiModelProperty("文章标题") private String articleTitle; } src/main/java/com/xcong/excoin/modules/helpCenter/vo/NoticeInfoVo.java
New file @@ -0,0 +1,43 @@ package com.xcong.excoin.modules.helpCenter.vo; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "NoticeInfoVo", description = "参数返回类") public class NoticeInfoVo { @ApiModelProperty("ID") private Long id; /** * 创建者 */ @ApiModelProperty("创建者") private String createBy; /** * 创建时间 */ @ApiModelProperty("创建时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; /** * 语言类型(1:简体中文2:英文) */ @ApiModelProperty("语言类型(1:简体中文2:英文)") private int typeLanguage; /** * 标题 */ @ApiModelProperty("标题") private String title; /** * 内容 */ @ApiModelProperty("内容") private String content; } src/main/resources/mapper/helpCenter/HelpCenterNoticeDao.xml
New file @@ -0,0 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xcong.excoin.modules.helpCenter.dao.HelpCenterNoticeDao"> <select id="getNewNoticeList" resultType="com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity"> SELECT * FROM help_center_notice WHERE article_notice = 1 ORDER BY create_time DESC </select> <select id="getImportantNoticeList" resultType="com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity"> SELECT * FROM help_center_notice WHERE article_notice = 2 ORDER BY create_time DESC </select> </mapper>