parent
1ce88f6e10
commit
9ecadc415b
|
@ -74,38 +74,42 @@ public class redeemTaskPlugin extends AbstractTask {
|
||||||
|
|
||||||
for (int i = 0; i < CDM_PAYABLEBILLs.length; i++) {
|
for (int i = 0; i < CDM_PAYABLEBILLs.length; i++) {
|
||||||
DynamicObject cdm_payablebill = CDM_PAYABLEBILLs[i];
|
DynamicObject cdm_payablebill = CDM_PAYABLEBILLs[i];
|
||||||
Long draftId = cdm_payablebill.getLong("id");
|
try {
|
||||||
BigDecimal sumBillAmt = (BigDecimal)amountMap.getOrDefault(draftId, BigDecimal.ZERO);
|
Long draftId = cdm_payablebill.getLong("id");
|
||||||
BigDecimal amount = cdm_payablebill.getBigDecimal("amount");
|
BigDecimal sumBillAmt = (BigDecimal)amountMap.getOrDefault(draftId, BigDecimal.ZERO);
|
||||||
boolean isNoAmount = sumBillAmt.compareTo(BigDecimal.ZERO) != 0 && amount.compareTo(sumBillAmt) == 0;
|
BigDecimal amount = cdm_payablebill.getBigDecimal("amount");
|
||||||
String billStatus = cdm_payablebill.getString("billstatus");
|
boolean isNoAmount = sumBillAmt.compareTo(BigDecimal.ZERO) != 0 && amount.compareTo(sumBillAmt) == 0;
|
||||||
String draftbillTranstatus = cdm_payablebill.getString("draftbilltranstatus");
|
String billStatus = cdm_payablebill.getString("billstatus");
|
||||||
if (!BillStatusEnum.AUDIT.getValue().equals(billStatus) || !DraftTranStatusEnum.SUCCESS.getValue().equals(draftbillTranstatus) || isNoAmount) {
|
String draftbillTranstatus = cdm_payablebill.getString("draftbilltranstatus");
|
||||||
logger.info("单据编号:"+cdm_payablebill.getString("billno")+"单据状态为“已审核”且票据交易状态为“交易成功”的未兑付票据才能操作票据兑付。");
|
if (!BillStatusEnum.AUDIT.getValue().equals(billStatus) || !DraftTranStatusEnum.SUCCESS.getValue().equals(draftbillTranstatus) || isNoAmount) {
|
||||||
continue;
|
logger.info("单据编号:"+cdm_payablebill.getString("billno")+"单据状态为“已审核”且票据交易状态为“交易成功”的未兑付票据才能操作票据兑付。");
|
||||||
}
|
continue;
|
||||||
|
|
||||||
List<Long> dataEntitys = new ArrayList<>();
|
|
||||||
dataEntitys.add(Long.parseLong(cdm_payablebill.getString("id")));
|
|
||||||
OperateOption option = OperateOption.create();
|
|
||||||
option.setVariableValue("tradeType", "redeem");
|
|
||||||
option.setVariableValue("remarks", "后台下推");
|
|
||||||
//调用方法执行数据 - 自动兑付下推
|
|
||||||
OperationResult operationResult = OperationServiceHelper.executeOperate("pushandsaveredeem",
|
|
||||||
CdmEntityConst.CDM_PAYABLEBILL,
|
|
||||||
dataEntitys.toArray(new Object[]{}), option);
|
|
||||||
if (operationResult.getAllErrorInfo().size()!=0) {
|
|
||||||
logger.info("单据编号:"+cdm_payablebill.getString("billno")+"后台生单失败,原因:"+operationResult.getAllErrorInfo().get(0).getMessage());
|
|
||||||
String targetpkvalue = operationResult.getAllErrorInfo().get(0).getErrorCustInfos().get("targetpkvalue");
|
|
||||||
DynamicObject cdm_drafttradebill = BusinessDataServiceHelper.loadSingle(targetpkvalue, "cdm_drafttradebill");
|
|
||||||
OperationResult delete = OperationServiceHelper.executeOperate("delete", "cdm_drafttradebill", new DynamicObject[]{cdm_drafttradebill}, OperateOption.create());
|
|
||||||
if (delete.isSuccess()==true){
|
|
||||||
logger.info("删除单据编号:"+cdm_payablebill.getString("billno")+"成功");
|
|
||||||
}else {
|
|
||||||
logger.info("删除单据编号:"+cdm_payablebill.getString("billno")+"失败,原因:"+delete.getMessage());
|
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
logger.info("单据编号:"+cdm_payablebill.getString("billno")+"后台生单成功");
|
List<Long> dataEntitys = new ArrayList<>();
|
||||||
|
dataEntitys.add(Long.parseLong(cdm_payablebill.getString("id")));
|
||||||
|
OperateOption option = OperateOption.create();
|
||||||
|
option.setVariableValue("tradeType", "redeem");
|
||||||
|
option.setVariableValue("remarks", "后台下推");
|
||||||
|
//调用方法执行数据 - 自动兑付下推
|
||||||
|
OperationResult operationResult = OperationServiceHelper.executeOperate("pushandsaveredeem",
|
||||||
|
CdmEntityConst.CDM_PAYABLEBILL,
|
||||||
|
dataEntitys.toArray(new Object[]{}), option);
|
||||||
|
if (operationResult.getAllErrorInfo().size()!=0) {
|
||||||
|
logger.info("单据编号:"+cdm_payablebill.getString("billno")+"后台生单失败,原因:"+operationResult.getAllErrorInfo().get(0).getMessage());
|
||||||
|
String targetpkvalue = operationResult.getAllErrorInfo().get(0).getErrorCustInfos().get("targetpkvalue");
|
||||||
|
DynamicObject cdm_drafttradebill = BusinessDataServiceHelper.loadSingle(targetpkvalue, "cdm_drafttradebill");
|
||||||
|
OperationResult delete = OperationServiceHelper.executeOperate("delete", "cdm_drafttradebill", new DynamicObject[]{cdm_drafttradebill}, OperateOption.create());
|
||||||
|
if (delete.isSuccess()==true){
|
||||||
|
logger.info("删除单据编号:"+cdm_payablebill.getString("billno")+"成功");
|
||||||
|
}else {
|
||||||
|
logger.info("删除单据编号:"+cdm_payablebill.getString("billno")+"失败,原因:"+delete.getMessage());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.info("单据编号:"+cdm_payablebill.getString("billno")+"后台生单成功");
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
logger.error("单据编号:"+cdm_payablebill.getString("billno")+"后台生单錯誤原因:"+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue