Commit 66b6fe4b authored by hongguangwu's avatar hongguangwu

MVP1.7.16-法大大

parent ad6c66e4
...@@ -2,7 +2,6 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller; ...@@ -2,7 +2,6 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fadada.api.utils.crypt.FddCryptUtil; import com.fadada.api.utils.crypt.FddCryptUtil;
import com.fasc.open.api.constants.RequestConstants; import com.fasc.open.api.constants.RequestConstants;
import com.fasc.open.api.exception.ApiException; import com.fasc.open.api.exception.ApiException;
...@@ -17,7 +16,6 @@ import io.swagger.v3.oas.annotations.Operation; ...@@ -17,7 +16,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -29,8 +27,6 @@ import javax.servlet.http.HttpServletResponse; ...@@ -29,8 +27,6 @@ import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.alibaba.fastjson.serializer.SerializerFeature.*;
/** /**
* @auther huyc * @auther huyc
* @date 2022/6/29 * @date 2022/6/29
...@@ -103,46 +99,19 @@ public class FascController { ...@@ -103,46 +99,19 @@ public class FascController {
return fascService.urgeTask(id); return fascService.urgeTask(id);
} }
/**
* @param id 合同待签订任务记录表TEmployeeContractPre:id
* @Description: 获取附件
* @Author: hgw
* @Date: 2025/10/13 17:24
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "获取附件")
@GetMapping("/getFileByRequestId")
public R<String> getFileByRequestId(@RequestParam String id) throws ApiException {
return fascService.getFileByRequestId(id);
}
// 法大大回调
/*@ResponseBody
@PostMapping(value = "/api/fascCallback")
public String fddEventCallback(@RequestHeader HttpHeaders headers,
@RequestParam("bizContent") String bizContent) throws Exception {
//appSecret,由开发者登陆到法大大官网,在应用管理管理中点击应用详情里面获取
String appSecret = "xxxx";
//获取请求头参数
String appId = headers.getFirst("X-FASC-App-Id");
String signType = headers.getFirst("X-FASC-Sign-Type");
String sign = headers.getFirst("X-FASC-Sign");
String timestamp = headers.getFirst("X-FASC-Timestamp");
//事件名称,开发者可以根据不同事件名称去解析bizContent的值,实现不同的逻辑
String event = headers.getFirst("X-FASC-Event");
String nonce = headers.getFirst("X-FASC-Nonce");
//验签
Map<String, String> paramMap = new HashMap<>();
paramMap.put("X-FASC-App-Id", appId);
paramMap.put("X-FASC-Sign-Type", "HMAC-SHA256");
paramMap.put("X-FASC-Timestamp", timestamp);
paramMap.put("X-FASC-Nonce", nonce);
paramMap.put("X-FASC-Event", event);
paramMap.put("bizContent", bizContent);
//参数排序,ascii码排序
String sortParam = FddCryptUtil.sortParameters(paramMap);
//生成签名后可以进行校验
String signature = FddCryptUtil.sign(sortParam, timestamp, appSecret);
if(!signature.equals(sign)) {
//log.error("日志记录,签名失败");
//为了不重复接收该请求,建议这里返回success,返回success后这条消息法大大将中断重试回调机制
return "{\"code\":\"200\";\"msg\":\"success\"}";
}
return "{\"code\":\"200\";\"msg\":\"success\"}";
}*/
private static final SerializerFeature[] features = new SerializerFeature[]{
WriteMapNullValue, WriteNullNumberAsZero, WriteNullListAsEmpty,
WriteNullStringAsEmpty, WriteDateUseDateFormat
};
@Operation(summary = "异步通知", description = "异步通知") @Operation(summary = "异步通知", description = "异步通知")
@RequestMapping(value = "/api/fascCallback") @RequestMapping(value = "/api/fascCallback")
......
...@@ -41,5 +41,7 @@ public interface FascService extends IService<FddContractInfo> { ...@@ -41,5 +41,7 @@ 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;
} }
...@@ -245,6 +245,29 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -245,6 +245,29 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
return fascUtil.urgeTask(contract, tFascPushLogService, tEmployeeContractPreMapper); return fascUtil.urgeTask(contract, tFascPushLogService, tEmployeeContractPreMapper);
} }
/**
* @param id TEmployeeContractPre主键
* @Description: 获取附件
* @Author: hgw
* @Date: 2025/10/15 17:56
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> getFileByRequestId(String id) throws ApiException {
// templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) {
return R.failed("未找到合同");
}
if (Common.isEmpty(contract.getRequestId())) {
return R.failed("无requestId,请检查数据");
}
// TODO - 判断什么状态催办等,需要产品定
return fascUtil.getFileByRequestId(contract, tFascPushLogService, tEmployeeContractPreMapper);
}
} }
...@@ -17,6 +17,7 @@ import com.fasc.open.api.v5_1.req.template.SignTemplateDetailReq; ...@@ -17,6 +17,7 @@ import com.fasc.open.api.v5_1.req.template.SignTemplateDetailReq;
import com.fasc.open.api.v5_1.req.template.SignTemplateListFilterInfo; import com.fasc.open.api.v5_1.req.template.SignTemplateListFilterInfo;
import com.fasc.open.api.v5_1.res.service.AccessTokenRes; 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.CreateSignTaskRes;
import com.fasc.open.api.v5_1.res.signtask.SignTaskGetFileRes;
import com.fasc.open.api.v5_1.res.template.DocumentInfo; import com.fasc.open.api.v5_1.res.template.DocumentInfo;
import com.fasc.open.api.v5_1.res.template.SignTemplateDetailRes; 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;
...@@ -35,6 +36,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; ...@@ -35,6 +36,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil; 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.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.checkerframework.checker.units.qual.C;
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;
...@@ -606,5 +608,56 @@ public class FascUtil { ...@@ -606,5 +608,56 @@ public class FascUtil {
return R.failed("res无返回"); return R.failed("res无返回");
} }
// 获取附件
public R<String> getFileByRequestId(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService
, TEmployeeContractPreMapper tEmployeeContractPreMapper) throws ApiException {
OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl());
String accessToken = this.getFascToken(openApiClient);
SignTaskClient signTaskClient = new SignTaskClient(openApiClient) ;
SignTaskGetFileReq signTaskGetFileReq = new SignTaskGetFileReq() ;
signTaskGetFileReq.setSignTaskId(contract.getRequestId()) ;
signTaskGetFileReq.setAccessToken(accessToken) ;
// 新增推送日志
TFascPushLog pushLog = new TFascPushLog();
pushLog.setTransReferenceId(fascConfig.getOpenId());
pushLog.setPushData(JSON.toJSONString(signTaskClient, features));
pushLog.setTaskStatus(CommonConstants.ZERO_STRING);
String empIdCard = contract.getEmpIdcard();
pushLog.setTypeKey("获取附件,身份证:" + empIdCard);
pushLog.setTypeName("获取附件");
pushLog.setContractId(contract.getId());
tFascPushLogService.save(pushLog);
BaseRes<SignTaskGetFileRes> res = signTaskClient.signTaskGetFile(signTaskGetFileReq) ;
if (res != null) {
pushLog.setReturnData(JSON.toJSONString(res, features));
pushLog.setTaskStatus(res.isSuccess() ? CommonConstants.ONE_STRING : CommonConstants.TWO_STRING);
tFascPushLogService.updateById(pushLog);
if (res.isSuccess()) {
if (Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getDocs())) {
for (SignTaskGetFileRes.DocFileInfo doc : res.getData().getDocs()) {
if (Common.isNotNull(doc.getFddFileUrl())) {
// TODO-存储文档
//contract.setFileId(doc.getFileId());
}
}
}
contract.setProcessStatus(CommonConstants.dingleDigitStrArray[9]);
tEmployeeContractPreMapper.updateById(contract);
return R.ok();
} else {
contract.setRequestMsg(res.getMsg());
tEmployeeContractPreMapper.updateById(contract);
return R.failed(res.getMsg());
}
}
return R.failed("res无返回");
}
} }
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