eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/conferenceRoom/service/impl/MeetingRoomReservationServiceImpl.java
@@ -24,13 +24,12 @@ import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomRepository; import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomDto; import me.zhengjie.modules.constant.Constant; import me.zhengjie.modules.quartz.service.OpaiDingTalkService; import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl; import me.zhengjie.modules.system.domain.CustomerResources; import me.zhengjie.modules.system.domain.Role; import me.zhengjie.modules.system.domain.User; import me.zhengjie.modules.system.repository.UserRepository; import me.zhengjie.utils.ValidationUtil; import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.*; import lombok.RequiredArgsConstructor; import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomReservationRepository; import me.zhengjie.modules.conferenceRoom.service.MeetingRoomReservationService; @@ -42,9 +41,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import me.zhengjie.utils.PageUtil; import me.zhengjie.utils.QueryHelp; import me.zhengjie.utils.SecurityUtils; import java.text.SimpleDateFormat; import java.util.*; @@ -65,7 +61,7 @@ private final MeetingRoomReservationRepository meetingRoomReservationRepository; private final MeetingRoomReservationMapper meetingRoomReservationMapper; private final MeetingRoomRepository meetingRoomRepository; private final OpaiDingTalkService opaiDingTalkService; private final WeComServiceImpl weComService; private final UserRepository userRepository; @Override @@ -113,8 +109,8 @@ throw new BadRequestException("预约时间冲突," + errorFormat.format(errorMeetingRoomReservation.getStartTime()) + "至" + errorFormat.format(errorMeetingRoomReservation.getEndTime()) + "已经存在会议室预约,请调整时间"); }else{ //调用钉钉公共方法 setDingding(resources); // 发送通知 sendNotice(resources); } return meetingRoomReservationMapper.toDto(meetingRoomReservationRepository.save(resources)); } @@ -139,41 +135,45 @@ throw new BadRequestException("预约时间冲突," + errorFormat.format(errorMeetingRoomReservation.getStartTime()) + "至" + errorFormat.format(errorMeetingRoomReservation.getEndTime()) + "已经存在会议室预约,请调整时间"); }else{ setDingding(resources); // 发送通知 sendNotice(resources); } meetingRoomReservationRepository.save(meetingRoomReservation); } /** * 发送钉钉公共方法 * 向其他应用发送通知公共方法 * * @param resources * @return * @throws Exception */ public void setDingding(MeetingRoomReservation resources) throws Exception { // 获取存储用户钉钉号 List<String> dingDingList = new ArrayList<>(); public void sendNotice(MeetingRoomReservation resources) { // 获取存储用户企微ID List<String> weComList = new ArrayList<>(); // 查询用户 List<User> userList = userRepository.findAll(); for(User user : userList){ Role role = user.getRoles().iterator().next(); // 获取项目组长级以上的用户的钉钉id // 获取项目组长级以上的用户的企微ID if(Long.valueOf(role.getLevel()) <= Constant.ROLE_LEVEL_LEADER){ if(ObjectUtils.isNotEmpty(user.getDingding())){ dingDingList.add(user.getDingding()); if (StringUtils.isNotBlank(user.getWeComId())) { weComList.add(user.getWeComId()); } } } // 查询会议室 MeetingRoom meetingRoom = meetingRoomRepository.findById(resources.getMeetingId()).orElseGet(MeetingRoom::new); // 发送内容至钉钉 opaiDingTalkService.sendNotice(dingDingList, "会议室预约提示", "### 会议室预约提示 \n >" + " \n 会议主题:" + resources.getMeetingTheme() + " \n 预订者:" + SecurityUtils.getCurrentUsername() + " \n 会议室:" + meetingRoom.getConferenceRoomName() + " \n 开始时间: " + resources.getStartTime().toString().substring(0,19) + " \n 结束时间: " + resources.getEndTime().toString().substring(0,19) + " \n 会议室预约有变更,请登录PMS系统查看。", "card"); // 发送内容至企微 weComService.sendNotice(weComList, "会议室预约提示", String.format("<div class=\"normal\">会议主题:%s</div>" + "<div class=\"normal\">预订者:%s</div>" + "<div class=\"normal\">会议室:%s</div>" + "<div class=\"normal\">开始时间:%s</div>" + "<div class=\"normal\">结束时间:%s</div>" + "<div class=\"highlight\">会议室预约有变更,请登录PMS系统查看。</div>", resources.getMeetingTheme(), SecurityUtils.getCurrentUsername(), meetingRoom.getConferenceRoomName(), resources.getStartTime().toString().substring(0,19), resources.getEndTime().toString().substring(0,19)), Constant.WECOM_MESSAGE_TYPE_TEXTCARD); } @Override eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java
@@ -381,4 +381,22 @@ // 申请审核站点 public static final String APPROVAL_SITE_TYPE = "approval_site_type"; // 企微消息类型:文本 public static final String WECOM_MESSAGE_TYPE_TEXT = "text"; // 企微消息类型:图片 public static final String WECOM_MESSAGE_TYPE_IMAGE = "image"; // 企微消息类型:语言 public static final String WECOM_MESSAGE_TYPE_VOICE = "voice"; // 企微消息类型:视频 public static final String WECOM_MESSAGE_TYPE_VIDEO = "video"; // 企微消息类型:文件 public static final String WECOM_MESSAGE_TYPE_FILE = "file"; // 企微消息类型:文本卡片 public static final String WECOM_MESSAGE_TYPE_TEXTCARD = "textcard"; // 企微消息:跳转链接 public static final String WECOM_MESSAGE_URL = "http://pms-upgrade.yhzhg.cn/"; // 企微消息:按钮文字(最多4个字,超出自动截断) public static final String WECOM_MESSAGE_BTNTXT = "前往查看"; } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
@@ -4,6 +4,7 @@ import lombok.RequiredArgsConstructor; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.cp.api.WxCpService; import me.chanjar.weixin.cp.bean.message.WxCpMessage; import me.chanjar.weixin.cp.bean.oa.WxCpCheckinData; import me.zhengjie.modules.attendance.domain.*; import me.zhengjie.modules.attendance.repository.*; @@ -262,10 +263,10 @@ */ @Transactional(rollbackFor = Exception.class) public void getWeComAttendanceListOfNight(String attendDate, List attUser) throws Exception { try { // 获取企业微信Token wxCpService.getAccessToken(); try { // 获取参数日期类 Calendar calAttendDate = Calendar.getInstance(); // 日期格式化 @@ -421,7 +422,6 @@ } return attendance; } /** * 请假优先于出差优先于外出 @@ -822,4 +822,58 @@ } return null; } /** * 发送企微应用消息 * * @param userWeComIdList 接收消息用户企微ID * @param content 消息内容 * @param type 消息类型 */ public void sendNotice(List<String> userWeComIdList, String title, String content, String type) { if (userWeComIdList.size() > 0) { try { // 获取企业微信Token wxCpService.getAccessToken(); // 编辑消息 WxCpMessage wxCpMessage = new WxCpMessage(); wxCpMessage.setToUser(userWeComIdList.stream().collect(Collectors.joining("|"))); if (type.equals(Constant.WECOM_MESSAGE_TYPE_TEXT)) { wxCpMessage.setMsgType(Constant.WECOM_MESSAGE_TYPE_TEXT); wxCpMessage.setContent(content); } else if (type.equals(Constant.WECOM_MESSAGE_TYPE_IMAGE)) { wxCpMessage.setMsgType(Constant.WECOM_MESSAGE_TYPE_IMAGE); wxCpMessage.setMediaId(content); } else if (type.equals(Constant.WECOM_MESSAGE_TYPE_VOICE)) { wxCpMessage.setMsgType(Constant.WECOM_MESSAGE_TYPE_VOICE); wxCpMessage.setMediaId(content); } else if (type.equals(Constant.WECOM_MESSAGE_TYPE_VIDEO)) { wxCpMessage.setMsgType(Constant.WECOM_MESSAGE_TYPE_VIDEO); wxCpMessage.setMediaId(content); wxCpMessage.setTitle(title); } else if (type.equals(Constant.WECOM_MESSAGE_TYPE_FILE)) { wxCpMessage.setMsgType(Constant.WECOM_MESSAGE_TYPE_FILE); wxCpMessage.setMediaId(content); } else if (type.equals(Constant.WECOM_MESSAGE_TYPE_TEXTCARD)) { wxCpMessage.setMsgType(Constant.WECOM_MESSAGE_TYPE_TEXTCARD); wxCpMessage.setTitle(title); wxCpMessage.setDescription(content); wxCpMessage.setUrl(Constant.WECOM_MESSAGE_URL); wxCpMessage.setBtnTxt(Constant.WECOM_MESSAGE_BTNTXT); } else { wxCpMessage.setMsgType(Constant.WECOM_MESSAGE_TYPE_TEXT); wxCpMessage.setContent(content); } wxCpMessage.setSafe("0"); wxCpMessage.setEnableDuplicateCheck(false); wxCpMessage.setDuplicateCheckInterval(600); // 发送消息 wxCpService.getMessageService().send(wxCpMessage); } catch (WxErrorException wxErrorException) { wxErrorException.printStackTrace(); } } } } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/ContractMethod.java
@@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import me.zhengjie.modules.constant.Constant; import me.zhengjie.modules.quartz.service.OpaiDingTalkService; import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl; import me.zhengjie.modules.system.domain.Role; import me.zhengjie.modules.system.domain.SysConfigProportion; import me.zhengjie.modules.system.domain.SysUserContract; @@ -12,6 +12,8 @@ import me.zhengjie.modules.system.repository.SysConfigProportionRepository; import me.zhengjie.modules.system.repository.SysUserContractRepository; import me.zhengjie.modules.system.repository.UserRepository; import me.zhengjie.utils.SecurityUtils; import me.zhengjie.utils.StringUtils; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; @@ -38,14 +40,14 @@ private final SysConfigProportionRepository sysConfigProportionRepository; private final SysUserContractRepository sysUserContractRepository; private final UserRepository userRepository; private final OpaiDingTalkService opaiDingTalkService; private final WeComServiceImpl weComService; // 合同到期提醒 public void contractRemind() throws Exception { // 今天日期 Date today = new Date(); // 钉钉Id List<String> dingDingList = new ArrayList<>(); // 用户企微ID List<String> weComList = new ArrayList<>(); // 查询用户 List<User> userList = userRepository.findAll(); for(User user : userList){ @@ -53,8 +55,8 @@ Role role = user.getRoles().iterator().next(); // 高级别 if(Long.valueOf(role.getLevel()).equals(Constant.ROLE_LEVEL_SUPER) || Long.valueOf(role.getLevel()).equals(Constant.ROLE_LEVEL_GENERAL)){ if(ObjectUtil.isNotEmpty(user.getDingding())){ dingDingList.add(user.getDingding()); if (StringUtils.isNotBlank(user.getWeComId())) { weComList.add(user.getWeComId()); } } } @@ -80,11 +82,13 @@ } // 相差天数等于配置表的数值时给高级别用户发钉钉信息 if(Double.valueOf(count).equals(sysConfigProportion.getProportion())){ opaiDingTalkService.sendNotice(dingDingList, "合同将到期提醒", "### 合同将到期提示 \n >" + " \n 所属员工:" + user1.getNickName() + " \n 合同名称: " + sysUserContract.getContractName() + " \n 合同到期时间: " + sysUserContract.getContractEndTime().toString().substring(0,10) + " \n 所属员工合同即将到期,请登录PMS系统查看。", "card"); weComService.sendNotice(weComList, "合同将到期提醒", String.format("<div class=\"normal\">所属员工:%s</div>" + "<div class=\"normal\">合同名称:%s</div>" + "<div class=\"normal\">合同到期时间:%s</div>" + "<div class=\"highlight\">所属员工合同即将到期,请登录PMS系统查看。</div>", user1.getNickName(), sysUserContract.getContractName(), sysUserContract.getContractEndTime().toString().substring(0,10)), Constant.WECOM_MESSAGE_TYPE_TEXTCARD); } } } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/ResourceReminderMethod.java
@@ -4,9 +4,10 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import me.zhengjie.modules.constant.Constant; import me.zhengjie.modules.quartz.service.OpaiDingTalkService; import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl; import me.zhengjie.modules.system.domain.*; import me.zhengjie.modules.system.repository.*; import me.zhengjie.utils.StringUtils; import org.springframework.stereotype.Service; import java.sql.Timestamp; @@ -30,7 +31,7 @@ public class ResourceReminderMethod { private final UserRepository userRepository; private final OpaiDingTalkService opaiDingTalkService; private final WeComServiceImpl weComService; private final CustomerResourcesRepository customerResourcesRepository; private final CustomerResourcesUserRepository customerResourcesUserRepository; @@ -47,20 +48,23 @@ for(CustomerResources customerResources : customerResourcesList){ // 表中的提醒时间与当前的时间一致,发送钉钉消息 if(customerResources.getOpeningTime() != null && customerResources.getOpeningTime().compareTo(Timestamp.valueOf(nowTime)) == 0){ // 钉钉List List<String> dingDingList = new ArrayList<>(); // 企微ID List<String> weComList = new ArrayList<>(); // 查询中间表 List<CustomerResourcesUser> customerResourcesUserList = customerResourcesUserRepository.findByCustomerResourcesId(customerResources.getId()); for(int i = 0; i < customerResourcesUserList.size(); i++){ for (CustomerResourcesUser customerResourcesUser : customerResourcesUserList) { // 查询用户 User user = userRepository.findById(customerResourcesUserList.get(i).getUserId()).orElseGet(User::new); dingDingList.add(user.getDingding()); User user = userRepository.findById(customerResourcesUser.getUserId()).orElseGet(User::new); if (StringUtils.isNotBlank(user.getWeComId())) { weComList.add(user.getWeComId()); } // 发送信息至被提醒人钉钉 opaiDingTalkService.sendNotice(dingDingList, "客户资源管理提示", "### 客户资源管理提示 \n >" + " \n 标题:" + customerResources.getTitle() + " \n 分类: " + customerResources.getClassification() + " \n 新增客户资源,请登录PMS系统查看。", "card"); } // 发送信息至被提醒人企微 weComService.sendNotice(weComList, "客户资源管理提示", String.format("<div class=\"normal\">标题:%s</div>" + "<div class=\"normal\">分类:%s</div>" + "<div class=\"highlight\">新增客户资源,请登录PMS系统查看。</div>", customerResources.getTitle(), customerResources.getClassification()), Constant.WECOM_MESSAGE_TYPE_TEXTCARD); } } } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/CustomerResourcesServiceImpl.java
@@ -18,14 +18,13 @@ import me.zhengjie.modules.business.service.BusinessPlanService; import me.zhengjie.modules.business.service.dto.BusinessPlanDto; import me.zhengjie.modules.constant.Constant; import me.zhengjie.modules.quartz.service.OpaiDingTalkService; import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl; import me.zhengjie.modules.system.domain.CustomerResources; import me.zhengjie.modules.system.domain.CustomerResourcesUser; import me.zhengjie.modules.system.domain.User; import me.zhengjie.modules.system.repository.CustomerResourcesUserRepository; import me.zhengjie.modules.system.repository.UserRepository; import me.zhengjie.utils.ValidationUtil; import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.*; import lombok.RequiredArgsConstructor; import me.zhengjie.modules.system.repository.CustomerResourcesRepository; import me.zhengjie.modules.system.service.CustomerResourcesService; @@ -37,8 +36,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import me.zhengjie.utils.PageUtil; import me.zhengjie.utils.QueryHelp; import java.sql.Timestamp; import java.text.SimpleDateFormat; @@ -61,7 +58,7 @@ private final CustomerResourcesRepository customerResourcesRepository; private final CustomerResourcesMapper customerResourcesMapper; private final UserRepository userRepository; private final OpaiDingTalkService opaiDingTalkService; private final WeComServiceImpl weComService; private final CustomerResourcesUserRepository customerResourcesUserRepository; private final BusinessPlanService businessPlanService; @@ -104,8 +101,8 @@ public void create(CustomerResources resources) throws Exception { // 提醒时间为空,状态为提醒说明是立即提醒,发送钉钉消息 if(ObjectUtils.isEmpty(resources.getOpeningTime()) && resources.getRemind().equals(Constant.RESOURCES_TYPE_REMIND)){ // 调用 resources = setDingding(resources); // 发送通知 resources = sendNotice(resources); } // 保存 customerResourcesRepository.save(resources); @@ -129,8 +126,8 @@ customerResources.copy(resources); // 提醒时间为空,状态为提醒说明是立即提醒,发送钉钉消息 if(ObjectUtils.isEmpty(resources.getOpeningTime()) && resources.getRemind().equals(Constant.RESOURCES_TYPE_REMIND)){ // 调用 customerResources = setDingding(customerResources); // 发送通知 customerResources = sendNotice(customerResources); }else if(resources.getRemind().equals(Constant.RESOURCES_TYPE_NOREMIND)){ customerResources.setOpeningTime(null); } @@ -153,32 +150,32 @@ } /** * 发送钉钉(公共) * 向其他应用发送通知公共方法 * * @param resources * @return * @throws Exception */ public CustomerResources setDingding(CustomerResources resources) throws Exception { public CustomerResources sendNotice(CustomerResources resources) { // 获取当前时间 SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time = sf.format(new Date()); resources.setOpeningTime(Timestamp.valueOf(time)); // 获取存储用户钉钉号 List<String> dingDingList = new ArrayList<>(); // 获取存储用户企微ID List<String> weComList = new ArrayList<>(); if(resources.getRemindPeople().size() != 0){ for(Long userId : resources.getRemindPeople()){ // 查询用户 User user = userRepository.findById(userId).orElseGet(User::new); if(ObjectUtils.isNotEmpty(user.getDingding())){ dingDingList.add(user.getDingding()); if (StringUtils.isNotBlank(user.getWeComId())) { weComList.add(user.getWeComId()); } } } // 发送内容至钉钉 opaiDingTalkService.sendNotice(dingDingList, "客户资源管理提示", "### 客户资源管理提示 \n >" + " \n 标题:" + resources.getTitle() + " \n 分类: " + resources.getClassification() + " \n 客户资源有变动,请登录PMS系统查看。", "card"); // 发送内容至企微 weComService.sendNotice(weComList, "客户资源管理提示", String.format("<div class=\"normal\">标题:%s</div>" + "<div class=\"normal\">分类:%s</div>" + "<div class=\"highlight\">客户资源有变动,请登录PMS系统查看。</div>", resources.getTitle(), resources.getClassification()), Constant.WECOM_MESSAGE_TYPE_TEXTCARD); return resources; } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java
@@ -35,7 +35,7 @@ import me.zhengjie.exception.BadRequestException; import me.zhengjie.modules.project.domain.Project; import me.zhengjie.modules.project.repository.ProjectRepository; import me.zhengjie.modules.quartz.service.OpaiDingTalkService; import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl; import me.zhengjie.modules.system.repository.DictDetailRepository; import me.zhengjie.modules.system.repository.SysUserLevelWageRepository; import me.zhengjie.modules.task.domain.*; @@ -43,8 +43,7 @@ import me.zhengjie.modules.task.service.dto.*; import me.zhengjie.modules.treatment.domain.UserLevelWage; import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.SecurityUtils; import me.zhengjie.utils.*; import org.bson.types.ObjectId; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; @@ -69,8 +68,6 @@ import me.zhengjie.modules.task.repository.TaskUserRepository; import me.zhengjie.modules.task.service.TaskUserService; import me.zhengjie.modules.task.service.mapstruct.TaskUserMapper; import me.zhengjie.utils.PageUtil; import me.zhengjie.utils.ValidationUtil; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -91,7 +88,7 @@ private final UserService userService; private final MongoTemplate mongoTemplate; private final UserLevelWageRepository userLevelWageRepository; private final OpaiDingTalkService opaiDingTalkService; private final WeComServiceImpl weComService; private final ProjectRepository projectRepository; private final DictDetailRepository dictDetailRepository; @@ -463,17 +460,22 @@ // } mongoTemplate.save(taskUserMongo); if (taskGenerate.getUserIds() != null) { //发送钉钉给审批人 List<String> sendList = new ArrayList<>(); // 发送给审批人企微 List<String> weComList = new ArrayList<>(); //查询所属用户信息 User user = userRepository.findById(taskGenerate.getUserIds()).orElseGet(User::new); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sendList.add(user.getDingding()); opaiDingTalkService.sendNotice(sendList, "任务变更提醒", "### 任务创建提示 \n" + " \n 项目:" + project.getName() + " \n 任务:" + taskMongos.get(0).getName() + " > " + taskUserMongo.getName() + " \n 任务区间:" + sdf.format(taskUserMongo.getTaskStartDate()) + "~" + sdf.format(taskUserMongo.getTaskEndDate()) + " \n 任务创建成功,请登录PMS系统查看。", "card"); if (StringUtils.isNotBlank(user.getWeComId())) { weComList.add(user.getWeComId()); weComService.sendNotice(weComList, "任务变更提醒", String.format("<div class=\"gray\">任务创建提示</div>" + "<div class=\"normal\">项目:%s</div>" + "<div class=\"normal\">任务:%s</div>" + "<div class=\"normal\">任务区间:%s</div>" + "<div class=\"highlight\">任务创建成功,请登录PMS系统查看。</div>", project.getName(), taskMongos.get(0).getName() + " > " + taskUserMongo.getName(), sdf.format(taskUserMongo.getTaskStartDate()) + "~" + sdf.format(taskUserMongo.getTaskEndDate())), Constant.WECOM_MESSAGE_TYPE_TEXTCARD); } } } } @@ -1156,18 +1158,23 @@ mongoTemplate.save(resources); if (resources.getUserId() != null) { //发送钉钉给审批人 List<String> sendList = new ArrayList<>(); // 发送给审批人企微 List<String> weComList = new ArrayList<>(); //查询所属用户信息 User user = userRepository.findById(resources.getUserId()).orElseGet(User::new); Project project = projectRepository.findById(resources.getTask().getProjectId()).orElseGet(Project::new); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sendList.add(user.getDingding()); opaiDingTalkService.sendNotice(sendList, "任务变更提醒", "### 任务创建提示 \n" + " \n 项目:" + project.getName() + " \n 任务:" + resources.getTask().getName() + " > " + resources.getName() + " \n 任务区间:" + sdf.format(resources.getTaskStartDate()) + "~" + sdf.format(resources.getTaskEndDate()) + " \n 任务创建成功,请登录PMS系统查看。", "card"); if (StringUtils.isNotBlank(user.getWeComId())) { weComList.add(user.getWeComId()); weComService.sendNotice(weComList, "任务变更提醒", String.format("<div class=\"gray\">任务创建提示</div>" + "<div class=\"normal\">项目:%s</div>" + "<div class=\"normal\">任务:%s</div>" + "<div class=\"normal\">任务区间:%s</div>" + "<div class=\"highlight\">任务创建成功,请登录PMS系统查看。</div>", project.getName(), resources.getTask().getName() + " > " + resources.getName(), sdf.format(resources.getTaskStartDate()) + "~" + sdf.format(resources.getTaskEndDate())), Constant.WECOM_MESSAGE_TYPE_TEXTCARD); } } } @@ -1241,18 +1248,23 @@ // " \n 当前任务有新的变更,请登录PMS系统查看。", "card"); if (resources.getUserId() != null) { //发送钉钉给审批人 List<String> sendList = new ArrayList<>(); // 发送给审批人企微 List<String> weComList = new ArrayList<>(); //查询所属用户信息 User user = userRepository.findById(resources.getUserId()).orElseGet(User::new); Project project = projectRepository.findById(resources.getProjectId()).orElseGet(Project::new); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sendList.add(user.getDingding()); opaiDingTalkService.sendNotice(sendList, "任务变更提醒", "### 任务创建提示 \n" + " \n 项目:" + project.getName() + " \n 任务:" + taskUserMongo.getTask().getName() + " > " + taskUserMongo.getName() + " \n 任务区间:" + sdf.format(taskUserMongo.getTaskStartDate()) + "~" + sdf.format(taskUserMongo.getTaskEndDate()) + " \n 任务创建成功,请登录PMS系统查看。", "card"); if (StringUtils.isNotBlank(user.getWeComId())) { weComList.add(user.getWeComId()); weComService.sendNotice(weComList, "任务变更提醒", String.format("<div class=\"gray\">任务创建提示</div>" + "<div class=\"normal\">项目:%s</div>" + "<div class=\"normal\">任务:%s</div>" + "<div class=\"normal\">任务区间:%s</div>" + "<div class=\"highlight\">任务创建成功,请登录PMS系统查看。</div>", project.getName(), taskUserMongo.getTask().getName() + " > " + taskUserMongo.getName(), sdf.format(taskUserMongo.getTaskStartDate()) + "~" + sdf.format(taskUserMongo.getTaskEndDate())), Constant.WECOM_MESSAGE_TYPE_TEXTCARD); } } }