科目余额取数表 - 资产负债获取公司通过配置表获取
This commit is contained in:
parent
57e06cfb4d
commit
115a00af42
|
|
@ -27,14 +27,14 @@ public class AssetsLiabilitiesbalanceAutoData {
|
|||
|
||||
private static final String[] asseestypeArrays = new String[]{"0001","0005","0003"};
|
||||
|
||||
public static void getData(Long periodId) {
|
||||
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,7 +59,24 @@ public class AssetsLiabilitiesbalanceAutoData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 查询组织下对应的当前期间数据
|
||||
DynamicObject[] orgByCurperiod = BusinessDataServiceHelper.load("gl_accountbook",
|
||||
|
|
@ -72,11 +89,13 @@ public class AssetsLiabilitiesbalanceAutoData {
|
|||
}
|
||||
|
||||
// 标记旧数据为非最新
|
||||
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);
|
||||
"update tk_zcgj_rpt_assistbalzcfz set fk_zcgj_isnew = ? ", sqlparams);
|
||||
}
|
||||
|
||||
for (String asseestype : asseestypeArrays) {
|
||||
// 查询科目余额配置表
|
||||
|
|
@ -168,7 +187,7 @@ public class AssetsLiabilitiesbalanceAutoData {
|
|||
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();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.filter.ControlFilters;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.list.IListView;
|
||||
|
|
@ -7,10 +8,16 @@ import kd.bos.list.ListShowParameter;
|
|||
import kd.bos.list.plugin.AbstractListPlugin;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
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.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +32,22 @@ public class AssetsLiabilitiesbalancePlugin extends AbstractListPlugin implement
|
|||
String itemKey = evt.getItemKey();
|
||||
if("zcgj_gatdata".equals(itemKey)) {
|
||||
//科目余额表自动取数
|
||||
AssetsLiabilitiesbalanceAutoData.getData(null);//其他
|
||||
//获取当前自然月作为最新期间
|
||||
// 获取当前日期
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
// 定义格式器
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
||||
// 格式化为字符串
|
||||
String currentMonth = currentDate.format(formatter);
|
||||
|
||||
QFilter idFilter = new QFilter("number", QCP.equals, currentMonth);
|
||||
DynamicObject curperiod = BusinessDataServiceHelper.loadSingle("bd_period", "id,number", new QFilter[]{idFilter});
|
||||
if(curperiod!=null){
|
||||
AssetsLiabilitiesbalanceAutoData.getData(curperiod.getLong("id"),true);//其他
|
||||
}else{
|
||||
this.getView().showMessage("获取当前期间有误!");
|
||||
}
|
||||
|
||||
}else if("zcgj_gatdataperiod".equals(itemKey)) {
|
||||
//获取列表查询参数
|
||||
ControlFilters filters = ((IListView)this.getView()).getControlFilters();
|
||||
|
|
@ -35,13 +57,16 @@ public class AssetsLiabilitiesbalancePlugin extends AbstractListPlugin implement
|
|||
}else{
|
||||
for (Object periodId : filter) {
|
||||
if(periodId instanceof String) {
|
||||
AssetsLiabilitiesbalanceAutoData.getData(Long.valueOf((String)periodId));//其他
|
||||
AssetsLiabilitiesbalanceAutoData.getData(Long.valueOf((String)periodId),false);//其他
|
||||
}
|
||||
}
|
||||
//重新执行一下拉取最新的数据,解决历史数据最新勾选问题
|
||||
AssetsLiabilitiesbalanceAutoData.getData(null);//其他
|
||||
//AssetsLiabilitiesbalanceAutoData.getData(null);//其他
|
||||
}
|
||||
|
||||
}else if("zcgj_deleteall".equals(itemKey)) {
|
||||
int zcgjRptAssistbalanZcfz = DeleteServiceHelper.delete("zcgj_rpt_assistbalan_zcfz", new QFilter[]{});
|
||||
this.getView().showMessage("操作完成!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue