员工申请加入机构流程 小程序需要的接口
This commit is contained in:
parent
544b464db4
commit
d1acb58d7e
|
|
@ -7,6 +7,8 @@ import java.util.List;
|
|||
|
||||
public interface EmployeesOrgLocalApi {
|
||||
|
||||
void apply(EmployeesApplyEntity dto);
|
||||
String apply(EmployeesApplyEntity dto);
|
||||
List<EmployeesOrgApiEntity> queryAll(String orgCodes);
|
||||
|
||||
String canApply(String employeeId, String orgCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ public interface IOrgApplyInfoApi {
|
|||
List<OrgApplyInfoApiEntity> queryAuditInfo(String openId, String id, String status);
|
||||
|
||||
IPage<OrgAllInfoApiEntity> queryOrgAllInfo(Integer pageNo, Integer pageSize, String orgCode, String title);
|
||||
|
||||
List<OrgAllInfoApiEntity> getOrgByOpenId(String status,String openId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,6 +171,20 @@ public class OrgAllInfoApiEntity implements Serializable {
|
|||
/** 加盟时间*/
|
||||
private Date franchiseTime;
|
||||
|
||||
|
||||
/** 审核状态 1申请中 2通过 3拒绝*/
|
||||
private String applyStatus;
|
||||
/** 是否线上机构 0是1否*/
|
||||
private String izOnline;
|
||||
/** 是否冻结 0是1否*/
|
||||
private String izFreeze;
|
||||
/** 入职时间*/
|
||||
private String entryTime;
|
||||
/**申请日期*/
|
||||
private String applyTime;
|
||||
/**审核日期*/
|
||||
private String auditTime;
|
||||
|
||||
/** 员工信息*/
|
||||
private EmployeesApiEntity employeesApiEntity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ import java.util.List;
|
|||
/**
|
||||
* @Description: 员工-机构关系中间表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-09-05
|
||||
* @Date: 2025-09-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class EmployeesOrgServiceImpl extends ServiceImpl<EmployeesOrgMapper, EmployeesOrg> implements IEmployeesOrgService, EmployeesOrgLocalApi {
|
||||
|
||||
@Override
|
||||
public void apply(EmployeesApplyEntity dto) {
|
||||
public String apply(EmployeesApplyEntity dto) {
|
||||
EmployeesOrg employeesOrg = new EmployeesOrg();
|
||||
employeesOrg.setOpenId(dto.getOpenId());
|
||||
employeesOrg.setEmployeesId(dto.getEmployeeId());
|
||||
|
|
@ -33,14 +33,32 @@ public class EmployeesOrgServiceImpl extends ServiceImpl<EmployeesOrgMapper, Emp
|
|||
employeesOrg.setIzOnline("1");
|
||||
employeesOrg.setIzFreeze("0");
|
||||
baseMapper.insert(employeesOrg);
|
||||
return employeesOrg.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmployeesOrgApiEntity> queryAll(String orgCodes) {
|
||||
QueryWrapper<EmployeesOrg> qw = new QueryWrapper<>();
|
||||
qw.in("org_code",orgCodes.split(","));
|
||||
qw.in("org_code", orgCodes.split(","));
|
||||
List<EmployeesOrg> list = baseMapper.selectList(qw);
|
||||
List<EmployeesOrgApiEntity> result = BeanUtil.copyToList(list, EmployeesOrgApiEntity.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String canApply(String employeeId, String orgCode) {
|
||||
QueryWrapper<EmployeesOrg> qw = new QueryWrapper<>();
|
||||
qw.eq("employees_id", employeeId);
|
||||
qw.eq("org_code",orgCode);
|
||||
EmployeesOrg employeesOrg = baseMapper.selectOne(qw);
|
||||
if(employeesOrg != null ){
|
||||
if("1".equals(employeesOrg.getStatus())){
|
||||
return "申请已提交";
|
||||
}
|
||||
if("2".equals(employeesOrg.getStatus())){
|
||||
return "已加入机构,请勿重复提交";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,10 +170,17 @@ public class OrgAllInfo implements Serializable {
|
|||
private String contractNote;
|
||||
/** 加盟时间*/
|
||||
private Date franchiseTime;
|
||||
|
||||
/** 审核状态 1申请中 2通过 3拒绝*/
|
||||
private String applyStatus;
|
||||
/** 是否线上机构 0是1否*/
|
||||
private String izOnline;
|
||||
/** 是否冻结 0是1否*/
|
||||
private String izFreeze;
|
||||
/** 入职时间*/
|
||||
private String entryTime;
|
||||
/**申请日期*/
|
||||
private String applyTime;
|
||||
/**审核日期*/
|
||||
private String auditTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, @Param("openId") String openId, @Param("status") String status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,11 @@
|
|||
<where>
|
||||
o.status = '2'
|
||||
and d.del_flag = '0'
|
||||
<if test="orgCode !=null and orgCode != ''">
|
||||
AND d.org_code = #{orgCode}
|
||||
<if test="orgCode != null and orgCode != ''">
|
||||
AND d.org_code IN
|
||||
<foreach item="item" collection="orgCode.split(',')" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
AND d.depart_name LIKE CONCAT('%', #{title}, '%')
|
||||
|
|
@ -77,18 +80,31 @@
|
|||
d.iz_elder_tag_main,
|
||||
d.media_url,
|
||||
o.*,
|
||||
eo.status AS applyStatus,
|
||||
eo.iz_online,
|
||||
eo.iz_freeze,
|
||||
eo.entry_time
|
||||
eo.entry_time,
|
||||
eo.create_time AS apply_time,
|
||||
eo.update_time AS audit_time
|
||||
from sys_depart d
|
||||
inner join nu_org_apply_info o on d.id = o.pk_id
|
||||
inner join nu_biz_employees_org eo on d.org_code = eo.org_code
|
||||
<where>
|
||||
o.status = '2'
|
||||
and d.del_flag = '0'
|
||||
and eo.status = '2'
|
||||
AND eo.open_id = #{openId}
|
||||
<if test="status != null and status != ''">
|
||||
and eo.status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by (d.org_code + 0) asc
|
||||
<choose>
|
||||
<when test='status != null and status == "2"'>
|
||||
ORDER BY (d.org_code + 0) ASC
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY eo.create_time DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -341,10 +341,12 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
|
|||
public IPage<OrgAllInfo> queryOrgInfo(IPage<OrgAllInfo> page, String orgCode, String title) {
|
||||
return baseMapper.queryOrgInfo(page, orgCode, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, String openId) {
|
||||
return baseMapper.getOrgByOpenId(page, openId);
|
||||
public IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, String openId) {
|
||||
return baseMapper.getOrgByOpenId(page, openId,"2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<OrgAllInfoApiEntity> queryOrgAllInfo(Integer pageNo, Integer pageSize, String orgCode, String title) {
|
||||
IPage<OrgAllInfo> page = new Page<>(pageNo, pageSize);
|
||||
|
|
@ -356,7 +358,7 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
|
|||
resultPage.setPages(orgAllInfoIPage.getPages());
|
||||
|
||||
List<OrgAllInfo> records = orgAllInfoIPage.getRecords();
|
||||
if(records == null || records.size() <= 0){
|
||||
if (records == null || records.size() <= 0) {
|
||||
List<OrgAllInfoApiEntity> l_ = List.of();
|
||||
resultPage.setRecords(l_);
|
||||
return resultPage;
|
||||
|
|
@ -364,4 +366,13 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
|
|||
resultPage.setRecords(BeanUtil.copyToList(records, OrgAllInfoApiEntity.class));
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgAllInfoApiEntity> getOrgByOpenId(String status,String openId) {
|
||||
IPage<OrgAllInfo> page = new Page<>(1, -1);
|
||||
IPage<OrgAllInfo> r_ = baseMapper.getOrgByOpenId(page, openId,status);
|
||||
List<OrgAllInfo> records = r_.getRecords();
|
||||
List<OrgAllInfoApiEntity> result = BeanUtil.copyToList(records, OrgAllInfoApiEntity.class);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.nu.mq.employees.listener;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.nu.dto.EmployeesStatusMQDto;
|
||||
import com.nu.modules.employees.entity.EmployeesOrg;
|
||||
import com.nu.modules.employees.entity.NuEmployeesAdvisoryInfo;
|
||||
import com.nu.modules.employees.service.IEmployeesOrgService;
|
||||
import com.nu.modules.employees.service.INuEmployeesAdvisoryInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.ExchangeTypes;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
|
|
@ -19,6 +21,8 @@ public class EmployeesMQListener {
|
|||
|
||||
@Autowired
|
||||
private IEmployeesOrgService employeesOrgService;
|
||||
@Autowired
|
||||
private INuEmployeesAdvisoryInfoService employeesAdvisoryInfoService;
|
||||
|
||||
/**
|
||||
* 员工-机构关系状态调整
|
||||
|
|
@ -34,6 +38,11 @@ public class EmployeesMQListener {
|
|||
employeesOrg.setAuditContent(dto.getAuditContent());
|
||||
if("2".equals(dto.getAuditStatus())){
|
||||
employeesOrg.setEntryTime(dto.getEntryTime());//审批通过的话将入职时间设置进去
|
||||
//修改员工注册表的入驻状态
|
||||
NuEmployeesAdvisoryInfo employeesAd = new NuEmployeesAdvisoryInfo();
|
||||
employeesAd.setId(dto.getEmployeeId());
|
||||
employeesAd.setIzEntry("0");
|
||||
employeesAdvisoryInfoService.updateById(employeesAd);
|
||||
}
|
||||
UpdateWrapper<EmployeesOrg> uw = new UpdateWrapper<>();
|
||||
uw.eq("employees_id",dto.getEmployeeId());
|
||||
|
|
|
|||
|
|
@ -44,11 +44,16 @@ public class EmployessApplyApi {
|
|||
if (StringUtils.isBlank(dto.getOrgCode())) {
|
||||
return Result.error("申请失败");
|
||||
}
|
||||
String msg = employeesOrgLocalApi.canApply(dto.getEmployeeId(),dto.getOrgCode());
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
return Result.error(msg);
|
||||
}
|
||||
|
||||
employeesOrgLocalApi.apply(dto);
|
||||
String id = employeesOrgLocalApi.apply(dto);
|
||||
|
||||
EmployeesApplyMQDto mqdto = new EmployeesApplyMQDto();
|
||||
BeanUtils.copyProperties(dto,mqdto);
|
||||
BeanUtils.copyProperties(dto, mqdto);
|
||||
mqdto.setId(id);
|
||||
rabbitMQUtil.sendToExchange("hldy.employees", dto.getOrgCode() + ".employees.apply", mqdto);
|
||||
|
||||
return Result.ok();
|
||||
|
|
@ -75,11 +80,14 @@ public class EmployessApplyApi {
|
|||
String orgCodes = "";
|
||||
for (int i = 0; i < sourceRecords.size(); i++) {
|
||||
indexMap.put(sourceRecords.get(i).getOrgCode(), i);
|
||||
orgCodes += sourceRecords.get(i).getOrgCode();
|
||||
orgCodes += sourceRecords.get(i).getOrgCode() + ",";
|
||||
}
|
||||
if (orgCodes.endsWith(",")) {
|
||||
orgCodes.substring(0, orgCodes.length() - 2);
|
||||
}
|
||||
List<EmployeesOrgApiEntity> employeesOrgList = employeesOrgLocalApi.queryAll(orgCodes);
|
||||
if (employeesOrgList != null && employeesOrgList.size() > 0) {
|
||||
employeesOrgList.stream().forEach( eo -> {
|
||||
employeesOrgList.stream().forEach(eo -> {
|
||||
EmployeesApiEntity en = new EmployeesApiEntity();
|
||||
en.setStatus(eo.getStatus());
|
||||
en.setAuditContent(eo.getAuditContent());
|
||||
|
|
@ -91,4 +99,17 @@ public class EmployessApplyApi {
|
|||
}
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工-机构关系列表
|
||||
*
|
||||
* @param openId 员工微信id
|
||||
* @param status 审核状态
|
||||
* @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);
|
||||
return Result.OK(result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue