员工入职机构

This commit is contained in:
1378012178@qq.com 2025-09-11 08:59:33 +08:00
parent c7b3a7d076
commit 9d9f757ce7
12 changed files with 383 additions and 244 deletions

View File

@ -1,8 +1,13 @@
package com.nu.modules.employeesInfo.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.common.collect.Maps;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import com.nu.modules.employeesInfo.entity.BizEmployeesInfo;

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.dto.EmployeesApplyMQDto;
import com.nu.dto.EmployeesStatusMQDto;
import com.nu.modules.employeesInfo.entity.BizEmployeesInfo;
import com.nu.modules.employeesInfo.service.IBizEmployeesInfoService;
@ -219,4 +220,42 @@ public class EmployeesApplyController extends JeecgController<EmployeesApply, IE
return super.importExcel(request, response, EmployeesApply.class);
}
/**
* 邀请
*
* @param employeesApply
* @return
*/
@AutoLog(value = "员工申请-邀请")
@ApiOperation(value = "员工申请-邀请", notes = "员工申请-邀请")
@PostMapping(value = "/invide")
public Result<String> invide(@RequestBody EmployeesApply employeesApply) {
//先查下员工在机构负责人停留界面期间是否进行了申请
QueryWrapper<EmployeesApply> qw = new QueryWrapper<>();
qw.eq("employee_id",employeesApply.getEmployeeId());
qw.eq("iz_history","1");
qw.eq("status","1");
EmployeesApply one = employeesApplyService.getOne(qw);
if(one !=null){
return Result.error("员工已申请加入机构,请在审核管理中进行审批");
}
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
String orgCode = deptInfo.getString("code");
employeesApply.setId(null);
employeesApply.setEmployeeId(employeesApply.getEmployeeId());
employeesApply.setStatus("1");
employeesApply.setDelFlag("0");
employeesApply.setIzHistory("1");
employeesApply.setIsInvited("0");
employeesApplyService.save(employeesApply);
//告诉管理平台 像员工-机构关系表nu_biz_employees_org 增加数据
EmployeesApplyMQDto mqdto = new EmployeesApplyMQDto();
BeanUtils.copyProperties(employeesApply, mqdto);
mqdto.setOrgCode(orgCode);
rabbitMQUtil.sendToExchange("hldy.employees", "hldy.employees.invide", mqdto);
return Result.OK("邀请成功!");
}
}

View File

@ -186,6 +186,11 @@ public class EmployeesApply implements Serializable {
@Excel(name = "是否历史数据", width = 15)
@ApiModelProperty(value = "是否历史数据")
private java.lang.String izHistory;
/**是否为被邀请 0被邀请 1主动申请*/
@Excel(name = "是否为被邀请", width = 15)
@ApiModelProperty(value = "是否为被邀请")
private java.lang.String isInvited;
/**
* 审批字符串 有值时说明是走的审批
* auditPass 审批通过
@ -193,4 +198,7 @@ public class EmployeesApply implements Serializable {
*/
@TableField(exist = false)
private String statusVal;
/**openId*/
@TableField(exist = false)
private String openId;
}

View File

@ -14,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface EmployeesApplyMapper extends BaseMapper<EmployeesApply> {
int cleanErrorInvided(@Param("employeeId") String employeeId);
}

View File

@ -2,4 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nu.modules.employeesapply.mapper.EmployeesApplyMapper">
<delete id="cleanErrorInvided">
delete from nu_biz_employees_apply where employee_id = #{employeeId} and iz_history = '1' and is_invited = '1'
</delete>
</mapper>

View File

@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IEmployeesApplyService extends IService<EmployeesApply> {
void cleanErrorInvided(String employeeId);
}

View File

@ -1,5 +1,6 @@
package com.nu.modules.employeesapply.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nu.modules.employeesapply.entity.EmployeesApply;
import com.nu.modules.employeesapply.mapper.EmployeesApplyMapper;
import com.nu.modules.employeesapply.service.IEmployeesApplyService;
@ -7,6 +8,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/**
* @Description: 员工申请
* @Author: jeecg-boot
@ -16,4 +19,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class EmployeesApplyServiceImpl extends ServiceImpl<EmployeesApplyMapper, EmployeesApply> implements IEmployeesApplyService {
@Override
public void cleanErrorInvided(String employeeId) {
//删掉已保存的错误数据
baseMapper.cleanErrorInvided(employeeId);
//将最后一次申请的记录历史状态改为飞历史
QueryWrapper<EmployeesApply> qw = new QueryWrapper<>();
qw.orderByDesc("create_time");
List<EmployeesApply> list = baseMapper.selectList(qw);
if (list != null && list.size() > 0) {
EmployeesApply employeesApply = list.get(0);
employeesApply.setIzHistory("1");
baseMapper.updateById(employeesApply);
}
}
}

View File

@ -1,10 +1,17 @@
package com.nu.modules.employessadvisiory.controller;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.nu.modules.employeesInfo.entity.BizEmployeesInfo;
import com.nu.modules.employeesInfo.service.IBizEmployeesInfoService;
import com.nu.modules.employeesapply.entity.EmployeesApply;
import com.nu.modules.employeesapply.service.IEmployeesApplyService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import com.nu.modules.employessadvisiory.entity.NuEmployeesAdvisoryInfo;
@ -37,6 +44,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
public class NuEmployeesAdvisoryInfoController extends JeecgController<NuEmployeesAdvisoryInfo, INuEmployeesAdvisoryInfoService> {
@Autowired
private INuEmployeesAdvisoryInfoService nuEmployeesAdvisoryInfoService;
@Autowired
private IBizEmployeesInfoService bizEmployeesInfoService;
@Autowired
private IEmployeesApplyService employeesApplyService;
/**
* 分页列表查询
@ -50,14 +61,40 @@ public class NuEmployeesAdvisoryInfoController extends JeecgController<NuEmploye
//@AutoLog(value = "员工咨询信息-分页列表查询")
@ApiOperation(value = "员工咨询信息-分页列表查询", notes = "员工咨询信息-分页列表查询")
@GetMapping(value = "/list")
@DS("ope")
public Result<IPage<NuEmployeesAdvisoryInfo>> queryPageList(NuEmployeesAdvisoryInfo nuEmployeesAdvisoryInfo,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
//先查询出需要排除的员工ids
QueryWrapper<BizEmployeesInfo> qw1 = new QueryWrapper<>();
qw1.select("id");
List<BizEmployeesInfo> list1 = bizEmployeesInfoService.list(qw1);
List<String> ids1 = list1.stream()
.map(BizEmployeesInfo::getId)
.map(String::valueOf)
.collect(Collectors.toList());
QueryWrapper<EmployeesApply> qw2 = new QueryWrapper<EmployeesApply>();
List<EmployeesApply> list2 = employeesApplyService.list(qw2);
List<String> ids2 = list2.stream()
.map(EmployeesApply::getEmployeeId)
.map(String::valueOf)
.collect(Collectors.toList());
if (ids1 != null) {
ids1.addAll(ids2);
} else {
ids1 = ids2;
}
//切换为本地数据源
DynamicDataSourceContextHolder.push("ope");
QueryWrapper<NuEmployeesAdvisoryInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuEmployeesAdvisoryInfo, req.getParameterMap());
Page<NuEmployeesAdvisoryInfo> page = new Page<NuEmployeesAdvisoryInfo>(pageNo, pageSize);
if (ids1 != null && ids1.size() > 0) {
queryWrapper.notIn("id", ids1);
}
IPage<NuEmployeesAdvisoryInfo> pageList = nuEmployeesAdvisoryInfoService.page(page, queryWrapper);
DynamicDataSourceContextHolder.clear();
return Result.OK(pageList);
}

View File

@ -8,14 +8,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.camerainfo.api.CameraInfoApi;
import com.nu.modules.camerainfo.entity.CameraInfoDto;
import com.nu.modules.customerDirective.entity.NuCustomerDirective;
import com.nu.modules.customerDirective.service.INuCustomerDirectiveService;
import com.nu.modules.nuBaseInfo.entity.NuBaseInfo;
import com.nu.modules.nuBaseInfo.mapper.NuBaseInfoMapper;
import com.nu.modules.nuBaseInfo.service.INuBaseInfoService;
import com.nu.modules.nuBizCustomerInfo.entity.NuBizCustomerInfo;
import com.nu.modules.nuBizCustomerInfo.mapper.NuBizCustomerInfoMapper;
import com.nu.modules.nuBizCustomerInfo.service.INuBizCustomerInfoService;
import com.nu.modules.nubaseinfo.api.INuBaseInfoApi;
import com.nu.modules.nubaseinfo.entity.CustomerDirectiveDto;
import com.nu.modules.nubaseinfo.entity.CustomerInfoDto;
@ -49,9 +46,6 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
@Autowired
private NuBizCustomerInfoMapper customerInfoMapper;
@Autowired
private INuCustomerDirectiveService nuCustomerDirectiveService;
@Override
public void setNuId(NuBaseInfo nuBaseInfo) {
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
@ -150,12 +144,12 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
BeanUtils.copyProperties(nuBizCustomerInfo,customerInfo);
nuBaseInfoApiDto.setCustomerInfo(customerInfo);
//根据客户id查询服务指令
List<NuCustomerDirective> customerDirectiveList = nuCustomerDirectiveService.list(new QueryWrapper<NuCustomerDirective>().lambda().eq(NuCustomerDirective::getCustomerId,customerInfo.getId()));
if(customerDirectiveList != null && customerDirectiveList.size() > 0){
List<CustomerDirectiveDto> customerDirectiveDtoList = new ArrayList<>();
BeanUtils.copyProperties(customerDirectiveList,customerDirectiveDtoList);
nuBaseInfoApiDto.setCustomerDirectiveDtoList(customerDirectiveDtoList);
}
// List<NuCustomerDirective> customerDirectiveList = nuCustomerDirectiveService.list(new QueryWrapper<NuCustomerDirective>().lambda().eq(NuCustomerDirective::getCustomerId,customerInfo.getId()));
// if(customerDirectiveList != null && customerDirectiveList.size() > 0){
// List<CustomerDirectiveDto> customerDirectiveDtoList = new ArrayList<>();
// BeanUtils.copyProperties(customerDirectiveList,customerDirectiveDtoList);
// nuBaseInfoApiDto.setCustomerDirectiveDtoList(customerDirectiveDtoList);
// }
}
});
});

View File

@ -25,4 +25,18 @@ public class DynamicQueueNameProvider {
public String getKeyName() {
return getQueueName();
}
public String getCanNotInvidedQueueName() {
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
String orgCode = deptInfo.getString("code");
if (StringUtils.isNotBlank(orgCode)) {
return orgCode + ".employees.cannotinvided";
} else {
return "";
}
}
public String getCanNotInvidedKeyName() {
return getCanNotInvidedQueueName();
}
}

View File

@ -53,7 +53,25 @@ public class EmployeesMQListener {
employeesApply.setStatus("1");
employeesApply.setDelFlag("0");
employeesApply.setIzHistory("1");
employeesApply.setIsInvited("1");
employeesApplyService.save(employeesApply);
}
/**
* 邀请时发现此员工已申请 清理已保存的数据
*
* @param dto
*/
@RabbitListener(
bindings = @QueueBinding(
value = @Queue(name = "#{employeesAsyncDQNP.getCanNotInvidedQueueName()}"),
exchange = @Exchange(name = "hldy.employees", type = ExchangeTypes.DIRECT),
key = "#{employeesAsyncDQNP.getCanNotInvidedKeyName()}"
),
errorHandler = "employeesMQErrorHandler"
)
public void handleCanNotInvided(EmployeesApplyMQDto dto) {
employeesApplyService.cleanErrorInvided(dto.getEmployeeId());
}
}

View File

@ -29,4 +29,6 @@ public class EmployeesStatusMQDto implements Serializable {
private String orgCode;
/**入职时间*/
private Date entryTime;
/**openId*/
private Date openId;
}