Merge remote-tracking branch 'origin/ht' into ht

This commit is contained in:
yuqh 2025-06-25 14:32:58 +08:00
commit be8089625e
49 changed files with 1884 additions and 512 deletions

View File

@ -1,5 +1,6 @@
package com.hzya.frame.plugin.cinvoice.assembler;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
@ -8,6 +9,7 @@ import com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivPlaneticketEntity;
import com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivPlaneticketsEntity;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
@ -109,7 +111,10 @@ public class ElecFlightInvoiceAssembler implements ParamAssembler{
flightItem.setSl("");//数量
flightItem.setDj("");//单价
flightItem.setJe(planeticketH.getPT_PRICE());//金额
flightItem.setSlv(planeticketH.getPT_TAXRATE());//税率
if (StrUtil.isEmpty(planeticketH.getPT_TAXRATE())){
planeticketH.setPT_TAXRATE(null);
}
flightItem.setSlv(Convert.toBigDecimal(planeticketH.getPT_TAXRATE()));//税率
flightItem.setSe(planeticketH.getPT_TAXAMOUNT());//税额
}
filightItemList.add(flightItem);
@ -118,4 +123,9 @@ public class ElecFlightInvoiceAssembler implements ParamAssembler{
}
return param;
}
public static void main(String[] args) {
BigDecimal bigDecimal = Convert.toBigDecimal(null);
System.out.println(bigDecimal);
}
}

View File

@ -14,6 +14,16 @@ public class CInvoiceImportHEntity extends BaseEntity {
private String bill_type;
//单据编码
private String bill_code;
//有度发票导入结果字段名
private String yd_res_field;
//有度发票导入接口返回的id
private String yd_result;
//发起时间
private String start_date;
//推送状态
private String push_status;
//推送字段
private String push_field;
public String getTab_name() {
return tab_name;
@ -38,4 +48,44 @@ public class CInvoiceImportHEntity extends BaseEntity {
public void setBill_code(String bill_code) {
this.bill_code = bill_code;
}
public String getYd_res_field() {
return yd_res_field;
}
public void setYd_res_field(String yd_res_field) {
this.yd_res_field = yd_res_field;
}
public String getYd_result() {
return yd_result;
}
public void setYd_result(String yd_result) {
this.yd_result = yd_result;
}
public String getStart_date() {
return start_date;
}
public void setStart_date(String start_date) {
this.start_date = start_date;
}
public String getPush_status() {
return push_status;
}
public void setPush_status(String push_status) {
this.push_status = push_status;
}
public String getPush_field() {
return push_field;
}
public void setPush_field(String push_field) {
this.push_field = push_field;
}
}

View File

@ -4,59 +4,30 @@
<resultMap id="get-CInvoiceImportHEntity-result" type="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
<result property="id" column="id" />
<result property="tab_name" column="tab_name" />
<result property="yd_res_field" column="yd_res_field" />
<result property="bill_type" column="bill_type" />
<result property="bill_code" column="bill_code" />
<result property="push_status" column="push_status" />
<result property="push_field" column="push_field" />
<result property="start_date" column="start_date" />
</resultMap>
<select id="entity_list_base" resultMap="get-CInvoiceImportHEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
select * from (
SELECT
id,
'formmain_0327' as tab_name,
'对公付款单' as bill_type,
field0146 as bill_code
FROM
formmain_0327
WHERE
1 = 1
-- and finishedflag = 1
UNION ALL
SELECT
id,
'formmain_0533' as tab_name,
'差旅费报销单' as bill_type,
field0094 as bill_code
FROM
formmain_0533
WHERE
1 = 1
-- and finishedflag = 1
UNION ALL
-- 日常费用报销
SELECT
id,
'formmain_0314' as tab_name,
'日常报销单' as bill_type,
field0220 as bill_code
FROM
formmain_0314
UNION ALL
-- 业务招待费
SELECT
id,
'formmain_0294' as tab_name,
'招待报销单' as bill_type,
field0053 as bill_code
FROM
formmain_0294
) f
select * from v_hzya_invoice_import f
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">f.id = #{id}</if>
<if test="bill_code != null and bill_code != ''">and f.bill_code = #{bill_code}</if>
and push_status is null
-- and start_date >= '2025-05-26'
</trim>
</select>
<update id="entity_update" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
update ${tab_name} set ${yd_res_field} = #{yd_result} where id = #{id}
</update>
<update id="entity_update_status" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
update ${tab_name} set ${push_field} = '1' where id = #{id}
</update>
</mapper>

View File

@ -77,7 +77,7 @@ public class LexmiscivPlaneticketEntity extends BaseEntity {
/**
* 无备注
*/
private BigDecimal PT_TAXRATE;
private String PT_TAXRATE;
/**
* 无备注
*/
@ -387,11 +387,11 @@ public class LexmiscivPlaneticketEntity extends BaseEntity {
return PT_AMOUNT;
}
public BigDecimal getPT_TAXRATE() {
public String getPT_TAXRATE() {
return PT_TAXRATE;
}
public void setPT_TAXRATE(BigDecimal PT_TAXRATE) {
public void setPT_TAXRATE(String PT_TAXRATE) {
this.PT_TAXRATE = PT_TAXRATE;
}

View File

@ -3,6 +3,7 @@ package com.hzya.frame.plugin.cinvoice.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.cinvoice.service.ICInvoiceImportPluginService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -94,8 +95,8 @@ public class CInvoiceImportPluginInitializer extends PluginBaseEntity {
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("======开始执OA发票批量导入有度税务插件======");
logger.info("======开始执OA发票批量导入有度税务插件======:{}",requestJson.toString());
pluginService.importInvoice(requestJson);
return null;
return BaseResult.getSuccessMessageEntity("执行成功");
}
}

View File

@ -19,4 +19,18 @@ public interface ICInvoiceImportHService extends IBaseService<CInvoiceImportHEnt
* @throws Exception
*/
List<CInvoiceImportHEntity> queryInvoiceList(CInvoiceImportHEntity entity) throws Exception;
/**
* 更新有度导入接口返回的id
* @param entity
* @return
*/
int updateResultId(CInvoiceImportHEntity entity);
/**
* 更新推送标记
* @param entity
* @return
*/
int updateStatus(CInvoiceImportHEntity entity);
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.plugin.cinvoice.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.plugin.cinvoice.dao.ICInvoiceImportHDao;
@ -42,4 +43,40 @@ public class CInvoiceImportHServiceImpl extends BaseService<CInvoiceImportHEntit
List<CInvoiceImportHEntity> list = cInvoiceImportHDao.queryList(entity, "com.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl.entity_list_base");
return list;
}
/**
* 更新有度导入接口返回的id
*
* @param entity
* @return
*/
@DS("#entity.dataSourceCode")
@Override
public int updateResultId(CInvoiceImportHEntity entity) {
if (null != entity
&& StrUtil.isNotEmpty(entity.getTab_name())
&& StrUtil.isNotEmpty(entity.getYd_res_field()) && StrUtil.isNotEmpty(entity.getYd_result())){
int updateRows = cInvoiceImportHDao.update("com.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl.entity_update", entity);
return updateRows;
}
return 0;
}
/**
* 更新推送标记
*
* @param entity
* @return
*/
@DS("#entity.dataSourceCode")
@Override
public int updateStatus(CInvoiceImportHEntity entity) {
if (null != entity
&& StrUtil.isNotEmpty(entity.getTab_name())
&& StrUtil.isNotEmpty(entity.getPush_field())){
int updateRows = cInvoiceImportHDao.update("com.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl.entity_update_status", entity);
return updateRows;
}
return 0;
}
}

View File

@ -16,6 +16,7 @@ import com.hzya.frame.plugin.cinvoice.service.ICInvoiceImportPluginService;
import com.hzya.frame.seeyon.util.YzfSignUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -58,6 +59,7 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Value("${zt.url:}")
private String url;
/**
* 发票导入
*
@ -71,55 +73,63 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
//1 查OA主表
String dataSourceCode = requestJson.getString("sourceCode");
String id = requestJson.getString("id");//主表id
if (StrUtil.isEmpty(dataSourceCode)) {
dataSourceCode = requestJson.getString("apiDataSourceCode");
}
String id = requestJson.getString("id");//主表id 测试的时候用
CInvoiceImportHEntity importHEntity = new CInvoiceImportHEntity();
importHEntity.setDataSourceCode(dataSourceCode);
importHEntity.setId("6286766887088770238");
importHEntity.setId(id);
List<CInvoiceImportHEntity> cInvoiceImportHList = cInvoiceImportHService.queryInvoiceList(importHEntity);
if (CollectionUtils.isNotEmpty(cInvoiceImportHList)){
if (CollectionUtils.isNotEmpty(cInvoiceImportHList)) {
ParamAssembler assembler = null;
CInvoiceImportHEntity cInvoiceH = cInvoiceImportHList.get(0);
cInvoiceH.setDataSourceCode(dataSourceCode);
//2 查OA明细表
//3 查迈瑞思发票表
//迈锐思发票公共信息表
LexmisPublicinfoEntity lexmisPublicinfoEntity = new LexmisPublicinfoEntity(cInvoiceH.getId(),dataSourceCode);
lexmisPublicinfoEntity.setPI_ID("-95056949260236712");
logger.info("开始查迈锐思发票公共表信息:{},{}",cInvoiceH.getId(),cInvoiceH.getBill_code());
LexmisPublicinfoEntity lexmisPublicinfoEntity = new LexmisPublicinfoEntity(cInvoiceH.getId(), dataSourceCode);
//lexmisPublicinfoEntity.setPI_ID("6952494198841691018");
List<LexmisPublicinfoEntity> lexmisPublicinfoEntityList = lexmisPublicinfoService.query(lexmisPublicinfoEntity);
if (CollectionUtils.isNotEmpty(lexmisPublicinfoEntityList)){
if (CollectionUtils.isNotEmpty(lexmisPublicinfoEntityList)) {
cInvoiceH.setPush_status("1");
cInvoiceImportHService.updateStatus(cInvoiceH);
//税务接口每次最多传50张发票
int size = lexmisPublicinfoEntityList.size();
int batchSize = 50;
for (int i = 0; i < size; i += batchSize){
for (int i = 0; i < size; i += batchSize) {
try {
int no = 1;//序号
//4 根据发票类型组装不同参数
JSONObject head = new JSONObject();
JSONArray inputInfos = new JSONArray();
head.put("inputInfos",inputInfos);//发票录入信息单次最大50张
head.put("inputInfos", inputInfos);//发票录入信息单次最大50张
// 获取当前批次的子列表
List<LexmisPublicinfoEntity> batchList = lexmisPublicinfoEntityList.subList(i, Math.min(i + batchSize, size));
//使用stream方式 publicinfoList PI_TABLENAME分组
Map<String, List<LexmisPublicinfoEntity>> groupedByPiTablename = batchList.stream()
.collect(Collectors.groupingBy(LexmisPublicinfoEntity::getPI_TABLENAME));
for (Map.Entry<String,List<LexmisPublicinfoEntity>> entry : groupedByPiTablename.entrySet()){
for (Map.Entry<String, List<LexmisPublicinfoEntity>> entry : groupedByPiTablename.entrySet()) {
String key = entry.getKey();//对应发票类型的表名
List<LexmisPublicinfoEntity> publicinfoList = entry.getValue();
for (LexmisPublicinfoEntity info : publicinfoList){
for (LexmisPublicinfoEntity info : publicinfoList) {
JSONObject inputInfo = new JSONObject();
inputInfos.add(inputInfo);
inputInfo.put("no",no);//编号
inputInfo.put("systemName","4");//来源系统 默认写4 代表OA
inputInfo.put("businessNo",cInvoiceH.getBill_code());//业务单据号
inputInfo.put("bookkeepingStatus","1");//记账状态默认传1
inputInfo.put("customFlag","2");//业务流转状态默认传2
inputInfo.put("no", no);//编号
inputInfo.put("systemName", "4");//来源系统 默认写4 代表OA
inputInfo.put("businessNo", cInvoiceH.getBill_code());//业务单据号
inputInfo.put("bookkeepingStatus", "1");//记账状态默认传1
inputInfo.put("customFlag", "2");//业务流转状态默认传2
JSONObject invoiceInfo = new JSONObject();//票面信息
inputInfo.put("invoiceInfo", invoiceInfo);
JSONObject baseInfo = new JSONObject();//发票基本信息
JSONObject contentInfo = new JSONObject();//发票内容
JSONArray taxturnsInfos = new JSONArray();//进项转出信息
invoiceInfo.put("taxturnsInfos",taxturnsInfos);
invoiceInfo.put("taxturnsInfos", taxturnsInfos);
switch (key){
switch (key) {
case "LEXMISCIV_INVOICEMAIN"://增值税发票
zzsInvoice(dataSourceCode, info, invoiceInfo, baseInfo);
break;
@ -138,23 +148,32 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
}
no++;
}
head.put("taxNo",publicinfoList.get(0).getPI_TAXNO());//当前企业税号
head.put("taxNo", publicinfoList.get(0).getPI_TAXNO());//当前企业税号
}
logger.info("调用有度发票批量导入接口请求参数:{}",head.toString());
logger.info("调用有度发票批量导入接口请求参数:{}", head.toString());
//调用税务接口
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
.put("apiCode", "8000600005")//有度发票导入接口
.put("publicKey","ZJYA7f8FzV219otH8zhkReiyyWpXswpbY/+StvC2em0hf59Ce7eDIk+3zDUT+v578prj")//发起方应用
.put("secretKey","xJ9J1Ev2F0faiJ/nQnCNklskAgtQp3QSm+ihO21uY/H0UADj0tSDPxmIhFfC4v6Fj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//发起方应用
.put("appId","800060")
.put("publicKey", "ZJYA7f8FzV219otH8zhkReiyyWpXswpbY/+StvC2em0hf59Ce7eDIk+3zDUT+v578prj")//发起方应用
.put("secretKey", "xJ9J1Ev2F0faiJ/nQnCNklskAgtQp3QSm+ihO21uY/H0UADj0tSDPxmIhFfC4v6Fj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//发起方应用
.put("appId", "800060")
.build();
String body = HttpRequest.post(url).addHeaders(headerMap).body(head.toString()).timeout(60000).execute().body();
//String body = null;
logger.info("调用有度发票批量导入接口响应参数:{}",body);
logger.info("调用有度发票批量导入接口响应参数:{}", body);
//保存操作日志
if (StrUtil.isNotEmpty(body)){
if (StrUtil.isNotEmpty(body)) {
JSONObject jsonObject = JSONObject.parseObject(body);
Boolean flag = jsonObject.getBoolean("flag");
JSONObject resObj = jsonObject.getJSONObject("attribute");
if (null != resObj && "0".equals(resObj.getString("code"))) {
String result = resObj.getString("result");
if (StrUtil.isNotEmpty(result)) {
cInvoiceH.setDataSourceCode(dataSourceCode);
cInvoiceH.setYd_result(result);
cInvoiceImportHService.updateResultId(cInvoiceH);
}
}
//保存日志
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
taskLivingDetail.setCreate_time(new Date());
@ -165,9 +184,15 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
taskLivingDetail.setRootAppNewData(head.toString());
taskLivingDetail.setNewTransmitInfo(body);
taskLivingDetail.setNewPushDate(new Date());
this.saveLog(id,flag,taskLivingDetail);
this.saveLog(id, flag, taskLivingDetail);
}
} catch (Exception e) {
logger.error("发票批量导入有度系统循环中出错:{}", e.getMessage());
}
}
}else {
cInvoiceH.setPush_status("未查询到有效数据不推送");
cInvoiceImportHService.updateStatus(cInvoiceH);
}
}
@ -176,39 +201,41 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
}
/**
* 保存日志
*
* @param integration_task_living_details_id
* @param flag
* @param taskLivingDetail
*/
public void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail){
public void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail) {
try {
//判断成功调用这个方法
if (StrUtil.isEmpty(integration_task_living_details_id)){
if (flag){
if (StrUtil.isEmpty(integration_task_living_details_id)) {
if (flag) {
taskLivingDetailsService.saveLogToSuccess(taskLivingDetail);
}else {
} else {
//失败 调用这个方法
taskLivingDetailsService.saveLogToFail(taskLivingDetail);
}
}else {
} else {
taskLivingDetail.setId(integration_task_living_details_id);
if (flag){
if (flag) {
//如果是重试 成功调这个方法
taskLivingDetailsService.saveLogFailToSuccess(taskLivingDetail);
}else {
} else {
//如果是重试 失败调这个方法
taskLivingDetailsService.updateLogFailToSuccess(taskLivingDetail);
}
}
}catch (Exception e){
logger.error("保存日志出错:{}",e);
} catch (Exception e) {
logger.error("保存日志出错:{}", e);
}
}
/**
* 机票
*
* @param dataSourceCode
* @param info
* @param invoiceInfo
@ -219,16 +246,16 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
JSONObject contentInfo;
ParamAssembler assembler;
LexmiscivPlaneticketEntity planeticketH = lexmiscivPlaneticketService.queryOne(new LexmiscivPlaneticketEntity(info.getPI_DATAKEY(), dataSourceCode));
if (null != planeticketH){
if (null != planeticketH) {
String fplx = "a4";
LexmiscivPlaneticketsEntity planeticketB = new LexmiscivPlaneticketsEntity(planeticketH.getPT_ID(), dataSourceCode);
//飞机行程单子表
List<LexmiscivPlaneticketsEntity> planeticketBList = lexmiscivPlaneticketsService.query(planeticketB);
JSONObject planeObj = new JSONObject();
planeObj.put("planeticketH",JSONObject.toJSONString(planeticketH));
planeObj.put("planeticketBList",JSONObject.toJSONString(planeticketBList));
planeObj.put("planeticketH", JSONObject.toJSONString(planeticketH));
planeObj.put("planeticketBList", JSONObject.toJSONString(planeticketBList));
//1表示电子行程单 先不区分试试策略类内部判断来实现区分
if ("1".equals(planeticketH.getPT_ELECTRONICMARK())){
if ("1".equals(planeticketH.getPT_ELECTRONICMARK())) {
//assembler = new ElecFlightInvoiceAssembler(planeObj);
fplx = "400";
}
@ -238,24 +265,25 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
assembler = new ElecFlightInvoiceAssembler(planeObj);
context = new ParamAssemblerContext(assembler);
contentInfo = context.assemble();
baseInfo.put("fphm",planeticketH.getPT_FPHM());//发票号码
baseInfo.put("fpdm","");//发票代码
baseInfo.put("fplx",fplx);//发票类型
baseInfo.put("kprq",planeticketH.getPT_MAKEDATE());//开票日期
baseInfo.put("bhszje",planeticketH.getPT_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym",planeticketH.getPT_VALIDCODE());//校验码
baseInfo.put("bxje",planeticketH.getPT_NOTAXAMOUNT());//不含税实际报销金额
baseInfo.put("jsse","");//有效计算税额
baseInfo.put("jsdkzq","");//计算抵扣账期
baseInfo.put("signPerson","");//签收人
baseInfo.put("signStatus","1");//签收状态默认传1
baseInfo.put("fphm", planeticketH.getPT_FPHM());//发票号码
baseInfo.put("fpdm", "");//发票代码
baseInfo.put("fplx", fplx);//发票类型
baseInfo.put("kprq", planeticketH.getPT_MAKEDATE());//开票日期
baseInfo.put("bhszje", planeticketH.getPT_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym", planeticketH.getPT_VALIDCODE());//校验码
baseInfo.put("bxje", planeticketH.getPT_NOTAXAMOUNT());//不含税实际报销金额
baseInfo.put("jsse", "");//有效计算税额
baseInfo.put("jsdkzq", "");//计算抵扣账期
baseInfo.put("signPerson", "");//签收人
baseInfo.put("signStatus", "1");//签收状态默认传1
invoiceInfo.put("baseInfo", baseInfo);
invoiceInfo.put("contentInfo",contentInfo);
invoiceInfo.put("contentInfo", contentInfo);
}
}
/**
* 火车票发票
*
* @param dataSourceCode
* @param inputInfos
* @param info
@ -270,34 +298,34 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
LexmiscivTrainticketEntity trainticketEntity = new LexmiscivTrainticketEntity(info.getPI_DATAKEY(), dataSourceCode);
trainticketEntity.setTT_BUSINESSTYPE(1);//1售票 2退票 3售票换开 4退票换开3和4没遇到过先查1
LexmiscivTrainticketEntity trainticket = lexmiscivTrainticketService.queryOne(trainticketEntity);
if (null != trainticket){
if (null != trainticket) {
JSONObject trainObj = new JSONObject();
trainObj.put("trainInvoice",JSONObject.toJSONString(trainticket));
trainObj.put("publicInvoice",JSONObject.toJSONString(info));
trainObj.put("trainInvoice", JSONObject.toJSONString(trainticket));
trainObj.put("publicInvoice", JSONObject.toJSONString(info));
String fplx = "a2";
//1是电子票
if ("1".equals(trainticket.getTT_ELECTRONIC())){
if ("1".equals(trainticket.getTT_ELECTRONIC())) {
assembler = new ElecTrainInvoiceAssembler(trainObj);
fplx = "200";
}else {
} else {
assembler = new TrainInvoiceAssembler(trainObj);
}
context = new ParamAssemblerContext(assembler);
contentInfo = context.assemble();
baseInfo.put("fphm",trainticket.getTT_CODE());//发票号码
baseInfo.put("fpdm","");//发票代码 火车票不用传
baseInfo.put("fplx",fplx);//发票类型
baseInfo.put("kprq",DateUtil.format(trainticket.getTT_DATE(),"yyyy-MM-dd"));//开票日期
baseInfo.put("bhszje",trainticket.getTT_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym","");//校验码
baseInfo.put("bxje",trainticket.getTT_NOTAXAMOUNT());//不含税实际报销金额
baseInfo.put("jsse","");//有效计算税额
baseInfo.put("jsdkzq","");//计算抵扣账期
baseInfo.put("signPerson","");//签收人
baseInfo.put("signStatus","1");//签收状态默认传1
baseInfo.put("fphm", trainticket.getTT_CODE());//发票号码
baseInfo.put("fpdm", "");//发票代码 火车票不用传
baseInfo.put("fplx", fplx);//发票类型
baseInfo.put("kprq", DateUtil.format(trainticket.getTT_DATE(), "yyyy-MM-dd"));//开票日期
baseInfo.put("bhszje", trainticket.getTT_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym", "");//校验码
baseInfo.put("bxje", trainticket.getTT_NOTAXAMOUNT());//不含税实际报销金额
baseInfo.put("jsse", "");//有效计算税额
baseInfo.put("jsdkzq", "");//计算抵扣账期
baseInfo.put("signPerson", "");//签收人
baseInfo.put("signStatus", "1");//签收状态默认传1
invoiceInfo.put("baseInfo", baseInfo);
invoiceInfo.put("contentInfo",contentInfo);
}else {
invoiceInfo.put("contentInfo", contentInfo);
} else {
inputInfos.remove(inputInfo);
logger.info("根据pi_datakey没有查到火车票发票信息:{},发票号:{}", info.getPI_DATAKEY());
}
@ -305,6 +333,7 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
/**
* 增值税发票
*
* @param dataSourceCode 数据源编码
* @param info 发票公共表
* @param invoiceInfo 发票信息对象
@ -318,28 +347,29 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
//增值税发票表体
List<LexmiscivInvoicedetailEntity> zzsInvoiceBList = lexmiscivInvoicedetailService.query(new LexmiscivInvoicedetailEntity(zzsInvoiceH.getIM_ID(), dataSourceCode));
JSONObject zzs = new JSONObject();
zzs.put("zzsInvoiceH",JSONObject.toJSONString(zzsInvoiceH));
zzs.put("zzsInvoiceBList",JSONObject.toJSONString(zzsInvoiceBList));
zzs.put("zzsInvoiceH", JSONObject.toJSONString(zzsInvoiceH));
zzs.put("zzsInvoiceBList", JSONObject.toJSONString(zzsInvoiceBList));
assembler = new ZzsInvoiceAssembler(zzs);
context = new ParamAssemblerContext(assembler);
contentInfo = context.assemble();
baseInfo.put("fphm",zzsInvoiceH.getIM_FPHM());//发票号码
baseInfo.put("fpdm",zzsInvoiceH.getIM_FPDM());//发票代码
baseInfo.put("fplx",convertZzsFplx(zzsInvoiceH.getIM_TYPE()));//发票类型
baseInfo.put("kprq",DateUtil.format(zzsInvoiceH.getIM_DATE(),"yyyy-MM-dd"));//开票日期
baseInfo.put("bhszje",zzsInvoiceH.getIM_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym",zzsInvoiceH.getIM_CHECKCODE());//校验码
baseInfo.put("bxje",zzsInvoiceH.getIM_NOTAXAMOUNT());//不含税实际报销金额
baseInfo.put("jsse","");//有效计算税额
baseInfo.put("jsdkzq","");//计算抵扣账期
baseInfo.put("signPerson","");//签收人
baseInfo.put("signStatus","1");//签收状态默认传1
baseInfo.put("fphm", zzsInvoiceH.getIM_FPHM());//发票号码
baseInfo.put("fpdm", zzsInvoiceH.getIM_FPDM());//发票代码
baseInfo.put("fplx", convertZzsFplx(zzsInvoiceH.getIM_TYPE()));//发票类型
baseInfo.put("kprq", DateUtil.format(zzsInvoiceH.getIM_DATE(), "yyyy-MM-dd"));//开票日期
baseInfo.put("bhszje", zzsInvoiceH.getIM_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym", zzsInvoiceH.getIM_CHECKCODE());//校验码
baseInfo.put("bxje", zzsInvoiceH.getIM_NOTAXAMOUNT());//不含税实际报销金额
baseInfo.put("jsse", "");//有效计算税额
baseInfo.put("jsdkzq", "");//计算抵扣账期
baseInfo.put("signPerson", "");//签收人
baseInfo.put("signStatus", "1");//签收状态默认传1
invoiceInfo.put("baseInfo", baseInfo);
invoiceInfo.put("contentInfo",contentInfo);
invoiceInfo.put("contentInfo", contentInfo);
}
/**
* 客运汽车
*
* @param dataSourceCode 数据源编码
* @param info 发票公共表嘻嘻
* @param invoiceInfo 发票参数对象
@ -349,39 +379,40 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
ParamAssemblerContext context;//策略上下文类
JSONObject contentInfo;
ParamAssembler assembler;
LexmiscivBusinvoiceEntity businvoiceEntity = lexmiscivBusinvoiceService.queryOne(new LexmiscivBusinvoiceEntity(info.getPI_DATAKEY(),dataSourceCode));
if (null != businvoiceEntity){
LexmiscivBusinvoiceEntity businvoiceEntity = lexmiscivBusinvoiceService.queryOne(new LexmiscivBusinvoiceEntity(info.getPI_DATAKEY(), dataSourceCode));
if (null != businvoiceEntity) {
JSONObject busObj = new JSONObject();
busObj.put("busInvoice",JSONObject.toJSONString(businvoiceEntity));
busObj.put("publicInfoice",JSONObject.toJSONString(info));
busObj.put("busInvoice", JSONObject.toJSONString(businvoiceEntity));
busObj.put("publicInfoice", JSONObject.toJSONString(info));
assembler = new BusInvoiceAssembler(busObj);
context = new ParamAssemblerContext(assembler);
contentInfo = context.assemble();
baseInfo.put("fphm", businvoiceEntity.getBI_FPHM());//发票号码
baseInfo.put("fpdm",businvoiceEntity.getBI_FPDM());//发票代码
baseInfo.put("fplx","a3");//发票类型
baseInfo.put("kprq",DateUtil.format(businvoiceEntity.getBI_DATE(),"yyyy-MM-dd"));//开票日期
baseInfo.put("bhszje",businvoiceEntity.getBI_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym","");//校验码
baseInfo.put("bxje",businvoiceEntity.getBI_NOTAXAMOUNT());//不含税金额
baseInfo.put("jsse","");//有效计算税额
baseInfo.put("jsdkzq","");//计算抵扣账期
baseInfo.put("signPerson","");//签收人
baseInfo.put("signStatus","1");//签收状态默认传1
baseInfo.put("fpdm", businvoiceEntity.getBI_FPDM());//发票代码
baseInfo.put("fplx", "a3");//发票类型
baseInfo.put("kprq", DateUtil.format(businvoiceEntity.getBI_DATE(), "yyyy-MM-dd"));//开票日期
baseInfo.put("bhszje", businvoiceEntity.getBI_NOTAXAMOUNT());//不含税总金额
baseInfo.put("jym", "");//校验码
baseInfo.put("bxje", businvoiceEntity.getBI_NOTAXAMOUNT());//不含税金额
baseInfo.put("jsse", "");//有效计算税额
baseInfo.put("jsdkzq", "");//计算抵扣账期
baseInfo.put("signPerson", "");//签收人
baseInfo.put("signStatus", "1");//签收状态默认传1
invoiceInfo.put("baseInfo", baseInfo);
invoiceInfo.put("contentInfo",contentInfo);
invoiceInfo.put("contentInfo", contentInfo);
}
}
/**
* 迈锐思增值税类发票类型转换成有度发票类型
*
* @param fplx 迈锐思发票类型
* @return
*/
private String convertZzsFplx(String fplx){
if (StrUtil.isNotEmpty(fplx)){
private String convertZzsFplx(String fplx) {
if (StrUtil.isNotEmpty(fplx)) {
String youduFplx = null;
switch (fplx){
switch (fplx) {
case "01"://增值税专用发票
youduFplx = "01";
break;

View File

@ -0,0 +1,12 @@
package com.hzya.frame.plugin.ht.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
/**
* @Description OA开票申请
* @Author xiangerlin
* @Date 2025/6/21 17:07
**/
public interface IApplyInvoiceDao extends IBaseDao<ApplyInvoiceEntity,String> {
}

View File

@ -0,0 +1,12 @@
package com.hzya.frame.plugin.ht.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
/**
* @Description OA资金拨付
* @Author xiangerlin
* @Date 2025/6/21 14:23
**/
public interface IFundsAllocationDao extends IBaseDao<FundsAllocationEntity,String> {
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.plugin.ht.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.ht.dao.IApplyInvoiceDao;
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
import org.springframework.stereotype.Repository;
/**
* @Description OA开票申请
* @Author xiangerlin
* @Date 2025/6/21 17:07
**/
@Repository(value = "applyInvoiceDaoImpl")
public class ApplyInvoiceDaoImpl extends MybatisGenericDao<ApplyInvoiceEntity,String> implements IApplyInvoiceDao {
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.plugin.ht.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.ht.dao.IFundsAllocationDao;
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
import org.springframework.stereotype.Repository;
/**
* @Description OA资金拨付
* @Author xiangerlin
* @Date 2025/6/21 14:24
**/
@Repository(value = "fundsAllocationDaoImpl")
public class FundsAllocationDaoImpl extends MybatisGenericDao<FundsAllocationEntity,String> implements IFundsAllocationDao {
}

View File

@ -0,0 +1,59 @@
package com.hzya.frame.plugin.ht.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @Description OA开票申请 formmain_0331
* @Author xiangerlin
* @Date 2025/6/21 17:02
**/
public class ApplyInvoiceEntity extends BaseEntity {
private String field0117;//单据号
//查询待办用的字段
private String col_summary_id;
private String ctp_affair_id;
private String workitem_id;
private String member_id;//用来指定查哪个用户的待办这里要查固定人员的待办
public String getField0117() {
return field0117;
}
public void setField0117(String field0117) {
this.field0117 = field0117;
}
public String getCol_summary_id() {
return col_summary_id;
}
public void setCol_summary_id(String col_summary_id) {
this.col_summary_id = col_summary_id;
}
public String getCtp_affair_id() {
return ctp_affair_id;
}
public void setCtp_affair_id(String ctp_affair_id) {
this.ctp_affair_id = ctp_affair_id;
}
public String getWorkitem_id() {
return workitem_id;
}
public void setWorkitem_id(String workitem_id) {
this.workitem_id = workitem_id;
}
public String getMember_id() {
return member_id;
}
public void setMember_id(String member_id) {
this.member_id = member_id;
}
}

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.plugin.ht.dao.impl.ApplyInvoiceDaoImpl">
<resultMap id="get-ApplyInvoiceEntity-result" type="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity">
<result property="id" column="id" />
<result property="field0117" column="field0117" />
</resultMap>
<resultMap id="get-Affair-subObjectId-result" type="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity">
<result property="id" column="id" />
<result property="field0117" column="field0117" />
<result property="col_summary_id" column="col_summary_id" />
<result property="ctp_affair_id" column="ctp_affair_id" />
<result property="workitem_id" column="workitem_id" />
</resultMap>
<select id="entity_list_base" resultMap="get-ApplyInvoiceEntity-result" parameterType="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity">
select * from formmain_0331
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">id = #{id}</if>
<if test="field0117 != null and field0117 != ''">and field0117 = #{field0117}</if>
</trim>
</select>
<!-- 查询待办事项id流程提交和退回要用到 -->
<select id="entity_list_affair" parameterType="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity" resultMap="get-Affair-subObjectId-result">
SELECT
formmain_0331.id,-- 单据id
formmain_0331.field0117,--单据编号
COL_SUMMARY.id as col_summary_id,--流程id
CTP_AFFAIR.id as ctp_affair_id,-- 待办id
CTP_AFFAIR.SUB_OBJECT_ID as workitem_id-- 流程处理和回退要用这个id
from
formmain_0331
LEFT JOIN COL_SUMMARY on COL_SUMMARY.FORM_RECORDID = formmain_0331.id
LEFT JOIN CTP_AFFAIR on CTP_AFFAIR.OBJECT_ID = COL_SUMMARY.id and CTP_AFFAIR.MEMBER_ID = '' and CTP_AFFAIR.STATE = '3'
where
formmain_0331.id = #{id}
and CTP_AFFAIR.SUB_OBJECT_ID is not null
</select>
</mapper>

View File

@ -0,0 +1,105 @@
package com.hzya.frame.plugin.ht.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @Description OA资金拨付 formmain_0464
* @Author xiangerlin
* @Date 2025/6/21 14:19
**/
public class FundsAllocationEntity extends BaseEntity {
private String field0045;//单据编号
private String field0061;//税务系统id这个字段不为空时表示是税务推过来的单子
private String field0062;//单据来源这个字段不为空时表示是司库推过来的单子
private String field0063;//司库系统批次号回调时用
//审批意见相关的字段
private String col_summary_id;//流程id
private String subject;//流程标题
private String state;//流程状态
private String name;//处理人姓名
private String approval_time;//处理时间
private String content;//审批意见
public String getField0045() {
return field0045;
}
public void setField0045(String field0045) {
this.field0045 = field0045;
}
public String getField0061() {
return field0061;
}
public void setField0061(String field0061) {
this.field0061 = field0061;
}
public String getField0062() {
return field0062;
}
public void setField0062(String field0062) {
this.field0062 = field0062;
}
public String getCol_summary_id() {
return col_summary_id;
}
public void setCol_summary_id(String col_summary_id) {
this.col_summary_id = col_summary_id;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getApproval_time() {
return approval_time;
}
public void setApproval_time(String approval_time) {
this.approval_time = approval_time;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getField0063() {
return field0063;
}
public void setField0063(String field0063) {
this.field0063 = field0063;
}
}

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.plugin.ht.dao.impl.FundsAllocationDaoImpl">
<resultMap id="get-FundsAllocationEntity-result" type="com.hzya.frame.plugin.ht.entity.FundsAllocationEntity">
<result property="id" column="id" />
<result property="field0045" column="field0045" />
<result property="field0061" column="field0061" />
<result property="field0062" column="field0062" />
<result property="field0063" column="field0063" />
</resultMap>
<resultMap id="get-CtpComment-result" type="com.hzya.frame.plugin.ht.entity.FundsAllocationEntity">
<result property="col_summary_id" column="col_summary_id" />
<result property="subject" column="subject" />
<result property="state" column="state" />
<result property="name" column="name" />
<result property="approval_time" column="approval_time" />
<result property="content" column="content" />
</resultMap>
<select id="entity_list_base" resultMap="get-FundsAllocationEntity-result" parameterType="com.hzya.frame.plugin.ht.entity.FundsAllocationEntity">
select * from formmain_0464
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">id = #{id}</if>
<if test="field0045 != null and field0045 != ''">and field0045 = #{field0045}</if>
</trim>
</select>
<!-- 查询审批意见 -->
<select id="entity_ctp_comment_all" resultMap="get-CtpComment-result" parameterType="com.hzya.frame.plugin.ht.entity.FundsAllocationEntity">
SELECT res.* from (
SELECT
col_summary.id as col_summary_id,
col_summary.subject,
col_summary.state,
ORG_MEMBER.NAME as name,
CASE CTP_AFFAIR.state
WHEN '1' THEN CTP_AFFAIR.create_date
WHEN '2' THEN CTP_AFFAIR.create_date
ELSE CTP_AFFAIR.complete_time
END as approval_time,
CTP_COMMENT_ALL.content
from col_summary
LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.object_id = col_summary.id
LEFT JOIN CTP_COMMENT_ALL ON CTP_COMMENT_ALL.affair_id = CTP_AFFAIR.id and CTP_COMMENT_ALL.FORWARD_COUNT = 0
LEFT JOIN ORG_MEMBER ON ORG_MEMBER.id = CTP_AFFAIR.member_id
where col_summary.id = #{col_summary_id}
)res ORDER BY res.approval_time desc
</select>
</mapper>

View File

@ -0,0 +1,103 @@
package com.hzya.frame.plugin.ht.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.ht.service.IFundsAllocationPluginService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description 资金拨付 流程结束回调 需要同时回调有度税务和中信司库
* @Author xiangerlin
* @Date 2025/6/21 14:06
**/
public class FundsAllocationPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(FundsAllocationPluginInitializer.class);
@Autowired
private IFundsAllocationPluginService fundsAllocationPluginService;
/***
* 插件初始化方法
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 10:48
* @Param []
* @return void
**/
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
/****
* 插件销毁方法
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
/****
* 插件的ID
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginId() {
return "FundsAllocationPlugin";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "资金拨付回调税务和司库";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "资金拨付回调税务和司库";
}
/***
* 插件类型 1场景插件
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 14:01
* @Param []
* @return java.lang.String
**/
@Override
public String getPluginType() {
return "1";
}
/***
* 执行业务代码
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-07 11:20
* @param requestJson 执行业务代码的参数
* @return void
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("======开始执行资金拨付回调有度税务和中信司库插件========");
fundsAllocationPluginService.callback(requestJson);
return BaseResult.getSuccessMessageEntity("执行成功");
}
}

View File

@ -22,6 +22,10 @@ import com.hzya.frame.mdm.mdmModuleDistributeTripartite.entity.MdmModuleDistribu
import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao;
import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity;
import com.hzya.frame.mdm.service.IMdmServiceCache;
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
import com.hzya.frame.plugin.ht.service.IApplyInvoiceService;
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDao;
import com.hzya.frame.seeyon.invoice.entity.InvoiceEntity;
import com.hzya.frame.sys.sysenum.SysEnum;
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
@ -45,6 +49,7 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.Resource;
@ -78,6 +83,10 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
private IMdmModuleSendLogDao mdmModuleSendLogDao;
@Resource
private IMdmModuleDistributeTripartiteDao mdmModuleDistributeTripartiteDao;
@Autowired
private IApplyInvoiceService applyInvoiceService;
@Autowired
private IInvoiceDao invoiceDao;
@Value("${zt.url}")
private String url ;
@ -1117,6 +1126,8 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
logger.info("=========开始执行开票申请单申请新增数据下发脚本,第二次==============");
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
logger.info("=====开票申请单申请数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
//todo 更新OA开票结果
updateOAForm(jsonResultEntity,doObjects.get(i));
if(jsonResultEntity.isFlag()){
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
logger.info("=========开始执行开票申请单申请数据新增返回脚本==============");
@ -1208,6 +1219,54 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
}*/
}
/**
* 更新OA开票结果
* @param jsonResultEntity
* @param data
*/
private void updateOAForm(JsonResultEntity jsonResultEntity, JSONObject data) {
try {
logger.info("准备更新开票结果到OA单据返回参数:{}data_id:{}",JSONObject.toJSONString(jsonResultEntity),data.getString("data_id"));
if (null != jsonResultEntity && null != data && StrUtil.isNotEmpty(data.getString("data_id"))){
String data_id = data.getString("data_id");
String attrStr = (String) jsonResultEntity.getAttribute();
JSONObject attrObj = JSONObject.parseObject(attrStr);
JSONObject attribute = attrObj.getJSONObject("attribute");
if (null != attribute && !"0".equals(attribute.getString("code"))){
String message = attribute.getString("message");
InvoiceEntity invoiceEntity = new InvoiceEntity();
invoiceEntity.setId(data_id);
invoiceEntity.setResult_status(message);
invoiceEntity.setDataSourceCode("HT-OA");
invoiceDao.updateInvoiceResult(invoiceEntity);
//查询待办退回流程用这里只处理退回的情况如果要处理提交要等开票成功后才能提交去定时查开票结果的定时任务里做
ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity();
applyInvoice.setId(data_id);
applyInvoice.setDataSourceCode("HT-OA");
ApplyInvoiceEntity applyInvoiceEntity = applyInvoiceService.queryAffair(applyInvoice);
if (null != applyInvoiceEntity){
String stepBack = applyInvoiceService.stepBackValueOf(applyInvoiceEntity.getWorkitem_id(), message);
applyInvoiceService.process(stepBack,"8000590006");
}
}
}
}catch (Exception e){
logger.info("调用有度开票申请接口后更新OA表单开票结果出错:{}",e);
}
}
public static void main(String[] args) {
String resultStr = "{\"attribute\":\"{\\\"msg\\\":\\\"转发成功\\\",\\\"type\\\":null,\\\"flag\\\":true,\\\"status\\\":\\\"200\\\",\\\"attribute\\\":{\\\"result\\\":{\\\"businessNo\\\":\\\"KP202506170028\\\",\\\"applicationNumber\\\":\\\"LZ250617000004\\\",\\\"applicationId\\\":\\\"1384530530992742657\\\"},\\\"code\\\":\\\"0\\\",\\\"cause\\\":null,\\\"message\\\":\\\"成功\\\"}}\",\"flag\":true,\"msg\":\"转发成功\",\"status\":\"200\"}";
JsonResultEntity jsonResultEntity = JSON.parseObject(resultStr,JsonResultEntity.class);
JSONObject data = new JSONObject();
data.put("data_id","2076813022629089234");
InvoiceDistributePluginInitializer plugin = new InvoiceDistributePluginInitializer();
String attrStr = (String) jsonResultEntity.getAttribute();
JSONObject attrObj = JSONObject.parseObject(attrStr);
plugin.updateOAForm(jsonResultEntity,data);
}
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String appId, String target_api,String apiID, String source_data, String option_type) throws Exception {
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");

View File

@ -0,0 +1,48 @@
package com.hzya.frame.plugin.ht.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
import com.hzya.frame.web.exception.BaseSystemException;
import java.util.List;
/**
* @Description OA开票申请
* @Author xiangerlin
* @Date 2025/6/21 17:56
**/
public interface IApplyInvoiceService extends IBaseService<ApplyInvoiceEntity,String> {
/**
* 查询待办信息
* 这里要指定人员 所以只会查出一条如果查出多条那就是有问题的
* @param entity
* @return
* @throws BaseSystemException
*/
ApplyInvoiceEntity queryAffair(ApplyInvoiceEntity entity)throws BaseSystemException;
/**
* 流程回退参数组装
* @param workitemId
* @param content
* @return
*/
String stepBackValueOf(String workitemId,String content);
/**
* 流程结束参数组装
* @param workitemId
* @param content
* @return
*/
String finishValueOf(String workitemId,String content);
/**
* 流程处理
* @param param
* @param apiCode
* @return
*/
String process(String param,String apiCode);
}

View File

@ -0,0 +1,21 @@
package com.hzya.frame.plugin.ht.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.web.exception.BaseSystemException;
/**
* @Description 资金拨付 流程结束回调 需要同时回调有度税务和中信司库
* @Author xiangerlin
* @Date 2025/6/21 14:13
**/
public interface IFundsAllocationPluginService {
/**
* 资金拨付流程结束回调有度税务系统和中信司库
* @param requestJson
* @return
* @throws BaseSystemException
*/
JsonResultEntity callback(JSONObject requestJson)throws BaseSystemException;
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.plugin.ht.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
import java.util.List;
/**
* @Description OA资金拨付 formmain_0464
* @Author xiangerlin
* @Date 2025/6/21 15:01
**/
public interface IFundsAllocationService extends IBaseService<FundsAllocationEntity,String> {
/**
* 查询审批意见
* @param entity
* @return
*/
List<FundsAllocationEntity> queryCtpCommentList(FundsAllocationEntity entity);
}

View File

@ -0,0 +1,136 @@
package com.hzya.frame.plugin.ht.service.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.plugin.ht.dao.IApplyInvoiceDao;
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
import com.hzya.frame.plugin.ht.service.IApplyInvoiceService;
import com.hzya.frame.seeyon.util.OARestUtil;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
* @Author xiangerlin
* @Date 2025/6/21 17:56
**/
@Service(value = "applyInvoiceServiceImpl")
public class ApplyInvoiceServiceImpl extends BaseService<ApplyInvoiceEntity,String> implements IApplyInvoiceService {
private IApplyInvoiceDao applyInvoiceDao;
@Autowired
public void setApplyInvoiceDao(IApplyInvoiceDao dao) {
this.applyInvoiceDao = dao;
this.dao = dao;
}
@Value("${zt.url}")
private String interfaceUrl;
/**
* 查询待办信息
*
* @param entity
* @return
* @throws BaseSystemException
*/
@DS("entity.dataSourceCode")
@Override
public ApplyInvoiceEntity queryAffair(ApplyInvoiceEntity entity) throws BaseSystemException {
List<ApplyInvoiceEntity> queryList = applyInvoiceDao.queryList(entity, "com.hzya.frame.plugin.ht.dao.impl.ApplyInvoiceDaoImpl.entity_list_affair");
if (CollectionUtils.isNotEmpty(queryList)){
if (queryList.size() > 1){
throw new BaseSystemException("数据异常,查询到多条待办数据"+entity.getId());
}
return queryList.get(0);
}
return null;
}
/**
* 流程回退参数组装
*
* @param workitemId
* @param content
* @return
*/
@Override
public String stepBackValueOf(String workitemId, String content) {
Assert.notEmpty(workitemId,"流程回退时workitemId 必填");
JSONObject jsonObject = new JSONObject();
jsonObject.put("appName", "collaboration");
jsonObject.put("workitemId", workitemId);
JSONObject commentDeal = new JSONObject();
commentDeal.put("attitude", "1");//1表示已阅
commentDeal.put("content", content);
JSONObject data = new JSONObject();
data.put("isWFTrace", "0");
data.put("comment_deal", commentDeal);
jsonObject.put("data", data);
return jsonObject.toJSONString();
}
/**
* 流程结束参数组装
*
* @param workitemId
* @param content
* @return
*/
@Override
public String finishValueOf(String workitemId, String content) {
Assert.notEmpty(workitemId,"流程回退时workitemId 必填");
JSONObject json = new JSONObject();
json.put("appName", "collaboration");
json.put("workitemId", workitemId);
JSONObject data = new JSONObject();
data.put("submitType", "1");
JSONObject commentDeal = new JSONObject();
commentDeal.put("attitude", "2");//2表示同意
commentDeal.put("content", content);
data.put("comment_deal", commentDeal);
json.put("data", data);
return json.toJSONString();
}
/**
* 流程处理
*
* @param param
* @param apiCode
* @return
*/
@Override
public String process(String param, String apiCode) {
Assert.notEmpty(param,"流程处理时参数不能为空");
Assert.notEmpty(apiCode,"apiCode不能为空");
logger.info("准备提交或退回流程:{},{}",apiCode,param);
String token = OARestUtil.getToken("hzya", "8000590001");
String result = HttpRequest.post(interfaceUrl)
.header("appId", "800059")//OA应用
.header("apiCode", apiCode)//流程提交/回退接口
.header("token", token)//token
.header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//中台公钥
.header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//中台密钥
.body(param)//表单内容
.timeout(30000)//超时毫秒
.execute().body();
return result;
}
}

View File

@ -0,0 +1,156 @@
package com.hzya.frame.plugin.ht.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.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
import com.hzya.frame.plugin.ht.service.IFundsAllocationPluginService;
import com.hzya.frame.plugin.ht.service.IFundsAllocationService;
import com.hzya.frame.seeyon.enums.ColEventTypeEnum;
import com.hzya.frame.seeyon.util.SM2Util;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description 资金拨付 流程结束回调 需要同时回调有度税务和中信司库
* @Author xiangerlin
* @Date 2025/6/21 14:17
**/
@Service(value = "fundsAllocationPluginServiceImpl")
public class FundsAllocationPluginServiceImpl implements IFundsAllocationPluginService {
Logger logger = LoggerFactory.getLogger(FundsAllocationPluginServiceImpl.class);
@Value("${zt.url}")
private String interfaceUrl;
@Value("${zx.publicKey:}")
private String publicKey;
@Autowired
private IFundsAllocationService fundsAllocationService;
/**
* 资金拨付流程结束回调有度税务系统和中信司库
*
* @param requestJson
* @return
* @throws BaseSystemException
*/
@Override
public JsonResultEntity callback(JSONObject requestJson) throws BaseSystemException {
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("表单数据为空");
}
}

View File

@ -0,0 +1,39 @@
package com.hzya.frame.plugin.ht.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.plugin.ht.dao.IFundsAllocationDao;
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
import com.hzya.frame.plugin.ht.service.IFundsAllocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
* @Author xiangerlin
* @Date 2025/6/21 15:03
**/
@Service(value = "fundsAllocationServiceImpl")
public class FundsAllocationServiceImpl extends BaseService<FundsAllocationEntity,String> implements IFundsAllocationService {
private IFundsAllocationDao fundsAllocationDao;
@Autowired
public void setFundsAllocationDao(IFundsAllocationDao dao) {
this.fundsAllocationDao = dao;
this.dao = dao;
}
/**
* 查询审批意见
*
* @param entity
* @return
*/
@DS("#entity.dataSourceCode")
@Override
public List<FundsAllocationEntity> queryCtpCommentList(FundsAllocationEntity entity) {
List<FundsAllocationEntity> queryList = fundsAllocationDao.queryList(entity, "com.hzya.frame.plugin.ht.dao.impl.FundsAllocationDaoImpl.entity_ctp_comment_all");
return queryList;
}
}

View File

@ -9,8 +9,8 @@ import com.hzya.frame.web.entity.BaseEntity;
public class IncomeInvoiceEntity extends BaseEntity {
//发票字段
private Integer dataId;
private Integer formmainId;
private String dataId;
private String formmainId;
private String field0127;
private String field0128;
private String field0129;
@ -28,6 +28,7 @@ public class IncomeInvoiceEntity extends BaseEntity {
private String iufoVer;
public String getAloneId() {
return aloneId;
}
@ -68,19 +69,19 @@ public class IncomeInvoiceEntity extends BaseEntity {
this.iufoVer = iufoVer;
}
public Integer getDataId() {
public String getDataId() {
return dataId;
}
public void setDataId(Integer dataId) {
public void setDataId(String dataId) {
this.dataId = dataId;
}
public Integer getFormmainId() {
public String getFormmainId() {
return formmainId;
}
public void setFormmainId(Integer formmainId) {
public void setFormmainId(String formmainId) {
this.formmainId = formmainId;
}

View File

@ -194,6 +194,7 @@
from formson_0702
<trim prefix="where" prefixOverrides="and">
<if test="field0128 != null and field0128 != ''"> and field0128 = #{field0128} </if>
<if test="formmainId != null and formmainId != ''"> and formmain_id = #{formmainId} </if>
</trim>
</select>

View File

@ -1,6 +1,7 @@
package com.hzya.frame.plugin.incomeInvoiceData.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
@ -40,15 +41,24 @@ import com.hzya.frame.basedao.service.impl.BaseService;
import org.springframework.core.task.TaskExecutor;
import javax.annotation.Resource;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -58,6 +68,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author makejava
@ -88,13 +100,12 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
//Integer size = 50;
boolean flags = false;
String uploadBalanceTableUrl = "http://122.9.186.182:30887/open/api/uploadBalanceTable";
String cbUrl = "http://122.9.186.182:30887/open/api/uploadFinancialReport";
String dataUrl = "https://workbench.test.htszny.com/oapi/invoice_rec/standing/book/queryList";//全量发票数据
String uploadBalanceTableUrl = "http://10.0.2.15:30887/open/api/uploadBalanceTable";
String cbUrl = "http://10.0.2.15:30887/open/api/uploadFinancialReport";
String dataUrl = "https://10.0.2.15:30889/oapi/invoice_rec/standing/book/queryList";//全量发票数据
String tokenUrl = "http://oapi.nanofintax.com/api/getToken";
String accessKey = "6X3B526P5HqE6ums";
String accessSecret = "34e5fc32ac894a2ba2ade8c3852c7a0a";
String taxNo = "91330110MAC5FPUY2U";
Integer size = 50;
@Resource
private TaskExecutor taskExecutor;
@ -121,7 +132,10 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
//2调用接口获取数据
Integer queryCursor = 1;
JSONArray datalist = new JSONArray();
sendBusinessData(datalist, access_token, queryCursor,times);
sendBusinessData(datalist, access_token, queryCursor,times,"91330328MABX16X17N");
sendBusinessData(datalist, access_token, queryCursor,times,"91330110MAC5FPUY2U");
sendBusinessData(datalist, access_token, queryCursor,times,"91330110MAD4PEK57L");
sendBusinessData(datalist, access_token, queryCursor,times,"91330110MADYHCEW89");
if(datalist != null && datalist.size() > 0){
for (int i = 0; i < datalist.size(); i++) {
@ -183,15 +197,17 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
saveData.put("kpr",content.getString("kpr"));
saveData.put("skr",content.getString("skr"));
saveData.put("fhr",content.getString("fhr"));
saveData.put("url",content.getString("url"));
saveData.put("ofdurl",content.getString("ofdUrl"));
saveData.put("xmlurl",content.getString("xmlUrl"));
saveData.put("url",jsonObject.getString("pdfUrl"));
saveData.put("ofdurl",jsonObject.getString("ofdUrl"));
saveData.put("xmlurl",jsonObject.getString("xmlUrl"));
//saveData.put("url",content.getOrDefault("url","http://prd-cabinet-1257122416.cos.ap-shanghai.myqcloud.com/recv-open-input-1313818348185971712-1362629996254053632.pdf"));
//saveData.put("ofdurl",content.getOrDefault("ofdUrl","http://prd-cabinet-1257122416.cos.ap-shanghai.myqcloud.com/recv-open-input-1313818348185971712-1362629996254053632.pdf"));
//saveData.put("xmlurl",content.getOrDefault("xmlUrl","http://prd-cabinet-1257122416.cos.ap-shanghai.myqcloud.com/recv-open-input-1313818348185971712-1362630000427386112.xml"));
saveData.put("htbh",content.getString("contraceNumber"));
saveData.put("htbh",jsonObject.getString("documentNumber"));
//if(saveData.getString("htbh") == null || "".equals(saveData.getString("htbh"))){
// continue;
//}
JSONArray detaildata = content.getJSONArray("items");
if(detaildata != null && detaildata.size() > 0){
for (int i1 = 0; i1 < detaildata.size(); i1++) {
@ -239,6 +255,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
controlsLogEntity.setOrg_id("0");
controlsLogEntity.setRemark("插件新增");
controlsLogDaoimpl.saveControlsLog(saveData.getString("id"), "数智中台", "800004", jsonObject.toJSONString(), "接口新增", "数智中台", "mdm_fp_option_log", "1");
}
}
return BaseResult.getSuccessMessageEntity("处理成功");
@ -257,7 +274,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
* @param dataTime
* @return void
**/
private void sendBusinessData(JSONArray datalist, String access_token, Integer queryCursor, String dataTime) {
private void sendBusinessData(JSONArray datalist, String access_token, Integer queryCursor, String dataTime, String taxNo) {
String url = dataUrl+access_token;
JSONObject dayabody = new JSONObject();
long timestamp = System.currentTimeMillis();
@ -293,7 +310,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
JSONArray businessList = data.getJSONArray("data");
if(data.getInteger("total") > queryCursor*size){
queryCursor = queryCursor+1;
sendBusinessData(datalist, access_token, queryCursor, dataTime);
sendBusinessData(datalist, access_token, queryCursor, dataTime,taxNo);
}
if(businessList != null && businessList.size() > 0){
datalist.addAll(businessList);
@ -505,10 +522,60 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
return null;
}
private String sendFileUpload(String url,String filename) {
private String sendFileUpload(String fileurl) {
try {
// 获取文件字节数据
byte[] fileBytes = downloadFileBytes(url);
byte[] fileBytes = null;
String filename = null;
// 创建信任所有证书的TrustManager
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
}
};
// 安装信任管理器
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// 创建允许所有主机名的验证器
HostnameVerifier allHostsValid = (hostname, session) -> true;
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
URL url = new URL(fileurl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
// 从响应头获取Content-Disposition
String contentDisposition = connection.getHeaderField("Content-Disposition");
// 尝试从Content-Disposition中提取文件名
if (contentDisposition != null) {
filename = extractFileNameFromContentDisposition(contentDisposition);
}else {
// 提取结果为 "recv-open-input-1364609961183034880-1377757054294396417.ofd"
filename = fileurl.substring(fileurl.lastIndexOf("/") + 1);
}
try (InputStream inputStream = connection.getInputStream();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
fileBytes = outputStream.toByteArray();
}
if (fileBytes != null) {
// 模拟一个文件
File tempFile = new File(filename);
@ -522,19 +589,53 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
fileUrl = data.getString("fileUrl");
}
// 操作完成后删除临时文件
tempFile.deleteOnExit();
boolean asd = tempFile.delete();
return fileUrl;
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
logger.error(e.getMessage());
}
return null;
}
public byte[] downloadFileBytes(String fileUrl) throws IOException {
public byte[] downloadFileBytes(String fileUrl) throws Exception {
// 创建信任所有证书的TrustManager
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
}
};
// 安装信任管理器
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// 创建允许所有主机名的验证器
HostnameVerifier allHostsValid = (hostname, session) -> true;
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
URL url = new URL(fileUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
// 从响应头获取Content-Disposition
String contentDisposition = connection.getHeaderField("Content-Disposition");
String fileName = null;
// 尝试从Content-Disposition中提取文件名
if (contentDisposition != null) {
fileName = extractFileNameFromContentDisposition(contentDisposition);
}
try (InputStream inputStream = connection.getInputStream();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
byte[] buffer = new byte[4096];
@ -545,6 +646,22 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
return outputStream.toByteArray();
}
}
private String extractFileNameFromContentDisposition(String contentDisposition) {
// 处理Content-Disposition头中的filename
try {
Pattern pattern = Pattern.compile("fileName=\"?([^\"]+)\"?");
Matcher matcher = pattern.matcher(contentDisposition);
if (matcher.find()) {
String filename = matcher.group(1);
String a = URLDecoder.decode(filename, "UTF-8");
return a;
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
/**
* seeyon流程事件监听后置方法绑定修改文件
@ -554,97 +671,156 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
*/
@Override
public void setDataCallBack(SysMessageManageLogEntity entity) throws Exception {
logger.error("999999发送后返回");
try {
JSONObject datas = JSONObject.parseObject(entity.getSourceData());
logger.error("999999发送后返回data"+datas.toJSONString());
String bodys = datas.getString("body");
logger.error("999999发送后返回bodys"+bodys);
JSONObject jsonObject = JSONObject.parseObject(bodys);
logger.error("999999发送后返回jsonObject"+jsonObject.toJSONString());
String urlData = null;
String ofdurlData = null;
String xmlurlData = null;
logger.error("999999发送后返回url");
if(jsonObject.getString("url") != null){
urlData = sendFileUpload(jsonObject.getString("url"),jsonObject.getString("fphm")+"url");
urlData = sendFileUpload(jsonObject.getString("url"));
}
logger.error("999999发送后返回ofdurl");
if(jsonObject.getString("ofdurl") != null){
ofdurlData = sendFileUpload(jsonObject.getString("ofdurl"),jsonObject.getString("fphm")+"ofdurl");
ofdurlData = sendFileUpload(jsonObject.getString("ofdurl"));
}
logger.error("999999发送后返回xmlurl");
if(jsonObject.getString("xmlurl") != null){
xmlurlData = sendFileUpload(jsonObject.getString("xmlurl"),jsonObject.getString("fphm")+"xmlurl");
xmlurlData = sendFileUpload(jsonObject.getString("xmlurl"));
}
//urlData = "7908556313791579509";
//ofdurlData = "7908556313791579509";
//xmlurlData = "7908556313791579509";
logger.error("999999发送后返回fphm");
if(jsonObject.getString("fphm") != null){
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
incomeInvoiceEntity.setDataSourceCode("HT-OA");
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
incomeInvoiceEntity.setField0130(urlData);//发票文件
incomeInvoiceEntity.setField0138(ofdurlData);//发票文件
incomeInvoiceEntity.setField0139(xmlurlData);//发票文件
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaFp(incomeInvoiceEntity);
logger.error("999999查询formmain_0705"+list.size() );
if(list != null && list.size() == 1){
incomeInvoiceEntity.setDataId(list.get(0).getDataId());
logger.error("999999保存关联表url"+list.get(0).getDataId());
if(urlData != null){
//保存关联表
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
incomeInvoiceEntity.setField0130(urluuid);//发票文件
ctpAttachmentService.saveAttachment(urlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
}
logger.error("999999保存关联表ofdurlData"+list.get(0).getDataId());
if(ofdurlData != null){
//保存关联表
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
incomeInvoiceEntity.setField0138(urluuid);//发票文件
ctpAttachmentService.saveAttachment(ofdurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
}
logger.error("999999保存关联表xmlurlData"+list.get(0).getDataId());
if(xmlurlData != null){
//保存关联表
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
incomeInvoiceEntity.setField0139(urluuid);//发票文件
ctpAttachmentService.saveAttachment(xmlurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
}
logger.error("999999修改发票开始");
incomeInvoiceDao.updateFP(incomeInvoiceEntity);
logger.error("999999修改发票结束");
}
}
//修改明细表
logger.error("999999修改合同开始");
if(jsonObject.getString("htbh") != null){
logger.error("999999修改合同开始1");
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
incomeInvoiceEntity.setDataSourceCode("HT-OA");
incomeInvoiceEntity.setField0003(jsonObject.getString("htbh"));//合同号
incomeInvoiceEntity.setField0127(jsonObject.getString("fpdm"));//发票代码
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
incomeInvoiceEntity.setField0129(jsonObject.getString("jshj"));//发票总额
incomeInvoiceEntity.setField0130(urlData);//发票文件
incomeInvoiceEntity.setField0138(ofdurlData);//发票文件
incomeInvoiceEntity.setField0139(xmlurlData);//发票文件
logger.error("999999查询合同明细");
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaZb(incomeInvoiceEntity);
logger.error("999999查询合同明细"+list.size());
if(list != null && list.size() == 1){
incomeInvoiceEntity.setFormmainId(list.get(0).getDataId());
if(urlData != null){
//保存关联表
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
ctpAttachmentService.saveAttachment(urlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
}
if(ofdurlData != null){
//保存关联表
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
ctpAttachmentService.saveAttachment(ofdurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
}
if(xmlurlData != null){
//保存关联表
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
ctpAttachmentService.saveAttachment(xmlurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
}
//logger.error("999999保存合同附件"+list.get(0).getDataId());
//
//if(urlData != null){
// //保存关联表
// String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
//incomeInvoiceEntity.setField0130(urluuid);//发票文件
// ctpAttachmentService.saveAttachment(urlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
//}
//logger.error("999999保存合同附件ofdurlData"+list.get(0).getDataId());
//
//if(ofdurlData != null){
// //保存关联表
// String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
//incomeInvoiceEntity.setField0138(urluuid);//发票文件
// ctpAttachmentService.saveAttachment(ofdurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
//}
//logger.error("999999保存合同附件xmlurlData"+list.get(0).getDataId());
//
//if(xmlurlData != null){
// //保存关联表
// String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
//incomeInvoiceEntity.setField0138(urluuid);//发票文件
// ctpAttachmentService.saveAttachment(xmlurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
//}
logger.error("999999查询合同明细"+list.get(0).getDataId());
List<IncomeInvoiceEntity> mxlist = incomeInvoiceDao.queryOaMx(incomeInvoiceEntity);
logger.error("999999查询合同明细结果"+mxlist.size());
if(mxlist != null && mxlist.size() == 1){
logger.error("999999修改合同明细结果"+mxlist.get(0).getDataId());
incomeInvoiceEntity.setDataId(mxlist.get(0).getDataId());
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
logger.error("999999修改合同明细结果完成");
}
if(mxlist == null || mxlist.size() == 0){
incomeInvoiceEntity.setDataId(1);
incomeInvoiceEntity.setDataId(String.valueOf(UUIDLong.longUUID()));
logger.error("999999保存合同明细结果"+incomeInvoiceEntity.getDataId());
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
logger.error("999999保存合同明细结果完成");
}
}
}
logger.error("999999结束");
} catch (Exception e) {
logger.error(e.getMessage());
logger.error("999999"+e.getMessage());
}
}
@ -769,7 +945,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
stringBuffer.append("</value>").append("</column>");
stringBuffer.append("<column name=\"合同编号\">").append("<value>");
stringBuffer.append(jsonObject.getString("htbm") != null?"<![CDATA["+jsonObject.getString("htbm")+"]]>":"");
stringBuffer.append(jsonObject.getString("htbh") != null?"<![CDATA["+jsonObject.getString("htbh")+"]]>":"");
stringBuffer.append("</value>").append("</column>");
stringBuffer.append("<column name=\"发票文件1\">").append("<value>");

View File

@ -3,7 +3,7 @@ logging:
#日志级别 指定目录级别
level:
root: INFO
encodings: UTF-8
encodings: GBK
file:
# 日志保存路径
path: D:\yongansystem\serverV3\log\zs
@ -12,17 +12,17 @@ spring:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
url: jdbc:mysql://127.0.0.1:3307/businesscenter_zs?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /home/webservice/zt/file
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
pluginpath: /home/webservice/zt/plugin
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
tomcatpath: /home/webservice/zt/tomcatV3/webapps/kangarooDataCenterV3/WEB-INF/classes/
cbs8:
appId: 1P4AGrpz
@ -39,15 +39,17 @@ cbs8:
OA:
data_source_code: yc_oa
zt:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface
file_oa:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload
#税务pdf附件下载存放路径
invoice_pdf:
url: D:\yongansystem\invoice\pdf\
#税务ofd附件下载存放路径
invoice_ofd:
url: D:\yongansystem\invoice\ofd\
invoice_xml:
url: D:\yongansystem\invoice\xml\
zx:
# 生产用这个 这个是银行给的
privateKey: MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgOHOzaKWBWOAbslvtYtS8tcQiJ9W9DT2cGQM3KSgXpfygCgYIKoEcz1UBgi2hRANCAAQNPct0MHOuDrVJBIy0RI7JKx9/PTlFHZlkIJr0EqpC+b/+N+z3JKbCMZ/wcP1V36Q+DlfDJCY9Ai/Uk2PZ9ZaF

View File

@ -18,12 +18,12 @@ spring:
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /home/webservice/zt/file
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
pluginpath: /home/webservice/zt/plugin
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
tomcatpath: /home/webservice/zt/tomcatV3/webapps/kangarooDataCenterV3/WEB-INF/classes/
path: D:\yongansystem\serverV3\zt\file
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
pluginpath: D:\yongansystem\serverV3\zt\plugin
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
tomcatpath: D:\yongansystem\serverV3\apache-tomcat-9.0.68_test\webapps\kangarooDataCenterV3\WEB-INF\classes\
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
@ -39,7 +39,17 @@ cbs8:
OA:
data_source_code: yc_oa
zt:
url: http://127.0.0.1:10087/kangarooDataCenterV3/entranceController/externalCallInterface
url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface
file_oa:
url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload
#税务pdf附件下载存放路径
invoice_pdf:
url: D:\yongansystem\invoice\pdf\
#税务ofd附件下载存放路径
invoice_ofd:
url: D:\yongansystem\invoice\ofd\
invoice_xml:
url: D:\yongansystem\invoice\xml\
zx:
# 测试用这个 这个是银行给的
privateKey: MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgtzMo2o6THK3yLIm+83Ch/560+02l2hjjBSFGieWY/Z6gCgYIKoEcz1UBgi2hRANCAATKhwZX4P3XI8vYTKeCOLMVbanUNbaXjrIEZynshwdOzRVgzRQSiPNWo6OBBkAPvqE+2RS+5ABpS82DSlKl81z0

View File

@ -5,5 +5,6 @@
<bean name="InvoiceDistributePluginInitializer" class="com.hzya.frame.plugin.ht.plugin.InvoiceDistributePluginInitializer" />
<bean name="QueryInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInvoiceResultPluginInitializer" />
<bean name="QueryInputInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInputInvoiceResultPluginInitializer" />
<bean name="fundsAllocationPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.FundsAllocationPluginInitializer" />
</beans>

View File

@ -153,15 +153,15 @@ public class temButtom {
}
@Test
public void test0111() {
//请求token
String accessToken = getToken();
//请求分页查询全量进项发票
String data = getdata(accessToken);
}
//@Test
//public void test0111() {
// //请求token
// String accessToken = getToken();
// //请求分页查询全量进项发票
// String data = getdata(accessToken);
//
//
//}
@Test
public void youduTest(){
@ -174,133 +174,133 @@ public class temButtom {
String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
System.out.println("sign"+a);
}
private String getdata(String accessToken) {
String url = "http://oapi.nanofintax.com/api/invoice_receive/fp/v1/query?accessToken="+accessToken;
JSONObject dayabody = new JSONObject();
dayabody.put("accessKey","6X3B526P5HqE6ums");
long timestamp = System.currentTimeMillis();
dayabody.put("timestamp",timestamp);
JSONObject queryParams = new JSONObject();
queryParams.put("page",1);
queryParams.put("size",50);
//queryParams.put("kprqq","2025-04-06");
//queryParams.put("kprqz","2025-04-06");
queryParams.put("taxNo","91330110MAC5FPUY2U");
dayabody.put("queryParams",queryParams);
Map<String, Object> parametersMap = new HashMap<>();
parametersMap.put("accessKey","6X3B526P5HqE6ums");
parametersMap.put("timestamp",timestamp);
//private String getdata(String accessToken) {
// String url = "http://oapi.nanofintax.com/api/invoice_receive/fp/v1/query?accessToken="+accessToken;
// JSONObject dayabody = new JSONObject();
// dayabody.put("accessKey","6X3B526P5HqE6ums");
// long timestamp = System.currentTimeMillis();
// dayabody.put("timestamp",timestamp);
// JSONObject queryParams = new JSONObject();
// queryParams.put("page",1);
// queryParams.put("size",50);
// //queryParams.put("kprqq","2025-04-06");
// //queryParams.put("kprqz","2025-04-06");
// queryParams.put("taxNo","91330110MAC5FPUY2U");
// dayabody.put("queryParams",queryParams);
// Map<String, Object> parametersMap = new HashMap<>();
// parametersMap.put("accessKey","6X3B526P5HqE6ums");
// parametersMap.put("timestamp",timestamp);
//
// String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
// dayabody.put("sign",a);
//
// StringBuilder body = new StringBuilder();
// SSLContext sslContext = null;
// try {
// sslContext = new SSLContextBuilder()
// .loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
// .build();
// } catch (Exception e) {
//
// }
// CloseableHttpClient closeableHttpClient = HttpClients.custom()
// .setSSLContext(sslContext)
// .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
// .build();
//
// HttpPost post = new HttpPost(url);
// CloseableHttpResponse response = null;
//
// RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
// post.setConfig(requestConfig);//设置请求参数超时时间
// post.setHeader("Content-Type", "application/json; charset=utf-8");
//
// try {
// if (dayabody.toJSONString() != null && !"".equals(dayabody.toJSONString())) {
// ByteArrayEntity entity = new ByteArrayEntity(dayabody.toJSONString().getBytes("UTF-8"));
// entity.setContentType("application/json");
// post.setEntity(entity);
// }
// response = closeableHttpClient.execute(post);
//
// HttpEntity entity = response.getEntity();
// body.append(EntityUtils.toString(entity, "UTF-8"));
// } catch (Exception e) {
// body.append(e.getMessage());
// } finally {
// try {
// // 关闭响应对象
// if (response != null) {
// response.close();
// }
// // 关闭响应对象
// if (closeableHttpClient != null) {
// closeableHttpClient.close();
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// }
// System.out.println("body"+body);
//
// return body.toString();
//}
String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
dayabody.put("sign",a);
StringBuilder body = new StringBuilder();
SSLContext sslContext = null;
try {
sslContext = new SSLContextBuilder()
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
.build();
} catch (Exception e) {
}
CloseableHttpClient closeableHttpClient = HttpClients.custom()
.setSSLContext(sslContext)
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
.build();
HttpPost post = new HttpPost(url);
CloseableHttpResponse response = null;
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
post.setConfig(requestConfig);//设置请求参数超时时间
post.setHeader("Content-Type", "application/json; charset=utf-8");
try {
if (dayabody.toJSONString() != null && !"".equals(dayabody.toJSONString())) {
ByteArrayEntity entity = new ByteArrayEntity(dayabody.toJSONString().getBytes("UTF-8"));
entity.setContentType("application/json");
post.setEntity(entity);
}
response = closeableHttpClient.execute(post);
HttpEntity entity = response.getEntity();
body.append(EntityUtils.toString(entity, "UTF-8"));
} catch (Exception e) {
body.append(e.getMessage());
} finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("body"+body);
return body.toString();
}
private String getToken() {
String url = "http://oapi.nanofintax.com/api/getToken";
String bodys = "{\"accessKey\":\"6X3B526P5HqE6ums\",\"accessSecret\":\"34e5fc32ac894a2ba2ade8c3852c7a0a\"}";
StringBuilder body = new StringBuilder();
SSLContext sslContext = null;
try {
sslContext = new SSLContextBuilder()
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
.build();
} catch (Exception e) {
}
CloseableHttpClient closeableHttpClient = HttpClients.custom()
.setSSLContext(sslContext)
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
.build();
HttpPost post = new HttpPost(url);
CloseableHttpResponse response = null;
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
post.setConfig(requestConfig);//设置请求参数超时时间
post.setHeader("Content-Type", "application/json; charset=utf-8");
try {
if (bodys != null && !"".equals(bodys)) {
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
entity.setContentType("application/json");
post.setEntity(entity);
}
response = closeableHttpClient.execute(post);
HttpEntity entity = response.getEntity();
body.append(EntityUtils.toString(entity, "UTF-8"));
} catch (Exception e) {
body.append(e.getMessage());
} finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("body"+body);
String accessToken = JSONObject.parseObject(body.toString()).getJSONObject("result").getString("accessToken");
return accessToken;
}
//private String getToken() {
// String url = "http://oapi.nanofintax.com/api/getToken";
// String bodys = "{\"accessKey\":\"6X3B526P5HqE6ums\",\"accessSecret\":\"34e5fc32ac894a2ba2ade8c3852c7a0a\"}";
// StringBuilder body = new StringBuilder();
// SSLContext sslContext = null;
// try {
// sslContext = new SSLContextBuilder()
// .loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
// .build();
// } catch (Exception e) {
//
// }
// CloseableHttpClient closeableHttpClient = HttpClients.custom()
// .setSSLContext(sslContext)
// .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
// .build();
//
// HttpPost post = new HttpPost(url);
// CloseableHttpResponse response = null;
//
// RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
// post.setConfig(requestConfig);//设置请求参数超时时间
// post.setHeader("Content-Type", "application/json; charset=utf-8");
//
// try {
// if (bodys != null && !"".equals(bodys)) {
// ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
// entity.setContentType("application/json");
// post.setEntity(entity);
// }
// response = closeableHttpClient.execute(post);
//
// HttpEntity entity = response.getEntity();
// body.append(EntityUtils.toString(entity, "UTF-8"));
// } catch (Exception e) {
// body.append(e.getMessage());
// } finally {
// try {
// // 关闭响应对象
// if (response != null) {
// response.close();
// }
// // 关闭响应对象
// if (closeableHttpClient != null) {
// closeableHttpClient.close();
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// }
// System.out.println("body"+body);
// String accessToken = JSONObject.parseObject(body.toString()).getJSONObject("result").getString("accessToken");
//
// return accessToken;
//}
}

View File

@ -217,6 +217,7 @@ public abstract class MybatisGenericDao<E extends Serializable, PK extends Seria
return this.sqlSession.delete(id, param);
}
@DS("#param.dataSourceCode")
@Override
public int update(String id, Object param) {
return this.sqlSession.update(id, param);

View File

@ -84,6 +84,7 @@
<!--api联查应用表like查询 -->
<sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis">
sys_application_api.id,
sys_application.id as app_id,
sys_application.app_id as app_code,
sys_application_api.api_code,
sys_application_api.api_name,

View File

@ -41,62 +41,35 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
static class A88772 {
String execute(String jsonStr) {
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data");
com.alibaba.fastjson.JSONArray gl_detail = data.getJSONArray("gl_detail");
com.alibaba.fastjson.JSONArray gl_fixtmpfreevalue = data.getJSONArray("gl_fixtmpfreevalue");
com.alibaba.fastjson.JSONObject resData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject sendData = new com.alibaba.fastjson.JSONObject();
sendData.put("accbookCode",data.getString("accbook_code"));
sendData.put("prepareddate",data.getString("prepareddate"));
sendData.put("year",data.getString("year"));
sendData.put("num",data.getString("num"));
sendData.put("period",data.getString("period"));
sendData.put("vouchertype",data.getString("vouchertype"));
sendData.put("attachment",data.getString("attachment"));
sendData.put("prepared",data.getString("prepared"));
com.alibaba.fastjson.JSONArray detail = new com.alibaba.fastjson.JSONArray();
if(gl_detail != null && gl_detail.size() > 0){
for (int i = 0; i < gl_detail.size(); i++) {
com.alibaba.fastjson.JSONObject detaildata = gl_detail.getJSONObject(i);
com.alibaba.fastjson.JSONObject object1 = new com.alibaba.fastjson.JSONObject();
object1.put("detailindex",detaildata.getString("detailindex"));
object1.put("explanation",detaildata.getString("explanation"));
object1.put("accountCode",detaildata.getString("account_code"));
object1.put("currtypeCode",detaildata.getString("currtype_code"));
object1.put("amount",detaildata.getString("amount"));
object1.put("localdebitamount",detaildata.getString("localdebitamount"));
object1.put("localcreditamount",detaildata.getString("localcreditamount"));
object1.put("groupdebitamount",detaildata.getString("groupdebitamount"));
object1.put("groupcreditamount",detaildata.getString("groupcreditamount"));
object1.put("globaldebitamount",detaildata.getString("globaldebitamount"));
object1.put("globalcreditamount",detaildata.getString("globalcreditamount"));
object1.put("busidate",detaildata.getString("busidate"));
detail.add(object1);
if(gl_fixtmpfreevalue != null && gl_fixtmpfreevalue.size() > 0){
com.alibaba.fastjson.JSONArray ass = new com.alibaba.fastjson.JSONArray();
for (int i1 = 0; i1 < gl_fixtmpfreevalue.size(); i1++) {
if(gl_fixtmpfreevalue.getJSONObject(i1).getString("voucher_id").equals(data.getString("voucher_id"))
&& gl_fixtmpfreevalue.getJSONObject(i1).getString("detail_id").equals(detaildata.getString("detail_id"))){
com.alibaba.fastjson.JSONObject assdetail1 = new com.alibaba.fastjson.JSONObject();
assdetail1.put("checktypecode",gl_fixtmpfreevalue.getJSONObject(i1).getString("checktypecode"));
assdetail1.put("checkvaluecode",gl_fixtmpfreevalue.getJSONObject(i1).getString("checkvaluecode"));
ass.add(assdetail1);
if("200".equals(resData.getJSONObject("data").get("status"))){
com.alibaba.fastjson.JSONObject reqData = resData.getJSONObject("data").getJSONObject("attribute");
if(null !=reqData){
if("0".equals(reqData.getString("code"))){
com.alibaba.fastjson.JSONObject result=reqData.getJSONObject("result");
if(null != result){
java.lang.String applicationId= result.getString("applicationId");
if(null != applicationId){
returnObject.put("success","true");
returnObject.put("tripartiteId",applicationId);
}else{
returnObject.put("success","false");
}
}else{
returnObject.put("success","false");
}
if(ass.size() > 0){
object1.put("ass",ass);
}else{
returnObject.put("success","false");
returnObject.put("message",reqData.getString("message"));
}
}else{
returnObject.put("success","false");
}
}else {
returnObject.put("success","false");
}
}
sendData.put("detail",detail);
returnObject.put("bodys",sendData);
return returnObject.toJSONString();
}
}
}

View File

@ -27,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -224,4 +225,13 @@ public class EntranceController {
}
@RequestMapping(value = "/option1")
@ResponseBody
public JsonResultEntity option1(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
HttpServletRequest request = (HttpServletRequest) servletRequest;
String queryString = request.getQueryString();
return BaseResult.getSuccessMessageEntity("成功");
}
}

View File

@ -69,4 +69,14 @@ public interface IInvoiceDao extends IBaseDao<InvoiceEntity,String> {
* @Date 2025-04-17 15:19
* **/
List<InvoiceEntity> queryInputInvoiceResult(InvoiceEntity entity);
/**
*
* @content 更新发票批量录入结果
* @Param
* @Return
* @Author hecan
* @Date 2025-05-26 10:34
* **/
Integer updateInputInvoiceResult(InvoiceEntity entity);
}

View File

@ -62,4 +62,10 @@ public class InvoiceDaoImpl extends MybatisGenericDao<InvoiceEntity,String> impl
public List<InvoiceEntity> queryInputInvoiceResult(InvoiceEntity entity) {
return (List<InvoiceEntity>)super.selectList("queryInputInvoiceResult",entity);
}
@DS("#entity.dataSourceCode")
@Override
public Integer updateInputInvoiceResult(InvoiceEntity entity) {
return super.update("updateInputInvoiceResult",entity);
}
}

View File

@ -75,6 +75,60 @@ public class InvoiceEntity extends BaseEntity {
private String summaryId;//
private String input_result_status_filed;//进项发票结果字段
private String input_result_status;//进项发票结果
private String yd_result;//进项发票批量导入返回流水号
private String tab_name;//表名称
private String yd_res_field;//进项发票批量导入返回流水号字段
private String import_result_field;//进项发票批量导入返回结果字段
private String import_result;//进项发票批量导入返回结果
private String bill_code;//发票批量导入单号
public String getBill_code() {
return bill_code;
}
public void setBill_code(String bill_code) {
this.bill_code = bill_code;
}
public String getTab_name() {
return tab_name;
}
public void setTab_name(String tab_name) {
this.tab_name = tab_name;
}
public String getYd_res_field() {
return yd_res_field;
}
public void setYd_res_field(String yd_res_field) {
this.yd_res_field = yd_res_field;
}
public String getImport_result_field() {
return import_result_field;
}
public void setImport_result_field(String import_result_field) {
this.import_result_field = import_result_field;
}
public String getImport_result() {
return import_result;
}
public void setImport_result(String import_result) {
this.import_result = import_result;
}
public String getYd_result() {
return yd_result;
}
public void setYd_result(String yd_result) {
this.yd_result = yd_result;
}
public String getInput_result_status_filed() {
return input_result_status_filed;

View File

@ -70,6 +70,15 @@
<result property="invoice_number" column="invoice_number" />
<result property="url" column="url" />
<result property="result_status" column="result_status" />
<result property="summaryId" column="summaryId" />
<result property="input_result_status_filed" column="input_result_status_filed" />
<result property="input_result_status" column="input_result_status" />
<result property="yd_result" column="yd_result" />
<result property="tab_name" column="tab_name" />
<result property="yd_res_field" column="yd_res_field" />
<result property="import_result_field" column="import_result_field" />
<result property="import_result" column="import_result" />
<result property="bill_code" column="bill_code" />
</resultMap>
@ -90,7 +99,7 @@
<select id="queryInputInvoiceResult" resultMap="get-InvoiceEntity-result" parameterType="com.hzya.frame.seeyon.invoice.entity.InvoiceEntity">
select
*
from formmain_0533
from v_hzya_invoice_import where push_status is not null and yd_result is not null and import_result is null
</select>
<!--通过主键修改方法-->
@ -115,6 +124,11 @@
where id=#{id}
</update>
<!--通过主键修改方法-->
<update id="updateInputInvoiceResult" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
update ${tab_name} set ${import_result_field} =#{import_result} where id=#{id}
</update>
</mapper>

View File

@ -0,0 +1,45 @@
package com.hzya.frame.seeyon.invoice.entity;
public enum InvoiceImportState {
inputZero("0","进行中"),
inputOne("1","全部成功"),
inputTwo("2","部分失败"),
inputThree("3","全部失败");
private String type;
//
private String value;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
InvoiceImportState(String type, String value){
this.type=type;
this.value=value;
}
public static String invoiceStateGetValue(String type){
for (InvoiceImportState invoiceState : InvoiceImportState.values()){
if(invoiceState.getType()==type||invoiceState.getType().equals(type)){
return invoiceState.getValue().toString();
}
}
return null;
}
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.seeyon.invoice.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
@ -16,6 +17,7 @@ import com.hzya.frame.seeyon.entity.CtpFileEntity;
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDao;
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDetailsDao;
import com.hzya.frame.seeyon.invoice.entity.InvoiceEntity;
import com.hzya.frame.seeyon.invoice.entity.InvoiceImportState;
import com.hzya.frame.seeyon.invoice.entity.InvoiceState;
import com.hzya.frame.seeyon.invoice.service.IInvoiceService;
import com.hzya.frame.seeyon.util.OARestUtil;
@ -74,6 +76,8 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
private String invoicePdfUrl;
@Value("${invoice_ofd.url:}")
private String invoiceOfdUrl;
@Value("${invoice_xml.url:}")
private String invoiceXmlUrl;
@Override
public JsonResultEntity queryArchives(JSONObject json) {
@ -179,7 +183,7 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
logger.info("=====调用杭泰税务查询申请单详情的返回参数为:{}===========", result);
JSONObject resultJson = JSONObject.parseObject(result);
if (!resultJson.getBoolean("flag")) {
saveTaskLivingDetails(entity.getId(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false, "");
saveTaskLivingDetails(entity.getSerial_number(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false, "QueryInvoiceResultPluginInitializer");
} else {
JSONObject attribute = resultJson.getJSONObject("attribute");
if ("0".equals(attribute.getString("code"))) {
@ -231,6 +235,19 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
ManyfileUpload(fileOfd, entity, sub_reference, att_reference, jsonObject);
logger.info("========ofd文件上传OA完成========");
}
//获取xml文件到本地 并为xml取名否则会报无法访问错误
logger.info("========开始将xml文件保存到本地========");
String xmlFileName = generateFileName(xmlUrl, "zip");
String xmlSavePath = invoiceXmlUrl + xmlFileName;
File fileXml = downloadXml(xmlUrl, xmlSavePath);
logger.info("========xml文件保存到本地完成========");
//File fileXml = new File(xmlSavePath);
if(null !=fileXml){
logger.info("========开始将xml文件上传OA========");
ManyfileUpload(fileXml, entity, sub_reference, att_reference, jsonObject);
logger.info("========xml文件上传OA完成========");
}
saveTaskLivingDetails(entity.getSerial_number(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), true, "QueryInvoiceResultPluginInitializer");
}
}
}else{
@ -240,8 +257,30 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
entity.setId(entity.getSerial_number());
invoiceDao.updateInvoiceResult(entity);
logger.info("=======将开票结果回写OA完毕======");
saveTaskLivingDetails(entity.getSerial_number(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false, "QueryInvoiceResultPluginInitializer");
}
}
//开票成功提交流程
//查询待办退回流程用这里只处理退回的情况如果要处理提交要等开票成功后才能提交去定时查开票结果的定时任务里做
// ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity();
// applyInvoice.setId(entity.getSerial_number());
// applyInvoice.setDataSourceCode("HT-OA");
// ApplyInvoiceEntity applyInvoiceEntity = applyInvoiceService.queryAffair(applyInvoice);
// if (null != applyInvoiceEntity){
// String stepBack = applyInvoiceService.stepBackValueOf(applyInvoiceEntity.getWorkitem_id(), InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));
// applyInvoiceService.process(stepBack,"8000590007");
// }
}else {
//开票失败流程回退
//查询待办退回流程用这里只处理退回的情况如果要处理提交要等开票成功后才能提交去定时查开票结果的定时任务里做
// ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity();
// applyInvoice.setId(entity.getSerial_number());
// applyInvoice.setDataSourceCode("HT-OA");
// ApplyInvoiceEntity applyInvoiceEntity = applyInvoiceService.queryAffair(applyInvoice);
// if (null != applyInvoiceEntity){
// String stepBack = applyInvoiceService.stepBackValueOf(applyInvoiceEntity.getWorkitem_id(), attribute.getString("resultMsg"));
// applyInvoiceService.process(stepBack,"8000590006");
// }
}
}
}
@ -267,7 +306,8 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
for (InvoiceEntity entity : invoiceEntities) {
entity.setDataSourceCode("HT-OA");
JSONObject jsonObject=new JSONObject();
jsonObject.put("serialNumber",entity.getId());
jsonObject.put("serialNumber",entity.getYd_result());
logger.info("=====调用杭泰税务查询发票批量录入结果的请求参数为:{}===========",jsonObject.toJSONString());
//发送数据
String result = HttpRequest.post(url).
header("appId", "800060").
@ -280,7 +320,7 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
logger.info("=====调用杭泰税务查询发票批量录入结果的返回参数为:{}===========",result);
JSONObject resultJson = JSONObject.parseObject(result);
if (!resultJson.getBoolean("flag")) {
saveTaskLivingDetails(entity.getId(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false,"");
saveTaskLivingDetails(entity.getId(), entity.getBill_code(), jsonObject.toJSONString(), resultJson.toJSONString(), false,"QueryInputInvoiceResultPluginInitializer");
} else {
JSONObject attribute = resultJson.getJSONObject("attribute");
if("0".equals(attribute.getString("code"))) {
@ -288,14 +328,14 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
if (null != jsonResult) {
String serialNumber = jsonResult.getString("serialNumber");//流水号
String status = jsonResult.getString("status");//发票批量录入返回结果状态
if(serialNumber.equals(entity.getId())){
if(serialNumber.equals(entity.getYd_result())){
//修改发票批量录入结果状态
logger.info("=========开始更新进项发票的结果==========");
entity.setInput_result_status(InvoiceState.invoiceStateGetValue(status));
entity.setImport_result(InvoiceImportState.invoiceStateGetValue(status));
entity.setDataSourceCode("HT-OA");
invoiceDao.updateInvoiceResult(entity);
invoiceDao.updateInputInvoiceResult(entity);
logger.info("=========更新进项发票的结果完成==========");
saveTaskLivingDetails(entity.getId(),entity.getBusiness_no(),jsonObject.toJSONString(), resultJson.toJSONString(), true,"");
saveTaskLivingDetails(entity.getId(),entity.getBill_code(),jsonObject.toJSONString(), resultJson.toJSONString(), true,"QueryInputInvoiceResultPluginInitializer");
}
}
}
@ -444,6 +484,20 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
}
}
/**
* 下载发票xml附件 税务系统返回的xml文件是.zip压缩包
* @param xmlUrl
* @param savePath
*/
private File downloadXml(String xmlUrl,String savePath){
long size = HttpUtil.downloadFile(xmlUrl,savePath);
File xmlZipFile = new File(savePath);
// if (null != xmlZipFile && xmlZipFile.getName().endsWith(".zip")){
// File unzip = ZipUtil.unzip(xmlZipFile);
// return unzip;
// }
return xmlZipFile;
}
private static void trustAllCertificates(HttpsURLConnection conn) throws Exception {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@ -577,7 +631,7 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
}
}catch (Exception e){
logger.info("抽取杭泰付款单保存日志到集成任务日志明细中失败:{}",e.getMessage());
logger.info("发票保存日志到集成任务日志明细中失败:{}",e.getMessage());
e.printStackTrace();
}
}

View File

@ -11,8 +11,8 @@ import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
public interface ICtpAttachmentService extends IBaseService<CtpAttachmentEntity, String> {
/**
* 保存附件关系表
* @param fileUrl ctp_file id
* @param col_summary_id col_summary id
* @param fileUrl ctp_file id fileUrl
* @param col_summary_id col_summary id oa表单id
* @param sub_reference 随机uuid
* @return
*/

View File

@ -91,7 +91,7 @@ public interface ISeeYonInterFace {
* @return
* @throws Exception
*/
JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType) throws Exception;
JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType,String summaryId) throws Exception;
JsonResultEntity chengeBody(JSONObject jsonObject) throws Exception;

View File

@ -61,7 +61,7 @@ public class CtpAttachmentServiceImpl extends BaseService<CtpAttachmentEntity, S
ctpAttachmentEntity.setFile_url(ctpFile.getId());//ctp_file表的id
ctpAttachmentEntity.setAtt_reference(col_summary_id);//业务表单的id
ctpAttachmentEntity.setSub_reference(sub_reference);//这个字段要保存到业务表附件到字段上
ctpAttachmentEntity.setCategory(ctpFile.getCategory());//这里写66 才可以显示图片
ctpAttachmentEntity.setCategory("66");//这里写66 才可以显示图片
ctpAttachmentEntity.setFilename(ctpFile.getFilename());
ctpAttachmentEntity.setType(ctpFile.getType());
ctpAttachmentEntity.setMime_type(ctpFile.getMime_type());

View File

@ -244,7 +244,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
JsonResultEntity result = null;
try {
//流程事件处理
result = colEventPost(jsonStr, formApp, eventType);
result = colEventPost(jsonStr, formApp, eventType, summaryId);
} catch (Exception e) {
return BaseResult.getFailureMessageEntity("传递失败", e.getMessage());
}
@ -500,7 +500,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
* @throws Exception
*/
@Override
public JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType) throws Exception {
public JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType,String summaryId) throws Exception {
if (StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)) {
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
sysApplicationApiEntity.setHeaderIn(formAppId + "_" + eventType);
@ -544,6 +544,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
reqJson.put("jsonStr",jsonStr);
reqJson.put("formAppId",formAppId);
reqJson.put("eventType",eventType);
reqJson.put("summaryId",summaryId);
reqJson.put("headers",JSON.toJSONString(headerMap));
reqJson.put("apiDataSourceCode",sysApiDatabase.getSourceCode());
JsonResultEntity result = pluginBaseEntity.executeBusiness(reqJson);

View File

@ -177,6 +177,9 @@ public class OARestUtil {
hashMap.put(parameterName,example);
}
}
if (StrUtil.isNotEmpty(login_name)){
hashMap.put("loginName",login_name);
}
login_name = hashMap.get("loginName");
if (StrUtil.isEmpty(login_name)){
hashMap.put("loginName","hzya");

View File

@ -237,14 +237,15 @@ public class SM2Util {
private void testSignByQuickpass() throws Exception {
//密钥生成
String privateKey = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgOHOzaKWBWOAbslvtYtS8tcQiJ9W9DT2cGQM3KSgXpfygCgYIKoEcz1UBgi2hRANCAAQNPct0MHOuDrVJBIy0RI7JKx9/PTlFHZlkIJr0EqpC+b/+N+z3JKbCMZ/wcP1V36Q+DlfDJCY9Ai/Uk2PZ9ZaF";
String publicKey = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEDT3LdDBzrg61SQSMtESOySsffz05RR2ZZCCa9BKqQvm//jfs9ySmwjGf8HD9Vd+kPg5XwyQmPQIv1JNj2fWWhQ==";
//String publicKey = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEDT3LdDBzrg61SQSMtESOySsffz05RR2ZZCCa9BKqQvm//jfs9ySmwjGf8HD9Vd+kPg5XwyQmPQIv1JNj2fWWhQ==";
String publicKey = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEyocGV+D91yPL2EyngjizFW2p1DW2l46yBGcp7IcHTs0VYM0UEojzVqOjgQZAD76hPtkUvuQAaUvNg0pSpfNc9A==";//测试环境
// 加验签
//String value = "{\"partner\": \"test\",\"tranTime\": \"20240128003627\",\"seqNo\": \"123456\",\"orderNo\": \"order123456\", \"orderAmt\": \"1500\"}";
String value="{\"data\":{\"companyCode\":\"CN000001\",\"purpose\":\"加入中国光伏行业协会会员单位获得行业技术支持2025年会员单位缴纳标准为1万元/年,汇款时需注明“会费”字样,并在备注中注明汇款单位;缴纳会费后,需有付款凭证,将付款凭证发送至协会邮箱,并填写开票信息等内容\",\"recAccountNum\":\"8110701012801540483\",\"recAccountName\":\"\",\"payAccountNum\":\"8110701012601540892\",\"fundType\":\"0001\",\"transAmount\":\"9.90\",\"documentNo\":\"DG202503240321\",\"recBankCode\":\"\",\"settleAccountType\":\"CASH_TRANSFER\",\"sourceFlowNumber\":\"-3854827654841675885_1539\",\"submitUser\":\"user1\",\"digest\":\"加入中国光伏行业协会会员单位获得行业技术支持2025年会\",\"payChannel\":\"DIRECT\",\"currency\":\"CNY\",\"toPublic\":true,\"payAccountName\":\"\",\"payDate\":\"2025-03-26\"}}";
String value="{\"data\":{\"companyCode\":\"CN000001\",\"recFinanceCode\":\"ICBC\",\"purpose\":\"丽水景宁招商局拜访我司,交流业务需求,购买星巴克咖啡\",\"recAccountNum\":\"6222031202014975097\",\"recAccountName\":\"董笑笑\",\"payAccountNum\":\"8110701012601540892\",\"fundType\":\"0002\",\"transAmount\":\"192.00\",\"documentNo\":\"ZD202505290104\",\"recBankCode\":\"102331002036\",\"settleAccountType\":\"CASH_TRANSFER\",\"sourceFlowNumber\":\"-1647479218002638895_1746\",\"digest\":\"付招待报销ZD202505290104\",\"payChannel\":\"DIRECT\",\"currency\":\"CNY\",\"toPublic\":false,\"payDate\":\"2025-06-04\"}}";
System.out.println("明文:" + value);
//加密
//String encryptStr = encrypt(value, publicKey);
String encryptStr="BLTRQV8d8D1ILWs21weVXVubIB1Ppx3Oy3rWqdocyrAXm5WBNhSz6YemoVVPTTtdycJ3mcFF1YuRKhuHsMhU/VkzssS3i7W8FPwWHNyyorhd3LrP0HMx+j3MN/s7kGs9PGRem/X4U+tQsJxoQSi8CkmwCcF42aN78LkQ5292cDQ6/AcobhKYNHBqCeX9+gUhue76pWFM12k9rXQYvCnIqdf+vB5ot+UXuk3eXwnlmVdP+f5kSSKxyWRIC8GjLwHRWChkuk6IkjIhVlSMJfVt1fOseBYq5VW32XkHQFbSZW3JvYUhHpimibw7SP6SK60TT8lfJzsABJ5euADCFlhVwfUZZXZLdSV4YFSB/IQ6vVkHorQmD5RdGxktgu3MbErdEPhiGl7/tLj6gKi2ecRobGkQwu1peKcKB08WgnWFX/6Wbs0dxfavAAc1W3mXta0zx/+q2jiIydCsySUT2xCRDVBlGHPIlN8RDucQ4mOE5gBlr9vvMxnKOG2kdWzTVoj+aibqKh5ljwGbIUetbE3XtwNlO7deupvTaUN565P1M8cuK7zQjLeoUD2gqLMZOzz5fgkrPTzd7jUyf3QatDOGEFxrF1u03BMJVNAssxj7pdq2aSBTrHKwafoplUpWEAogeiUh2xYlVSEu2BUinHoMxqGU57UM/ZU1IRFgVKTdHV/R/4hLOpu55Mq7C5cOTVwVFasnIdbkJvabNX/vN0js9Bx/2QJx5SN2wqCV5R4yrXTH4dUGVTQFNLuiZSX8TML463FCIrtiofHZ/jvp3hEbyYTchkMuPEvH3MBZAt6ZXmwInYEktymF2nvBD7Pw22xQaE1Sqfjig5m4gQHB1mRV/RKCaNv7CuXsef29ldU5mQnER0U=";
String encryptStr = encrypt(value, publicKey);
//String encryptStr="BD0GuyA+11ejXLUgFbf2jW0YBh0klhbiHry6dyUtnto2Ld3Mb9DLmsKtDulejqdhpZpFffaMumy+eLU80cERr4QwGGCP7rOVt010bsP8a0RMH7JbMdpSMNUeB8nAYTI+rdsHVCFn6wTWMpMAqNqAw8HkZ+OHEjuPBht3Q1VX670twFSnOa/h/hBY2DeEO1Nzo1yodzfLVJF6fyDA+4dwz7Zi/4cqO+AEwFYmZ20WR6hTAmC4dzDK9BLFx7ymSQX46X3ppydZGcnGQcBR8RWItk4ev84TB59PREeXf0ruNEqsryUrCLsVAHeB1+RhhgRYQyz0L8hFRRbXq0ArMgrnYZzDgagAtGvo6QtE49dbERr4rSfAk65XVew5aEBmhHmL4gEgGOgaJ8juIzoYnj5pssmdxYh8xOzrpFprLI5Rp7mbbl/GhPruUNCrZOg5kTahVzMYodgokeWjQLp3bjXROIQBcgkLH2Dhov9lVKqa9Bnf291XxvsWkU7hr68WGz+30nEEOfmCfoFF8ZBZPyCbZ/zNKYL136F3qqezdh6x7OgTH8CFbFdK/qMIgGrzLTwIXYJJx3ZA+zzUQ7PlosFuv/vYACN5BQ3NbX8uVWJQVJ2KmG4fgo7xEa61TeBB3i5n6FJNxO5NPelDlJToy/FS0tutmwgwu/vvKbeb4Hz6ZZt9nyCvDoHbMdKutyQKmNPNc6fz2VvhUCEbQrtDmZqimHMpozm+lZFHn8bHsxVqDY0M0G3hJhoQDWElIWBrZF7TWb0WEk4leCKB6z+qK8V8Bjdc3UdV4IsFU2MV9H5tcjKk+2k4gqUB9+vfV5fYhVsBpflyw6uGNjwdWoGmZAXbKyrKI3bIlmPCe2/boraFNQfr7BsRT6D0PgJn+kb4TVgl6TP2MTX3bDMe4h5XR6Qs6HYQnm8KnS5uXdrQh3Luyhw+dch5D4kzK7Yf";
System.out.println("加密结果:" + encryptStr);
//解密

View File

@ -97,7 +97,7 @@
<!--通过主键修改方法-->
<update id="updateElecStatusZX" parameterType = "com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity" >
update ${tabName} set ${receiptFiled} =#{receipt} where id=#{id}
update ${tabName} set ${receiptFiled} =#{receipt} where id=#{dataId}
</update>

View File

@ -179,7 +179,7 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
String encrypt = SM2Util.encrypt(objectData.toJSONString(), publicKey);
JSONObject jsonData=new JSONObject();
jsonData.put("data",encrypt);
logger.info("=======杭泰付款单调用中信支付结果查询请求参数密文为:{}", jsonData.toJSONString());
//logger.info("=======杭泰付款单调用中信支付结果查询请求参数密文为:{}", jsonData.toJSONString());
//发送数据
String result = HttpRequest.post(url).
header("appId", "800058").
@ -197,7 +197,7 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
} else {
JSONObject attribute = resultJson.getJSONObject("attribute");
String data = attribute.getString("data");
logger.info("=======杭泰付款单调用中信支付结果查询返回参数密文为:{}", data);
// logger.info("=======杭泰付款单调用中信支付结果查询返回参数密文为:{}", data);
String decrypt = SM2Util.decrypt(data, privateKey);
logger.info("=======杭泰付款单调用中信支付结果查询返回参数明文为:{}", decrypt);
JSONObject jsonObjectData = JSONObject.parseObject(decrypt);
@ -223,7 +223,7 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
}
}
}
logger.info("========杭泰付款单查询支付结果执行成功========");
//logger.info("========杭泰付款单查询支付结果执行成功========");
return BaseResult.getSuccessMessageEntity("支付结果查询成功");
}catch (Exception e){
logger.info("=========查询中信返回的支付结果失败:{}=======",e.getMessage());