提交人:陈绍鑫

日期:2025/11/06 12:30
内容:备案申请选择
This commit is contained in:
陈绍鑫 2025-11-06 17:51:58 +08:00
parent daf6b20b88
commit 07f9f6a7c7
2 changed files with 48 additions and 30 deletions

View File

@ -1,5 +1,6 @@
package shkd.sys.sys.plugin.form;
import com.nbcb.sdk.aes.service.BussinessAdapterService;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
@ -9,6 +10,7 @@ import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.math.BigDecimal;
import java.util.EventObject;
@ -56,7 +58,8 @@ public class FilingApplicationSelectPlugin extends AbstractBillPlugIn implements
if (newValue==null){
return;
}
BigDecimal shkd_syed = newValue.getBigDecimal("shkd_syed");
DynamicObject shkd_filingapplication = BusinessDataServiceHelper.loadSingle(newValue.getPkValue(), "shkd_filingapplication");
BigDecimal shkd_syed = shkd_filingapplication.getBigDecimal("shkd_syed");
BigDecimal drawamount = (BigDecimal) this.getModel().getValue("drawamount");
if (shkd_syed.compareTo(drawamount)<0){
this.getModel().setValue("shkd_baed",null);

View File

@ -2,10 +2,12 @@ package shkd.sys.sys.plugin.operation;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.operate.result.OperateErrorInfo;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.entity.plugin.args.BeforeOperationArgs;
import kd.bos.entity.validate.ErrorLevel;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP;
@ -49,12 +51,12 @@ public class SubmitOccupyFilingApplication extends AbstractOperationServicePlugI
for (DynamicObject dataEntity : dataEntities) {
DynamicObject shkd_baed = dataEntity.getDynamicObject("shkd_baed");
if (shkd_baed!=null){
UpdateFilingApplicationData(shkd_baed);
UpdateFilingApplicationData(shkd_baed,dataEntity);
}
}
// SaveServiceHelper.save(dataEntities);
}
public void UpdateFilingApplicationData(DynamicObject shkd_baed){
public void UpdateFilingApplicationData(DynamicObject shkd_baed,DynamicObject dataEntity){
QFilter qFilter = new QFilter("billstatus", QCP.in, Arrays.asList("B", "C"));//提交审核状态
//债券发行
QFilter zqfxqFilter = qFilter.and(new QFilter("shkd_baed", QCP.equals, shkd_baed.getLong("id")));
@ -63,7 +65,7 @@ public class SubmitOccupyFilingApplication extends AbstractOperationServicePlugI
for (DynamicObject cfm_loanbill_bond : cfm_loanbill_bonds) {
Map<String,Object> zqfxmap=new HashMap<>();
zqfxmap.put("shkd_djbh",cfm_loanbill_bond.getString("billno"));
zqfxmap.put("shkd_djlx","债券发行");
zqfxmap.put("shkd_djlx","提款处理");
zqfxmap.put("shkd_zyje",cfm_loanbill_bond.getBigDecimal("drawamount"));
zqfxlist.add(zqfxmap);
}
@ -73,36 +75,40 @@ public class SubmitOccupyFilingApplication extends AbstractOperationServicePlugI
.filter(Objects::nonNull) // 过滤null值
.reduce(BigDecimal.ZERO, BigDecimal::add); // 求和初始值为BigDecimal.ZERO
//银行提款处理
QFilter yhtkclqFilter = qFilter.and(new QFilter("shkd_baed", QCP.equals, shkd_baed.getLong("id")));
List<Map<String, Object>> yhtkcllist = new ArrayList<>();
DynamicObject[] cfm_loanbills = BusinessDataServiceHelper.load("cfm_loanbill", "id,billno,drawamount", yhtkclqFilter.toArray());
for (DynamicObject cfm_loanbill : cfm_loanbills) {
Map<String,Object> zqfxmap=new HashMap<>();
zqfxmap.put("shkd_djbh",cfm_loanbill.getString("billno"));
zqfxmap.put("shkd_djlx","银行提款处理");
zqfxmap.put("shkd_zyje",cfm_loanbill.getBigDecimal("drawamount"));
yhtkcllist.add(zqfxmap);
}
// 使用Stream计算shkd_zyje的合计
BigDecimal yhtkcltotal = yhtkcllist.stream() // 将zqfxlist转为Stream
.map(map -> (BigDecimal) map.get("shkd_zyje")) // 提取shkd_zyje的值
.filter(Objects::nonNull) // 过滤null值
.reduce(BigDecimal.ZERO, BigDecimal::add); // 求和初始值为BigDecimal.ZERO
BigDecimal total = yhtkcltotal.add(zqfxtotal);
// //银行提款处理
// QFilter yhtkclqFilter = qFilter.and(new QFilter("shkd_baed", QCP.equals, shkd_baed.getLong("id")));
// List<Map<String, Object>> yhtkcllist = new ArrayList<>();
// DynamicObject[] cfm_loanbills = BusinessDataServiceHelper.load("cfm_loanbill", "id,billno,drawamount", yhtkclqFilter.toArray());
// for (DynamicObject cfm_loanbill : cfm_loanbills) {
// Map<String,Object> zqfxmap=new HashMap<>();
// zqfxmap.put("shkd_djbh",cfm_loanbill.getString("billno"));
// zqfxmap.put("shkd_djlx","银行提款处理");
// zqfxmap.put("shkd_zyje",cfm_loanbill.getBigDecimal("drawamount"));
// yhtkcllist.add(zqfxmap);
// }
// // 使用Stream计算shkd_zyje的合计
// BigDecimal yhtkcltotal = yhtkcllist.stream() // 将zqfxlist转为Stream
// .map(map -> (BigDecimal) map.get("shkd_zyje")) // 提取shkd_zyje的值
// .filter(Objects::nonNull) // 过滤null值
// .reduce(BigDecimal.ZERO, BigDecimal::add); // 求和初始值为BigDecimal.ZERO
// BigDecimal total = yhtkcltotal.add(zqfxtotal);
DynamicObject shkd_filingapplication = BusinessDataServiceHelper.loadSingle(shkd_baed.getPkValue(), "shkd_filingapplication");
shkd_filingapplication.set("shkd_zyed",yhtkcltotal.add(zqfxtotal));
shkd_filingapplication.set("shkd_zyed",zqfxtotal);
BigDecimal shkd_zed = shkd_filingapplication.getBigDecimal("shkd_zed");
shkd_filingapplication.set("shkd_zyed",shkd_zed.subtract(total));
if (shkd_zed.subtract(zqfxtotal).compareTo(BigDecimal.ZERO)<0){
this.getOperationResult().addErrorInfo(setErrorMessage(dataEntity, dataEntity.getString("billno")+"失败原因:"+"备案申请余额不足"));
return;
}
shkd_filingapplication.set("shkd_zyed",shkd_zed.subtract(zqfxtotal));
DynamicObjectCollection shkd_zyxx = shkd_filingapplication.getDynamicObjectCollection("shkd_zyxx");//占用信息
shkd_zyxx.clear();
for (Map<String, Object> stringObjectMap : yhtkcllist) {
DynamicObject dynamicObject = shkd_zyxx.addNew();
dynamicObject.set("shkd_djbh",stringObjectMap.get("shkd_djbh"));
dynamicObject.set("shkd_djlx",stringObjectMap.get("shkd_djlx"));
dynamicObject.set("shkd_zyje",stringObjectMap.get("shkd_zyje"));
}
// for (Map<String, Object> stringObjectMap : yhtkcllist) {
// DynamicObject dynamicObject = shkd_zyxx.addNew();
// dynamicObject.set("shkd_djbh",stringObjectMap.get("shkd_djbh"));
// dynamicObject.set("shkd_djlx",stringObjectMap.get("shkd_djlx"));
// dynamicObject.set("shkd_zyje",stringObjectMap.get("shkd_zyje"));
// }
for (Map<String, Object> stringObjectMap : zqfxlist) {
DynamicObject dynamicObject = shkd_zyxx.addNew();
dynamicObject.set("shkd_djbh",stringObjectMap.get("shkd_djbh"));
@ -110,6 +116,15 @@ public class SubmitOccupyFilingApplication extends AbstractOperationServicePlugI
dynamicObject.set("shkd_zyje",stringObjectMap.get("shkd_zyje"));
}
SaveServiceHelper.update(shkd_filingapplication);
SaveServiceHelper.save(new DynamicObject[]{shkd_filingapplication});
}
/*
* 返回错误信息对象
* */
private OperateErrorInfo setErrorMessage(DynamicObject dataEntity, String Message) {
OperateErrorInfo errorcode_001 = new OperateErrorInfo("errorcode_001", ErrorLevel.Error, dataEntity.getPkValue());
errorcode_001.setMessage(Message);
return errorcode_001;
}
}