企业管理-员工信息
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 String FUNC_COMPANY = "company";
|
||||||
/**批量操作数据量*/
|
/**批量操作数据量*/
|
||||||
public static final Integer BATCH_SIZE = 100;
|
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 DICT_SYS_USER_SEX = "system_user_sex";
|
||||||
/**学历*/
|
/**学历*/
|
||||||
public static final String COMPANY_STAFF_EDU = "company_staff_edu";
|
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.entity.Company;
|
||||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
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.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业信息表(每个租户的下属企业信息);(dl_company)表数据库访问层
|
* 企业信息表(每个租户的下属企业信息);(dl_company)表数据库访问层
|
||||||
* @author : http://www.chiner.pro
|
* @author : http://www.chiner.pro
|
||||||
@ -16,4 +19,11 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface CompanyMapper extends BaseMapper<Company>{
|
public interface CompanyMapper extends BaseMapper<Company>{
|
||||||
IPage<Company> selectListPage(@Param("map") CompanyReqVO companyReqVO, Page<Company> page);
|
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.entity.CompanyQuals;
|
||||||
import cn.iocoder.yudao.module.company.vo.CompanyQualsRespVO;
|
import cn.iocoder.yudao.module.company.vo.CompanyQualsRespVO;
|
||||||
|
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业资质信息表
|
* 企业资质信息表
|
||||||
* @author : http://www.chiner.pro
|
* @author : http://www.chiner.pro
|
||||||
@ -34,4 +37,11 @@ public interface CompanyQualsService extends IService<CompanyQuals> {
|
|||||||
* @param id 企业资质id
|
* @param id 企业资质id
|
||||||
**/
|
**/
|
||||||
void removeDataObj(String 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.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业信息表(每个租户的下属企业信息);(dl_company)表服务接口
|
* 企业信息表(每个租户的下属企业信息);(dl_company)表服务接口
|
||||||
* @author : http://www.chiner.pro
|
* @author : http://www.chiner.pro
|
||||||
@ -44,4 +46,11 @@ public interface CompanyService extends IService<Company> {
|
|||||||
* @param id 企业id
|
* @param id 企业id
|
||||||
**/
|
**/
|
||||||
void removeDataObj(String 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;
|
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.entity.CompanyQuals;
|
||||||
import cn.iocoder.yudao.module.company.mapper.CompanyQualsMapper;
|
import cn.iocoder.yudao.module.company.mapper.CompanyQualsMapper;
|
||||||
import cn.iocoder.yudao.module.company.service.CompanyQualsService;
|
import cn.iocoder.yudao.module.company.service.CompanyQualsService;
|
||||||
import cn.iocoder.yudao.module.company.vo.CompanyQualsRespVO;
|
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
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
|
@Service
|
||||||
public class CompanyQualsServiceImpl extends ServiceImpl<CompanyQualsMapper, CompanyQuals> implements CompanyQualsService {
|
public class CompanyQualsServiceImpl extends ServiceImpl<CompanyQualsMapper, CompanyQuals> implements CompanyQualsService {
|
||||||
@Resource
|
@Resource
|
||||||
private CompanyQualsMapper companyQualsMapper;
|
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) {
|
public void removeDataObj(String id) {
|
||||||
this.removeById(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;
|
package cn.iocoder.yudao.module.company.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.company.entity.Company;
|
import cn.iocoder.yudao.module.company.entity.Company;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -20,4 +21,9 @@ public class CompanyRespVO extends Company {
|
|||||||
* 登录账户密码
|
* 登录账户密码
|
||||||
*/
|
*/
|
||||||
List<String> serviceCodeArray;
|
List<String> serviceCodeArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业对应的管理员
|
||||||
|
**/
|
||||||
|
private UserDTO userDTO;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.custom.vo;
|
package cn.iocoder.yudao.module.custom.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
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
|
* 推广记录表查询VO
|
||||||
@ -10,4 +16,8 @@ import lombok.Data;
|
|||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class BasePromotionReqVO extends BasePromotion {
|
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;
|
package cn.iocoder.yudao.module.custom.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,4 +11,10 @@ import lombok.Data;
|
|||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class BasePromotionRespVO extends BasePromotion {
|
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.quartz.core.handler.JobHandler;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时提醒企业管理员资质过期
|
* 定时提醒企业管理员资质过期
|
||||||
* @author 小李
|
* @author 小李
|
||||||
@ -15,9 +21,18 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class NoticeCompanyQualsExpiredJob implements JobHandler {
|
public class NoticeCompanyQualsExpiredJob implements JobHandler {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CompanyQualsService qualsService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String execute(String param) throws Exception {
|
public String execute(String param) throws Exception {
|
||||||
// TODO
|
// 获取所有企业和其管理员
|
||||||
|
List<CompanyRespVO> companyAndManager = companyService.getCompanyAndManager();
|
||||||
|
// 提醒管理员资质过期
|
||||||
|
qualsService.noticeCompanyQualsExpired(companyAndManager);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,29 +6,42 @@
|
|||||||
SELECT
|
SELECT
|
||||||
bc.*
|
bc.*
|
||||||
FROM
|
FROM
|
||||||
base_company bc
|
base_company bc
|
||||||
WHERE deleted = '0'
|
WHERE deleted = '0'
|
||||||
<if test="map.registDateArray.length>0">
|
<if test="map.registDateArray.length>0">
|
||||||
AND (bc.regist_date BETWEEN #{map.registDateArray[0]} AND #{map.registDateArray[1]})
|
AND (bc.regist_date BETWEEN #{map.registDateArray[0]} AND #{map.registDateArray[1]})
|
||||||
</if>
|
</if>
|
||||||
<if test="map.corpName!='' and map.corpName!=null">
|
<if test="map.corpName!='' and map.corpName!=null">
|
||||||
AND (bc.corp_name LIKE CONCAT('%',#{map.corpName},'%'))
|
AND (bc.corp_name LIKE CONCAT('%',#{map.corpName},'%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="map.orgCard!='' and map.orgCard!=null">
|
<if test="map.orgCard!='' and map.orgCard!=null">
|
||||||
AND (bc.org_card LIKE CONCAT('%',#{map.orgCard},'%'))
|
AND (bc.org_card LIKE CONCAT('%',#{map.orgCard},'%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="map.legalName!='' and map.legalName!=null">
|
<if test="map.legalName!='' and map.legalName!=null">
|
||||||
AND (bc.legal_name LIKE CONCAT('%',#{map.legalName},'%'))
|
AND (bc.legal_name LIKE CONCAT('%',#{map.legalName},'%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="map.legalCard!='' and map.legalCard!=null">
|
<if test="map.legalCard!='' and map.legalCard!=null">
|
||||||
AND (bc.legal_card LIKE CONCAT('%',#{map.legalCard},'%'))
|
AND (bc.legal_card LIKE CONCAT('%',#{map.legalCard},'%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="map.contactName!='' and map.contactName!=null">
|
<if test="map.contactName!='' and map.contactName!=null">
|
||||||
AND (bc.contact_name LIKE CONCAT('%',#{map.contactName},'%'))
|
AND (bc.contact_name LIKE CONCAT('%',#{map.contactName},'%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="map.mobilePhone!='' and map.mobilePhone!=null">
|
<if test="map.mobilePhone!='' and map.mobilePhone!=null">
|
||||||
AND (bc.mobile_phone LIKE CONCAT('%',#{map.mobilePhone},'%'))
|
AND (bc.mobile_phone LIKE CONCAT('%',#{map.mobilePhone},'%'))
|
||||||
</if>
|
</if>
|
||||||
ORDER BY bc.create_time DESC
|
ORDER BY bc.create_time DESC
|
||||||
</select>
|
</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>
|
</mapper>
|
@ -4,18 +4,50 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.BasePromotionMapper">
|
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.BasePromotionMapper">
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.custom.entity.BasePromotion">
|
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.custom.vo.BasePromotionRespVO">
|
||||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
<id property="id" column="bp_id" jdbcType="VARCHAR"/>
|
||||||
<result property="oldUserId" column="old_user_id" jdbcType="BIGINT"/>
|
<result property="oldUserName" column="bp_old_user_name" jdbcType="VARCHAR"/>
|
||||||
<result property="oldUserName" column="old_user_name" jdbcType="VARCHAR"/>
|
<result property="promotionChannel" column="bp_promotion_channel" jdbcType="VARCHAR"/>
|
||||||
<result property="promotionChannel" column="promotion_channel" jdbcType="VARCHAR"/>
|
<result property="newUserName" column="bp_new_user_name" jdbcType="VARCHAR"/>
|
||||||
<result property="newUserId" column="new_user_id" jdbcType="BIGINT"/>
|
<result property="registerTime" column="bp_register_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="newUserName" column="new_user_name" jdbcType="VARCHAR"/>
|
<result property="uniqueCode" column="bp_unique_code" jdbcType="VARCHAR"/>
|
||||||
<result property="registerTime" column="register_time" jdbcType="TIMESTAMP"/>
|
|
||||||
<result property="uniqueCode" column="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>
|
</resultMap>
|
||||||
|
|
||||||
<select id="queryListPage" resultMap="BaseResultMap">
|
<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>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -55,6 +55,8 @@ public class CompanyStaffChangeServiceImpl extends ServiceImpl<CompanyStaffChang
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 交接记分页查询
|
||||||
|
*
|
||||||
* @param staffChangeReqVO 分页对象
|
* @param staffChangeReqVO 分页对象
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 19:00 2024/8/12
|
* @date 19:00 2024/8/12
|
||||||
@ -68,27 +70,27 @@ public class CompanyStaffChangeServiceImpl extends ServiceImpl<CompanyStaffChang
|
|||||||
ObjectUtil.isNotEmpty(staffChangeReqVO.getTel())
|
ObjectUtil.isNotEmpty(staffChangeReqVO.getTel())
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// 根据不为空的那个条件去查员工的userId
|
// 根据不为空的那个条件去查员工的userId
|
||||||
List<CompanyStaff> list = null;
|
List<CompanyStaff> list = null;
|
||||||
if (ObjectUtil.isNotEmpty(staffChangeReqVO.getName())){
|
if (ObjectUtil.isNotEmpty(staffChangeReqVO.getName())) {
|
||||||
list = staffService.list(new LambdaQueryWrapper<CompanyStaff>()
|
list = staffService.list(new LambdaQueryWrapper<CompanyStaff>()
|
||||||
.like(CompanyStaff::getName, staffChangeReqVO.getName())
|
.like(CompanyStaff::getName, staffChangeReqVO.getName())
|
||||||
);
|
);
|
||||||
}else if (ObjectUtil.isNotEmpty(staffChangeReqVO.getWorkNo())){
|
} else if (ObjectUtil.isNotEmpty(staffChangeReqVO.getWorkNo())) {
|
||||||
list = staffService.list(new LambdaQueryWrapper<CompanyStaff>()
|
list = staffService.list(new LambdaQueryWrapper<CompanyStaff>()
|
||||||
.like(CompanyStaff::getWorkNo, staffChangeReqVO.getWorkNo())
|
.like(CompanyStaff::getWorkNo, staffChangeReqVO.getWorkNo())
|
||||||
);
|
);
|
||||||
}else if (ObjectUtil.isNotEmpty(staffChangeReqVO.getTel())){
|
} else if (ObjectUtil.isNotEmpty(staffChangeReqVO.getTel())) {
|
||||||
list = staffService.list(new LambdaQueryWrapper<CompanyStaff>()
|
list = staffService.list(new LambdaQueryWrapper<CompanyStaff>()
|
||||||
.like(CompanyStaff::getTel, staffChangeReqVO.getTel())
|
.like(CompanyStaff::getTel, staffChangeReqVO.getTel())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// 如果查到了结果才处理,没查到不管
|
// 如果查到了结果才处理,没查到不管
|
||||||
if (ObjectUtil.isNotEmpty(list)){
|
if (ObjectUtil.isNotEmpty(list)) {
|
||||||
List<Long> userIds = list.stream().map(item -> item.getUserId()).collect(Collectors.toList());
|
List<Long> userIds = list.stream().map(item -> item.getUserId()).collect(Collectors.toList());
|
||||||
if (staffChangeReqVO.getChangeType().equals("0")){
|
if (staffChangeReqVO.getChangeType().equals("0")) {
|
||||||
staffChangeReqVO.setOldUserIds(userIds);
|
staffChangeReqVO.setOldUserIds(userIds);
|
||||||
}else{
|
} else {
|
||||||
staffChangeReqVO.setNewUserIds(userIds);
|
staffChangeReqVO.setNewUserIds(userIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,8 +137,7 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
/* 插入员工库 */
|
/* 插入员工库 */
|
||||||
// 1 获取当前登录用户的企业信息给添加的员工
|
// 1 获取当前登录用户的企业信息给添加的员工
|
||||||
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
|
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
|
||||||
Company company = getLoginCompany(loginDept.getName());
|
staffRespVO.setCorpId(loginDept.getCorpId());
|
||||||
staffRespVO.setCorpId(company.getId());
|
|
||||||
// 2 生成唯一推广码
|
// 2 生成唯一推广码
|
||||||
String uniqueCode = uniqueCodeService.createUniqueCode();
|
String uniqueCode = uniqueCodeService.createUniqueCode();
|
||||||
if (!ObjectUtil.isNotEmpty(uniqueCode)) {
|
if (!ObjectUtil.isNotEmpty(uniqueCode)) {
|
||||||
@ -370,14 +369,8 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
* @date 14:03 2024/8/9
|
* @date 14:03 2024/8/9
|
||||||
**/
|
**/
|
||||||
public Boolean checkWorkNo(String workNo) {
|
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 -> {
|
return staffMapper.selectCount(new LambdaQueryWrapper<CompanyStaff>().and(item -> {
|
||||||
item.eq(CompanyStaff::getWorkNo, workNo)
|
item.eq(CompanyStaff::getWorkNo, workNo);
|
||||||
.eq(CompanyStaff::getDeptId, loginDept.getId())
|
|
||||||
.eq(CompanyStaff::getCorpId, loginCompany.getId());
|
|
||||||
})) == 0;
|
})) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,17 +396,6 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
return deptApi.getDept(deptId);
|
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新员工的工龄和司龄
|
* 更新员工的工龄和司龄
|
||||||
*
|
*
|
||||||
|
@ -49,49 +49,50 @@
|
|||||||
|
|
||||||
<select id="getStaffChangePage" resultMap="BaseResultMap">
|
<select id="getStaffChangePage" resultMap="BaseResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
csc.id as csc_id,
|
csc.id as csc_id,
|
||||||
csc.old_user_id as csc_old_user_id,
|
csc.old_user_id as csc_old_user_id,
|
||||||
csc.new_user_id as csc_new_user_id,
|
csc.new_user_id as csc_new_user_id,
|
||||||
csc.change_time as csc_change_time,
|
csc.change_time as csc_change_time,
|
||||||
csc.file_urls as csc_file_urls,
|
csc.file_urls as csc_file_urls,
|
||||||
csc.remark as csc_remark,
|
csc.remark as csc_remark,
|
||||||
cs_old.id as cs_old_id,
|
cs_old.id as cs_old_id,
|
||||||
cs_old.work_no as cs_old_work_no,
|
cs_old.work_no as cs_old_work_no,
|
||||||
cs_old.name as cs_old_name,
|
cs_old.name as cs_old_name,
|
||||||
cs_old.tel as cs_old_tel,
|
cs_old.tel as cs_old_tel,
|
||||||
cs_old.sex as cs_old_sex,
|
cs_old.sex as cs_old_sex,
|
||||||
cs_old.address as cs_old_address,
|
cs_old.address as cs_old_address,
|
||||||
cs_old.work_date as cs_old_work_date,
|
cs_old.work_date as cs_old_work_date,
|
||||||
cs_old.work_year as cs_old_work_year,
|
cs_old.work_year as cs_old_work_year,
|
||||||
cs_old.joined_date as cs_old_joined_date,
|
cs_old.joined_date as cs_old_joined_date,
|
||||||
cs_old.joined_year as cs_old_joined_year,
|
cs_old.joined_year as cs_old_joined_year,
|
||||||
cs_old.education as cs_old_education,
|
cs_old.education as cs_old_education,
|
||||||
cs_old.content as cs_old_content,
|
cs_old.content as cs_old_content,
|
||||||
cs_old.unique_code as cs_old_unique_code,
|
cs_old.unique_code as cs_old_unique_code,
|
||||||
cs_old.file_urls as cs_old_file_urls,
|
cs_old.file_urls as cs_old_file_urls,
|
||||||
cs_new.id as cs_new_id,
|
cs_new.id as cs_new_id,
|
||||||
cs_new.work_no as cs_new_work_no,
|
cs_new.work_no as cs_new_work_no,
|
||||||
cs_new.name as cs_new_name,
|
cs_new.name as cs_new_name,
|
||||||
cs_new.tel as cs_new_tel,
|
cs_new.tel as cs_new_tel,
|
||||||
cs_new.sex as cs_new_sex,
|
cs_new.sex as cs_new_sex,
|
||||||
cs_new.address as cs_new_address,
|
cs_new.address as cs_new_address,
|
||||||
cs_new.work_date as cs_new_work_date,
|
cs_new.work_date as cs_new_work_date,
|
||||||
cs_new.work_year as cs_new_work_year,
|
cs_new.work_year as cs_new_work_year,
|
||||||
cs_new.joined_date as cs_new_joined_date,
|
cs_new.joined_date as cs_new_joined_date,
|
||||||
cs_new.joined_year as cs_new_joined_year,
|
cs_new.joined_year as cs_new_joined_year,
|
||||||
cs_new.education as cs_new_education,
|
cs_new.education as cs_new_education,
|
||||||
cs_new.content as cs_new_content,
|
cs_new.content as cs_new_content,
|
||||||
cs_new.unique_code as cs_new_unique_code,
|
cs_new.unique_code as cs_new_unique_code,
|
||||||
cs_new.file_urls as cs_new_file_urls
|
cs_new.file_urls as cs_new_file_urls
|
||||||
FROM company_staff_change csc
|
FROM company_staff_change csc
|
||||||
INNER JOIN company_staff cs_old ON csc.old_user_id = cs_old.user_id
|
INNER JOIN company_staff cs_old ON csc.old_user_id = cs_old.user_id
|
||||||
INNER JOIN company_staff cs_new ON csc.new_user_id = cs_new.user_id
|
INNER JOIN company_staff cs_new ON csc.new_user_id = cs_new.user_id
|
||||||
where csc.deleted = '0'
|
where csc.deleted = '0'
|
||||||
<if test="map.name != null and map.name != ''">
|
<if test="map.name != null and map.name != ''">
|
||||||
and (cs_old.name like concat('%', #{map.name}, '%') or cs_new.name like concat('%', #{map.name}, '%'))
|
and (cs_old.name like concat('%', #{map.name}, '%') or cs_new.name like concat('%', #{map.name}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="map.workNo != null and map.workNo != ''">
|
<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>
|
||||||
<if test="map.tel != null and map.tel != ''">
|
<if test="map.tel != null and map.tel != ''">
|
||||||
and (cs_old.tel like concat('%', #{map.tel}, '%') or cs_new.tel like concat('%', #{map.tel}, '%'))
|
and (cs_old.tel like concat('%', #{map.tel}, '%') or cs_new.tel like concat('%', #{map.tel}, '%'))
|
||||||
@ -100,7 +101,7 @@
|
|||||||
and (csc.change_time between #{map.changeTimeArray[0]} and #{map.changeTimeArray[1]})
|
and (csc.change_time between #{map.changeTimeArray[0]} and #{map.changeTimeArray[1]})
|
||||||
</if>
|
</if>
|
||||||
<if test="map.oldUserIds != null and map.oldUserIds.size > 0">
|
<if test="map.oldUserIds != null and map.oldUserIds.size > 0">
|
||||||
and csc.old_user_id in
|
and csc.old_user_id in
|
||||||
<foreach collection="map.oldUserIds" item="userId" open="(" separator="," close=")">
|
<foreach collection="map.oldUserIds" item="userId" open="(" separator="," close=")">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
Loading…
Reference in New Issue
Block a user