Merge remote-tracking branch 'origin/master'

This commit is contained in:
LiuY 2022-04-29 15:10:58 +08:00
commit 648657dba0
7 changed files with 140 additions and 77 deletions

View File

@ -31,6 +31,33 @@ public class MailAppController extends DefaultBaseController {
@Autowired
private IMailService mailService;
@ApiOperation(value = "保存邮件已读状态", notes = "保存邮件已读状态")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "id", value = "邮件ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save-app-mail-read-tag/{id}")
public SuccessResult saveAppMailReadTag(@RequestHeader("token") String token,
@PathVariable("id") String id){
Map<String, Object> params = requestParams();
params.put("id", id);
mailService.saveAppMailReadTag(token, params);
return new SuccessResult();
}
@ApiOperation(value = "用户未读邮件数量", notes = "用户未读邮件数量")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-app-user-unread-mail")
public Integer getAppUserUnreadMail(@RequestHeader("token") String token){
Map<String, Object> params = requestParams();
Integer unreadCounts = mailService.getAppUserUnreadMail(token, params);
return unreadCounts;
}
@ApiOperation(value = "批量发送内部邮件接口", notes = "批量发送内部邮件接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
@ -51,7 +78,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "keywords", value = "标题|收件人姓名", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-page-app=send-mail")
@GetMapping("list-page-app-send-mail")
public SuccessResultList<List<MailSendDTO>> listPageAppSendMail(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
@ -63,7 +90,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-app=send-mail/{mailId}")
@GetMapping("get-app-send-mail/{mailId}")
public MailSendDTO getAppSendMail(@RequestHeader("token") String token,
@PathVariable("mailId") String mailId){
Map<String, Object> params = requestParams();
@ -79,7 +106,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-page-app=inbox-mail")
@GetMapping("list-page-app-inbox-mail")
public SuccessResultList<List<MailInboxDTO>> listPageAppInboxMail(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
@ -92,7 +119,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-app=inbox-mail/{id}")
@GetMapping("get-app-inbox-mail/{id}")
public MailInboxDTO getAppInboxMail(@RequestHeader("token") String token,
@PathVariable("id") String id){
Map<String, Object> params = requestParams();
@ -123,7 +150,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-page-app=draft-mail")
@GetMapping("list-page-app-draft-mail")
public SuccessResultList<List<MailSendDTO>> listPageAppDraftMail(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
@ -135,7 +162,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-app=draft-mail/{mailId}")
@GetMapping("get-app-draft-mail/{mailId}")
public MailSendDTO getAppDraftMail(@RequestHeader("token") String token,
@PathVariable("mailId") String mailId){
Map<String, Object> params = requestParams();
@ -179,7 +206,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-page-app=del-mail")
@GetMapping("list-page-app-del-mail")
public SuccessResultList<List<MailDelDTO>> listPageAppDelMail(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
@ -192,7 +219,7 @@ public class MailAppController extends DefaultBaseController {
@ApiImplicitParam(name = "id", value = "Id值", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-app=del-mail/{id}")
@GetMapping("get-app-del-mail/{id}")
public MailDelDTO getAppDelMail(@RequestHeader("token") String token,
@PathVariable("id") String id){
Map<String, Object> params = requestParams();

View File

@ -51,4 +51,8 @@ public interface IMailDao {
void deleteDelMail(String ids);
void deleteAppDelMailAll(Map<String, Object> query);
void saveMailReadTag(Map<String, Object> saveMap);
Map<String, Object> getUserMailReadTag(Map<String, Object> params);
}

View File

@ -2,6 +2,7 @@ package cn.com.tenlion.systemoa.pojo.dtos.mail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.ToString;
@ -49,4 +50,9 @@ public class MailInboxDTO {
private String secretTypes;
@ApiModelProperty(name = "creatorNames", value = "发件人姓名")
private String creatorNames;
@ApiModelProperty(name = "readTag", value = "阅读状态0未读1已读")
private Integer readTag;
@ApiModelProperty(name = "readTime", value = "阅读时间")
private String readTime;
}

View File

@ -229,46 +229,6 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
}
}
/*List<FileUploadDTO> fileUploadDTOList = fileUploadDao.list(params);
if(null != fileUploadDTOList && fileUploadDTOList.size() > 0) {
Iterator it = fileUploadDTOList.iterator();
while(it.hasNext()) {
FileUploadDTO fileUploadDTO = (FileUploadDTO) it.next();
params.put("fileTypeId", fileUploadDTO.getFileTypeId());
params.put("fileUploadId", fileUploadDTO.getFileUploadId());
String typeBelong = null;
if(null != params.get("typeBelong")) {
typeBelong = params.get("typeBelong").toString();
if("共享文档".equals(typeBelong)) {
typeBelong = "个人文档";
}
}
if(null != params.get("typeBelong") && "共享文档".equals(params.get("typeBelong").toString())) {
List<FileRoleDTO> fileRoleDTOList = fileTypeService.getShare(params);
if(null == fileRoleDTOList || fileRoleDTOList.size() == 0) {
it.remove();
continue;
}
}
params.remove("typeBelong");
params.remove("creator");
FileTypeDTO fileTypeDTO = fileTypeService.get(params);
params.put("typeBelong", typeBelong);
if(null != params.get("typeBelong") && null != fileTypeDTO) {
if(!params.get("typeBelong").toString().equals(fileTypeDTO.getTypeBelong())) {
it.remove();
continue;
}
}
FileTypeDTO fileTypeDTO1 = fileTypeService.getName(fileUploadDTO.getFileTypeId());
if(null != fileTypeDTO1) {
fileUploadDTO.setCatalogueType(fileTypeDTO1.getTypeBelong());
fileUploadDTO.setCatalogueName(fileTypeDTO1.getTypeName());
}
}
}*/
// 新逻辑
List<FileUploadDTO> fileUploadDTOList = null;
if(null != params.get("typeBelong")) {
@ -287,6 +247,7 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
if(null != fileTypeDTO && "公共文档".equals(fileTypeDTO.getTypeBelong())) {
iterator.remove();
}
fileUploadDTO.setCatalogueId(fileTypeDTO.getFileTypeId());
fileUploadDTO.setCatalogueName(fileTypeDTO.getTypeName());
fileUploadDTO.setCatalogueType(fileTypeDTO.getTypeBelong());
}
@ -317,6 +278,7 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
params.remove("creator");
FileTypeDTO fileTypeDTO = fileTypeService.get(params);
if(null != fileTypeDTO) {
fileUploadDTO.setCatalogueId(fileTypeDTO.getFileTypeId());
fileUploadDTO.setCatalogueName(fileTypeDTO.getTypeName());
fileUploadDTO.setCatalogueType(fileTypeDTO.getTypeBelong());
}
@ -343,6 +305,7 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
continue;
}
if(null != fileTypeDTO) {
fileUploadDTO.setCatalogueId(fileTypeDTO.getFileTypeId());
fileUploadDTO.setCatalogueName(fileTypeDTO.getTypeName());
fileUploadDTO.setCatalogueType(fileTypeDTO.getTypeBelong());
}
@ -377,6 +340,18 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
}
}
if(null != fileUploadDTOList && fileUploadDTOList.size() > 0) {
Iterator<FileUploadDTO> it = fileUploadDTOList.iterator();
String fileTypeId = null == params.get("cataId") ? null : params.get("cataId").toString();
while (it.hasNext() && null != fileTypeId) {
FileUploadDTO fileUploadDTO = it.next();
if(!fileTypeId.equals(fileUploadDTO.getFileTypeId())) {
it.remove();
}
}
}
return fileUploadDTOList;
}

View File

@ -100,4 +100,8 @@ public interface IMailService {
void deleteAppDraftMail(String token, String ids);
void deleteAppDelMailAll(String token);
Integer getAppUserUnreadMail(String token, Map<String, Object> params);
void saveAppMailReadTag(String token, Map<String, Object> params);
}

View File

@ -43,6 +43,28 @@ public class MailServiceImpl extends DefaultBaseService implements IMailService
@Autowired
private IUserService userService;
@Override
public void saveAppMailReadTag(String token, Map<String, Object> params) {
AppTokenUser appTokenUser = getAppTokenUser(token);
String id = params.get("id").toString();
Map<String, Object> saveMap = new HashMap<>(8);
saveMap.put("id", id);
saveMap.put("userId", appTokenUser.getId());
saveMap.put("readTime", DateUtil.getTime());
mailDao.saveMailReadTag(saveMap);
}
@Override
public Integer getAppUserUnreadMail(String token, Map<String, Object> params) {
AppTokenUser appTokenUser = getAppTokenUser(token);
if(appTokenUser == null || "".equals(appTokenUser.getId())){
return 0;
}
params.clear();
params.put("userId", appTokenUser.getId());
List<MailInboxDTO> list = mailDao.listInboxMail(params);
return list == null ? 0 : list.size();
}
@Override
public void saveSendMail(MailSendVO vo) {
@ -146,44 +168,46 @@ public class MailServiceImpl extends DefaultBaseService implements IMailService
params.put("userId", appTokenUser.getId());
PageHelper.startPage(page.getPage(), page.getRows());
List<MailInboxDTO> list = mailDao.listInboxMail(params);
// 处理发件人
for (MailInboxDTO item : list){
// 处理发件人
String creatorId = item.getCreator();
UserDTO userDTO = userService.get(creatorId);
String creatorNames = userDTO.getUserUsername() + "[" + userDTO.getUserName() + "]";
item.setCreatorNames(creatorNames);
}
// 处理抄送情况
for(MailInboxDTO item : list){
if(item.getCopyForIds() == null || "".equals(item.getCopyForIds())){
continue;
}
String[] copyForIds = item.getCopyForIds().split(",");
for (String str : copyForIds){
if(str.equals(appTokenUser.getId())){
item.setCopyForTypes("1");
continue;
// 处理抄送情况
if(item.getCopyForIds() != null && !"".equals(item.getCopyForIds())){
String[] copyForIds = item.getCopyForIds().split(",");
for (String str : copyForIds){
if(str.equals(appTokenUser.getId())){
item.setCopyForTypes("1");
continue;
}
}
}
}
// 处理密送情况
for(MailInboxDTO item : list){
if(item.getSecretIds() == null || "".equals(item.getSecretIds())){
continue;
}
String[] secretIds = item.getSecretIds().split(",");
for (String str : secretIds){
String tempId = "";
String tempName = "";
if(str.equals(appTokenUser.getId())){
tempId = str;
tempName = appTokenUser.getUsername() + "[" + appTokenUser.getName() + "]";
item.setSecretIds(tempId);
item.setSecretNames(tempName);
item.setSecretTypes("1");
continue;
// 处理密送情况
if(item.getSecretIds() != null && !"".equals(item.getSecretIds())){
String[] secretIds = item.getSecretIds().split(",");
for (String str : secretIds){
String tempId = "";
String tempName = "";
if(str.equals(appTokenUser.getId())){
tempId = str;
tempName = appTokenUser.getUsername() + "[" + appTokenUser.getName() + "]";
item.setSecretIds(tempId);
item.setSecretNames(tempName);
item.setSecretTypes("1");
continue;
}
}
}
// 处理阅读状态
params.put("id", item.getId());
Map<String, Object> readTagMap = mailDao.getUserMailReadTag(params);
item.setReadTag(0);
if(readTagMap != null){
item.setReadTag(1);
item.setReadTime(readTagMap.get("readTime").toString());
}
}
PageInfo<MailInboxDTO> pageInfo = new PageInfo<>(list);
return new SuccessResultList<>(list, pageInfo.getPageNum(), pageInfo.getTotal());

View File

@ -60,6 +60,29 @@
<result column="del_time" property="delTime"/>
</resultMap>
<!-- 添加已阅记录 -->
<insert id="saveMailReadTag" parameterType="map">
INSERT INTO oa_mail_read_tag (
id, user_id, read_time
) VALUES (
#{id}, #{userId}, #{readTime}
)
</insert>
<!-- 查询邮件是否已读 -->
<select id="getUserMailReadTag" parameterType="map" resultType="map">
SELECT
id,
user_id userId,
read_time readTime
FROM
oa_mail_read_tag
WHERE
id = # {id}
AND user_id = #{userId}
LIMIT 1
</select>
<!-- 发信 -->
<insert id="saveSendMail" parameterType="map">
INSERT INTO oa_mail_send(