财报数据推送
This commit is contained in:
parent
ab0be7eb28
commit
d7518643be
|
@ -28,5 +28,7 @@ public interface IIncomeInvoiceDao extends IBaseDao<IncomeInvoiceEntity, String>
|
|||
int updateMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||
|
||||
int saveMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||
|
||||
List<IncomeInvoiceEntity> queryZtzz(IncomeInvoiceEntity entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,5 +52,14 @@ public class IncomeInvoiceDaoImpl extends MybatisGenericDao<IncomeInvoiceEntity,
|
|||
public int saveMx(IncomeInvoiceEntity entity) {
|
||||
return super.insert(getSqlIdPrifx() + "saveMx", entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<IncomeInvoiceEntity> queryZtzz(IncomeInvoiceEntity entity) {
|
||||
List<IncomeInvoiceEntity> o = (List<IncomeInvoiceEntity>) super.selectList(getSqlIdPrifx() + "queryZtzz", entity);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.hzya.frame.web.entity.BaseEntity;
|
|||
*/
|
||||
public class IncomeInvoiceEntity extends BaseEntity {
|
||||
|
||||
//发票字段
|
||||
private Integer dataId;
|
||||
private Integer formmainId;
|
||||
private String field0127;
|
||||
|
@ -17,6 +18,54 @@ public class IncomeInvoiceEntity extends BaseEntity {
|
|||
private String field0003;
|
||||
|
||||
|
||||
//财报数据 字段
|
||||
private String aloneId;
|
||||
private String sysData;
|
||||
private String orgCode;
|
||||
private String orgName;
|
||||
private String iufoVer;
|
||||
|
||||
|
||||
public String getAloneId() {
|
||||
return aloneId;
|
||||
}
|
||||
|
||||
public void setAloneId(String aloneId) {
|
||||
this.aloneId = aloneId;
|
||||
}
|
||||
|
||||
public String getSysData() {
|
||||
return sysData;
|
||||
}
|
||||
|
||||
public void setSysData(String sysData) {
|
||||
this.sysData = sysData;
|
||||
}
|
||||
|
||||
public String getOrgCode() {
|
||||
return orgCode;
|
||||
}
|
||||
|
||||
public void setOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
|
||||
public String getOrgName() {
|
||||
return orgName;
|
||||
}
|
||||
|
||||
public void setOrgName(String orgName) {
|
||||
this.orgName = orgName;
|
||||
}
|
||||
|
||||
public String getIufoVer() {
|
||||
return iufoVer;
|
||||
}
|
||||
|
||||
public void setIufoVer(String iufoVer) {
|
||||
this.iufoVer = iufoVer;
|
||||
}
|
||||
|
||||
public Integer getDataId() {
|
||||
return dataId;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
<if test="kpr != null and kpr != ''"> kpr , </if>
|
||||
<if test="skr != null and skr != ''"> skr , </if>
|
||||
<if test="fhr != null and fhr != ''"> fhr , </if>
|
||||
<if test="url != null and url != ''"> url , </if>
|
||||
<if test="ofdurl != null and ofdurl != ''"> ofdurl , </if>
|
||||
<if test="xmlurl != null and xmlurl != ''"> xmlurl , </if>
|
||||
<if test="htbh != null and htbh != ''"> htbh , </if>
|
||||
|
||||
|
||||
</trim>
|
||||
|
@ -97,7 +101,10 @@
|
|||
<if test="kpr != null and kpr != ''"> #{kpr} , </if>
|
||||
<if test="skr != null and skr != ''"> #{skr} , </if>
|
||||
<if test="fhr != null and fhr != ''"> #{fhr} , </if>
|
||||
|
||||
<if test="url != null and url != ''"> #{url} , </if>
|
||||
<if test="ofdurl != null and ofdurl != ''"> #{ofdurl} , </if>
|
||||
<if test="xmlurl != null and xmlurl != ''"> #{xmlurl} , </if>
|
||||
<if test="htbh != null and htbh != ''"> #{htbh} , </if>
|
||||
|
||||
</trim>
|
||||
)
|
||||
|
@ -214,5 +221,19 @@
|
|||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="queryZtzz" resultType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||
select
|
||||
alone_id as aloneId,
|
||||
keyword2 as sysData,
|
||||
orgs.code as orgCode,
|
||||
orgs.name as orgName,
|
||||
iufo.ver as iufoVer
|
||||
from IUFO_MEASPUB_VIOU iufo
|
||||
LEFT JOIN org_orgs orgs on iufo.keyword1 = orgs.pk_org
|
||||
<if test="sysData != null and sysData !='' "> where iufo.keyword2 = #{sysData} </if>
|
||||
and ver = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.service.IIncomeInvoiceService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 主数据同步
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class FinancialReportPluginInitializer extends PluginBaseEntity{
|
||||
Logger logger = LoggerFactory.getLogger(FinancialReportPluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private IIncomeInvoiceService incomeInvoiceService;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "执行初始化方法initialize()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "执行销毁方法destroy()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "FinancialReportPlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "FinancialReportPlugin插件";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "FinancialReportPlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行进项全量发票主数据信息同步========");
|
||||
return incomeInvoiceService.sendFinancialReportPlugin(requestJson);
|
||||
}catch (Exception e){
|
||||
logger.info("======执行进项全量发票主数据同步失败:{}========",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -12,6 +12,15 @@ import com.hzya.frame.web.entity.JsonResultEntity;
|
|||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public interface IIncomeInvoiceService extends IBaseService<IncomeInvoiceEntity, String> {
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 全量发票数据
|
||||
* @Date 4:28 下午 2025/4/16
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity getIncomeInvoiceData(JSONObject requestJson);
|
||||
SysExtensionApiEntity setData(SysExtensionApiEntity entity) throws Exception;
|
||||
|
||||
JsonResultEntity sendFinancialReportPlugin(JSONObject requestJson);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.dao.IIncomeInvoiceDao;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.service.IIncomeInvoiceService;
|
||||
|
@ -15,6 +17,7 @@ import com.hzya.frame.uuid.UUIDLong;
|
|||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
|
@ -33,6 +36,7 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
|||
import javax.net.ssl.SSLContext;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -61,6 +65,13 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
|||
String taxNo = "91330110MAC5FPUY2U";
|
||||
Integer size = 50;
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 全量发票数据
|
||||
* @Date 4:28 下午 2025/4/16
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity getIncomeInvoiceData(JSONObject requestJson) {
|
||||
//1、调用token
|
||||
|
@ -137,6 +148,10 @@ 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("htbh",content.getString("contraceNumber"));
|
||||
|
||||
JSONArray detaildata = content.getJSONArray("items");
|
||||
if(detaildata != null && detaildata.size() > 0){
|
||||
|
@ -461,26 +476,28 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
|||
sendBody.put("dataXml",dataXml);
|
||||
entity.setBodys(sendBody.toJSONString());
|
||||
//修改明细表
|
||||
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
||||
incomeInvoiceEntity.setDataSourceCode("master");//todo
|
||||
//incomeInvoiceEntity.setDataSourceCode("HT-OA");//todo
|
||||
incomeInvoiceEntity.setField0003("hth001");//合同号 todo
|
||||
incomeInvoiceEntity.setField0127(jsonObject.getString("fpdm"));//发票代码
|
||||
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
||||
incomeInvoiceEntity.setField0129(jsonObject.getString("jshj"));//发票总额
|
||||
incomeInvoiceEntity.setField0130(jsonObject.getString("fpwj"));//发票文件 todo
|
||||
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaZb(incomeInvoiceEntity);
|
||||
if(list != null && list.size() == 1){
|
||||
incomeInvoiceEntity.setFormmainId(list.get(0).getDataId());
|
||||
}
|
||||
List<IncomeInvoiceEntity> mxlist = incomeInvoiceDao.queryOaMx(incomeInvoiceEntity);
|
||||
if(mxlist != null && mxlist.size() == 1){
|
||||
incomeInvoiceEntity.setDataId(mxlist.get(0).getDataId());
|
||||
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
|
||||
}
|
||||
if(mxlist == null || mxlist.size() == 0){
|
||||
incomeInvoiceEntity.setDataId(1);
|
||||
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
|
||||
if(jsonObject.getString("htbh") != null){
|
||||
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
||||
incomeInvoiceEntity.setDataSourceCode("master");//todo
|
||||
//incomeInvoiceEntity.setDataSourceCode("HT-OA");//todo
|
||||
incomeInvoiceEntity.setField0003(jsonObject.getString("htbh"));//合同号
|
||||
incomeInvoiceEntity.setField0127(jsonObject.getString("fpdm"));//发票代码
|
||||
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
||||
incomeInvoiceEntity.setField0129(jsonObject.getString("jshj"));//发票总额
|
||||
incomeInvoiceEntity.setField0130(jsonObject.getString("fpwj"));//发票文件 todo
|
||||
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaZb(incomeInvoiceEntity);
|
||||
if(list != null && list.size() == 1){
|
||||
incomeInvoiceEntity.setFormmainId(list.get(0).getDataId());
|
||||
}
|
||||
List<IncomeInvoiceEntity> mxlist = incomeInvoiceDao.queryOaMx(incomeInvoiceEntity);
|
||||
if(mxlist != null && mxlist.size() == 1){
|
||||
incomeInvoiceEntity.setDataId(mxlist.get(0).getDataId());
|
||||
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
|
||||
}
|
||||
if(mxlist == null || mxlist.size() == 0){
|
||||
incomeInvoiceEntity.setDataId(1);
|
||||
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -488,6 +505,8 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
|||
return entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String getXml(JSONObject jsonObject) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("<forms version=\"2.1\">");
|
||||
|
@ -609,7 +628,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
|||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"发票文件\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("fpwj") != null?"<![CDATA["+jsonObject.getString("fpwj")+"]]>":"");
|
||||
stringBuffer.append(jsonObject.getString("fpwj") != null?"<![CDATA["+jsonObject.getString("url")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
|
||||
|
@ -658,5 +677,59 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 财报数据推送
|
||||
* @Date 4:28 下午 2025/4/16
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity sendFinancialReportPlugin(JSONObject requestJson) {
|
||||
JSONObject jsonObject = requestJson.getJSONObject("jsonStr");
|
||||
String cdDate = null;
|
||||
String jnDate = null;
|
||||
String qnDate = null;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
if(requestJson.getString("year") != null && requestJson.getString("month") != null){
|
||||
cdDate = requestJson.getString("year") + "-" + requestJson.getString("month");
|
||||
if("13".equals(requestJson.getString("month"))){
|
||||
cdDate = requestJson.getString("year") + "-12";
|
||||
qnDate = (requestJson.getInteger("year")-1) + "-12";
|
||||
}else {
|
||||
cdDate = requestJson.getString("year") + "-" + requestJson.getString("month");
|
||||
qnDate = (requestJson.getInteger("year")-1) + "-" + requestJson.getString("month");
|
||||
}
|
||||
}else {
|
||||
cdDate = sdf.format(new Date());
|
||||
jnDate = sdf.format(new Date());
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
calendar.add(Calendar.YEAR, -1);
|
||||
Date qn = calendar.getTime();
|
||||
qnDate = sdf.format(qn);
|
||||
}
|
||||
|
||||
//查询帐套组织
|
||||
IncomeInvoiceEntity entity = new IncomeInvoiceEntity();
|
||||
entity.setDataSourceCode("");
|
||||
entity.setSysData(jnDate);
|
||||
entity.setOrgCode("jnDate");
|
||||
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryZtzz(entity);
|
||||
if(list != null && list.size() > 0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
//查询数据
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="IncomeInvoicePlugin_Initializer" class="com.hzya.frame.plugin.incomeInvoiceData.plugin.IncomeInvoicePluginInitializer" />
|
||||
<bean name="FinancialReportPlugin_Initializer" class="com.hzya.frame.plugin.incomeInvoiceData.plugin.FinancialReportPluginInitializer" />
|
||||
</beans>
|
||||
|
|
Loading…
Reference in New Issue