机构邀请员工

This commit is contained in:
1378012178@qq.com 2025-09-11 11:15:34 +08:00
parent 44accb2336
commit 452c00f7e8
11 changed files with 134 additions and 56 deletions

View File

@ -11,4 +11,6 @@ public interface EmployeesOrgLocalApi {
List<EmployeesOrgApiEntity> queryAll(String orgCodes,String openId);
String canApply(String employeeId, String orgCode);
void invitedConfirm(EmployeesApplyEntity dto);
}

View File

@ -16,5 +16,5 @@ public interface IOrgApplyInfoApi {
IPage<OrgAllInfoApiEntity> queryOrgAllInfo(Integer pageNo, Integer pageSize, String orgCode, String title);
List<OrgAllInfoApiEntity> getOrgByOpenId(String status,String openId);
List<OrgAllInfoApiEntity> getOrgByOpenId(String status,String openId,String invited);
}

View File

@ -186,6 +186,8 @@ public class OrgAllInfoApiEntity implements Serializable {
private String applyTime;
/**审核日期*/
private String auditTime;
/**员工id*/
private String employeesId;
/** 员工信息*/
private EmployeesApiEntity employeesApiEntity;

View File

@ -7,8 +7,11 @@ import com.nu.entity.EmployeesApplyEntity;
import com.nu.modules.EmployessInfo.api.EmployeesOrgLocalApi;
import com.nu.modules.EmployessInfo.entity.EmployeesOrgApiEntity;
import com.nu.modules.employees.entity.EmployeesOrg;
import com.nu.modules.employees.entity.NuEmployeesAdvisoryInfo;
import com.nu.modules.employees.mapper.EmployeesOrgMapper;
import com.nu.modules.employees.service.IEmployeesOrgService;
import com.nu.modules.employees.service.INuEmployeesAdvisoryInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -24,15 +27,19 @@ import java.util.List;
@Service
public class EmployeesOrgServiceImpl extends ServiceImpl<EmployeesOrgMapper, EmployeesOrg> implements IEmployeesOrgService, EmployeesOrgLocalApi {
@Autowired
private INuEmployeesAdvisoryInfoService employeesAdvisoryInfoService;
@Override
public String apply(EmployeesApplyEntity dto) {
//先将旧数据置为历史状态
UpdateWrapper<EmployeesOrg> uw = new UpdateWrapper<>();
uw.eq("employees_id",dto.getEmployeeId());
uw.eq("org_code",dto.getOrgCode());
uw.eq("employees_id", dto.getEmployeeId());
uw.eq("org_code", dto.getOrgCode());
uw.eq("iz_history", "1");
EmployeesOrg udto = new EmployeesOrg();
udto.setIzHistory("0");
baseMapper.update(udto,uw);
baseMapper.update(udto, uw);
EmployeesOrg employeesOrg = new EmployeesOrg();
employeesOrg.setOpenId(dto.getOpenId());
@ -47,11 +54,11 @@ public class EmployeesOrgServiceImpl extends ServiceImpl<EmployeesOrgMapper, Emp
}
@Override
public List<EmployeesOrgApiEntity> queryAll(String orgCodes,String openId) {
public List<EmployeesOrgApiEntity> queryAll(String orgCodes, String openId) {
QueryWrapper<EmployeesOrg> qw = new QueryWrapper<>();
qw.in("org_code", orgCodes.split(","));
qw.eq("open_id",openId);
qw.eq("iz_history","1");
qw.eq("open_id", openId);
qw.eq("iz_history", "1");
List<EmployeesOrg> list = baseMapper.selectList(qw);
List<EmployeesOrgApiEntity> result = BeanUtil.copyToList(list, EmployeesOrgApiEntity.class);
return result;
@ -61,17 +68,40 @@ public class EmployeesOrgServiceImpl extends ServiceImpl<EmployeesOrgMapper, Emp
public String canApply(String employeeId, String orgCode) {
QueryWrapper<EmployeesOrg> qw = new QueryWrapper<>();
qw.eq("employees_id", employeeId);
qw.eq("org_code",orgCode);
qw.eq("iz_history","1");
qw.eq("org_code", orgCode);
qw.eq("iz_history", "1");
EmployeesOrg employeesOrg = baseMapper.selectOne(qw);
if(employeesOrg != null ){
if("1".equals(employeesOrg.getStatus())){
return "申请已提交";
if (employeesOrg != null) {
if ("1".equals(employeesOrg.getStatus())) {
return "申请已提交";
}
if("2".equals(employeesOrg.getStatus())){
if ("2".equals(employeesOrg.getStatus())) {
return "已加入机构,请勿重复提交";
}
}
return "";
}
@Override
public void invitedConfirm(EmployeesApplyEntity dto) {
UpdateWrapper<EmployeesOrg> uw = new UpdateWrapper<>();
uw.eq("employees_id", dto.getEmployeeId());
uw.eq("org_code", dto.getOrgCode());
uw.eq("iz_history", "1");
uw.eq("is_invited", "0");
EmployeesOrg udto = new EmployeesOrg();
udto.setStatus(dto.getStatus());
if ("2".equals(dto.getStatus())) {
udto.setEntryTime(dto.getOpeTime());//审批通过的话将入职时间设置进去
}
baseMapper.update(udto, uw);
if ("2".equals(dto.getStatus())) {
//修改员工注册表的入驻状态
NuEmployeesAdvisoryInfo employeesAd = new NuEmployeesAdvisoryInfo();
employeesAd.setId(dto.getEmployeeId());
employeesAd.setIzEntry("0");
employeesAdvisoryInfoService.updateById(employeesAd);
}
}
}

View File

@ -19,6 +19,9 @@ public class OrgAllInfo implements Serializable {
/**机构id*/
private String orgId;
/**员工id*/
private String employeesId;
/**
* 机构/部门名称
*/

View File

@ -20,5 +20,5 @@ public interface OrgApplyInfoMapper extends BaseMapper<OrgApplyInfo> {
IPage<OrgAllInfo> queryOrgInfo(@Param("page") IPage<OrgAllInfo> page, @Param("orgCode") String orgCode, @Param("title") String title);
IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, @Param("openId") String openId, @Param("status") String status);
IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, @Param("openId") String openId, @Param("status") String status, @Param("invited") String invited);
}

View File

@ -80,10 +80,13 @@
d.iz_elder_tag_main,
d.media_url,
o.*,
eo.open_id,
eo.employees_id,
eo.org_code,
eo.status AS applyStatus,
eo.iz_online,
eo.iz_freeze,
eo.iz_invited,
eo.is_invited,
eo.entry_time,
eo.create_time AS apply_time,
eo.update_time AS audit_time
@ -101,6 +104,9 @@
#{item}
</foreach>
</if>
<if test="invited !=null and invited != ''">
and eo.is_invited = #{invited}
</if>
</where>
<choose>
<when test='status != null and status == "2"'>
@ -108,6 +114,7 @@
</when>
<otherwise>
ORDER BY
eo.iz_history desc,
CASE eo.status
WHEN '2' THEN 1
WHEN '1' THEN 2

View File

@ -344,7 +344,7 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
@Override
public IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, String openId) {
return baseMapper.getOrgByOpenId(page, openId,"2");
return baseMapper.getOrgByOpenId(page, openId,"2",null);
}
@Override
@ -368,9 +368,9 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
}
@Override
public List<OrgAllInfoApiEntity> getOrgByOpenId(String status,String openId) {
public List<OrgAllInfoApiEntity> getOrgByOpenId(String status,String openId,String invited) {
IPage<OrgAllInfo> page = new Page<>(1, -1);
IPage<OrgAllInfo> r_ = baseMapper.getOrgByOpenId(page, openId,status);
IPage<OrgAllInfo> r_ = baseMapper.getOrgByOpenId(page, openId,status,invited);
List<OrgAllInfo> records = r_.getRecords();
List<OrgAllInfoApiEntity> result = BeanUtil.copyToList(records, OrgAllInfoApiEntity.class);
return result;

View File

@ -17,6 +17,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -43,7 +44,7 @@ public class EmployessApplyApi {
if (StringUtils.isBlank(dto.getOrgCode())) {
return Result.error("申请失败");
}
String msg = employeesOrgLocalApi.canApply(dto.getEmployeeId(),dto.getOrgCode());
String msg = employeesOrgLocalApi.canApply(dto.getEmployeeId(), dto.getOrgCode());
if (StringUtils.isNotBlank(msg)) {
return Result.error(msg);
}
@ -85,7 +86,7 @@ public class EmployessApplyApi {
if (orgCodes.endsWith(",")) {
orgCodes.substring(0, orgCodes.length() - 2);
}
List<EmployeesOrgApiEntity> employeesOrgList = employeesOrgLocalApi.queryAll(orgCodes,openId);
List<EmployeesOrgApiEntity> employeesOrgList = employeesOrgLocalApi.queryAll(orgCodes, openId);
if (employeesOrgList != null && employeesOrgList.size() > 0) {
employeesOrgList.stream().forEach(eo -> {
EmployeesApiEntity en = new EmployeesApiEntity();
@ -109,8 +110,37 @@ public class EmployessApplyApi {
* @return
*/
@GetMapping(value = "/getEmployeesOrgRela")
public Result<List<OrgAllInfoApiEntity>> getEmployeesOrgRela(@RequestParam(value = "status", required = false) String status, @RequestParam(value = "openId") String openId) {
List<OrgAllInfoApiEntity> result = orgApplyInfoApi.getOrgByOpenId(status, openId);
public Result<List<OrgAllInfoApiEntity>> getEmployeesOrgRela(@RequestParam(value = "status", required = false) String status, @RequestParam(value = "invited",required = false) String invited, @RequestParam(value = "openId") String openId) {
List<OrgAllInfoApiEntity> result = orgApplyInfoApi.getOrgByOpenId(status, openId, invited);
return Result.OK(result);
}
/**
* 机构邀请员工-员工确认操作
* 1需要修改员工机构表被邀请的那条记录的status 2同意/3拒绝
* 2给对应机构发通知让他修改邀请结果
* 3如果通过将此人是否已加入机构改为已加入
*
* @param dto employeeId status orgCode 必传
* @return
*/
@AutoLog(value = "机构邀请员工-员工确认操作")
@PostMapping("/invitedConfirm")
public Result<Object> invitedConfirm(@RequestBody EmployeesApplyEntity dto) {
if (StringUtils.isBlank(dto.getOrgCode())) {
return Result.error("申请失败");
}
dto.setOpeTime(new Date());
employeesOrgLocalApi.invitedConfirm(dto);
EmployeesApplyMQDto mqdto = new EmployeesApplyMQDto();
mqdto.setStatus(dto.getStatus());
mqdto.setEmployeeId(dto.getEmployeeId());
mqdto.setOrgCode(dto.getOrgCode());
mqdto.setOpeTime(dto.getOpeTime());
rabbitMQUtil.sendToExchange("hldy.employees", dto.getOrgCode() + ".employees.invitedConfirm", mqdto);
return Result.ok();
}
}

View File

@ -15,78 +15,80 @@ import java.util.Date;
public class EmployeesApplyMQDto implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
/**id*/
private String id;
/**open_id*/
private String openId;
/**员工id*/
private String employeeId;
/**姓名*/
/**姓名*/
private String name;
/**性别*/
/**性别*/
private String sex;
/**民族*/
/**民族*/
private String national;
/**身份证号*/
/**身份证号*/
private String idCard;
/**联系电话*/
/**联系电话*/
private String tel;
/**出生日期*/
/**出生日期*/
private Date dateOfBirth;
/**婚否*/
/**婚否*/
private String marriedOrNot;
/**身高*/
/**身高*/
private Double height;
/**体重*/
/**体重*/
private Double weight;
/**家庭住址*/
/**家庭住址*/
private String address;
/**是否吸烟*/
/**是否吸烟*/
private String isSmoking;
/**健康状况*/
/**健康状况*/
private String healthStatus;
/**户籍所在地*/
/**户籍所在地*/
private String houseAddress;
/**政治面貌*/
/**政治面貌*/
private String politicalAppearance;
/**紧急联系人*/
/**紧急联系人*/
private String emergencyContact;
/**紧急联系人电话*/
/**紧急联系人电话*/
private String emergencyTel;
/**紧急联系人与本人关系*/
/**紧急联系人与本人关系*/
private String emergencyRelationship;
/**户口性质*/
/**户口性质*/
private String hukouNature;
/**身份证正面*/
/**身份证正面*/
private String idCardPositive;
/**身份证反面*/
/**身份证反面*/
private String idCardNegative;
/**健康证正面*/
/**健康证正面*/
private String healthCertificatePositive;
/**健康证反面*/
/**健康证反面*/
private String healthCertificateNegative;
/**银行卡正面*/
/**银行卡正面*/
private String bankPositive;
/**银行卡反面*/
/**银行卡反面*/
private String bankNegative;
/**资质证*/
/**资质证*/
private String qualification;
/**无犯罪证明*/
/**无犯罪证明*/
private String noCrimeCertificate;
/**区域*/
/**区域*/
private String regional;
/**是否删除 0未删除 1删除*/
/**是否删除 0未删除 1删除*/
private String delFlag;
/**申请日期*/
/**申请日期*/
private Date createTime;
/**更新人*/
/**更新人*/
private String updateBy;
/**更新日期*/
/**更新日期*/
private Date updateTime;
/**申请状态 1申请中 2通过 3驳回*/
/**申请状态 1申请中 2通过 3驳回*/
private String status;
/**审核备注*/
/**审核备注*/
private String auditContent;
/**机构编码*/
private String orgCode;
/**操作时间*/
private Date opeTime;
}

View File

@ -93,4 +93,6 @@ public class EmployeesApplyEntity implements Serializable {
private String auditContent;
/**机构编码*/
private String orgCode;
private Date opeTime;
}