Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
03e947fb72
|
|
@ -0,0 +1,199 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.common;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.db.DB;
|
||||||
|
import kd.bos.db.DBRoute;
|
||||||
|
import kd.bos.openapi.common.result.OpenApiResult;
|
||||||
|
import kd.bos.openapi.common.util.OpenApiSdkUtil;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import zcgj.zcdev.zcdev.fs.utils.AccountRecord;
|
||||||
|
import zcgj.zcdev.zcdev.fs.utils.BalanceQueryParamApi;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class SuppliertbalanceAutoData {
|
||||||
|
|
||||||
|
public static void getData(String type){
|
||||||
|
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 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});
|
||||||
|
List<Long> orgIds = new ArrayList<>();
|
||||||
|
Map<String,DynamicObject> orgNumberMap = new HashMap<>();
|
||||||
|
for (int i = 0; i < load.length; i++) {
|
||||||
|
DynamicObject dynamicObject = load[i];
|
||||||
|
orgNumberMap.put(dynamicObject.getString("number"), dynamicObject);
|
||||||
|
orgIds.add(dynamicObject.getLong("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject[] costcompany = BusinessDataServiceHelper.load("zcgj_minecompany", "zcgj_costcompany", new QFilter[]{});
|
||||||
|
if(costcompany != null){
|
||||||
|
List<Long> ids = new ArrayList<>();
|
||||||
|
for (DynamicObject dynamicObject : costcompany) {
|
||||||
|
DynamicObject minecompany = dynamicObject.getDynamicObject("zcgj_costcompany");
|
||||||
|
long id = minecompany.getLong("id");
|
||||||
|
ids.add(id);
|
||||||
|
}
|
||||||
|
QFilter idFilter = new QFilter("id", QCP.in, ids);
|
||||||
|
DynamicObject[] org = BusinessDataServiceHelper.load("bos_org", "id,structure.longnumber,structure.view", new QFilter[]{idFilter});
|
||||||
|
for (DynamicObject dynamicObject : org) {
|
||||||
|
orgNumberMap.put(dynamicObject.getString("number"), dynamicObject);
|
||||||
|
orgIds.add(dynamicObject.getLong("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QFilter filtertype = new QFilter("zcgj_type", QCP.equals, type);
|
||||||
|
//查询科目余额配置表
|
||||||
|
DynamicObject[] accountConf = BusinessDataServiceHelper.load("zcgj_conf_balanceaccougys", "zcgj_entryentity.zcgj_account", new QFilter[]{filtertype});
|
||||||
|
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",
|
||||||
|
new QFilter[]{new QFilter("enable", QCP.equals, Boolean.TRUE).
|
||||||
|
and("status", QCP.equals, "C").and("org.id", QCP.in, orgIds)});
|
||||||
|
Map<Long, DynamicObject> orgByCurperiodMap = new HashMap<>();
|
||||||
|
for (DynamicObject dynamicObject : orgByCurperiod) {
|
||||||
|
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<>();
|
||||||
|
Object[] sqlparam = new Object[] { false };
|
||||||
|
sqlparams.add(sqlparam);
|
||||||
|
if("YUFZK".equals(type)){//预付账款
|
||||||
|
DB.executeBatch(DBRoute.of("fi"),
|
||||||
|
"update tk_zcgj_rpt_assbalgysyu set fk_zcgj_isnew = ? ", sqlparams);
|
||||||
|
}else if("YIFZK".equals(type)){//应付账款
|
||||||
|
DB.executeBatch(DBRoute.of("fi"),
|
||||||
|
"update tk_zcgj_rpt_assbalgysyi set fk_zcgj_isnew = ? ", sqlparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (String orgNumber : orgNumberMap.keySet()) {
|
||||||
|
BalanceQueryParamApi balanceQueryParamApi = new BalanceQueryParamApi();
|
||||||
|
balanceQueryParamApi.setSelectors(Arrays.asList(selectorsArray));
|
||||||
|
// balanceQueryParamApi.setOrgNumber("cw000102");
|
||||||
|
balanceQueryParamApi.setOrgNumber(orgNumber);
|
||||||
|
balanceQueryParamApi.setBookTypeNumber("100002"); //账簿类型
|
||||||
|
balanceQueryParamApi.setAccountTableNumber("0003");//科目表
|
||||||
|
|
||||||
|
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")); //
|
||||||
|
}else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, List<Map<String, String>>> accountAssgrp = new HashMap<>();
|
||||||
|
List<Map<String, String>> li = new ArrayList<>();
|
||||||
|
Map<String, String> map1 = new HashMap<>();
|
||||||
|
map1.put("0005","");
|
||||||
|
li.add(map1);
|
||||||
|
for (String accNum : accountNumber) {
|
||||||
|
accountAssgrp.put(accNum,li);
|
||||||
|
}
|
||||||
|
balanceQueryParamApi.setAccountAssgrp(accountAssgrp);
|
||||||
|
List<String> groupBy = new ArrayList<>();
|
||||||
|
groupBy.add("0005");
|
||||||
|
groupBy.add("account");
|
||||||
|
balanceQueryParamApi.setGroupBys(groupBy);
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String json = gson.toJson(balanceQueryParamApi);
|
||||||
|
Map<String, Object> params = gson.fromJson(json,
|
||||||
|
new TypeToken<Map<String, Object>>(){}.getType());
|
||||||
|
|
||||||
|
OpenApiResult balanceData = OpenApiSdkUtil.invoke("/v2/gl/getBalanceApi", params);
|
||||||
|
|
||||||
|
List<DynamicObject> addEntities = new ArrayList<>();
|
||||||
|
if(balanceData.isStatus()){
|
||||||
|
String data = (String) balanceData.getData();
|
||||||
|
Type listType = new TypeToken<List<AccountRecord>>() {}.getType();
|
||||||
|
List<AccountRecord> records = gson.fromJson(data, listType);
|
||||||
|
// 示例输出
|
||||||
|
for (AccountRecord record : records) {
|
||||||
|
String entityName = "";
|
||||||
|
if("YUFZK".equals(type)){//预付账款
|
||||||
|
entityName="zcgj_rpt_assibalancegysyu";
|
||||||
|
}else if("YIFZK".equals(type)){//应付账款
|
||||||
|
entityName="zcgj_rpt_assibalancegysyi";
|
||||||
|
}
|
||||||
|
DynamicObject assistbalance
|
||||||
|
=BusinessDataServiceHelper.newDynamicObject(entityName);
|
||||||
|
assistbalance.set("zcgj_debitlocal", record.getDebitlocal());
|
||||||
|
assistbalance.set("zcgj_beginlocal", record.getBeginlocal());
|
||||||
|
assistbalance.set("zcgj_creditlocal", record.getCreditlocal());
|
||||||
|
assistbalance.set("zcgj_yeardebitfor", record.getYeardebitfor());
|
||||||
|
assistbalance.set("zcgj_yearcreditfor", record.getYearcreditfor());
|
||||||
|
assistbalance.set("zcgj_endlocal", record.getEndlocal());
|
||||||
|
assistbalance.set("zcgj_org",orgNumberMap.get(orgNumber));
|
||||||
|
assistbalance.set("zcgj_accounttable",accountTableLoad);
|
||||||
|
assistbalance.set("zcgj_account", record.getAccount());
|
||||||
|
assistbalance.set("zcgj_period",curperiod);
|
||||||
|
assistbalance.set("zcgj_isnew",true);
|
||||||
|
//assistbalance.set("zcgj_pm",projectMap.get(orgNumber));
|
||||||
|
Map<String, AccountRecord.AssGrpItem> assgrp = record.getAssgrp();
|
||||||
|
if (assgrp.containsKey("0005")) {
|
||||||
|
assistbalance.set("zcgj_suppliernumber",assgrp.get("0005").getNumber());
|
||||||
|
assistbalance.set("zcgj_suppliername",assgrp.get("0005").getName());
|
||||||
|
}
|
||||||
|
addEntities.add(assistbalance);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!addEntities.isEmpty()) {
|
||||||
|
try {
|
||||||
|
SaveServiceHelper.save(addEntities.toArray(new DynamicObject[0]));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.bill.BillShowParameter;
|
||||||
|
import kd.bos.context.RequestContext;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.operate.Submit;
|
||||||
|
import kd.bos.form.ShowType;
|
||||||
|
import kd.bos.form.control.EntryGrid;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.events.HyperLinkClickEvent;
|
||||||
|
import kd.bos.form.events.HyperLinkClickListener;
|
||||||
|
import kd.bos.form.field.BasedataEdit;
|
||||||
|
import kd.bos.form.field.RefBillEdit;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预付单关联申请插件
|
||||||
|
*/
|
||||||
|
public class PrepaybillWriteoffapplyPlugin extends AbstractBillPlugIn implements Plugin, HyperLinkClickListener {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(PrepaybillWriteoffapplyPlugin.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
EntryGrid control = this.getControl("zcgj_writeoffapply");
|
||||||
|
control.addHyperClickListener(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) {
|
||||||
|
String fieldName = hyperLinkClickEvent.getFieldName();
|
||||||
|
EntryGrid entryGrid = getView().getControl("zcgj_writeoffapply");
|
||||||
|
int[] selectRows = entryGrid.getSelectRows();
|
||||||
|
if(selectRows != null && selectRows.length == 1){
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_writeoffapply");
|
||||||
|
DynamicObject dynamicObject = dynamicObjectCollection.get(selectRows[0]);
|
||||||
|
String zcgjApplybillno = dynamicObject.getString("zcgj_applybillno");
|
||||||
|
long sourceapplybillid = dynamicObject.getLong("zcgj_sourceapplybillid");
|
||||||
|
if(sourceapplybillid != 0){
|
||||||
|
//弹出发票详情
|
||||||
|
BillShowParameter showParameter = new BillShowParameter();
|
||||||
|
showParameter.setPkId(sourceapplybillid);
|
||||||
|
showParameter.setFormId("er_dailyapplybill");
|
||||||
|
showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); //打开方式
|
||||||
|
getView().showForm(showParameter);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getView().showTipNotification("请选择一条关联申请数据。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import zcgj.zcdev.zcdev.fs.plugin.common.SubjectbalanceAutoData;
|
||||||
|
import zcgj.zcdev.zcdev.fs.plugin.common.SuppliertbalanceAutoData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核算维度余额取数表(矿山二开)-应收账款
|
||||||
|
*/
|
||||||
|
public class SupplieryibalancePlugin extends AbstractListPlugin implements Plugin {
|
||||||
|
private static final Log log = LogFactory.getLog(SupplieryibalancePlugin.class);
|
||||||
|
|
||||||
|
public static String ksNumberTop = "10006431"; //矿山总部组织编码
|
||||||
|
@Override
|
||||||
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
super.itemClick(evt);
|
||||||
|
String itemKey = evt.getItemKey();
|
||||||
|
if("zcgj_gatdata".equals(itemKey)) {
|
||||||
|
//科目余额表自动取数
|
||||||
|
SuppliertbalanceAutoData.getData("YIFZK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import zcgj.zcdev.zcdev.fs.plugin.common.SubjectbalanceAutoData;
|
||||||
|
import zcgj.zcdev.zcdev.fs.plugin.common.SuppliertbalanceAutoData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核算维度余额取数表(矿山二开)-预付账款
|
||||||
|
*/
|
||||||
|
public class SupplieryubalancePlugin extends AbstractListPlugin implements Plugin {
|
||||||
|
private static final Log log = LogFactory.getLog(SupplieryubalancePlugin.class);
|
||||||
|
|
||||||
|
public static String ksNumberTop = "10006431"; //矿山总部组织编码
|
||||||
|
@Override
|
||||||
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
super.itemClick(evt);
|
||||||
|
String itemKey = evt.getItemKey();
|
||||||
|
if("zcgj_gatdata".equals(itemKey)) {
|
||||||
|
//科目余额表自动取数
|
||||||
|
SuppliertbalanceAutoData.getData("YUFZK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -65,7 +65,8 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
||||||
if(costcompanyObj!=null && costdeptObj != null){
|
if(costcompanyObj!=null && costdeptObj != null){
|
||||||
DynamicObject costcompany = (DynamicObject)costcompanyObj;
|
DynamicObject costcompany = (DynamicObject)costcompanyObj;
|
||||||
long costcompanyId = costcompany.getLong("id");
|
long costcompanyId = costcompany.getLong("id");
|
||||||
if(OrgCheckUtils.isKS(costcompanyId)){
|
String number = costcompany.getString("number");
|
||||||
|
if(OrgCheckUtils.isKS(costcompanyId) && !number.equals("10006476")){
|
||||||
List<String> errorList = new ArrayList<>();
|
List<String> errorList = new ArrayList<>();
|
||||||
//行程明细,会有多个明细
|
//行程明细,会有多个明细
|
||||||
DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("tripentry");
|
DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("tripentry");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.other;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.utils.OrmUtils;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
|
||||||
|
import kd.bos.entity.botp.plugin.args.AfterBuildDrawFilterEventArgs;
|
||||||
|
import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs;
|
||||||
|
import kd.bos.entity.botp.plugin.args.BeforeBuildRowConditionEventArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预付单上拉费用申请单botp插件
|
||||||
|
*/
|
||||||
|
public class PrepaybillWriteoffapplyBotpPlugin extends AbstractConvertPlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterBuildDrawFilter(AfterBuildDrawFilterEventArgs e) {
|
||||||
|
//选单过滤
|
||||||
|
super.afterBuildDrawFilter(e);
|
||||||
|
System.out.println("afterBuildDrawFilter——>");
|
||||||
|
QFilter plugFilter = e.getPlugFilter();//插件追加的选单条件
|
||||||
|
String sourceLayout = e.getSourceLayout();//获取插件设置的选单时打开的源单列表布局
|
||||||
|
DynamicObject targetDataEntity = e.getTargetDataEntity();//当前数据包
|
||||||
|
DynamicObjectCollection writeoffapplyCollection = targetDataEntity.getDynamicObjectCollection("zcgj_writeoffapply");
|
||||||
|
List<Long> ids = new ArrayList<>();
|
||||||
|
for (DynamicObject dynamicObject : writeoffapplyCollection) {
|
||||||
|
long aLong = dynamicObject.getLong("zcgj_sourceapplybillid");
|
||||||
|
ids.add(aLong);
|
||||||
|
}
|
||||||
|
QFilter filter = new QFilter("id", QCP.not_in, ids);
|
||||||
|
e.setPlugFilter(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue