Commit 4666f8de authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.7.16' into MVP1.7.16

parents 0a8eb4b6 25de81c6
......@@ -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;
......
......@@ -87,5 +87,13 @@ public class TFascCompany extends BaseEntity {
@ExcelProperty("openId")
@Schema(description = "openId")
private String openId;
/**
* 场景码
*/
@ExcelAttribute(name = "场景码", maxLength = 100)
@Length(max = 100, message = "场景码不能超过100个字符")
@ExcelProperty("场景码")
@Schema(description = "场景码")
private String businessId;
}
......@@ -163,6 +163,20 @@ public class TFascTemplate extends BaseEntity {
@ExcelProperty("必填是否已配置0未配置1部分配置2已配置")
@Schema(description = "必填是否已配置0未配置1部分配置2已配置")
private String isMustEdit;
/**
* 发起方ID
*/
@ExcelAttribute(name = "发起方ID")
@ExcelProperty("发起方ID")
@Schema(description = "发起方ID")
private String companyActorId;
/**
* 签署方ID
*/
@ExcelAttribute(name = "签署方ID")
@ExcelProperty("签署方ID")
@Schema(description = "签署方ID")
private String personActorId;
@TableField(exist = false)
@ExcelProperty("当前必填已配置数量")
......
......@@ -231,6 +231,7 @@ public class FascController {
pre.setProcessStatus(CommonConstants.dingleDigitStrArray[9]);
contractInfo.setIsFile(CommonConstants.ZERO_STRING);
contractInfo.setContractNo(pre.getRequestId());
tEmployeeContractInfoService.updateById(contractInfo);
}
tEmployeeContractPreService.updateById(pre);
......
......@@ -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;
......@@ -243,6 +243,27 @@ public class FascUtil {
pushLog.setTaskStatus(res.isSuccess() ? CommonConstants.ONE_STRING : CommonConstants.TWO_STRING);
tFascPushLogService.updateById(pushLog);
if (res.isSuccess() && res.getData() != null && res.getData().getActors() != null
&& !res.getData().getActors().isEmpty()) {
String companyActorId = null;
String personActorId = null;
for (SignTaskActorInfo actor : res.getData().getActors()) {
if (Common.isEmpty(companyActorId) && actor.getActorInfo() != null
&& Common.isNotNull(actor.getActorInfo().getActorType())
&& "corp".equals(actor.getActorInfo().getActorType())
&& Common.isNotNull(actor.getActorInfo().getActorId())) {
companyActorId = actor.getActorInfo().getActorId();
}
if (Common.isEmpty(personActorId) && actor.getActorInfo() != null
&& Common.isNotNull(actor.getActorInfo().getActorType())
&& "person".equals(actor.getActorInfo().getActorType())
&& Common.isNotNull(actor.getActorInfo().getActorId())) {
personActorId = actor.getActorInfo().getActorId();
}
}
template.setCompanyActorId(companyActorId);
template.setPersonActorId(personActorId);
}
if (res.isSuccess() && res.getData() != null && res.getData().getDocs() != null
&& !res.getData().getDocs().isEmpty()) {
if (list == null) {
......@@ -335,7 +356,7 @@ public class FascUtil {
createWithTemplateReq.setSignTemplateId(contract.getFadadaTemplateId());
// 核心代码:设置参与方列表
createWithTemplateReq.setActors(this.buildActors(contract, company));
createWithTemplateReq.setActors(this.buildActors(contract, company, tFascTemplate));
// 新增推送日志
TFascPushLog pushLog = new TFascPushLog();
pushLog.setTransReferenceId(company.getOpenId());
......@@ -422,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);
}
......@@ -459,6 +480,7 @@ public class FascUtil {
/**
* 使用反射根据字段名获取合同对象中对应字段的值
*
* @param contract 合同对象
* @param fieldName 字段名
* @return 字段值
......@@ -475,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 {
......@@ -490,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);
......@@ -509,14 +572,18 @@ public class FascUtil {
/**
* 构建参与方列表
*/
private List<AddActorsTempInfo> buildActors(TEmployeeContractPre contract, TFascCompany company) {
private List<AddActorsTempInfo> buildActors(TEmployeeContractPre contract, TFascCompany company, TFascTemplate tFascTemplate) {
List<AddActorsTempInfo> actors = new ArrayList<>();
if (Common.isNotNull(tFascTemplate.getCompanyActorId())) {
// 添加企业方(甲方)
actors.add(buildCompanyActor(company, tFascTemplate.getCompanyActorId()));
}
if (Common.isNotNull(tFascTemplate.getPersonActorId())) {
// 添加企业方(甲方)
actors.add(buildCompanyActor(contract, company));
// 核心代码:添加员工方(乙方)
actors.add(buildEmployeeActor(contract));
actors.add(buildEmployeeActor(contract, tFascTemplate.getPersonActorId()));
}
return actors;
}
......@@ -524,16 +591,14 @@ public class FascUtil {
/**
* 构建企业方参与方
*/
private AddActorsTempInfo buildCompanyActor(TEmployeeContractPre contract, TFascCompany company) {
private AddActorsTempInfo buildCompanyActor(TFascCompany company, String actorId) {
AddActorsTempInfo companyActor = new AddActorsTempInfo();
Actor actor = new Actor();
// TODO - 改造签署openID到mysql表里配置
// TODO - 参与方1 在模板详情接口返回
actor.setActorId("发起企业"); // 与模板中的参与方标识一致
actor.setActorId(actorId); // 与模板中的参与方标识一致
actor.setActorType(CacheConstants.FASC_ID_TYPE);
actor.setActorName("安徽皖信人力资源管理有限公司");
actor.setActorName(company.getCompanyName());
// 权限设置
actor.setPermissions(Collections.singletonList("sign"));
......@@ -551,19 +616,29 @@ public class FascUtil {
companyActor.setActor(actor);
if (Common.isNotNull(company.getBusinessId())) {
// 添加免验签
companyActor.setSignConfigInfo(buildZhang());
}
return companyActor;
}
private TemplateSignConfigInfoReq buildZhang() {
TemplateSignConfigInfoReq templateSignConfigInfoReq1 = new TemplateSignConfigInfoReq();
templateSignConfigInfoReq1.setOrderNo(1);
templateSignConfigInfoReq1.setRequestVerifyFree(true);
return templateSignConfigInfoReq1;
}
/**
* 构建员工方参与方
*/
private AddActorsTempInfo buildEmployeeActor(TEmployeeContractPre contract) {
private AddActorsTempInfo buildEmployeeActor(TEmployeeContractPre contract, String actorId) {
AddActorsTempInfo employeeActor = new AddActorsTempInfo();
Actor actor = new Actor();
// TODO - 改造签署openID到mysql表里配置
// TODO - 参与方1 在模板详情接口返回
actor.setActorId("个人签署"); // 与模板中的参与方标识一致
actor.setActorId(actorId); // 与模板中的参与方标识一致
actor.setActorType(CacheConstants.FASC_ID_TYPE_PERSON);
actor.setActorName(contract.getEmployeeName());
......@@ -675,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);
// 新增推送日志
......@@ -692,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);
......
......@@ -35,6 +35,7 @@
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="businessId" column="business_id"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
......@@ -47,7 +48,8 @@
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
a.UPDATE_TIME,
a.business_id
</sql>
<sql id="tFascCompany_where">
<if test="tFascCompany != null">
......
......@@ -44,6 +44,8 @@
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="companyActorId" column="company_actor_id"/>
<result property="personActorId" column="person_actor_id"/>
<!-- 非数据库字段,用来比较厚,更新日志 -->
<result property="isMustNow" column="is_must_now"/>
......@@ -84,7 +86,9 @@
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
a.UPDATE_TIME,
a.company_actor_id,
a.person_actor_id
</sql>
<sql id="tFascTemplate_where">
<if test="tFascTemplate != null">
......
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