Lee-茶百道二开需求整合
This commit is contained in:
parent
df75f4d16a
commit
8b87ecb401
|
|
@ -0,0 +1,125 @@
|
|||
package com.weaver.seconddev.employee.action;
|
||||
|
||||
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.seconddev.employee.mapper.FormatChangeMapper;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
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.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("FormatChangeFilesAction")
|
||||
public class FormatChangeFilesAction implements EsbServerlessRpcRemoteInterface {
|
||||
|
||||
@Autowired
|
||||
FormatChangeMapper formatEntryFilesMapper;
|
||||
|
||||
@Autowired
|
||||
FileClientService fileClientService;
|
||||
|
||||
@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.getChangeRecord(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, "其他附件");
|
||||
renameFile(Convert.toStr(entryRecord.get("sbzmwj")), prefix, "社保证明");
|
||||
renameFile(Convert.toStr(entryRecord.get("xwzszp")), 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();
|
||||
LocalDateTime localDate = DateUtil.toLocalDateTime(uploadTime);
|
||||
if (null == localDate) {
|
||||
localDate = DateUtil.toLocalDateTime(new Date());
|
||||
}
|
||||
String formatDate = DateUtil.formatDateTime(localDate, DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
||||
int lastDotIndex = fileObj.getName().lastIndexOf(".");
|
||||
String suffix = fileObj.getName().substring(lastDotIndex);
|
||||
String newFileName = prefix + "-" + fileName + "-" + formatDate + suffix;
|
||||
fileObj.setName(newFileName);
|
||||
fileClientService.update(fileObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.weaver.seconddev.employee.mapper;
|
||||
|
||||
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/08/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface FormatChangeMapper {
|
||||
|
||||
Map<String,Object> getChangeRecord(@Param("param") BaseParam param, @Param("id") Long id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.weaver.seconddev.entry.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("bankCardRecognitionAction")
|
||||
public class BankCardRecognitionAction implements EsbServerlessRpcRemoteInterface {
|
||||
|
||||
@Autowired
|
||||
FileDownloadService fileDownloadService;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
Long fileId = Convert.toLong(params.get("fileId"), null);
|
||||
log.error("fileId==" + fileId);
|
||||
if (null == fileId) {
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
FileData fileData = fileDownloadService.downloadFile(fileId);
|
||||
FileObj fileObj = fileData.getFileObj();
|
||||
InputStream inputStream = fileData.getInputStream();
|
||||
String fileName = fileObj.getName();
|
||||
log.error("fileName==" + fileName);
|
||||
try {
|
||||
log.error("inputStream==" + inputStream.available());
|
||||
} catch (IOException e) {
|
||||
log.error("inputStream获取异常", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
String response = callBankCardOcrApi(inputStream, fileName);
|
||||
log.error("response==" + response);
|
||||
// 正面响应数据
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
if (jsonObject.getBoolean("isSuccess")) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONArray resultArray = data.getJSONArray("result");
|
||||
if (resultArray.size() > 0) {
|
||||
JSONObject result = resultArray.getJSONObject(0);
|
||||
returnMap.put("org", result.get("org"));
|
||||
returnMap.put("number", result.get("number"));
|
||||
returnMap.put("valid_thru", result.get("valid_thru"));
|
||||
returnMap.put("type", result.get("type"));
|
||||
returnMap.put("valid_from", result.get("valid_from"));
|
||||
returnMap.put("holder", result.get("holder"));
|
||||
}
|
||||
|
||||
}
|
||||
log.error("returnMap==" + JSON.toJSONString(returnMap));
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用千里聆身份证识别接口
|
||||
*
|
||||
* @param inputStream 文件输入流
|
||||
* @param fileName 文件名
|
||||
* @return
|
||||
*/
|
||||
public static String callBankCardOcrApi(InputStream inputStream, String fileName) {
|
||||
byte[] bytes = IoUtil.readBytes(inputStream);
|
||||
long currentTime = System.currentTimeMillis();
|
||||
HttpResponse response = HttpRequest.post(ApplicationConfigConstant.BANK_CARD_OCR_URL)
|
||||
.header("Content-Type", "multipart/form-data")
|
||||
.header("sign", IDCardRecognitionAction.getSign(currentTime))
|
||||
.header("appId", ApplicationConfigConstant.OCR_APP_ID)
|
||||
.header("timestamp", String.valueOf(currentTime))
|
||||
.form("image_file", bytes, fileName)
|
||||
.execute();
|
||||
return response.body();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.weaver.seconddev.entry.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.entry.mapper.EmailAccountGenerateMapper;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.seconddev.portal.util.ChineseNameToPinyin;
|
||||
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.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("emailAccountGenerateAction")
|
||||
public class EmailAccountGenerateAction implements EsbServerlessRpcRemoteInterface {
|
||||
private static final String EMAIL_DOMAIN = "@chabaidao.com";
|
||||
|
||||
@Autowired
|
||||
EmailAccountGenerateMapper emailAccountGenerateMapper;
|
||||
|
||||
BaseParam baseParam = new BaseParam();
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
// 获取参数
|
||||
String xm = Convert.toStr(params.get("xm"), "");
|
||||
Long requestId = Convert.toLong(params.get("requestId"));
|
||||
|
||||
if (StringUtils.isBlank(xm)) {
|
||||
return WeaResult.success();
|
||||
}
|
||||
|
||||
// 生成基础邮箱账号
|
||||
String pinyinName = ChineseNameToPinyin.convertChineseNameToPinyin(xm);
|
||||
|
||||
// 检查并生成唯一邮箱账号
|
||||
String uniqueEmail = generateUniqueEmail(pinyinName, requestId);
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
// 将生成的邮箱账号放入返回结果中
|
||||
dataMap.put("email", uniqueEmail);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成唯一的邮箱账号
|
||||
*
|
||||
* @param pinyinName 拼音姓名
|
||||
* @return 唯一邮箱账号
|
||||
*/
|
||||
private String generateUniqueEmail(String pinyinName, Long requestId) {
|
||||
String baseEmail = pinyinName + EMAIL_DOMAIN;
|
||||
|
||||
// 首先检查基础邮箱是否已存在
|
||||
if (!isEmailExists(baseEmail, requestId)) {
|
||||
return baseEmail;
|
||||
}
|
||||
|
||||
// 如果基础邮箱已存在,则尝试添加数字后缀
|
||||
int suffix = 1;
|
||||
String emailWithSuffix;
|
||||
do {
|
||||
emailWithSuffix = pinyinName + suffix + EMAIL_DOMAIN;
|
||||
suffix++;
|
||||
} while (isEmailExists(emailWithSuffix, requestId));
|
||||
|
||||
return emailWithSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查入职管理表是否已存在相同邮箱
|
||||
*
|
||||
* @param email 邮箱账号
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isEmailExists(String email, Long requestId) {
|
||||
Integer checkCount = emailAccountGenerateMapper.checkSameEmailAccount(baseParam, email, requestId);
|
||||
log.error("检查入职表邮箱账号是否已存在: {}", email);
|
||||
log.error("检查结果: {}", checkCount);
|
||||
boolean isSame = checkCount != null && checkCount > 0;
|
||||
if (isSame) {
|
||||
return true;
|
||||
}
|
||||
return isEmailExists(email);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验花名册是否存在相同邮箱
|
||||
*
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
private boolean isEmailExists(String email) {
|
||||
Integer checkCount = emailAccountGenerateMapper.checkEmployeeSameEmail(baseParam, email);
|
||||
log.error("检查花名册邮箱账号是否已存在: {}", email);
|
||||
log.error("检查结果: {}", checkCount);
|
||||
return checkCount != null && checkCount > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package com.weaver.seconddev.entry.action;
|
||||
|
||||
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.seconddev.entry.mapper.FormatEntryFilesMapper;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
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.LocalDateTime;
|
||||
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;
|
||||
|
||||
@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, "其他附件");
|
||||
renameFile(Convert.toStr(entryRecord.get("sbzmwj")), prefix, "社保证明");
|
||||
renameFile(Convert.toStr(entryRecord.get("xwzszp")), 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();
|
||||
LocalDateTime localDate = DateUtil.toLocalDateTime(uploadTime);
|
||||
if (null == localDate) {
|
||||
localDate = DateUtil.toLocalDateTime(new Date());
|
||||
}
|
||||
String formatDate = DateUtil.formatDateTime(localDate, DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
||||
int lastDotIndex = fileObj.getName().lastIndexOf(".");
|
||||
String suffix = fileObj.getName().substring(lastDotIndex);
|
||||
String newFileName = prefix + "-" + fileName + "-" + formatDate + suffix;
|
||||
fileObj.setName(newFileName);
|
||||
fileClientService.update(fileObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,295 @@
|
|||
package com.weaver.seconddev.entry.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.seconddev.portal.mapper.dictionary.DataConvertMapper;
|
||||
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.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.file.Files;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("idCardRecognitionAction")
|
||||
public class IDCardRecognitionAction implements EsbServerlessRpcRemoteInterface {
|
||||
|
||||
@Autowired
|
||||
FileDownloadService fileDownloadService;
|
||||
@Autowired
|
||||
DataConvertMapper dataConvertMapper;
|
||||
|
||||
BaseParam baseParam = new BaseParam();
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
Long fileId = Convert.toLong(params.get("fileId"), null);
|
||||
log.error("fileId==" + fileId);
|
||||
String nationalityConvert = Convert.toStr(params.get("nationalityConvert"), "");
|
||||
log.error("nationalityConvert==" + nationalityConvert);
|
||||
if (null == fileId) {
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
FileData fileData = fileDownloadService.downloadFile(fileId);
|
||||
FileObj fileObj = fileData.getFileObj();
|
||||
InputStream inputStream = fileData.getInputStream();
|
||||
String fileName = fileObj.getName();
|
||||
log.error("fileName==" + fileName);
|
||||
try {
|
||||
log.error("inputStream==" + inputStream.available());
|
||||
} catch (IOException e) {
|
||||
log.error("inputStream获取异常", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
String response = callIdCardOcrApi(inputStream, fileName);
|
||||
// 正面响应数据
|
||||
//String response = "{\"isSuccess\": true, \"data\": {\"page_num\": \"1\", \"result\": [{\"姓名\": \"王某某\", \"性别\": \"男\", \"民族\": \"汉\", \"出生\": \"1989年3月21日\", \"住址\": \"上海市浦东新区塘桥街道蓝村路xxx号\", \"公民身份号码\": \"370112198903217890\", \"标签\": \"头像面\"}]}, \"status_code\": 5200}";
|
||||
log.error("response==" + response);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
if (jsonObject.getBoolean("isSuccess")) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONArray resultArray = data.getJSONArray("result");
|
||||
if (resultArray.size() > 0) {
|
||||
JSONObject result = resultArray.getJSONObject(0);
|
||||
returnMap.put("name", result.getString("姓名"));
|
||||
returnMap.put("sex", result.getString("性别"));
|
||||
String nation = result.getString("民族");
|
||||
if (StringUtils.isNotBlank(nation) && StringUtils.isNotBlank(nationalityConvert)) {
|
||||
Long nationId = dataConvertMapper.getIdByName(baseParam, "nation", nation + "族");
|
||||
log.error("nationId==" + nationId);
|
||||
nation = Convert.toStr(nationId, "");
|
||||
log.error("nation==" + nation);
|
||||
|
||||
}
|
||||
returnMap.put("nation", nation);
|
||||
|
||||
returnMap.put("birthday", Convert.toStr(result.getString("出生"), "").replace("年", "-").replace("月", "-").replace("日", "-"));
|
||||
returnMap.put("address", result.getString("住址"));
|
||||
String idNumber = result.getString("公民身份号码");
|
||||
returnMap.put("idCard", idNumber);
|
||||
// 根据身份证号,计算年龄、 性别
|
||||
if (StringUtils.isNotBlank(idNumber)) {
|
||||
returnMap.put("age", getAge(idNumber));
|
||||
returnMap.put("gender", getGender(idNumber));
|
||||
}
|
||||
|
||||
returnMap.put("issueAuthority", result.getString("签发机关"));
|
||||
String validity = result.getString("有效期限");
|
||||
checkValidity(validity, returnMap);
|
||||
returnMap.put("validity", validity);
|
||||
}
|
||||
}else{
|
||||
log.error("response==" + response);
|
||||
return WeaResult.fail(500, jsonObject.getString("errorMsg"), true);
|
||||
}
|
||||
log.error("returnMap==" + JSON.toJSONString(returnMap));
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用千里聆身份证识别接口
|
||||
*
|
||||
* @param inputStream 文件输入流
|
||||
* @param fileName 文件名
|
||||
* @return
|
||||
*/
|
||||
public static String callIdCardOcrApi(InputStream inputStream, String fileName) {
|
||||
byte[] bytes = IoUtil.readBytes(inputStream);
|
||||
long currentTime = System.currentTimeMillis();
|
||||
HttpResponse response = HttpRequest.post(ApplicationConfigConstant.ID_CARD_OCR_URL)
|
||||
.header("Content-Type", "multipart/form-data")
|
||||
.header("sign", getSign(currentTime))
|
||||
.header("appId", ApplicationConfigConstant.OCR_APP_ID)
|
||||
.header("timestamp", String.valueOf(currentTime))
|
||||
.form("img", bytes, fileName)
|
||||
.execute();
|
||||
return response.body();
|
||||
}
|
||||
|
||||
/**
|
||||
* 千里聆签名
|
||||
*
|
||||
* @param timestamp 当前时间戳(毫秒数)
|
||||
* @return
|
||||
*/
|
||||
public static String getSign(long timestamp) {
|
||||
try {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
md5.update(ApplicationConfigConstant.OCR_APP_ID.getBytes());
|
||||
md5.update((timestamp + "").getBytes());
|
||||
md5.update(ApplicationConfigConstant.OCR_APP_SECRET.getBytes());
|
||||
byte[] bytes = md5.digest();
|
||||
return (new BigInteger(1, bytes)).toString(16);
|
||||
} catch (NoSuchAlgorithmException var8) {
|
||||
throw new RuntimeException("不支持的加密算法", var8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份证号获取性别
|
||||
*
|
||||
* @param idCard 身份证号
|
||||
* @return 性别:"男"或"女"
|
||||
* @throws IllegalArgumentException 身份证号不合法时抛出
|
||||
*/
|
||||
public static String getGender(String idCard) {
|
||||
// 校验身份证号长度
|
||||
if (idCard == null || (idCard.length() != 18 && idCard.length() != 15)) {
|
||||
throw new IllegalArgumentException("身份证号长度不合法");
|
||||
}
|
||||
|
||||
// 18位身份证取第17位,15位身份证取第15位
|
||||
char genderChar;
|
||||
if (idCard.length() == 18) {
|
||||
genderChar = idCard.charAt(16);
|
||||
} else {
|
||||
genderChar = idCard.charAt(14);
|
||||
}
|
||||
|
||||
// 奇数为男,偶数为女
|
||||
return (Integer.parseInt(String.valueOf(genderChar)) % 2 == 1) ? "male" : "female";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份证号计算年龄
|
||||
*
|
||||
* @param idCard 身份证号
|
||||
* @return 年龄
|
||||
* @throws IllegalArgumentException 身份证号不合法时抛出
|
||||
*/
|
||||
public static int getAge(String idCard) {
|
||||
// 校验身份证号长度
|
||||
if (idCard == null || (idCard.length() != 18 && idCard.length() != 15)) {
|
||||
throw new IllegalArgumentException("身份证号长度不合法");
|
||||
}
|
||||
|
||||
// 解析出生日期
|
||||
LocalDate birthDate;
|
||||
if (idCard.length() == 18) {
|
||||
// 18位身份证:第7-14位为出生日期(yyyyMMdd)
|
||||
String birthStr = idCard.substring(6, 14);
|
||||
birthDate = LocalDate.parse(birthStr, DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
} else {
|
||||
// 15位身份证:第7-12位为出生日期(yyMMdd),默认19xx年
|
||||
String birthStr = "19" + idCard.substring(6, 12);
|
||||
birthDate = LocalDate.parse(birthStr, DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
}
|
||||
|
||||
// 计算与当前日期的差距
|
||||
LocalDate now = LocalDate.now();
|
||||
Period period = Period.between(birthDate, now);
|
||||
|
||||
return period.getYears();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查有效期
|
||||
*
|
||||
* @param validity
|
||||
* @param returnMap
|
||||
*/
|
||||
private static void checkValidity(String validity, Map<String, Object> returnMap) {
|
||||
if(StringUtils.isBlank(validity)){
|
||||
return;
|
||||
}
|
||||
String[] validityArr = validity.split("-");
|
||||
if (validityArr.length < 2) {
|
||||
return;
|
||||
}
|
||||
String startDate = Convert.toStr(validityArr[0], "").replace(".", "-");
|
||||
String endDate = Convert.toStr(validityArr[1], "").replace(".", "-");
|
||||
returnMap.put("validityType", "0");
|
||||
if ("长期".equals(endDate)) {
|
||||
endDate = "9999-12-31";
|
||||
returnMap.put("validityType", "1");
|
||||
}
|
||||
returnMap.put("validityStart", startDate);
|
||||
returnMap.put("validityEnd", endDate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// TODO
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
File file = new File("C:\\Users\\dxfeng\\Desktop\\茶百道\\长期身份证.jpg");
|
||||
InputStream inputStream = Files.newInputStream(file.toPath());
|
||||
|
||||
//String response = callIdCardOcrApi(inputStream, file.getName());
|
||||
// 正面响应数据
|
||||
//String response = "{\"isSuccess\": true, \"data\": {\"page_num\": \"1\", \"result\": [{\"姓名\": \"王某某\", \"性别\": \"男\", \"民族\": \"汉\", \"出生\": \"1989年3月21日\", \"住址\": \"上海市浦东新区塘桥街道蓝村路xxx号\", \"公民身份号码\": \"370112198903217890\", \"标签\": \"头像面\"}]}, \"status_code\": 5200}";
|
||||
//String response = "{\"isSuccess\": true, \"data\": {\"page_num\": \"1\", \"result\": [{\"签发机关\": \"东港市公安局\", \"有效期限\": \"2014.07.09-长期\", \"标签\": \"国徽面\"}]}, \"status_code\": 5200}";
|
||||
String response = "{\"isSuccess\": true, \"data\": {\"page_num\": \"1\", \"result\": [{\"签发机关\": \"东港市公安局\", \"有效期限\": \"2013.03.05-2023.03.05\", \"标签\": \"国徽面\"}]}, \"status_code\": 5200}";
|
||||
System.out.println("response==" + response);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
if (jsonObject.getBoolean("isSuccess")) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONArray resultArray = data.getJSONArray("result");
|
||||
if (resultArray.size() > 0) {
|
||||
JSONObject result = resultArray.getJSONObject(0);
|
||||
returnMap.put("name", result.getString("姓名"));
|
||||
returnMap.put("sex", result.getString("性别"));
|
||||
String nation = result.getString("民族");
|
||||
//if (StringUtils.isNotBlank(nation) && StringUtils.isNotBlank(nationalityConvert)) {
|
||||
// Long nationId = dataConvertMapper.getIdByName(baseParam, "nation", nation + "族");
|
||||
// log.error("nationId==" + nationId);
|
||||
// nation = Convert.toStr(nationId, "");
|
||||
// log.error("nation==" + nation);
|
||||
//
|
||||
//}
|
||||
returnMap.put("nation", nation);
|
||||
|
||||
returnMap.put("birthday", Convert.toStr(result.getString("出生"), "").replace("年", "-").replace("月", "-").replace("日", "-"));
|
||||
returnMap.put("address", result.getString("住址"));
|
||||
String idNumber = result.getString("公民身份号码");
|
||||
returnMap.put("idCard", idNumber);
|
||||
// 根据身份证号,计算年龄、 性别
|
||||
if (StringUtils.isNotBlank(idNumber)) {
|
||||
returnMap.put("age", getAge(idNumber));
|
||||
returnMap.put("gender", getGender(idNumber));
|
||||
}
|
||||
|
||||
returnMap.put("issueAuthority", result.getString("签发机关"));
|
||||
String validity = result.getString("有效期限");
|
||||
checkValidity(validity, returnMap);
|
||||
returnMap.put("validity", validity);
|
||||
}
|
||||
}
|
||||
System.out.println("returnMap==" + JSON.toJSONString(returnMap));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
package com.weaver.seconddev.entry.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.entry.entity.PermissionTransferModule;
|
||||
import com.weaver.seconddev.entry.entity.RoleDetail;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import com.weaver.seconddev.portal.util.PapiUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("PermissionDetailAction")
|
||||
public class PermissionDetailAction implements EsbServerlessRpcRemoteInterface {
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
// 离职员工ID
|
||||
String employeeId = Convert.toStr(params.get("employeeId"), null);
|
||||
|
||||
// 权限转移操作人员ID
|
||||
String optUserId = Convert.toStr(params.get("optUserId"), null);
|
||||
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "B2b");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
|
||||
// 查询某个人员组织的可以转移的权限数据
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// {"type":"resource","opt":"1","targetId":"959466419596591105"}
|
||||
jsonObject.put("type", "resource");
|
||||
jsonObject.put("opt", "1");
|
||||
jsonObject.put("targetId", employeeId);
|
||||
jsonObject.put("access_token", papiToken);
|
||||
|
||||
log.info("jsonObject===" + jsonObject);
|
||||
String response = HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/architecture/permission/transfer/query/v1/module")
|
||||
.header("Content-Type", "application/json")
|
||||
.header("optUserId", optUserId)
|
||||
.body(jsonObject.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.info("response===" + response);
|
||||
|
||||
JSONObject responseJson = JSONObject.parseObject(response);
|
||||
if (responseJson.getIntValue("code") != 200) {
|
||||
// 请求失败直接响应失败数据
|
||||
return WeaResult.fail(response, true);
|
||||
}
|
||||
JSONObject data = responseJson.getJSONObject("data");
|
||||
List<PermissionTransferModule> permissionTransferModuleList = new ArrayList<>();
|
||||
PermissionTransferModule roleModule = null;
|
||||
if (data != null) {
|
||||
JSONArray permissionTransferModules = data.getJSONArray("permissionTransferModules");
|
||||
for (Object permissionTransferModule : permissionTransferModules) {
|
||||
JSONObject permissionTransferModuleJson = (JSONObject) permissionTransferModule;
|
||||
PermissionTransferModule module = PermissionTransferModule.builder()
|
||||
.deleteType(permissionTransferModuleJson.getInteger("deleteType"))
|
||||
.opt(permissionTransferModuleJson.getInteger("opt"))
|
||||
.module(permissionTransferModuleJson.getString("module"))
|
||||
.moduleName(permissionTransferModuleJson.getString("moduleName"))
|
||||
.subModule(permissionTransferModuleJson.getString("subModule"))
|
||||
.subModuleName(permissionTransferModuleJson.getString("subModuleName"))
|
||||
.type(permissionTransferModuleJson.getString("type"))
|
||||
.content(permissionTransferModuleJson.getString("content"))
|
||||
.count(permissionTransferModuleJson.getInteger("count"))
|
||||
.build();
|
||||
if ("hrm_role".equals(module.getSubModule())) {
|
||||
roleModule = module;
|
||||
} else {
|
||||
permissionTransferModuleList.add(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询角色明细数据
|
||||
List<RoleDetail> roleDetailList = new ArrayList<>();
|
||||
getRoleDetail(employeeId, optUserId, 1, roleDetailList);
|
||||
|
||||
returnMap.put("permissionTransferModuleList", permissionTransferModuleList);
|
||||
returnMap.put("roleDetailList", roleDetailList);
|
||||
log.info("returnMap==" + JSON.toJSONString(returnMap));
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色明细数据
|
||||
*
|
||||
* @param employeeId 员工ID
|
||||
* @param optUserId 操作用户ID
|
||||
* @param pageNum 当前页码
|
||||
* @param roleDetailList 角色明细列表
|
||||
* @param roleDetailList
|
||||
*/
|
||||
private void getRoleDetail(String employeeId, String optUserId, int pageNum, List<RoleDetail> roleDetailList) {
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "B3b");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("access_token", papiToken);
|
||||
jsonObject.put("pageNum", pageNum);
|
||||
jsonObject.put("pageSize", 10);
|
||||
jsonObject.put("targetId", employeeId);
|
||||
jsonObject.put("param", new JSONObject());
|
||||
jsonObject.put("opt", "1");
|
||||
jsonObject.put("module", "hrm");
|
||||
jsonObject.put("subModule", "hrm_role");
|
||||
jsonObject.put("type", "resource");
|
||||
log.info("getRoleDetail>>jsonObject===" + jsonObject);
|
||||
String response = HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/architecture/permission/transfer/query/v1/module/content")
|
||||
.header("Content-Type", "application/json")
|
||||
.header("optUserId", optUserId)
|
||||
.body(jsonObject.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.info("getRoleDetail>>response===" + response);
|
||||
|
||||
JSONObject responseJson = JSONObject.parseObject(response);
|
||||
if (responseJson.getIntValue("code") != 200) {
|
||||
// 请求失败直接响应失败数据
|
||||
log.error("response==" + response);
|
||||
roleDetailList = new ArrayList<>();
|
||||
return;
|
||||
}
|
||||
JSONObject data = responseJson.getJSONObject("data");
|
||||
if (data != null) {
|
||||
JSONObject page = data.getJSONObject("page");
|
||||
JSONArray records = page.getJSONArray("records");
|
||||
if (records.size() > 0) {
|
||||
for (Object record : records) {
|
||||
JSONObject recordJson = (JSONObject) record;
|
||||
JSONArray columnValueList = recordJson.getJSONArray("columnValueList");
|
||||
if (columnValueList.size() > 0) {
|
||||
JSONObject columnValue = columnValueList.getJSONObject(0);
|
||||
RoleDetail roleDetail = RoleDetail.builder()
|
||||
.sourceId(columnValue.getString("sourceId"))
|
||||
.roleName(columnValue.getString("dataIndex_0"))
|
||||
.functionCount(columnValue.getInteger("dataIndex_1"))
|
||||
.memberCount(columnValue.getInteger("dataIndex_2"))
|
||||
.build();
|
||||
roleDetailList.add(roleDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int pages = page.getIntValue("pages");
|
||||
if (pages > pageNum) {
|
||||
getRoleDetail(employeeId, optUserId, pageNum + 1, roleDetailList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("employeeId", "1147262704872284161");
|
||||
params.put("optUserId", "1147262704872284161");
|
||||
PermissionTransferAction permissionTransferAction = new PermissionTransferAction();
|
||||
WeaResult<Map<String, Object>> execute = permissionTransferAction.execute(params);
|
||||
System.out.println(JSON.toJSONString(execute));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
package com.weaver.seconddev.entry.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.entry.entity.PermissionTransferModule;
|
||||
import com.weaver.seconddev.entry.mapper.ResignationApplyMapper;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.seconddev.portal.util.DateUtil;
|
||||
import com.weaver.seconddev.portal.util.PapiUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("PermissionTransferAction")
|
||||
public class PermissionTransferAction implements EsbServerlessRpcRemoteInterface {
|
||||
|
||||
@Autowired
|
||||
ResignationApplyMapper resignationApplyMapper;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("开始执行权限转移操作:{}", DateUtil.getCurrentDateTimeStr());
|
||||
// 权限转移操作人员ID
|
||||
String optUserId = Convert.toStr(params.get("optUserId"), null);
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
BaseParam baseParam = new BaseParam();
|
||||
// 查询已经提交的离职申请流程,且权限转移生效时间在今天之前的数据
|
||||
List<PermissionTransferModule> permissionTransferModuleList = resignationApplyMapper.getPermissionTransferModuleList(baseParam, DateUtil.getCurrentDateStr());
|
||||
// 遍历数据 执行权限转移操作,并反写权限转移结果
|
||||
for (PermissionTransferModule permissionTransferModule : permissionTransferModuleList) {
|
||||
log.error("permissionTransferModule==={}", JSON.toJSONString(permissionTransferModule));
|
||||
// 转移该模块全部数据权限
|
||||
transferPermission(permissionTransferModule, optUserId, "0");
|
||||
// 更新 数据 存储权限转移结果
|
||||
resignationApplyMapper.updatePermissionTransferModule(baseParam, permissionTransferModule);
|
||||
}
|
||||
|
||||
|
||||
// 查询角色权限转移数据
|
||||
List<PermissionTransferModule> roleTransferModuleList = resignationApplyMapper.getRoleTransferModuleList(baseParam, DateUtil.getCurrentDateStr());
|
||||
for (PermissionTransferModule roleTransferModule : roleTransferModuleList) {
|
||||
log.error("roleTransferModule==={}", JSON.toJSONString(roleTransferModule));
|
||||
transferPermission(roleTransferModule, optUserId, roleTransferModule.getSourceId());
|
||||
resignationApplyMapper.updateRoleTransferModule(baseParam, roleTransferModule);
|
||||
}
|
||||
|
||||
log.error("结束执行权限转移操作:{}", DateUtil.getCurrentDateTimeStr());
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限转移
|
||||
*
|
||||
* @param permissionTransferModule
|
||||
* @param optUserId
|
||||
* @param sourceId
|
||||
*/
|
||||
private static void transferPermission(PermissionTransferModule permissionTransferModule, String optUserId, String sourceId) {
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "C3c");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
|
||||
// 查询某个人员组织的可以转移的权限数据
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("access_token", papiToken);
|
||||
jsonObject.put("module", permissionTransferModule.getModule());
|
||||
jsonObject.put("subModule", permissionTransferModule.getSubModule());
|
||||
jsonObject.put("transferId", sourceId);
|
||||
jsonObject.put("type", "resource");
|
||||
jsonObject.put("opt", "1");
|
||||
jsonObject.put("targetIdFrom", permissionTransferModule.getEmployeeId());
|
||||
jsonObject.put("targetIdTo", permissionTransferModule.getHandoverId());
|
||||
|
||||
JSONArray array = new JSONArray();
|
||||
array.add(jsonObject);
|
||||
|
||||
log.error("array===" + array);
|
||||
String response = HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/architecture/permission/transfer/module/v1/opt/extend?access_token=" + papiToken)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("optUserId", optUserId)
|
||||
.body(array.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.error("response===" + response);
|
||||
|
||||
JSONObject responseJson = JSONObject.parseObject(response);
|
||||
if (responseJson.getIntValue("code") != 200) {
|
||||
log.error("权限转移失败,接口响应结果=={}", response);
|
||||
permissionTransferModule.setSuccessCount(-1);
|
||||
permissionTransferModule.setFailReason("权限转移失败,接口响应结果:" + response);
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject data = responseJson.getJSONObject("data");
|
||||
if (data != null) {
|
||||
String transferId = data.getString("transferId");
|
||||
log.error("transferId===" + transferId);
|
||||
// 查询权限转移执行结果
|
||||
queryPermissionTransferResult(permissionTransferModule, optUserId, transferId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询权限转移执行结果
|
||||
*/
|
||||
private static void queryPermissionTransferResult(PermissionTransferModule permissionTransferModule, String optUserId, String transferId) {
|
||||
queryPermissionTransferResult(permissionTransferModule, optUserId, transferId, 0);
|
||||
}
|
||||
|
||||
private static void queryPermissionTransferResult(PermissionTransferModule permissionTransferModule, String optUserId, String transferId, int retryCount) {
|
||||
// 限制重试次数,防止无限递归
|
||||
if (retryCount >= 5) {
|
||||
log.error("权限转移查询超过最大重试次数");
|
||||
permissionTransferModule.setSuccessCount(-1);
|
||||
permissionTransferModule.setFailReason("权限转移查询超过最大重试次数");
|
||||
return;
|
||||
}
|
||||
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "D4d");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("access_token", papiToken);
|
||||
|
||||
log.error("jsonObject===" + jsonObject);
|
||||
|
||||
try {
|
||||
String response = HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/architecture/permission/transfer/module/v1/opt/extend/refresh?transferId=" + transferId)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("optUserId", optUserId)
|
||||
.body(jsonObject.toJSONString())
|
||||
.timeout(10000)
|
||||
.execute()
|
||||
.body();
|
||||
log.error("response===" + response);
|
||||
|
||||
JSONObject responseJson = JSONObject.parseObject(response);
|
||||
if (responseJson.getIntValue("code") != 200) {
|
||||
log.error("权限转移失败,接口响应结果=={}", response);
|
||||
permissionTransferModule.setSuccessCount(-1);
|
||||
permissionTransferModule.setFailReason("权限转移失败," + response);
|
||||
return;
|
||||
}
|
||||
JSONObject data = responseJson.getJSONObject("data");
|
||||
JSONArray dataSource = data.getJSONArray("dataSource");
|
||||
if (dataSource != null && dataSource.size() > 0) {
|
||||
JSONObject dataSourceObj = dataSource.getJSONObject(0);
|
||||
Integer success = dataSourceObj.getInteger("success");
|
||||
Integer fail = dataSourceObj.getInteger("fail");
|
||||
String cause = dataSourceObj.getString("cause");
|
||||
permissionTransferModule.setSuccessCount(success);
|
||||
permissionTransferModule.setFailCount(fail);
|
||||
permissionTransferModule.setFailReason(cause);
|
||||
} else if ("false".equals(data.getString("finished"))) {
|
||||
// 没有返回dataSource数组,重复调用,增加重试计数
|
||||
Thread.sleep(1000);
|
||||
queryPermissionTransferResult(permissionTransferModule, optUserId, transferId, retryCount + 1);
|
||||
} else {
|
||||
log.error("权限转移查询异常,接口响应:" + response);
|
||||
permissionTransferModule.setSuccessCount(-1);
|
||||
permissionTransferModule.setFailReason("权限转移查询异常,接口响应:" + response);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("权限转移查询异常", e);
|
||||
permissionTransferModule.setSuccessCount(-1);
|
||||
permissionTransferModule.setFailReason("权限转移查询异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//public static void main(String[] args) {
|
||||
// //
|
||||
// PermissionTransferModule permissionTransferModule = new PermissionTransferModule();
|
||||
// permissionTransferModule.setModule("doc");
|
||||
// permissionTransferModule.setSubModule("doc_doc_author_permission");
|
||||
// permissionTransferModule.setEmployeeId("1160242985059614723");
|
||||
// permissionTransferModule.setHandoverId("1155098662311870470");
|
||||
// //transferPermission(permissionTransferModule, "1147262704872284161", "0");
|
||||
//
|
||||
// queryPermissionTransferResult(permissionTransferModule, "1147262704872284161", "1164707182682865680");
|
||||
//}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.weaver.seconddev.entry.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.entry.service.EntryManageService;
|
||||
import com.weaver.teams.hrapp.service.HrComEstService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/31
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/entry/manage")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class EntryManageController {
|
||||
|
||||
@Autowired
|
||||
EntryManageService entryManageService;
|
||||
@Autowired
|
||||
HrComEstService hrComEstService;
|
||||
|
||||
@GetMapping("/checkJobNum")
|
||||
public WeaResult<Map<String, Object>> checkJobNum(@RequestParam("jobNum") String jobNum) {
|
||||
return entryManageService.checkJobNum(jobNum);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadFiles")
|
||||
private WeaResult<Map<String, Object>> uploadFiles(@RequestBody Map<String, String> params) {
|
||||
return entryManageService.uploadFiles(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.weaver.seconddev.entry.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/31
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class FileUploadLoad {
|
||||
|
||||
public FileUploadLoad(String fileName, String formatDate, Long fileId) {
|
||||
this.fileId = fileId;
|
||||
this.formatDate = formatDate;
|
||||
|
||||
// 获取文件后缀
|
||||
String suffix = "";
|
||||
String fileNameWithoutSuffix = fileName;
|
||||
if (fileName.contains(".")) {
|
||||
int lastDotIndex = fileName.lastIndexOf(".");
|
||||
suffix = fileName.substring(lastDotIndex);
|
||||
fileNameWithoutSuffix = fileName.substring(0, lastDotIndex);
|
||||
}
|
||||
|
||||
// 按"-"分割文件名
|
||||
String[] split = fileNameWithoutSuffix.split("-");
|
||||
|
||||
// 判断是否包含时间字符串(最后一个部分是否为时间格式)
|
||||
boolean hasDateFormat = false;
|
||||
if (split.length > 0) {
|
||||
String lastPart = split[split.length - 1];
|
||||
// 简单判断是否为时间格式(12位数字)
|
||||
if (lastPart.matches("\\d{12}")) {
|
||||
hasDateFormat = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDateFormat && split.length >= 3) {
|
||||
// 包含时间格式,直接使用
|
||||
this.jobNum = split[0];
|
||||
this.userName = split[1];
|
||||
// 重新组合文件类型部分(处理可能包含"-"的文件类型名称)
|
||||
StringBuilder fileTypeBuilder = new StringBuilder();
|
||||
for (int i = 2; i < split.length - 1; i++) {
|
||||
if (fileTypeBuilder.length() > 0) {
|
||||
fileTypeBuilder.append("-");
|
||||
}
|
||||
fileTypeBuilder.append(split[i]);
|
||||
}
|
||||
this.fileTypeName = fileTypeBuilder.toString();
|
||||
// 文件名保持原样
|
||||
this.fileName = fileName;
|
||||
} else if (!hasDateFormat && split.length >= 3) {
|
||||
// 不包含时间格式,需要添加formatDate
|
||||
this.jobNum = split[0];
|
||||
this.userName = split[1];
|
||||
// 重新组合文件类型部分(处理可能包含"-"的文件类型名称)
|
||||
StringBuilder fileTypeBuilder = new StringBuilder();
|
||||
for (int i = 2; i < split.length; i++) {
|
||||
if (fileTypeBuilder.length() > 0) {
|
||||
fileTypeBuilder.append("-");
|
||||
}
|
||||
fileTypeBuilder.append(split[i]);
|
||||
}
|
||||
this.fileTypeName = fileTypeBuilder.toString();
|
||||
// 添加时间格式到文件名
|
||||
this.fileName = fileNameWithoutSuffix + "-" + formatDate + suffix;
|
||||
} else if (!hasDateFormat && split.length == 2) {
|
||||
// 特殊情况:只有工号和姓名,没有文件类型
|
||||
this.jobNum = split[0];
|
||||
this.userName = split[1];
|
||||
this.fileTypeName = "";
|
||||
// 添加时间格式到文件名
|
||||
this.fileName = fileNameWithoutSuffix + "-" + formatDate + suffix;
|
||||
} else {
|
||||
// 其他情况,设置默认值
|
||||
this.jobNum = split.length > 0 ? split[0] : "";
|
||||
this.userName = split.length > 1 ? split[1] : "";
|
||||
this.fileTypeName = "";
|
||||
// 添加时间格式到文件名
|
||||
this.fileName = fileNameWithoutSuffix + (split.length > 0 ? "-" + formatDate : "") + suffix;
|
||||
}
|
||||
}
|
||||
|
||||
private String fileName;
|
||||
private String formatDate;
|
||||
private String userName;
|
||||
private String jobNum;
|
||||
private String fileTypeName;
|
||||
private Long fileId;
|
||||
private String uploadTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.weaver.seconddev.entry.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class PermissionTransferModule {
|
||||
private Integer deleteType;
|
||||
private Integer opt;
|
||||
private String module;
|
||||
private String moduleName;
|
||||
private String subModule;
|
||||
private String subModuleName;
|
||||
private String type;
|
||||
private String content;
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 交接人
|
||||
*/
|
||||
private String handoverId;
|
||||
/**
|
||||
* 生效类型
|
||||
*/
|
||||
private Integer effectType;
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
private String effectDate;
|
||||
/**
|
||||
* 离职员工
|
||||
*/
|
||||
private String employeeId;
|
||||
/**
|
||||
* 最后工作日
|
||||
*/
|
||||
private String lastWorkDate;
|
||||
/**
|
||||
* 明细表ID
|
||||
*/
|
||||
private Long detailId;
|
||||
/**
|
||||
* 主表ID
|
||||
*/
|
||||
private Long formDataId;
|
||||
|
||||
/**
|
||||
* 角色数据ID
|
||||
*/
|
||||
private String sourceId;
|
||||
|
||||
private Integer successCount;
|
||||
private Integer failCount;
|
||||
private String failReason;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.weaver.seconddev.entry.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RoleDetail {
|
||||
private String sourceId;
|
||||
private String roleName;
|
||||
/**
|
||||
* 功能权限数量
|
||||
*/
|
||||
private Integer functionCount;
|
||||
/**
|
||||
* 成员数量
|
||||
*/
|
||||
private Integer memberCount;
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.weaver.seconddev.entry.enums;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/31
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum FileUploadType {
|
||||
// ['身份证正面', '身份证反面', '护照', '学历证明', '半身形象照', '寸照', '银行卡', '体检报告', '健康证', '离职证明', '其他附件']
|
||||
IDENTITY_CARD_FRONT("身份证正面","sfzzpzfm"),
|
||||
IDENTITY_CARD_BACK("身份证反面","sfzfmghm"),
|
||||
PASSPORT("护照","hzzp"),
|
||||
EDUCATION_PROOF("学历证明","zgxlbyzszp"),
|
||||
FACE_IMAGE("半身形象照","xxzbs"),
|
||||
PORTRAIT("寸照","czycbdz"),
|
||||
BANK_CARD("银行卡","yxkzm"),
|
||||
PHYSICAL_EXAMINATION_REPORT("体检报告","tjbg"),
|
||||
HEALTH_CERTIFICATE("健康证","jkz"),
|
||||
RESIGNATION_PROOF("离职证明","sjdwlzzm"),
|
||||
OTHER_ATTACHMENT("其他附件","qtfj");
|
||||
|
||||
private final String name;
|
||||
private final String dbName;
|
||||
|
||||
FileUploadType(String name, String dbName) {
|
||||
this.name = name;
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDbName() {
|
||||
return dbName;
|
||||
}
|
||||
|
||||
public static FileUploadType getByName(String name) {
|
||||
for (FileUploadType value : FileUploadType.values()) {
|
||||
if (value.getName().equals(name)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.entry.mapper;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EmailAccountGenerateMapper {
|
||||
|
||||
Integer checkSameEmailAccount(@Param("param") BaseParam param, @Param("email") String email, @Param("requestId") Long requestId);
|
||||
|
||||
Integer checkEmployeeSameEmail(@Param("param") BaseParam param, @Param("email") String email);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.weaver.seconddev.entry.mapper;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/31
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EntryManageMapper {
|
||||
|
||||
/**
|
||||
* 根据工号查询员工ID
|
||||
*
|
||||
* @param param
|
||||
* @param jobNum
|
||||
* @return
|
||||
*/
|
||||
Long getEntryRecordIdByJobNum(@Param("param") BaseParam param, @Param("jobNum") String jobNum);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.entry.mapper;
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.weaver.seconddev.entry.mapper;
|
||||
|
||||
import com.weaver.seconddev.entry.entity.PermissionTransferModule;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface ResignationApplyMapper {
|
||||
|
||||
List<PermissionTransferModule> getPermissionTransferModuleList(@Param("param") BaseParam param, @Param("currentDate") String currentDate);
|
||||
|
||||
List<PermissionTransferModule> getRoleTransferModuleList(@Param("param") BaseParam param, @Param("currentDate") String currentDate);
|
||||
|
||||
|
||||
int updatePermissionTransferModule(@Param("param") BaseParam param, @Param("module") PermissionTransferModule module);
|
||||
|
||||
int updateRoleTransferModule(@Param("param") BaseParam param, @Param("module") PermissionTransferModule module);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.weaver.seconddev.entry.service;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/31
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface EntryManageService {
|
||||
|
||||
/**
|
||||
* 校验工号
|
||||
*
|
||||
* @param jobNum 工号
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> checkJobNum(String jobNum);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> uploadFiles(Map<String, String> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
package com.weaver.seconddev.entry.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.form.metadata.field.FormField;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.eteams.file.client.param.RemoteUploadParam;
|
||||
import com.weaver.eteams.file.client.remote.FileClientService;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.file.ud.api.FileUploadService;
|
||||
import com.weaver.seconddev.entry.entity.FileUploadLoad;
|
||||
import com.weaver.seconddev.entry.enums.FileUploadType;
|
||||
import com.weaver.seconddev.entry.mapper.EntryManageMapper;
|
||||
import com.weaver.seconddev.entry.service.EntryManageService;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.seconddev.portal.mapper.portal.EbuilderBaseMapper;
|
||||
import com.weaver.seconddev.portal.util.DateUtil;
|
||||
import com.weaver.seconddev.portal.util.PapiUtil;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
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.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/31
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EntryManageServiceImpl implements EntryManageService {
|
||||
|
||||
@Autowired
|
||||
EntryManageMapper entryManageMapper;
|
||||
|
||||
@Autowired
|
||||
FileClientService fileClientService;
|
||||
|
||||
@Autowired
|
||||
FileUploadService fileUploadService;
|
||||
|
||||
@Autowired
|
||||
private FileDownloadService fileDownloadService;
|
||||
|
||||
@Autowired
|
||||
EbuilderBaseMapper ebuilderBaseMapper;
|
||||
|
||||
BaseParam baseParam = new BaseParam();
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> checkJobNum(String jobNum) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("isExist", false);
|
||||
if (StringUtils.isBlank(jobNum)) {
|
||||
return WeaResult.fail("工号获取异常", true);
|
||||
}
|
||||
|
||||
Long empIdByJobNum = entryManageMapper.getEntryRecordIdByJobNum(baseParam, jobNum);
|
||||
dataMap.put("isExist", null != empIdByJobNum);
|
||||
dataMap.put("empId", empIdByJobNum);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> uploadFiles(Map<String, String> params) {
|
||||
String fileIds = params.get("fileIds");
|
||||
if (StringUtils.isBlank(fileIds)) {
|
||||
return WeaResult.fail("请选择文件后上传", true);
|
||||
}
|
||||
String[] fieldArray = fileIds.split(",");
|
||||
List<FileUploadLoad> fileUploadLoadList = new ArrayList<>();
|
||||
for (String fieldStr : fieldArray) {
|
||||
Long field = Convert.toLong(fieldStr);
|
||||
FileObj fileObj = fileClientService.get(field);
|
||||
if (null == fileObj) {
|
||||
log.error("文件不存在,field={}", field);
|
||||
continue;
|
||||
}
|
||||
Date uploadTime = fileObj.getUploadTime();
|
||||
LocalDateTime localDate = DateUtil.toLocalDateTime(uploadTime);
|
||||
if (null == localDate) {
|
||||
localDate = DateUtil.toLocalDateTime(new Date());
|
||||
}
|
||||
String formatDate = DateUtil.formatDateTime(localDate, DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
||||
|
||||
FileUploadLoad fileUploadLoad = new FileUploadLoad(fileObj.getName(), formatDate, field);
|
||||
fileObj.setName(fileUploadLoad.getFileName());
|
||||
fileClientService.update(fileObj);
|
||||
fileUploadLoadList.add(fileUploadLoad);
|
||||
}
|
||||
|
||||
Map<String, List<FileUploadLoad>> fileUploadMap = fileUploadLoadList.stream().collect(Collectors.groupingBy(FileUploadLoad::getJobNum));
|
||||
|
||||
|
||||
JSONArray datas = new JSONArray();
|
||||
Long formId = ebuilderBaseMapper.getFormIdByTableName(baseParam, "uf_jcl_rzgl");
|
||||
|
||||
for (Map.Entry<String, List<FileUploadLoad>> entry : fileUploadMap.entrySet()) {
|
||||
String jobNum = entry.getKey();
|
||||
// 入职记录ID
|
||||
Long entryRecordId = entryManageMapper.getEntryRecordIdByJobNum(baseParam, jobNum);
|
||||
if (null == entryRecordId) {
|
||||
continue;
|
||||
}
|
||||
List<FileUploadLoad> personFileUploadLoadList = entry.getValue();
|
||||
|
||||
// 根据文件类型分组,并将同一类别的附件ID用逗号分隔
|
||||
Map<String, List<FileUploadLoad>> fileTypeMap = personFileUploadLoadList.stream().collect(Collectors.groupingBy(FileUploadLoad::getFileTypeName));
|
||||
// 组合更新的JOSN对象
|
||||
JSONObject mainDataObj = new JSONObject();
|
||||
mainDataObj.put("id", entryRecordId);
|
||||
fileTypeMap.forEach((fileTypeName, list) -> {
|
||||
FileUploadType byName = FileUploadType.getByName(fileTypeName);
|
||||
if (null != byName) {
|
||||
String fieldIds = reUploadFiled(entryRecordId, list, formId, byName.getDbName());
|
||||
mainDataObj.put(byName.getDbName(), fieldIds);
|
||||
}
|
||||
});
|
||||
JSONObject dataObj = new JSONObject();
|
||||
dataObj.put("mainTable", mainDataObj);
|
||||
log.error("dataObj===" + dataObj);
|
||||
datas.add(dataObj);
|
||||
}
|
||||
|
||||
Long objId = ebuilderBaseMapper.getObjIdByTableName(baseParam, "uf_jcl_rzgl");
|
||||
Long userId = UserContext.getCurrentUser().getEmployeeId();
|
||||
|
||||
String updateMsg = updateEbTable(datas, String.valueOf(objId), String.valueOf(userId));
|
||||
Map<String, Object> actionMap = new HashMap<>();
|
||||
actionMap.put("updateMsg", updateMsg);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新EB表单数据
|
||||
*
|
||||
* @param datas
|
||||
* @param objId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
private String updateEbTable(JSONArray datas, String objId, String userId) {
|
||||
JSONObject dataJson = new JSONObject();
|
||||
JSONObject operationinfo = new JSONObject();
|
||||
operationinfo.put("fieldNoFindIgnore", "true");
|
||||
operationinfo.put("doAction", "false");
|
||||
JSONObject header = new JSONObject();
|
||||
header.put("objId", objId);
|
||||
|
||||
dataJson.put("datas", datas);
|
||||
dataJson.put("header", header);
|
||||
dataJson.put("operationinfo", operationinfo);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("datajson", dataJson);
|
||||
jsonObject.put("userid", userId);
|
||||
// 请求授权
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "A1a");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
jsonObject.put("access_token", papiToken);
|
||||
|
||||
log.error("jsonObject===" + jsonObject);
|
||||
|
||||
return HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/ebuilder/form/dataset/v2/updateFormData")
|
||||
.header("Content-Type", "application/json")
|
||||
.body(jsonObject.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文件上传到EB
|
||||
*
|
||||
* @param entryRecordId
|
||||
* @param fileUploadLoadList
|
||||
* @param formId
|
||||
* @param fieldName
|
||||
* @return
|
||||
*/
|
||||
private String reUploadFiled(Long entryRecordId, List<FileUploadLoad> fileUploadLoadList, Long formId, String fieldName) {
|
||||
List<String> newFieldIds = new ArrayList<>();
|
||||
FormField formField = ebuilderBaseMapper.getFormFieldByFieldName(baseParam, formId, fieldName);
|
||||
if (null != formField) {
|
||||
Long folderIdByFieldId = ebuilderBaseMapper.getFolderIdByFieldId(baseParam, formField.getId());
|
||||
for (FileUploadLoad fileUploadLoad : fileUploadLoadList) {
|
||||
FileData fileData = fileDownloadService.downloadFile(fileUploadLoad.getFileId());
|
||||
FileObj fileObj = fileData.getFileObj();
|
||||
RemoteUploadParam uploadParam = new RemoteUploadParam(fileObj.getName(), String.valueOf(System.currentTimeMillis()), "ebuilderform");
|
||||
uploadParam.setRefId(entryRecordId);
|
||||
uploadParam.setFolderId(folderIdByFieldId);
|
||||
|
||||
InputStream inputStream = fileData.getInputStream();
|
||||
FileObj fileObj1 = fileUploadService.uploadLocalFile(inputStream, UserContext.getCurrentUser().getEmployeeId(), fileObj.getType(), uploadParam);
|
||||
if (null != fileObj1) {
|
||||
newFieldIds.add(fileObj1.getId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringUtils.join(newFieldIds, ",");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.weaver.seconddev.portal.constant;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
public class ApplicationConfigConstant {
|
||||
/**
|
||||
* 应用端URL
|
||||
*/
|
||||
public static final String APP_URL = "http://10.60.4.124:30609";
|
||||
/**
|
||||
* Corp id
|
||||
*/
|
||||
public static final String CORP_ID = "ec7de918480e79abe774982cf075c045";
|
||||
/**
|
||||
* 组织中心APP Key
|
||||
*/
|
||||
public static final String ORGANIZATION_APP_KEY = "c003f58a174a12abebb9fdfa5ba800c2";
|
||||
/**
|
||||
* 组织中心APP Secret
|
||||
*/
|
||||
public static final String ORGANIZATION_APP_SECRET = "332ed6328a15f6189efa4d2ac5935bc1";
|
||||
|
||||
|
||||
/**
|
||||
* 千里聆服务APP ID
|
||||
*/
|
||||
public static final String OCR_APP_ID = "6ou6wvl8";
|
||||
/**
|
||||
* 千里聆服务APP SECRET
|
||||
*/
|
||||
public static final String OCR_APP_SECRET = "53fc247ffe4f3e8d6c96a5d0a9a222a7";
|
||||
|
||||
public static final String ID_CARD_OCR_URL = "https://open.easst.cn/openapi/rest/common/idcardocr";
|
||||
public static final String BANK_CARD_OCR_URL = "https://open.easst.cn/openapi/rest/common/bank_card_ocr";
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.weaver.seconddev.portal.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.po.EmployeeBasicInfoPo;
|
||||
import com.weaver.seconddev.portal.service.EmployeePortalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/portal/employee")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class EmployeePortalController {
|
||||
|
||||
@Autowired
|
||||
EmployeePortalService employeePortalService;
|
||||
|
||||
@PostMapping("/getDurationOfEmployment")
|
||||
private WeaResult<Map<String, Object>> getDurationOfEmployment(@RequestBody Map<String, String> params) {
|
||||
return employeePortalService.getDurationOfEmployment(params);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getEmployeeInfo")
|
||||
private WeaResult<EmployeeBasicInfoPo> getEmployeeInfo(@RequestHeader Map<String, String> header, @RequestBody Map<String, Object> params) {
|
||||
String origin = header.get("origin");
|
||||
// 考勤标准接口
|
||||
String otherApiUrl = origin + "/api/attend/web/attendInfoV2/getAttendInfoStatis";
|
||||
params.put("otherApiUrl", otherApiUrl);
|
||||
params.put("header",header);
|
||||
return employeePortalService.getEmployeeInfo(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.weaver.seconddev.portal.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.service.HrbpPortalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/10
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/portal/hrbp")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class HrbpPortalController {
|
||||
|
||||
@Autowired
|
||||
HrbpPortalService hrPortalService;
|
||||
|
||||
|
||||
@PostMapping("/getToDo")
|
||||
private WeaResult<Map<String, Object>> getToDo(@RequestBody Map<String, String> params) {
|
||||
return hrPortalService.getToDo(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getEmployeeData")
|
||||
private WeaResult<Map<String, Object>> getEmployeeData(@RequestBody Map<String, String> params) {
|
||||
return hrPortalService.getEmployeeData(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getTodayOverview")
|
||||
private WeaResult<Map<String, Object>> getTodayOverview(@RequestBody Map<String, String> params) {
|
||||
return hrPortalService.getTodayOverview(params);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.weaver.seconddev.portal.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalPO;
|
||||
import com.weaver.seconddev.portal.service.LeaderCockpitService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/portal/leader")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class LeaderCockpitController {
|
||||
|
||||
@Autowired
|
||||
LeaderCockpitService leaderCockpitService;
|
||||
|
||||
@PostMapping("/getOnJobNumber")
|
||||
private WeaResult<Map<String, Object>> getOnJobNumber(@RequestBody Map<String, String> params) {
|
||||
return leaderCockpitService.getOnJobNumber(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getLaborCost")
|
||||
private WeaResult<Map<String, Object>> getLaborCost(@RequestBody Map<String, String> params) {
|
||||
return leaderCockpitService.getLaborCost(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getTurnoverRate")
|
||||
private WeaResult<Map<String, Object>> getTurnoverRate(@RequestBody Map<String, String> params) {
|
||||
return leaderCockpitService.getTurnoverRate(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getAttendanceRate")
|
||||
private WeaResult<List<PortalPO>> getAttendanceRate(@RequestBody Map<String, String> params) {
|
||||
return leaderCockpitService.getAttendanceRate(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getFullStaffingRate")
|
||||
private WeaResult<List<PortalPO>> getFullStaffingRate(@RequestHeader Map<String, String> header, @RequestBody Map<String, String> params) {
|
||||
return leaderCockpitService.getFullStaffingRate(header, params);
|
||||
}
|
||||
|
||||
@PostMapping("/getEmploymentStatus")
|
||||
private WeaResult<Map<String, Object>> getEmploymentStatus(@RequestBody Map<String, String> params) {
|
||||
return leaderCockpitService.getEmploymentStatus(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getResignationSituation")
|
||||
private WeaResult<Map<String, Object>> getResignationSituation(@RequestBody Map<String, String> params) {
|
||||
return leaderCockpitService.getResignationSituation(params);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.weaver.seconddev.portal.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.component.Option;
|
||||
import com.weaver.seconddev.portal.service.ManagerPortalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/portal/manager")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class ManagerPortalController {
|
||||
|
||||
@Autowired
|
||||
ManagerPortalService managerPortalService;
|
||||
|
||||
@PostMapping("/getMangerInfo")
|
||||
private WeaResult<Map<String, Object>> getMangerInfo(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getMangerInfo(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getTodayOverview")
|
||||
private WeaResult<Map<String, Object>> getTodayOverview(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getTodayOverview(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getBasicPersonnel")
|
||||
private WeaResult<Map<String, Object>> getBasicPersonnel(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getBasicPersonnel(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getBasicPersonnelSql")
|
||||
private WeaResult<String> getBasicPersonnelSql(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getBasicPersonnelSql(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getTeamMemorialDay")
|
||||
private WeaResult<Map<String, Object>> getTeamMemorialDay(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getTeamMemorialDay(params);
|
||||
}
|
||||
@PostMapping("/getTeamMemorialDaySql")
|
||||
private WeaResult<String> getTeamMemorialDaySql(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getTeamMemorialDaySql(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getEducationInfo")
|
||||
private WeaResult<Map<String, Object>> getEducationInfo(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getEducationInfo(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getAttendanceInfo")
|
||||
private WeaResult<Map<String, Object>> getAttendanceInfo(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getAttendanceInfo(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getTeamEmployee")
|
||||
private WeaResult<Map<String, Object>> getTeamEmployee(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getTeamEmployee(params);
|
||||
}
|
||||
|
||||
@PostMapping("/getEbFieldOptions")
|
||||
private WeaResult<List<Option>> getEbFieldOptions(@RequestBody Map<String, String> params) {
|
||||
return managerPortalService.getEbFieldOptions(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.weaver.seconddev.portal.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.po.ExpirationReminderPo;
|
||||
import com.weaver.seconddev.portal.service.SscPortalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/portal/ssc")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class SscPortalController {
|
||||
|
||||
@Autowired
|
||||
SscPortalService sscPortalService;
|
||||
|
||||
@PostMapping("/getExpirationReminder")
|
||||
private WeaResult<ExpirationReminderPo> getExpirationReminder(@RequestBody Map<String, String> params) {
|
||||
return sscPortalService.getExpirationReminder(params);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.weaver.seconddev.portal.entity.bo;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.portal.entity.po.cfg.EmployeeStaff;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class EmployeeStaffBo {
|
||||
public static List<EmployeeStaff> mapEmployeeStaffData(String responseJson) {
|
||||
// 解析接口返回的 JSON 数据
|
||||
JSONObject responseObj = JSON.parseObject(responseJson);
|
||||
|
||||
// 判断接口是否响应成功
|
||||
if (responseObj.containsKey("code") && responseObj.getIntValue("code") == 200 && responseObj.containsKey("status") && responseObj.getBooleanValue("status")) {
|
||||
// 判断是否存在 data 和 displayData 字段
|
||||
if (responseObj.containsKey("data")) {
|
||||
JSONObject dataObj = responseObj.getJSONObject("data");
|
||||
if (dataObj.containsKey("displayData")) {
|
||||
// 解析 displayData 对象集合
|
||||
return dataObj.getJSONArray("displayData").toJavaList(EmployeeStaff.class);
|
||||
} else {
|
||||
// displayData 字段不存在
|
||||
throw new IllegalArgumentException("displayData 字段不存在");
|
||||
}
|
||||
} else {
|
||||
// data 字段不存在
|
||||
throw new IllegalArgumentException("data 字段不存在");
|
||||
}
|
||||
} else {
|
||||
// 接口响应失败
|
||||
String errorMsg = responseObj.getString("msg");
|
||||
throw new RuntimeException("接口调用失败: " + errorMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.weaver.seconddev.portal.entity.component;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Option {
|
||||
private String id;
|
||||
private String content;
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.weaver.seconddev.portal.entity.param;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class BaseParam {
|
||||
private String e10_common = "e10_common";
|
||||
private String e10_core_business = "e10_core_business";
|
||||
private String e10_other_business = "e10_other_business";
|
||||
private String ec_secondev = "ec_secondev";
|
||||
private String eteams = "eteams";
|
||||
|
||||
/**
|
||||
* 部门自定义表
|
||||
*/
|
||||
private String table_dept_cus = "ft_1154218872715993098";
|
||||
/**
|
||||
* 岗位自定义表
|
||||
*/
|
||||
private String table_job_cus = "ft_1155455711525494797";
|
||||
|
||||
/**
|
||||
* 请假表单
|
||||
*/
|
||||
private String leaveFormCus = "ft_1151420254779654145";
|
||||
///**
|
||||
// * 员工自定义表
|
||||
// */
|
||||
//private String table_emp_cus = "ft_1152026012537184302";
|
||||
/**
|
||||
* 租户标识
|
||||
*/
|
||||
private String tenantKey;
|
||||
|
||||
public String getTenantKey() {
|
||||
if (StringUtils.isBlank(tenantKey)) {
|
||||
// 租户默认值
|
||||
return "t024j0gfn0";
|
||||
}
|
||||
return tenantKey;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.weaver.seconddev.portal.entity.param;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BasicPersonnelParam extends BaseParam {
|
||||
private Set<Long> departmentIdList;
|
||||
private String searchType;
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
private String pieType;
|
||||
private Integer startIndex;
|
||||
private Integer endIndex;
|
||||
private String belongYear;
|
||||
|
||||
/*分页查询*/
|
||||
|
||||
private String searchKey;
|
||||
private String departmentId;
|
||||
private Integer current;
|
||||
private Integer offset;
|
||||
private Integer pageSize;
|
||||
|
||||
public Integer getOffset() {
|
||||
return (current - 1) * pageSize;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.weaver.seconddev.portal.entity.param;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/14
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class EmployeePortalParam extends BaseParam {
|
||||
private Long employeeId;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.weaver.seconddev.portal.entity.param;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/10
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class HrbpParam extends BaseParam{
|
||||
private Set<Long> departmentIdList;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.weaver.seconddev.portal.entity.param;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SearchConditionParam extends BaseParam{
|
||||
private String departmentId;
|
||||
private Set<Long> departmentIdList;
|
||||
private String searchDate;
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
|
||||
private Set<Long> selectDepartmentId;
|
||||
/**
|
||||
* 是否关键人员
|
||||
*/
|
||||
private String isKeyPerson;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.portal.entity.param;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SscParam extends BaseParam {
|
||||
private Set<Long> departmentIdList;
|
||||
private String currentDate;
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import com.weaver.teams.domain.user.Avatar;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/14
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class EmployeeBasicInfoPo {
|
||||
private Long employeeId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private Avatar avatar;
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
private String workCode;
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
private String companyName;
|
||||
private String departmentName;
|
||||
/**
|
||||
* 入职日期
|
||||
*/
|
||||
private String hireDate;
|
||||
/**
|
||||
* 人员状态
|
||||
*/
|
||||
private String employeeStatus;
|
||||
/**
|
||||
* 直接上级
|
||||
*/
|
||||
private String directSuperior;
|
||||
/**
|
||||
* 年假余额
|
||||
*/
|
||||
private String annualLeaveBalance;
|
||||
private String annualLeaveBalanceUrl;
|
||||
/**
|
||||
* 调休余额
|
||||
*/
|
||||
private String leaveBalance;
|
||||
private String leaveBalanceUrl;
|
||||
/**
|
||||
* 带薪病假余额
|
||||
*/
|
||||
private String paidSickLeaveBalance;
|
||||
private String paidSickLeaveBalanceUrl;
|
||||
/**
|
||||
* 应出勤天数
|
||||
*/
|
||||
private String expectedAttendance;
|
||||
private String expectedAttendanceUrl;
|
||||
/**
|
||||
* 实际出勤
|
||||
*/
|
||||
private String actualAttendance;
|
||||
private String actualAttendanceUrl;
|
||||
/**
|
||||
* 请假
|
||||
*/
|
||||
private String leave;
|
||||
private String leaveUrl;
|
||||
/**
|
||||
* 出差
|
||||
*/
|
||||
private String travel;
|
||||
private String travelUrl;
|
||||
/**
|
||||
* 加班
|
||||
*/
|
||||
private String overtime;
|
||||
private String overtimeUrl;
|
||||
/**
|
||||
* 公出
|
||||
*/
|
||||
private String publicLeave;
|
||||
private String publicLeaveUrl;
|
||||
/**
|
||||
* 异常出勤
|
||||
*/
|
||||
private String exceptionalAttendance;
|
||||
private String exceptionalAttendanceUrl;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExpirationReminderPo {
|
||||
/**
|
||||
* 合同到期
|
||||
*/
|
||||
private int contractExpiration;
|
||||
private String contractExpirationUrl;
|
||||
/**
|
||||
* 身份证到期
|
||||
*/
|
||||
private int idCardExpiration;
|
||||
private String idCardExpirationUrl;
|
||||
/**
|
||||
* 健康证到期
|
||||
*/
|
||||
private int healthCertificateExpiration;
|
||||
private String healthCertificateExpirationUrl;
|
||||
/**
|
||||
* 入职周年提醒
|
||||
*/
|
||||
private int employmentAnniversary;
|
||||
private String employmentAnniversaryUrl;
|
||||
/**
|
||||
* 管理层生日提醒
|
||||
*/
|
||||
private int birthdayNum;
|
||||
private String birthdayNumUrl;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LateAndEarlyRankPo {
|
||||
private Long empId;
|
||||
private String empName;
|
||||
private String departmentName;
|
||||
private Integer times;
|
||||
private Integer minutes;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/10
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PieChartConfig {
|
||||
private String type;
|
||||
private String name;
|
||||
private String educationIds;
|
||||
private Integer startIndex;
|
||||
private Integer endIndex;
|
||||
private String gradeIds;
|
||||
private Integer orderNum;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PortalData {
|
||||
private String index;
|
||||
private String date;
|
||||
private String depart;
|
||||
private String posi;
|
||||
private String leader;
|
||||
private String count;
|
||||
private Integer all;
|
||||
private Integer key;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PortalPO {
|
||||
private String value;
|
||||
private String name;
|
||||
private String id;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PortalUrlDetail {
|
||||
private String id;
|
||||
private String detailKey;
|
||||
private String urlAddress;
|
||||
private String detailName;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class Position {
|
||||
private Long positionId;
|
||||
private String positionName;
|
||||
private Long departmentId;
|
||||
private String departmentName;
|
||||
private Long gradeId;
|
||||
private String gradeName;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.weaver.seconddev.portal.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class TeamEmployeePo {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private String departmentName;
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
private String jobPositionName;
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
private String jobLevelName;
|
||||
/**
|
||||
* 入职日期
|
||||
*/
|
||||
private String hireDate;
|
||||
/**
|
||||
* 学校
|
||||
*/
|
||||
private String schoolName;
|
||||
/**
|
||||
* 学历
|
||||
*/
|
||||
private String educationName;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private String age;
|
||||
|
||||
public String getAge() {
|
||||
if (StringUtils.isNotBlank(age)) {
|
||||
return age + "岁";
|
||||
}
|
||||
return age;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class EmployeeStaff {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private String orgId;
|
||||
/**
|
||||
* 组织
|
||||
*/
|
||||
private String orgName;
|
||||
/**
|
||||
* 组织全名
|
||||
*/
|
||||
private String orgFullName;
|
||||
private String isParent;
|
||||
/**
|
||||
* 编制方案ID
|
||||
*/
|
||||
private String planId;
|
||||
/**
|
||||
* 编制方案名称
|
||||
*/
|
||||
private String planName;
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private Integer year;
|
||||
/**
|
||||
* 超编管控
|
||||
*/
|
||||
private String overCtrl;
|
||||
/**
|
||||
* 编制数(含下级)
|
||||
*/
|
||||
private Integer estCountWithSub;
|
||||
/**
|
||||
* 编制数(本级)
|
||||
*/
|
||||
private Integer estCount;
|
||||
/**
|
||||
* 在编数(本级)
|
||||
*/
|
||||
private Integer numberingCount;
|
||||
/**
|
||||
* 在编数(含下级)
|
||||
*/
|
||||
private Integer numberingCountWithSub;
|
||||
/**
|
||||
* 预增数(本级)
|
||||
*/
|
||||
private Integer preAddEmpCount;
|
||||
/**
|
||||
* 预增数(含下级)
|
||||
*/
|
||||
private Integer preAddEmpCountWithSub;
|
||||
/**
|
||||
* 预减数(本级)
|
||||
*/
|
||||
private Integer preSubEmpCount;
|
||||
/**
|
||||
* 预减数(含下级)
|
||||
*/
|
||||
private Integer preSubEmpCountWithSub;
|
||||
/**
|
||||
* 缺编数(本级)
|
||||
*/
|
||||
private Integer estLackCount;
|
||||
/**
|
||||
* 缺编数(含下级)
|
||||
*/
|
||||
private Integer estLackCountWithSub;
|
||||
/**
|
||||
* 超编数(本级)
|
||||
*/
|
||||
private Integer estOverCount;
|
||||
/**
|
||||
* 超编数(含下级)
|
||||
*/
|
||||
private Integer estOverCountWithSub;
|
||||
private Integer hasLink;
|
||||
private Integer hasDc;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
/**
|
||||
* @author: dxfeng
|
||||
* @createTime: 2025/07/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class FormDatas {
|
||||
private FormDatasDetail formDatas;
|
||||
private QuickSearchDatas quickSearchDatas;
|
||||
|
||||
// Getters and Setters
|
||||
public FormDatasDetail getFormDatas() {
|
||||
return formDatas;
|
||||
}
|
||||
|
||||
public void setFormDatas(FormDatasDetail formDatas) {
|
||||
this.formDatas = formDatas;
|
||||
}
|
||||
|
||||
public QuickSearchDatas getQuickSearchDatas() {
|
||||
return quickSearchDatas;
|
||||
}
|
||||
|
||||
public void setQuickSearchDatas(QuickSearchDatas quickSearchDatas) {
|
||||
this.quickSearchDatas = quickSearchDatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FormDatasDetail {
|
||||
private List<OrgWrapper> org;
|
||||
private List<OverCtrlWrapper> overCtrl;
|
||||
private List<MonthWrapper> month;
|
||||
|
||||
// Getters and Setters
|
||||
public List<OrgWrapper> getOrg() {
|
||||
return org;
|
||||
}
|
||||
|
||||
public void setOrg(List<OrgWrapper> org) {
|
||||
this.org = org;
|
||||
}
|
||||
|
||||
public List<OverCtrlWrapper> getOverCtrl() {
|
||||
return overCtrl;
|
||||
}
|
||||
|
||||
public void setOverCtrl(List<OverCtrlWrapper> overCtrl) {
|
||||
this.overCtrl = overCtrl;
|
||||
}
|
||||
|
||||
public List<MonthWrapper> getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(List<MonthWrapper> month) {
|
||||
this.month = month;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
public class MonthWrapper {
|
||||
private String month;
|
||||
|
||||
// Getters and Setters
|
||||
public String getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
public class OrgItem {
|
||||
private String id;
|
||||
|
||||
// Getters and Setters
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrgWrapper {
|
||||
private List<OrgItem> org;
|
||||
|
||||
// Getters and Setters
|
||||
public List<OrgItem> getOrg() {
|
||||
return org;
|
||||
}
|
||||
|
||||
public void setOrg(List<OrgItem> org) {
|
||||
this.org = org;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
public class OverCtrlWrapper {
|
||||
private String overCtrl;
|
||||
|
||||
// Getters and Setters
|
||||
public String getOverCtrl() {
|
||||
return overCtrl;
|
||||
}
|
||||
|
||||
public void setOverCtrl(String overCtrl) {
|
||||
this.overCtrl = overCtrl;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package com.weaver.seconddev.portal.entity.po.cfg;
|
||||
|
||||
public class QuickSearchDatas {
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.weaver.seconddev.portal.enums;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/14
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum PersonnelStatusEnum {
|
||||
/**
|
||||
* 1 试用、2 试用延期、3 正式、4 临时、5 实习、6 离职、7 退休、9 解聘、10 无效
|
||||
*/
|
||||
TRY_OUT("1", "试用"),
|
||||
TRY_OUT_DELAY("2", "试用延期"),
|
||||
FORMAL("3", "正式"),
|
||||
TEMPORARY("4", "临时"),
|
||||
INTERNSHIP("5", "实习"),
|
||||
LEAVE("6", "离职"),
|
||||
RETIRED("7", "退休"),
|
||||
INVALID("9", "解聘"),
|
||||
QUIT("10", "无效");
|
||||
|
||||
PersonnelStatusEnum(String value, String showName) {
|
||||
this.value = value;
|
||||
this.showName = showName;
|
||||
}
|
||||
|
||||
private String value;
|
||||
private String showName;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getShowName() {
|
||||
return showName;
|
||||
}
|
||||
|
||||
public void setShowName(String showName) {
|
||||
this.showName = showName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据value获取showName
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String getShowNameByValue(String value) {
|
||||
for (PersonnelStatusEnum item : PersonnelStatusEnum.values()) {
|
||||
if (item.getValue().equalsIgnoreCase(value)) {
|
||||
return item.getShowName();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.weaver.seconddev.portal.mapper.dictionary;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataConvertMapper {
|
||||
/**
|
||||
* 根据名称、类型获取ID
|
||||
*
|
||||
* @param param
|
||||
* @param type
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
Long getIdByName(@Param("param") BaseParam param, @Param("type") String type, @Param("name") String name);
|
||||
|
||||
/**
|
||||
* 获取假期类型
|
||||
* @param param
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
Long getHolidayType(@Param("param") BaseParam param, @Param("name") String name);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import com.weaver.common.form.datasource.FormdataTemplateDetails;
|
||||
import com.weaver.common.form.metadata.field.FormField;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EbuilderBaseMapper {
|
||||
/**
|
||||
* 根据表名获取表ID
|
||||
*
|
||||
* @param param
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
long getFormIdByTableName(@Param("param") BaseParam param, @Param("tableName") String tableName);
|
||||
|
||||
/**
|
||||
* 根据表ID和字段名获取字段信息
|
||||
*
|
||||
* @param param
|
||||
* @param formId
|
||||
* @param fieldName
|
||||
* @return
|
||||
*/
|
||||
FormField getFormFieldByFieldName(@Param("param") BaseParam param, @Param("formId") long formId, @Param("fieldName") String fieldName);
|
||||
|
||||
/**
|
||||
* 根据模板ID获取模板详情
|
||||
*
|
||||
* @param param
|
||||
* @param templateId
|
||||
* @return
|
||||
*/
|
||||
List<FormdataTemplateDetails> getFormdataTemplateDetails(@Param("param") BaseParam param, @Param("templateId") long templateId);
|
||||
|
||||
/**
|
||||
* 根据表名获取对象ID
|
||||
*
|
||||
* @param param
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
Long getObjIdByTableName(@Param("param") BaseParam param, @Param("tableName") String tableName);
|
||||
|
||||
Long getFolderIdByFieldId(@Param("param") BaseParam param, @Param("fieldId") Long fieldId);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EmployeePortalMapper {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import com.weaver.common.form.metadata.field.FormField;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/18
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EteamsBaseMapper {
|
||||
/**
|
||||
* 根据表名获取表ID
|
||||
*
|
||||
* @param param
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
long getFormIdByTableName(@Param("param") BaseParam param, @Param("tableName") String tableName);
|
||||
|
||||
/**
|
||||
* 根据表ID和字段名获取字段信息
|
||||
*
|
||||
* @param param
|
||||
* @param formId
|
||||
* @param fieldName
|
||||
* @return
|
||||
*/
|
||||
FormField getFormFieldByFieldName(@Param("param") BaseParam param, @Param("formId") long formId, @Param("fieldName") String fieldName);
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.HrbpParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/10
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface HrbpPortalMapper {
|
||||
|
||||
/**
|
||||
* 待入职
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getToEntryCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 待转正
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getToRegularCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 待离职
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getToLeaveCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 待签订
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getToSignCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 代理期转正
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getToProxyCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 员工人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getAllEmployeeCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 正式员工
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getFormalEmployeeCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 实习生
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getInternEmployeeCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 外包
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getOutsourcingCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 劳务
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getLaborCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 试用
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getProbationCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 正式
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getFormalCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 实习
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getInternCount(HrbpParam param);
|
||||
|
||||
/**
|
||||
* 离职
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getLeaveCount(HrbpParam param);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.SearchConditionParam;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalPO;
|
||||
import com.weaver.seconddev.portal.entity.po.Position;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LeaderCockpitMapper {
|
||||
|
||||
/**
|
||||
* 按类型统计在职人数
|
||||
*
|
||||
* @param conditionParam
|
||||
* @return
|
||||
*/
|
||||
List<PortalPO> getOnJobNumber(SearchConditionParam conditionParam);
|
||||
|
||||
/**
|
||||
* 查询在职人数
|
||||
*
|
||||
* @param conditionParam
|
||||
* @return
|
||||
*/
|
||||
int getOnJobCount(SearchConditionParam conditionParam);
|
||||
|
||||
/**
|
||||
* 查询入职人数
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
int getEmploymentCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询入职人数列表
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
List<PortalPO> getEmploymentListByPosition(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询关键入职人数
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
int getKeyEmploymentCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
|
||||
/**
|
||||
* 查询离职人数
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
int getResignCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询关键离职人数
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
int getKeyResignCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询离职人数列表
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
List<PortalPO> getResignListByPosition(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
|
||||
Position getPositionById(@Param("param") SearchConditionParam param, @Param("positionId") String positionId);
|
||||
|
||||
/**
|
||||
* 获取顶级部门id列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Set<Long> getTopDepartmentIds(@Param("param") SearchConditionParam param);
|
||||
|
||||
/**
|
||||
* 人力成本
|
||||
*/
|
||||
Map<String,Object> getLaborCost(SearchConditionParam param);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.BasicPersonnelParam;
|
||||
import com.weaver.seconddev.portal.entity.po.LateAndEarlyRankPo;
|
||||
import com.weaver.seconddev.portal.entity.po.PieChartConfig;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalPO;
|
||||
import com.weaver.seconddev.portal.entity.po.TeamEmployeePo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface ManagerPortalMapper {
|
||||
/**
|
||||
* 在职人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getOnJobNum(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 离职人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getResignNumber(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 离职流程中人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getResigningNumber(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 入职流程中人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getEntryingNumber(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 入职人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getEntryNumber(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 获取所负责的顶级部门
|
||||
*
|
||||
* @param param
|
||||
* @param emdId
|
||||
* @return
|
||||
*/
|
||||
List<Long> getManageDeptIds(@Param("param") BasicPersonnelParam param, @Param("empId") Long emdId);
|
||||
|
||||
/**
|
||||
* 获取生日人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getBirthdayNum(BasicPersonnelParam param);
|
||||
|
||||
|
||||
/**
|
||||
* 获取预计转正员工人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getRegularEmployeeNum(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 获取入职周年人数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getEmploymentAnniversary(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 获取学历信息
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<PortalPO> getEducationInfo(BasicPersonnelParam param);
|
||||
|
||||
List<PortalPO> getPerformanceInfo(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 获取年龄统计数据
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startIndex
|
||||
* @param endIndex
|
||||
* @return
|
||||
*/
|
||||
Integer getAgeCount(@Param("param") BasicPersonnelParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startIndex") Integer startIndex, @Param("endIndex") Integer endIndex);
|
||||
|
||||
/**
|
||||
* 获取司龄统计数据
|
||||
*
|
||||
* @param param
|
||||
* @param departmentIdList
|
||||
* @param startIndex
|
||||
* @param endIndex
|
||||
* @return
|
||||
*/
|
||||
Integer getComapnyCount(@Param("param") BasicPersonnelParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startIndex") Integer startIndex, @Param("endIndex") Integer endIndex);
|
||||
|
||||
/**
|
||||
* 饼状图配置信息
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<PieChartConfig> getPieTypeConfig(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 获取团队成员信息
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<TeamEmployeePo> getTeamEmployee(BasicPersonnelParam param);
|
||||
|
||||
/**
|
||||
* 获取团队成员总数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getTeamEmployeeTotal(BasicPersonnelParam param);
|
||||
|
||||
|
||||
Integer sumLateTimes(BasicPersonnelParam param);
|
||||
|
||||
Integer sumLeaveEarlyTimes(BasicPersonnelParam param);
|
||||
|
||||
Integer sumAbsenteeismTimes(BasicPersonnelParam param);
|
||||
|
||||
Integer sumReissueCardTimes(BasicPersonnelParam param);
|
||||
|
||||
Integer sumTotalAttendanceTimes(BasicPersonnelParam param);
|
||||
|
||||
List<LateAndEarlyRankPo> getLateAndEarlyRankList(BasicPersonnelParam param);
|
||||
|
||||
Integer sumWorkdayOvertimeDuration(BasicPersonnelParam param);
|
||||
|
||||
Integer sumWeekendOvertimeDuration(BasicPersonnelParam param);
|
||||
|
||||
Integer sumLegalHolidayOvertimeDuration(BasicPersonnelParam param);
|
||||
|
||||
Integer sumHolidayTimes(@Param("param") BasicPersonnelParam param, @Param("holidayIds") Collection<Long> holidayIds);
|
||||
|
||||
Integer sumPersonalLeaveDuration(BasicPersonnelParam param);
|
||||
|
||||
//Integer sumSickLeaveCount(@Param("param") BasicPersonnelParam param,@Param("holidayIds") Collection<Long> holidayIds);
|
||||
|
||||
Integer sumSickLeaveDuration(BasicPersonnelParam param);
|
||||
|
||||
//Integer sumAnnualLeaveCount(@Param("param") BasicPersonnelParam param,@Param("holidayIds") Collection<Long> holidayIds);
|
||||
|
||||
Integer sumAnnualLeaveDuration(BasicPersonnelParam param);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface PortalMapper {
|
||||
List<PortalUrlDetail> getPortalUrlDetail(@Param("tenantKey") String tenantKey,@Param("portalKey") String portalKey,@Param("componentKey") String componentKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.weaver.seconddev.portal.mapper.portal;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.SscParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SscPortalMapper {
|
||||
|
||||
/**
|
||||
* 合同到期
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getExpirationReminderCount(SscParam param);
|
||||
|
||||
/**
|
||||
* 身份证到期
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getIdCardExpirationCount(SscParam param);
|
||||
|
||||
/**
|
||||
* 健康证到期
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getHealthCertificateExpirationCount(SscParam param);
|
||||
|
||||
/**
|
||||
* 入职周年提醒
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getEmploymentAnniversaryCount(SscParam param);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.weaver.seconddev.portal.service;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.po.EmployeeBasicInfoPo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface EmployeePortalService {
|
||||
/**
|
||||
* 获取员工工作时长
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getDurationOfEmployment(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取员工信息
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<EmployeeBasicInfoPo> getEmployeeInfo(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.weaver.seconddev.portal.service;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/10
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface HrbpPortalService {
|
||||
|
||||
/**
|
||||
* 获取待办事项
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getToDo(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取员工数据
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getEmployeeData(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 今日概况
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getTodayOverview(Map<String, String> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.weaver.seconddev.portal.service;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalPO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 领导驾驶舱门户
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface LeaderCockpitService {
|
||||
|
||||
/**
|
||||
* 获取在职人数
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getOnJobNumber(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取人工成本
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getLaborCost(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取离职率
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getTurnoverRate(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取出勤率
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<List<PortalPO>> getAttendanceRate(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取满编率
|
||||
*
|
||||
* @param params
|
||||
* @param header
|
||||
* @return
|
||||
*/
|
||||
WeaResult<List<PortalPO>> getFullStaffingRate(Map<String, String> header, Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取入职情况
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getEmploymentStatus(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取离职情况
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getResignationSituation(Map<String, String> params);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.weaver.seconddev.portal.service;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.component.Option;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 经理门户
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface ManagerPortalService {
|
||||
|
||||
/**
|
||||
* 经理信息
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getMangerInfo(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 今日概况
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getTodayOverview(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 基础人事
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getBasicPersonnel(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 基础人事SQL
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<String> getBasicPersonnelSql(Map<String, String> params);
|
||||
|
||||
|
||||
/**
|
||||
* 团队纪念日
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getTeamMemorialDay(Map<String, String> params);
|
||||
|
||||
WeaResult<String> getTeamMemorialDaySql(Map<String, String> params);
|
||||
|
||||
|
||||
/**
|
||||
* 数据看板
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getEducationInfo(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 考勤看板
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getAttendanceInfo(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 团队员工
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<Map<String, Object>> getTeamEmployee(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 获取EB表单字段下拉选项
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<List<Option>> getEbFieldOptions(Map<String, String> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.weaver.seconddev.portal.service;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.po.ExpirationReminderPo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface SscPortalService {
|
||||
/**
|
||||
* 到期提醒
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<ExpirationReminderPo> getExpirationReminder(Map<String, String> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
package com.weaver.seconddev.portal.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hr.util.Util;
|
||||
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
|
||||
import com.weaver.seconddev.portal.entity.po.EmployeeBasicInfoPo;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
|
||||
import com.weaver.seconddev.portal.enums.PersonnelStatusEnum;
|
||||
import com.weaver.seconddev.portal.mapper.portal.PortalMapper;
|
||||
import com.weaver.seconddev.portal.service.EmployeePortalService;
|
||||
import com.weaver.seconddev.portal.util.DateUtil;
|
||||
import com.weaver.teams.domain.department.SimpleDepartment;
|
||||
import com.weaver.teams.domain.user.Avatar;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import com.weaver.teams.security.user.User;
|
||||
import com.weaver.workflow.common.cfg.org.service.DepartMentService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EmployeePortalServiceImpl implements EmployeePortalService {
|
||||
|
||||
private static final String PORTAL_KEY = "employeePortal";
|
||||
|
||||
@Autowired
|
||||
HrmCommonEmployeeDao hrmCommonEmployeeDao;
|
||||
|
||||
@Autowired
|
||||
DepartMentService departMentService;
|
||||
|
||||
@Autowired
|
||||
PortalMapper portalMapper;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getDurationOfEmployment(Map<String, String> params) {
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
SimpleEmployee byId = hrmCommonEmployeeDao.getById(currentUser.getEmployeeId());
|
||||
|
||||
LocalDate localDate = DateUtil.toLocalDate(byId.getHiredate());
|
||||
// 计算入职日期到现在的天数
|
||||
long days = DateUtil.daysBetween(DateUtil.formatDate(localDate), DateUtil.getCurrentDateStr());
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>(1);
|
||||
returnMap.put("days", days);
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<EmployeeBasicInfoPo> getEmployeeInfo(Map<String, Object> params) {
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
EmployeeBasicInfoPo employeeBasicInfoPo = new EmployeeBasicInfoPo();
|
||||
employeeBasicInfoPo.setEmployeeId(currentUser.getEmployeeId());
|
||||
|
||||
SimpleEmployee byId = hrmCommonEmployeeDao.getById(currentUser.getEmployeeId());
|
||||
SimpleDepartment department = byId.getDepartment();
|
||||
Avatar avatar = byId.getAvatar();
|
||||
employeeBasicInfoPo.setAvatar(avatar);
|
||||
employeeBasicInfoPo.setUserName(byId.getUsername());
|
||||
employeeBasicInfoPo.setWorkCode(byId.getJobNum());
|
||||
//WeaDepartMent departmentById = departMentService.getDepartMentById(byId.getDepartmentId());
|
||||
//employeeBasicInfoPo.setCompanyName(null != departmentById ? departmentById.getDepartMentName() : "");
|
||||
employeeBasicInfoPo.setDepartmentName(null==department?"":department.getName());
|
||||
|
||||
employeeBasicInfoPo.setHireDate(cn.hutool.core.date.DateUtil.formatDate(byId.getHiredate()));
|
||||
employeeBasicInfoPo.setEmployeeStatus(PersonnelStatusEnum.getShowNameByValue(byId.getPersonnelStatus()));
|
||||
|
||||
SimpleEmployee superior = byId.getSuperior();
|
||||
|
||||
employeeBasicInfoPo.setDirectSuperior(null != superior ? superior.getUsername() : "");
|
||||
|
||||
|
||||
// 考勤信息
|
||||
buildAttendance(params, employeeBasicInfoPo);
|
||||
|
||||
// 穿透地址处理
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "getEmployeeInfo");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
employeeBasicInfoPo.setAnnualLeaveBalanceUrl(urlMap.get("annualLeaveBalance"));
|
||||
employeeBasicInfoPo.setLeaveBalanceUrl(urlMap.get("leaveBalance"));
|
||||
employeeBasicInfoPo.setPaidSickLeaveBalanceUrl(urlMap.get("paidSickLeaveBalance"));
|
||||
employeeBasicInfoPo.setExpectedAttendanceUrl(urlMap.get("expectedAttendance"));
|
||||
employeeBasicInfoPo.setActualAttendanceUrl(urlMap.get("actualAttendance"));
|
||||
employeeBasicInfoPo.setLeaveUrl(urlMap.get("leave"));
|
||||
employeeBasicInfoPo.setTravelUrl(urlMap.get("travel"));
|
||||
employeeBasicInfoPo.setOvertimeUrl(urlMap.get("overtime"));
|
||||
employeeBasicInfoPo.setPublicLeaveUrl(urlMap.get("publicLeave"));
|
||||
employeeBasicInfoPo.setExceptionalAttendanceUrl(urlMap.get("exceptionalAttendance"));
|
||||
|
||||
|
||||
return WeaResult.success(employeeBasicInfoPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建考勤信息
|
||||
*
|
||||
* @param params
|
||||
* @param employeeBasicInfoPo
|
||||
*/
|
||||
private void buildAttendance(Map<String, Object> params, EmployeeBasicInfoPo employeeBasicInfoPo) {
|
||||
String url = Util.null2String(params.get("otherApiUrl"));
|
||||
Map<String, String> header = (Map<String, String>) params.get("header");
|
||||
|
||||
String beginDate = DateUtil.getFirstDayOfMonth();
|
||||
String endDate = DateUtil.getLastDayOfMonth();
|
||||
Long userId = employeeBasicInfoPo.getEmployeeId();
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("beginDate", beginDate);
|
||||
jsonObject.put("endDate", endDate);
|
||||
jsonObject.put("userId", String.valueOf(userId));
|
||||
|
||||
String resultStr = HttpRequest.post(url).headerMap(header, true)
|
||||
.body(jsonObject.toJSONString()).execute().body();
|
||||
|
||||
if (resultStr != null) {
|
||||
JSONObject response = JSON.parseObject(resultStr);
|
||||
if (response.getBoolean("status") && 200 == response.getIntValue("code")) {
|
||||
JSONObject data = response.getJSONObject("data");
|
||||
|
||||
// 考勤信息
|
||||
JSONObject attendStatis = data.getJSONObject("attendStatis");
|
||||
if (attendStatis != null) {
|
||||
JSONObject periodLength = attendStatis.getJSONObject("periodLength");
|
||||
employeeBasicInfoPo.setExpectedAttendance(null == periodLength ? "0" : periodLength.getString("value"));
|
||||
JSONObject actual = attendStatis.getJSONObject("actual");
|
||||
employeeBasicInfoPo.setActualAttendance(null == actual ? "0" : actual.getString("value"));
|
||||
JSONObject lostLength = attendStatis.getJSONObject("lostLength");
|
||||
employeeBasicInfoPo.setExceptionalAttendance(null == lostLength ? "0" : lostLength.getString("value"));
|
||||
}
|
||||
|
||||
JSONArray attendSummaryData = data.getJSONObject("attendSummary").getJSONArray("data");
|
||||
if (attendSummaryData != null) {
|
||||
for (int i = 0; i < attendSummaryData.size(); i++) {
|
||||
JSONObject item = attendSummaryData.getJSONObject(i);
|
||||
String key = item.getString("key");
|
||||
String value = item.getString("value");
|
||||
|
||||
switch (key) {
|
||||
case "LEAVE":
|
||||
employeeBasicInfoPo.setLeave(value);
|
||||
break;
|
||||
case "BUSINESS":
|
||||
employeeBasicInfoPo.setTravel(value);
|
||||
break;
|
||||
case "OUT_SIDE":
|
||||
employeeBasicInfoPo.setPublicLeave(value);
|
||||
break;
|
||||
case "OVERTIME":
|
||||
employeeBasicInfoPo.setOvertime(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 假期余额信息
|
||||
JSONArray vacationBalanceList = data.getJSONArray("vacationBalanceList");
|
||||
if (vacationBalanceList != null) {
|
||||
for (int i = 0; i < vacationBalanceList.size(); i++) {
|
||||
JSONObject vacationItem = vacationBalanceList.getJSONObject(i);
|
||||
String title = vacationItem.getString("title");
|
||||
JSONArray dataArray = vacationItem.getJSONArray("data");
|
||||
|
||||
if (dataArray != null && dataArray.size() > 0) {
|
||||
JSONObject totalItem = dataArray.getJSONObject(dataArray.size() - 1);
|
||||
String totalValue = totalItem.getString("value");
|
||||
|
||||
switch (title) {
|
||||
case "年假":
|
||||
employeeBasicInfoPo.setAnnualLeaveBalance(totalValue);
|
||||
break;
|
||||
case "调休假":
|
||||
employeeBasicInfoPo.setLeaveBalance(totalValue);
|
||||
break;
|
||||
case "带薪病假":
|
||||
employeeBasicInfoPo.setPaidSickLeaveBalance(totalValue);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package com.weaver.seconddev.portal.service.impl;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.param.HrbpParam;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
|
||||
import com.weaver.seconddev.portal.mapper.portal.HrbpPortalMapper;
|
||||
import com.weaver.seconddev.portal.mapper.portal.PortalMapper;
|
||||
import com.weaver.seconddev.portal.service.HrbpPortalService;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/10
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HrbpPortalServiceImpl implements HrbpPortalService {
|
||||
|
||||
private static final String PORTAL_KEY = "hrbpPortal";
|
||||
|
||||
@Autowired
|
||||
HrbpPortalMapper hrbpPortalMapper;
|
||||
|
||||
@Autowired
|
||||
PortalMapper portalMapper;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getToDo(Map<String, String> params) {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
HrbpParam hrbpParam = new HrbpParam();
|
||||
hrbpParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
|
||||
// 权限条件
|
||||
|
||||
|
||||
int toEntryCount = hrbpPortalMapper.getToEntryCount(hrbpParam);
|
||||
int toRegularCount = hrbpPortalMapper.getToRegularCount(hrbpParam);
|
||||
int toLeaveCount = hrbpPortalMapper.getToLeaveCount(hrbpParam);
|
||||
int toSignCount = hrbpPortalMapper.getToSignCount(hrbpParam);
|
||||
int toProxyCount = hrbpPortalMapper.getToProxyCount(hrbpParam);
|
||||
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(hrbpParam.getTenantKey(), PORTAL_KEY, "getToDo");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
|
||||
// 待入职
|
||||
map.put("entry", toEntryCount);
|
||||
map.put("entryUrl", urlMap.get("entry"));
|
||||
// 待转正
|
||||
map.put("regular", toRegularCount);
|
||||
map.put("regularUrl", urlMap.get("regular"));
|
||||
// 待离职
|
||||
map.put("leave", toLeaveCount);
|
||||
map.put("leaveUrl", urlMap.get("leave"));
|
||||
// 待签订
|
||||
map.put("sign", toSignCount);
|
||||
map.put("signUrl", urlMap.get("sign"));
|
||||
// 代理期转正
|
||||
map.put("proxy", toProxyCount);
|
||||
map.put("proxyUrl", urlMap.get("proxy"));
|
||||
return WeaResult.success(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getEmployeeData(Map<String, String> params) {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
HrbpParam hrbpParam = new HrbpParam();
|
||||
hrbpParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
|
||||
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(hrbpParam.getTenantKey(), PORTAL_KEY, "getEmployeeData");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
|
||||
|
||||
// 员工人数
|
||||
int allEmployeeCount = hrbpPortalMapper.getAllEmployeeCount(hrbpParam);
|
||||
map.put("allEmployee", allEmployeeCount);
|
||||
map.put("allEmployeeUrl", urlMap.get("allEmployee"));
|
||||
// 正式员工
|
||||
int formalEmployeeCount = hrbpPortalMapper.getFormalEmployeeCount(hrbpParam);
|
||||
map.put("formalEmployee", formalEmployeeCount);
|
||||
map.put("formalEmployeeUrl", urlMap.get("formalEmployee"));
|
||||
// 实习生
|
||||
map.put("internEmployee", hrbpPortalMapper.getInternEmployeeCount(hrbpParam));
|
||||
map.put("internEmployeeUrl", urlMap.get("internEmployee"));
|
||||
// 外包
|
||||
map.put("outsourcing", hrbpPortalMapper.getOutsourcingCount(hrbpParam));
|
||||
map.put("outsourcingUrl", urlMap.get("outsourcing"));
|
||||
// 劳务
|
||||
map.put("labor", hrbpPortalMapper.getLaborCount(hrbpParam));
|
||||
map.put("laborUrl", urlMap.get("labor"));
|
||||
// 试用
|
||||
map.put("probation", hrbpPortalMapper.getProbationCount(hrbpParam));
|
||||
map.put("probationUrl", urlMap.get("probation"));
|
||||
// 正式
|
||||
map.put("formal", hrbpPortalMapper.getFormalCount(hrbpParam));
|
||||
map.put("formalUrl", urlMap.get("formal"));
|
||||
// 实习
|
||||
map.put("intern", hrbpPortalMapper.getInternCount(hrbpParam));
|
||||
map.put("internUrl", urlMap.get("intern"));
|
||||
// 离职
|
||||
map.put("leave", hrbpPortalMapper.getLeaveCount(hrbpParam));
|
||||
map.put("leaveUrl", urlMap.get("leave"));
|
||||
return WeaResult.success(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getTodayOverview(Map<String, String> params) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
package com.weaver.seconddev.portal.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
|
||||
import com.weaver.seconddev.portal.entity.bo.EmployeeStaffBo;
|
||||
import com.weaver.seconddev.portal.entity.param.SearchConditionParam;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalData;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalPO;
|
||||
import com.weaver.seconddev.portal.entity.po.cfg.*;
|
||||
import com.weaver.seconddev.portal.mapper.portal.LeaderCockpitMapper;
|
||||
import com.weaver.seconddev.portal.service.LeaderCockpitService;
|
||||
import com.weaver.seconddev.portal.util.DateUtil;
|
||||
import com.weaver.teams.security.StringUtils;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import com.weaver.workflow.common.cfg.org.service.DepartMentService;
|
||||
import com.weaver.workflow.common.entity.org.WeaDepartMent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 领导驾驶舱门户
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LeaderCockpitServiceImpl implements LeaderCockpitService {
|
||||
@Autowired
|
||||
LeaderCockpitMapper leaderCockpitMapper;
|
||||
|
||||
@Autowired
|
||||
HrmCommonEmployeeDao hrmCommonEmployeeDao;
|
||||
|
||||
@Autowired
|
||||
DepartMentService departMentService;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getOnJobNumber(Map<String, String> params) {
|
||||
SearchConditionParam searchConditionParam = new SearchConditionParam();
|
||||
initSearchConditionParam(searchConditionParam, params, null);
|
||||
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
|
||||
List<PortalPO> onJobNumber = leaderCockpitMapper.getOnJobNumber(searchConditionParam);
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
returnMap.put("data", onJobNumber);
|
||||
returnMap.put("total", onJobNumber.stream().mapToInt(item -> Convert.toInt(item.getValue(), 0)).sum());
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object> > getLaborCost(Map<String, String> params) {
|
||||
SearchConditionParam searchConditionParam = new SearchConditionParam();
|
||||
initSearchConditionParam(searchConditionParam, params, null);
|
||||
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
|
||||
|
||||
Map<String, Object> laborCost = leaderCockpitMapper.getLaborCost(searchConditionParam);
|
||||
return WeaResult.success(laborCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getTurnoverRate(Map<String, String> params) {
|
||||
SearchConditionParam searchConditionParam = new SearchConditionParam();
|
||||
initSearchConditionParam(searchConditionParam, params, null);
|
||||
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
|
||||
// 查询范围内在职人员
|
||||
int onJobCount = leaderCockpitMapper.getOnJobCount(searchConditionParam);
|
||||
// 查询范围内离职人员
|
||||
int resignCount = leaderCockpitMapper.getResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
|
||||
// 查询关键离职率
|
||||
int keyResignCount = leaderCockpitMapper.getKeyResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
|
||||
// 计算离职率
|
||||
double turnoverRate = calculateRate(keyResignCount, onJobCount);
|
||||
//TODO 计算关键离职率
|
||||
double keyTurnoverRate = calculateRate(keyResignCount, resignCount);
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>(2);
|
||||
returnMap.put("turnoverRate", formatPercentage(turnoverRate));
|
||||
returnMap.put("keyTurnoverRate", formatPercentage(keyTurnoverRate));
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<List<PortalPO>> getAttendanceRate(Map<String, String> params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<List<PortalPO>> getFullStaffingRate(Map<String, String> header, Map<String, String> params) {
|
||||
String origin = header.get("origin");
|
||||
// 人员编制
|
||||
String employeeStaffUrl = origin + "/api/bs/hr/est/cfg/table";
|
||||
// 人员编制具体信息
|
||||
String getEmployeeDetailUrl = origin + "/api/bs/hr/est/cfg/emp/table";
|
||||
|
||||
String beginDate = DateUtil.getFirstDayOfMonth();
|
||||
String endDate = DateUtil.getLastDayOfMonth();
|
||||
SearchConditionParam searchConditionParam = new SearchConditionParam();
|
||||
initSearchConditionParam(searchConditionParam, params, null);
|
||||
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
|
||||
//postEmployeeStaff(employeeStaffUrl, header, searchConditionParam.getDepartmentIdList(), month);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void postEmployeeStaff(String employeeStaffUrl,Map<String, String> header, Set<Long> departmentIdList, String month) {
|
||||
|
||||
FormDatas formDatas = new FormDatas();
|
||||
FormDatasDetail formDatasDetail = new FormDatasDetail();
|
||||
formDatas.setFormDatas(formDatasDetail);
|
||||
List<OrgItem> orgItemList = new ArrayList<>();
|
||||
for (Long aLong : departmentIdList) {
|
||||
OrgItem orgItem = new OrgItem();
|
||||
orgItem.setId(aLong + "");
|
||||
orgItemList.add(orgItem);
|
||||
}
|
||||
OrgWrapper orgWrapper = new OrgWrapper();
|
||||
orgWrapper.setOrg(orgItemList);
|
||||
formDatasDetail.setOrg(Collections.singletonList(orgWrapper));
|
||||
MonthWrapper monthWrapper = new MonthWrapper();
|
||||
monthWrapper.setMonth(month);
|
||||
formDatasDetail.setMonth(Collections.singletonList(monthWrapper));
|
||||
OverCtrlWrapper overCtrlWrapper = new OverCtrlWrapper();
|
||||
overCtrlWrapper.setOverCtrl("all");
|
||||
formDatasDetail.setOverCtrl(Collections.singletonList(overCtrlWrapper));
|
||||
|
||||
|
||||
String resultStr = HttpRequest.post(employeeStaffUrl).headerMap(header, true)
|
||||
.body(JSON.toJSONString(formDatas)).execute().body();
|
||||
List<EmployeeStaff> employeeStaffs = EmployeeStaffBo.mapEmployeeStaffData(resultStr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getEmploymentStatus(Map<String, String> params) {
|
||||
SearchConditionParam searchConditionParam = new SearchConditionParam();
|
||||
initSearchConditionParam(searchConditionParam, params, 0);
|
||||
|
||||
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
|
||||
String searchDate = params.get("searchDate");
|
||||
if (StringUtils.isBlank(searchDate)) {
|
||||
searchDate = DateUtil.getCurrentDateStr();
|
||||
}
|
||||
LocalDate localDate = DateUtil.parseDate(searchDate);
|
||||
|
||||
String month = DateUtil.formatToYearMonth_ZH(localDate);
|
||||
Map<String, Integer> allDataMap = new LinkedHashMap<>(3);
|
||||
Map<String, Integer> keyDataMap = new LinkedHashMap<>(3);
|
||||
allDataMap.put(month, leaderCockpitMapper.getEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
|
||||
keyDataMap.put(month, leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
|
||||
|
||||
String firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate());
|
||||
String lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate());
|
||||
// 前面5个月
|
||||
for (int i = 1; i < 7; i++) {
|
||||
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
|
||||
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
|
||||
firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate(), i);
|
||||
lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate(), i);
|
||||
}
|
||||
|
||||
// 查询台账
|
||||
String currentMonth = DateUtil.formatToYearMonth(searchConditionParam.getStartDate());
|
||||
|
||||
Set<Long> selectDepartmentId = searchConditionParam.getSelectDepartmentId();
|
||||
log.error("selectDepartmentId===" + JSON.toJSONString(selectDepartmentId));
|
||||
if (CollectionUtils.isEmpty(selectDepartmentId)) {
|
||||
// 未选择部门,查询所有一级部门数据
|
||||
selectDepartmentId = leaderCockpitMapper.getTopDepartmentIds(searchConditionParam);
|
||||
log.error("topDepartmentId===" + JSON.toJSONString(selectDepartmentId));
|
||||
}
|
||||
|
||||
// 查询每个部门 时间范围内的入职人数
|
||||
List<PortalData> portalList = new ArrayList<>();
|
||||
for (Long topDepartmentId : selectDepartmentId) {
|
||||
List<Long> beLongDeps = departMentService.getBeLongDeps(topDepartmentId, searchConditionParam.getTenantKey(), false);
|
||||
beLongDeps.add(topDepartmentId);
|
||||
WeaDepartMent departMentById = departMentService.getDepartMentById(topDepartmentId);
|
||||
PortalData portalData = new PortalData();
|
||||
portalData.setDate(currentMonth);
|
||||
portalData.setDepart(departMentById.getDepartMentName());
|
||||
// 关键
|
||||
int keyEmploymentCount = leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
|
||||
// 非关键
|
||||
int employmentCount = leaderCockpitMapper.getEmploymentCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
|
||||
portalData.setKey(keyEmploymentCount);
|
||||
portalData.setAll(employmentCount);
|
||||
portalList.add(portalData);
|
||||
}
|
||||
|
||||
// portalList按照all排序
|
||||
portalList.sort((o1, o2) -> o2.getAll().compareTo(o1.getAll()));
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>(3);
|
||||
returnMap.put("dataSource", portalList);
|
||||
returnMap.put("all", allDataMap);
|
||||
returnMap.put("key", keyDataMap);
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getResignationSituation(Map<String, String> params) {
|
||||
SearchConditionParam searchConditionParam = new SearchConditionParam();
|
||||
initSearchConditionParam(searchConditionParam, params, 0);
|
||||
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
|
||||
|
||||
String searchDate = params.get("searchDate");
|
||||
if (StringUtils.isBlank(searchDate)) {
|
||||
searchDate = DateUtil.getCurrentDateStr();
|
||||
}
|
||||
LocalDate localDate = DateUtil.parseDate(searchDate);
|
||||
|
||||
String month = DateUtil.formatToYearMonth_ZH(localDate);
|
||||
Map<String, Integer> allDataMap = new LinkedHashMap<>(3);
|
||||
Map<String, Integer> keyDataMap = new LinkedHashMap<>(3);
|
||||
allDataMap.put(month, leaderCockpitMapper.getResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
|
||||
keyDataMap.put(month, leaderCockpitMapper.getKeyResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
|
||||
|
||||
String firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate());
|
||||
String lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate());
|
||||
// 前五个月
|
||||
for (int i = 1; i < 7; i++) {
|
||||
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
|
||||
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
|
||||
|
||||
firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate(), i);
|
||||
lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate(), i);
|
||||
}
|
||||
|
||||
|
||||
String currentMonth = DateUtil.formatToYearMonth(searchConditionParam.getStartDate());
|
||||
Set<Long> selectDepartmentId = searchConditionParam.getSelectDepartmentId();
|
||||
log.error("selectDepartmentId===" + JSON.toJSONString(selectDepartmentId));
|
||||
if (CollectionUtils.isEmpty(selectDepartmentId)) {
|
||||
// 未选择部门,查询所有一级部门数据
|
||||
selectDepartmentId = leaderCockpitMapper.getTopDepartmentIds(searchConditionParam);
|
||||
log.error("topDepartmentId===" + JSON.toJSONString(selectDepartmentId));
|
||||
}
|
||||
// 查询每个部门 时间范围内的离职人数
|
||||
List<PortalData> portalList = new ArrayList<>();
|
||||
for (Long topDepartmentId : selectDepartmentId) {
|
||||
List<Long> beLongDeps = departMentService.getBeLongDeps(topDepartmentId, searchConditionParam.getTenantKey(), false);
|
||||
beLongDeps.add(topDepartmentId);
|
||||
WeaDepartMent departMentById = departMentService.getDepartMentById(topDepartmentId);
|
||||
PortalData portalData = new PortalData();
|
||||
portalData.setDate(currentMonth);
|
||||
portalData.setDepart(departMentById.getDepartMentName());
|
||||
// 关键
|
||||
int keyEmploymentCount = leaderCockpitMapper.getKeyResignCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
|
||||
// 非关键
|
||||
int employmentCount = leaderCockpitMapper.getResignCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
|
||||
portalData.setKey(keyEmploymentCount);
|
||||
portalData.setAll(employmentCount);
|
||||
portalList.add(portalData);
|
||||
}
|
||||
|
||||
// portalList按照all排序
|
||||
portalList.sort((o1, o2) -> o2.getAll().compareTo(o1.getAll()));
|
||||
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>(3);
|
||||
returnMap.put("dataSource", portalList);
|
||||
returnMap.put("all", allDataMap);
|
||||
returnMap.put("key", keyDataMap);
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建查询对象
|
||||
*
|
||||
* @param searchConditionParam
|
||||
* @param params
|
||||
* @param beforeMonth
|
||||
*/
|
||||
private void initSearchConditionParam(SearchConditionParam searchConditionParam, Map<String, String> params, Integer beforeMonth) {
|
||||
String searchDate = params.get("searchDate");
|
||||
String departmentId = params.get("departmentId");
|
||||
|
||||
// 租户
|
||||
searchConditionParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
|
||||
// 部门
|
||||
//searchConditionParam.setDepartmentId(departmentId);
|
||||
|
||||
// 获取部门下的所有子部门
|
||||
if (StringUtils.isNotBlank(departmentId)) {
|
||||
Set<Long> deptIdSet = new HashSet<>();
|
||||
Set<Long> selectDepartmentId = new HashSet<>();
|
||||
String[] split = departmentId.split(",");
|
||||
for (String s : split) {
|
||||
if (StringUtils.isBlank(s)) {
|
||||
continue;
|
||||
}
|
||||
long parseLong = Long.parseLong(s);
|
||||
log.error("parseLong===" + parseLong);
|
||||
selectDepartmentId.add(parseLong);
|
||||
List<Long> beLongDeps = departMentService.getBeLongDeps(parseLong, searchConditionParam.getTenantKey(), false);
|
||||
beLongDeps.add(parseLong);
|
||||
log.error("beLongDeps===" + JSON.toJSONString(beLongDeps));
|
||||
deptIdSet.addAll(beLongDeps);
|
||||
}
|
||||
searchConditionParam.setDepartmentIdList(deptIdSet);
|
||||
searchConditionParam.setSelectDepartmentId(selectDepartmentId);
|
||||
}
|
||||
|
||||
// 处理截止日期
|
||||
String endDateStr;
|
||||
if (StringUtils.isBlank(searchDate)) {
|
||||
endDateStr = DateUtil.getCurrentDateStr();
|
||||
} else {
|
||||
try {
|
||||
// 验证日期格式是否合法
|
||||
endDateStr = searchDate;
|
||||
} catch (Exception e) {
|
||||
log.error("日期格式错误,使用当前日期: {}", searchDate, e);
|
||||
endDateStr = DateUtil.getCurrentDateStr();
|
||||
}
|
||||
}
|
||||
searchConditionParam.setEndDate(endDateStr);
|
||||
|
||||
// 处理开始日期
|
||||
if (beforeMonth == null) {
|
||||
// 查询当前年度数据
|
||||
searchConditionParam.setStartDate(DateUtil.getFirstDayOfYearStr(searchConditionParam.getEndDate()));
|
||||
} else {
|
||||
// 查询前N个月数据
|
||||
try {
|
||||
LocalDate endDate = LocalDate.parse(endDateStr);
|
||||
LocalDate startDate = endDate.minusMonths(beforeMonth);
|
||||
searchConditionParam.setStartDate(DateUtil.getFirstDayOfMonthStr(DateUtil.formatDate(startDate)));
|
||||
} catch (Exception e) {
|
||||
log.error("计算开始日期失败,使用所选日期年度第一天", e);
|
||||
searchConditionParam.setStartDate(searchConditionParam.getEndDate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算百分比
|
||||
*
|
||||
* @param numerator
|
||||
* @param denominator
|
||||
* @return
|
||||
*/
|
||||
private double calculateRate(int numerator, int denominator) {
|
||||
if (denominator == 0) {
|
||||
log.warn("计算比率时分母为0,返回0");
|
||||
return 0.0;
|
||||
}
|
||||
return (double) numerator / denominator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化百分比
|
||||
*
|
||||
* @param rate
|
||||
* @return
|
||||
*/
|
||||
private String formatPercentage(double rate) {
|
||||
return String.format("%.2f%%", rate * 100);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,660 @@
|
|||
package com.weaver.seconddev.portal.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.form.datasource.FormdataTemplateDetails;
|
||||
import com.weaver.common.form.metadata.field.FormField;
|
||||
import com.weaver.common.hrm.cache.HrmDepartmentComInfo;
|
||||
import com.weaver.common.hrm.dao.HrmCommonDepartmentDao;
|
||||
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
|
||||
import com.weaver.common.hrm.manage.HrmComInfoCacheHandler;
|
||||
import com.weaver.seconddev.portal.entity.component.Option;
|
||||
import com.weaver.seconddev.portal.entity.param.BasicPersonnelParam;
|
||||
import com.weaver.seconddev.portal.entity.po.*;
|
||||
import com.weaver.seconddev.portal.mapper.dictionary.DataConvertMapper;
|
||||
import com.weaver.seconddev.portal.mapper.portal.EbuilderBaseMapper;
|
||||
import com.weaver.seconddev.portal.mapper.portal.LeaderCockpitMapper;
|
||||
import com.weaver.seconddev.portal.mapper.portal.ManagerPortalMapper;
|
||||
import com.weaver.seconddev.portal.mapper.portal.PortalMapper;
|
||||
import com.weaver.seconddev.portal.service.ManagerPortalService;
|
||||
import com.weaver.seconddev.portal.util.DateUtil;
|
||||
import com.weaver.seconddev.portal.util.StringUtil;
|
||||
import com.weaver.teams.domain.department.SimpleDepartment;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import com.weaver.teams.security.user.User;
|
||||
import com.weaver.workflow.common.cfg.org.service.DepartMentService;
|
||||
import com.weaver.workflow.common.entity.org.WeaDepartMent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 经理门户
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/08
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ManagerPortalServiceImpl implements ManagerPortalService {
|
||||
private static final String PORTAL_KEY = "managerPortal";
|
||||
|
||||
@Autowired
|
||||
LeaderCockpitMapper leaderCockpitMapper;
|
||||
|
||||
@Autowired
|
||||
PortalMapper portalMapper;
|
||||
|
||||
@Autowired
|
||||
ManagerPortalMapper managerPortalMapper;
|
||||
@Autowired
|
||||
DepartMentService departMentService;
|
||||
@Autowired
|
||||
HrmCommonDepartmentDao hrmCommonDepartmentDao;
|
||||
@Autowired
|
||||
HrmComInfoCacheHandler hrmComInfoCacheHandler;
|
||||
@Autowired
|
||||
EbuilderBaseMapper ebuilderBaseMapper;
|
||||
@Autowired
|
||||
HrmCommonEmployeeDao hrmCommonEmployeeDao;
|
||||
@Autowired
|
||||
DataConvertMapper dataConvertMapper;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getMangerInfo(Map<String, String> params) {
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
Set<Long> allDepartmentIds = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
List<HrmDepartmentComInfo> departmentList = hrmComInfoCacheHandler.getCacheList(HrmDepartmentComInfo.class, allDepartmentIds);
|
||||
// 获取顶级部门
|
||||
List<HrmDepartmentComInfo> topDepartmentList = departmentList.stream()
|
||||
.filter(dept -> !allDepartmentIds.contains(dept.getParent()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<String> departmentNames = topDepartmentList.stream().map(HrmDepartmentComInfo::getName).collect(Collectors.toList());
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
returnMap.put("deptNames", StringUtils.join(departmentNames, "、"));
|
||||
returnMap.put("userName", currentUser.getUsername());
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getTodayOverview(Map<String, String> params) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getBasicPersonnel(Map<String, String> params) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
String searchType = params.get("searchType");
|
||||
String searchDate = params.get("searchDate");
|
||||
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
|
||||
// 设置部门范围ID集合
|
||||
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
|
||||
|
||||
if ("year".equals(searchType)) {
|
||||
// 开始时间年度第一天
|
||||
basicPersonnelParam.setStartDate(StringUtils.isBlank(searchDate) ? DateUtil.getFirstDayOfYearStr() : searchDate + "-01-01");
|
||||
// 结束时间年度最后一天
|
||||
basicPersonnelParam.setEndDate(StringUtils.isBlank(searchDate) ? DateUtil.getCurrentDateStr() : searchDate + "-12-31");
|
||||
|
||||
} else if ("month".equals(searchType)) {
|
||||
// 开始时间月度第一天
|
||||
basicPersonnelParam.setStartDate(StringUtils.isBlank(searchDate) ? DateUtil.getFirstDayOfMonth() : searchDate + "-01");
|
||||
// 结束时间月度最后一天
|
||||
basicPersonnelParam.setEndDate(StringUtils.isBlank(searchDate) ? DateUtil.getCurrentDateStr() : DateUtil.getLastDayOfPreviousMonthStr(searchDate + "-01", 0));
|
||||
}
|
||||
|
||||
int onJobNum = managerPortalMapper.getOnJobNum(basicPersonnelParam);
|
||||
int resignNumber = managerPortalMapper.getResignNumber(basicPersonnelParam);
|
||||
int resigningNumber = managerPortalMapper.getResigningNumber(basicPersonnelParam);
|
||||
int entryNumber = managerPortalMapper.getEntryNumber(basicPersonnelParam);
|
||||
int entryingNumber = managerPortalMapper.getEntryingNumber(basicPersonnelParam);
|
||||
|
||||
// 获取穿透地址
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "getBasicPersonnel");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
|
||||
// 在职人数
|
||||
returnMap.put("onJobNumber", onJobNum);
|
||||
returnMap.put("onJobNumberUrl", urlMap.get("onJobNumber") + "?dataKey=onJobNumber&startDate=" + basicPersonnelParam.getStartDate() + "&endDate=" + basicPersonnelParam.getEndDate());
|
||||
// 年度离职人数
|
||||
returnMap.put("resignNumber", resignNumber);
|
||||
returnMap.put("resignNumberUrl", urlMap.get("resignNumber") + "?dataKey=resignNumber&startDate=" + basicPersonnelParam.getStartDate() + "&endDate=" + basicPersonnelParam.getEndDate());
|
||||
|
||||
// 年度入职人数
|
||||
returnMap.put("entryNumber", entryNumber);
|
||||
returnMap.put("entryNumberUrl", urlMap.get("entryNumber") + "?dataKey=entryNumber&startDate=" + basicPersonnelParam.getStartDate() + "&endDate=" + basicPersonnelParam.getEndDate());
|
||||
// 离职流程中人数
|
||||
returnMap.put("resigningNumber", resigningNumber);
|
||||
returnMap.put("resigningNumberUrl", urlMap.get("resigningNumber") + "?dataKey=resigningNumber&startDate=" + basicPersonnelParam.getStartDate() + "&endDate=" + basicPersonnelParam.getEndDate());
|
||||
// 入职流程中人数
|
||||
returnMap.put("entryingNumber", entryingNumber);
|
||||
returnMap.put("entryingNumberUrl", urlMap.get("entryingNumber") + "?dataKey=entryingNumber&startDate=" + basicPersonnelParam.getStartDate() + "&endDate=" + basicPersonnelParam.getEndDate());
|
||||
|
||||
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<String> getBasicPersonnelSql(Map<String, String> params) {
|
||||
String dataKey = params.get("dataKey");
|
||||
String startDate = params.get("startDate");
|
||||
String endDate = params.get("endDate");
|
||||
log.error("params==={}", JSON.toJSONString(params));
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
StringJoiner andCondition = new StringJoiner(" and ");
|
||||
switch (dataKey) {
|
||||
case "onJobNumber":
|
||||
// 在职人数
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.department in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" t1.hiredate <= #{endDate} AND (t1.zhgzr >= #{startDate} OR t1.zhgzr IS NULL OR t1.zhgzr = '') ");
|
||||
break;
|
||||
case "resignNumber":
|
||||
// 年度离职人数
|
||||
andCondition.add(" t1.lzzt = 1 ");
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.lzqbm in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" t1.zhgzr >= #{startDate} and t1.zhgzr <= #{endDate} ");
|
||||
break;
|
||||
case "entryNumber":
|
||||
// 年度入职人数
|
||||
andCondition.add(" t1.rzzt = 1 ");
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.department in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" t1.hiredate >= #{startDate} and t1.hiredate <= #{endDate} ");
|
||||
break;
|
||||
case "resigningNumber":
|
||||
// 离职流程中人数
|
||||
andCondition.add(" t1.flow_status in (0,1,2) ");
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.lzqbm in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" t1.sqrq >= #{startDate} and t1.sqrq <= #{endDate} ");
|
||||
break;
|
||||
case "entryingNumber":
|
||||
// 入职流程中人数
|
||||
andCondition.add(" t1.flow_status in (0,1,2) ");
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.ssbm in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" t1.sqsj >= #{startDate} and t1.sqsj <= #{endDate} ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
String replaceSql = andCondition.toString().replace("#{startDate}", "'" + startDate + "'").replace("#{endDate}", "'" + endDate + "'");
|
||||
log.error("replaceSql==={}", replaceSql);
|
||||
return WeaResult.success(replaceSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生日提醒:提前一周
|
||||
* 转正提醒:提前30天
|
||||
* 入职周年:提前一周
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getTeamMemorialDay(Map<String, String> params) {
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
|
||||
// 设置部门范围ID集合
|
||||
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
|
||||
int birthdayNum = managerPortalMapper.getBirthdayNum(basicPersonnelParam);
|
||||
|
||||
int regularEmployeeNum = managerPortalMapper.getRegularEmployeeNum(basicPersonnelParam);
|
||||
|
||||
int employmentAnniversary = managerPortalMapper.getEmploymentAnniversary(basicPersonnelParam);
|
||||
|
||||
// 获取穿透地址
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "getTeamMemorialDay");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
// 生日提醒
|
||||
returnMap.put("birthdayNum", birthdayNum);
|
||||
returnMap.put("birthdayNumUrl", urlMap.get("birthdayNum") + "?dataKey=birthdayNum");
|
||||
// 转正日期
|
||||
returnMap.put("regularEmployeeNum", regularEmployeeNum);
|
||||
returnMap.put("regularEmployeeNumUrl", urlMap.get("regularEmployeeNum") + "?dataKey=regularEmployeeNum");
|
||||
// 入职周年提醒
|
||||
returnMap.put("employmentAnniversary", employmentAnniversary);
|
||||
returnMap.put("employmentAnniversaryUrl", urlMap.get("employmentAnniversary") + "?dataKey=employmentAnniversary");
|
||||
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<String> getTeamMemorialDaySql(Map<String, String> params) {
|
||||
String dataKey = params.get("dataKey");
|
||||
log.error("params==={}", JSON.toJSONString(params));
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
StringJoiner andCondition = new StringJoiner(" and ");
|
||||
switch (dataKey) {
|
||||
case "birthdayNum":
|
||||
// 生日提醒
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.department in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" ( ( DATE_FORMAT(t1.birthday, '%m-%d') BETWEEN DATE_FORMAT(CURDATE(), '%m-%d') AND DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d') ) OR ( DATE_FORMAT(CURDATE(), '%m-%d') > DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d') AND ( DATE_FORMAT(birthday, '%m-%d') >= DATE_FORMAT(CURDATE(), '%m-%d') OR DATE_FORMAT(t1.birthday, '%m-%d') <= DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d') ) ) ) ");
|
||||
|
||||
break;
|
||||
case "regularEmployeeNum":
|
||||
// 转正日期
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.department in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" t1.yjsyjsrq IS NOT NULL AND ( STR_TO_DATE(CONCAT(YEAR(CURDATE()), '-', DATE_FORMAT(t1.yjsyjsrq, '%m-%d')), '%Y-%m-%d') BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 60 DAY) OR STR_TO_DATE(CONCAT(YEAR(CURDATE()) + 1, '-', DATE_FORMAT(t1.yjsyjsrq, '%m-%d')), '%Y-%m-%d') BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 60 DAY) ) ");
|
||||
|
||||
break;
|
||||
case "employmentAnniversary":
|
||||
// 入职周年提醒
|
||||
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
|
||||
andCondition.add(" t1.department in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
|
||||
}
|
||||
andCondition.add(" ( ( DATE_FORMAT(t1.hiredate, '%m-%d') between DATE_FORMAT(CURDATE(), '%m-%d') and DATE_FORMAT(DATE_ADD(CURDATE(), interval 7 day), '%m-%d') ) or ( DATE_FORMAT(CURDATE(), '%m-%d') > DATE_FORMAT(DATE_ADD(CURDATE(), interval 7 day), '%m-%d') and ( DATE_FORMAT(t1.hiredate, '%m-%d') >= DATE_FORMAT(CURDATE(), '%m-%d') or DATE_FORMAT(t1.hiredate, '%m-%d') <= DATE_FORMAT(DATE_ADD(CURDATE(), interval 7 day), '%m-%d') ) ) ) ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
String replaceSql = StringUtil.buildSqlCondition(andCondition.toString());
|
||||
log.error("replaceSql==={}", replaceSql);
|
||||
return WeaResult.success(replaceSql);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getEducationInfo(Map<String, String> params) {
|
||||
|
||||
String type = params.get("type");
|
||||
String searchKey = params.get("searchKey");
|
||||
if (StringUtils.isBlank(type)) {
|
||||
// 默认学历信息
|
||||
type = "education";
|
||||
}
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
// 设置部门范围ID集合
|
||||
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
|
||||
basicPersonnelParam.setPieType(type);
|
||||
basicPersonnelParam.setSearchKey(searchKey);
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "getEducationInfo");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
List<PortalPO> returnList = new ArrayList<>();
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
switch (type) {
|
||||
case "education":
|
||||
// 学历
|
||||
dealEducationInfo(basicPersonnelParam, returnList);
|
||||
returnMap.put("url", urlMap.get("education"));
|
||||
|
||||
break;
|
||||
case "age":
|
||||
// 年龄
|
||||
dealAgeInfo(basicPersonnelParam, returnList);
|
||||
returnMap.put("url", urlMap.get("age"));
|
||||
break;
|
||||
case "grade":
|
||||
// 职级
|
||||
returnMap.put("url", urlMap.get("grade"));
|
||||
break;
|
||||
case "company":
|
||||
// 司龄
|
||||
dealCompanyInfo(basicPersonnelParam, returnList);
|
||||
returnMap.put("url", urlMap.get("company"));
|
||||
break;
|
||||
case "performance":
|
||||
// 绩效
|
||||
dealPerformanceInfo(basicPersonnelParam, returnList);
|
||||
returnMap.put("url", urlMap.get("performance"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
returnMap.put("list", returnList);
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getAttendanceInfo(Map<String, String> params) {
|
||||
String type = params.get("type");
|
||||
if (StringUtils.isBlank(type)) {
|
||||
// 默认学历信息
|
||||
type = "abnormalAttendance";
|
||||
}
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
basicPersonnelParam.setStartDate(DateUtil.getFirstDayOfMonth());
|
||||
basicPersonnelParam.setEndDate(DateUtil.getLastDayOfMonth());
|
||||
|
||||
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
// 设置部门范围ID集合
|
||||
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
|
||||
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "getAttendanceInfo");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
|
||||
switch (type) {
|
||||
case "abnormalAttendance":
|
||||
// 异常考勤
|
||||
Map<String, Object> map = dealAbnormalAttendanceInfo(basicPersonnelParam);
|
||||
map.put("url", urlMap.get("abnormalAttendance"));
|
||||
return WeaResult.success(map);
|
||||
case "lateOrLeaveEarly":
|
||||
// 迟到/早退
|
||||
Map<String, Object> map1 = dealLateOrLeaveEarlyInfo(basicPersonnelParam);
|
||||
map1.put("url", urlMap.get("lateOrLeaveEarly"));
|
||||
return WeaResult.success(map1);
|
||||
case "overtimeDuration":
|
||||
// 加班时长
|
||||
Map<String, Object> map2 = dealOvertimeDurationInfo(basicPersonnelParam);
|
||||
map2.put("url", urlMap.get("overtimeDuration"));
|
||||
return WeaResult.success(map2);
|
||||
case "leaveType":
|
||||
// 请假类型
|
||||
Map<String, Object> map3 = dealLeaveTypeInfo(basicPersonnelParam);
|
||||
map3.put("url", urlMap.get("leaveType"));
|
||||
return WeaResult.success(map3);
|
||||
default:
|
||||
return WeaResult.fail("不支持的统计类型",true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getTeamEmployee(Map<String, String> params) {
|
||||
String searchKey = params.get("searchKey");
|
||||
String departmentId = params.get("departmentId");
|
||||
int pageSize = Convert.toInt(params.get("pageSize"), 10);
|
||||
int current = Convert.toInt(params.get("current"), 1);
|
||||
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
basicPersonnelParam.setCurrent(current);
|
||||
basicPersonnelParam.setPageSize(pageSize);
|
||||
basicPersonnelParam.setSearchKey(searchKey);
|
||||
//log.error("departmentId==={}", departmentId);
|
||||
basicPersonnelParam.setDepartmentId(departmentId);
|
||||
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
|
||||
//log.error("allDepartmentIdList111==={}", JSON.toJSONString(allDepartmentIdList));
|
||||
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
|
||||
if (StringUtils.isNotBlank(departmentId)) {
|
||||
List<WeaDepartMent> beLongDeps = departMentService.getBeLongDeps(Long.parseLong(departmentId));
|
||||
Set<Long> collect = beLongDeps.stream().map(WeaDepartMent::getDepartMentId).collect(Collectors.toSet());
|
||||
collect.add(Long.parseLong(departmentId));
|
||||
// 两个set取交集
|
||||
allDepartmentIdList.retainAll(collect);
|
||||
//log.error("collect==={}", JSON.toJSONString(collect));
|
||||
|
||||
if (CollectionUtils.isEmpty(allDepartmentIdList)) {
|
||||
allDepartmentIdList.add(-1L);
|
||||
}
|
||||
}
|
||||
//log.error("allDepartmentIdList222==={}", JSON.toJSONString(allDepartmentIdList));
|
||||
|
||||
|
||||
List<TeamEmployeePo> teamEmployee = managerPortalMapper.getTeamEmployee(basicPersonnelParam);
|
||||
int total = managerPortalMapper.getTeamEmployeeTotal(basicPersonnelParam);
|
||||
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
returnMap.put("list", teamEmployee);
|
||||
returnMap.put("total", total);
|
||||
returnMap.put("current", current);
|
||||
returnMap.put("pageSize", pageSize);
|
||||
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaResult<List<Option>> getEbFieldOptions(Map<String, String> params) {
|
||||
String tableName = params.get("tableName");
|
||||
String fieldName = params.get("fieldName");
|
||||
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
|
||||
// 查询考核周期选项
|
||||
long formId = ebuilderBaseMapper.getFormIdByTableName(basicPersonnelParam, StringUtils.isBlank(tableName) ? "uf_jxsjtz" : tableName);
|
||||
FormField formField = ebuilderBaseMapper.getFormFieldByFieldName(basicPersonnelParam, formId, StringUtils.isBlank(fieldName) ? "khzq" : fieldName);
|
||||
List<FormdataTemplateDetails> templateDetails = ebuilderBaseMapper.getFormdataTemplateDetails(basicPersonnelParam, formField.getDataTemplateId());
|
||||
|
||||
List<Option> optionList = new ArrayList<>();
|
||||
for (FormdataTemplateDetails templateDetail : templateDetails) {
|
||||
// 构建选项
|
||||
optionList.add(Option.builder().id(templateDetail.getValueKey()).content(templateDetail.getName()).build());
|
||||
}
|
||||
|
||||
return WeaResult.success(optionList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学历分布数据
|
||||
*
|
||||
* @param basicPersonnelParam
|
||||
* @param returnList
|
||||
*/
|
||||
private void dealEducationInfo(BasicPersonnelParam basicPersonnelParam, List<PortalPO> returnList) {
|
||||
// 学历分布
|
||||
List<PortalPO> educationInfo = managerPortalMapper.getEducationInfo(basicPersonnelParam);
|
||||
Map<String, String> educationMap = educationInfo.stream().collect(Collectors.toMap(PortalPO::getId, PortalPO::getValue));
|
||||
|
||||
managerPortalMapper.getPieTypeConfig(basicPersonnelParam).forEach(pieChartConfig -> {
|
||||
String name = pieChartConfig.getName();
|
||||
String educationIds = pieChartConfig.getEducationIds();
|
||||
String[] split = educationIds.split(",");
|
||||
int count = 0;
|
||||
for (String s : split) {
|
||||
String s1 = educationMap.get(s);
|
||||
count += Convert.toInt(s1, 0);
|
||||
}
|
||||
PortalPO portalPO = new PortalPO();
|
||||
portalPO.setValue(String.valueOf(count));
|
||||
portalPO.setName(name);
|
||||
returnList.add(portalPO);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 学历分布数据
|
||||
*
|
||||
* @param basicPersonnelParam
|
||||
* @param returnList
|
||||
*/
|
||||
private void dealAgeInfo(BasicPersonnelParam basicPersonnelParam, List<PortalPO> returnList) {
|
||||
List<PieChartConfig> pieTypeConfig = managerPortalMapper.getPieTypeConfig(basicPersonnelParam);
|
||||
for (PieChartConfig pieChartConfig : pieTypeConfig) {
|
||||
|
||||
PortalPO portalPO = new PortalPO();
|
||||
portalPO.setName(pieChartConfig.getName());
|
||||
// 查询时间段内的数据
|
||||
Integer ageCount = managerPortalMapper.getAgeCount(basicPersonnelParam, basicPersonnelParam.getDepartmentIdList(), pieChartConfig.getStartIndex(), pieChartConfig.getEndIndex());
|
||||
portalPO.setValue(String.valueOf(ageCount));
|
||||
returnList.add(portalPO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 司龄分布数据
|
||||
*
|
||||
* @param basicPersonnelParam
|
||||
* @param returnList
|
||||
*/
|
||||
private void dealCompanyInfo(BasicPersonnelParam basicPersonnelParam, List<PortalPO> returnList) {
|
||||
List<PieChartConfig> pieTypeConfig = managerPortalMapper.getPieTypeConfig(basicPersonnelParam);
|
||||
for (PieChartConfig pieChartConfig : pieTypeConfig) {
|
||||
|
||||
PortalPO portalPO = new PortalPO();
|
||||
portalPO.setName(pieChartConfig.getName());
|
||||
// 查询时间段内的数据
|
||||
Integer ageCount = managerPortalMapper.getComapnyCount(basicPersonnelParam, basicPersonnelParam.getDepartmentIdList(), pieChartConfig.getStartIndex(), pieChartConfig.getEndIndex());
|
||||
portalPO.setValue(String.valueOf(ageCount));
|
||||
returnList.add(portalPO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param basicPersonnelParam
|
||||
* @param returnList
|
||||
*/
|
||||
private void dealPerformanceInfo(BasicPersonnelParam basicPersonnelParam, List<PortalPO> returnList) {
|
||||
// 指定查询当前年份数据
|
||||
basicPersonnelParam.setBelongYear(DateUtil.getCurrentYearStr());
|
||||
// 按照考核周期、查询绩效数据
|
||||
returnList.addAll(managerPortalMapper.getPerformanceInfo(basicPersonnelParam));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 异常考勤
|
||||
*
|
||||
* @param basicPersonnelParam
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> dealAbnormalAttendanceInfo(BasicPersonnelParam basicPersonnelParam) {
|
||||
Map<String, Object> dataMap = new LinkedHashMap<>();
|
||||
dataMap.put("late", Convert.toInt(managerPortalMapper.sumLateTimes(basicPersonnelParam), 0));
|
||||
dataMap.put("leaveEarly", Convert.toInt(managerPortalMapper.sumLeaveEarlyTimes(basicPersonnelParam), 0));
|
||||
dataMap.put("absenteeism", Convert.toInt(managerPortalMapper.sumAbsenteeismTimes(basicPersonnelParam), 0));
|
||||
dataMap.put("reissueCard", Convert.toInt(managerPortalMapper.sumReissueCardTimes(basicPersonnelParam), 0));
|
||||
dataMap.put("totalAttendance", Convert.toInt(managerPortalMapper.sumTotalAttendanceTimes(basicPersonnelParam), 0) * 2);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 迟到/早退
|
||||
*
|
||||
* @param basicPersonnelParam
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> dealLateOrLeaveEarlyInfo(BasicPersonnelParam basicPersonnelParam) {
|
||||
Map<String, Object> dataMap = new LinkedHashMap<>();
|
||||
List<LateAndEarlyRankPo> lateAndEarlyRankList = managerPortalMapper.getLateAndEarlyRankList(basicPersonnelParam);
|
||||
Iterator<LateAndEarlyRankPo> iterator = lateAndEarlyRankList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
LateAndEarlyRankPo lateAndEarlyRankPo = iterator.next();
|
||||
if (lateAndEarlyRankPo.getTimes() == null || lateAndEarlyRankPo.getTimes() == 0) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
SimpleEmployee byId = hrmCommonEmployeeDao.getById(lateAndEarlyRankPo.getEmpId());
|
||||
if (byId != null) {
|
||||
lateAndEarlyRankPo.setEmpName(byId.getName());
|
||||
SimpleDepartment department = byId.getDepartment();
|
||||
if (department != null) {
|
||||
lateAndEarlyRankPo.setDepartmentName(department.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
dataMap.put("list", lateAndEarlyRankList);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加班时长
|
||||
*
|
||||
* @param basicPersonnelParam
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> dealOvertimeDurationInfo(BasicPersonnelParam basicPersonnelParam) {
|
||||
Map<String, Object> dataMap = new LinkedHashMap<>();
|
||||
// 工作日加班
|
||||
dataMap.put("workday", Convert.toInt(managerPortalMapper.sumWorkdayOvertimeDuration(basicPersonnelParam), 0));
|
||||
// 公休日加班
|
||||
dataMap.put("weekend", Convert.toInt(managerPortalMapper.sumWeekendOvertimeDuration(basicPersonnelParam), 0));
|
||||
// 法定假节日加班
|
||||
dataMap.put("legalHoliday", Convert.toInt(managerPortalMapper.sumLegalHolidayOvertimeDuration(basicPersonnelParam), 0));
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请假类型
|
||||
*
|
||||
* @param basicPersonnelParam
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> dealLeaveTypeInfo(BasicPersonnelParam basicPersonnelParam) {
|
||||
Map<String, Object> dataMap = new LinkedHashMap<>();
|
||||
Set<Long> holidayIds = new HashSet<>();
|
||||
// 事假次数
|
||||
holidayIds.add(dataConvertMapper.getHolidayType(basicPersonnelParam, "事假"));
|
||||
dataMap.put("personalLeaveCount", Convert.toInt(managerPortalMapper.sumHolidayTimes(basicPersonnelParam, CollectionUtil.isEmpty(holidayIds) ? Collections.singletonList(-1L) : holidayIds), 0));
|
||||
// 事假时长
|
||||
dataMap.put("personalLeaveDuration", Convert.toInt(managerPortalMapper.sumPersonalLeaveDuration(basicPersonnelParam), 0));
|
||||
// 病假次数
|
||||
holidayIds = new HashSet<>();
|
||||
holidayIds.add(dataConvertMapper.getHolidayType(basicPersonnelParam, "病假"));
|
||||
holidayIds.add(dataConvertMapper.getHolidayType(basicPersonnelParam, "带薪病假"));
|
||||
dataMap.put("sickLeaveCount", Convert.toInt(managerPortalMapper.sumHolidayTimes(basicPersonnelParam, CollectionUtil.isEmpty(holidayIds) ? Collections.singletonList(-1L) : holidayIds), 0));
|
||||
// 病假时长
|
||||
dataMap.put("sickLeaveDuration", Convert.toInt(managerPortalMapper.sumSickLeaveDuration(basicPersonnelParam), 0));
|
||||
// 年假次数
|
||||
holidayIds = new HashSet<>();
|
||||
holidayIds.add(dataConvertMapper.getHolidayType(basicPersonnelParam, "年假"));
|
||||
dataMap.put("annualLeaveCount", Convert.toInt(managerPortalMapper.sumHolidayTimes(basicPersonnelParam, CollectionUtil.isEmpty(holidayIds) ? Collections.singletonList(-1L) : holidayIds), 0));
|
||||
// 年假时长
|
||||
dataMap.put("annualLeaveDuration", Convert.toInt(managerPortalMapper.sumAnnualLeaveDuration(basicPersonnelParam), 0));
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户当前所负责的所有的部门以及下级部门
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Set<Long> getAllDepartmentIdList(BasicPersonnelParam basicPersonnelParam, Long employeeId) {
|
||||
// 查询所负责的部门
|
||||
List<Long> manageDeptIds = managerPortalMapper.getManageDeptIds(basicPersonnelParam, employeeId);
|
||||
// 查询所有的部门、子部门信息
|
||||
Set<WeaDepartMent> allDepartmentList = new HashSet<>();
|
||||
for (Long manageDeptId : manageDeptIds) {
|
||||
WeaDepartMent departMentById = departMentService.getDepartMentById(manageDeptId);
|
||||
List<WeaDepartMent> beLongDeps = departMentService.getBeLongDeps(manageDeptId);
|
||||
allDepartmentList.add(departMentById);
|
||||
allDepartmentList.addAll(beLongDeps);
|
||||
}
|
||||
// TODO 判断集合如果为空,不展示数据
|
||||
return allDepartmentList.stream().map(WeaDepartMent::getDepartMentId).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.weaver.seconddev.portal.service.impl;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.portal.entity.param.SscParam;
|
||||
import com.weaver.seconddev.portal.entity.po.ExpirationReminderPo;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
|
||||
import com.weaver.seconddev.portal.mapper.portal.PortalMapper;
|
||||
import com.weaver.seconddev.portal.mapper.portal.SscPortalMapper;
|
||||
import com.weaver.seconddev.portal.service.SscPortalService;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import com.weaver.teams.security.user.User;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SscPortalServiceImpl implements SscPortalService {
|
||||
private static final String PORTAL_KEY = "sscPortal";
|
||||
|
||||
@Autowired
|
||||
SscPortalMapper sscPortalMapper;
|
||||
|
||||
@Autowired
|
||||
PortalMapper portalMapper;
|
||||
|
||||
@Override
|
||||
public WeaResult<ExpirationReminderPo> getExpirationReminder(Map<String, String> params) {
|
||||
User currentUser = UserContext.getCurrentUser();
|
||||
SscParam sscParam = new SscParam();
|
||||
sscParam.setTenantKey(currentUser.getTenantKey());
|
||||
|
||||
ExpirationReminderPo expirationReminderPo = new ExpirationReminderPo();
|
||||
|
||||
// 合同到期
|
||||
expirationReminderPo.setContractExpiration(sscPortalMapper.getExpirationReminderCount(sscParam));
|
||||
expirationReminderPo.setIdCardExpiration(sscPortalMapper.getIdCardExpirationCount(sscParam));
|
||||
expirationReminderPo.setHealthCertificateExpiration(sscPortalMapper.getHealthCertificateExpirationCount(sscParam));
|
||||
expirationReminderPo.setEmploymentAnniversary(sscPortalMapper.getEmploymentAnniversaryCount(sscParam));
|
||||
// TODO
|
||||
expirationReminderPo.setBirthdayNum(0);
|
||||
|
||||
|
||||
// 设置穿透地址
|
||||
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(sscParam.getTenantKey(), PORTAL_KEY, "getExpirationReminder");
|
||||
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
|
||||
expirationReminderPo.setContractExpirationUrl(urlMap.get("contractExpiration"));
|
||||
expirationReminderPo.setIdCardExpirationUrl(urlMap.get("idCardExpiration"));
|
||||
expirationReminderPo.setHealthCertificateExpirationUrl(urlMap.get("healthCertificateExpiration"));
|
||||
expirationReminderPo.setEmploymentAnniversaryUrl(urlMap.get("employmentAnniversary"));
|
||||
expirationReminderPo.setBirthdayNumUrl(urlMap.get("birthdayNum"));
|
||||
|
||||
|
||||
return WeaResult.success(expirationReminderPo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,349 @@
|
|||
package com.weaver.seconddev.portal.util;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 中文姓名转拼音工具类
|
||||
* 支持多音字识别、复姓处理、姓名结构分析等
|
||||
*/
|
||||
public class ChineseNameToPinyin {
|
||||
|
||||
// 拼音输出格式
|
||||
private static final HanyuPinyinOutputFormat FORMAT = new HanyuPinyinOutputFormat();
|
||||
|
||||
// 姓氏多音字映射(姓氏位置读音)
|
||||
private static final Map<String, String> SURNAME_POLYPHONE_MAP = new HashMap<>();
|
||||
|
||||
// 非姓氏多音字映射(词中/词尾读音)
|
||||
private static final Map<String, String> NON_SURNAME_POLYPHONE_MAP = new HashMap<>();
|
||||
|
||||
// 常见复姓
|
||||
private static final Set<String> COMPOUND_SURNAMES = new HashSet<>();
|
||||
|
||||
// 常见单姓
|
||||
private static final Set<String> SINGLE_SURNAMES = new HashSet<>();
|
||||
|
||||
// 常用汉字读音修正表(用于处理常见错误拼音)
|
||||
private static final Map<String, String> COMMON_CORRECTION_MAP = new HashMap<>();
|
||||
|
||||
// 缓存已处理过的姓名,提高性能
|
||||
private static final Map<String, String> NAME_CACHE = new ConcurrentHashMap<>();
|
||||
private static final int MAX_CACHE_SIZE = 10000;
|
||||
|
||||
static {
|
||||
FORMAT.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
FORMAT.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
|
||||
// 初始化姓氏多音字映射
|
||||
initSurnamePolyphoneMap();
|
||||
|
||||
// 初始化非姓氏多音字映射
|
||||
initNonSurnamePolyphoneMap();
|
||||
|
||||
// 初始化复姓列表
|
||||
initCompoundSurnames();
|
||||
|
||||
// 初始化单姓列表
|
||||
initSingleSurnames();
|
||||
|
||||
// 初始化常用汉字读音修正表
|
||||
initCommonCorrectionMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化姓氏多音字映射
|
||||
*/
|
||||
private static void initSurnamePolyphoneMap() {
|
||||
// 姓氏中的多音字(在姓氏位置的特殊读音)
|
||||
SURNAME_POLYPHONE_MAP.put("区", "ou");
|
||||
SURNAME_POLYPHONE_MAP.put("仇", "qiu");
|
||||
SURNAME_POLYPHONE_MAP.put("单", "shan");
|
||||
SURNAME_POLYPHONE_MAP.put("解", "xie");
|
||||
SURNAME_POLYPHONE_MAP.put("华", "hua");
|
||||
SURNAME_POLYPHONE_MAP.put("朴", "piao");
|
||||
SURNAME_POLYPHONE_MAP.put("曾", "zeng");
|
||||
SURNAME_POLYPHONE_MAP.put("查", "zha");
|
||||
SURNAME_POLYPHONE_MAP.put("翟", "zhai");
|
||||
SURNAME_POLYPHONE_MAP.put("尉", "yu");
|
||||
SURNAME_POLYPHONE_MAP.put("盖", "ge");
|
||||
SURNAME_POLYPHONE_MAP.put("缪", "miao");
|
||||
SURNAME_POLYPHONE_MAP.put("覃", "qin");
|
||||
SURNAME_POLYPHONE_MAP.put("宓", "mi");
|
||||
SURNAME_POLYPHONE_MAP.put("折", "she");
|
||||
SURNAME_POLYPHONE_MAP.put("繁", "po");
|
||||
SURNAME_POLYPHONE_MAP.put("员", "yun");
|
||||
SURNAME_POLYPHONE_MAP.put("召", "shao");
|
||||
SURNAME_POLYPHONE_MAP.put("隗", "kui");
|
||||
SURNAME_POLYPHONE_MAP.put("覃", "qin");
|
||||
SURNAME_POLYPHONE_MAP.put("冼", "xian");
|
||||
SURNAME_POLYPHONE_MAP.put("覃", "tan");
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化非姓氏多音字映射
|
||||
*/
|
||||
private static void initNonSurnamePolyphoneMap() {
|
||||
// 非姓氏位置的多音字读音
|
||||
NON_SURNAME_POLYPHONE_MAP.put("区", "qu");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("仇", "chou");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("单", "dan");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("解", "jie");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("华", "hua");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("朴", "pu");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("曾", "ceng");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("查", "cha");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("翟", "di");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("尉", "wei");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("盖", "gai");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("缪", "miu");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("覃", "tan");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("宓", "fu");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("折", "zhe");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("繁", "fan");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("员", "yuan");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("召", "zhao");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("隗", "wei");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("冼", "xiǎn");
|
||||
NON_SURNAME_POLYPHONE_MAP.put("覃", "qín");
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化复姓列表
|
||||
*/
|
||||
private static void initCompoundSurnames() {
|
||||
// 常见复姓(按长度排序,长的在前)
|
||||
String[] compoundSurnames = {
|
||||
"欧阳", "太史", "端木", "上官", "司马", "东方", "独孤", "南宫", "万俟", "闻人",
|
||||
"夏侯", "诸葛", "尉迟", "公羊", "赫连", "澹台", "皇甫", "宗政", "濮阳", "公冶",
|
||||
"太叔", "申屠", "公孙", "慕容", "仲孙", "钟离", "长孙", "宇文", "司徒", "鲜于",
|
||||
"司空", "闾丘", "子车", "亓官", "司寇", "巫马", "公西", "颛孙", "壤驷", "公良",
|
||||
"漆雕", "乐正", "宰父", "谷梁", "拓跋", "夹谷", "轩辕", "令狐", "段干", "百里",
|
||||
"呼延", "东郭", "南门", "羊舌", "微生", "岳父", "缑亢", "况后", "有琴", "梁丘",
|
||||
"左丘", "东门", "西门"
|
||||
};
|
||||
COMPOUND_SURNAMES.addAll(Arrays.asList(compoundSurnames));
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化单姓列表
|
||||
*/
|
||||
private static void initSingleSurnames() {
|
||||
// 常见单姓(按频率排序)
|
||||
String[] singleSurnames = {
|
||||
"王", "李", "张", "刘", "陈", "杨", "赵", "黄", "周", "吴", "徐", "孙", "胡", "朱",
|
||||
"高", "林", "何", "郭", "马", "罗", "梁", "宋", "郑", "谢", "韩", "唐", "冯", "于",
|
||||
"董", "萧", "程", "曹", "袁", "邓", "许", "傅", "沉", "曾", "彭", "吕", "苏", "卢",
|
||||
"蒋", "蔡", "贾", "丁", "魏", "薛", "叶", "阎", "余", "潘", "杜", "戴", "夏", "钟",
|
||||
"汪", "田", "任", "姜", "范", "方", "石", "姚", "谭", "廖", "邹", "熊", "金", "陆",
|
||||
"郝", "孔", "白", "崔", "康", "毛", "邱", "秦", "江", "尹", "薛", "闫", "段", "雷",
|
||||
"侯", "龙", "史", "陶", "黎", "贺", "顾", "孟", "黄", "万", "段", "雷", "钱", "汤",
|
||||
"尹", "黎", "易", "常", "武", "乔", "贺", "赖", "龚", "文"
|
||||
};
|
||||
SINGLE_SURNAMES.addAll(Arrays.asList(singleSurnames));
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化常用汉字读音修正表
|
||||
*/
|
||||
private static void initCommonCorrectionMap() {
|
||||
// 常见汉字读音修正
|
||||
COMMON_CORRECTION_MAP.put("茜", "qian"); // 作为名字时通常读作qian
|
||||
COMMON_CORRECTION_MAP.put("芃", "peng"); // 人名常用字
|
||||
COMMON_CORRECTION_MAP.put("喆", "zhe"); // 人名常用字
|
||||
}
|
||||
|
||||
/**
|
||||
* 将中文姓名转换为拼音(不带声调)
|
||||
*
|
||||
* @param chineseName 中文姓名
|
||||
* @return 拼音全称
|
||||
*/
|
||||
public static String convertChineseNameToPinyin(String chineseName) {
|
||||
if (chineseName == null || chineseName.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 先从缓存中查找
|
||||
String cachedResult = NAME_CACHE.get(chineseName);
|
||||
if (cachedResult != null) {
|
||||
return cachedResult;
|
||||
}
|
||||
|
||||
String result = doConvertChineseNameToPinyin(chineseName);
|
||||
|
||||
// 缓存结果(控制缓存大小)
|
||||
if (NAME_CACHE.size() < MAX_CACHE_SIZE) {
|
||||
NAME_CACHE.put(chineseName, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实际转换逻辑
|
||||
*/
|
||||
private static String doConvertChineseNameToPinyin(String chineseName) {
|
||||
StringBuilder pinyinBuilder = new StringBuilder();
|
||||
int i = 0;
|
||||
|
||||
// 首先尝试匹配复姓
|
||||
boolean surnameProcessed = false;
|
||||
if (chineseName.length() >= 2) {
|
||||
// 优先匹配3字复姓
|
||||
if (chineseName.length() >= 3) {
|
||||
String threeCharSurname = chineseName.substring(0, 3);
|
||||
if (COMPOUND_SURNAMES.contains(threeCharSurname)) {
|
||||
processSurname(pinyinBuilder, threeCharSurname);
|
||||
i = 3;
|
||||
surnameProcessed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果不是3字复姓,再匹配2字复姓
|
||||
if (!surnameProcessed) {
|
||||
String twoCharSurname = chineseName.substring(0, 2);
|
||||
if (COMPOUND_SURNAMES.contains(twoCharSurname)) {
|
||||
processSurname(pinyinBuilder, twoCharSurname);
|
||||
i = 2;
|
||||
surnameProcessed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果不是复姓,处理单姓
|
||||
if (!surnameProcessed && chineseName.length() >= 1) {
|
||||
String firstChar = String.valueOf(chineseName.charAt(0));
|
||||
if (SINGLE_SURNAMES.contains(firstChar) || SURNAME_POLYPHONE_MAP.containsKey(firstChar)) {
|
||||
processSurname(pinyinBuilder, firstChar);
|
||||
i = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理剩余部分(名字)
|
||||
while (i < chineseName.length()) {
|
||||
char ch = chineseName.charAt(i);
|
||||
processNonSurname(pinyinBuilder, ch, i, chineseName);
|
||||
i++;
|
||||
}
|
||||
|
||||
return pinyinBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理姓氏部分
|
||||
*/
|
||||
private static void processSurname(StringBuilder pinyinBuilder, String surname) {
|
||||
for (int j = 0; j < surname.length(); j++) {
|
||||
char ch = surname.charAt(j);
|
||||
String pinyin = getPinyinWithPolyphone(ch, true, j, surname);
|
||||
pinyinBuilder.append(pinyin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理非姓氏部分
|
||||
*/
|
||||
private static void processNonSurname(StringBuilder pinyinBuilder, char ch, int position, String fullName) {
|
||||
// 处理空格等非中文字符
|
||||
if (ch == ' ') {
|
||||
pinyinBuilder.append(" ");
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理英文字母
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
|
||||
pinyinBuilder.append(Character.toLowerCase(ch));
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理数字
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
pinyinBuilder.append(ch);
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理中文字符
|
||||
String pinyin = getPinyinWithPolyphone(ch, false, position, fullName);
|
||||
pinyinBuilder.append(pinyin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字符的拼音(考虑多音字)
|
||||
*/
|
||||
private static String getPinyinWithPolyphone(char ch, boolean isSurname, int position, String context) {
|
||||
try {
|
||||
// 首先检查常用修正表
|
||||
String correction = COMMON_CORRECTION_MAP.get(String.valueOf(ch));
|
||||
if (correction != null) {
|
||||
return correction;
|
||||
}
|
||||
|
||||
// 检查多音字映射
|
||||
if (isSurname) {
|
||||
String surnamePinyin = SURNAME_POLYPHONE_MAP.get(String.valueOf(ch));
|
||||
if (surnamePinyin != null) {
|
||||
return surnamePinyin;
|
||||
}
|
||||
} else {
|
||||
String nonSurnamePinyin = NON_SURNAME_POLYPHONE_MAP.get(String.valueOf(ch));
|
||||
if (nonSurnamePinyin != null) {
|
||||
return nonSurnamePinyin;
|
||||
}
|
||||
}
|
||||
|
||||
// 使用pinyin4j获取拼音
|
||||
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(ch, FORMAT);
|
||||
if (pinyinArray != null && pinyinArray.length > 0) {
|
||||
return pinyinArray[0]; // 默认返回第一个拼音
|
||||
} else {
|
||||
return String.valueOf(ch); // 非中文字符返回原字符
|
||||
}
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
return String.valueOf(ch); // 异常情况下返回原字符
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 带分隔符的拼音转换
|
||||
*
|
||||
* @param chineseName 中文姓名
|
||||
* @param separator 分隔符
|
||||
* @return 带分隔符的拼音
|
||||
*/
|
||||
public static String convertChineseNameToPinyinWithSeparator(String chineseName, String separator) {
|
||||
String pinyin = convertChineseNameToPinyin(chineseName);
|
||||
if (pinyin.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < pinyin.length(); i++) {
|
||||
if (i > 0) {
|
||||
result.append(separator);
|
||||
}
|
||||
result.append(pinyin.charAt(i));
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
public static void clearCache() {
|
||||
NAME_CACHE.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存大小
|
||||
*/
|
||||
public static int getCacheSize() {
|
||||
return NAME_CACHE.size();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,327 @@
|
|||
package com.weaver.seconddev.portal.util;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
public class DateUtil {
|
||||
|
||||
private static final DateTimeFormatter DEFAULT_YEAR_FORMATTER = DateTimeFormatter.ofPattern("yyyy");
|
||||
private static final DateTimeFormatter DEFAULT_MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
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)
|
||||
*/
|
||||
public static String getCurrentDateStr() {
|
||||
return LocalDate.now().format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
public static String getCurrentYearStr() {
|
||||
return LocalDate.now().format(DEFAULT_YEAR_FORMATTER);
|
||||
}
|
||||
|
||||
public static String getCurrentMonthStr() {
|
||||
return LocalDate.now().format(DEFAULT_MONTH_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期时间字符串 (yyyy-MM-dd HH:mm:ss)
|
||||
*/
|
||||
public static String getCurrentDateTimeStr() {
|
||||
return LocalDateTime.now().format(DEFAULT_DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析日期字符串为LocalDate
|
||||
*/
|
||||
public static LocalDate parseDate(String dateStr) {
|
||||
if (dateStr == null || dateStr.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return LocalDate.parse(dateStr, DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析日期时间字符串为LocalDateTime
|
||||
*/
|
||||
public static LocalDateTime parseDateTime(String dateTimeStr) {
|
||||
if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return LocalDateTime.parse(dateTimeStr, DEFAULT_DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化LocalDate为字符串
|
||||
*/
|
||||
public static String formatDate(LocalDate date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
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;
|
||||
}
|
||||
return dateTime.format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化LocalDateTime为字符串
|
||||
*/
|
||||
public static String formatDateTime(LocalDateTime dateTime) {
|
||||
if (dateTime == null) {
|
||||
return null;
|
||||
}
|
||||
return dateTime.format(DEFAULT_DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前年度第一天的字符串
|
||||
*/
|
||||
public static String getFirstDayOfYearStr() {
|
||||
return LocalDate.now().withMonth(1).withDayOfMonth(1).format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
public static String getFirstDayOfYearStr(String dateStr) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.withMonth(1).withDayOfMonth(1).format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前年度最后一天的字符串
|
||||
*/
|
||||
public static String getLastDayOfYearStr() {
|
||||
return LocalDate.now().withMonth(12).withDayOfMonth(31).format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期所在月份的第一天
|
||||
*
|
||||
* @param date 输入日期
|
||||
* @return 当月第一天的 LocalDate
|
||||
*/
|
||||
public static LocalDate getFirstDayOfMonth(LocalDate date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.withDayOfMonth(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前年度第一天的字符串
|
||||
*/
|
||||
public static String getFirstDayOfMonth() {
|
||||
return LocalDate.now().withDayOfMonth(1).format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前月份的最后一天
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getLastDayOfMonth() {
|
||||
return LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期字符串所在月份的第一天(字符串形式)
|
||||
*
|
||||
* @param dateStr 输入日期字符串 (yyyy-MM-dd)
|
||||
* @return 当月第一天的字符串
|
||||
*/
|
||||
public static String getFirstDayOfMonthStr(String dateStr) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return formatDate(getFirstDayOfMonth(date));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期的前N个月日期字符串
|
||||
*/
|
||||
public static String getBeforeMonthDateStr(String dateStr, int months) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.minusMonths(months).format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期的后N个月日期字符串
|
||||
*/
|
||||
public static String getAfterMonthDateStr(String dateStr, int months) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.plusMonths(months).format(DEFAULT_DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个日期之间的天数差
|
||||
*/
|
||||
public static long daysBetween(String startDateStr, String endDateStr) {
|
||||
LocalDate startDate = parseDate(startDateStr);
|
||||
LocalDate endDate = parseDate(endDateStr);
|
||||
if (startDate == null || endDate == null) {
|
||||
return 0;
|
||||
}
|
||||
return ChronoUnit.DAYS.between(startDate, endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个日期之间的月数差
|
||||
*/
|
||||
public static long monthsBetween(String startDateStr, String endDateStr) {
|
||||
LocalDate startDate = parseDate(startDateStr);
|
||||
LocalDate endDate = parseDate(endDateStr);
|
||||
if (startDate == null || endDate == null) {
|
||||
return 0;
|
||||
}
|
||||
return ChronoUnit.MONTHS.between(startDate, endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将java.util.Date转换为LocalDate
|
||||
*/
|
||||
public static LocalDate toLocalDate(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate();
|
||||
}
|
||||
|
||||
public static LocalDateTime toLocalDateTime(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 格式化LocalDateTime为指定格式的字符串
|
||||
*/
|
||||
public static String formatDateTime(LocalDateTime dateTime, DateTimeFormatter formatter) {
|
||||
if (dateTime == null || formatter == null) {
|
||||
return null;
|
||||
}
|
||||
return dateTime.format(formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将LocalDate转换为java.util.Date
|
||||
*/
|
||||
public static Date toDate(LocalDate localDate) {
|
||||
if (localDate == null) {
|
||||
return null;
|
||||
}
|
||||
return java.sql.Date.valueOf(localDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期字符串上个月的第一天(字符串形式)
|
||||
*
|
||||
* @param dateStr 输入日期字符串 (yyyy-MM-dd)
|
||||
* @return 上个月第一天的字符串
|
||||
*/
|
||||
public static String getFirstDayOfPreviousMonthStr(String dateStr) {
|
||||
return getFirstDayOfPreviousMonthStr(dateStr, 1);
|
||||
}
|
||||
|
||||
public static String getFirstDayOfPreviousMonthStr(String dateStr, int month) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
// 获取上个月的第一天
|
||||
LocalDate firstDayOfPrevMonth = date.minusMonths(month).withDayOfMonth(1);
|
||||
return formatDate(firstDayOfPrevMonth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期字符串上个月的最后一天(字符串形式)
|
||||
*
|
||||
* @param dateStr 输入日期字符串 (yyyy-MM-dd)
|
||||
* @return 上个月最后一天的字符串
|
||||
*/
|
||||
public static String getLastDayOfPreviousMonthStr(String dateStr) {
|
||||
return getLastDayOfPreviousMonthStr(dateStr, 1);
|
||||
}
|
||||
|
||||
public static String getLastDayOfPreviousMonthStr(String dateStr, int month) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
// 获取当月第一天,再减一天得到上个月最后一天
|
||||
LocalDate firstDayOfCurrentMonth = date.minusMonths(month - 1).withDayOfMonth(1);
|
||||
LocalDate lastDayOfPrevMonth = firstDayOfCurrentMonth.minusDays(1);
|
||||
return formatDate(lastDayOfPrevMonth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 LocalDate 格式化为 yyyy-MM 字符串
|
||||
*
|
||||
* @param date 输入日期
|
||||
* @return 年月字符串 (yyyy-MM)
|
||||
*/
|
||||
public static String formatToYearMonth(LocalDate date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
}
|
||||
|
||||
public static String formatToYearMonth_ZH(LocalDate date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return date.format(DateTimeFormatter.ofPattern("yyyy年MM月"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将日期字符串 (yyyy-MM-dd) 转换为年月字符串 (yyyy-MM)
|
||||
*
|
||||
* @param dateStr 输入日期字符串
|
||||
* @return 年月字符串 (yyyy-MM)
|
||||
*/
|
||||
public static String formatToYearMonth(String dateStr) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
return formatToYearMonth(date);
|
||||
}
|
||||
|
||||
public static String formatToYearMonth_ZH(String dateStr) {
|
||||
LocalDate date = parseDate(dateStr);
|
||||
return formatToYearMonth_ZH(date);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.weaver.seconddev.portal.util;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class PapiUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 获取papi授权码
|
||||
*
|
||||
* @param url
|
||||
* @param corpId
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
public static String getPapiCode(String url, String corpId, String state) {
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("corpid", corpId);
|
||||
bodyJson.put("response_type", "code");
|
||||
bodyJson.put("state", state);
|
||||
String resultStr = HttpRequest.post(url + "/papi/openapi/oauth2/authorize")
|
||||
.body(bodyJson.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(resultStr);
|
||||
return jsonObject.getString("code");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取papi token
|
||||
*
|
||||
* @param url
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static String getPapiToken(String url, String appKey, String appSecret, String code) {
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("app_key", appKey);
|
||||
bodyJson.put("app_secret", appSecret);
|
||||
bodyJson.put("grant_type", "authorization_code");
|
||||
bodyJson.put("code", code);
|
||||
String resultStr = HttpRequest.post(url + "/papi/openapi/oauth2/access_token")
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.body(bodyJson.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(resultStr);
|
||||
return jsonObject.getString("accessToken");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO 测试用
|
||||
String papiCode = getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "A1a");
|
||||
System.out.println("papiCode==" + papiCode);
|
||||
String papiToken = getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
System.out.println("papiToken==" + papiToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.weaver.seconddev.portal.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/17
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class StringUtil {
|
||||
/**
|
||||
* XML转义字符处理
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String unescapeXml(String input) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
// 替换常见的XML转义字符
|
||||
return input.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("&", "&")
|
||||
.replace(""", "\"")
|
||||
.replace("'", "'");
|
||||
}
|
||||
|
||||
|
||||
public static String buildSqlCondition(String sql) {
|
||||
if (StringUtils.isBlank(sql)) {
|
||||
return "";
|
||||
}
|
||||
return unescapeXml(sql);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.weaver.seconddev.staff.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import com.weaver.seconddev.portal.util.PapiUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 招聘需求流程提交时,根据年、月、部门、岗位、招需人数三个条件,判断是否超编,超编前端提醒并阻止流程提交,不超编,流转流转。
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("StaffCheckAction")
|
||||
public class StaffCheckAction implements EsbServerlessRpcRemoteInterface {
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("StaffCheckAction==params=={}", params);
|
||||
// 部门id
|
||||
Long departmentId = Convert.toLong(params.get("departmentId"));
|
||||
// 岗位id
|
||||
Long positionId = Convert.toLong(params.get("positionId"));
|
||||
// 办公地点id
|
||||
Long locationId = Convert.toLong(params.get("locationId"));
|
||||
// 职称
|
||||
Long jobCallId = Convert.toLong(params.get("jobCallId"));
|
||||
// 职级
|
||||
Long gradeId = Convert.toLong(params.get("gradeId"));
|
||||
// 职等
|
||||
Long jobsetLevelId = Convert.toLong(params.get("jobsetLevelId"));
|
||||
// 入职日期
|
||||
String hiredate = Convert.toStr(params.get("hiredate"));
|
||||
if (StringUtils.isNotBlank(hiredate) && hiredate.length() == 7) {
|
||||
hiredate = hiredate + "-01";
|
||||
}
|
||||
Date date = Convert.toDate(hiredate);
|
||||
// 人员状态
|
||||
Long personnelStatus = Convert.toLong(params.get("personnelStatus"));
|
||||
// 需求人数
|
||||
Integer requiredNumber = Convert.toInt(params.get("requiredNumber"), 0);
|
||||
|
||||
if (requiredNumber < 1) {
|
||||
// 需求人数小于1,不做校验
|
||||
return WeaResult.success();
|
||||
}
|
||||
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "A1a");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
List<JSONObject> empList = new ArrayList<>();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
// 赵普西
|
||||
for (int i = 0; i < requiredNumber; i++) {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("departmentId", departmentId);
|
||||
obj.put("positionId", positionId);
|
||||
obj.put("locationId", locationId);
|
||||
obj.put("jobCallId", jobCallId);
|
||||
obj.put("gradeId", gradeId);
|
||||
obj.put("jobsetLevelId", jobsetLevelId);
|
||||
obj.put("hiredate", date);
|
||||
obj.put("personnelStatus", personnelStatus);
|
||||
empList.add(obj);
|
||||
}
|
||||
jsonObject.put("empList", empList);
|
||||
jsonObject.put("source", "addEmp");
|
||||
jsonObject.put("access_token", papiToken);
|
||||
log.error("validate==jsonObject=={}", JSON.toJSONString(jsonObject));
|
||||
String response = HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/hr/hrapi/est/validate")
|
||||
.header("Content-Type", "application/json")
|
||||
.body(jsonObject.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.error("validate>>response===" + response);
|
||||
|
||||
JSONObject responseJson = JSONObject.parseObject(response);
|
||||
JSONObject data = responseJson.getJSONObject("data");
|
||||
if (data != null && !data.getBoolean("checkResult")) {
|
||||
// 验证失败
|
||||
return WeaResult.fail(data.getString("errContent"), true);
|
||||
}
|
||||
return WeaResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?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.dictionary.DataConvertMapper">
|
||||
|
||||
|
||||
<select id="getIdByName" resultType="java.lang.Long">
|
||||
select t1.id from ${param.e10_other_business}.hr_dictionary_setting t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{param.tenantKey}
|
||||
and t1.type = #{type}
|
||||
and t1.name = #{name}
|
||||
</select>
|
||||
|
||||
<select id="getHolidayType" resultType="java.lang.Long">
|
||||
select t1.id from ${param.e10_other_business}.attend_vacation_setting t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{param.tenantKey}
|
||||
and t1.name = #{name}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -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.employee.mapper.FormatChangeMapper">
|
||||
|
||||
|
||||
<select id="getChangeRecord" 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_employee_xxbgsq t1
|
||||
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
|
||||
and t1.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?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.entry.mapper.EmailAccountGenerateMapper">
|
||||
|
||||
<select id="checkSameEmailAccount" resultType="java.lang.Integer">
|
||||
select count(t1.id) from ${param.e10_common}.uf_jcl_rzsq t1
|
||||
where t1.tenant_key = #{param.tenantKey}
|
||||
<!-- and t1.delete_type = 0-->
|
||||
and t1.email = #{email}
|
||||
<if test="requestId != null and requestId != ''">
|
||||
and t1.form_data_id != #{requestId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="checkEmployeeSameEmail" resultType="java.lang.Integer">
|
||||
select count(t1.id) from ${param.e10_common}.uf_jcl_employee_information t1
|
||||
where t1.tenant_key = #{param.tenantKey}
|
||||
<!-- and t1.delete_type = 0-->
|
||||
and t1.email = #{email}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -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.entry.mapper.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>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?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.entry.mapper.EntryManageMapper">
|
||||
|
||||
<select id="getEntryRecordIdByJobNum" resultType="java.lang.Long">
|
||||
select t1.id from ${param.e10_common}.uf_jcl_rzgl t1
|
||||
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
|
||||
and t1.job_num = #{jobNum}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?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.entry.mapper.ResignationApplyMapper">
|
||||
|
||||
<resultMap id="PermissionTransferModuleMap" type="com.weaver.seconddev.entry.entity.PermissionTransferModule">
|
||||
<id property="detailId" column="id"/>
|
||||
<result property="formDataId" column="form_data_id"/>
|
||||
<result property="handoverId" column="gzjjr"/>
|
||||
<result property="effectDate" column="sxrq"/>
|
||||
<result property="effectType" column="sxlx"/>
|
||||
<result property="module" column="mk"/>
|
||||
<result property="subModule" column="zmk"/>
|
||||
<result property="employeeId" column="lzyg"/>
|
||||
<result property="lastWorkDate" column="zhgzr"/>
|
||||
<result property="lastWorkDate" column="zhgzr"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<update id="updatePermissionTransferModule">
|
||||
update ${param.e10_common}.uf_jcl_lzs_mxb1 set cgs =
|
||||
#{module.successCount},sbs=#{module.failCount},yy=#{module.failReason}
|
||||
where id = #{module.detailId}
|
||||
</update>
|
||||
|
||||
<update id="updateRoleTransferModule">
|
||||
update ${param.e10_common}.uf_jcl_lzs_jsmx set cgs =
|
||||
#{module.successCount},sbs=#{module.failCount},yy=#{module.failReason}
|
||||
where id = #{module.detailId}
|
||||
</update>
|
||||
|
||||
<select id="getPermissionTransferModuleList" resultMap="PermissionTransferModuleMap">
|
||||
select t1.*,t2.lzyg ,t2.zhgzr ,t2.sfksgzjj from ${param.e10_common}.uf_jcl_lzs_mxb1 t1
|
||||
inner join ${param.e10_common}.uf_jcl_lzsq t2 on t1.FORM_DATA_ID = t2.FORM_DATA_ID
|
||||
where t1.DELETE_TYPE =0 and t1.TENANT_KEY =#{param.tenantKey}
|
||||
and t2.DELETE_TYPE =0 and t2.TENANT_KEY =#{param.tenantKey}
|
||||
and t1.cgs is null and t1.sxrq <= #{currentDate}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getRoleTransferModuleList" resultMap="PermissionTransferModuleMap">
|
||||
select t1.id,t1.form_data_id,t1.source_id ,t1.gzjjr ,t1.sxrq,t1.sxlx, 'hrm' as mk,'hrm_role' as zmk,t2.lzyg
|
||||
,t2.zhgzr ,t2.sfksgzjj
|
||||
from ${param.e10_common}.uf_jcl_lzs_jsmx t1
|
||||
inner join ${param.e10_common}.uf_jcl_lzsq t2 on t1.FORM_DATA_ID = t2.FORM_DATA_ID
|
||||
where t1.DELETE_TYPE =0 and t1.TENANT_KEY =#{param.tenantKey}
|
||||
and t2.DELETE_TYPE =0 and t2.TENANT_KEY =#{param.tenantKey}
|
||||
and t1.cgs is null and t1.sxrq <= #{currentDate}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?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.portal.EbuilderBaseMapper">
|
||||
|
||||
<select id="getFormIdByTableName" resultType="java.lang.Long">
|
||||
select t.form_id from ${param.e10_common}.form_table t where
|
||||
t.tenant_key = #{param.tenantKey} and t.delete_type = 0
|
||||
and t.table_name = #{tableName}
|
||||
</select>
|
||||
|
||||
<select id="getFormFieldByFieldName" resultType="com.weaver.common.form.metadata.field.FormField">
|
||||
select t.* from ${param.e10_common}.form_field t
|
||||
where t.tenant_key = #{param.tenantKey} and t.delete_type = 0
|
||||
and t.form_id = #{formId} and t.data_key = #{fieldName}
|
||||
</select>
|
||||
|
||||
<select id="getFormdataTemplateDetails"
|
||||
resultType="com.weaver.common.form.datasource.FormdataTemplateDetails">
|
||||
select t.* from ${param.e10_common}.formdata_template_details t
|
||||
where t.tenant_key = #{param.tenantKey} and t.delete_type = 0
|
||||
and t.template_id = #{templateId}
|
||||
order by t.`order`
|
||||
</select>
|
||||
|
||||
<select id="getObjIdByTableName" resultType="java.lang.Long">
|
||||
select t.id from ${param.e10_common}.ebdf_obj t where
|
||||
t.tenant_key = #{param.tenantKey} and t.delete_type = 0
|
||||
and t.table_name = #{tableName}
|
||||
</select>
|
||||
|
||||
<select id="getFolderIdByFieldId" resultType="java.lang.Long">
|
||||
select t.folder_id from ${param.e10_common}.form_attachment_config t where
|
||||
t.tenant_key = #{param.tenantKey} and t.delete_type = 0
|
||||
and t.field_id = #{fieldId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?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.portal.EmployeePortalMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?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.portal.EteamsBaseMapper">
|
||||
|
||||
<select id="getFormIdByTableName" resultType="java.lang.Long">
|
||||
select t.form_id from ${param.eteams}.form_table t where
|
||||
t.tenant_key = #{param.tenantKey} and t.delete_type = 0
|
||||
and t.table_name = #{tableName}
|
||||
</select>
|
||||
|
||||
<select id="getFormFieldByFieldName" resultType="com.weaver.common.form.metadata.field.FormField">
|
||||
select t.* from ${param.eteams}.form_field t
|
||||
where t.tenant_key = #{param.tenantKey} and t.delete_type = 0
|
||||
and t.form_id = #{formId} and t.data_key = #{fieldName}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
<?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.portal.HrbpPortalMapper">
|
||||
|
||||
<select id="getToEntryCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_rzgl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t.rzzt = 0
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getToRegularCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t.personnel_status in(1,3)
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getToLeaveCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_lzsq t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.lzqbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.flow_status in (1, 2, 3)
|
||||
and (t.zhgzr is null or t.zhgzr = '' or zhgzr >current_date())
|
||||
</select>
|
||||
|
||||
<select id="getToSignCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_rshtgl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.ssbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.htzt = 1
|
||||
</select>
|
||||
|
||||
<select id="getToProxyCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_dlqgl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.ssbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.dlqzt = 2
|
||||
</select>
|
||||
|
||||
<select id="getAllEmployeeCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status not in (5,6)
|
||||
</select>
|
||||
|
||||
<select id="getFormalEmployeeCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status not in (5,6)
|
||||
and t.yglx=1109770887364624394
|
||||
</select>
|
||||
|
||||
<select id="getInternEmployeeCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status not in (5,6)
|
||||
and t.yglx=1109772927499255817
|
||||
</select>
|
||||
|
||||
<select id="getOutsourcingCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status not in (5,6)
|
||||
and t.yglx=1109775968260603906
|
||||
</select>
|
||||
|
||||
<select id="getLaborCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status not in (5,6)
|
||||
and t.yglx=1109776092848209920
|
||||
</select>
|
||||
|
||||
<select id="getProbationCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status = 1
|
||||
</select>
|
||||
|
||||
<select id="getFormalCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status = 2
|
||||
</select>
|
||||
<select id="getInternCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status = 4
|
||||
</select>
|
||||
|
||||
<select id="getLeaveCount" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.personnel_status = 5
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
<?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.portal.LeaderCockpitMapper">
|
||||
|
||||
|
||||
<select id="getOnJobNumber" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
|
||||
select count(t.id) as value ,b.yglxmc as name from ${e10_common}.uf_jcl_employee_information t
|
||||
inner join ${e10_common}.uf_jcl_yglx b on t.yglx = b.id
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--开始日期 <= 结束查询日期-->
|
||||
AND t.hiredate <= #{endDate}
|
||||
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
|
||||
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr > #{endDate})
|
||||
group by b.yglxmc
|
||||
</select>
|
||||
|
||||
<select id="getOnJobCount" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--开始日期 <= 结束查询日期-->
|
||||
AND t.hiredate <= #{endDate}
|
||||
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
|
||||
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr > #{endDate})
|
||||
</select>
|
||||
|
||||
<select id="getResignCount" resultType="java.lang.Integer">
|
||||
select count(id) as value from ${param.e10_common}.uf_jcl_lzxxjl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
and t.lzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.lzqbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.zhgzr >= #{startDate}
|
||||
and t.zhgzr <= #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="getKeyResignCount" resultType="java.lang.Integer">
|
||||
select count(id) as value from ${param.e10_common}.uf_jcl_lzxxjl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
and t.lzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.lzqbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.sfgjrc = 1
|
||||
and t.zhgzr >= #{startDate}
|
||||
and t.zhgzr <= #{endDate}
|
||||
</select>
|
||||
<select id="getEmploymentCount" resultType="java.lang.Integer">
|
||||
select count(id) as value from ${param.e10_common}.uf_jcl_rzgl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
and t.rzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.hiredate >= #{startDate}
|
||||
and t.hiredate <= #{endDate}
|
||||
</select>
|
||||
<select id="getKeyEmploymentCount" resultType="java.lang.Integer">
|
||||
select count(id) as value from ${param.e10_common}.uf_jcl_rzgl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
and t.rzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.sfgjrc = 1
|
||||
and t.hiredate >= #{startDate}
|
||||
and t.hiredate <= #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="getEmploymentListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
|
||||
select count(id) as name,position as value from ${param.e10_common}.uf_jcl_rzgl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
and t.rzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.hiredate >= #{startDate}
|
||||
and t.hiredate <= #{endDate}
|
||||
and position !='' and position is not null
|
||||
group by position order by value
|
||||
</select>
|
||||
|
||||
<select id="getPositionById" resultType="com.weaver.seconddev.portal.entity.po.Position">
|
||||
select p.id as position_id, p.name as position_name,
|
||||
d.id as department_id, d.name as department_name,
|
||||
g.id as grade_id, g.name as grade_name
|
||||
from ${param.eteams}.position p
|
||||
left join ${param.eteams}.department d on p.department = d.id
|
||||
left join ${param.eteams}.grade g on p.grade_id = g.id
|
||||
where p.id = #{positionId} and p.delete_type = 0
|
||||
and p.tenant_key = #{param.tenantKey} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getResignListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
|
||||
select count(id) as name,lzqgw as value from ${param.e10_common}.uf_jcl_lzxxjl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
and t.lzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.lzqbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.zhgzr >= #{startDate}
|
||||
and t.zhgzr <= #{endDate}
|
||||
and t.lzqgw !='' and t.lzqgw is not null
|
||||
group by t.lzqgw order by value
|
||||
</select>
|
||||
<select id="getTopDepartmentIds" resultType="java.lang.Long">
|
||||
select t.id
|
||||
from ${param.eteams}.department t
|
||||
inner join ${param.eteams}.department t1 on t.parent = t1.id
|
||||
where t.type = 'department'
|
||||
and t1.type = 'subcompany'
|
||||
and t.delete_type = 0
|
||||
and t.status = 1
|
||||
and t.tenant_key = #{param.tenantKey}
|
||||
and t1.delete_type = 0
|
||||
and t1.status = 1
|
||||
and t1.tenant_key = #{param.tenantKey}
|
||||
</select>
|
||||
|
||||
<select id="getLaborCost" resultType="java.util.Map">
|
||||
select t.yscb,t.sjcb from ${e10_common}.uf_rlcb t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t.ny = DATE_FORMAT(#{endDate}, '%Y-%m')
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,447 @@
|
|||
<?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.portal.ManagerPortalMapper">
|
||||
|
||||
<select id="getOnJobNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(t.id) AS value
|
||||
FROM ${e10_common}.uf_jcl_employee_information t
|
||||
WHERE t.delete_type = 0
|
||||
AND t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
AND t.hiredate <= #{endDate}
|
||||
AND (t.zhgzr >= #{startDate}
|
||||
OR t.zhgzr IS NULL
|
||||
OR t.zhgzr = '')
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getResignNumber" resultType="java.lang.Integer">
|
||||
select count(id) as value from ${e10_common}.uf_jcl_lzxxjl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t.lzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.lzqbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.zhgzr >= #{startDate}
|
||||
and t.zhgzr <= #{endDate}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getResigningNumber" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_lzsq t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.lzqbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--审批中-->
|
||||
and t.flow_status in (0,1,2)
|
||||
<!--申请日期-->
|
||||
and t.sqrq >= #{startDate}
|
||||
and t.sqrq <= #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="getEntryingNumber" resultType="java.lang.Integer">
|
||||
select count(t.id) from ${e10_common}.uf_jcl_rzsq t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.ssbm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--审批中-->
|
||||
and t.flow_status in (0,1,2)
|
||||
<!--申请日期-->
|
||||
and t.sqsj >= #{startDate}
|
||||
and t.sqsj <= #{endDate}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getEntryNumber" resultType="java.lang.Integer">
|
||||
select count(id) as value from ${e10_common}.uf_jcl_rzgl t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t.rzzt = 1
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.hiredate >= #{startDate}
|
||||
and t.hiredate <= #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="getManageDeptIds" resultType="java.lang.Long">
|
||||
select t.id
|
||||
from ${param.eteams}.department t
|
||||
inner join ${param.eteams}.${param.table_dept_cus} t2 on t.formdata = t2.id
|
||||
where t.type = 'department'
|
||||
and t.delete_type = 0
|
||||
and t.status = 1
|
||||
and t.tenant_key = #{param.tenantKey}
|
||||
and t2.tenant_key = #{param.tenantKey}
|
||||
and t2.delete_type = 0
|
||||
and t2.bmfzr = #{empId}
|
||||
</select>
|
||||
|
||||
<select id="getBirthdayNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(t.id) AS value
|
||||
FROM ${e10_common}.uf_jcl_employee_information t
|
||||
WHERE t.delete_type = 0
|
||||
AND t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND (
|
||||
(
|
||||
DATE_FORMAT(birthday, '%m-%d') BETWEEN
|
||||
DATE_FORMAT(CURDATE(), '%m-%d') AND DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
)
|
||||
OR (
|
||||
DATE_FORMAT(CURDATE(), '%m-%d') > DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
AND (
|
||||
DATE_FORMAT(birthday, '%m-%d') >= DATE_FORMAT(CURDATE(), '%m-%d')
|
||||
OR DATE_FORMAT(birthday, '%m-%d') <= DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
)
|
||||
)
|
||||
)
|
||||
</select>
|
||||
<select id="getRegularEmployeeNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(t.id) AS value
|
||||
FROM ${e10_common}.uf_jcl_employee_information t
|
||||
WHERE t.delete_type = 0
|
||||
AND t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and yjsyjsrq IS NOT NULL
|
||||
AND (
|
||||
STR_TO_DATE(CONCAT(YEAR(CURDATE()), '-', DATE_FORMAT(yjsyjsrq, '%m-%d')), '%Y-%m-%d') BETWEEN
|
||||
CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 60 DAY)
|
||||
OR STR_TO_DATE(CONCAT(YEAR(CURDATE()) + 1, '-', DATE_FORMAT(yjsyjsrq, '%m-%d')), '%Y-%m-%d') BETWEEN
|
||||
CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 60 DAY)
|
||||
)
|
||||
</select>
|
||||
<select id="getEmploymentAnniversary" resultType="java.lang.Integer">
|
||||
SELECT COUNT(t.id) AS value
|
||||
FROM ${e10_common}.uf_jcl_employee_information t
|
||||
WHERE t.delete_type = 0
|
||||
AND t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND (
|
||||
(
|
||||
DATE_FORMAT(hiredate, '%m-%d') BETWEEN
|
||||
DATE_FORMAT(CURDATE(), '%m-%d') AND DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
)
|
||||
OR (
|
||||
DATE_FORMAT(CURDATE(), '%m-%d') > DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
AND (
|
||||
DATE_FORMAT(hiredate, '%m-%d') >= DATE_FORMAT(CURDATE(), '%m-%d')
|
||||
OR DATE_FORMAT(hiredate, '%m-%d') <= DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getEducationInfo" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
|
||||
select count(t.id) as value , t.education as id
|
||||
from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by t.education
|
||||
</select>
|
||||
|
||||
<select id="getPieTypeConfig" resultType="com.weaver.seconddev.portal.entity.po.PieChartConfig">
|
||||
select t.lx as type,t.flmc as name,t.xlfl as educationIds,
|
||||
t.qsw as startIndex,t.jzw as endIndex,t.zj as gradeIds,t.zssx as orderNum
|
||||
from ${e10_common}.uf_xlfb t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t.lx = #{pieType} order by t.zssx
|
||||
</select>
|
||||
|
||||
<select id="getAgeCount" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${param.e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.age > #{startIndex}
|
||||
and t.age <= #{endIndex}
|
||||
</select>
|
||||
|
||||
<select id="getComapnyCount" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${param.e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.sl > #{startIndex}
|
||||
and t.sl <= #{endIndex}
|
||||
</select>
|
||||
<select id="getTeamEmployee" resultType="com.weaver.seconddev.portal.entity.po.TeamEmployeePo">
|
||||
select t.id,t.username as userName ,t1.NAME as departmentName,t2.NAME as jobPositionName,t3.jobset_levelname as
|
||||
jobLevelName,t.graduate_school as schoolName,t4.name as educationName,t.age as age,t.hiredate as hireDate from
|
||||
${e10_common}.uf_jcl_employee_information t
|
||||
left join ${eteams}.department t1 on t.DEPARTMENT = t1.ID
|
||||
left join ${eteams}.`position` t2 on t.`POSITION` =t2.id
|
||||
left join ${eteams}.hrm_jobset_level t3 on t.jobset_level = t3.id
|
||||
left join ${e10_other_business}.hr_dictionary_setting t4 on t.education =t4.id
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and (t.zhgzr is null or t.zhgzr = '' or zhgzr >current_date())
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- <if test="departmentId != null and departmentId != ''">-->
|
||||
<!-- and t.department = #{departmentId}-->
|
||||
<!-- </if>-->
|
||||
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
and (t.username like concat('%',#{searchKey},'%') or t.job_num like concat('%',#{searchKey},'%'))
|
||||
</if>
|
||||
|
||||
<!--分页-->
|
||||
limit #{offset},#{pageSize}
|
||||
|
||||
</select>
|
||||
<select id="getTeamEmployeeTotal" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and (t.zhgzr is null or t.zhgzr = '' or zhgzr >current_date())
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- <if test="departmentId != null and departmentId != ''">-->
|
||||
<!-- and t.department = #{departmentId}-->
|
||||
<!-- </if>-->
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
and (t.username like concat('%',#{searchKey},'%') or t.job_num like concat('%',#{searchKey},'%'))
|
||||
</if>
|
||||
|
||||
</select>
|
||||
<select id="getPerformanceInfo" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
|
||||
select count(t.id) as value , t.ppdj as name
|
||||
from ${e10_common}.uf_jxsjtz t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t.khnf = #{belongYear} and t.khzq = #{searchKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.bm IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by t.ppdj
|
||||
</select>
|
||||
|
||||
<select id="sumLateTimes" resultType="java.lang.Integer">
|
||||
select sum(t1.cdcs) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumLeaveEarlyTimes" resultType="java.lang.Integer">
|
||||
select sum(t1.ztcs) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumAbsenteeismTimes" resultType="java.lang.Integer">
|
||||
select sum(t1.kgcs) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumReissueCardTimes" resultType="java.lang.Integer">
|
||||
select sum(t1.bkcs) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumTotalAttendanceTimes" resultType="java.lang.Integer">
|
||||
select count(t1.id) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
<!-- TODO -->
|
||||
and t1.rqlx = '工作日'
|
||||
</select>
|
||||
|
||||
<select id="getLateAndEarlyRankList" resultType="com.weaver.seconddev.portal.entity.po.LateAndEarlyRankPo">
|
||||
select t1.xm as empId,sum(ifnull(t1.cdcs,0) + ifnull(t1.ztcs,0)) as times,sum(ifnull(t1.cdfzs,0) + ifnull(t1.ztfzs,0)) as minutes
|
||||
from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
group by t1.xm
|
||||
order by times desc
|
||||
</select>
|
||||
|
||||
<select id="sumWorkdayOvertimeDuration" resultType="java.lang.Integer">
|
||||
select sum(t1.ot1hj) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumWeekendOvertimeDuration" resultType="java.lang.Integer">
|
||||
select sum(t1.ot2hj) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumLegalHolidayOvertimeDuration" resultType="java.lang.Integer">
|
||||
select sum(t1.ot3hj) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumPersonalLeaveDuration" resultType="java.lang.Integer">
|
||||
select sum(t1.sj) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumSickLeaveDuration" resultType="java.lang.Integer">
|
||||
select sum(ifnull(t1.bj,0)+ifnull(t1.dxbj,0)) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumAnnualLeaveDuration" resultType="java.lang.Integer">
|
||||
select sum(t1.nj) as value from ${e10_common}.uf_attend_day_report t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t1.bm in
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t1.rq between #{startDate} and #{endDate}
|
||||
</select>
|
||||
|
||||
<select id="sumHolidayTimes" resultType="java.lang.Integer">
|
||||
select count(t1.id) as value from ${param.e10_common}.${param.leaveFormCus} t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{param.tenantKey}
|
||||
<if test="param.departmentIdList != null and param.departmentIdList.size() > 0">
|
||||
AND t1.sqbm in
|
||||
<foreach collection="param.departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and (t1.kssj between #{param.startDate} and #{param.endDate} or t1.jssj between #{param.startDate} and
|
||||
#{param.endDate})
|
||||
<if test="holidayIds != null and holidayIds.size() > 0">
|
||||
AND t1.xjxm in
|
||||
<foreach collection="holidayIds" item="holidayId" open="(" close=")" separator=",">
|
||||
#{holidayId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--状态为:已审批-->
|
||||
and t1.zt = 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?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.portal.PortalMapper">
|
||||
|
||||
<select id="getPortalUrlDetail" resultType="com.weaver.seconddev.portal.entity.po.PortalUrlDetail">
|
||||
select t.id as id,t.jkbs as detailKey,t.ctdz as urlAddress,t.zjmc as detailName from e10_common.uf_mhctdz_mxb1 t
|
||||
inner join e10_common.uf_mhctdz t1
|
||||
on t.FORM_DATA_ID =t1.FORM_DATA_ID
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
and t1.tenant_key = #{tenantKey} and t1.delete_type = 0
|
||||
and t1.mhmc = #{portalKey} and t1.zjjk = #{componentKey}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<?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.portal.SscPortalMapper">
|
||||
|
||||
<select id="getExpirationReminderCount" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.htzzrq <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 30 DAY)
|
||||
</select>
|
||||
|
||||
<select id="getIdCardExpirationCount" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.sfzyxjsrq <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 7 DAY)
|
||||
</select>
|
||||
|
||||
<select id="getHealthCertificateExpirationCount" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and t.jkzdqrq <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 7 DAY)
|
||||
</select>
|
||||
|
||||
<select id="getEmploymentAnniversaryCount" resultType="java.lang.Integer">
|
||||
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
|
||||
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
|
||||
<if test="departmentIdList != null and departmentIdList.size() > 0">
|
||||
AND t.department IN
|
||||
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
|
||||
#{departmentId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND (
|
||||
(
|
||||
DATE_FORMAT(hiredate, '%m-%d') BETWEEN
|
||||
DATE_FORMAT(CURDATE(), '%m-%d') AND DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
)
|
||||
OR (
|
||||
DATE_FORMAT(CURDATE(), '%m-%d') > DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
AND (
|
||||
DATE_FORMAT(hiredate, '%m-%d') >= DATE_FORMAT(CURDATE(), '%m-%d')
|
||||
OR DATE_FORMAT(hiredate, '%m-%d') <= DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY), '%m-%d')
|
||||
)
|
||||
)
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.weaver.seconddev.chapanda.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
import com.weaver.seconddev.chapanda.service.MybatisDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/qt/demo")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class DemoController {
|
||||
|
||||
@Autowired
|
||||
private MybatisDemoService mybatisDemoService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public WeaResult<List<DemoPO>> getSearchCondition() {
|
||||
return WeaResult.success(mybatisDemoService.list());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.weaver.seconddev.chapanda.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class RecordDetailDTO {
|
||||
private Long id;
|
||||
private Long xm;
|
||||
private String fb;
|
||||
private String bm;
|
||||
private String ssgw;
|
||||
private String sxkqgz;
|
||||
private String sxrq;
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
private Long employeeid;
|
||||
/**
|
||||
* 原部门
|
||||
*/
|
||||
private Long oldDepartment;
|
||||
/**
|
||||
* 原职位
|
||||
*/
|
||||
private Long oldPosition;
|
||||
|
||||
|
||||
/**
|
||||
* 变更日期
|
||||
*/
|
||||
private Date changeDate;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package com.weaver.seconddev.chapanda.entity.po;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EbFieldInfo {
|
||||
private Data data;
|
||||
private Message message;
|
||||
|
||||
// Getters and Setters
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Message getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(Message message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
private List<Field> mainFields;
|
||||
private List<Field> detailFields;
|
||||
|
||||
// Getters and Setters
|
||||
public List<Field> getMainFields() {
|
||||
return mainFields;
|
||||
}
|
||||
|
||||
public void setMainFields(List<Field> mainFields) {
|
||||
this.mainFields = mainFields;
|
||||
}
|
||||
|
||||
public List<Field> getDetailFields() {
|
||||
return detailFields;
|
||||
}
|
||||
|
||||
public void setDetailFields(List<Field> detailFields) {
|
||||
this.detailFields = detailFields;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Field {
|
||||
private long id;
|
||||
private String fieldId;
|
||||
private String fieldName;
|
||||
private String fieldType;
|
||||
private String fieldKey;
|
||||
private int number;
|
||||
private boolean multiSelect;
|
||||
private long objId;
|
||||
|
||||
// Getters and Setters
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFieldId() {
|
||||
return fieldId;
|
||||
}
|
||||
|
||||
public void setFieldId(String fieldId) {
|
||||
this.fieldId = fieldId;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(String fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getFieldKey() {
|
||||
return fieldKey;
|
||||
}
|
||||
|
||||
public void setFieldKey(String fieldKey) {
|
||||
this.fieldKey = fieldKey;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(int number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public boolean isMultiSelect() {
|
||||
return multiSelect;
|
||||
}
|
||||
|
||||
public void setMultiSelect(boolean multiSelect) {
|
||||
this.multiSelect = multiSelect;
|
||||
}
|
||||
|
||||
public long getObjId() {
|
||||
return objId;
|
||||
}
|
||||
|
||||
public void setObjId(long objId) {
|
||||
this.objId = objId;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Message {
|
||||
private String code;
|
||||
private String msg;
|
||||
|
||||
// Getters and Setters
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,12 +10,18 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface AttendStatusDetailMapper {
|
||||
/**
|
||||
*
|
||||
* @param tenantKey
|
||||
* @param attendDate
|
||||
* @param deleteType
|
||||
* @return
|
||||
*/
|
||||
List<AttendStatusDetailDTO> selectByCondition(@Param("tenantKey") String tenantKey,
|
||||
@Param("attendDate") Date attendDate, @Param("deleteType") Integer deleteType,@Param("dbName") String dbName);
|
||||
@Param("attendDate") Date attendDate, @Param("deleteType") Integer deleteType, @Param("dbName") String dbName);
|
||||
|
||||
List<AttendStatusDetailDTO> getAllEmployeeBy(@Param("tenantKey") String tenantKey,
|
||||
@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("dbName") String dbName);
|
||||
|
||||
List<AttendStatusDetailDTO> everyDayByEmp(@Param("employee") Long employee,
|
||||
@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("dbName") String dbName);
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.weaver.seconddev.chapanda.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoFormDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface DemoMapper extends BaseMapper<DemoPO> {
|
||||
DemoFormDTO getDemoListDTO(@Param("id") Long id, @Param("tenantKey") String tenantKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.chapanda.mapper;
|
||||
|
||||
import com.weaver.seconddev.chapanda.entity.dto.RecordDetailDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface RecordDetailMapper {
|
||||
List<RecordDetailDTO> getAllRecordByUser(@Param("employee") Long employee, @Param("dbName") String dbName);
|
||||
|
||||
RecordDetailDTO getEmpChange(@Param("employee") Long employee, @Param("changeDate") Date changeDate, @Param("dbName") String dbName);
|
||||
|
||||
RecordDetailDTO lastChangeRecord(@Param("employee") Long employee, @Param("changeDate") Date changeDate, @Param("dbName") String dbName);
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.weaver.seconddev.chapanda.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
|
||||
/**
|
||||
* db最佳实践demo
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public interface MybatisDemoService extends IService<DemoPO> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.weaver.seconddev.chapanda.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.weaver.framework.spring.annotation.AopClass;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
import com.weaver.seconddev.chapanda.mapper.DemoMapper;
|
||||
import com.weaver.seconddev.chapanda.service.MybatisDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* db最佳实践
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Service
|
||||
@AopClass
|
||||
public class MybatisDemoServiceImpl extends ServiceImpl<DemoMapper, DemoPO> implements MybatisDemoService {
|
||||
@Autowired
|
||||
private DemoMapper demoMapper;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
package com.weaver.seconddev.chapanda.service.impl;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.weaver.common.component.form.WeaForm;
|
||||
import com.weaver.common.component.search.WeaSearchCondition;
|
||||
import com.weaver.common.component.table.WeaTable;
|
||||
import com.weaver.common.component.table.page.Page;
|
||||
import com.weaver.ebuilder.datasource.api.entity.ExecuteSqlEntity;
|
||||
import com.weaver.ebuilder.datasource.api.enums.SourceType;
|
||||
import com.weaver.ebuilder.datasource.api.service.DataSetService;
|
||||
import com.weaver.framework.spring.annotation.AopClass;
|
||||
import com.weaver.seconddev.chapanda.common.SqlResponse;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoFormDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoSearchConditionDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.OrderTypeListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.param.DemoQueryParam;
|
||||
import com.weaver.seconddev.chapanda.entity.param.OrderTypeQueryParam;
|
||||
import com.weaver.seconddev.chapanda.enums.SQLStatusEnum;
|
||||
import com.weaver.seconddev.chapanda.exception.BusinessRunTimeException;
|
||||
import com.weaver.seconddev.chapanda.exception.SqlRunTimeException;
|
||||
import com.weaver.seconddev.chapanda.mapper.DemoMapper;
|
||||
import com.weaver.seconddev.chapanda.service.PageDemoService;
|
||||
import com.weaver.seconddev.chapanda.util.EntityUtil;
|
||||
import com.weaver.seconddev.chapanda.util.FormatUtil;
|
||||
import com.weaver.seconddev.chapanda.util.PageUtil;
|
||||
import com.weaver.teams.security.context.TenantContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@AopClass
|
||||
@Slf4j
|
||||
public class PageDemoServiceImpl implements PageDemoService {
|
||||
|
||||
@Autowired
|
||||
private DataSetService dataSetService;
|
||||
|
||||
@Autowired
|
||||
private DemoMapper demoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public WeaSearchCondition getSearchCondition() {
|
||||
WeaSearchCondition weaSearchCondition = FormatUtil.<DemoSearchConditionDTO>getInstance()
|
||||
.buildCondition(DemoSearchConditionDTO.class, new DemoSearchConditionDTO(), "demoPage_SearchCondition");
|
||||
return weaSearchCondition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaTable<DemoListDTO> list(DemoQueryParam queryParam) {
|
||||
|
||||
String sql = "select t.id,t.bt,cjrq,fqr,bm,wtms,wd,ebllk,e.username,d.name as bmName,x.mc as gdlxname from uf_gdjcxx t " +
|
||||
"LEFT JOIN eteams.EMPLOYEE e ON e.id = t.fqr " +
|
||||
"LEFT JOIN eteams.DEPARTMENT d ON d.id = e.department " +
|
||||
"LEFT JOIN uf_gdlx x ON t.gdlx = x.id " +
|
||||
"where t.TENANT_KEY = 'tma3ktp1q7' ";
|
||||
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(Base64.encode(sql));
|
||||
executeSqlEntity.setGroupId("weaver-ebuilder-app-service");
|
||||
executeSqlEntity.setSourceType(SourceType.LOGIC);
|
||||
|
||||
Map<String, Object> map = dataSetService.executeSql(executeSqlEntity);
|
||||
SqlResponse<DemoListDTO> sqlResponse = EntityUtil.map2Entity(map, DemoListDTO.class);
|
||||
if (SQLStatusEnum.FAIL.getValue().equals(sqlResponse.getStatus())) {
|
||||
throw new SqlRunTimeException(sqlResponse.getMessage());
|
||||
}
|
||||
List<DemoListDTO> list = sqlResponse.getRecords();
|
||||
|
||||
Page<DemoListDTO> page = PageUtil.buildPage(list, queryParam.getCurrent(), queryParam.getPageSize());
|
||||
WeaTable<DemoListDTO> table = FormatUtil.<DemoListDTO>getInstance().buildTable(DemoListDTO.class, page);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<OrderTypeListDTO> orderTypePage(OrderTypeQueryParam queryParam) {
|
||||
|
||||
String sql = "select t.id,t.mc from uf_gdlx t where t.TENANT_KEY = 'tma3ktp1q7' ";
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(Base64.encode(sql));
|
||||
executeSqlEntity.setGroupId("weaver-ebuilder-app-service");
|
||||
executeSqlEntity.setSourceType(SourceType.LOGIC);
|
||||
|
||||
Map<String, Object> map = dataSetService.executeSql(executeSqlEntity);
|
||||
SqlResponse<OrderTypeListDTO> sqlResponse = EntityUtil.map2Entity(map, OrderTypeListDTO.class);
|
||||
if (SQLStatusEnum.FAIL.getValue().equals(sqlResponse.getStatus())) {
|
||||
throw new SqlRunTimeException(sqlResponse.getMessage());
|
||||
}
|
||||
List<OrderTypeListDTO> list = sqlResponse.getRecords();
|
||||
|
||||
Page<OrderTypeListDTO> page = PageUtil.buildPage(list, queryParam.getCurrent(), queryParam.getPageSize());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaForm getForm(Long id) {
|
||||
DemoFormDTO dataFormDTO = new DemoFormDTO();
|
||||
if (id != null) {
|
||||
dataFormDTO = demoMapper.getDemoListDTO(id, TenantContext.getCurrentTenantKey());
|
||||
|
||||
if (dataFormDTO == null) {
|
||||
throw new BusinessRunTimeException("数据不存在!");
|
||||
}
|
||||
}
|
||||
|
||||
WeaForm weaForm = FormatUtil.<DemoFormDTO>getInstance().buildForm(DemoFormDTO.class, dataFormDTO);
|
||||
|
||||
return weaForm;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +1,13 @@
|
|||
package com.weaver.seconddev.chapanda.trigger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.weaver.common.distribution.genid.IdGenerator;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqOperation;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqOperationInfo;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataUpdateType;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.AttendStatusDetailDTO;
|
||||
import com.weaver.seconddev.chapanda.mapper.AttendStatusDetailMapper;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.logging.log4j.util.Base64Util;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.weaver.common.cache.tablecache.impl.ComInfoCache;
|
||||
import com.weaver.common.distribution.genid.IdGenerator;
|
||||
import com.weaver.common.escheduler.context.ESchedulerJobHelper;
|
||||
import com.weaver.common.escheduler.handler.annotation.ESchedulerHandler;
|
||||
import com.weaver.common.hrm.cache.HrmEmployeeComInfo;
|
||||
|
|
@ -35,8 +17,9 @@ import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
|||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqHeader;
|
||||
import com.weaver.ebuilder.form.client.entity.field.FieldsQueryDto;
|
||||
import com.weaver.ebuilder.form.client.entity.field.ModuleField;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqOperation;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqOperationInfo;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataUpdateType;
|
||||
import com.weaver.ebuilder.form.client.service.data.RemoteSimpleDataService;
|
||||
import com.weaver.ebuilder.form.client.service.emobile.IEtFormDatasetService;
|
||||
import com.weaver.ebuilder.teams.etform.base.query.ConditionTreeDto;
|
||||
|
|
@ -44,6 +27,26 @@ import com.weaver.ebuilder.teams.etform.base.query.Query;
|
|||
import com.weaver.ebuilder.teams.etform.org.bean.EBSimpleEmployee;
|
||||
import com.weaver.framework.util.JsonUtil;
|
||||
import com.weaver.publishkit.api.util.PublishKitRuntimeUtil;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.AttendStatusDetailDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.po.EbFieldInfo;
|
||||
import com.weaver.seconddev.chapanda.mapper.AttendStatusDetailMapper;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import com.weaver.seconddev.portal.util.PapiUtil;
|
||||
import com.weaver.teams.client.utils.HttpUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.logging.log4j.util.Base64Util;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 监控考勤规则变动,存在变动的写入eb台账表
|
||||
|
|
@ -63,21 +66,24 @@ public class AttendConfChangeEscheduler {
|
|||
|
||||
@Value("#{'${attend.opensyncEbTable.tenantKey:tk9x0xdor1}'.split(',')}")
|
||||
private List<String> tenantKeyList;
|
||||
//eb表id
|
||||
@Value("#{'${attend.opensyncEbTable.objId}'}")
|
||||
private String objId;
|
||||
@Value("#{'${attend.opensyncEbTable.operatorId}'}")
|
||||
private String operatorId;
|
||||
|
||||
/**
|
||||
* value: 考勤规则同步eb表单 cron: cron表达式自定义执行时间
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ESchedulerHandler(value = "AttendConfChangeEscheduler", cron = "0/10 * * * * ?")
|
||||
@ESchedulerHandler(value = "AttendConfChangeEscheduler")
|
||||
public void demoJobHandler() throws Exception {
|
||||
log.error("AttendConfChangeEscheduler runnint");
|
||||
try {
|
||||
|
||||
// 获取页面上配置的任务参数
|
||||
final String jobParam = ESchedulerJobHelper.getJobParam();
|
||||
// eb表单id,eb表单姓名字段fieldId,eb表单是否生效中字段fieldId,操作人id
|
||||
String[] jobParamSplit = jobParam.split(",");
|
||||
Date preDayDate =
|
||||
TimeUtils.getString2Date(TimeUtils.dateAdd(TimeUtils.getCurrentTimeString(), -1), "yyyy-MM-dd");
|
||||
|
||||
|
|
@ -88,36 +94,40 @@ public class AttendConfChangeEscheduler {
|
|||
// 开启此功能的租户
|
||||
for (String tenantKey : tenantKeyList) {
|
||||
// 不同租户eb表字段对应的id
|
||||
Map<String, String> fieldMap = extracted(jobParamSplit, iEtFormDatasetService, tenantKey, jobParamSplit[1]);
|
||||
log.error("AttendConfChangeEscheduler-fieldMap:{}", JSON.toJSONString(fieldMap));
|
||||
|
||||
// 查询昨天人员对应的考勤规则与eb台账最新的生效考勤规则对比
|
||||
try {
|
||||
Map<String, String> fieldMap = getEbFieldMap(iEtFormDatasetService, tenantKey);
|
||||
log.error("AttendConfChangeEscheduler-fieldMap:{}", JSON.toJSONString(fieldMap));
|
||||
|
||||
// 查询昨天人员对应的考勤规则与eb台账最新的生效考勤规则对比
|
||||
EBDataChangeReqDto ebReqDto = new EBDataChangeReqDto();
|
||||
ebReqDto.setHeader(new EBDataReqHeader(jobParamSplit[0], jobParamSplit[1], tenantKey));
|
||||
ebReqDto.setHeader(new EBDataReqHeader(objId, operatorId, tenantKey));
|
||||
|
||||
List<AttendStatusDetailDTO> statusDetailDtos =
|
||||
attendStatusDetailMapper.selectByCondition(tenantKey, preDayDate, 0, null);
|
||||
//查询昨天生成的考勤明细数据,里面有对应的考勤规则
|
||||
for (AttendStatusDetailDTO statusDetailDto : statusDetailDtos) {
|
||||
if (statusDetailDto.getAttendConfig() == null) {
|
||||
continue;
|
||||
}
|
||||
List<Map<String, Object>> oldAttendRuleEbList = queryResult(iEtFormDatasetService,
|
||||
statusDetailDto.getEmployee(), tenantKey, jobParamSplit, fieldMap, true);
|
||||
statusDetailDto.getEmployee(), tenantKey, fieldMap, true);
|
||||
ArrayList<EBDataReqDto> insertDataReqDtos = new ArrayList<>();
|
||||
EBDataReqDto InsertEbDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData1 = new ArrayList<>();
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("xm"),
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("姓名"),
|
||||
String.valueOf(statusDetailDto.getEmployee())));
|
||||
HrmEmployeeComInfo hrmEmployeeInfo =
|
||||
comInfoCache.getCacheById(HrmEmployeeComInfo.class, statusDetailDto.getEmployee());
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("fb"),
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("分部"),
|
||||
String.valueOf(hrmEmployeeInfo.getSubcompanyId())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("bm"),
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("部门"),
|
||||
String.valueOf(hrmEmployeeInfo.getDepartment())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("bdrq"),
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("变动日期"),
|
||||
DateUtil.format(preDayDate, "yyyy-MM-dd")));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("sxkqgz"),
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("生效考勤规则"),
|
||||
String.valueOf(statusDetailDto.getAttendConfig())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("sfsxz"), "0"));
|
||||
//有历史数据
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("是否生效中"), "0"));
|
||||
//没有历史数据
|
||||
if (CollectionUtils.isEmpty(oldAttendRuleEbList)) {
|
||||
// mainData1.add(new EBDataReqDetailDto(fieldMap.get("shxkqgz"), String.valueOf(statusDetailDto.getAttendConfig())));
|
||||
InsertEbDataReqDto.setMainDatas(mainData1);
|
||||
|
|
@ -129,10 +139,12 @@ public class AttendConfChangeEscheduler {
|
|||
Map<String, Object> oldAttendRuleEb = oldAttendRuleEbList.get(0);
|
||||
// 生效考勤规则变动,失效之前的考勤规则,并新增一条记录
|
||||
ArrayList<Map<String, Object>> sxkqgz =
|
||||
(ArrayList<Map<String, Object>>) oldAttendRuleEb.get(fieldMap.get("sxkqgz"));
|
||||
(ArrayList<Map<String, Object>>) oldAttendRuleEb.get(fieldMap.get("生效考勤规则"));
|
||||
Map<String, Object> sxkqgzMap = sxkqgz.get(0);
|
||||
log.error("AttendConfChangeEscheduler-sxkqgzMap:{}", JSON.toJSONString(sxkqgzMap));
|
||||
log.error("AttendConfChangeEscheduler-statusDetailDto:{}", JSON.toJSONString(statusDetailDto));
|
||||
if (!String.valueOf(statusDetailDto.getAttendConfig()).equals(sxkqgzMap.get("id"))) {
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("shxkqgz"), (String) sxkqgzMap.get("id")));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("生效考勤规则"), (String) sxkqgzMap.get("id")));
|
||||
InsertEbDataReqDto.setMainDatas(mainData1);
|
||||
insertDataReqDtos.add(InsertEbDataReqDto);
|
||||
// 失效老数据
|
||||
|
|
@ -176,7 +188,7 @@ public class AttendConfChangeEscheduler {
|
|||
// 数据
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<>();
|
||||
mainData.add(new EBDataReqDetailDto(fieldMap.get("sfsxz"), "1"));
|
||||
mainData.add(new EBDataReqDetailDto(fieldMap.get("是否生效中"), "1"));
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
ebReqDto.setDatas(Collections.singletonList(ebDataReqDto));
|
||||
EBDataChangeResult ebDataChangeResult = remoteSimpleDataService.updateFormData(ebReqDto);
|
||||
|
|
@ -185,25 +197,38 @@ public class AttendConfChangeEscheduler {
|
|||
}
|
||||
}
|
||||
|
||||
private static Map<String, String> extracted(String[] jobParamSplit, IEtFormDatasetService iEtFormDatasetService,
|
||||
String tenantKey, String userId) {
|
||||
private Map<String, String> getEbFieldMap(IEtFormDatasetService iEtFormDatasetService,
|
||||
String tenantKey) throws JsonProcessingException {
|
||||
Map<String, String> fieldMap = new HashMap<>();
|
||||
EBSimpleEmployee ebSimpleEmployee = new EBSimpleEmployee();
|
||||
ebSimpleEmployee.setEmployeeId(userId);
|
||||
ebSimpleEmployee.setTenantKey(tenantKey);
|
||||
FieldsQueryDto fieldsQueryDto = new FieldsQueryDto();
|
||||
fieldsQueryDto.setEbSimpleEmployee(ebSimpleEmployee);
|
||||
fieldsQueryDto.setObjId(Long.valueOf(jobParamSplit[0]));
|
||||
List<ModuleField> fields = iEtFormDatasetService.getFields(fieldsQueryDto);
|
||||
log.error("ModuleField:{}", JSON.toJSONString(fields));
|
||||
fields.stream().forEach(item -> {
|
||||
fieldMap.put(item.getDataKey(), item.getFieldId());
|
||||
// EBSimpleEmployee ebSimpleEmployee = new EBSimpleEmployee();
|
||||
// ebSimpleEmployee.setEmployeeId(operatorId);
|
||||
// ebSimpleEmployee.setTenantKey(tenantKey);
|
||||
// FieldsQueryDto fieldsQueryDto = new FieldsQueryDto();
|
||||
// fieldsQueryDto.setEbSimpleEmployee(ebSimpleEmployee);
|
||||
// fieldsQueryDto.setObjId(Long.valueOf(objId));
|
||||
// fieldsQueryDto.setNeedChild(false);
|
||||
// List<ModuleField> fields = iEtFormDatasetService.getFields(fieldsQueryDto);
|
||||
String url = ApplicationConfigConstant.APP_URL + "/papi/openapi/api/ebuilder/form/dataset/v1/getFields";
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "A1a");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
HashMap<String, Object> requestMap = new HashMap<>();
|
||||
requestMap.put("access_token", papiToken);
|
||||
requestMap.put("userid", operatorId);
|
||||
requestMap.put("objId", objId);
|
||||
|
||||
String result = HttpUtils.httpJsonPost(url, JSON.toJSONString(requestMap));
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
EbFieldInfo ebFieldInfo = mapper.readValue(result, EbFieldInfo.class);
|
||||
log.error("ModuleField:{}", JSON.toJSONString(ebFieldInfo));
|
||||
List<EbFieldInfo.Field> mainFields = ebFieldInfo.getData().getMainFields();
|
||||
mainFields.stream().forEach(item -> {
|
||||
fieldMap.put(item.getFieldName(), item.getFieldId());
|
||||
});
|
||||
return fieldMap;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryResult(IEtFormDatasetService iEtFormDatasetService, Long userId,
|
||||
String tenantKey, String[] paramSplit, Map<String, String> fieldMap, boolean schedulerSource) {
|
||||
String tenantKey, Map<String, String> fieldMap, boolean schedulerSource) {
|
||||
List<Map<String, Object>> records = new ArrayList<>();
|
||||
try {
|
||||
Query query = new Query();
|
||||
|
|
@ -230,23 +255,23 @@ public class AttendConfChangeEscheduler {
|
|||
|
||||
ConditionTreeDto leaf4Node = new ConditionTreeDto();
|
||||
leaf4Node.setCompareType("eq");
|
||||
leaf4Node.setConditionId(fieldMap.get("xm"));
|
||||
leaf4Node.setConditionId(fieldMap.get("姓名"));
|
||||
leaf4Node.setConditionType("employee");
|
||||
leaf4Node.setConditionValue(userId.toString());
|
||||
leaf4Node.setIsParent(false);
|
||||
leaf4Node.setKey(String.valueOf(IdGenerator.generate()));
|
||||
leaf4Node.setObjId(paramSplit[0]);
|
||||
leaf4Node.setObjId(objId);
|
||||
leaf4Node.setParentNode(leaf1Node.getKey());
|
||||
leaf1Node.getConditionList().add(leaf4Node);
|
||||
|
||||
ConditionTreeDto leaf5Node = new ConditionTreeDto();
|
||||
leaf5Node.setCompareType("eq");
|
||||
leaf5Node.setConditionId(fieldMap.get("sfsxz"));
|
||||
leaf5Node.setConditionId(fieldMap.get("是否生效中"));
|
||||
leaf5Node.setConditionType("Select");
|
||||
leaf5Node.setConditionValue("0");
|
||||
leaf5Node.setIsParent(false);
|
||||
leaf5Node.setKey(String.valueOf(IdGenerator.generate()));
|
||||
leaf5Node.setObjId(paramSplit[0]);
|
||||
leaf5Node.setObjId(objId);
|
||||
leaf5Node.setParentNode(leaf1Node.getKey());
|
||||
leaf1Node.getConditionList().add(leaf5Node);
|
||||
|
||||
|
|
@ -262,7 +287,7 @@ public class AttendConfChangeEscheduler {
|
|||
}
|
||||
String encodeStr = Base64Util.encode(JsonUtil.toJsonString(query));
|
||||
Map<String, Object> ebFormDataMap =
|
||||
iEtFormDatasetService.getDatas(Long.valueOf(paramSplit[0]), "", encodeStr, null);
|
||||
iEtFormDatasetService.getDatas(Long.valueOf(objId), "", encodeStr, null);
|
||||
if (ebFormDataMap != null && ebFormDataMap.size() > 0) {
|
||||
if (ebFormDataMap.containsKey("list")) {
|
||||
records = (List<Map<String, Object>>) ebFormDataMap.getOrDefault("list", Collections.emptyList());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,172 @@
|
|||
package com.weaver.seconddev.chapanda.trigger;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.weaver.common.cache.tablecache.impl.ComInfoCache;
|
||||
import com.weaver.common.escheduler.context.ESchedulerJobHelper;
|
||||
import com.weaver.common.escheduler.handler.annotation.ESchedulerHandler;
|
||||
import com.weaver.common.hrm.cache.HrmDepartmentComInfo;
|
||||
import com.weaver.common.hrm.cache.HrmEmployeeComInfo;
|
||||
import com.weaver.eb.common.util.TimeUtils;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeReqDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqHeader;
|
||||
import com.weaver.ebuilder.form.client.service.data.RemoteSimpleDataService;
|
||||
import com.weaver.publishkit.api.util.PublishKitRuntimeUtil;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.AttendStatusDetailDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.RecordDetailDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.po.EbFieldInfo;
|
||||
import com.weaver.seconddev.chapanda.mapper.AttendStatusDetailMapper;
|
||||
import com.weaver.seconddev.chapanda.mapper.RecordDetailMapper;
|
||||
import com.weaver.seconddev.portal.constant.ApplicationConfigConstant;
|
||||
import com.weaver.seconddev.portal.util.PapiUtil;
|
||||
import com.weaver.teams.client.utils.HttpUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 监控考勤规则变动,存在变动的写入eb台账表
|
||||
*/
|
||||
@Service
|
||||
public class AttendConfChangeToEBJob {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(AttendConfChangeToEBJob.class);
|
||||
|
||||
@Autowired
|
||||
private AttendStatusDetailMapper attendStatusDetailMapper;
|
||||
@Autowired
|
||||
private RecordDetailMapper recordDetailMapper;
|
||||
|
||||
@Autowired
|
||||
private ComInfoCache comInfoCache;
|
||||
@Autowired
|
||||
private PublishKitRuntimeUtil publishKitRuntimeUtil;
|
||||
|
||||
@Value("#{'${attend.opensyncEbTable.tenantKey:t024j0gfn0}'.split(',')}")
|
||||
private List<String> tenantKeyList;
|
||||
//eb表id
|
||||
@Value("#{'${attend.opensyncEbTable.objId}'}")
|
||||
private String objId;
|
||||
@Value("#{'${attend.opensyncEbTable.operatorId}'}")
|
||||
private String operatorId;
|
||||
|
||||
/**
|
||||
* value: 考勤规则同步eb表单 cron: cron表达式自定义执行时间
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ESchedulerHandler(value = "AttendConfChangeToEBJob", cron = "0/10 * 2 * * ?")
|
||||
public void demoJobHandler() throws Exception {
|
||||
log.error("AttendConfChangeToEBJob runnint");
|
||||
|
||||
// 获取页面上配置的任务参数
|
||||
final String jobParam = ESchedulerJobHelper.getJobParam();
|
||||
int dateAdd = -30;
|
||||
if (StringUtils.isNotEmpty(jobParam)) {
|
||||
dateAdd = Integer.parseInt(jobParam);
|
||||
}
|
||||
Date preDayDate = TimeUtils.getString2Date(TimeUtils.dateAdd(TimeUtils.getCurrentTimeString(), dateAdd), "yyyy-MM-dd");
|
||||
Date currentDate = TimeUtils.getString2Date(TimeUtils.getCurrentDateString(), "yyyy-MM-dd");
|
||||
|
||||
RemoteSimpleDataService remoteSimpleDataService = publishKitRuntimeUtil.buildRpcService(RemoteSimpleDataService.class, "ebuilderform", "defaultAppId");
|
||||
// 开启此功能的租户
|
||||
for (String tenantKey : tenantKeyList) {
|
||||
// 不同租户eb表字段对应的id
|
||||
try {
|
||||
Map<String, String> fieldMap = getEbFieldMap();
|
||||
log.error("AttendConfChangeEscheduler-fieldMap:{}", JSON.toJSONString(fieldMap));
|
||||
//ebb表单操作初始化
|
||||
EBDataChangeReqDto ebReqDto = new EBDataChangeReqDto();
|
||||
ebReqDto.setHeader(new EBDataReqHeader(objId, operatorId, tenantKey));
|
||||
//区间内有考勤数据的所有人员
|
||||
List<AttendStatusDetailDTO> employeeIds = attendStatusDetailMapper.getAllEmployeeBy(tenantKey, preDayDate, currentDate, null);
|
||||
List<Long> collect = employeeIds.stream().map(AttendStatusDetailDTO::getEmployee).collect(Collectors.toList());
|
||||
log.error("AttendConfChangeEscheduler-employeeIds:{}", JSON.toJSONString(collect));
|
||||
//遍历人员
|
||||
for (AttendStatusDetailDTO employee : employeeIds) {
|
||||
Long employeeId = employee.getEmployee();
|
||||
Long lastAttendConfig = 0l;
|
||||
//人员每天生成的对应的考勤规则
|
||||
List<AttendStatusDetailDTO> everyDayDetail = attendStatusDetailMapper.everyDayByEmp(employeeId, preDayDate, currentDate, null);
|
||||
log.error("AttendConfChangeEscheduler-everyDayDetail:{}", JSON.toJSONString(everyDayDetail));
|
||||
for (AttendStatusDetailDTO attendStatusDetail : everyDayDetail) {
|
||||
if (lastAttendConfig != attendStatusDetail.getAttendConfig()) {
|
||||
//查询早于考勤日期的最早的考勤变更记录,考勤规则是否改变
|
||||
//改变了,插入新的,没改变则不做操作
|
||||
RecordDetailDTO lastChangeRecord = recordDetailMapper.lastChangeRecord(employeeId, attendStatusDetail.getAttendDate(), null);
|
||||
log.error("AttendConfChangeEscheduler-lastChangeRecord:{}", JSON.toJSONString(lastChangeRecord));
|
||||
if (lastChangeRecord == null || !lastChangeRecord.getSxkqgz().equals(String.valueOf(attendStatusDetail.getAttendConfig()))) {
|
||||
ArrayList<EBDataReqDto> insertDataReqDtos = new ArrayList<>();
|
||||
EBDataReqDto insertEbDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData1 = new ArrayList<>();
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("姓名"), String.valueOf(employeeId)));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("考勤规则"), String.valueOf(attendStatusDetail.getAttendConfig())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("生效日期"), DateUtil.format(attendStatusDetail.getAttendDate(), "yyyy-MM-dd")));
|
||||
//查询变动后的人员工作信息
|
||||
RecordDetailDTO empChange = recordDetailMapper.getEmpChange(employeeId, attendStatusDetail.getAttendDate(), null);
|
||||
log.error("AttendConfChangeEscheduler-empChange:{}", JSON.toJSONString(empChange));
|
||||
if (empChange == null) {
|
||||
HrmEmployeeComInfo hrmEmployeeInfo = comInfoCache.getCacheById(HrmEmployeeComInfo.class, employeeId);
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("所在分部"), String.valueOf(hrmEmployeeInfo.getSubcompanyId())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("所在部门"), String.valueOf(hrmEmployeeInfo.getDepartment())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("所属岗位"), String.valueOf(hrmEmployeeInfo.getPosition())));
|
||||
// mainData1.add(new EBDataReqDetailDto(fieldMap.get("生效日期"), DateUtil.format(hrmEmployeeInfo.getHireDate(), "yyyy-MM-dd")));
|
||||
} else {
|
||||
HrmDepartmentComInfo departmentInfo = comInfoCache.getCacheById(HrmDepartmentComInfo.class, empChange.getOldDepartment());
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("所在分部"), String.valueOf(departmentInfo.getSubcompanyid())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("所在部门"), String.valueOf(empChange.getOldDepartment())));
|
||||
mainData1.add(new EBDataReqDetailDto(fieldMap.get("所属岗位"), String.valueOf(empChange.getOldPosition())));
|
||||
}
|
||||
insertEbDataReqDto.setMainDatas(mainData1);
|
||||
insertDataReqDtos.add(insertEbDataReqDto);
|
||||
ebReqDto.setDatas(insertDataReqDtos);
|
||||
EBDataChangeResult ebDataChangeResult = remoteSimpleDataService.saveFormData(ebReqDto);
|
||||
log.error("AttendConfChangeEscheduler-ebDataChangeResult:{}", JSON.toJSONString(ebDataChangeResult));
|
||||
}
|
||||
}
|
||||
lastAttendConfig = attendStatusDetail.getAttendConfig();
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("AttendConfChangeEscheduler-e-", e);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> getEbFieldMap() throws JsonProcessingException {
|
||||
Map<String, String> fieldMap = new HashMap<>();
|
||||
String url = ApplicationConfigConstant.APP_URL + "/papi/openapi/api/ebuilder/form/dataset/v1/getFields";
|
||||
String papiCode = PapiUtil.getPapiCode(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.CORP_ID, "A1a");
|
||||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
HashMap<String, Object> requestMap = new HashMap<>();
|
||||
requestMap.put("access_token", papiToken);
|
||||
requestMap.put("userid", operatorId);
|
||||
requestMap.put("objId", objId);
|
||||
|
||||
String result = HttpUtils.httpJsonPost(url, JSON.toJSONString(requestMap));
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
EbFieldInfo ebFieldInfo = mapper.readValue(result, EbFieldInfo.class);
|
||||
List<EbFieldInfo.Field> mainFields = ebFieldInfo.getData().getMainFields();
|
||||
mainFields.stream().forEach(item -> {
|
||||
fieldMap.put(item.getFieldName(), item.getFieldId());
|
||||
});
|
||||
return fieldMap;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue