开票申请
This commit is contained in:
parent
e905df8793
commit
cb503948d4
|
@ -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.BipProjectEntity;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.InvoiceDistributeEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IInvoiceDistributeDao extends IBaseDao<InvoiceDistributeEntity,String> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.hzya.frame.plugin.ht.dao.impl;
|
||||||
|
|
||||||
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
|
import com.hzya.frame.plugin.ht.dao.IInvoiceDistributeDao;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.InvoiceDistributeEntity;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
|
@Repository(value = "invoiceDistributeDaoImpl")
|
||||||
|
public class InvoiceDistributeDaoImpl extends MybatisGenericDao<InvoiceDistributeEntity,String> implements IInvoiceDistributeDao {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.hzya.frame.plugin.ht.entity;
|
||||||
|
|
||||||
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
|
public class InvoiceDistributeEntity extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?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.InvoiceDistributeDaoImpl">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -24,6 +24,7 @@ import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity;
|
||||||
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
||||||
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
|
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
|
||||||
import com.hzya.frame.plugin.ht.service.IApplyInvoiceService;
|
import com.hzya.frame.plugin.ht.service.IApplyInvoiceService;
|
||||||
|
import com.hzya.frame.plugin.ht.service.IInvoiceDistributeService;
|
||||||
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDao;
|
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDao;
|
||||||
import com.hzya.frame.seeyon.invoice.entity.InvoiceEntity;
|
import com.hzya.frame.seeyon.invoice.entity.InvoiceEntity;
|
||||||
import com.hzya.frame.sys.sysenum.SysEnum;
|
import com.hzya.frame.sys.sysenum.SysEnum;
|
||||||
|
@ -63,6 +64,8 @@ import java.util.*;
|
||||||
public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
Logger logger = LoggerFactory.getLogger(getClass());
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IInvoiceDistributeService iInvoiceDistributeService;
|
||||||
@Resource
|
@Resource
|
||||||
private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao;
|
private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -173,6 +176,22 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
|
logger.info("======开始执行开票申请(中台蓝字,红字推送有度)同步========");
|
||||||
|
return iInvoiceDistributeService.sendInvoiceDistribute(requestJson);
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("======执行开票申请(中台蓝字,红字推送有度)同步失败:{}========",e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/***
|
||||||
|
* 执行业务代码
|
||||||
|
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @Date 2023-08-07 11:20
|
||||||
|
* @param requestJson 执行业务代码的参数
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
public JsonResultEntity executeBusiness1(JSONObject requestJson) throws Exception {
|
||||||
try{
|
try{
|
||||||
//重试方法
|
//重试方法
|
||||||
if (null != requestJson) {
|
if (null != requestJson) {
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.hzya.frame.plugin.ht.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.basedao.service.IBaseService;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.InvoiceDistributeEntity;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
|
||||||
|
public interface IInvoiceDistributeService extends IBaseService<InvoiceDistributeEntity,String> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 开票申请(中台蓝字,红字推送有度)同步
|
||||||
|
* @Date 10:47 上午 2025/9/3
|
||||||
|
* @param requestJson
|
||||||
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
|
**/
|
||||||
|
JsonResultEntity sendInvoiceDistribute(JSONObject requestJson);
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.hzya.frame.plugin.ht.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
|
import com.hzya.frame.plugin.ht.dao.IInvoiceDistributeDao;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.InvoiceDistributeEntity;
|
||||||
|
import com.hzya.frame.plugin.ht.service.IInvoiceDistributeService;
|
||||||
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
|
||||||
|
|
||||||
|
@Service(value = "invoiceDistributeServiceImpl")
|
||||||
|
public class InvoiceDistributeServiceImpl extends BaseService<InvoiceDistributeEntity, String> implements IInvoiceDistributeService {
|
||||||
|
|
||||||
|
private IInvoiceDistributeDao iInvoiceDistributeDao;
|
||||||
|
@Value("${zt.url}")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setInvoiceDistributeDao(IInvoiceDistributeDao dao) {
|
||||||
|
this.iInvoiceDistributeDao = dao;
|
||||||
|
this.dao = dao;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param requestJson
|
||||||
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 开票申请(中台蓝字 , 红字推送有度)同步
|
||||||
|
* @Date 10:47 上午 2025/9/3
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity sendInvoiceDistribute(JSONObject requestJson) {
|
||||||
|
logger.error("同步开票申请:" + requestJson.toJSONString());
|
||||||
|
JSONObject jsonStr = requestJson.getJSONObject("jsonStr");
|
||||||
|
if (jsonStr == null) {
|
||||||
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
|
}
|
||||||
|
JSONObject businessDataStr = jsonStr.getJSONObject("businessDataStr");
|
||||||
|
if (businessDataStr == null) {
|
||||||
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
|
}
|
||||||
|
JSONObject mainData = businessDataStr.getJSONObject("formmain_0331");
|
||||||
|
if (mainData == null) {
|
||||||
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
|
}
|
||||||
|
JSONArray detailArray = businessDataStr.getJSONArray("formson_0700");
|
||||||
|
|
||||||
|
//组装发送数据
|
||||||
|
JSONObject sendData = null;
|
||||||
|
try {
|
||||||
|
sendData = getSendData(mainData, detailArray);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("推送开票申请失败:组装数据失败:" + e.getMessage());
|
||||||
|
return BaseResult.getFailureMessageEntity("推送开票申请失败:组装数据失败");
|
||||||
|
}
|
||||||
|
//发送数据
|
||||||
|
logger.error("推送开票申请推送:" + sendData.toJSONString());
|
||||||
|
|
||||||
|
String tokenResult = HttpRequest.post(url).
|
||||||
|
header("appId", "800051").
|
||||||
|
header("apiCode", "8000510012").
|
||||||
|
header("publicKey", "ZJYAM2YFEIsIaI1e4wMagkS2Q7SFgGk0RvsPhEES45m/OVFCe7eDIk+3zDUT+v578prj").
|
||||||
|
header("secretKey", "lR6+uf94mvNMclAB43oIwmhJSMDzQaViTkfXLeNvmGdpLfbFiUvbgbU+p43zO25Zj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||||
|
body(sendData.toJSONString()).
|
||||||
|
execute().
|
||||||
|
body();
|
||||||
|
logger.error("推送开票申请返回:" + tokenResult);
|
||||||
|
JSONObject resoutJson = JSONObject.parseObject(tokenResult);
|
||||||
|
if (resoutJson.getBoolean("flag")) {
|
||||||
|
return BaseResult.getSuccessMessageEntity("推送开票申请成功");
|
||||||
|
} else {
|
||||||
|
return BaseResult.getFailureMessageEntity("推送开票申请失败:" + resoutJson.getString("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mainData
|
||||||
|
* @param detailArray
|
||||||
|
* @return com.alibaba.fastjson.JSONObject
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 组装数据
|
||||||
|
* @Date 6:12 下午 2025/6/27
|
||||||
|
**/
|
||||||
|
private JSONObject getSendData(JSONObject mainData, JSONArray detailArray) throws ParseException {
|
||||||
|
JSONObject sendData = new JSONObject();
|
||||||
|
|
||||||
|
return sendData;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue