Commit e80b3fd9 authored by huyuchen's avatar huyuchen

huych-入离职登记提交

parent c01b0003
......@@ -636,6 +636,8 @@ public interface CommonConstants {
List<String> processStatus = Stream.of("0","1").collect(Collectors.toList());
List<String> processPreStatus = Stream.of("1").collect(Collectors.toList());
List<String> socialInfoStatus = Stream.of("1","3","5","7").collect(Collectors.toList());
List<String> deptList = Stream.of("安徽一册档案管理有限公司","安徽顾合企业管理咨询有限公司","安徽赤道线数字传媒科技有限公司","劳务业务中心","易服智享&研究院").collect(Collectors.toList());
......
......@@ -83,4 +83,7 @@ public class EmployeeRegistrationSearchVo extends EmployeeRegistration {
@TableField(exist = false)
private List<String> deptNoList;
@Schema(description = "列表类型 1 待办 2监控")
private String type;
}
......@@ -204,4 +204,16 @@ public class EmployeeRegistrationController {
public R<IPage<EmployeeRegistration>> getHrConfirmEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration) {
return new R<>(employeeRegistrationService.getHrConfirmEmployeeRegistrationPage(page, employeeRegistration));
}
/**
* 入职待确认表 批量导出
*
* @author huych
* @date 2025-03-13 16:55:32
**/
@Operation(description = "导出入职待确认表")
@PostMapping("/hrConfirmExport")
public void hrConfirmExport(HttpServletResponse response, @RequestBody EmployeeRegistrationSearchVo searchVo) {
employeeRegistrationService.hrConfirmExport(response, searchVo);
}
}
......@@ -84,6 +84,13 @@ public interface EmployeeRegistrationService extends IService<EmployeeRegistrati
*/
void listHrExport(HttpServletResponse response, EmployeeRegistrationSearchVo searchVo);
/**
* 入职待确认表导出
* @param searchVo 入离职登记
* @return
*/
void hrConfirmExport(HttpServletResponse response, EmployeeRegistrationSearchVo searchVo);
/**
* @param searchCspVo 身份证 与 类型
* @Description: 获取已接收的入离职申请,同步所属部门到项目档案里
......
......@@ -122,17 +122,11 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
*/
@Override
public IPage<EmployeeRegistration> getHrConfirmEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration) {
YifuUser user = SecurityUtils.getUser();
long roleId = 1839501715787390978L;
boolean isSsc = this.haveRole(user, roleId);
if (!isSsc && !CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
//获取项目信息
R<TSettleDomainRegistListVo> domainR = archivesDaprUtil.getAllDeptByCustomerLoginName(user.getUsername());
if (null != domainR && null != domainR.getData() && null != domainR.getData().getDeptNos()) {
employeeRegistration.setDeptNoList(domainR.getData().getDeptNos());
} else {
employeeRegistration.setId(CommonConstants.ONE_STRING_NEGATE);
}
//前端客服的所有项目权限赋值
initSearchVo(employeeRegistration);
//待办列表只查看未处理的数据
if (CommonConstants.ONE_STRING.equals(employeeRegistration.getType())) {
employeeRegistration.setStatusList(CommonConstants.processPreStatus);
}
return baseMapper.getEmployeeRegistrationPage(page, employeeRegistration);
}
......@@ -234,8 +228,62 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
/**
* 入离职登记表批量导出
*
* @param searchVo 入离职登记表
* @return
*/
@Override
public void hrConfirmExport(HttpServletResponse response, EmployeeRegistrationSearchVo searchVo) {
String fileName = "入职待确认批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<EmployeeRegistrationExportVo> list = new ArrayList<>();
//前端客服的所有项目权限赋值
initSearchVo(searchVo);
//待办列表只查看未处理的数据
if (CommonConstants.ONE_STRING.equals(searchVo.getType())) {
searchVo.setStatusList(CommonConstants.processPreStatus);
}
long count = baseMapper.selectExportCount(searchVo);
try (ServletOutputStream out = response.getOutputStream()) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.selectExportList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("入职待确认" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("入职待确认" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
}
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream,String deptId) {
public R<List<ErrorMessage>> importDiy(InputStream inputStream, String deptId) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeRegistrationVo> util1 = new ExcelUtil<>(EmployeeRegistrationVo.class);
YifuUser user = SecurityUtils.getUser();
......@@ -290,7 +338,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmployeeRegistration(cachedDataList, errorMessageList,user, selectVo);
importEmployeeRegistration(cachedDataList, errorMessageList, user, selectVo);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -302,7 +350,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
private void importEmployeeRegistration(List<EmployeeRegistrationVo> excelVOList,
List<ErrorMessage> errorMessageList,YifuUser user,TSettleDomainSelectVo selectVo) {
List<ErrorMessage> errorMessageList, YifuUser user, TSettleDomainSelectVo selectVo) {
Map<String, String> exitMap = new HashMap<>();
EmployeeRegistrationVo excel;
......@@ -334,17 +382,17 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), error, excel));
continue;
}
initRegistInfo(insert,user, selectVo);
initRegistInfo(insert, user, selectVo);
insertList.add(insert);
//新增记录,新增操作记录
baseMapper.insert(insert);
if (CommonConstants.ONE_STRING.equals(insert.getFeedbackType())) {
inNum ++;
inNum++;
} else {
outNum ++;
outNum++;
}
logService.saveLog(insert.getId(), CommonConstants.ZERO_STRING,RegistConstants.MESSAGE_REGIST, LocalDateTime.now(),
insert.getRegistorUsername(),null);
logService.saveLog(insert.getId(), CommonConstants.ZERO_STRING, RegistConstants.MESSAGE_REGIST, LocalDateTime.now(),
insert.getRegistorUsername(), null);
}
if (!Common.isEmpty(insertList)) {
insertList.clear();
......@@ -372,10 +420,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
baseMapper.insert(registration);
}
//企业微信消息提醒
sendMessageToWx(registration,registration.getFeedbackType());
sendMessageToWx(registration, registration.getFeedbackType());
//操作记录
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.MESSAGE_REGIST, LocalDateTime.now(),
registration.getRegistorUsername(),null);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING, RegistConstants.MESSAGE_REGIST, LocalDateTime.now(),
registration.getRegistorUsername(), null);
return R.ok();
}
......@@ -401,8 +449,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
registrationNow.setProcessStatus(CommonConstants.ZERO_STRING);
baseMapper.updateById(registrationNow);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.CONFIRM_SUBMIT, LocalDateTime.now(),
user.getNickname(),null);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING, RegistConstants.CONFIRM_SUBMIT, LocalDateTime.now(),
user.getNickname(), null);
return R.ok();
}
......@@ -413,11 +461,11 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
return R.failed(RegistConstants.NO_DATA_TO_HANDLE);
}
registrationNow.setProcessStatus(CommonConstants.TWO_STRING);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.CONFIRM_SUBMIT, LocalDateTime.now(),
user.getNickname(),null);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.MESSAGE_FINISH, registration.getProjectCreateTime(),
user.getNickname(),CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType())
? RegistConstants.BEFORE_IN_PROJECT :RegistConstants.BEFORE_OUT_PROJECT);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING, RegistConstants.CONFIRM_SUBMIT, LocalDateTime.now(),
user.getNickname(), null);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING, RegistConstants.MESSAGE_FINISH, registration.getProjectCreateTime(),
user.getNickname(), CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType())
? RegistConstants.BEFORE_IN_PROJECT : RegistConstants.BEFORE_OUT_PROJECT);
SysCspDeptVo vo = new SysCspDeptVo();
if (CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType())) {
vo.setDepartName(registrationNow.getEmpDeptname());
......@@ -490,7 +538,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
//数据初始化
private void initRegistInfo(EmployeeRegistration insert,YifuUser user,TSettleDomainSelectVo selectVo) {
private void initRegistInfo(EmployeeRegistration insert, YifuUser user, TSettleDomainSelectVo selectVo) {
SysCspDeptVo vo = new SysCspDeptVo();
vo.setUserId(user.getId());
vo.setProjectId(selectVo.getId());
......@@ -525,9 +573,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
return;
}
R<SysUser> res = upmsDaprUtils.getSimpleUserByLoginName(registration.getCustomerUserLoginname());
if (Common.isNotNull(res) && Common.isNotNull(res.getData())){
if (Common.isNotNull(res) && Common.isNotNull(res.getData())) {
user = res.getData();
}else {
} else {
return;
}
StringBuilder sendUser = null;
......@@ -538,13 +586,13 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName()+"/auth/oauth/wxLogin", "66"+registration.getId());
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "66" + registration.getId());
StringBuilder description = new StringBuilder();
String title = "";
if (CommonConstants.ONE_STRING.equals(type) || CommonConstants.TWO_STRING.equals(type)) {
title = CommonConstants.ONE_STRING.equals(type) ? "人员入职提醒:":"人员离职提醒:";
description.append(CommonConstants.ONE_STRING.equals(type) ? "入职日期:":"离职日期:")
.append(DateUtil.dateToString(registration.getJoinLeaveDate(),DateUtil.ISO_EXPANDED_DATE_FORMAT)).append("<br>");
title = CommonConstants.ONE_STRING.equals(type) ? "人员入职提醒:" : "人员离职提醒:";
description.append(CommonConstants.ONE_STRING.equals(type) ? "入职日期:" : "离职日期:")
.append(DateUtil.dateToString(registration.getJoinLeaveDate(), DateUtil.ISO_EXPANDED_DATE_FORMAT)).append("<br>");
description.append("项目名称:").append(registration.getDeptName()).append("<br>");
description.append("项目编码:").append(registration.getDeptNo()).append("<br>");
description.append("员工姓名:").append(registration.getEmployeeName()).append("<br>");
......@@ -569,8 +617,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
wxConfig.sendTextCard(restTemplate, requestMap);
}
//企业微信发送记录
logService.saveLog(user.getUserId(), CommonConstants.ZERO_STRING,"企业微信消息提醒", LocalDateTime.now(),
registration.getRegistorUsername(),"提醒人:" + user.getNickname());
logService.saveLog(user.getUserId(), CommonConstants.ZERO_STRING, "企业微信消息提醒", LocalDateTime.now(),
registration.getRegistorUsername(), "提醒人:" + user.getNickname());
}
}
......@@ -661,6 +709,27 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
/**
* @Description: 获取前端客服的所有项目权限
* @Author: huych
* @Date: 2025/3/13 17:02
* @return:
**/
public void initSearchVo(EmployeeRegistrationSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
long roleId = 1839501715787390978L;
boolean isSsc = this.haveRole(user, roleId);
if (!isSsc && !CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
//获取项目信息
R<TSettleDomainRegistListVo> domainR = archivesDaprUtil.getAllDeptByCustomerLoginName(user.getUsername());
if (null != domainR && null != domainR.getData() && null != domainR.getData().getDeptNos()) {
searchVo.setDeptNoList(domainR.getData().getDeptNos());
} else {
searchVo.setId(CommonConstants.ONE_STRING_NEGATE);
}
}
}
public boolean haveRole(YifuUser user, long roleId) {
List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP);
for (Long role : roleList) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment