企业管理-员工信息
This commit is contained in:
parent
819430bc73
commit
ffafa16367
@ -43,4 +43,8 @@ public class BaseConstants {
|
||||
public static final String FUNC_COMPANY = "company";
|
||||
/**批量操作数据量*/
|
||||
public static final Integer BATCH_SIZE = 100;
|
||||
/**资质临期通知模板*/
|
||||
public static final String QUALS_INTERIM_PERIOD = "quals_interim_period";
|
||||
/**资质过期通知模板*/
|
||||
public static final String QUALS_EXPIRED = "quals_expired";
|
||||
}
|
||||
|
@ -19,4 +19,6 @@ public class DictBaseConstants {
|
||||
public static final String DICT_SYS_USER_SEX = "system_user_sex";
|
||||
/**学历*/
|
||||
public static final String COMPANY_STAFF_EDU = "company_staff_edu";
|
||||
/**企业资质临期判定时间*/
|
||||
public static final String COMPANY_QUALS_EXPIRED = "company_quals_expired";
|
||||
}
|
||||
|
@ -2,12 +2,15 @@ package cn.iocoder.yudao.module.company.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业信息表(每个租户的下属企业信息);(dl_company)表数据库访问层
|
||||
* @author : http://www.chiner.pro
|
||||
@ -16,4 +19,11 @@ import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface CompanyMapper extends BaseMapper<Company>{
|
||||
IPage<Company> selectListPage(@Param("map") CompanyReqVO companyReqVO, Page<Company> page);
|
||||
|
||||
/**
|
||||
* 获取所有企业及对应的管理信息
|
||||
* @author 小李
|
||||
* @date 10:15 2024/8/14
|
||||
**/
|
||||
List<CompanyRespVO> getCompanyAndManager();
|
||||
}
|
@ -2,8 +2,11 @@ package cn.iocoder.yudao.module.company.service;
|
||||
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyQuals;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyQualsRespVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业资质信息表
|
||||
* @author : http://www.chiner.pro
|
||||
@ -34,4 +37,11 @@ public interface CompanyQualsService extends IService<CompanyQuals> {
|
||||
* @param id 企业资质id
|
||||
**/
|
||||
void removeDataObj(String id);
|
||||
|
||||
/**
|
||||
* 企业资质临期提醒
|
||||
* @author 小李
|
||||
* @date 8:54 2024/8/14
|
||||
**/
|
||||
void noticeCompanyQualsExpired(List<CompanyRespVO> companyRespVOS);
|
||||
}
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业信息表(每个租户的下属企业信息);(dl_company)表服务接口
|
||||
* @author : http://www.chiner.pro
|
||||
@ -44,4 +46,11 @@ public interface CompanyService extends IService<Company> {
|
||||
* @param id 企业id
|
||||
**/
|
||||
void removeDataObj(String id);
|
||||
|
||||
/**
|
||||
* 获取所有企业及对应的管理信息
|
||||
* @author 小李
|
||||
* @date 10:15 2024/8/14
|
||||
**/
|
||||
List<CompanyRespVO> getCompanyAndManager();
|
||||
}
|
@ -1,19 +1,43 @@
|
||||
package cn.iocoder.yudao.module.company.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.BaseConstants;
|
||||
import cn.iocoder.yudao.common.DictBaseConstants;
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyQuals;
|
||||
import cn.iocoder.yudao.module.company.mapper.CompanyQualsMapper;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyQualsService;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyQualsRespVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CompanyQualsServiceImpl extends ServiceImpl<CompanyQualsMapper, CompanyQuals> implements CompanyQualsService {
|
||||
@Resource
|
||||
private CompanyQualsMapper companyQualsMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dataApi;
|
||||
|
||||
@Resource
|
||||
private NotifyMessageSendApi sendApi;
|
||||
|
||||
/**
|
||||
* 新增企业资质信息
|
||||
*
|
||||
@ -49,4 +73,73 @@ public class CompanyQualsServiceImpl extends ServiceImpl<CompanyQualsMapper, Com
|
||||
public void removeDataObj(String id) {
|
||||
this.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业资质临期提醒
|
||||
*
|
||||
* @author 小李
|
||||
* @date 8:54 2024/8/14
|
||||
**/
|
||||
@Override
|
||||
public void noticeCompanyQualsExpired(List<CompanyRespVO> companyRespVOS) {
|
||||
// 构建分页条件
|
||||
LambdaQueryWrapper<CompanyQuals> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<CompanyQuals> page = new Page<>(0, BaseConstants.BATCH_SIZE);
|
||||
// 获取临期判定时间
|
||||
List<DictDataRespDTO> dictDataList = dataApi.getDictDataList(DictBaseConstants.COMPANY_QUALS_EXPIRED);
|
||||
Long ruleDay = null;
|
||||
if (ObjectUtil.isNotEmpty(dictDataList)) {
|
||||
ruleDay = Long.valueOf(dictDataList.get(0).getValue());
|
||||
}
|
||||
while (ObjectUtil.isNotEmpty(ruleDay)) {
|
||||
// 查询一页数据
|
||||
Page<CompanyQuals> qualsPage = baseMapper.selectPage(page, queryWrapper);
|
||||
// 分类出临期和过期的数据
|
||||
// 这里重新赋值是因为不重新赋值用不了,我也不知道为什么,看到这里的人知道的话可以给我讲讲
|
||||
Long finalRuleDay = ruleDay;
|
||||
qualsPage.getRecords().forEach(item -> {
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
LocalDate endDate = item.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
// 计算离当前时间还有多少天
|
||||
Long day = ChronoUnit.DAYS.between(currentDate, endDate);
|
||||
// day 小于0是过期了 小于等于finalRuleDay是临期了 其他就正常的
|
||||
if (day < 0) {
|
||||
sendMessage(item, BaseConstants.QUALS_EXPIRED, companyRespVOS, day);
|
||||
} else if (day <= finalRuleDay) {
|
||||
sendMessage(item, BaseConstants.QUALS_INTERIM_PERIOD, companyRespVOS, day);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送站内信
|
||||
*
|
||||
* @param data 要发送的数据
|
||||
* @param templateCode 发送用什么模板
|
||||
* @param companyRespVOS 企业和其管理员数据集
|
||||
* @param day 资质的到期时间到今天还有多少天
|
||||
* @author 小李
|
||||
* @date 9:58 2024/8/14
|
||||
**/
|
||||
private void sendMessage(CompanyQuals data, String templateCode, List<CompanyRespVO> companyRespVOS, Long day) {
|
||||
// 获取记录的企业管理员的id
|
||||
List<CompanyRespVO> collect = companyRespVOS.stream().filter(company -> company.getId() == data.getCorpId()).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(collect)) {
|
||||
Long userId = collect.get(0).getUserDTO().getId();
|
||||
|
||||
// 准备发送参数
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
// 什么资质
|
||||
templateParams.put("qualsName", data.getQualsName());
|
||||
// 还有多少天过期或已过期多少天,可能是负数,绝对值一下
|
||||
templateParams.put("day", Math.abs(day));
|
||||
|
||||
// 发送
|
||||
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
||||
.setUserId(userId)
|
||||
.setTemplateCode(templateCode).setTemplateParams(templateParams));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,4 +159,13 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有企业及对应的管理信息
|
||||
* @author 小李
|
||||
* @date 10:15 2024/8/14
|
||||
**/
|
||||
@Override
|
||||
public List<CompanyRespVO> getCompanyAndManager(){
|
||||
return baseMapper.getCompanyAndManager();
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.company.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@ -20,4 +21,9 @@ public class CompanyRespVO extends Company {
|
||||
* 登录账户密码
|
||||
*/
|
||||
List<String> serviceCodeArray;
|
||||
|
||||
/**
|
||||
* 企业对应的管理员
|
||||
**/
|
||||
private UserDTO userDTO;
|
||||
}
|
||||
|
@ -1,7 +1,13 @@
|
||||
package cn.iocoder.yudao.module.custom.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 推广记录表查询VO
|
||||
@ -10,4 +16,8 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class BasePromotionReqVO extends BasePromotion {
|
||||
|
||||
@Schema(description = "被推广人注册日期查询范围")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] registerTimeArray;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.custom.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -10,4 +11,10 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class BasePromotionRespVO extends BasePromotion {
|
||||
|
||||
/** 推广人 */
|
||||
private UserDTO oldUser;
|
||||
|
||||
/** 被推广人 */
|
||||
private UserDTO newUser;
|
||||
}
|
||||
|
@ -2,9 +2,15 @@ package cn.iocoder.yudao.scheduled;
|
||||
|
||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyQualsService;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时提醒企业管理员资质过期
|
||||
* @author 小李
|
||||
@ -15,9 +21,18 @@ import org.springframework.stereotype.Component;
|
||||
@Slf4j
|
||||
public class NoticeCompanyQualsExpiredJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private CompanyQualsService qualsService;
|
||||
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
// TODO
|
||||
// 获取所有企业和其管理员
|
||||
List<CompanyRespVO> companyAndManager = companyService.getCompanyAndManager();
|
||||
// 提醒管理员资质过期
|
||||
qualsService.noticeCompanyQualsExpired(companyAndManager);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -31,4 +31,17 @@
|
||||
</if>
|
||||
ORDER BY bc.create_time DESC
|
||||
</select>
|
||||
|
||||
<resultMap id="QueryResultMap" type="cn.iocoder.yudao.module.company.vo.CompanyRespVO">
|
||||
<id property="id" column="c_id" jdbcType="VARCHAR"/>
|
||||
<association property="userDTO" javaType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO">
|
||||
<id property="id" column="u_id" jdbcType="BIGINT" />
|
||||
</association>
|
||||
</resultMap>
|
||||
<select id="getCompanyAndManager" resultMap="QueryResultMap">
|
||||
select c.id as c_id,
|
||||
u.id as u_id
|
||||
from base_company c
|
||||
inner join system_users u on c.login_account = u.username
|
||||
</select>
|
||||
</mapper>
|
@ -4,18 +4,50 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.BasePromotionMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.custom.entity.BasePromotion">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="oldUserId" column="old_user_id" jdbcType="BIGINT"/>
|
||||
<result property="oldUserName" column="old_user_name" jdbcType="VARCHAR"/>
|
||||
<result property="promotionChannel" column="promotion_channel" jdbcType="VARCHAR"/>
|
||||
<result property="newUserId" column="new_user_id" jdbcType="BIGINT"/>
|
||||
<result property="newUserName" column="new_user_name" jdbcType="VARCHAR"/>
|
||||
<result property="registerTime" column="register_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="uniqueCode" column="unique_code" jdbcType="VARCHAR"/>
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.custom.vo.BasePromotionRespVO">
|
||||
<id property="id" column="bp_id" jdbcType="VARCHAR"/>
|
||||
<result property="oldUserName" column="bp_old_user_name" jdbcType="VARCHAR"/>
|
||||
<result property="promotionChannel" column="bp_promotion_channel" jdbcType="VARCHAR"/>
|
||||
<result property="newUserName" column="bp_new_user_name" jdbcType="VARCHAR"/>
|
||||
<result property="registerTime" column="bp_register_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="uniqueCode" column="bp_unique_code" jdbcType="VARCHAR"/>
|
||||
|
||||
<association property="oldUser" javaType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO">
|
||||
<result property="mobile" column="os_mobile"/>
|
||||
</association>
|
||||
|
||||
<association property="newUser" javaType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO">
|
||||
<result property="mobile" column="ns_mobile"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryListPage" resultMap="BaseResultMap">
|
||||
select * from base_promotion
|
||||
select bp.id as bp_id,
|
||||
bp.promotion_channel as bp_promotion_channel,
|
||||
bp.register_time as bp_register_time,
|
||||
bp.unique_code as bp_unique_code,
|
||||
bp.old_user_name as bp_old_user_name,
|
||||
bp.new_user_name as bp_new_user_name,
|
||||
os.mobile as os_mobile,
|
||||
ns.mobile as ns_mobile
|
||||
from base_promotion bp
|
||||
INNER JOIN system_users os on bp.old_user_id = os.id
|
||||
INNER JOIN system_users ns on bp.new_user_id = ns.id
|
||||
where bp.deleted = '0'
|
||||
<if test="map.oldUserName != null and map.oldUserName != ''">
|
||||
and (bp.old_user_name like concat('%', #{map.oldUserName}, '%'))
|
||||
</if>
|
||||
<if test="map.uniqueCode != null and map.uniqueCode != ''">
|
||||
and (bp.unique_code like concat('%', #{map.uniqueCode}, '%'))
|
||||
</if>
|
||||
<if test="map.newUserName != null and map.newUserName != ''">
|
||||
and (bp.new_user_name like concat('%', #{map.newUserName}, '%'))
|
||||
</if>
|
||||
<if test="map.promotionChannel != null and map.promotionChannel != ''">
|
||||
and (bp.promotion_channel = #{map.promotionChannel})
|
||||
</if>
|
||||
<if test="map.registerTimeArray != null and map.registerTimeArray.length > 0">
|
||||
and (bp.register_time between #{map.registerTimeArray[0]} and #{map.registerTimeArray[1]})
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -55,6 +55,8 @@ public class CompanyStaffChangeServiceImpl extends ServiceImpl<CompanyStaffChang
|
||||
}
|
||||
|
||||
/**
|
||||
* 交接记分页查询
|
||||
*
|
||||
* @param staffChangeReqVO 分页对象
|
||||
* @author 小李
|
||||
* @date 19:00 2024/8/12
|
||||
|
@ -137,8 +137,7 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
||||
/* 插入员工库 */
|
||||
// 1 获取当前登录用户的企业信息给添加的员工
|
||||
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
|
||||
Company company = getLoginCompany(loginDept.getName());
|
||||
staffRespVO.setCorpId(company.getId());
|
||||
staffRespVO.setCorpId(loginDept.getCorpId());
|
||||
// 2 生成唯一推广码
|
||||
String uniqueCode = uniqueCodeService.createUniqueCode();
|
||||
if (!ObjectUtil.isNotEmpty(uniqueCode)) {
|
||||
@ -370,14 +369,8 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
||||
* @date 14:03 2024/8/9
|
||||
**/
|
||||
public Boolean checkWorkNo(String workNo) {
|
||||
// 获取当前登录用户的部门ID和企业ID
|
||||
AdminUserRespDTO loginUser = getLoginUser();
|
||||
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
|
||||
Company loginCompany = getLoginCompany(loginDept.getName());
|
||||
return staffMapper.selectCount(new LambdaQueryWrapper<CompanyStaff>().and(item -> {
|
||||
item.eq(CompanyStaff::getWorkNo, workNo)
|
||||
.eq(CompanyStaff::getDeptId, loginDept.getId())
|
||||
.eq(CompanyStaff::getCorpId, loginCompany.getId());
|
||||
item.eq(CompanyStaff::getWorkNo, workNo);
|
||||
})) == 0;
|
||||
}
|
||||
|
||||
@ -403,17 +396,6 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
||||
return deptApi.getDept(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的企业详细信息
|
||||
*
|
||||
* @param corpName 企业名称
|
||||
* @author 小李
|
||||
* @date 18:03 2024/8/9
|
||||
**/
|
||||
private Company getLoginCompany(String corpName) {
|
||||
return companyService.getOne(new LambdaQueryWrapper<Company>().eq(Company::getCorpName, corpName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新员工的工龄和司龄
|
||||
*
|
||||
|
@ -91,7 +91,8 @@
|
||||
and (cs_old.name like concat('%', #{map.name}, '%') or cs_new.name like concat('%', #{map.name}, '%'))
|
||||
</if>
|
||||
<if test="map.workNo != null and map.workNo != ''">
|
||||
and (cs_old.work_no like concat('%', #{map.workNo}, '%') or cs_new.work_no like concat('%', #{map.workNo}, '%'))
|
||||
and (cs_old.work_no like concat('%', #{map.workNo}, '%') or cs_new.work_no like concat('%', #{map.workNo},
|
||||
'%'))
|
||||
</if>
|
||||
<if test="map.tel != null and map.tel != ''">
|
||||
and (cs_old.tel like concat('%', #{map.tel}, '%') or cs_new.tel like concat('%', #{map.tel}, '%'))
|
||||
|
Loading…
Reference in New Issue
Block a user