科目余额工序取数表,取数公司通过配置表获取
This commit is contained in:
parent
72e5464e3d
commit
696a84f1b9
|
|
@ -27,14 +27,14 @@ public class SubjectbalanceAutoData {
|
|||
|
||||
private static final String[] asseestypeArrays = new String[]{"0032","0017",""};
|
||||
|
||||
public static void getData() {
|
||||
public static void getData(Long periodId,boolean isAuto) {
|
||||
String[] selectorsArray = new String[]{"beginlocal", "endlocal", "yeardebitfor", "yearcreditfor", "debitlocal", "creditlocal"};
|
||||
|
||||
QFilter filteraccountTable = new QFilter("number", QCP.equals, "0003");
|
||||
DynamicObject accountTableLoad = BusinessDataServiceHelper.loadSingle("bd_accounttable", "id", new QFilter[]{filteraccountTable});
|
||||
|
||||
// 查询核算组织
|
||||
QFilter number = new QFilter("fisaccounting", "=", "1");
|
||||
/*QFilter number = new QFilter("fisaccounting", "=", "1");
|
||||
QFilter structure = new QFilter("structure.longnumber", QCP.like, "10000000!10006431%");
|
||||
QFilter isleaf = new QFilter("structure.isleaf", QCP.equals, true);
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("bos_org", "id,structure.longnumber,structure.view", new QFilter[]{number, structure, isleaf});
|
||||
|
|
@ -59,6 +59,22 @@ public class SubjectbalanceAutoData {
|
|||
orgNumberMap.put(dynamicObject.getString("number"), dynamicObject);
|
||||
orgIds.add(dynamicObject.getLong("id"));
|
||||
}
|
||||
}*/
|
||||
|
||||
//通过配置表取公司
|
||||
Map<String, DynamicObject> orgNumberMap = new HashMap<>();
|
||||
List<Long> orgIds = new ArrayList<>();
|
||||
DynamicObject[] companybelongs = BusinessDataServiceHelper.load("zcgj_companybelong", "id,zcgj_companyblentry.zcgj_org", new QFilter[]{});
|
||||
for (DynamicObject companybelong : companybelongs) {
|
||||
DynamicObjectCollection companyblentryCollection = companybelong.getDynamicObjectCollection("zcgj_companyblentry");
|
||||
for (DynamicObject dynamicObject : companyblentryCollection) {
|
||||
DynamicObject zcgjOrg = dynamicObject.getDynamicObject("zcgj_org");
|
||||
if(zcgjOrg!=null){
|
||||
long id = zcgjOrg.getLong("id");
|
||||
orgIds.add(id);
|
||||
orgNumberMap.put(zcgjOrg.getString("number"), zcgjOrg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询组织下对应的当前期间数据
|
||||
|
|
@ -72,11 +88,14 @@ public class SubjectbalanceAutoData {
|
|||
}
|
||||
|
||||
// 标记旧数据为非最新
|
||||
List<Object[]> sqlparams = new ArrayList<>();
|
||||
Object[] sqlparam = new Object[]{false};
|
||||
sqlparams.add(sqlparam);
|
||||
DB.executeBatch(DBRoute.of("fi"),
|
||||
"update tk_zcgj_rpt_assistbalangx set fk_zcgj_isnew = ? ", sqlparams);
|
||||
if(isAuto) { //使用自动执行时标记旧数据
|
||||
List<Object[]> sqlparams = new ArrayList<>();
|
||||
Object[] sqlparam = new Object[]{false};
|
||||
sqlparams.add(sqlparam);
|
||||
DB.executeBatch(DBRoute.of("fi"),
|
||||
"update tk_zcgj_rpt_assistbalangx set fk_zcgj_isnew = ? ", sqlparams);
|
||||
}
|
||||
|
||||
|
||||
for (String asseestype : asseestypeArrays) {
|
||||
// 查询科目余额配置表
|
||||
|
|
@ -102,17 +121,25 @@ public class SubjectbalanceAutoData {
|
|||
DynamicObject orgObj = orgNumberMap.get(orgNumber);
|
||||
DynamicObject periodObj = orgByCurperiodMap.get(orgObj.getLong("id"));
|
||||
DynamicObject curperiod = null;
|
||||
if (periodObj != null) {
|
||||
curperiod = periodObj.getDynamicObject("curperiod");
|
||||
if (curperiod != null) {
|
||||
balanceQueryParamApi.setPeriodNumber(curperiod.getString("number")); //
|
||||
if(periodId==null){
|
||||
if (periodObj != null) {
|
||||
curperiod = periodObj.getDynamicObject("curperiod");
|
||||
if (curperiod != null) {
|
||||
balanceQueryParamApi.setPeriodNumber(curperiod.getString("number")); //
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}else{
|
||||
QFilter idFilter = new QFilter("id", QCP.equals, periodId);
|
||||
curperiod = BusinessDataServiceHelper.loadSingle("bd_period", "id,number", new QFilter[]{idFilter});
|
||||
String periodNumber = curperiod.getString("number");
|
||||
balanceQueryParamApi.setPeriodNumber(periodNumber); //
|
||||
}
|
||||
|
||||
|
||||
List<String> groupBy = new ArrayList<>();
|
||||
if (!StringUtils.isEmpty(asseestype)) {
|
||||
Map<String, List<Map<String, String>>> accountAssgrp = new HashMap<>();
|
||||
|
|
@ -161,7 +188,7 @@ public class SubjectbalanceAutoData {
|
|||
assistbalance.set("zcgj_accounttable", accountTableLoad);
|
||||
assistbalance.set("zcgj_account", record.getAccount());
|
||||
assistbalance.set("zcgj_period", curperiod);
|
||||
assistbalance.set("zcgj_isnew", true);
|
||||
assistbalance.set("zcgj_isnew", isAuto);
|
||||
assistbalance.set("zcgj_sourcetype", asseestype);
|
||||
|
||||
Map<String, AccountRecord.AssGrpItem> assgrp = record.getAssgrp();
|
||||
|
|
@ -186,9 +213,9 @@ public class SubjectbalanceAutoData {
|
|||
try {
|
||||
// ✅ 删除旧数据(保证每个组织、每个期间只保留一份最新的)
|
||||
Long orgId = orgObj.getLong("id");
|
||||
Long periodId = curperiod.getLong("id");
|
||||
Long periodIddelete = curperiod.getLong("id");
|
||||
QFilter orgFilter = new QFilter("zcgj_org", QCP.equals, orgId);
|
||||
QFilter periodFilter = new QFilter("zcgj_period", QCP.equals, periodId);
|
||||
QFilter periodFilter = new QFilter("zcgj_period", QCP.equals, periodIddelete);
|
||||
QFilter sourcetypeFilter = new QFilter("zcgj_sourcetype", QCP.equals, asseestype);
|
||||
QFilter isnewFilter = new QFilter("zcgj_isnew", QCP.equals, false);
|
||||
DeleteServiceHelper.delete("zcgj_rpt_assistbalancegx", new QFilter[]{orgFilter.and(periodFilter).and(sourcetypeFilter).and(isnewFilter)});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,19 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||
|
||||
import kd.bos.entity.filter.ControlFilters;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.list.IListView;
|
||||
import kd.bos.list.plugin.AbstractListPlugin;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import zcgj.zcdev.zcdev.fs.plugin.common.AssetsLiabilitiesbalanceAutoData;
|
||||
import zcgj.zcdev.zcdev.fs.plugin.common.SubjectbalanceAutoData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 核算维度余额取数表(矿山二开)
|
||||
*/
|
||||
|
|
@ -20,7 +27,26 @@ public class SubjectbalancePlugin extends AbstractListPlugin implements Plugin
|
|||
String itemKey = evt.getItemKey();
|
||||
if("zcgj_gatdata".equals(itemKey)) {
|
||||
//科目余额表自动取数
|
||||
SubjectbalanceAutoData.getData();//其他
|
||||
SubjectbalanceAutoData.getData(null,true);//其他
|
||||
}else if("zcgj_gatdataperiod".equals(itemKey)) {
|
||||
//获取列表查询参数
|
||||
ControlFilters filters = ((IListView)this.getView()).getControlFilters();
|
||||
List<Object> filter = filters.getFilter("zcgj_period.id");
|
||||
if(filter.isEmpty()) {
|
||||
this.getView().showMessage("请选择期间!");
|
||||
}else{
|
||||
for (Object periodId : filter) {
|
||||
if(periodId instanceof String) {
|
||||
SubjectbalanceAutoData.getData(Long.valueOf((String)periodId),false);//其他
|
||||
}
|
||||
}
|
||||
//重新执行一下拉取最新的数据,解决历史数据最新勾选问题
|
||||
//AssetsLiabilitiesbalanceAutoData.getData(null);//其他
|
||||
}
|
||||
|
||||
}else if("zcgj_deleteall".equals(itemKey)) {
|
||||
int zcgjRptAssistbalanZcfz = DeleteServiceHelper.delete("zcgj_rpt_assistbalancegx", new QFilter[]{});
|
||||
this.getView().showMessage("操作完成!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue