Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ad460d8b80
|
@ -0,0 +1,115 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.operate;
|
||||||
|
|
||||||
|
import com.grapecity.documents.excel.B;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.db.tx.TX;
|
||||||
|
import kd.bos.db.tx.TXHandle;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.bos.util.StringUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款处理单反写资金计划申请实际付款
|
||||||
|
*/
|
||||||
|
public class CasPaybillToEcFundPlanApplyOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(CasPaybillToEcFundPlanApplyOp.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endOperationTransaction(EndOperationTransactionArgs e) {
|
||||||
|
String operationKey = e.getOperationKey();
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
switch (operationKey) {
|
||||||
|
case "pay"://付款
|
||||||
|
log.info("执行CasPaybillToEcFundPlanApplyOp的付款操作,开始更资金计划申请,付款类型实付金额");
|
||||||
|
updateInApplyRealPayAmt(dataEntities, true);
|
||||||
|
break;
|
||||||
|
case "unpay"://取消付款
|
||||||
|
log.info("执行CasPaybillToEcFundPlanApplyOp的取消付款操作,开始更资金计划申请,付款类型实付金额");
|
||||||
|
updateInApplyRealPayAmt(dataEntities, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*public void endOperationTransaction(EndOperationTransactionArgs e) {
|
||||||
|
}*/
|
||||||
|
|
||||||
|
protected void updateInApplyRealPayAmt(DynamicObject[] dataEntities, boolean isPay){
|
||||||
|
List<DynamicObject> updateData = new ArrayList<>();
|
||||||
|
for (DynamicObject dataEntity : dataEntities) {
|
||||||
|
long id = dataEntity.getLong("id");
|
||||||
|
// idList.add(id);
|
||||||
|
Map<String, HashSet<Long>> sourceBills = BFTrackerServiceHelper.findSourceBills("cas_paybill", new Long[]{id});
|
||||||
|
HashSet<Long> zcgjEcFundingplanapply = sourceBills.get("zcgj_ec_fundingplanapply");
|
||||||
|
if(zcgjEcFundingplanapply != null && !zcgjEcFundingplanapply.isEmpty()) {
|
||||||
|
Long dataId = (Long)zcgjEcFundingplanapply.toArray()[0];
|
||||||
|
|
||||||
|
//计算实际付款金额
|
||||||
|
DynamicObject paybill = BusinessDataServiceHelper.loadSingle(id, "cas_paybill");
|
||||||
|
DynamicObject settletype = paybill.getDynamicObject("settletype");
|
||||||
|
String typeString = "";
|
||||||
|
if(settletype!=null){
|
||||||
|
String type = settletype.getString("number");
|
||||||
|
if("002".equals(type)){ //司库-对公
|
||||||
|
//现金
|
||||||
|
typeString = "XJ";
|
||||||
|
}else if("JSFS07".equals(type)){ //银行承兑汇票
|
||||||
|
//银行承兑
|
||||||
|
typeString = "YHCD";
|
||||||
|
}else if("JSFS06".equals(type)){ //商业承兑汇票
|
||||||
|
//商业承兑
|
||||||
|
typeString = "SYCD";
|
||||||
|
}else if("JSFS26".equals(type)){ //供应链
|
||||||
|
//供应链
|
||||||
|
typeString = "GYL";
|
||||||
|
}else if("JSFS27".equals(type)){ //其他金融产品
|
||||||
|
//其他金融产品
|
||||||
|
typeString = "QTJRCP";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DynamicObjectCollection entryCpllection = paybill.getDynamicObjectCollection("entry");
|
||||||
|
BigDecimal allActamt = BigDecimal.ZERO;
|
||||||
|
for (DynamicObject entry : entryCpllection) {
|
||||||
|
BigDecimal eActamt = entry.getBigDecimal("e_actamt");//获取实付金额
|
||||||
|
allActamt = allActamt.add(eActamt);
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取资金计划申请
|
||||||
|
DynamicObject fundingplanapply = BusinessDataServiceHelper.loadSingle(dataId, "zcgj_ec_fundingplanapply");
|
||||||
|
DynamicObjectCollection zcgjFinApprovedAmount = fundingplanapply.getDynamicObjectCollection("zcgj_fin_approved_amount");
|
||||||
|
for (DynamicObject dynamicObject : zcgjFinApprovedAmount) {
|
||||||
|
String zcgjSetttype = dynamicObject.getString("zcgj_setttype");
|
||||||
|
if(typeString.equals(zcgjSetttype)){
|
||||||
|
BigDecimal zcgjAmountRecommended = dynamicObject.getBigDecimal("zcgj_amountpaid");//实际付款金额
|
||||||
|
BigDecimal amountrecommended = BigDecimal.ZERO;
|
||||||
|
if(!isPay){
|
||||||
|
amountrecommended = allActamt;
|
||||||
|
allActamt = allActamt.multiply(BigDecimal.ZERO.subtract(BigDecimal.ONE));//取相反数
|
||||||
|
}
|
||||||
|
allActamt = allActamt.add(zcgjAmountRecommended);
|
||||||
|
dynamicObject.set("zcgj_amountpaid", allActamt);//实付金额
|
||||||
|
dynamicObject.set("zcgj_amount_inpayment",amountrecommended);//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateData.add(fundingplanapply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!updateData.isEmpty()){
|
||||||
|
try (TXHandle txType = TX.requiresNew("updateAmt")) {
|
||||||
|
SaveServiceHelper.save(updateData.toArray(new DynamicObject[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -90,8 +90,8 @@ public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugi
|
||||||
}
|
}
|
||||||
QFilter qFilter = new QFilter("assetcat.number", QCP.in, strings);
|
QFilter qFilter = new QFilter("assetcat.number", QCP.in, strings);
|
||||||
QFilter qFilter2 = new QFilter("assetunit.id", QCP.in, orgSer);
|
QFilter qFilter2 = new QFilter("assetunit.id", QCP.in, orgSer);
|
||||||
QFilter qFilter3 = new QFilter("bizstatus", QCP.equals, "DELETE");
|
QFilter qFilter3 = new QFilter("bizstatus", QCP.not_equals, "DELETE");
|
||||||
// QFilter qFilter4 = new QFilter("billstatus", QCP.equals, "C");
|
// QFilter qFilter4 = new QFilter("billstatus", QCP.equals., "C");
|
||||||
DynamicObject[] realcards = BusinessDataServiceHelper.load("fa_asset_card", "zcgj_costcenter,headusedept,finentry,assetcat,number,assetname,model,realaccountdate," +
|
DynamicObject[] realcards = BusinessDataServiceHelper.load("fa_asset_card", "zcgj_costcenter,headusedept,finentry,assetcat,number,assetname,model,realaccountdate," +
|
||||||
"assetunit,supplier,zcgj_platenumber,unit,zcgj_manufacturer,zcgj_prodate,storeplace,creator,createtime,modifier,modifytime,auditdate,auditor,finentry.fin_originalval,finentry.fin_preresidualval,finentry.fin_depredamount,finentry.fin_preusingamount,finentry.fin_accumdepre,finentry.fin_networth", new QFilter[]{qFilter,qFilter2,qFilter3});
|
"assetunit,supplier,zcgj_platenumber,unit,zcgj_manufacturer,zcgj_prodate,storeplace,creator,createtime,modifier,modifytime,auditdate,auditor,finentry.fin_originalval,finentry.fin_preresidualval,finentry.fin_depredamount,finentry.fin_preusingamount,finentry.fin_accumdepre,finentry.fin_networth", new QFilter[]{qFilter,qFilter2,qFilter3});
|
||||||
log.info("同步的实物数量有"+realcards.length);
|
log.info("同步的实物数量有"+realcards.length);
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class FundingplanapplyOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
e.getFieldKeys().add("zcgj_fin_approved_amount");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
//当前所在的组织是属于矿山下的
|
||||||
|
e.getValidators().add(new ValidatorExt());
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidatorExt extends AbstractValidator {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||||
|
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||||
|
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||||
|
DynamicObjectCollection finApprovedAmount = dataEntity.getDynamicObjectCollection("zcgj_fin_approved_amount");
|
||||||
|
if (!finApprovedAmount.isEmpty()) {
|
||||||
|
Set<String> typeSet = new HashSet<>();
|
||||||
|
for (DynamicObject dynamicObject : finApprovedAmount) {
|
||||||
|
String sSetttype = dynamicObject.getString("zcgj_setttype");
|
||||||
|
if(typeSet.contains(sSetttype)) {
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, "财务部核定金额的结算方式不允许重复!");
|
||||||
|
return;
|
||||||
|
}else{
|
||||||
|
typeSet.add(sSetttype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -64,7 +64,7 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
||||||
}
|
}
|
||||||
QFilter qFilter = new QFilter("assetcat.number", QCP.in, strings);
|
QFilter qFilter = new QFilter("assetcat.number", QCP.in, strings);
|
||||||
QFilter qFilter2 = new QFilter("assetunit.id", QCP.in, orgSer);
|
QFilter qFilter2 = new QFilter("assetunit.id", QCP.in, orgSer);
|
||||||
QFilter qFilter3 = new QFilter("bizstatus", QCP.equals, "DELETE");
|
QFilter qFilter3 = new QFilter("bizstatus", QCP.not_equals, "DELETE");
|
||||||
// QFilter qFilter4 = new QFilter("billstatus", QCP.equals, "C");
|
// QFilter qFilter4 = new QFilter("billstatus", QCP.equals, "C");
|
||||||
DynamicObject[] realcards = BusinessDataServiceHelper.load("fa_asset_card", "zcgj_costcenter,headusedept,finentry,assetcat,number,assetname,model,realaccountdate," +
|
DynamicObject[] realcards = BusinessDataServiceHelper.load("fa_asset_card", "zcgj_costcenter,headusedept,finentry,assetcat,number,assetname,model,realaccountdate," +
|
||||||
"assetunit,supplier,zcgj_platenumber,unit,zcgj_manufacturer,zcgj_prodate,storeplace,creator,createtime,modifier,modifytime,auditdate,auditor,finentry.fin_originalval,finentry.fin_preresidualval,finentry.fin_depredamount,finentry.fin_preusingamount,finentry.fin_accumdepre,finentry.fin_networth", new QFilter[]{qFilter,qFilter2,qFilter3});
|
"assetunit,supplier,zcgj_platenumber,unit,zcgj_manufacturer,zcgj_prodate,storeplace,creator,createtime,modifier,modifytime,auditdate,auditor,finentry.fin_originalval,finentry.fin_preresidualval,finentry.fin_depredamount,finentry.fin_preusingamount,finentry.fin_accumdepre,finentry.fin_networth", new QFilter[]{qFilter,qFilter2,qFilter3});
|
||||||
|
|
Loading…
Reference in New Issue