诺诺发票推送

This commit is contained in:
lvleigang 2025-06-27 17:31:12 +08:00
parent e02817cd4e
commit 4f52aea52f
1 changed files with 116 additions and 4 deletions

View File

@ -1,13 +1,21 @@
package com.hzya.frame.plugin.nuonuo.service.impl; package com.hzya.frame.plugin.nuonuo.service.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.plugin.nuonuo.dao.INuoNuoDao; import com.hzya.frame.plugin.nuonuo.dao.INuoNuoDao;
import com.hzya.frame.plugin.nuonuo.entity.NuoNuoEntity; import com.hzya.frame.plugin.nuonuo.entity.NuoNuoEntity;
import com.hzya.frame.plugin.nuonuo.service.INuoNuoService; import com.hzya.frame.plugin.nuonuo.service.INuoNuoService;
import com.hzya.frame.seeyon.enums.ColEventTypeEnum;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.hzya.frame.basedao.service.impl.BaseService; import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> implements INuoNuoService { public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> implements INuoNuoService {
private INuoNuoDao nuoNuoDao; private INuoNuoDao nuoNuoDao;
@ -27,12 +35,116 @@ public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> impleme
**/ **/
@Override @Override
public JsonResultEntity sendNuoNuoFaPiao(JSONObject requestJson) { public JsonResultEntity sendNuoNuoFaPiao(JSONObject requestJson) {
logger.error(" 资金拨付流程结束回调:"+requestJson.toJSONString());
//String dataSourceCode = requestJson.getString("apiDataSourceCode");//数据源
//String headerStr = requestJson.getString("headers");//表头
//String eventType = requestJson.getString("eventType");
//String summaryId = requestJson.getString("summaryId");
//Assert.notEmpty(dataSourceCode,"数据源不能为空");
//Assert.notEmpty(headerStr,"headers不能为空");
//Assert.notEmpty(eventType,"eventType不能为空");
//Assert.notEmpty(summaryId,"summaryId不能为空");
//JSONObject headers = requestJson.getJSONObject("headers");
//String formmainTableName = headers.getString("formmainTableName");
//JSONObject jsonStrObj = requestJson.getJSONObject("jsonStr");
//JSONObject businessData = jsonStrObj.getJSONObject("businessDataStr");
//JSONObject formmainData = businessData.getJSONObject(formmainTableName);
//if (null != formmainData){
// //税务系统id这个字段不为空时表示是税务推过来的单子
// String field0061 = formmainData.getString("field0061");
// //司库系统批次号
// String field0063 = formmainData.getString("field0063");
// //资金归集
// String field0062 = formmainData.getString("field0062");
// if (StrUtil.isNotEmpty(field0061) || StrUtil.isNotEmpty(field0063) || StrUtil.isNotEmpty(field0062)){
// //查询审批意见
// FundsAllocationEntity fundAllocation = new FundsAllocationEntity();
// fundAllocation.setCol_summary_id(summaryId);
// fundAllocation.setDataSourceCode(dataSourceCode);
// List<FundsAllocationEntity> fundsAllocationList = fundsAllocationService.queryCtpCommentList(fundAllocation);
// if (CollectionUtils.isNotEmpty(fundsAllocationList)){
// fundAllocation = fundsAllocationList.get(0);
// }
// String appId = "";//应用
// String apiCode = "";//api
// String param = "";//参数
// if (StrUtil.isNotEmpty(field0061)){
// appId = "800060";
// apiCode = "8000600008";
// //税务
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("transferOrderNumber",field0061);
// jsonObject.put("approvalUser",fundAllocation.getName());
// jsonObject.put("approvalTime",fundAllocation.getApproval_time());
// jsonObject.put("approvalRemark",StrUtil.isEmpty(fundAllocation.getContent()) ? "审批通过" : fundAllocation.getContent());
// if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
// jsonObject.put("approvalStatus","2");
// }else if (ColEventTypeEnum.ONSTOP.getType().equals(eventType)){//审批终止
// jsonObject.put("approvalStatus","3");
// }
// param = jsonObject.toJSONString();
// }else if (StrUtil.isNotEmpty(field0063)){
// appId = "800058";
// apiCode = "8000580004";
// //司库
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("batchNo",field0063);
// jsonObject.put("reason",fundAllocation.getContent());
// if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
// jsonObject.put("status","APPROVED");
// }else if (ColEventTypeEnum.ONSTOP.getType().equals(eventType)){//审批终止
// jsonObject.put("status","REJECTION");
// }
// JSONObject objectData = new JSONObject();
// objectData.put("data",jsonObject);
// logger.info("资金拨付审批回调司库请求参数明文:{}",objectData.toJSONString());
// String encrypt = SM2Util.encrypt(objectData.toJSONString(),publicKey);
// JSONObject jsonData = new JSONObject();
// jsonData.put("data",encrypt);
// param = jsonData.toJSONString();
// }else if (StrUtil.isNotEmpty(field0062)){
// appId = "800058";
// apiCode = "8000580004";
// //司库
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("batchNo",field0062);
// jsonObject.put("reason",fundAllocation.getContent());
// if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
// jsonObject.put("status","APPROVED");
// }else if (ColEventTypeEnum.ONSTOP.getType().equals(eventType)){//审批终止
// jsonObject.put("status","REJECTION");
// }
// JSONObject objectData = new JSONObject();
// objectData.put("data",jsonObject);
// logger.info("资金归集审批回调司库请求参数明文:{}",objectData.toJSONString());
// String encrypt = SM2Util.encrypt(objectData.toJSONString(),publicKey);
// JSONObject jsonData = new JSONObject();
// jsonData.put("data",encrypt);
// param = jsonData.toJSONString();
// }
// if (StrUtil.isNotEmpty(appId) && StrUtil.isNotEmpty(apiCode) && StrUtil.isNotEmpty(param)){
// logger.info("回调有度/司库请求apiCode{},报文:{}",apiCode,param);
// String result = HttpRequest.post(interfaceUrl)
// .header("appId", appId)//税务/司库应用
// .header("apiCode", apiCode)//回调接口
// .header("publicKey", "ZJYA7f8FzV219otH8zhkReiyyWpXswpbY/+StvC2em0hf59Ce7eDIk+3zDUT+v578prj")//OA公钥
// .header("secretKey", "xJ9J1Ev2F0faiJ/nQnCNklskAgtQp3QSm+ihO21uY/H0UADj0tSDPxmIhFfC4v6Fj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
// .body(param)//表单内容
// .timeout(30000)//超时毫秒
// .execute().body();
// logger.info("回调有度/司库返回报文:{}",result);
// return BaseResult.getSuccessMessageEntity(result);
// }else {
// logger.info("appId、apiCode、param 其中有参数是空的,不能执行");
// }
// }else {
// logger.info("不是有度税务/中信司库推过来的单子,不需要执行");
// }
//}
return BaseResult.getFailureMessageEntity("表单数据为空");
return null;
} }
} }