科目余额工序取数
This commit is contained in:
parent
93ce7a6da4
commit
a4dc2091a3
|
|
@ -12,6 +12,7 @@ import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.bos.util.StringUtils;
|
||||||
import zcgj.zcdev.zcdev.fs.utils.AccountRecord;
|
import zcgj.zcdev.zcdev.fs.utils.AccountRecord;
|
||||||
import zcgj.zcdev.zcdev.fs.utils.BalanceQueryParamApi;
|
import zcgj.zcdev.zcdev.fs.utils.BalanceQueryParamApi;
|
||||||
|
|
||||||
|
|
@ -20,6 +21,8 @@ import java.util.*;
|
||||||
|
|
||||||
public class SubjectbalanceAutoData {
|
public class SubjectbalanceAutoData {
|
||||||
|
|
||||||
|
private static final String[] asseestypeArrays = new String[]{"0032","0017",""};
|
||||||
|
|
||||||
public static void getData(){
|
public static void getData(){
|
||||||
String[] selectorsArray = new String[]{"beginlocal", "endlocal", "yeardebitfor","yearcreditfor","debitlocal","creditlocal"};
|
String[] selectorsArray = new String[]{"beginlocal", "endlocal", "yeardebitfor","yearcreditfor","debitlocal","creditlocal"};
|
||||||
|
|
||||||
|
|
@ -54,18 +57,6 @@ public class SubjectbalanceAutoData {
|
||||||
orgIds.add(dynamicObject.getLong("id"));
|
orgIds.add(dynamicObject.getLong("id"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询科目余额配置表
|
|
||||||
DynamicObject[] accountConf = BusinessDataServiceHelper.load("zcgj_conf_balanceaccoungx", "zcgj_entryentity.zcgj_account", new QFilter[]{});
|
|
||||||
Set<String> accountNumber = new HashSet<>();
|
|
||||||
for (DynamicObject dynamicObject : accountConf) {
|
|
||||||
DynamicObjectCollection zcgjEntryentity = dynamicObject.getDynamicObjectCollection("zcgj_entryentity");
|
|
||||||
for (DynamicObject object : zcgjEntryentity) {
|
|
||||||
accountNumber.add(object.getDynamicObject("zcgj_account").getString("number"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//查询组织下对应的当前期间数据
|
//查询组织下对应的当前期间数据
|
||||||
DynamicObject[] orgByCurperiod = BusinessDataServiceHelper.load("gl_accountbook",
|
DynamicObject[] orgByCurperiod = BusinessDataServiceHelper.load("gl_accountbook",
|
||||||
"org,curperiod",
|
"org,curperiod",
|
||||||
|
|
@ -76,22 +67,6 @@ public class SubjectbalanceAutoData {
|
||||||
orgByCurperiodMap.put(dynamicObject.getLong("org.id"), dynamicObject);
|
orgByCurperiodMap.put(dynamicObject.getLong("org.id"), dynamicObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取核算组织的项目
|
|
||||||
/*Map<String,DynamicObject> projectMap = new HashMap<>();
|
|
||||||
//ec_project
|
|
||||||
DynamicObject[] projects = BusinessDataServiceHelper.load("ec_project",
|
|
||||||
"fiaccountorg,zcgj_pm",
|
|
||||||
new QFilter[]{new QFilter("billstatus", QCP.equals, "C").
|
|
||||||
and("fiaccountorg", QCP.in, orgIds)});
|
|
||||||
for (DynamicObject project : projects) {
|
|
||||||
DynamicObject fiaccountorg = project.getDynamicObject("fiaccountorg");
|
|
||||||
DynamicObject pm = project.getDynamicObject("zcgj_pm");
|
|
||||||
if(fiaccountorg!=null){
|
|
||||||
projectMap.put(fiaccountorg.getString("number"), pm);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
//清除数据
|
//清除数据
|
||||||
//DeleteServiceHelper.delete("zcgj_rpt_assistbalance",new QFilter[]{});
|
//DeleteServiceHelper.delete("zcgj_rpt_assistbalance",new QFilter[]{});
|
||||||
List<Object[]> sqlparams = new ArrayList<>();
|
List<Object[]> sqlparams = new ArrayList<>();
|
||||||
|
|
@ -100,6 +75,20 @@ public class SubjectbalanceAutoData {
|
||||||
DB.executeBatch(DBRoute.of("fi"),
|
DB.executeBatch(DBRoute.of("fi"),
|
||||||
"update tk_zcgj_rpt_assistbalangx set fk_zcgj_isnew = ? ", sqlparams);
|
"update tk_zcgj_rpt_assistbalangx set fk_zcgj_isnew = ? ", sqlparams);
|
||||||
|
|
||||||
|
for (String asseestype : asseestypeArrays) {
|
||||||
|
//查询科目余额配置表
|
||||||
|
DynamicObject[] accountConf = BusinessDataServiceHelper.load("zcgj_conf_balanceaccoungx", "zcgj_entryentity.zcgj_account,zcgj_entryentity.zcgj_asseestype", new QFilter[]{});
|
||||||
|
Set<String> accountNumber = new HashSet<>();
|
||||||
|
for (DynamicObject dynamicObject : accountConf) {
|
||||||
|
DynamicObjectCollection zcgjEntryentity = dynamicObject.getDynamicObjectCollection("zcgj_entryentity");
|
||||||
|
for (DynamicObject object : zcgjEntryentity) {
|
||||||
|
String zcgjAsseestype = object.getString("zcgj_asseestype");
|
||||||
|
if(asseestype.equals(zcgjAsseestype)){
|
||||||
|
accountNumber.add(object.getDynamicObject("zcgj_account").getString("number"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (String orgNumber : orgNumberMap.keySet()) {
|
for (String orgNumber : orgNumberMap.keySet()) {
|
||||||
BalanceQueryParamApi balanceQueryParamApi = new BalanceQueryParamApi();
|
BalanceQueryParamApi balanceQueryParamApi = new BalanceQueryParamApi();
|
||||||
balanceQueryParamApi.setSelectors(Arrays.asList(selectorsArray));
|
balanceQueryParamApi.setSelectors(Arrays.asList(selectorsArray));
|
||||||
|
|
@ -122,17 +111,21 @@ public class SubjectbalanceAutoData {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<String> groupBy = new ArrayList<>();
|
||||||
|
if(!StringUtils.isEmpty(asseestype)){
|
||||||
Map<String, List<Map<String, String>>> accountAssgrp = new HashMap<>();
|
Map<String, List<Map<String, String>>> accountAssgrp = new HashMap<>();
|
||||||
List<Map<String, String>> li = new ArrayList<>();
|
List<Map<String, String>> li = new ArrayList<>();
|
||||||
Map<String, String> map1 = new HashMap<>();
|
Map<String, String> map1 = new HashMap<>();
|
||||||
map1.put("0032","");
|
map1.put(asseestype,"");
|
||||||
li.add(map1);
|
li.add(map1);
|
||||||
for (String accNum : accountNumber) {
|
for (String accNum : accountNumber) {
|
||||||
accountAssgrp.put(accNum,li);
|
accountAssgrp.put(accNum,li);
|
||||||
}
|
}
|
||||||
balanceQueryParamApi.setAccountAssgrp(accountAssgrp);
|
balanceQueryParamApi.setAccountAssgrp(accountAssgrp);
|
||||||
List<String> groupBy = new ArrayList<>();
|
|
||||||
groupBy.add("0032");
|
groupBy.add(asseestype);
|
||||||
|
}
|
||||||
groupBy.add("account");
|
groupBy.add("account");
|
||||||
balanceQueryParamApi.setGroupBys(groupBy);
|
balanceQueryParamApi.setGroupBys(groupBy);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|
@ -165,9 +158,16 @@ public class SubjectbalanceAutoData {
|
||||||
//assistbalance.set("zcgj_pm",projectMap.get(orgNumber));
|
//assistbalance.set("zcgj_pm",projectMap.get(orgNumber));
|
||||||
Map<String, AccountRecord.AssGrpItem> assgrp = record.getAssgrp();
|
Map<String, AccountRecord.AssGrpItem> assgrp = record.getAssgrp();
|
||||||
if (assgrp.containsKey("0032")) {
|
if (assgrp.containsKey("0032")) {
|
||||||
|
if(assgrp.get("0032")!=null){
|
||||||
assistbalance.set("zcgj_processnumber",assgrp.get("0032").getNumber());
|
assistbalance.set("zcgj_processnumber",assgrp.get("0032").getNumber());
|
||||||
assistbalance.set("zcgj_processname",assgrp.get("0032").getName());
|
assistbalance.set("zcgj_processname",assgrp.get("0032").getName());
|
||||||
}
|
}
|
||||||
|
}else if(assgrp.containsKey("0017")){
|
||||||
|
if(assgrp.get("0017")!=null){
|
||||||
|
assistbalance.set("zcgj_costcompanynumber",assgrp.get("0017").getNumber());
|
||||||
|
assistbalance.set("zcgj_costcompanyname",assgrp.get("0017").getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
addEntities.add(assistbalance);
|
addEntities.add(assistbalance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,3 +183,4 @@ public class SubjectbalanceAutoData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue