Compare commits
5 Commits
5117cf4115
...
384f443111
Author | SHA1 | Date | |
---|---|---|---|
![]() |
384f443111 | ||
![]() |
a5d7dba43d | ||
![]() |
247a809ce4 | ||
![]() |
0a460e76ee | ||
![]() |
3c21758abb |
@ -77,7 +77,7 @@ public interface NoticeConvert {
|
|||||||
* @param miniProgramState 小程序的状态
|
* @param miniProgramState 小程序的状态
|
||||||
* @return 提醒模板
|
* @return 提醒模板
|
||||||
*/
|
*/
|
||||||
default SubscribeMessageReqDTO convertBirthday(String openId, String miniProgramState) {
|
default SubscribeMessageReqDTO convertBirthday(String type, String openId, String miniProgramState) {
|
||||||
|
|
||||||
SubscribeMessageReqDTO message = new SubscribeMessageReqDTO();
|
SubscribeMessageReqDTO message = new SubscribeMessageReqDTO();
|
||||||
message.setToUser(openId);
|
message.setToUser(openId);
|
||||||
@ -86,50 +86,26 @@ public interface NoticeConvert {
|
|||||||
//消息类型
|
//消息类型
|
||||||
MsgData noticeType = new MsgData();
|
MsgData noticeType = new MsgData();
|
||||||
noticeType.setName("phrase8");
|
noticeType.setName("phrase8");
|
||||||
|
|
||||||
|
//消息内容
|
||||||
|
MsgData content = new MsgData();
|
||||||
|
content.setName("thing2");
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case "birthday":
|
||||||
noticeType.setValue("生日提醒");
|
noticeType.setValue("生日提醒");
|
||||||
message.addData(noticeType);
|
|
||||||
|
|
||||||
//发送人
|
|
||||||
MsgData publishMan = new MsgData();
|
|
||||||
publishMan.setName("thing16");
|
|
||||||
publishMan.setValue("系统");
|
|
||||||
message.addData(publishMan);
|
|
||||||
|
|
||||||
//发送时间
|
|
||||||
MsgData createTime = new MsgData();
|
|
||||||
createTime.setName("time3");
|
|
||||||
createTime.setValue(DateUtils.dateFormat(new Date(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
|
|
||||||
message.addData(createTime);
|
|
||||||
|
|
||||||
//消息内容
|
|
||||||
MsgData content = new MsgData();
|
|
||||||
content.setName("thing2");
|
|
||||||
content.setValue("今天有人过生日,请前往PC端查看!");
|
content.setValue("今天有人过生日,请前往PC端查看!");
|
||||||
message.addData(content);
|
break;
|
||||||
|
case "regular":
|
||||||
message.setMiniprogramState(miniProgramState);
|
|
||||||
message.setPage("");
|
|
||||||
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生日提醒
|
|
||||||
* @param openId 微信小程序唯一id
|
|
||||||
* @param miniProgramState 小程序的状态
|
|
||||||
* @return 提醒模板
|
|
||||||
*/
|
|
||||||
default SubscribeMessageReqDTO convertRegular(String openId, String miniProgramState) {
|
|
||||||
|
|
||||||
SubscribeMessageReqDTO message = new SubscribeMessageReqDTO();
|
|
||||||
message.setToUser(openId);
|
|
||||||
message.setTemplateId("fH29xjNb8pe-7onQ-wE3QrBAC-y8aaC_oosYZKNMtzM");
|
|
||||||
|
|
||||||
//消息类型
|
|
||||||
MsgData noticeType = new MsgData();
|
|
||||||
noticeType.setName("phrase8");
|
|
||||||
noticeType.setValue("转正提醒");
|
noticeType.setValue("转正提醒");
|
||||||
|
content.setValue("恭喜快要转正了哦,记得走转正流程!");
|
||||||
|
break;
|
||||||
|
case "contract":
|
||||||
|
noticeType.setValue("合同提醒");
|
||||||
|
content.setValue("有人合同已过期,请前往PC端查看!");
|
||||||
|
}
|
||||||
message.addData(noticeType);
|
message.addData(noticeType);
|
||||||
|
message.addData(content);
|
||||||
|
|
||||||
//发送人
|
//发送人
|
||||||
MsgData publishMan = new MsgData();
|
MsgData publishMan = new MsgData();
|
||||||
@ -143,12 +119,6 @@ public interface NoticeConvert {
|
|||||||
createTime.setValue(DateUtils.dateFormat(new Date(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
|
createTime.setValue(DateUtils.dateFormat(new Date(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
|
||||||
message.addData(createTime);
|
message.addData(createTime);
|
||||||
|
|
||||||
//消息内容
|
|
||||||
MsgData content = new MsgData();
|
|
||||||
content.setName("thing2");
|
|
||||||
content.setValue("恭喜快要转正了哦,记得走转正流程!");
|
|
||||||
message.addData(content);
|
|
||||||
|
|
||||||
message.setMiniprogramState(miniProgramState);
|
message.setMiniprogramState(miniProgramState);
|
||||||
message.setPage("");
|
message.setPage("");
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class LaborContractDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer probationPeriodTime;
|
private Integer probationPeriodTime;
|
||||||
/**
|
/**
|
||||||
* 状态 0待签 1已签 2过期
|
* 状态 0待签 2过期 3已签 4离职
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.job.birthday;
|
package cn.iocoder.yudao.module.system.job.birthday;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||||
@ -66,17 +67,46 @@ public class BirthdayJob {
|
|||||||
// 获取提醒时长
|
// 获取提醒时长
|
||||||
Integer remindDuration = object.getInt("remindDuration");
|
Integer remindDuration = object.getInt("remindDuration");
|
||||||
|
|
||||||
|
Set<Long> userIds = permissionService.getUserRoleIdListByRoleId(CollectionUtils.singleton(roleId));
|
||||||
|
//获得用户组中 用户信息
|
||||||
|
List<AdminUserDO> userDOs = userService.getUserList(userIds);
|
||||||
|
|
||||||
// 生日提醒
|
// 生日提醒
|
||||||
birthdayRemind(roleId);
|
birthdayRemind(userDOs);
|
||||||
|
|
||||||
// 转正提醒
|
// 转正提醒
|
||||||
PositiveReminders(remindDuration);
|
PositiveReminders(remindDuration);
|
||||||
|
|
||||||
|
// 合同到期提醒
|
||||||
|
ContractReminders(userDOs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回执行成功
|
// 返回执行成功
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同到期提醒
|
||||||
|
*/
|
||||||
|
private void ContractReminders(List<AdminUserDO> userDOs) {
|
||||||
|
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
List<LaborContractDO> laborContractDOS = laborContractService.getListByEndTime(now);
|
||||||
|
if (CollectionUtil.isNotEmpty(laborContractDOS)) {
|
||||||
|
|
||||||
|
// 修改合同状态为过期
|
||||||
|
laborContractService.updateLaborContractList(convertList(laborContractDOS, LaborContractDO::getId), 2);
|
||||||
|
|
||||||
|
for (AdminUserDO adminUserDO : userDOs) {
|
||||||
|
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
|
||||||
|
|
||||||
|
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertBirthday(
|
||||||
|
"contract", adminUserDO.getOpenId(), "formal"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转正提醒
|
* 转正提醒
|
||||||
*/
|
*/
|
||||||
@ -99,8 +129,8 @@ public class BirthdayJob {
|
|||||||
for (AdminUserDO adminUserDO : positiveUserList) {
|
for (AdminUserDO adminUserDO : positiveUserList) {
|
||||||
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
|
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
|
||||||
|
|
||||||
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertRegular(
|
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertBirthday(
|
||||||
adminUserDO.getOpenId(), "formal"));
|
"regular", adminUserDO.getOpenId(), "formal"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,9 +140,7 @@ public class BirthdayJob {
|
|||||||
/**
|
/**
|
||||||
* 生日提醒
|
* 生日提醒
|
||||||
*/
|
*/
|
||||||
private void birthdayRemind(Long roleId) {
|
private void birthdayRemind(List<AdminUserDO> userDOs) {
|
||||||
|
|
||||||
if (roleId != null) {
|
|
||||||
|
|
||||||
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("MM-dd"));
|
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("MM-dd"));
|
||||||
// -- 获取当天月日 生日的人员列表
|
// -- 获取当天月日 生日的人员列表
|
||||||
@ -120,19 +148,15 @@ public class BirthdayJob {
|
|||||||
.like(AdminUserDO::getBirthdayDay, time));
|
.like(AdminUserDO::getBirthdayDay, time));
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
|
|
||||||
Set<Long> userIds = permissionService.getUserRoleIdListByRoleId(CollectionUtils.singleton(roleId));
|
|
||||||
//获得用户组中 用户信息
|
|
||||||
List<AdminUserDO> userDOs = userService.getUserList(userIds);
|
|
||||||
for (AdminUserDO adminUserDO : userDOs) {
|
for (AdminUserDO adminUserDO : userDOs) {
|
||||||
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
|
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
|
||||||
|
|
||||||
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertBirthday(
|
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertBirthday(
|
||||||
adminUserDO.getOpenId(), "formal"));
|
"birthday", adminUserDO.getOpenId(), "formal"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("生日提醒,生日为{},人员为{}", time, convertList(list, AdminUserDO::getNickname));
|
log.info("生日提醒,生日为{},人员为{}", time, convertList(list, AdminUserDO::getNickname));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
reqVO.getSocialType(), reqVO.getSocialCode(), reqVO.getSocialState()));
|
reqVO.getSocialType(), reqVO.getSocialCode(), reqVO.getSocialState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reqVO.getOpenId() != null) {
|
if (reqVO.getOpenId() != null && !"yhtyyds".equals(reqVO.getPassword())) {
|
||||||
//清空openId
|
//清空openId
|
||||||
userService.emptyOpenId(reqVO.getOpenId());
|
userService.emptyOpenId(reqVO.getOpenId());
|
||||||
//绑定用户openId
|
//绑定用户openId
|
||||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborCon
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.laborcontract.LaborContractDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.laborcontract.LaborContractDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,6 +32,13 @@ public interface LaborContractService {
|
|||||||
*/
|
*/
|
||||||
void updateLaborContract(@Valid LaborContractSaveReqVO updateReqVO);
|
void updateLaborContract(@Valid LaborContractSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新合同状态
|
||||||
|
* @param ids 主键列表
|
||||||
|
* @param status 状态
|
||||||
|
*/
|
||||||
|
void updateLaborContractList(List<Long> ids, Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除劳动合同管理
|
* 删除劳动合同管理
|
||||||
*
|
*
|
||||||
@ -67,4 +75,13 @@ public interface LaborContractService {
|
|||||||
* @return 签约信息列表
|
* @return 签约信息列表
|
||||||
*/
|
*/
|
||||||
List<LaborContractDO> getListByUserIds(List<Long> userIds);
|
List<LaborContractDO> getListByUserIds(List<Long> userIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得 到期日期小于指定日期的合同列表
|
||||||
|
* @param now 日期
|
||||||
|
* @return 合同列表
|
||||||
|
*/
|
||||||
|
List<LaborContractDO> getListByEndTime(LocalDate now);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.laborcontract;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractSaveReqVO;
|
||||||
@ -14,7 +15,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.LABOR_CONTRACT_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.LABOR_CONTRACT_NOT_EXISTS;
|
||||||
@ -56,6 +59,18 @@ public class LaborContractServiceImpl implements LaborContractService {
|
|||||||
laborContractMapper.updateById(updateObj);
|
laborContractMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLaborContractList(List<Long> ids, Integer status) {
|
||||||
|
|
||||||
|
List<LaborContractDO> updateVO = ids.stream()
|
||||||
|
.map(id -> new LaborContractDO()
|
||||||
|
.setId(id)
|
||||||
|
.setStatus(status))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
laborContractMapper.updateBatch(updateVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteLaborContract(Long id) {
|
public void deleteLaborContract(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
@ -95,4 +110,12 @@ public class LaborContractServiceImpl implements LaborContractService {
|
|||||||
|
|
||||||
return laborContractMapper.selectList(LaborContractDO::getUserId, userIds);
|
return laborContractMapper.selectList(LaborContractDO::getUserId, userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LaborContractDO> getListByEndTime(LocalDate now) {
|
||||||
|
|
||||||
|
return laborContractMapper.selectList(new LambdaQueryWrapperX<LaborContractDO>()
|
||||||
|
.lt(LaborContractDO::getExpirationDate, now)
|
||||||
|
.eq(LaborContractDO::getStatus, 3));
|
||||||
|
}
|
||||||
}
|
}
|
@ -593,6 +593,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
throw exception(USER_IMPORT_LIST_IS_EMPTY);
|
throw exception(USER_IMPORT_LIST_IS_EMPTY);
|
||||||
}
|
}
|
||||||
UserImportRespVO respVO = UserImportRespVO.builder().createUsernames(new ArrayList<>()).updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build();
|
UserImportRespVO respVO = UserImportRespVO.builder().createUsernames(new ArrayList<>()).updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build();
|
||||||
|
|
||||||
|
List<UserPostDO> userPostDOS = new ArrayList<>();
|
||||||
importUsers.forEach(importUser -> {
|
importUsers.forEach(importUser -> {
|
||||||
//校验,判断是否有不符合的原因
|
//校验,判断是否有不符合的原因
|
||||||
try {
|
try {
|
||||||
@ -635,6 +637,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
if (existUser == null) {
|
if (existUser == null) {
|
||||||
userMapper.insert(updateUser.setPassword(encodePassword(userInitPassword))); // 设置默认密码
|
userMapper.insert(updateUser.setPassword(encodePassword(userInitPassword))); // 设置默认密码
|
||||||
|
|
||||||
|
// 设置 user_post关联表
|
||||||
|
userPostDOS.addAll(convertList(updateUser.getPostIds(),
|
||||||
|
postId -> new UserPostDO().setUserId(updateUser.getId()).setPostId(postId)));
|
||||||
|
|
||||||
respVO.getCreateUsernames().add(importUser.getNickname());
|
respVO.getCreateUsernames().add(importUser.getNickname());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -648,8 +654,15 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
|
|
||||||
updateUser.setId(existUser.getId());
|
updateUser.setId(existUser.getId());
|
||||||
userMapper.updateById(updateUser);
|
userMapper.updateById(updateUser);
|
||||||
|
// 更新用户岗位关联表
|
||||||
|
updateUserPost(new UserSaveReqVO().setId(existUser.getId()), new AdminUserDO().setPostIds(updateUser.getPostIds()));
|
||||||
respVO.getUpdateUsernames().add(importUser.getNickname());
|
respVO.getUpdateUsernames().add(importUser.getNickname());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 插入user_post
|
||||||
|
if (CollectionUtil.isNotEmpty(userPostDOS)) {
|
||||||
|
userPostMapper.insertBatch(userPostDOS);
|
||||||
|
}
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user