This commit is contained in:
parent
3e0652034e
commit
b994aeefd8
@ -71,24 +71,5 @@ public class MessageController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 指派时消息
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/message/assign")
|
|
||||||
public BaseResponse messageAssign(
|
|
||||||
@RequestParam Integer pId,
|
|
||||||
@RequestParam Integer systemId,
|
|
||||||
@RequestParam Integer moddleId,
|
|
||||||
@RequestParam Long uId,
|
|
||||||
@RequestParam Long isPass,
|
|
||||||
HttpServletRequest request) {
|
|
||||||
//messageService.messageAdd(pId, systemId, moddleId, uId, isPass, request);
|
|
||||||
return ResultUtil.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.apache.ibatis.annotations.Update;
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@ -115,4 +116,9 @@ public interface ProjectMapper {
|
|||||||
|
|
||||||
@Select("select principal_id from organize_oa.oa_project_work where pid=#{id}")
|
@Select("select principal_id from organize_oa.oa_project_work where pid=#{id}")
|
||||||
List <Long> getMemberBySystemId(Integer id);
|
List <Long> getMemberBySystemId(Integer id);
|
||||||
|
|
||||||
|
@Select("select * from organize_oa.oa_project_work "
|
||||||
|
+ "where DATE(deadline) = DATE(#{threeDayLater}) and is_finish != 1")
|
||||||
|
List<ProjectWorkDO> getProjectWorkByTime(LocalDateTime threeDayLater);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,6 @@ public interface MessageService {
|
|||||||
void messageAdd(Integer pId, Integer type, Integer systemId, HttpServletRequest request);
|
void messageAdd(Integer pId, Integer type, Integer systemId, HttpServletRequest request);
|
||||||
void messageAdd(Integer pId, Integer systmeId, Integer moddleId, Integer type, HttpServletRequest request);
|
void messageAdd(Integer pId, Integer systmeId, Integer moddleId, Integer type, HttpServletRequest request);
|
||||||
void messageAdd(Integer pId, Integer systemId, Integer moddleId);
|
void messageAdd(Integer pId, Integer systemId, Integer moddleId);
|
||||||
|
|
||||||
|
void messageRemind();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.jsl.oa.dao.UserDAO;
|
|||||||
import com.jsl.oa.mapper.MessageMapper;
|
import com.jsl.oa.mapper.MessageMapper;
|
||||||
import com.jsl.oa.mapper.ProjectMapper;
|
import com.jsl.oa.mapper.ProjectMapper;
|
||||||
import com.jsl.oa.model.dodata.MessageDO;
|
import com.jsl.oa.model.dodata.MessageDO;
|
||||||
|
import com.jsl.oa.model.dodata.ProjectWorkDO;
|
||||||
import com.jsl.oa.model.vodata.MessageAddVO;
|
import com.jsl.oa.model.vodata.MessageAddVO;
|
||||||
import com.jsl.oa.model.vodata.MessageGetVO;
|
import com.jsl.oa.model.vodata.MessageGetVO;
|
||||||
import com.jsl.oa.services.MessageService;
|
import com.jsl.oa.services.MessageService;
|
||||||
@ -246,7 +247,7 @@ public class MessageServiceImpl implements MessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加日报消息
|
* 添加成员填写日报消息
|
||||||
*
|
*
|
||||||
* @param pId 项目id
|
* @param pId 项目id
|
||||||
* @param systemId 系统id
|
* @param systemId 系统id
|
||||||
@ -272,6 +273,76 @@ public class MessageServiceImpl implements MessageService {
|
|||||||
messageMapper.messageAdd(messageAddVO);
|
messageMapper.messageAdd(messageAddVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加提醒消息
|
||||||
|
* 系统/模块到期提醒
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void messageRemind() {
|
||||||
|
// 当前时间
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
// 三天后时间
|
||||||
|
LocalDateTime threeDaysLater = now.plusDays(3);
|
||||||
|
// 七天后时间
|
||||||
|
LocalDateTime sevenDaysLater = now.plusDays(7);
|
||||||
|
// 获取三天后到期的系统/模块
|
||||||
|
List<ProjectWorkDO> projectWorkDOList = projectMapper.getProjectWorkByTime(threeDaysLater);
|
||||||
|
// 获取七天后到期的系统/模块
|
||||||
|
List<ProjectWorkDO> projectWorkDOList1 = projectMapper.getProjectWorkByTime(sevenDaysLater);
|
||||||
|
if (!projectWorkDOList1.isEmpty()) {
|
||||||
|
for (ProjectWorkDO projectWorkDO : projectWorkDOList) {
|
||||||
|
// 添加消息
|
||||||
|
MessageAddVO messageAddVO = new MessageAddVO();
|
||||||
|
messageAddVO.setUid(projectWorkDO.getPrincipalId());
|
||||||
|
messageAddVO.setTitle("提醒消息");
|
||||||
|
// 0:系统 1:模块
|
||||||
|
String projectName = projectMapper
|
||||||
|
.tgetProjectById(projectWorkDO.getProjectId().intValue()).getName();
|
||||||
|
String systemName;
|
||||||
|
if (projectWorkDO.getType() == 1) {
|
||||||
|
systemName = projectMapper.getWorkById(projectWorkDO.getPid().intValue()).getName();
|
||||||
|
String moddleName = projectMapper.getWorkById(projectWorkDO.getId().intValue()).getName();
|
||||||
|
messageAddVO.setText("您负责的" + projectName + "项目的" + systemName + "系统的" + moddleName + "模块"
|
||||||
|
+ "还有七天就要到期了,请及时处理");
|
||||||
|
messageAddVO.setType("跳转模块页");
|
||||||
|
} else {
|
||||||
|
systemName = projectMapper.getWorkById(projectWorkDO.getId().intValue()).getName();
|
||||||
|
messageAddVO.setText("您负责的" + projectName + "项目的" + systemName + "系统"
|
||||||
|
+ "还有七天就要到期了,请及时处理");
|
||||||
|
messageAddVO.setType("跳转系统页");
|
||||||
|
}
|
||||||
|
messageAddVO.setToId(projectWorkDO.getId().intValue());
|
||||||
|
messageMapper.messageAdd(messageAddVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!projectWorkDOList.isEmpty()) {
|
||||||
|
for (ProjectWorkDO projectWorkDO : projectWorkDOList) {
|
||||||
|
// 添加消息
|
||||||
|
MessageAddVO messageAddVO = new MessageAddVO();
|
||||||
|
messageAddVO.setUid(projectWorkDO.getPrincipalId());
|
||||||
|
messageAddVO.setTitle("提醒消息");
|
||||||
|
// 0:系统 1:模块
|
||||||
|
String projectName = projectMapper
|
||||||
|
.tgetProjectById(projectWorkDO.getProjectId().intValue()).getName();
|
||||||
|
String systemName;
|
||||||
|
if (projectWorkDO.getType() == 1) {
|
||||||
|
systemName = projectMapper.getWorkById(projectWorkDO.getPid().intValue()).getName();
|
||||||
|
String moddleName = projectMapper.getWorkById(projectWorkDO.getId().intValue()).getName();
|
||||||
|
messageAddVO.setText("您负责的" + projectName + "项目的" + systemName + "系统的" + moddleName + "模块"
|
||||||
|
+ "还有三天就要到期了,请及时处理");
|
||||||
|
messageAddVO.setType("跳转模块页");
|
||||||
|
} else {
|
||||||
|
systemName = projectMapper.getWorkById(projectWorkDO.getId().intValue()).getName();
|
||||||
|
messageAddVO.setText("您负责的" + projectName + "项目的" + systemName + "系统"
|
||||||
|
+ "还有三天就要到期了,请及时处理");
|
||||||
|
messageAddVO.setType("跳转系统页");
|
||||||
|
}
|
||||||
|
messageAddVO.setToId(projectWorkDO.getId().intValue());
|
||||||
|
messageMapper.messageAdd(messageAddVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.jsl.oa.services.timese;
|
||||||
|
|
||||||
|
|
||||||
|
import com.jsl.oa.services.MessageService;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class MessageTimeTask {
|
||||||
|
@Resource
|
||||||
|
private MessageService messageService;
|
||||||
|
|
||||||
|
// 每天0点执行一次
|
||||||
|
@Scheduled(cron = "0 0 0 * * ?")
|
||||||
|
public void messageRemind() {
|
||||||
|
messageService.messageRemind();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user