财报代码编写
This commit is contained in:
parent
7d9941d9c8
commit
0234240494
|
@ -563,177 +563,10 @@
|
||||||
|
|
||||||
|
|
||||||
<select id="queryAccountByZq" resultType="com.alibaba.fastjson.JSONObject" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
<select id="queryAccountByZq" resultType="com.alibaba.fastjson.JSONObject" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||||
-- CREATE or replace VIEW V_LPHB_KMFZYE1 AS
|
select * from V_LPHB_KMFZYE
|
||||||
select * from (
|
|
||||||
SELECT
|
|
||||||
year,
|
|
||||||
adjustperiod as period,
|
|
||||||
year || '-' || adjustperiod as yearperiod,
|
|
||||||
nt.code AS subjectCode,
|
|
||||||
oa.name AS subjectName,
|
|
||||||
oa.dispname as subjectFullName,
|
|
||||||
( SELECT code FROM bd_account WHERE pk_account = nt.pid ) as superCode,
|
|
||||||
case
|
|
||||||
when balanorient = '1' then '-1'
|
|
||||||
when balanorient = '0' then '1'
|
|
||||||
end as subjectDir,
|
|
||||||
case
|
|
||||||
when pk_acctype = '0001Z01000000000019S' then 1
|
|
||||||
when pk_acctype = '0001Z01000000000019T' then 2
|
|
||||||
when pk_acctype = '0001Z01000000000019V' then 3
|
|
||||||
when pk_acctype = '0001Z01000000000019U' then 4
|
|
||||||
when pk_acctype = '0001Z01000000000019W' then 5
|
|
||||||
when pk_acctype = '0001Z01000000000019X' then 6
|
|
||||||
end as subjectType,
|
|
||||||
nt.sumprint_level as subjectLevel,
|
|
||||||
case
|
|
||||||
when nt.sumprint_level = '0' then 1
|
|
||||||
when nt.sumprint_level != '0' then 0
|
|
||||||
end as endLevel,
|
|
||||||
sum( debitamount ) AS debitValue,-- 本期借方發生額
|
|
||||||
sum( localcreditamount ) AS creditValue,-- 本期貸方發生額
|
|
||||||
CASE
|
|
||||||
WHEN sum( qmlocalamount ) - ( sum( localdebitamount ) - sum( localcreditamount ) ) > 0 THEN'1'
|
|
||||||
WHEN sum( qmlocalamount ) - ( sum( localdebitamount ) - sum( localcreditamount ) ) = 0 THEN'0' ELSE '-1' END AS initialSubjectDir,
|
|
||||||
case
|
|
||||||
when sum( qmlocalamount ) - ( sum( localdebitamount ) - sum( localcreditamount ) )>0 then sum( qmlocalamount ) - ( sum( localdebitamount ) - sum( localcreditamount ) )
|
|
||||||
else 0 end AS initialDebitBalanceValue, -- 期初余额借方金额
|
|
||||||
case when sum( qmlocalamount ) - ( sum( localdebitamount ) - sum( localcreditamount ) ) < 0 then sum( qmlocalamount ) - ( sum( localdebitamount ) - sum( localcreditamount ) )
|
|
||||||
else 0 end AS initialCreditBalanceValue, -- 期初余额贷方金额
|
|
||||||
|
|
||||||
CASE
|
|
||||||
WHEN sum( qmamount ) > 0 THEN'1'
|
|
||||||
WHEN sum( qmamount ) = 0 THEN'0' ELSE '-1' END AS balanceSubjectDir,
|
|
||||||
case when sum( qmlocalamount )>0 then sum( qmlocalamount )
|
|
||||||
else 0 end as balanceDeditValue, -- 期末余额借方金额
|
|
||||||
|
|
||||||
case when sum( qmlocalamount )>0 then sum( qmlocalamount )
|
|
||||||
else 0 end as balanceCreditValue, -- 期末余额贷方金额
|
|
||||||
sum( ljlocaldebitamount ) AS totalDebitValue,
|
|
||||||
sum( ljlocalcreditamount ) AS totalCreditValue,
|
|
||||||
org.code GSBM,
|
|
||||||
org.name GSMC
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT DISTINCT
|
|
||||||
accperiodmonth.periodyear YEAR,
|
|
||||||
accperiodmonth.PERIOD ADJUSTPERIOD,
|
|
||||||
dezz.pk_org,
|
|
||||||
dezz.pk_accasoa,
|
|
||||||
dezz.pk_currtype,
|
|
||||||
dezz.assid assid,
|
|
||||||
0 AS localdebitamount,
|
|
||||||
0 AS localcreditamount,
|
|
||||||
0 AS debitamount,
|
|
||||||
0 AS creditamount,
|
|
||||||
sum( localdebitamount ) AS ljlocaldebitamount,
|
|
||||||
sum( localcreditamount ) AS ljlocalcreditamount,
|
|
||||||
sum( debitamount ) AS ljdebitamount,
|
|
||||||
sum( creditamount ) AS ljcreditamount,
|
|
||||||
0 AS qmlocalamount,
|
|
||||||
0 AS qmamount
|
|
||||||
FROM
|
|
||||||
( SELECT substr( yearmth, 0, 4 ) periodyear, substr( yearmth, 6, 7 ) period FROM bd_accperiodmonth WHERE yearmth < TO_CHAR( SYSDATE, 'YYYY-MM' ) ) accperiodmonth
|
|
||||||
LEFT JOIN gl_balance dezz ON dezz.YEAR = accperiodmonth.periodyear
|
|
||||||
AND dezz.adjustperiod < = accperiodmonth.period
|
|
||||||
WHERE
|
|
||||||
voucherkind != 5
|
|
||||||
AND voucherkind != 4
|
|
||||||
AND dezz.adjustperiod > '00'
|
|
||||||
GROUP BY
|
|
||||||
accperiodmonth.periodyear,
|
|
||||||
accperiodmonth.PERIOD,
|
|
||||||
dezz.pk_org,
|
|
||||||
dezz.pk_accasoa,
|
|
||||||
dezz.pk_currtype,
|
|
||||||
dezz.assid UNION ALL
|
|
||||||
SELECT DISTINCT
|
|
||||||
dezz.YEAR,
|
|
||||||
dezz.ADJUSTPERIOD,
|
|
||||||
dezz.pk_org,
|
|
||||||
dezz.pk_accasoa,
|
|
||||||
dezz.pk_currtype,
|
|
||||||
dezz.assid,
|
|
||||||
sum( localdebitamount ) AS localdebitamount,
|
|
||||||
sum( localcreditamount ) AS localcreditamount,
|
|
||||||
sum( debitamount ) AS debitamount,
|
|
||||||
sum( creditamount ) AS creditamount,
|
|
||||||
0 AS ljlocaldebitamount,
|
|
||||||
0 AS ljlocalcreditamount,
|
|
||||||
0 AS ljdebitamount,
|
|
||||||
0 AS ljcreditamount,
|
|
||||||
0 AS qmlocalamount,
|
|
||||||
0 AS qmamount
|
|
||||||
FROM
|
|
||||||
gl_balance dezz
|
|
||||||
WHERE
|
|
||||||
voucherkind != 5
|
|
||||||
AND voucherkind != 4
|
|
||||||
GROUP BY
|
|
||||||
dezz.YEAR,
|
|
||||||
dezz.ADJUSTPERIOD,
|
|
||||||
dezz.pk_org,
|
|
||||||
dezz.pk_accasoa,
|
|
||||||
dezz.pk_currtype,
|
|
||||||
dezz.assid UNION ALL
|
|
||||||
SELECT DISTINCT
|
|
||||||
accperiodmonth.periodyear YEAR,
|
|
||||||
accperiodmonth.PERIOD ADJUSTPERIOD,
|
|
||||||
dezz.pk_org,
|
|
||||||
dezz.pk_accasoa,
|
|
||||||
dezz.pk_currtype,
|
|
||||||
dezz.assid assid,
|
|
||||||
0 AS localdebitamount,
|
|
||||||
0 AS localcreditamount,
|
|
||||||
0 AS debitamount,
|
|
||||||
0 AS creditamount,
|
|
||||||
0 AS ljlocaldebitamount,
|
|
||||||
0 AS ljlocalcreditamount,
|
|
||||||
0 AS ljdebitamount,
|
|
||||||
0 AS ljcreditamount,
|
|
||||||
sum( localdebitamount ) - sum( localcreditamount ) AS qmlocalamount,
|
|
||||||
sum( debitamount ) - sum( creditamount ) AS qmamount
|
|
||||||
FROM
|
|
||||||
( SELECT substr( yearmth, 0, 4 ) periodyear, substr( yearmth, 6, 7 ) period FROM bd_accperiodmonth WHERE yearmth < TO_CHAR( SYSDATE, 'YYYY-MM' ) ) accperiodmonth
|
|
||||||
LEFT JOIN gl_balance dezz ON dezz.YEAR = accperiodmonth.periodyear
|
|
||||||
AND dezz.adjustperiod < = accperiodmonth.period
|
|
||||||
WHERE
|
|
||||||
voucherkind != 5
|
|
||||||
AND voucherkind != 4
|
|
||||||
AND dezz.adjustperiod >= '00'
|
|
||||||
AND dezz.adjustperiod != '12A'
|
|
||||||
GROUP BY
|
|
||||||
accperiodmonth.periodyear,
|
|
||||||
accperiodmonth.PERIOD,
|
|
||||||
dezz.pk_org,
|
|
||||||
dezz.pk_accasoa,
|
|
||||||
dezz.pk_currtype,
|
|
||||||
dezz.assid
|
|
||||||
) a
|
|
||||||
LEFT JOIN org_orgs org ON org.pk_org = a.pk_org
|
|
||||||
LEFT JOIN bd_accasoa oa ON oa.pk_accasoa = a.pk_accasoa
|
|
||||||
LEFT JOIN bd_account nt ON nt.pk_account = oa.pk_account
|
|
||||||
LEFT JOIN bd_currtype currtype ON a.pk_currtype = currtype.pk_currtype
|
|
||||||
LEFT JOIN gl_docfree1 fr1 ON fr1.assid = a.assid
|
|
||||||
where adjustperiod != '12A'
|
|
||||||
and adjustperiod >= '00'
|
|
||||||
and adjustperiod != '00'
|
|
||||||
GROUP BY
|
|
||||||
year,
|
|
||||||
adjustperiod,
|
|
||||||
nt.code ,
|
|
||||||
oa.name ,
|
|
||||||
oa.dispname,
|
|
||||||
nt.pid,
|
|
||||||
balanorient,
|
|
||||||
pk_acctype,
|
|
||||||
org.code,
|
|
||||||
org.name,
|
|
||||||
nt.sumprint_level
|
|
||||||
)m1
|
|
||||||
<trim prefix="where" prefixOverrides="and">
|
<trim prefix="where" prefixOverrides="and">
|
||||||
<if test="orgCode != null and orgCode !='' "> and gsbm = #{orgCode} </if>
|
<if test="orgCode != null and orgCode !='' "> and gsbm = #{orgCode} </if>
|
||||||
<if test="sysData != null and sysData !='' "> and yearperiod = {sysData} </if>
|
<if test="sysData != null and sysData !='' "> and yearperiod = #{sysData} </if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
//Integer size = 50;
|
//Integer size = 50;
|
||||||
|
|
||||||
boolean flags = false;
|
boolean flags = false;
|
||||||
String uploadBalanceTableUrl = "http://oapi.nanofintax.com/api/collect/uploadBalanceTable?accessToken";
|
String uploadBalanceTableUrl = "http://122.9.186.182:30887/open/api/uploadBalanceTable";
|
||||||
String cbUrl = "http://122.9.186.182:30887/open/api/uploadFinancialReport";
|
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 dataUrl = "https://workbench.test.htszny.com/oapi/invoice_rec/standing/book/queryList";//全量发票数据
|
||||||
String tokenUrl = "http://oapi.nanofintax.com/api/getToken";
|
String tokenUrl = "http://oapi.nanofintax.com/api/getToken";
|
||||||
|
@ -963,8 +963,8 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
Date date = null;
|
Date date = null;
|
||||||
String qncjzq = null;
|
String qncjzq = null;
|
||||||
IncomeInvoiceEntity dyAloneId = null;
|
IncomeInvoiceEntity dyAloneId = null;
|
||||||
JSONObject dydata = null;
|
JSONObject dydata = new JSONObject();
|
||||||
JSONObject qndata = null;
|
JSONObject qndata = new JSONObject();
|
||||||
IncomeInvoiceEntity qnAloneId = null;
|
IncomeInvoiceEntity qnAloneId = null;
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||||
|
@ -985,10 +985,11 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
jnentity.setSysData(cjzq);
|
jnentity.setSysData(cjzq);
|
||||||
jnentity.setOrgCode(ztbm);
|
jnentity.setOrgCode(ztbm);
|
||||||
List<IncomeInvoiceEntity> jnlist = incomeInvoiceDao.queryZtzz(jnentity);
|
List<IncomeInvoiceEntity> jnlist = incomeInvoiceDao.queryZtzz(jnentity);
|
||||||
|
//List<IncomeInvoiceEntity> jnlist = null;
|
||||||
if(jnlist != null && jnlist.size() == 1){
|
if(jnlist != null && jnlist.size() == 1){
|
||||||
dyAloneId = jnlist.get(0);
|
dyAloneId = jnlist.get(0);
|
||||||
}else {
|
}else {
|
||||||
return BaseResult.getSuccessMessageEntity("未查询到当月的财报数据,不推送");
|
//return BaseResult.getSuccessMessageEntity("未查询到当月的财报数据,不推送");
|
||||||
}
|
}
|
||||||
//查询去年当帐套组织
|
//查询去年当帐套组织
|
||||||
IncomeInvoiceEntity qnentity = new IncomeInvoiceEntity();
|
IncomeInvoiceEntity qnentity = new IncomeInvoiceEntity();
|
||||||
|
@ -996,6 +997,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
qnentity.setSysData(qncjzq);
|
qnentity.setSysData(qncjzq);
|
||||||
qnentity.setOrgCode(ztbm);
|
qnentity.setOrgCode(ztbm);
|
||||||
List<IncomeInvoiceEntity> qnlist = incomeInvoiceDao.queryZtzz(qnentity);
|
List<IncomeInvoiceEntity> qnlist = incomeInvoiceDao.queryZtzz(qnentity);
|
||||||
|
//List<IncomeInvoiceEntity> qnlist = null;
|
||||||
if(qnlist != null && qnlist.size() == 1){
|
if(qnlist != null && qnlist.size() == 1){
|
||||||
qnAloneId = qnlist.get(0);
|
qnAloneId = qnlist.get(0);
|
||||||
}else {
|
}else {
|
||||||
|
@ -1003,15 +1005,18 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询当月的财报数据
|
//查询当月的财报数据
|
||||||
IncomeInvoiceEntity jnquerydata = new IncomeInvoiceEntity();
|
if(dyAloneId != null){
|
||||||
jnquerydata.setDataSourceCode("htBip");
|
IncomeInvoiceEntity jnquerydata = new IncomeInvoiceEntity();
|
||||||
jnquerydata.setAloneId(dyAloneId.getAloneId());
|
jnquerydata.setDataSourceCode("htBip");
|
||||||
List<JSONObject> dydataList = incomeInvoiceDao.queryByAloneId(jnquerydata);
|
jnquerydata.setAloneId(dyAloneId.getAloneId());
|
||||||
if(dydataList != null && dydataList.size() == 1){
|
List<JSONObject> dydataList = incomeInvoiceDao.queryByAloneId(jnquerydata);
|
||||||
dydata = dydataList.get(0);
|
if(dydataList != null && dydataList.size() == 1){
|
||||||
}else {
|
dydata = dydataList.get(0);
|
||||||
return BaseResult.getSuccessMessageEntity("未查询到当月的财报数据,不推送");
|
}else {
|
||||||
|
//return BaseResult.getSuccessMessageEntity("未查询到当月的财报数据,不推送");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询去年当期的财报数据
|
//查询去年当期的财报数据
|
||||||
if(qnAloneId != null){
|
if(qnAloneId != null){
|
||||||
//查找去年数据
|
//查找去年数据
|
||||||
|
|
Loading…
Reference in New Issue