xiaoyong931011
2020-08-14 c3392f5f16d3258f38170640a02fb3449ab09e2b
20200814 代码提交
4 files added
5 files modified
216 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/helpCenter/controller/HelpCenterController.java 23 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/dao/HelpCenterTypeDao.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/dto/NewNoticeTypePageDto.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/dto/NoticePageDto.java 31 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/entity/HelpCenterTypeEntity.java 10 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/service/HelpCenterService.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java 79 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/vo/NewNoticeTypeInfoVo.java 19 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/helpCenter/HelpCenterTypeDao.xml 14 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/helpCenter/controller/HelpCenterController.java
@@ -13,9 +13,12 @@
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.dto.NewNoticeTypePageDto;
import com.xcong.excoin.modules.helpCenter.dto.NoticePageDto;
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.NewNoticeTypeInfoVo;
import com.xcong.excoin.modules.helpCenter.vo.NoticeInfoVo;
import io.swagger.annotations.Api;
@@ -35,6 +38,26 @@
    HelpCenterService helpCenterService;
    
    /**
     *  公告类别列表
     */
    @ApiOperation(value="公告类别列表", notes="公告类别列表")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = NewNoticeTypeInfoVo.class)})
    @PostMapping(value = "/getNewNoticeTypeList")
    public Result  getNewNoticeTypeList(@RequestBody @Valid NewNoticeTypePageDto newNoticeTypePageDto) {
        return helpCenterService.getNewNoticeTypeList(newNoticeTypePageDto);
    }
    /**
     *  公告列表
     */
    @ApiOperation(value="公告列表", notes="公告列表")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = NewNoticeInfoVo.class)})
    @PostMapping(value = "/getNoticeList")
    public Result  getNoticeList(@RequestBody @Valid NoticePageDto noticePageDto) {
        return helpCenterService.getNoticeList(noticePageDto);
    }
    /**
     *  最新公告
     */
    @ApiOperation(value="最新公告", notes="最新公告")
src/main/java/com/xcong/excoin/modules/helpCenter/dao/HelpCenterTypeDao.java
@@ -1,8 +1,15 @@
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.HelpCenterTypeEntity;
public interface HelpCenterTypeDao extends BaseMapper<HelpCenterTypeEntity> {
    IPage<HelpCenterTypeEntity> getNoticeTypeList(Page<HelpCenterTypeEntity> page,
            @Param("record") HelpCenterTypeEntity helpCenterTypeEntity);
}
src/main/java/com/xcong/excoin/modules/helpCenter/dto/NewNoticeTypePageDto.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 = "NewNoticeTypePageDto", description = "参数接受类")
public class NewNoticeTypePageDto {
    @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/NoticePageDto.java
New file
@@ -0,0 +1,31 @@
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 = "NoticePageDto", description = "参数接受类")
public class NoticePageDto {
    @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;
    @NotNull
    @ApiModelProperty(value = "ID", example = "1")
    private Long id;
}
src/main/java/com/xcong/excoin/modules/helpCenter/entity/HelpCenterTypeEntity.java
@@ -16,7 +16,7 @@
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;
    /**
     * 所属类别(1:公告类型2:语言类型)
     * 所属类别(1:帮助中心类别2:...)
     */
    private int status;
    /**
@@ -24,12 +24,12 @@
     */
    private int type;
    /**
     * 语言类型(1:简体中文2:英文)
     */
    private int typeLanguage;
    /**
     *类型内容
     */
    private String content;
    /**
     *类型内容
     */
    private String contentUs;
}
src/main/java/com/xcong/excoin/modules/helpCenter/service/HelpCenterService.java
@@ -7,6 +7,8 @@
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.dto.NewNoticeTypePageDto;
import com.xcong.excoin.modules.helpCenter.dto.NoticePageDto;
import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity;
public interface HelpCenterService extends IService<HelpCenterNoticeEntity> {
@@ -17,5 +19,9 @@
    Result getNoticeInfo(long id);
    Result getNewNoticeTypeList(@Valid NewNoticeTypePageDto newNoticeTypePageDto);
    Result getNoticeList(@Valid NoticePageDto noticePageDto);
}
src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java
@@ -2,7 +2,9 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.validation.Valid;
@@ -15,13 +17,18 @@
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.dao.HelpCenterTypeDao;
import com.xcong.excoin.modules.helpCenter.dto.ImportantNoticePageDto;
import com.xcong.excoin.modules.helpCenter.dto.NewNoticePageDto;
import com.xcong.excoin.modules.helpCenter.dto.NewNoticeTypePageDto;
import com.xcong.excoin.modules.helpCenter.dto.NoticePageDto;
import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity;
import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity;
import com.xcong.excoin.modules.helpCenter.entity.HelpCenterTypeEntity;
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.NewNoticeTypeInfoVo;
import com.xcong.excoin.modules.helpCenter.vo.NoticeInfoVo;
import cn.hutool.core.collection.CollUtil;
@@ -36,6 +43,8 @@
    private HelpCenterArticleDao helpCenterArticleDao;
    @Resource
    private HelpCenterNoticeDao helpCenterNoticeDao;
    @Resource
    private HelpCenterTypeDao helpCenterTypeDao;
    
    @Override
    public Result getNewNoticeList(@Valid NewNoticePageDto newNoticePageDto) {
@@ -136,6 +145,76 @@
        return Result.ok(noticeInfoVo);
    }
    @Override
    public Result getNewNoticeTypeList(@Valid NewNoticeTypePageDto newNoticeTypePageDto) {
        List<NewNoticeTypeInfoVo> arrayList = new ArrayList<>();
        Page<HelpCenterTypeEntity> page = new Page<>(newNoticeTypePageDto.getPageNum(), newNoticeTypePageDto.getPageSize());
        //获取【类别】
        HelpCenterTypeEntity helpCenterTypeEntity = new HelpCenterTypeEntity();
        IPage<HelpCenterTypeEntity> helpCenterTypeEntitys = helpCenterTypeDao.getNoticeTypeList(page, helpCenterTypeEntity);
        List<HelpCenterTypeEntity> records = helpCenterTypeEntitys.getRecords();
        if(CollUtil.isNotEmpty(records)) {
            for(HelpCenterTypeEntity helpCenterType : records) {
                NewNoticeTypeInfoVo noticeInfoVo = new NewNoticeTypeInfoVo();
                Long id = helpCenterType.getId();
                noticeInfoVo.setId(id);
                int type = newNoticeTypePageDto.getType();
                if(type == 2) {
                    String contentUs = helpCenterType.getContentUs();
                    noticeInfoVo.setContent(contentUs);
                }else {
                    String content = helpCenterType.getContent();
                    noticeInfoVo.setContent(content);
                }
                arrayList.add(noticeInfoVo);
            }
        }
        return Result.ok(arrayList);
    }
    @Override
    public Result getNoticeList(@Valid NoticePageDto noticePageDto) {
        List<NewNoticeInfoVo> arrayList = new ArrayList<>();
        int noticeType = noticePageDto.getType();
        //获取【类别】数据
        Long id = noticePageDto.getId();
        HelpCenterTypeEntity helpCenterTypeEntity = helpCenterTypeDao.selectById(id);
        if(ObjectUtil.isNotEmpty(helpCenterTypeEntity)) {
            int type = helpCenterTypeEntity.getType();
            //获取对应的【帮助中心公告】
            Map<String, Object> columnMap = new HashMap<String, Object>();
            columnMap.put("article_notice", type);
            List<HelpCenterNoticeEntity> helpCenterNoticeEntitys = helpCenterNoticeDao.selectByMap(columnMap);
            if(CollUtil.isNotEmpty(helpCenterNoticeEntitys)) {
                for(HelpCenterNoticeEntity helpCenterNoticeEntity : helpCenterNoticeEntitys) {
                    NewNoticeInfoVo newNoticeInfoVo = new NewNoticeInfoVo();
                    Long noticeId = helpCenterNoticeEntity.getId();
                    newNoticeInfoVo.setId(noticeId);
                    String createBy = helpCenterNoticeEntity.getCreateBy();
                    newNoticeInfoVo.setCreateBy(createBy);
                    Date createTime = helpCenterNoticeEntity.getCreateTime();
                    newNoticeInfoVo.setCreateTime(createTime);
                    if(noticeType == 2) {
                        Long articleIdUs = helpCenterNoticeEntity.getArticleIdUs();
                        newNoticeInfoVo.setArticleId(articleIdUs);
                        String articleTitle = helpCenterNoticeEntity.getArticleTitleUs();
                        newNoticeInfoVo.setArticleTitle(articleTitle);
                    }else {
                        Long articleId = helpCenterNoticeEntity.getArticleId();
                        newNoticeInfoVo.setArticleId(articleId);
                        String articleTitle = helpCenterNoticeEntity.getArticleTitle();
                        helpCenterNoticeEntity.getArticleTitle();
                        newNoticeInfoVo.setArticleTitle(articleTitle);
                    }
                }
            }
        }
        return Result.ok(arrayList);
    }
    
    
src/main/java/com/xcong/excoin/modules/helpCenter/vo/NewNoticeTypeInfoVo.java
New file
@@ -0,0 +1,19 @@
package com.xcong.excoin.modules.helpCenter.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "NewNoticeTypeInfoVo", description = "参数返回类")
public class NewNoticeTypeInfoVo {
    @ApiModelProperty("ID")
    private Long id;
    /**
     *类型内容
     */
    @ApiModelProperty("类型内容")
    private String content;
}
src/main/resources/mapper/helpCenter/HelpCenterTypeDao.xml
New file
@@ -0,0 +1,14 @@
<?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.HelpCenterTypeDao">
    <select id="getNoticeTypeList" resultType="com.xcong.excoin.modules.helpCenter.entity.HelpCenterTypeEntity">
        SELECT
            *
        FROM
            help_center_type
        WHERE
            status = 1
    </select>
</mapper>