Commit 25de81c6 authored by hongguangwu's avatar hongguangwu

MVP1.7.16-合同编码

parent 26b366b0
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -57,6 +58,7 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "合同类型,标准合同/劳务协议/实习协议/劳务派遣合同/非全日制/其他合同")
private String contractType;
@ExcelAttribute(name = "签署方式", isDataId = true, readConverterExp = "0=待确认,1=待发起,2=线下签待审核,3=线下签审核不通过4=线下签待归档5=发起失败6=签署中7=签署失败8=电子待归档9=已完结10=撤销签署")
@Schema(description = "状态,0待确认,1待发起,2线下签待审核,3线下签审核不通过4线下签待归档5发起失败6签署中7签署失败8电子待归档9已完结10撤销签署")
private String processStatus;
......@@ -69,9 +71,11 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "前端客服登录名")
private String customerUserLoginname;
@ExcelAttribute(name = "签署方式", isDataId = true, readConverterExp = "0=电子签,1=线下签")
@Schema(description = "签署方式1线下签0电子签")
private String signType;
@ExcelAttribute(name = "是否撤销签署", isDataId = true, readConverterExp = "0=是,1=否")
@Schema(description = "是否撤销签署0是1否")
private String signFlag;
......@@ -97,6 +101,7 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "电子签转线下签操作时间")
private Date changeTypeTime;
@ExcelAttribute(name = "是否已建档", isDataId = true, readConverterExp = "0=是,1=否")
@Schema(description = "是否已建档 0是 1否")
private String archivesIsCreate;
......@@ -129,6 +134,7 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "签订类型")
private String situation;
@ExcelAttribute(name = "签订期限", isDataId = true, readConverterExp = "0=已完成一定工作任务为期限,1=固定期限,2=无固定期限")
@Schema(description = "签订期限 0已完成一定工作任务为期限、1固定期限、2无固定期限")
private String contractTerm;
......@@ -151,6 +157,7 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "工作任务")
private String task;
@ExcelAttribute(name = "任务类型", isDataId = true, readConverterExp = "0=不同员工不同任务自定义,1=所有员工任务相同")
@Schema(description = "任务类型: 0 不同员工不同任务自定义 1 所有员工任务相同")
private String taskType;
......@@ -160,15 +167,18 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "配置名称")
private String configName;
@ExcelAttribute(name = "是否允许修改", isDataId = true, readConverterExp = "0=是,1=否")
@Schema(description = "是否允许修改 0是 1否")
private String updateFlag;
@ExcelAttribute(name = "是否有试用期", isDataId = true, readConverterExp = "0=是,1=否")
@Schema(description = "是否有试用期 0是1否")
private String tryPeriodType;
@Schema(description = "试用期(单位月)")
private String tryPeriod;
@ExcelAttribute(name = "工资形式", isDataId = true, readConverterExp = "1=计时工资,2=计件工资,3=其他")
@Schema(description = "工资形式 1.计时工资 2.计件工资 3.其他")
private String salaryType;
......@@ -187,6 +197,7 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "用工单位名称")
private String workingCompany;
@ExcelAttribute(name = "工时制", isDataId = true, readConverterExp = "1=标准工时,2=综合工时,3=不定时工时制")
@Schema(description = "工时制(数据字典) 1标准工时 2 综合工时 3不定时工时制")
private String workingHours;
......@@ -214,6 +225,7 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "工资发放时间")
private String paymentTime;
@ExcelAttribute(name = "工资发放方式", isDataId = true, readConverterExp = "0=直接发放,1=委托银行代发")
@Schema(description = "工资发放方式 0 直接发放/1委托银行代发")
private String paymentType;
......@@ -231,6 +243,7 @@ public class TEmployeeContractPre extends BaseEntity {
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Date dispatchPeriodEnd;
@ExcelAttribute(name = "工作方式", isDataId = true, readConverterExp = "0=第一种方式,1=第二种方式")
@Schema(description = "工作方式 0 第一种方式 1 第二种方式")
private String workType;
......@@ -257,15 +270,20 @@ public class TEmployeeContractPre extends BaseEntity {
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Date internshipPeriodEnd;
@ExcelAttribute(name = "合同岗位", isDataId = true, readConverterExp = "0=固定岗位,1=等于档案处维护,2=自定义")
@Schema(description = "合同岗位 0 固定岗位 1 等于档案处维护 2 自定义")
private String postType;
@ExcelAttribute(name = "入职确认选择", isDataId = true, readConverterExp = "0=配置方案内选择,1=自定义,2=配置方案+自定义")
@Schema(description = "入职确认选择 0 配置方案内选择、1 自定义 2 配置方案+自定义")
private String confirmEmpSelect;
@ExcelAttribute(name = "超时未确认是否触发签署任务", isDataId = true, readConverterExp = "0=自动触发,1=不触发")
@Schema(description = "超时未确认是否触发签署任务(电子签) 0 自动触发 1 不触发")
private String timeoutElecSign;
@ExcelAttribute(name = "合同截止日期类型", isDataId = true, readConverterExp = "0=合同年限推算,1=同商务合同一致,2=已完成固定工作位期限")
@Schema(description = "合同截止日期类型 0合同年限推算/1同商务合同一致/2已完成固定工作位期限")
private String contractEndType;
......@@ -281,9 +299,11 @@ public class TEmployeeContractPre extends BaseEntity {
@Schema(description = "入离职登记主表id")
private String registerId;
@ExcelAttribute(name = "是否已签署合同", isDataId = true, readConverterExp = "0=是,1=否")
@Schema(description = "是否已签署合同 0是1否")
private String contractFlag;
@ExcelAttribute(name = "新合同发起时间", isDataId = true, readConverterExp = "0=入职日期,3=入职3天后,7=入职1周后,14=入职2周后,21=入职3周后")
@Schema(description = "新合同发起时间 入职日期 0、入职3天后 3、入职1周后 7、入职2周后 14、入职3周后 21")
@TableField(exist = false)
private String registType;
......@@ -300,6 +320,7 @@ public class TEmployeeContractPre extends BaseEntity {
@TableField(exist = false)
private List<TAttaInfo> attaList;
@ExcelAttribute(name = "超期标识", isDataId = true, readConverterExp = "0=已超期,1=未超期")
@Schema(description = "超期标识 0已超期 1未超期")
private String overFlag;
......
......@@ -20,13 +20,13 @@ import com.fasc.open.api.v5_1.res.service.AccessTokenRes;
import com.fasc.open.api.v5_1.res.signtask.CreateSignTaskRes;
import com.fasc.open.api.v5_1.res.signtask.SignTaskGetFileRes;
import com.fasc.open.api.v5_1.res.template.*;
import com.yifu.cloud.plus.v1.yifu.archives.config.FascConfig;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascPushLogService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -443,9 +443,9 @@ public class FascUtil {
// 转化字段
fieldName = detail.getHrFieldId();
if (FascConstants.CONTRACT_DURATION.equals(fieldName)) {
fieldValue = contract.getContractDurationYear() + CommonConstants.DOWN_LINE_STRING + contract.getContractDurationMonth();
fieldValue = contract.getContractDurationYear() + CommonConstants.CENTER_SPLIT_LINE_STRING + contract.getContractDurationMonth();
} else if (FascConstants.DISPATCH_PERIOD.equals(fieldName)) {
fieldValue = contract.getDispatchPeriodYear() + CommonConstants.DOWN_LINE_STRING + contract.getDispatchPeriodMonth();
fieldValue = contract.getDispatchPeriodYear() + CommonConstants.CENTER_SPLIT_LINE_STRING + contract.getDispatchPeriodMonth();
} else {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName);
}
......@@ -480,6 +480,7 @@ public class FascUtil {
/**
* 使用反射根据字段名获取合同对象中对应字段的值
*
* @param contract 合同对象
* @param fieldName 字段名
* @return 字段值
......@@ -496,8 +497,9 @@ public class FascUtil {
// 获取方法并调用
java.lang.reflect.Method method = contract.getClass().getMethod(getterMethodName);
Object value = method.invoke(contract);
return value != null ? value.toString() : null;
String valueStr = String.valueOf(value);
valueStr = this.getCoverValue(contract, fieldName, valueStr);
return valueStr;
} catch (Exception e) {
// 如果找不到对应的方法,尝试直接匹配字段名
try {
......@@ -511,6 +513,46 @@ public class FascUtil {
}
}
// 翻译字典
private String getCoverValue(TEmployeeContractPre contract, String fieldName, String valueStr) throws NoSuchFieldException {
if (Common.isNotNull(valueStr) && isInteger(valueStr)) {
java.lang.reflect.Field field = contract.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
// 检查ExcelAttribute注解
ExcelAttribute excelAnnotation = field.getAnnotation(ExcelAttribute.class);
if (excelAnnotation != null && excelAnnotation.isDataId()) {
String converterExp = excelAnnotation.readConverterExp();
if (converterExp != null && !converterExp.isEmpty()) {
valueStr = convertByExp(converterExp, valueStr);
}
}
}
return valueStr;
}
/**
* 根据转换表达式翻译值
*/
private static String convertByExp(String converterExp, String value) {
if (converterExp == null || value == null) {
return value;
}
String[] items = converterExp.split(",");
String[] keyValue;
for (String item : items) {
keyValue = item.split("=");
if (keyValue.length == 2 && keyValue[0].trim().equals(value.trim())) {
return keyValue[1].trim();
}
}
return value; // 如果没有找到匹配的,返回原值
}
private boolean isInteger(String value) {
// 允许正负整数,不允许前导0(除了0本身)
return value != null && value.matches("^(-?[1-9]\\d*|0)$");
}
// 第三步:提交任务
private R<String> submitTask(String requestId, OpenApiClient openApiClient, String accessToken) throws ApiException {
SignTaskClient signTaskClient = new SignTaskClient(openApiClient);
......@@ -583,9 +625,9 @@ public class FascUtil {
}
private TemplateSignConfigInfoReq buildZhang() {
TemplateSignConfigInfoReq templateSignConfigInfoReq1 = new TemplateSignConfigInfoReq() ;
templateSignConfigInfoReq1.setOrderNo(1) ;
templateSignConfigInfoReq1.setRequestVerifyFree(true) ;
TemplateSignConfigInfoReq templateSignConfigInfoReq1 = new TemplateSignConfigInfoReq();
templateSignConfigInfoReq1.setOrderNo(1);
templateSignConfigInfoReq1.setRequestVerifyFree(true);
return templateSignConfigInfoReq1;
}
......@@ -708,11 +750,11 @@ public class FascUtil {
OpenApiClient openApiClient = new OpenApiClient(company.getAppId(), company.getAppSecret(), company.getAppUrl());
String accessToken = this.getFascToken(openApiClient, company);
TemplateClient templateClient = new TemplateClient(openApiClient) ;
GetTemplatePreviewUrlReq getTemplatePreviewUrlReq = new GetTemplatePreviewUrlReq() ;
getTemplatePreviewUrlReq.setOpenCorpId(company.getOpenId()) ;
getTemplatePreviewUrlReq.setTemplateId(signTemplateId) ;
getTemplatePreviewUrlReq.setAccessToken(accessToken) ;
TemplateClient templateClient = new TemplateClient(openApiClient);
GetTemplatePreviewUrlReq getTemplatePreviewUrlReq = new GetTemplatePreviewUrlReq();
getTemplatePreviewUrlReq.setOpenCorpId(company.getOpenId());
getTemplatePreviewUrlReq.setTemplateId(signTemplateId);
getTemplatePreviewUrlReq.setAccessToken(accessToken);
// 新增推送日志
......@@ -725,7 +767,7 @@ public class FascUtil {
pushLog.setContractId(signTemplateId);
tFascPushLogService.save(pushLog);
BaseRes<GetTemplatePreviewUrlRes> res = templateClient.getTemplatePreviewUrl(getTemplatePreviewUrlReq) ;
BaseRes<GetTemplatePreviewUrlRes> res = templateClient.getTemplatePreviewUrl(getTemplatePreviewUrlReq);
if (res != null) {
pushLog.setReturnData(JSON.toJSONString(res, features));
pushLog.setTaskStatus(res.isSuccess() ? CommonConstants.ONE_STRING : CommonConstants.TWO_STRING);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment