Commit 8bf8bd8b authored by huyuchen's avatar huyuchen

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

parents 81995529 b5905b3c
...@@ -267,7 +267,11 @@ public class TEmployeeContractInfoController { ...@@ -267,7 +267,11 @@ public class TEmployeeContractInfoController {
@PostMapping("/filingContract") @PostMapping("/filingContract")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_filing')") @PreAuthorize("@pms.hasPermission('temployeecontractinfo_filing')")
public R<String> filingContract(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) { public R<String> filingContract(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) {
return tEmployeeContractInfoService.filingContract(tEmployeeContractInfo); YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
return tEmployeeContractInfoService.filingContract(tEmployeeContractInfo, user);
} }
/** /**
......
...@@ -71,6 +71,22 @@ public class TEmployeeContractPreController { ...@@ -71,6 +71,22 @@ public class TEmployeeContractPreController {
return R.ok(tEmployeeContractPreService.getById(id)); return R.ok(tEmployeeContractPreService.getById(id));
} }
/**
* @param contractId 合同ID
* @Description: 通过合同ID查询(原合同查电子签详情专用)
* @Author: hgw
* @Date: 2025/10/20 10:19
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractPre>
**/
@Operation(summary = "通过合同ID查询", description = "通过合同ID查询")
@GetMapping("/getByContractId" )
public R<TEmployeeContractPre> getByContractId(@RequestParam("contractId" ) String contractId) {
// 2025-10-20 10:29:41 倩倩说不过滤状态,只要是自动化生成的合同,都要看电子签详情
TEmployeeContractPre pre = tEmployeeContractPreService.getOne(Wrappers.<TEmployeeContractPre>lambdaQuery()
.eq(TEmployeeContractPre::getContractId, contractId).last(CommonConstants.LAST_ONE_SQL));
return R.ok(pre);
}
/** /**
* 不分页查询 * 不分页查询
* @param tEmployeeContractPre 商险待办任务表 * @param tEmployeeContractPre 商险待办任务表
......
...@@ -42,6 +42,6 @@ public interface FascService extends IService<FddContractInfo> { ...@@ -42,6 +42,6 @@ public interface FascService extends IService<FddContractInfo> {
// 催办签署任务 // 催办签署任务
R<String> urgeTask(String id) throws ApiException; R<String> urgeTask(String id) throws ApiException;
// 获取附件 // 获取附件
R<String> getFileByRequestId(String id) throws ApiException; boolean getFileByRequestId(String id) throws ApiException;
} }
...@@ -130,7 +130,7 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract ...@@ -130,7 +130,7 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
* @Date: 2022/7/1 10:32 * @Date: 2022/7/1 10:32
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo); R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user);
/** /**
* @param inputStream * @param inputStream
......
...@@ -21,11 +21,13 @@ import com.fasc.open.api.exception.ApiException; ...@@ -21,11 +21,13 @@ import com.fasc.open.api.exception.ApiException;
import com.fasc.open.api.v5_1.res.template.SignTemplateListInfo; import com.fasc.open.api.v5_1.res.template.SignTemplateListInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*; 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.mapper.FddContractInfoMapper;
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.mapper.TEmployeeContractPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.utils.FascUtil; import com.yifu.cloud.plus.v1.yifu.archives.utils.FascUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; 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.Common;
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.util.R;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -51,6 +53,10 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -51,6 +53,10 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
private final TFascTemplateService tFascTemplateService; private final TFascTemplateService tFascTemplateService;
private final TFascTemplateDetailService tFascTemplateDetailService; private final TFascTemplateDetailService tFascTemplateDetailService;
private final TEmployeeContractPreMapper tEmployeeContractPreMapper; private final TEmployeeContractPreMapper tEmployeeContractPreMapper;
private final TAttaInfoMapper tAttaInfoMapper;
private final OSSUtil ossUtil;
private final static String FASC_NO_CONTRACT = "未找到合同";
@Override @Override
public R<String> getTemplate(String templateName) throws ApiException { public R<String> getTemplate(String templateName) throws ApiException {
...@@ -173,7 +179,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -173,7 +179,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
// templateName 签署任务模板名称 // templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id); TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) { if (contract == null) {
return R.failed("未找到合同"); return R.failed(FASC_NO_CONTRACT);
} }
if (Common.isEmpty(contract.getFadadaTemplateId())) { if (Common.isEmpty(contract.getFadadaTemplateId())) {
return R.failed("未找到合同模板ID,请联系管理员"); return R.failed("未找到合同模板ID,请联系管理员");
...@@ -212,7 +218,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -212,7 +218,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
// templateName 签署任务模板名称 // templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id); TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) { if (contract == null) {
return R.failed("未找到合同"); return R.failed(FASC_NO_CONTRACT);
} }
if (Common.isEmpty(contract.getRequestId())) { if (Common.isEmpty(contract.getRequestId())) {
return R.failed("无requestId,请检查数据"); return R.failed("无requestId,请检查数据");
...@@ -235,7 +241,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -235,7 +241,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
// templateName 签署任务模板名称 // templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id); TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) { if (contract == null) {
return R.failed("未找到合同"); return R.failed(FASC_NO_CONTRACT);
} }
if (Common.isEmpty(contract.getRequestId())) { if (Common.isEmpty(contract.getRequestId())) {
return R.failed("无requestId,请检查数据"); return R.failed("无requestId,请检查数据");
...@@ -253,20 +259,17 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -253,20 +259,17 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
@Override @Override
public R<String> getFileByRequestId(String id) throws ApiException { public boolean getFileByRequestId(String id) throws ApiException {
// templateName 签署任务模板名称 // templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id); TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) { if (contract == null) {
return R.failed("未找到合同"); return false;
} }
if (Common.isEmpty(contract.getRequestId())) { if (Common.isEmpty(contract.getRequestId())) {
return R.failed("无requestId,请检查数据"); // return R.failed("无requestId,请检查数据")
return false;
} }
return fascUtil.getFileByRequestId(contract, tFascPushLogService, tAttaInfoMapper, ossUtil);
// TODO - 判断什么状态催办等,需要产品定
return fascUtil.getFileByRequestId(contract, tFascPushLogService, tEmployeeContractPreMapper);
} }
......
...@@ -1331,11 +1331,11 @@ private R<Boolean> checkItemRepeat(List<SysAutoDictItem> autoDictItems, Map<Stri ...@@ -1331,11 +1331,11 @@ private R<Boolean> checkItemRepeat(List<SysAutoDictItem> autoDictItems, Map<Stri
// 添加了异常处理,避免 recordBase 不是合法数字格式时程序崩溃 // 添加了异常处理,避免 recordBase 不是合法数字格式时程序崩溃
if (CommonConstants.TWO_STRING.equals(rel.getPaymentType())) { if (CommonConstants.TWO_STRING.equals(rel.getPaymentType())) {
if (BigDecimal.valueOf(Double.valueOf(rel.getRecordBase())).compareTo(setInfo.getUpperLimit()) != 0) { if (BigDecimal.valueOf(Double.valueOf(rel.getRecordBase())).compareTo(setInfo.getUpperLimit()) != 0) {
return R.failed("备案基数不等于社保户最高基数:"+setInfo.getUpperLimit()); return R.failed("备案基数不等于社保户("+setInfo.getDepartName()+")最高基数:"+setInfo.getUpperLimit());
} }
} else if (CommonConstants.ZERO_STRING.equals(rel.getPaymentType())){ } else if (CommonConstants.ZERO_STRING.equals(rel.getPaymentType())){
if (BigDecimal.valueOf(Double.valueOf(rel.getRecordBase())).compareTo(setInfo.getLowerLimit()) != 0) { if (BigDecimal.valueOf(Double.valueOf(rel.getRecordBase())).compareTo(setInfo.getLowerLimit()) != 0) {
return R.failed("备案基数不等于社保户最低基数:"+setInfo.getLowerLimit()); return R.failed("备案基数不等于社保户("+setInfo.getDepartName()+")最低基数:"+setInfo.getLowerLimit());
} }
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
......
...@@ -777,12 +777,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -777,12 +777,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
@Override @Override
public R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user) { public R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user) {
// 是否电子签,默认否
boolean fascFlag = false;
if (tEmployeeContractInfo != null) { if (tEmployeeContractInfo != null) {
if (Common.isEmpty(tEmployeeContractInfo.getId()) || Common.isEmpty(tEmployeeContractInfo.getAuditStatus())) { if (Common.isEmpty(tEmployeeContractInfo.getId()) || Common.isEmpty(tEmployeeContractInfo.getAuditStatus())) {
return R.failed("id、意见必填"); return R.failed("id、意见必填");
} }
TEmployeeContractInfo contractInfo = this.getById(tEmployeeContractInfo.getId()); TEmployeeContractInfo contractInfo = this.getById(tEmployeeContractInfo.getId());
if (contractInfo.getAuditStatus() != CommonConstants.ONE_INT) { if (Common.isNotNull(contractInfo.getSignType()) && CommonConstants.ZERO_STRING.equals(contractInfo.getSignType())) {
fascFlag = true;
}
if (contractInfo.getAuditStatus() != CommonConstants.ONE_INT
&& !fascFlag) {
// 电子签的也要审核
return R.failed("不是待审核状态!"); return R.failed("不是待审核状态!");
} }
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[2]) { if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[2]) {
...@@ -802,11 +809,11 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -802,11 +809,11 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL) .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
// 渲染字典值 // 渲染字典值
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get( Map<String, String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "personnel_type"); CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "personnel_type");
String tempStr = null; String tempStr = null;
for (Map.Entry<String,String> entry:dicObj.entrySet()){ for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getValue()) && entry.getValue().equals(contractInfo.getContractName())){ if (Common.isNotNull(entry.getValue()) && entry.getValue().equals(contractInfo.getContractName())) {
tempStr = entry.getKey(); tempStr = entry.getKey();
break; break;
} }
...@@ -815,7 +822,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -815,7 +822,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
tEmployeeProject.setContractStatus(CommonConstants.ONE_INT); tEmployeeProject.setContractStatus(CommonConstants.ONE_INT);
//签订类型正常签订的时候更新项目档案信息 //签订类型正常签订的时候更新项目档案信息
if (EmployeeConstants.SITUATION_ONE.equals(contractInfo.getSituation())) { if (EmployeeConstants.SITUATION_ONE.equals(contractInfo.getSituation())) {
tEmployeeProject.setContractType(null == tempStr? "":tempStr); tEmployeeProject.setContractType(null == tempStr ? "" : tempStr);
tEmployeeProject.setWorkingHours(contractInfo.getWorkingHours()); tEmployeeProject.setWorkingHours(contractInfo.getWorkingHours());
tEmployeeProject.setPost(contractInfo.getPost()); tEmployeeProject.setPost(contractInfo.getPost());
tEmployeeProject.setEnjoinDate(contractInfo.getContractStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); tEmployeeProject.setEnjoinDate(contractInfo.getContractStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
...@@ -842,7 +849,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -842,7 +849,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
TPreEmployeeProject preEmployeeProject = preEmployeeProjectMapper.selectOne(Wrappers.<TPreEmployeeProject>query() TPreEmployeeProject preEmployeeProject = preEmployeeProjectMapper.selectOne(Wrappers.<TPreEmployeeProject>query()
.lambda().eq(TPreEmployeeProject::getPreMainId, empMain.getId())); .lambda().eq(TPreEmployeeProject::getPreMainId, empMain.getId()));
if (Optional.ofNullable(preEmployeeProject).isPresent()) { if (Optional.ofNullable(preEmployeeProject).isPresent()) {
preEmployeeProject.setContractType(null == tempStr? "":tempStr); preEmployeeProject.setContractType(null == tempStr ? "" : tempStr);
preEmployeeProject.setWorkingHours(contractInfo.getWorkingHours()); preEmployeeProject.setWorkingHours(contractInfo.getWorkingHours());
preEmployeeProject.setPost(contractInfo.getPost()); preEmployeeProject.setPost(contractInfo.getPost());
preEmployeeProject.setEnjoinDate(contractInfo.getContractStart()); preEmployeeProject.setEnjoinDate(contractInfo.getContractStart());
...@@ -856,7 +863,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -856,7 +863,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if (EmployeeConstants.SITUATION_SEVEN.equals(contractInfo.getSituation()) if (EmployeeConstants.SITUATION_SEVEN.equals(contractInfo.getSituation())
&& Common.isNotNull(contractInfo.getChangeContractAndEmployee()) && Common.isNotNull(contractInfo.getChangeContractAndEmployee())
&& CommonConstants.ZERO_STRING.equals(contractInfo.getChangeContractAndEmployee())) { && CommonConstants.ZERO_STRING.equals(contractInfo.getChangeContractAndEmployee())) {
changeStatus(contractInfo,user); changeStatus(contractInfo, user);
} else { } else {
//先停用项目内的其他的员工合同————不要这个逻辑了 //先停用项目内的其他的员工合同————不要这个逻辑了
// 2022-7-22 16:54:12 产品倩倩与测试说,作废终止审核通过,仅将原先选择的合同不在用即可 // 2022-7-22 16:54:12 产品倩倩与测试说,作废终止审核通过,仅将原先选择的合同不在用即可
...@@ -909,14 +916,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -909,14 +916,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} }
} }
} }
//更新合同状态为4线下签待归档 if (!fascFlag) {
TEmployeeContractPre contractPre = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda() //更新合同状态为4线下签待归档
.eq(TEmployeeContractPre::getContractId, contractInfo.getId()) TEmployeeContractPre contractPre = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getProcessStatus, CommonConstants.TWO_STRING) .eq(TEmployeeContractPre::getContractId, contractInfo.getId())
.last(CommonConstants.LAST_ONE_SQL)); .eq(TEmployeeContractPre::getProcessStatus, CommonConstants.TWO_STRING)
if (Common.isNotNull(contractPre)) { .last(CommonConstants.LAST_ONE_SQL));
contractPre.setProcessStatus(CommonConstants.FOUR_STRING); if (Common.isNotNull(contractPre)) {
contractPreMapper.updateById(contractPre); contractPre.setProcessStatus(CommonConstants.FOUR_STRING);
contractPreMapper.updateById(contractPre);
}
} }
//瓜子项目编码:皖A694302 //瓜子项目编码:皖A694302
if (CommonConstants.GZ_DEPT_NO.equals(contractInfo.getDeptNo())) { if (CommonConstants.GZ_DEPT_NO.equals(contractInfo.getDeptNo())) {
...@@ -925,14 +934,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -925,14 +934,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} }
} }
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[3]) { if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[3]) {
//更新合同状态为3线下签审核不通过 if (!fascFlag) {
TEmployeeContractPre contractPre = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda() //更新合同状态为3线下签审核不通过
.eq(TEmployeeContractPre::getContractId, contractInfo.getId()) TEmployeeContractPre contractPre = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getProcessStatus, CommonConstants.TWO_STRING) .eq(TEmployeeContractPre::getContractId, contractInfo.getId())
.last(CommonConstants.LAST_ONE_SQL)); .eq(TEmployeeContractPre::getProcessStatus, CommonConstants.TWO_STRING)
if (Common.isNotNull(contractPre)) { .last(CommonConstants.LAST_ONE_SQL));
contractPre.setProcessStatus(CommonConstants.THREE_STRING); if (Common.isNotNull(contractPre)) {
contractPreMapper.updateById(contractPre); contractPre.setProcessStatus(CommonConstants.THREE_STRING);
contractPreMapper.updateById(contractPre);
}
} }
} }
tEmployeeContractInfo.setAuditUserName(user.getNickname()); tEmployeeContractInfo.setAuditUserName(user.getNickname());
...@@ -1018,11 +1029,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -1018,11 +1029,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} }
@Override @Override
public R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo) { public R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if (tEmployeeContractInfo != null) { if (tEmployeeContractInfo != null) {
if ((Common.isNotNull(tEmployeeContractInfo.getContractNo()) && tEmployeeContractInfo.getContractNo().length() > 50) if ((Common.isNotNull(tEmployeeContractInfo.getContractNo()) && tEmployeeContractInfo.getContractNo().length() > 50)
|| (Common.isNotNull(tEmployeeContractInfo.getFileCabinetNo()) && tEmployeeContractInfo.getFileCabinetNo().length() > 50)) { || (Common.isNotNull(tEmployeeContractInfo.getFileCabinetNo()) && tEmployeeContractInfo.getFileCabinetNo().length() > 50)) {
......
...@@ -23,24 +23,26 @@ import com.fasc.open.api.v5_1.res.template.SignTemplateDetailRes; ...@@ -23,24 +23,26 @@ import com.fasc.open.api.v5_1.res.template.SignTemplateDetailRes;
import com.fasc.open.api.v5_1.res.template.SignTemplateListInfo; import com.fasc.open.api.v5_1.res.template.SignTemplateListInfo;
import com.fasc.open.api.v5_1.res.template.SignTemplateListRes; import com.fasc.open.api.v5_1.res.template.SignTemplateListRes;
import com.yifu.cloud.plus.v1.yifu.archives.config.FascConfig; import com.yifu.cloud.plus.v1.yifu.archives.config.FascConfig;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractPre; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascPushLog; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplate;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplateDetail;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractPreMapper; 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.archives.service.TFascPushLogService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; 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.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException; import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.checkerframework.checker.units.qual.C; import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.File;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -609,8 +611,8 @@ public class FascUtil { ...@@ -609,8 +611,8 @@ public class FascUtil {
} }
// 获取附件 // 获取附件
public R<String> getFileByRequestId(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService public boolean getFileByRequestId(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService
, TEmployeeContractPreMapper tEmployeeContractPreMapper) throws ApiException { , TAttaInfoMapper tAttaInfoMapper , OSSUtil ossUtil) throws ApiException {
OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl()); OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl());
String accessToken = this.getFascToken(openApiClient); String accessToken = this.getFascToken(openApiClient);
...@@ -639,25 +641,67 @@ public class FascUtil { ...@@ -639,25 +641,67 @@ public class FascUtil {
if (Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getDocs())) { if (Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getDocs())) {
for (SignTaskGetFileRes.DocFileInfo doc : res.getData().getDocs()) { for (SignTaskGetFileRes.DocFileInfo doc : res.getData().getDocs()) {
if (Common.isNotNull(doc.getFddFileUrl())) { if (Common.isNotNull(doc.getFddFileUrl())) {
// TODO-存储文档 // 存储文档
//contract.setFileId(doc.getFileId()); // 将法大大回传的url字符串转化为流,存储到阿里云
this.streamUpload(doc.getFddFileUrl(), ossUtil, tAttaInfoMapper, contract.getContractId(), doc.getDocName());
} }
} }
} }
contract.setProcessStatus(CommonConstants.dingleDigitStrArray[9]); return true;
tEmployeeContractPreMapper.updateById(contract);
return R.ok();
} else { } else {
contract.setRequestMsg(res.getMsg()); return false;
tEmployeeContractPreMapper.updateById(contract);
return R.failed(res.getMsg());
} }
} }
return R.failed("res无返回"); return false;
} }
public void streamUpload(String fileUrl, OSSUtil ossUtil, TAttaInfoMapper tAttaInfoMapper, String domainId, String fileName) {
InputStream inputStream = null;
HttpURLConnection connection = null;
try {
// 创建URL连接
URL url = new URL(fileUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(30000);
connection.setReadTimeout(60000);
// 获取输入流
inputStream = connection.getInputStream();
String fileType = ".pdf";
fileName += fileType;
// Bucket 命名规范:1)只能包括小写字母,数字和短横线(-);2)必须以小写字母或者数字开头;3)长度必须在 3-63 字节之间。
String ossKey = "fasc/" + domainId + "/" + System.currentTimeMillis() + fileName;
// 直接流式上传到OSS
ossUtil.uploadFileByStream(inputStream, ossKey, null);
TAttaInfo unitAtta = new TAttaInfo();
unitAtta.setDomainId(domainId);
unitAtta.setRelationType(CommonConstants.FOUR_STRING);
unitAtta.setAttaName(fileName);
unitAtta.setAttaSrc(ossKey);
unitAtta.setAttaType(fileType);
unitAtta.setCreateTime(LocalDateTime.now());
unitAtta.setCreateName("法大大电子签");
tAttaInfoMapper.insert(unitAtta);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("法大大附件流式上传失败: " + e.getMessage());
} finally {
// 关闭资源
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (connection != null) {
connection.disconnect();
}
}
}
} }
...@@ -61,6 +61,7 @@ security: ...@@ -61,6 +61,7 @@ security:
- /gz/core/saveOfferInfo - /gz/core/saveOfferInfo
- /gz/core/getGzBank - /gz/core/getGzBank
- /fasc/api/fascCallback - /fasc/api/fascCallback
- /fasc/getFileByRequestId
# 文件上传相关 支持阿里云、华为云、腾讯、minio # 文件上传相关 支持阿里云、华为云、腾讯、minio
......
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