generated from dxfeng/secondev-wugang-dxfeng
人员入职后,格式化入职管理附件
This commit is contained in:
parent
5e5cf207c9
commit
2e89689b26
|
|
@ -36,7 +36,7 @@ public class EmailAccountGenerateAction implements EsbServerlessRpcRemoteInterfa
|
|||
Long requestId = Convert.toLong(params.get("requestId"));
|
||||
|
||||
if (StringUtils.isBlank(xm)) {
|
||||
return WeaResult.fail("姓名不能为空", true);
|
||||
return WeaResult.success();
|
||||
}
|
||||
|
||||
// 生成基础邮箱账号
|
||||
|
|
|
|||
|
|
@ -0,0 +1,126 @@
|
|||
package com.weaver.seconddev.portal.action.entry;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.eteams.file.client.remote.FileClientService;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.seconddev.portal.mapper.action.entry.FormatEntryFilesMapper;
|
||||
import com.weaver.seconddev.portal.util.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* FormatEntryFilesActionGroup
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("FormatEntryFilesAction")
|
||||
public class FormatEntryFilesAction implements EsbServerlessRpcRemoteInterface {
|
||||
|
||||
@Autowired
|
||||
FormatEntryFilesMapper formatEntryFilesMapper;
|
||||
|
||||
@Autowired
|
||||
FileClientService fileClientService;
|
||||
@Autowired
|
||||
FileDownloadService fileDownloadService;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("params=>:{}", params);
|
||||
Long rzjlid = Convert.toLong(params.get("rzjlid"));
|
||||
log.error("rzjlid=>:{}", rzjlid);
|
||||
if (null == rzjlid) {
|
||||
return WeaResult.success();
|
||||
}
|
||||
// 查询入职管理表数据信息
|
||||
BaseParam baseParam = new BaseParam();
|
||||
Map<String, Object> entryRecord = formatEntryFilesMapper.getEntryRecord(baseParam, rzjlid);
|
||||
if (entryRecord.isEmpty()) {
|
||||
log.error("entryRecord is null,{}", params);
|
||||
return WeaResult.success();
|
||||
}
|
||||
log.error("entryRecord=>:{}", JSON.toJSONString(entryRecord));
|
||||
String username = Convert.toStr(entryRecord.get("username"));
|
||||
String jobNum = Convert.toStr(entryRecord.get("job_num"));
|
||||
log.error("userName=={}", username);
|
||||
log.error("jobNum=={}", jobNum);
|
||||
if (StringUtils.isBlank(jobNum)) {
|
||||
log.error("jobNum is null,{}", params);
|
||||
return WeaResult.success();
|
||||
}
|
||||
|
||||
String prefix = username + "-" + jobNum;
|
||||
renameFile(Convert.toStr(entryRecord.get("sfzzpzfm")), prefix, "身份证正面");
|
||||
renameFile(Convert.toStr(entryRecord.get("sfzfmghm")), prefix, "身份证反面");
|
||||
renameFile(Convert.toStr(entryRecord.get("hzzp")), prefix, "护照");
|
||||
renameFile(Convert.toStr(entryRecord.get("zgxlbyzszp")), prefix, "学历证明");
|
||||
renameFile(Convert.toStr(entryRecord.get("xxzbs")), prefix, "半身形象照");
|
||||
renameFile(Convert.toStr(entryRecord.get("czycbdz")), prefix, "寸照");
|
||||
renameFile(Convert.toStr(entryRecord.get("yxkzm")), prefix, "银行卡");
|
||||
renameFile(Convert.toStr(entryRecord.get("tjbg")), prefix, "体检报告");
|
||||
renameFile(Convert.toStr(entryRecord.get("jkz")), prefix, "健康证");
|
||||
renameFile(Convert.toStr(entryRecord.get("sjdwlzzm")), prefix, "离职证明");
|
||||
renameFile(Convert.toStr(entryRecord.get("qtfj")), prefix, "其他附件");
|
||||
|
||||
|
||||
return WeaResult.success(params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重命名文件
|
||||
*
|
||||
* @param fileIds 文件ID
|
||||
* @param prefix 前缀
|
||||
* @param fileName 文件名
|
||||
*/
|
||||
private void renameFile(String fileIds, String prefix, String fileName) {
|
||||
if (StringUtils.isBlank(fileIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 1;
|
||||
String[] split = fileIds.split(",");
|
||||
if (split.length > 0) {
|
||||
for (String s : split) {
|
||||
Long fileId = Convert.toLong(s);
|
||||
if (null == fileId) {
|
||||
log.error("fileId is null,{}", s);
|
||||
continue;
|
||||
}
|
||||
FileObj fileObj = fileClientService.get(fileId);
|
||||
if (null == fileObj) {
|
||||
log.error("fileObj is null,{}", fileId);
|
||||
continue;
|
||||
}
|
||||
Date uploadTime = fileObj.getUploadTime();
|
||||
LocalDate localDate = DateUtil.toLocalDate(uploadTime);
|
||||
if (null == localDate) {
|
||||
localDate = DateUtil.toLocalDate(new Date());
|
||||
}
|
||||
String formatDate = DateUtil.formatDate(localDate, DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
||||
String newFileName = prefix + "-" + fileName + "-" + formatDate;
|
||||
fileObj.setName(newFileName);
|
||||
fileClientService.update(fileObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.portal.mapper.action.entry;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface FormatEntryFilesMapper {
|
||||
|
||||
Map<String,Object> getEntryRecord(@Param("param") BaseParam param, @Param("id") Long id);
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ public class DateUtil {
|
|||
private static final DateTimeFormatter DEFAULT_DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
private static final DateTimeFormatter DEFAULT_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前日期字符串 (yyyy-MM-dd)
|
||||
*/
|
||||
|
|
@ -72,6 +73,13 @@ public class DateUtil {
|
|||
return date.format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
public static String formatDate(LocalDate date,DateTimeFormatter formatStr) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.format(formatStr);
|
||||
}
|
||||
|
||||
public static String formatDate(LocalDateTime dateTime) {
|
||||
if (dateTime == null) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.weaver.seconddev.portal.mapper.action.entry.FormatEntryFilesMapper">
|
||||
|
||||
|
||||
<select id="getEntryRecord" resultType="java.util.Map">
|
||||
select
|
||||
t1.id,t1.username,t1.glzzyg,t1.job_num,t1.sfzzpzfm,t1.sfzfmghm,t1.xwzszp,t1.zgxlbyzszp,
|
||||
t1.hzzp,t1.xxzbs,t1.sbzmwj,t1.yxkzm,t1.tjbg,t1.sjdwlzzm,t1.czycbdz,t1.jkz,t1.qtfj
|
||||
from ${param.e10_common}.uf_jcl_rzgl t1
|
||||
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
|
||||
and t1.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue