Commit a50b64be authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 57fdd48a
......@@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
......@@ -55,25 +56,25 @@ public class FddContractAttachInfo extends BaseEntity {
* 合同试用期开始时间
*/
@Schema(description ="合同试用期开始时间")
private LocalDateTime periodStart;
private LocalDate periodStart;
/**
* 合同试用期结束时间
*/
@Schema(description ="合同试用期结束时间")
private LocalDateTime periodEnd;
private LocalDate periodEnd;
/**
* 合同起始时间
*/
@Schema(description ="合同起始时间")
private LocalDateTime contractStart;
private LocalDate contractStart;
/**
* 合同到期时间
*/
@Schema(description ="合同到期时间")
private LocalDateTime contractEnd;
private LocalDate contractEnd;
/**
* 试用期工资 元/月
......
......@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
......@@ -61,5 +62,10 @@ public class FddTemplateFieldInfo extends BaseEntity {
@Schema(description ="模板ID")
private String templateId;
/**
* 对应法大大模板字段值
*/
@Schema(description ="对应法大大模板字段值")
@TableField(exist = false)
private String fieldValue;
}
......@@ -67,6 +67,11 @@
<version>1.8.0</version>
<artifactId>fadada-java-sdk-api3</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<version>5.8.0</version>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fadada.api.exception.ApiException;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.FddContractInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -111,4 +112,17 @@ public class FddContractInfoController {
return R.ok(fddContractInfoService.removeById(id));
}
/**
* @param fddContractInfo
* @Author: huyc
* @Date: 2022/6/30
* @Description: 发送法大大电子合同定稿任务
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Operation(summary = "发送法大大电子合同定稿任务", description = "发送法大大电子合同定稿任务")
@SysLog("发送法大大电子合同定稿任务" )
@PostMapping("/send")
public R<String> send(FddContractInfo fddContractInfo) throws ApiException {
return fddContractInfoService.saveEmpContract(fddContractInfo);
}
}
......@@ -19,7 +19,9 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fadada.api.exception.ApiException;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
/**
* 法大大合同与员工合同信息
......@@ -29,4 +31,5 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo;
*/
public interface FddContractInfoService extends IService<FddContractInfo> {
R<String> saveEmpContract(FddContractInfo fddContractInfo) throws ApiException;
}
......@@ -21,6 +21,8 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddTemplateFieldInfo;
import java.util.List;
/**
* 法大大字段对应信息表
*
......@@ -28,5 +30,6 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.FddTemplateFieldInfo;
* @date 2022-06-28 16:24:12
*/
public interface FddTemplateFieldInfoService extends IService<FddTemplateFieldInfo> {
List<FddTemplateFieldInfo> getFddFields(String templateId, String type);
}
......@@ -16,13 +16,42 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo;
import com.fadada.api.bean.req.account.NoticeReq;
import com.fadada.api.bean.req.revise.CreateReviseTaskReq;
import com.fadada.api.bean.rsp.BaseRsp;
import com.fadada.api.bean.rsp.revise.CreateReviseTaskRsp;
import com.fadada.api.client.ReviseTaskClient;
import com.fadada.api.exception.ApiException;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.FddContractInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.utils.FddUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* 法大大合同与员工合同信息
*
......@@ -31,6 +60,359 @@ import org.springframework.stereotype.Service;
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContractInfo> implements FddContractInfoService {
public static final String FILL_FILE_ID_NULL = "定稿任务id为空";
public static final String NOT_FOUND_FDD_USER = "未获取到当前登录用户对应的组织下实名法大大用户";
@Autowired
private FddUtil fddUtil;
@Autowired
private FddReqLogService reqLogService;
@Autowired
private FddContractTemplateService fddContractTemplateService;
@Autowired
private FddPersonAccountService fddPersonAccountService;
@Autowired
private FddContractTemplateFileService fddContractTemplateFileService;
@Autowired
private FddContractInfoService fddContractInfoService;
@Autowired
private FddCompanyInfoService fddCompanyInfoService;
@Autowired
private FddSealPersonAuthService fddSealPersonAuthService;
@Autowired
private FddContractAttachInfoService fddContractAttachInfoService;
// @Autowired
// private TEmployeeContractInfoService employeeContractInfoService;
@Autowired
private TEmployeeInfoService employeeInfoService;
@Autowired
private FddTemplateFieldInfoService fieldInfoService;
// 阿里云文件上传服务
@Autowired
private OSSUtil ossUtil;
// // 附件表
// @Autowired
// private TEmpAttaService empAttaService;
// // 附件-合同,关联表
// @Autowired
// private MEmpContractAttaService mempContractAttaService;
@Autowired
private TSettleDomainService tSettleDomainService;
@Override
public R<String> saveEmpContract(FddContractInfo fddContractInfo) throws ApiException {
FddContractAttachInfo fddContractAttachInfo = fddContractAttachInfoService.getById(fddContractInfo.getId());
YifuUser user = SecurityUtils.getUser();
if (!user.getId().equals(fddContractAttachInfo.getCreateBy())) {
return R.failed("当前用户不是电子合同导入用户,不能操作");
}
//法大大合同模板
TSettleDomain settleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda().eq(TSettleDomain::getDepartNo, fddContractAttachInfo.getDepartNo()));
if (settleDomain == null) {
return R.failed("未获取到对应的结算主体");
}
List<FddContractTemplate> fddContractTemplateList = fddContractTemplateService.list(Wrappers.<FddContractTemplate>query().lambda()
.eq(FddContractTemplate::getModifyUploadStatus, CommonConstants.dingleDigitStrArray[1])
.eq(FddContractTemplate::getFddTemplateId,fddContractAttachInfo.getFddTemplateId()));
//如果模板存在则生成法大大电子合同数据
if (fddContractTemplateList.size() == CommonConstants.ZERO_INT) {
return R.failed("未获取到有效的合同模板");
}
if (fddContractTemplateList.size() != CommonConstants.ONE_INT) {
return R.failed("法大大合同有效合同模板存在多条");
}
//校验登录用户和法大大实名用户是否名称和手机号一致
FddPersonAccount fddCompanyPersonAccount = fddPersonAccountService.getOne(Wrappers.<FddPersonAccount>query().lambda().eq(FddPersonAccount::getMoblie, user.getPhone())
.eq(FddPersonAccount::getRealStatus, CommonConstants.ONE_STRING).eq(FddPersonAccount::getSystemFlag, CommonConstants.ZERO_STRING).isNotNull(FddPersonAccount::getCompanyInfoId));
if (fddCompanyPersonAccount == null) {
return R.failed(NOT_FOUND_FDD_USER);
}
//获取员工法大大用户id
FddPersonAccount fddEmpAccount = fddPersonAccountService.getOne(Wrappers.<FddPersonAccount>query().lambda().eq(FddPersonAccount::getMoblie, fddContractAttachInfo.getEmpPhone())
.eq(FddPersonAccount::getRealStatus, CommonConstants.ONE_STRING).eq(FddPersonAccount::getSystemFlag, CommonConstants.ONE_STRING));
if (fddEmpAccount == null) {
return R.failed(NOT_FOUND_FDD_USER);
}
if (!StringUtils.equals(CommonConstants.ONE_STRING, fddEmpAccount.getRealStatus())) {
return R.failed("当前用户未实名通过");
}
//获取法大大组织
List<String> companyInfoIdList = Arrays.asList(fddCompanyPersonAccount.getCompanyInfoId().split(","));
List<FddCompanyInfo> fddCompanyInfo = fddCompanyInfoService.list(Wrappers.<FddCompanyInfo>query().lambda().in(FddCompanyInfo::getId, companyInfoIdList));
if (fddCompanyInfo == null) {
return R.failed("未获取到对应法大大组织");
}
FddContractTemplate fddContractTemplate = fddContractTemplateList.get(CommonConstants.ZERO_INT);
//获取法大大模板下附件
FddContractTemplateFile fddContractTemplateFile = fddContractTemplateFileService.getOne(Wrappers.<FddContractTemplateFile>query().lambda().eq(FddContractTemplateFile::getFddTemplateId, fddContractTemplate.getFddTemplateId()));
ReviseTaskClient reviseTaskClient = new ReviseTaskClient(fddUtil.getFadadaApiClient());
CreateReviseTaskReq req = new CreateReviseTaskReq();
req.setTemplateId(fddContractTemplate.getFddTemplateId());
req.setTaskSubject("员工合同");
req.setFinalizeWay(1);
req.setSort(1);
//定义persion角色开始
CreateReviseTaskReq.FillRoleInfo persionFillRoleInfo = new CreateReviseTaskReq.FillRoleInfo();
persionFillRoleInfo.setRoleName(FddUtil.PERSON);
NoticeReq perSionNoticeReq = new NoticeReq();
perSionNoticeReq.setNotifyWay(1);
perSionNoticeReq.setNotifyAddress(fddContractAttachInfo.getEmpPhone());
persionFillRoleInfo.setNotice(perSionNoticeReq);
persionFillRoleInfo.setUnionId(fddEmpAccount.getUnionid());
//文件参数预先填充
List<CreateReviseTaskReq.FillTemplateFileInfo> fileInfoList = new ArrayList<>();
CreateReviseTaskReq.FillTemplateFileInfo fileInfo = new CreateReviseTaskReq.FillTemplateFileInfo();
fileInfo.setFileId(fddContractTemplateFile.getFddFileId());
//员工填充数据
//FddEmployeeContractFillVo fddEmployeeContractFillVo = new FddEmployeeContractFillVo();
//fileInfo.setFormFields(JSON.toJSONString(fddEmployeeContractFillVo));
List<FddTemplateFieldInfo> personFields = fieldInfoService.getFddFields(fddContractTemplate.getFddTemplateId(),CommonConstants.ZERO_STRING);
if (Common.isNotNull(personFields)){
initPersonFields(fddContractAttachInfo,personFields);
fileInfo.setFormFields(JSON.toJSONString(personFields.stream().collect(HashMap::new, (m, v)->m.put(v.getFiledName(), v.getFieldValue()),HashMap::putAll)));
}
fileInfoList.add(fileInfo);
persionFillRoleInfo.setFillTemplateFiles(fileInfoList);
//定义persion角色结束
//定义company角色开始
CreateReviseTaskReq.FillRoleInfo companyFillRoleInfo = new CreateReviseTaskReq.FillRoleInfo();
companyFillRoleInfo.setRoleName(FddUtil.COMPANY);
NoticeReq companyionNoticeReq = new NoticeReq();
companyionNoticeReq.setNotifyWay(1);
companyionNoticeReq.setNotifyAddress(fddCompanyPersonAccount.getMoblie());
companyFillRoleInfo.setNotice(companyionNoticeReq);
companyFillRoleInfo.setUnionId(fddCompanyPersonAccount.getUnionid());
//文件参数预先填充
List<CreateReviseTaskReq.FillTemplateFileInfo> companyFileInfoList = new ArrayList<>();
CreateReviseTaskReq.FillTemplateFileInfo companyFileInfo = new CreateReviseTaskReq.FillTemplateFileInfo();
companyFileInfo.setFileId(fddContractTemplateFile.getFddFileId());
//公司填充数据
List<FddTemplateFieldInfo> compamyFields = fieldInfoService.getFddFields(fddContractTemplate.getFddTemplateId(),CommonConstants.ONE_STRING);
if (Common.isNotNull(compamyFields)){
Map<String,String> companyFieldMap = compamyFields.stream().collect(Collectors.toMap(k->k.getFiledName(), k->k.getFiledName()));
R<String> employeeParamR = generalEmployeeParamNew(fddContractAttachInfo,companyFieldMap);
if (Common.isEmpty(employeeParamR) || employeeParamR.getCode() == CommonConstants.FAIL.intValue()){
return employeeParamR;
}
companyFileInfo.setFormFields(employeeParamR.getData());
}
companyFileInfoList.add(companyFileInfo);
companyFillRoleInfo.setFillTemplateFiles(companyFileInfoList);
//定义company角色结束
//文件id
List<CreateReviseTaskReq.TemplateFileInfo> templateFileInfos = new ArrayList<>();
CreateReviseTaskReq.TemplateFileInfo templateFileInfo = new CreateReviseTaskReq.TemplateFileInfo();
templateFileInfo.setFileId(fddContractTemplateFile.getFddFileId());
templateFileInfo.setFileName("员工合同");
templateFileInfos.add(templateFileInfo);
req.setTemplateFiles(templateFileInfos);
//发送请求
List<CreateReviseTaskReq.FillRoleInfo> fillRoles = new ArrayList<>();
fillRoles.add(persionFillRoleInfo);
fillRoles.add(companyFillRoleInfo);
req.setFillRoles(fillRoles);
//设置token
req.setToken(fddUtil.getToken());
BaseRsp<CreateReviseTaskRsp> rsp = reviseTaskClient.createReviseTask(req);
//保存日志
reqLogService.saveLog(this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName(), req, rsp);
//校验参数
if (StringUtils.equals(rsp.getCode(), FddUtil.SUCCESS)) {
CreateReviseTaskRsp rspData = rsp.getData();
//法大大员工合同记录生成
FddContractInfo fddContractInfoNew = new FddContractInfo();
fddContractInfoNew.setContractId(fddContractAttachInfo.getContractId());
fddContractInfoNew.setFddPersonAccountSendId(fddCompanyPersonAccount.getId());
fddContractInfoNew.setFddPersonAccountReceiveId(fddEmpAccount.getId());
fddContractInfoNew.setSendUnionid(fddCompanyPersonAccount.getUnionid());
fddContractInfoNew.setReceiveUnionid(fddEmpAccount.getUnionid());
fddContractInfoNew.setFddTemplateId(fddContractTemplate.getId());
this.save(fddContractInfoNew);
fddContractInfoNew.setTaskId(rspData.getTaskId());
fddContractInfoNew.setFileId(rspData.getTaskFiles().get(CommonConstants.ZERO_INT).getFileId());
this.updateById(fddContractInfoNew);
return new R<>("创建模板定稿任务成功");
} else {
log.error("请求数据:{}",JSON.toJSONString(req));
log.error("返回数据:{}",JSON.toJSONString(rsp));
return R.failed(rsp.getMsg());
}
}
public R<String> generalEmployeeParamNew(FddContractAttachInfo attachInfo,
Map<String, String> companyFieldMap) {
JSONObject paramter = new JSONObject();
if (Common.isNotNull(companyFieldMap)){
R<String> res = getValuesOfKey(paramter,attachInfo,companyFieldMap);
if (Common.isNotNull(res) && res.getCode() == CommonConstants.FAIL.intValue()){
return res;
}
}
return new R<>(paramter.toJSONString());
}
private R<String> getValuesOfKey(JSONObject paramter,
FddContractAttachInfo attachInfo,
Map<String, String> companyFieldMap) {
if (Common.isNotNull(companyFieldMap.get("name"))){
if (StringUtils.isEmpty(attachInfo.getEmpName())) {
return R.failed("姓名为空,请去档案补充对应信息!");
}
paramter.put("name", attachInfo.getEmpName());
}
if (Common.isNotNull(companyFieldMap.get("birth"))){
Date date = IdcardUtil.getBirthDate(attachInfo.getEmpIdcard());
if (LocalDateTimeUtils.convertDateToLDT(date) == null) {
return R.failed("出生年月为空,请去档案补充对应信息!");
}
paramter.put("birth", DateUtil.format(LocalDateTimeUtils.convertDateToLDT(date), DatePattern.NORM_DATE_PATTERN));
}
//暂时档案所在地为空
if (Common.isNotNull(companyFieldMap.get("id_card"))){
if (StringUtils.isEmpty(attachInfo.getEmpIdcard())) {
return R.failed("身份证号为空,请去档案补充对应信息!");
}
paramter.put("id_card", attachInfo.getEmpIdcard());
}
if (Common.isNotNull(companyFieldMap.get("sex"))){
int sex = IdcardUtil.getGenderByIdCard(attachInfo.getEmpIdcard());
if (sex == 0) {
paramter.put("sex", "女");
} else if (sex == 1) {
paramter.put("sex", "男");
}
}
if (Common.isNotNull(companyFieldMap.get("mobile"))){
if (StringUtils.isEmpty(attachInfo.getEmpPhone())) {
return R.failed("手机号为空,请去档案补充对应信息!");
}
paramter.put("mobile", attachInfo.getEmpPhone());
}
if (Common.isNotNull(companyFieldMap.get("contractType"))){
//固定期限
paramter.put("contractType", "一");
paramter.put("fcontractStartY", DateUtil.format(localDate2Date(attachInfo.getContractStart()), "yyyy"));
paramter.put("fcontractStartM", DateUtil.format(localDate2Date(attachInfo.getContractStart()), "MM"));
paramter.put("fcontractStartD", DateUtil.format(localDate2Date(attachInfo.getContractStart()), "dd"));
paramter.put("fcontractEndY", DateUtil.format(localDate2Date(attachInfo.getContractEnd()), "yyyy"));
paramter.put("fcontractEndM", DateUtil.format(localDate2Date(attachInfo.getContractEnd()), "MM"));
paramter.put("fcontractEndD", DateUtil.format(localDate2Date(attachInfo.getContractEnd()), "dd"));
if (Common.isNotNull(companyFieldMap.get("fPeriodStartY"))){
//合同起止时间填充,新签需要判断是否有试用期,试用期工资
if (attachInfo.getPeriodStart() == null) {
return R.failed("新签试用期开始时间为空");
}
paramter.put("fPeriodStartY", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "yyyy"));
paramter.put("fPeriodStartM", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "MM"));
paramter.put("fPeriodStartD", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "dd"));
}
if (Common.isNotNull(companyFieldMap.get("fPeriodEndY"))){
if (attachInfo.getPeriodEnd() == null) {
return R.failed("新签试用期结束时间为空");
}
paramter.put("fPeriodEndY", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "yyyy"));
paramter.put("fPeriodEndM", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "MM"));
paramter.put("fPeriodEndD", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "dd"));
}
if (Common.isNotNull(companyFieldMap.get("periodSalaryPerMonth"))){
if (attachInfo.getPeriodSalaryPerMonth() == null) {
return R.failed("新签试用期工资为空");
}
paramter.put("pSalaryPerMon", attachInfo.getPeriodSalaryPerMonth());
}
}
if (Common.isNotNull(companyFieldMap.get("post"))){
//工作地点和岗位填充
if (StringUtils.isEmpty(attachInfo.getPost())) {
return R.failed("员工岗位为空,请去档案补充对应信息!");
}
paramter.put("post", attachInfo.getPost());
}
if (Common.isNotNull(companyFieldMap.get("workSpace"))){
if (StringUtils.isEmpty(attachInfo.getWorkSpace())) {
return R.failed("员工工作地点为空");
}
paramter.put("workSpace", attachInfo.getWorkSpace());
}
if (Common.isNotNull(companyFieldMap.get("workingHours"))){
paramter.put("workingHours", "");
}
if (Common.isNotNull(companyFieldMap.get("salaryType"))){
//工资标准
if(StringUtils.isEmpty(attachInfo.getSalaryType())){
return R.failed("工资标准类型不能为空");
}
String salaryTypeKey = "salaryType";
if (StringUtils.equals(CommonConstants.ONE_STRING, attachInfo.getSalaryType())) {
paramter.put(salaryTypeKey, CommonConstants.ONE_STRING);
//计时工资
if (attachInfo.getSalaryStandardPerHour()==null) {
return R.failed("计时工资为空");
}
if (Common.isNotNull(companyFieldMap.get("salaryStrandPh"))){
paramter.put("salaryStrandPh", String.valueOf(attachInfo.getSalaryStandardPerHour()));
}
} else if (StringUtils.equals(CommonConstants.TWO_STRING, attachInfo.getSalaryType())) {
paramter.put(salaryTypeKey, CommonConstants.TWO_STRING);
if (attachInfo.getSalaryStandardPerPiece()==null) {
return R.failed("计件工资为空");
}
if (Common.isNotNull(companyFieldMap.get("salaryStrandPp"))){
//计月工资
paramter.put("salaryStrandPp", String.valueOf(attachInfo.getSalaryStandardPerPiece()));
}
} else if (StringUtils.equals(CommonConstants.THREE_STRING, attachInfo.getSalaryType())) {
paramter.put(salaryTypeKey, CommonConstants.THREE_STRING);
} else {
return R.failed("未知的工资标准类型");
}
}
return new R<>(paramter.toJSONString());
}
private void initPersonFields(FddContractAttachInfo fddContractAttachInfo, List<FddTemplateFieldInfo> personFields) {
if (Common.isNotNull(fddContractAttachInfo) && Common.isNotNull(personFields)){
for (FddTemplateFieldInfo field:personFields){
if (field.getFiledName().equals("empNameRecord")){
field.setFieldValue(fddContractAttachInfo.getEmpName());
}
if (field.getFiledName().equals("empSexRecord")){
int sex = IdcardUtil.getGenderByIdCard(fddContractAttachInfo.getEmpIdcard());
if (sex == 0) {
field.setFieldValue("女");
} else if (sex == 1) {
field.setFieldValue("男");
}
}
if (field.getFiledName().equals("empBirthRecord")){
Date date = IdcardUtil.getBirthDate(fddContractAttachInfo.getEmpIdcard());
if (LocalDateTimeUtils.convertDateToLDT(date) != null){
field.setFieldValue(DateUtil.format(LocalDateTimeUtils.convertDateToLDT(date), DatePattern.NORM_DATE_PATTERN));
}
}
if (field.getFiledName().equals("empIdCardRecord")){
field.setFieldValue(fddContractAttachInfo.getEmpIdcard());
}
if (field.getFiledName().equals("empMobileRecord")){
field.setFieldValue(fddContractAttachInfo.getEmpPhone());
}
}
}
}
public static Date localDate2Date(LocalDate localDate) {
if (null == localDate) {
return null;
}
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
return Date.from(zonedDateTime.toInstant());
}
}
......@@ -16,6 +16,7 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddTemplateFieldInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.FddTemplateFieldInfoMapper;
......@@ -23,6 +24,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.FddTemplateFieldInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 法大大字段对应信息表
*
......@@ -33,4 +36,17 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class FddTemplateFieldInfoServiceImpl extends ServiceImpl<FddTemplateFieldInfoMapper, FddTemplateFieldInfo> implements FddTemplateFieldInfoService {
/**
* @ClassName: com.yifu.cloud.v1.hr.basicArchives.service.impl.FddTemplateFieldInfoServiceImpl.java
* @author huyc
* @date 2022/6/30
* @Description 按模板和角色获取具体字段参数
* @param templateId: 模板ID type:0 个人角色 1 公司角色
*/
@Override
public List<FddTemplateFieldInfo> getFddFields(String templateId, String type) {
return baseMapper.selectList(Wrappers.<FddTemplateFieldInfo>query().lambda()
.eq(FddTemplateFieldInfo::getType,type)
.eq(FddTemplateFieldInfo::getTemplateId,templateId));
}
}
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