1.采购订单关闭推送返利规则

This commit is contained in:
龚豆豆 2025-11-25 17:52:48 +08:00
parent cb240bf22e
commit c2d592e676
3 changed files with 21 additions and 75 deletions

View File

@ -513,6 +513,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
model.setValue("materialname", tqq9_material.getString("name"), i);//物料名称
model.setValue("unit", tqq9_material.getDynamicObject("baseunit"), i);//计量单位
model.setValue("baseunit", tqq9_material.getDynamicObject("baseunit"), i);//基本单位
model.setValue("baseunit", tqq9_material.getDynamicObject("baseunit"), i);//基本单位
model.setValue("rowclosestatus", "A", i);//行关闭状态
model.setValue("rowterminatestatus", "A", i);//行终止状态
model.setValue("entrypurog", LCJT, i);//分录采购组织(封存)

View File

@ -107,7 +107,7 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
BigDecimal tqq9_hsxfsyje = pm_purorderbill.getBigDecimal("tqq9_hsxfsyje");//含税现返使用金额
String tqq9_hfid = pm_purorderbill.getString("tqq9_hfid");//货返id
String tqq9_xfid = pm_purorderbill.getString("tqq9_xfid");//现返id
String billno = pm_purorderbill.getString("tqqbillno9_xfid");//单据编号
String billno = pm_purorderbill.getString("billno");//单据编号
BigDecimal oneHundred = new BigDecimal(100);
HashMap<String, String> tokenMap = new HashMap<String, String>();
tokenMap.put("Authorization", FLXT_TOKEN);
@ -134,8 +134,9 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
lcLogService.savelog("FL-解锁返利金额", Cancel_URL, false, false, queryMap.toString(), "接口调用报错errormessage:" + ex.getMessage());
throw new RuntimeException(ex+",请求返利系统失败");
}
//现返关闭
} else if (tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0) {
}
//现返关闭
if (tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal notaxamount = tqq9_hsxfsyje.multiply(oneHundred.divide(oneHundred.add(new BigDecimal(13)), 10, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
BigDecimal taxamount = tqq9_hsxfsyje.subtract(notaxamount);//税额
HashMap<String, Object> queryMap = new HashMap<>();
@ -159,11 +160,12 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
}
}
}else{
//货返关闭
BigDecimal tqq9_hshfsyje = pm_purorderbill.getBigDecimal("tqq9_hshfsyje");//含税货返使用金额
BigDecimal tqq9_hsxfsyje = pm_purorderbill.getBigDecimal("tqq9_hsxfsyje");//含税现返使用金额
String tqq9_hfid = pm_purorderbill.getString("tqq9_hfid");//货返id
String tqq9_xfid = pm_purorderbill.getString("tqq9_xfid");//现返id
String billno = pm_purorderbill.getString("tqqbillno9_xfid");//单据编号
String billno = pm_purorderbill.getString("billno");//单据编号
BigDecimal oneHundred = new BigDecimal(100);
HashMap<String, String> tokenMap = new HashMap<String, String>();
tokenMap.put("Authorization", FLXT_TOKEN);
@ -177,7 +179,7 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
String orgid_fl = org_fl != null ? org_fl.getString("name") : null;
BigDecimal notaxamount = tqq9_hshfsyje.multiply(oneHundred.divide(oneHundred.add(new BigDecimal(13)), 10, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
BigDecimal taxamount = tqq9_hshfsyje.subtract(notaxamount);//税额
HashMap<String, Object> queryMap = new HashMap<>();
JSONObject queryMap = new JSONObject();
queryMap.put("id", tqq9_hfid);
queryMap.put("money", tqq9_hshfsyje);
queryMap.put("taxAmount", taxamount);
@ -185,21 +187,22 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
queryMap.put("companyId", orgid_fl);
Gson gson = new Gson();
try {
String bodyString = HttpRequestUtils.postJson(Cancel_URL, queryMap.toString(), tokenMap);
String bodyString = HttpRequestUtils.postJson(RETURN_URL, queryMap.toString(), tokenMap);
JSONObject map = gson.fromJson(bodyString, JSONObject.class);
Boolean data = map.getBoolean("data");
if (data == null || !data) {
lcLogService.savelog("FL-释放返利金额", Cancel_URL, false, false, queryMap.toString(), bodyString);
lcLogService.savelog("FL-释放返利金额", RETURN_URL, false, false, queryMap.toString(), bodyString);
this.getView().showErrorNotification("采购订单:" + billno + ",释放返利金额失败");
} else {
lcLogService.savelog("FL-释放返利金额", Cancel_URL, false, true, queryMap.toString(), bodyString);
lcLogService.savelog("FL-释放返利金额", RETURN_URL, false, true, queryMap.toString(), bodyString);
}
} catch (IOException ex) {
lcLogService.savelog("FL-释放返利金额", Cancel_URL, false, false, queryMap.toString(), "接口调用报错errormessage:" + ex.getMessage());
lcLogService.savelog("FL-释放返利金额", RETURN_URL, false, false, queryMap.toString(), "接口调用报错errormessage:" + ex.getMessage());
throw new RuntimeException(ex+",请求返利系统失败");
}
//现返关闭
} else if (tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0) {
}
//现返关闭
if (tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0) {
DynamicObject supplier = pm_purorderbill.getDynamicObject("supplier");//供应商
DynamicObject org = pm_purorderbill.getDynamicObject("org");//组织
String number = org.getString("number");
@ -208,7 +211,7 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
String orgid_fl = org_fl != null ? org_fl.getString("name") : null;
BigDecimal notaxamount = tqq9_hsxfsyje.multiply(oneHundred.divide(oneHundred.add(new BigDecimal(13)), 10, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
BigDecimal taxamount = tqq9_hsxfsyje.subtract(notaxamount);//税额
HashMap<String, Object> queryMap = new HashMap<>();
JSONObject queryMap = new JSONObject();
queryMap.put("id", tqq9_xfid);
queryMap.put("money", tqq9_hsxfsyje);
queryMap.put("taxAmount", taxamount);
@ -216,17 +219,17 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
queryMap.put("companyId", orgid_fl);
Gson gson = new Gson();
try {
String bodyString = HttpRequestUtils.postJson(Cancel_URL, queryMap.toString(), tokenMap);
String bodyString = HttpRequestUtils.postJson(RETURN_URL, queryMap.toString(), tokenMap);
JSONObject map = gson.fromJson(bodyString, JSONObject.class);
Boolean data = map.getBoolean("data");
if (data == null || !data) {
lcLogService.savelog("FL-释放返利金额", Cancel_URL, false, false, queryMap.toString(), bodyString);
lcLogService.savelog("FL-释放返利金额", RETURN_URL, false, false, queryMap.toString(), bodyString);
this.getView().showErrorNotification("采购订单:" + billno + ",释放返利金额失败");
} else {
lcLogService.savelog("FL-释放返利金额", Cancel_URL, false, true, queryMap.toString(), bodyString);
lcLogService.savelog("FL-释放返利金额", RETURN_URL, false, true, queryMap.toString(), bodyString);
}
} catch (IOException ex) {
lcLogService.savelog("FL-释放返利金额", Cancel_URL, false, false, queryMap.toString(), "接口调用报错errormessage:" + ex.getMessage());
lcLogService.savelog("FL-释放返利金额", RETURN_URL, false, false, queryMap.toString(), "接口调用报错errormessage:" + ex.getMessage());
throw new RuntimeException(ex+",请求返利系统失败");
}
}
@ -235,63 +238,4 @@ public class PurOrderCloseBillPlugin extends AbstractListPlugin implements Plugi
}
}
}
// @Override
// public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
// // 回调标识正确并且点击了确认
// if (StringUtils.equals(messageBoxClosedEvent.getCallBackId(), "isrebate") && messageBoxClosedEvent.getResult() == MessageBoxResult.Yes) {
// DynamicObject dataEntity = this.getModel().getDataEntity();
// // todo 在此添加业务逻辑
// BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal("tqq9_hshfsyje");//含税货返使用金额
// BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal("tqq9_hsxfsyje");//含税现返使用金额
// String tqq9_hfid = dataEntity.getString("tqq9_hfid");//货返id
// String tqq9_xfid = dataEntity.getString("tqq9_xfid");//现返id
// String billno = dataEntity.getString("tqqbillno9_xfid");//单据编号
// BigDecimal oneHundred = new BigDecimal(100);
// HashMap<String, String> tokenMap = new HashMap<String, String>();
// tokenMap.put("Authorization", FLXT_TOKEN);
//
// if (tqq9_hshfsyje.compareTo(BigDecimal.ZERO) > 0) {
// BigDecimal notaxamount = tqq9_hshfsyje.multiply(oneHundred.divide(oneHundred.add(new BigDecimal(13)), 10, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
// BigDecimal taxamount = tqq9_hshfsyje.subtract(notaxamount);//税额
// JSONObject bodyMap = new JSONObject();
// bodyMap.put("id", tqq9_hfid);
// bodyMap.put("lockMoney", tqq9_hshfsyje);
// bodyMap.put("lockTaxAmount", taxamount);
// Gson gson = new Gson();
// try {
// String bodyString = HttpRequestUtils.postJson(URL ,bodyMap.toString(), tokenMap);
// HashMap map = gson.fromJson(bodyString, HashMap.class);
// Boolean data = (Boolean) map.get("data");
// if (!data) {
// this.getView().showErrorNotification("采购订单:" + billno + ",释放返利金额成功");
// }
// } catch (IOException ex) {
// throw new RuntimeException(ex);
// }
// //现返审核
// } else if (tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0) {
// BigDecimal notaxamount = tqq9_hsxfsyje.multiply(oneHundred.divide(oneHundred.add(new BigDecimal(13)), 10, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
// BigDecimal taxamount = tqq9_hsxfsyje.subtract(notaxamount);//税额
// JSONObject bodyMap = new JSONObject();
// bodyMap.put("id", tqq9_xfid);
// bodyMap.put("lockMoney", tqq9_hsxfsyje);
// bodyMap.put("lockTaxAmount", taxamount);
// Gson gson = new Gson();
// try {
// String bodyString = HttpRequestUtils.postJson(URL, bodyMap.toString(), tokenMap);
// HashMap map = gson.fromJson(bodyString, HashMap.class);
// Boolean data = (Boolean) map.get("data");
// if (!data) {
// this.getView().showErrorNotification("采购订单:" + billno + ",释放返利金额成功");
// }
// } catch (IOException ex) {
// throw new RuntimeException(ex);
// }
// }
//// this.getView().showSuccessNotification("confirm call back success");
// }
//
//
// }
}

View File

@ -296,6 +296,7 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement
}else{
lcLogService.savelog("创建返利规则",Push_URL,true,true, bodyMap.toString(), bodyString);
dataEntity.set("tqq9_status","B");
dataEntity.set("tqq9_rebateruleid",data);
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
DynamicObject tqq9_conm_purcontract = dataEntity.getDynamicObject("tqq9_conm_purcontract");//采购合同
tqq9_conm_purcontract = BusinessDataServiceHelper.loadSingle("conm_purcontract", new QFilter[]{new QFilter("id", QCP.equals, tqq9_conm_purcontract.getLong("id"))});