科目余额工序取数
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.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.bos.util.StringUtils;
|
||||
import zcgj.zcdev.zcdev.fs.utils.AccountRecord;
|
||||
import zcgj.zcdev.zcdev.fs.utils.BalanceQueryParamApi;
|
||||
|
||||
|
|
@ -20,6 +21,8 @@ import java.util.*;
|
|||
|
||||
public class SubjectbalanceAutoData {
|
||||
|
||||
private static final String[] asseestypeArrays = new String[]{"0032","0017",""};
|
||||
|
||||
public static void getData(){
|
||||
String[] selectorsArray = new String[]{"beginlocal", "endlocal", "yeardebitfor","yearcreditfor","debitlocal","creditlocal"};
|
||||
|
||||
|
|
@ -54,18 +57,6 @@ public class SubjectbalanceAutoData {
|
|||
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",
|
||||
"org,curperiod",
|
||||
|
|
@ -76,22 +67,6 @@ public class SubjectbalanceAutoData {
|
|||
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[]{});
|
||||
List<Object[]> sqlparams = new ArrayList<>();
|
||||
|
|
@ -100,6 +75,20 @@ public class SubjectbalanceAutoData {
|
|||
DB.executeBatch(DBRoute.of("fi"),
|
||||
"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()) {
|
||||
BalanceQueryParamApi balanceQueryParamApi = new BalanceQueryParamApi();
|
||||
balanceQueryParamApi.setSelectors(Arrays.asList(selectorsArray));
|
||||
|
|
@ -122,17 +111,21 @@ public class SubjectbalanceAutoData {
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
List<String> groupBy = new ArrayList<>();
|
||||
if(!StringUtils.isEmpty(asseestype)){
|
||||
Map<String, List<Map<String, String>>> accountAssgrp = new HashMap<>();
|
||||
List<Map<String, String>> li = new ArrayList<>();
|
||||
Map<String, String> map1 = new HashMap<>();
|
||||
map1.put("0032","");
|
||||
map1.put(asseestype,"");
|
||||
li.add(map1);
|
||||
for (String accNum : accountNumber) {
|
||||
accountAssgrp.put(accNum,li);
|
||||
}
|
||||
balanceQueryParamApi.setAccountAssgrp(accountAssgrp);
|
||||
List<String> groupBy = new ArrayList<>();
|
||||
groupBy.add("0032");
|
||||
|
||||
groupBy.add(asseestype);
|
||||
}
|
||||
groupBy.add("account");
|
||||
balanceQueryParamApi.setGroupBys(groupBy);
|
||||
Gson gson = new Gson();
|
||||
|
|
@ -165,9 +158,16 @@ public class SubjectbalanceAutoData {
|
|||
//assistbalance.set("zcgj_pm",projectMap.get(orgNumber));
|
||||
Map<String, AccountRecord.AssGrpItem> assgrp = record.getAssgrp();
|
||||
if (assgrp.containsKey("0032")) {
|
||||
if(assgrp.get("0032")!=null){
|
||||
assistbalance.set("zcgj_processnumber",assgrp.get("0032").getNumber());
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -183,3 +183,4 @@ public class SubjectbalanceAutoData {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue