Merge remote-tracking branch 'origin/lixuetao' into lixuetao
# Conflicts: # adc-da-report/src/main/java/com/adc/da/report/eo/ReportFile.java # adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java # adc-da-report/src/main/java/com/adc/da/report/vo/ReportDetailVo.java # adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package com.adc.da.report;
|
||||
|
||||
import com.adc.da.report.constant.MessageTypeEnum;
|
||||
import com.adc.da.report.eo.MessageEntity;
|
||||
import com.adc.da.report.service.IMessageService;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import io.github.swagger2markup.GroupBy;
|
||||
import io.github.swagger2markup.Language;
|
||||
import io.github.swagger2markup.Swagger2MarkupConfig;
|
||||
import io.github.swagger2markup.Swagger2MarkupConverter;
|
||||
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
|
||||
import io.github.swagger2markup.markup.builder.MarkupLanguage;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
||||
public class TestMessage {
|
||||
|
||||
@Resource
|
||||
private IMessageService messageService;
|
||||
|
||||
@Test
|
||||
public void testMessagePublish() {
|
||||
MessageEntity messageEntity = new MessageEntity();
|
||||
messageEntity.setMessageTitle("测试批量发送标题")
|
||||
.setMessageType(MessageTypeEnum.SYSTEM_MESSAGE.getValue())
|
||||
.setId(UUID.randomUUID10())
|
||||
.setContent("测试测试最后一次")
|
||||
.setDelFlag(0)
|
||||
.setCreateUser("ZGGJP3N7FT")
|
||||
.setCreateDate(new Date());
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add("ZGGJP3N7FT");
|
||||
messageService.publishMessage(messageEntity, false, userIds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.report.constant;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/23 15:17
|
||||
* @Description:
|
||||
*/
|
||||
public class MessageConstants {
|
||||
|
||||
/**
|
||||
* 消息状态 未读
|
||||
*/
|
||||
public static final Integer UNREAD = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 消息状态 已读
|
||||
*/
|
||||
public static final Integer READ = 1;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.adc.da.report.constant;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/24 10:44
|
||||
* @Description:
|
||||
*/
|
||||
public enum MessageTypeEnum {
|
||||
|
||||
/**
|
||||
* 系统消息
|
||||
*/
|
||||
SYSTEM_MESSAGE(0, "系统消息");
|
||||
|
||||
/**
|
||||
* 对应值
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
MessageTypeEnum(Integer code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,15 @@ public class ReportConstants {
|
||||
*/
|
||||
public static final String NO_USER_PRIVACY_INVOLVED = "不涉及用户隐私";
|
||||
|
||||
/**
|
||||
* 流程中
|
||||
*/
|
||||
public static final Integer IN_PROCESS = 1;
|
||||
|
||||
/**
|
||||
* 不在流程中
|
||||
*/
|
||||
public static final Integer NOT_IN_PROCESS = 2;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.adc.da.report.controller;
|
||||
|
||||
import com.adc.da.report.service.IMessageService;
|
||||
import com.adc.da.report.vo.MessageQueryVo;
|
||||
import com.adc.da.report.vo.MessageVo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @Author caihaohan
|
||||
* @Date 2021/11/9 13:46
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "站内信")
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/message")
|
||||
public class MessageController {
|
||||
|
||||
|
||||
@Resource
|
||||
private IMessageService messageEntityService;
|
||||
|
||||
/**
|
||||
* 站内信消息列表
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("站内信消息列表")
|
||||
@GetMapping("/list")
|
||||
public ResponseMessage list(@Valid MessageQueryVo messageQueryVo) {
|
||||
return messageEntityService.listByCurrentUser(messageQueryVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全部已读
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("全部已读接口")
|
||||
@GetMapping("/allRead")
|
||||
public ResponseMessage allRead() {
|
||||
return messageEntityService.allRead();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.adc.da.report.dao.mysql;
|
||||
|
||||
import com.adc.da.report.eo.MessageEntity;
|
||||
import com.adc.da.report.vo.MessageQueryVo;
|
||||
import com.adc.da.report.vo.MessageVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_message】的数据库操作Mapper
|
||||
* @createDate 2023-05-23 11:22:15
|
||||
* @Entity com.adc.da.report.eo.MessageEntityEntity
|
||||
*/
|
||||
public interface MessageDao extends BaseMapper<MessageEntity> {
|
||||
|
||||
/**
|
||||
* 根据当前用户展示站内信列表
|
||||
* @param page
|
||||
* @param messageVo
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
IPage<MessageVo> listByUser(IPage<MessageVo> page, @Param("vo") MessageQueryVo messageVo, @Param("userId") String userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.report.dao.mysql;
|
||||
|
||||
import com.adc.da.report.eo.UserMessageEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_user_message】的数据库操作Mapper
|
||||
* @createDate 2023-05-23 11:30:04
|
||||
* @Entity com.adc.da.report.eo.UserMessage
|
||||
*/
|
||||
public interface UserMessageDao extends BaseMapper<UserMessageEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.adc.da.report.eo;
|
||||
|
||||
import com.adc.da.report.constant.MessageTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Caihaohan
|
||||
* @TableName ts_message
|
||||
*/
|
||||
@TableName(value ="ts_message")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class MessageEntity implements Serializable {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@TableField(value = "message_title")
|
||||
private String messageTitle;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
@TableField(value = "message_type")
|
||||
private Integer messageType;
|
||||
|
||||
/**
|
||||
* 发布人
|
||||
*/
|
||||
@TableField(value = "createUser")
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@TableField(value = "createDate")
|
||||
private Date createDate;
|
||||
|
||||
/**
|
||||
* 删除标记(0未删除 1已删除)
|
||||
*/
|
||||
@TableField(value = "del_flag")
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1314298673425876932L;
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.adc.da.report.eo;
|
||||
|
||||
import com.adc.da.login.util.UserUtils;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -11,8 +15,8 @@ import java.util.List;
|
||||
@TableName("TS_REPORT_FILE")
|
||||
public class ReportFile {
|
||||
|
||||
@TableField("id")
|
||||
private String Id;
|
||||
@TableId(value = "id",type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
@TableField("report_id")
|
||||
private String reportId;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.adc.da.report.eo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ThinkBook
|
||||
* @TableName ts_user_message
|
||||
*/
|
||||
@TableName(value ="ts_user_message")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class UserMessageEntity implements Serializable {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 站内信id
|
||||
*/
|
||||
@TableField(value = "message_id")
|
||||
private String messageId;
|
||||
|
||||
/**
|
||||
* 阅读状态(0代表未读,1代表已读)
|
||||
*/
|
||||
@TableField(value = "read_type")
|
||||
private Integer readType;
|
||||
|
||||
/**
|
||||
* 删除标记(0未删除 1已删除)
|
||||
*/
|
||||
@TableField(value = "del_flag")
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.adc.da.report.service;
|
||||
|
||||
import com.adc.da.report.eo.MessageEntity;
|
||||
import com.adc.da.report.vo.MessageQueryVo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_message】的数据库操作Service
|
||||
* @createDate 2023-05-23 11:22:15
|
||||
*/
|
||||
public interface IMessageService extends IService<MessageEntity> {
|
||||
|
||||
/**
|
||||
* 返回当前用户的消息列表
|
||||
* @return
|
||||
*/
|
||||
ResponseMessage listByCurrentUser(MessageQueryVo messageVo);
|
||||
|
||||
/**
|
||||
* 全部已读接口
|
||||
* @return
|
||||
*/
|
||||
ResponseMessage allRead();
|
||||
|
||||
/**
|
||||
* 发布站内信(当用户数过多的时候谨慎使用发送给全部用户)
|
||||
* @param message
|
||||
* @param toAllUser
|
||||
* @param userIds
|
||||
*/
|
||||
void publishMessage(MessageEntity message, boolean toAllUser, List<String> userIds);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.adc.da.report.service;
|
||||
|
||||
import com.adc.da.report.eo.UserMessageEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_user_message】的数据库操作Service
|
||||
* @createDate 2023-05-23 11:30:04
|
||||
*/
|
||||
public interface IUserMessageService extends IService<UserMessageEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.adc.da.report.service.impl;
|
||||
|
||||
import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.report.constant.MessageConstants;
|
||||
import com.adc.da.report.constant.MessageTypeEnum;
|
||||
import com.adc.da.report.constant.ReportConstants;
|
||||
import com.adc.da.report.dao.mysql.UserMessageDao;
|
||||
import com.adc.da.report.eo.UserMessageEntity;
|
||||
import com.adc.da.report.service.IUserMessageService;
|
||||
import com.adc.da.report.vo.MessageQueryVo;
|
||||
import com.adc.da.report.vo.MessageVo;
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
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.adc.da.report.eo.MessageEntity;
|
||||
import com.adc.da.report.service.IMessageService;
|
||||
import com.adc.da.report.dao.mysql.MessageDao;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_message】的数据库操作Service实现
|
||||
* @createDate 2023-05-23 11:22:15
|
||||
*/
|
||||
@Service
|
||||
public class IMessageServiceImpl extends ServiceImpl<MessageDao, MessageEntity>
|
||||
implements IMessageService {
|
||||
|
||||
@Resource
|
||||
private MessageDao messageDao;
|
||||
|
||||
@Resource
|
||||
private IUserMessageService userMessageService;
|
||||
|
||||
@Resource
|
||||
private UserEODao userEODao;
|
||||
|
||||
@Override
|
||||
public ResponseMessage listByCurrentUser(MessageQueryVo messageVo) {
|
||||
IPage<MessageVo> page = new Page<>();
|
||||
page.setCurrent(messageVo.getPageNo());
|
||||
page.setSize(messageVo.getPageSize());
|
||||
IPage<MessageVo> list = messageDao.listByUser(page, messageVo, UserUtils.getUserId());
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseMessage allRead() {
|
||||
LambdaUpdateWrapper<UserMessageEntity> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(UserMessageEntity::getReadType, MessageConstants.UNREAD);
|
||||
wrapper.eq(UserMessageEntity::getUserId, UserUtils.getUserId());
|
||||
wrapper.set(UserMessageEntity::getReadType, MessageConstants.READ);
|
||||
userMessageService.update(wrapper);
|
||||
return Result.success("全部已读");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void publishMessage(MessageEntity message, boolean toAllUser, List<String> userIds) {
|
||||
List<String> userEoIds = new ArrayList<>();
|
||||
if (toAllUser) {
|
||||
LambdaQueryWrapper<UserEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserEO::getDelFlag, 0);
|
||||
List<UserEO> userEOS = userEODao.selectList(lambdaQueryWrapper);
|
||||
if (userEOS != null) {
|
||||
userEoIds = userEOS.stream().map(UserEO::getUsid).collect(Collectors.toList());
|
||||
}
|
||||
} else {
|
||||
userEoIds = userIds;
|
||||
if (userEoIds.isEmpty()) {
|
||||
throw new AdcDaBaseException("无指定发送的用户,无法发送站内信");
|
||||
}
|
||||
}
|
||||
//保存消息信息
|
||||
save(message);
|
||||
List<UserMessageEntity> userMessageEntities = new ArrayList<>();
|
||||
userEoIds.forEach(userId -> {
|
||||
UserMessageEntity userMessageEntity = new UserMessageEntity();
|
||||
userMessageEntity.setId(UUID.randomUUID10())
|
||||
.setUserId(userId)
|
||||
.setMessageId(message.getId())
|
||||
.setReadType(MessageConstants.UNREAD)
|
||||
.setDelFlag(0);
|
||||
userMessageEntities.add(userMessageEntity);
|
||||
});
|
||||
userMessageService.saveBatch(userMessageEntities);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+71
-64
@@ -11,10 +11,7 @@ import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||
import com.adc.da.report.eo.*;
|
||||
import com.adc.da.report.service.*;
|
||||
import com.adc.da.report.util.*;
|
||||
import com.adc.da.report.vo.ChangeUploaderVo;
|
||||
import com.adc.da.report.vo.ReportDetailVo;
|
||||
import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.report.vo.*;
|
||||
import com.adc.da.sys.dao.mysql.RoleEODao;
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
@@ -23,6 +20,7 @@ import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.MenuEOService;
|
||||
import com.adc.da.sys.service.OrgEOService;
|
||||
import com.adc.da.sys.util.BeanCopyUtils;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
@@ -549,41 +547,38 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
});
|
||||
}
|
||||
|
||||
list.getRecords().forEach(c -> {
|
||||
// TODO FILE c.getFileList
|
||||
// list.getRecords().forEach(c -> {
|
||||
// FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
|
||||
FileEntity fileEntity = new FileEntity();
|
||||
if (StringUtils.isEmpty(fileEntity.getFileType())) {
|
||||
c.setFileType(null);
|
||||
}
|
||||
//ppt文件
|
||||
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("1");
|
||||
}
|
||||
//excel文件
|
||||
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("2");
|
||||
}
|
||||
//pdf文件
|
||||
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("3");
|
||||
}
|
||||
//word文件
|
||||
else {
|
||||
c.setFileType("4");
|
||||
}
|
||||
|
||||
//文件大小
|
||||
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
|
||||
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
|
||||
// TODO FILE
|
||||
// if (StringUtils.isEmpty(fileEntity.getFileType())) {
|
||||
// c.setFileType(null);
|
||||
// }
|
||||
// //ppt文件
|
||||
// else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
// ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
// c.setFileType("1");
|
||||
// }
|
||||
// //excel文件
|
||||
// else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
// ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
// c.setFileType("2");
|
||||
// }
|
||||
// //pdf文件
|
||||
// else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
// c.setFileType("3");
|
||||
// }
|
||||
// //word文件
|
||||
// else {
|
||||
// c.setFileType("4");
|
||||
// }
|
||||
//
|
||||
// //文件大小
|
||||
// c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
|
||||
// ? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
|
||||
// c.setFileName(fileEntity.getFileName());
|
||||
// List<String> userIdList = reportUserDao.selectList(
|
||||
// new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
|
||||
// .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
|
||||
});
|
||||
// });
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -635,41 +630,38 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
}
|
||||
});
|
||||
|
||||
list.getRecords().forEach(c -> {
|
||||
// TODO FILE c.getFileList
|
||||
// list.getRecords().forEach(c -> {
|
||||
// FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
|
||||
FileEntity fileEntity = new FileEntity() ;
|
||||
if (StringUtils.isEmpty(fileEntity.getFileType())) {
|
||||
c.setFileType(null);
|
||||
}
|
||||
//ppt文件
|
||||
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("1");
|
||||
}
|
||||
//excel文件
|
||||
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("2");
|
||||
}
|
||||
//pdf文件
|
||||
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("3");
|
||||
}
|
||||
//word文件
|
||||
else {
|
||||
c.setFileType("4");
|
||||
}
|
||||
|
||||
//文件大小
|
||||
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
|
||||
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
|
||||
//TODO FILE
|
||||
// if (StringUtils.isEmpty(fileEntity.getFileType())) {
|
||||
// c.setFileType(null);
|
||||
// }
|
||||
// //ppt文件
|
||||
// else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
// ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
// c.setFileType("1");
|
||||
// }
|
||||
// //excel文件
|
||||
// else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
// ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
// c.setFileType("2");
|
||||
// }
|
||||
// //pdf文件
|
||||
// else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
// c.setFileType("3");
|
||||
// }
|
||||
// //word文件
|
||||
// else {
|
||||
// c.setFileType("4");
|
||||
// }
|
||||
//
|
||||
// //文件大小
|
||||
// c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
|
||||
// ? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
|
||||
// c.setFileName(fileEntity.getFileName());
|
||||
// List<String> userIdList = reportUserDao.selectList(
|
||||
// new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
|
||||
// .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
|
||||
});
|
||||
// });
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -742,6 +734,21 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
@Override
|
||||
public ResponseMessage reportDetail(String reportId) {
|
||||
ReportDetailVo reportDetailVo = reportDao.reportDetail(reportId);
|
||||
//设置文件信息
|
||||
LambdaQueryWrapper<ReportFile> reportFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
reportFileLambdaQueryWrapper.eq(ReportFile::getReportId, reportDetailVo.getId());
|
||||
reportFileLambdaQueryWrapper.eq(ReportFile::getState, ReportConstants.NOT_IN_PROCESS);
|
||||
List<ReportFile> reportFiles = reportFileDao.selectList(reportFileLambdaQueryWrapper);
|
||||
List<String> fileIds = new ArrayList<>();
|
||||
if (reportFiles != null) {
|
||||
fileIds = reportFiles.stream().map(ReportFile::getFileId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(fileIds)) {
|
||||
List<FileEntity> fileEntities = fileDao.selectBatchIds(fileIds);
|
||||
List<FileVo> fileVos = BeanCopyUtils.copyBeanList(fileEntities, FileVo.class);
|
||||
reportDetailVo.setFileList(fileVos);
|
||||
}
|
||||
|
||||
//设置部门名称
|
||||
String department = reportDetailVo.getDepartment();
|
||||
if (StrUtil.isNotBlank(department)) {
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.adc.da.report.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.adc.da.report.eo.UserMessageEntity;
|
||||
import com.adc.da.report.service.IUserMessageService;
|
||||
import com.adc.da.report.dao.mysql.UserMessageDao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_user_message】的数据库操作Service实现
|
||||
* @createDate 2023-05-23 11:30:04
|
||||
*/
|
||||
@Service
|
||||
public class IUserMessageServiceImpl extends ServiceImpl<UserMessageDao, UserMessageEntity>
|
||||
implements IUserMessageService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FileVo {
|
||||
|
||||
/**
|
||||
* 文件主键id
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
private String fileName;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/23 14:14
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageQueryVo {
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String messageTitle;
|
||||
|
||||
/**
|
||||
* 发布人姓名
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 页数
|
||||
*/
|
||||
@Min(1)
|
||||
private int pageNo;
|
||||
|
||||
/**
|
||||
* 每页数量
|
||||
*/
|
||||
@NotNull
|
||||
private int pageSize;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import com.adc.da.report.constant.MessageTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/23 11:54
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class MessageVo {
|
||||
|
||||
/**
|
||||
* 关系表的id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String messageTitle;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private Integer messageType;
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private String messageTypeDesc;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
private Date createDate;
|
||||
|
||||
/**
|
||||
* 创建用户id
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 消息id
|
||||
*/
|
||||
private String messageId;
|
||||
|
||||
/**
|
||||
* 阅读状态(0未读 1已读)
|
||||
*/
|
||||
private Integer readType;
|
||||
|
||||
public void setMessageType(Integer messageType) {
|
||||
this.messageType = messageType;
|
||||
switch (messageType) {
|
||||
case 0:
|
||||
this.messageTypeDesc = MessageTypeEnum.SYSTEM_MESSAGE.getDesc();
|
||||
break;
|
||||
default:
|
||||
this.messageTypeDesc = "未知";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,13 +67,6 @@ public class ReportDetailVo {
|
||||
*/
|
||||
private String privacyLevel;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@@ -117,4 +110,9 @@ public class ReportDetailVo {
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ReportFile> fileList;
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*/
|
||||
private List<FileVo> fileList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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.adc.da.report.dao.mysql.MessageDao">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.report.eo.MessageEntity">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="messageType" column="message_type" jdbcType="TINYINT"/>
|
||||
<result property="createDate" column="createDate" jdbcType="TIMESTAMP"/>
|
||||
<result property="delFlag" column="del_flag" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,content,message_type,
|
||||
createDate,del_flag
|
||||
</sql>
|
||||
<select id="listByUser" resultType="com.adc.da.report.vo.MessageVo">
|
||||
SELECT
|
||||
um.id AS Id,
|
||||
um.user_id AS userId,
|
||||
um.message_id AS messageId,
|
||||
um.read_type AS readType,
|
||||
m.message_title AS messageTitle,
|
||||
m.content AS content,
|
||||
m.message_type AS messageType,
|
||||
m.createDate AS createDate,
|
||||
m.createUser AS createUser
|
||||
FROM
|
||||
ts_user_message AS um
|
||||
LEFT JOIN ts_message AS m ON um.message_id = m.id
|
||||
LEFT JOIN ts_user AS u ON m.createUser = u.USID
|
||||
WHERE
|
||||
um.del_flag = 0
|
||||
AND
|
||||
um.user_id = #{userId}
|
||||
<!--全文模糊搜索-->
|
||||
<if test="vo.messageTitle !='' and vo.messageTitle != null">
|
||||
AND m.message_title like CONCAT(CONCAT('%', #{vo.messageTitle}), '%')
|
||||
</if>
|
||||
<if test="vo.createUserName !='' and vo.createUserName != null">
|
||||
AND u.USNAME like CONCAT(CONCAT('%', #{vo.createUserName}), '%')
|
||||
</if>
|
||||
ORDER BY
|
||||
um.read_type ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -23,31 +23,6 @@
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultReportVoMap" type="com.adc.da.report.vo.ReportVo">
|
||||
<result column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="keycontent" property="keyContent" />
|
||||
<result column="maincontent" property="mainContent" />
|
||||
<result column="department" property="department" />
|
||||
<result column="year" property="year" />
|
||||
<result column="confidentialLevel" property="confidentialLevel" />
|
||||
<result column="privacyLevel" property="privacyLevel" />
|
||||
<result column="createUserId" property="createUserId" />
|
||||
<result column="uploader" property="uploader" />
|
||||
<result column="createDate" property="createDate" />
|
||||
<result column="thumbUp" property="thumbUp" />
|
||||
<result column="clicks" property="clicks" />
|
||||
<result column="download" property="download" />
|
||||
<result column="reportRating" property="reportRating" />
|
||||
<result column="isAct" property="isAct" />
|
||||
<collection property="fileList" ofType="com.adc.da.report.eo.ReportFile">
|
||||
<result column="fileId" property="fileId" />
|
||||
<result column="fileName" property="fileName" />
|
||||
<result column="rfId" property="id" />
|
||||
</collection>
|
||||
</resultMap>
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="BaseColumnList">
|
||||
id, name, keycontent, maincontent, department, year, confidentialLevel, privacyLevel,
|
||||
|
||||
Reference in New Issue
Block a user