parent
0eb3a8621e
commit
61ffe0d181
|
|
@ -82,6 +82,17 @@ public class CasPaybillController {
|
||||||
Boolean iserror = true;
|
Boolean iserror = true;
|
||||||
for (DynamicObject cas_paybill : cas_paybills) {
|
for (DynamicObject cas_paybill : cas_paybills) {
|
||||||
if (billno.equals(cas_paybill.getString("billno"))) {
|
if (billno.equals(cas_paybill.getString("billno"))) {
|
||||||
|
String billstatus = cas_paybill.getString("billstatus");
|
||||||
|
if(!StringUtils.equals("C",billstatus)){
|
||||||
|
ArrayList<String> rowMsg = error.getRowMsg();
|
||||||
|
rowMsg.add("传入编号:" + billno + "的单据状态非已审核,无法变更");
|
||||||
|
error.setRowMsg(rowMsg);
|
||||||
|
error.setEntityKey(Constants.CAS_PAYBILL);
|
||||||
|
error.setKeys(keys);
|
||||||
|
resultBean.setId("");
|
||||||
|
resultBean.setBillStatus(false);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
cas_paybill.set("description", dataMap.get("description"));
|
cas_paybill.set("description", dataMap.get("description"));
|
||||||
cas_paybill.set("tqq9_digital_receipt", dataMap.get("tqq9_digital_receipt"));
|
cas_paybill.set("tqq9_digital_receipt", dataMap.get("tqq9_digital_receipt"));
|
||||||
resultBean.setId(cas_paybill.getString("id"));
|
resultBean.setId(cas_paybill.getString("id"));
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,11 @@ public class PaySaveApiPlugin implements ApiSavePlugin {
|
||||||
for (Map<String, Object> reqDatum : reqData) {
|
for (Map<String, Object> reqDatum : reqData) {
|
||||||
BigDecimal actpayamt = (BigDecimal) reqDatum.get("actpayamt");//实付金额
|
BigDecimal actpayamt = (BigDecimal) reqDatum.get("actpayamt");//实付金额
|
||||||
HashMap paymenttype = (HashMap)reqDatum.get("paymenttype");//付款类型
|
HashMap paymenttype = (HashMap)reqDatum.get("paymenttype");//付款类型
|
||||||
// String paymenttype_number = paymenttype.get("number").toString();
|
|
||||||
if (reqDatum.get("payerbank") instanceof Map) {
|
if (reqDatum.get("payerbank") instanceof Map) {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
HashMap payerbank = (HashMap) reqDatum.get("payerbank");//付款银行
|
HashMap payerbank = (HashMap) reqDatum.get("payerbank");//付款银行
|
||||||
String payeename = reqDatum.get("payeename").toString();//付款人名称
|
String payeename = reqDatum.get("payeename").toString();//收款人名称
|
||||||
String payeetype = reqDatum.get("payeetype").toString();//付款人类型
|
String payeetype = reqDatum.get("payeetype").toString();//收款人类型
|
||||||
DynamicObject payee = BusinessDataServiceHelper.loadSingle(payeetype, new QFilter[]{new QFilter("name", QCP.equals, payeename)});
|
DynamicObject payee = BusinessDataServiceHelper.loadSingle(payeetype, new QFilter[]{new QFilter("name", QCP.equals, payeename)});
|
||||||
if(payee!=null){
|
if(payee!=null){
|
||||||
reqDatum.put("payee", payee.getLong("id"));
|
reqDatum.put("payee", payee.getLong("id"));
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package tqq9.lc123.cloud.app.api.plugin;
|
package tqq9.lc123.cloud.app.api.plugin;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
import kd.bos.openapi.api.plugin.ApiSavePlugin;
|
import kd.bos.openapi.api.plugin.ApiSavePlugin;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -19,12 +22,35 @@ public class RecBillSavePlugin extends AbstractFormPlugin implements ApiSavePlug
|
||||||
for (Map<String, Object> reqDatum : reqData) {
|
for (Map<String, Object> reqDatum : reqData) {
|
||||||
String tqq9_salorder = (String) reqDatum.get("tqq9_salorder");//销售订单
|
String tqq9_salorder = (String) reqDatum.get("tqq9_salorder");//销售订单
|
||||||
BigDecimal actrecamt = (BigDecimal) reqDatum.get("actrecamt");//收款金额
|
BigDecimal actrecamt = (BigDecimal) reqDatum.get("actrecamt");//收款金额
|
||||||
|
HashMap receivingtype = (HashMap)reqDatum.get("receivingtype");//收款类型
|
||||||
|
if (reqDatum.get("payeebank") instanceof Map) {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
HashMap payeebank = (HashMap) reqDatum.get("payeebank");//收款银行
|
||||||
|
String payername = reqDatum.get("payername").toString();//付款人名称
|
||||||
|
String payertype = reqDatum.get("payertype").toString();//付款人类型
|
||||||
|
DynamicObject payer = BusinessDataServiceHelper.loadSingle(payertype, new QFilter[]{new QFilter("name", QCP.equals, payername)});
|
||||||
|
if(payer!=null){
|
||||||
|
reqDatum.put("payer", payer.getLong("id"));
|
||||||
|
}
|
||||||
|
String number = payeebank.get("number").toString();
|
||||||
|
DynamicObject bd_bebank = BusinessDataServiceHelper.loadSingle("bd_bebank", new QFilter[]{new QFilter("number", QCP.equals, number)});
|
||||||
|
if (bd_bebank != null) {
|
||||||
|
DynamicObject bd_finorginfo = BusinessDataServiceHelper.loadSingle("bd_finorginfo", new QFilter[]{new QFilter("bebank", QCP.equals, bd_bebank.getLong("id"))});
|
||||||
|
if (bd_finorginfo != null) {
|
||||||
|
map.put("number", bd_finorginfo.getString("number"));
|
||||||
|
reqDatum.put("payeebank", map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<HashMap<String, Object>> entries = new ArrayList<HashMap<String, Object>>();
|
ArrayList<HashMap<String, Object>> entries = new ArrayList<HashMap<String, Object>>();
|
||||||
HashMap<String, Object> map=new HashMap<>();
|
HashMap<String, Object> map=new HashMap<>();
|
||||||
map.put("tqq9_salorder", tqq9_salorder);
|
map.put("tqq9_salorder", tqq9_salorder);
|
||||||
map.put("e_receivableamt", actrecamt);
|
map.put("e_receivableamt", actrecamt);
|
||||||
entries.add(map);
|
entries.add(map);
|
||||||
reqDatum.put("entry",entries);
|
reqDatum.put("entry",entries);
|
||||||
|
map.put("e_receivingtype", receivingtype);
|
||||||
|
|
||||||
}
|
}
|
||||||
return ApiSavePlugin.super.preHandleRequestData(reqData);
|
return ApiSavePlugin.super.preHandleRequestData(reqData);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ public class RebateRulesBillPlugin extends AbstractBillPlugIn implements BeforeF
|
||||||
String itemKey = afterDoOperationEventArgs.getOperateKey();
|
String itemKey = afterDoOperationEventArgs.getOperateKey();
|
||||||
if (StringUtils.equals("donothing", itemKey)) {
|
if (StringUtils.equals("donothing", itemKey)) {
|
||||||
Object name = this.getModel().getValue("name");
|
Object name = this.getModel().getValue("name");
|
||||||
|
String status = this.getModel().getValue("status").toString();
|
||||||
|
if(StringUtils.equals("A",status)){
|
||||||
|
this.getView().showErrorNotification("返利规则编辑完成后请先提交返利规则再单击确认");
|
||||||
|
}
|
||||||
Object tqq9_supplier = this.getModel().getValue("tqq9_supplier");
|
Object tqq9_supplier = this.getModel().getValue("tqq9_supplier");
|
||||||
Object tqq9_startdate = this.getModel().getValue("tqq9_startdate");
|
Object tqq9_startdate = this.getModel().getValue("tqq9_startdate");
|
||||||
Object tqq9_enddate = this.getModel().getValue("tqq9_enddate");
|
Object tqq9_enddate = this.getModel().getValue("tqq9_enddate");
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ public class PayBillOperationPlugin extends AbstractOperationServicePlugIn imple
|
||||||
private static String FLXT_TOKEN;
|
private static String FLXT_TOKEN;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
||||||
new QFilter[]{new QFilter("number", QCP.equals, "EqmDatabase_url")});
|
new QFilter[]{new QFilter("number", QCP.equals, "EqmDatabase_url")});
|
||||||
|
|
@ -88,20 +87,22 @@ public class PayBillOperationPlugin extends AbstractOperationServicePlugIn imple
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
String operateKey = this.getOperateKey();
|
||||||
for (ExtendedDataEntity dataEntity : this.getDataEntities()) {
|
for (ExtendedDataEntity dataEntity : this.getDataEntities()) {
|
||||||
DynamicObject dataEntity1 = dataEntity.getDataEntity();
|
DynamicObject dataEntity1 = dataEntity.getDataEntity();
|
||||||
DynamicObjectCollection entry = dataEntity1.getDynamicObjectCollection("entry");
|
DynamicObjectCollection entry = dataEntity1.getDynamicObjectCollection("entry");
|
||||||
String corebillno = entry.get(0).getString("e_corebillno");
|
String corebillno = entry.get(0).getString("e_corebillno");
|
||||||
BigDecimal actpayamt = dataEntity1.getBigDecimal("actpayamt");
|
BigDecimal actpayamt = dataEntity1.getBigDecimal("actpayamt");
|
||||||
String billno = dataEntity1.getString("billno");//单据号
|
String billno = dataEntity1.getString("billno");//单据号
|
||||||
Boolean tqq9_isrebatecalculate = dataEntity1.getBoolean("tqq9_isrebatecalculate");//是否已计算返利
|
if (StringUtils.isNotBlank(corebillno)) {
|
||||||
DynamicObject pm_purorderbill = BusinessDataServiceHelper.loadSingle("pm_purorderbill", new QFilter[]{new QFilter("billno", QCP.equals, corebillno)});
|
DynamicObject pm_purorderbill = BusinessDataServiceHelper.loadSingle("pm_purorderbill", new QFilter[]{new QFilter("billno", QCP.equals, corebillno)});
|
||||||
if (pm_purorderbill != null && !tqq9_isrebatecalculate) {
|
Boolean tqq9_isrebatecalculate = pm_purorderbill.getBoolean("tqq9_isrebatecalculate");//是否已计算返利
|
||||||
BigDecimal tqq9_hshfsyje = pm_purorderbill.getBigDecimal("tqq9_hshfsyje");//含税货返使用金额
|
if (pm_purorderbill != null && !tqq9_isrebatecalculate) {
|
||||||
BigDecimal tqq9_hsxfsyje = pm_purorderbill.getBigDecimal("tqq9_hsxfsyje");//含税现返使用金额
|
BigDecimal tqq9_hshfsyje = pm_purorderbill.getBigDecimal("tqq9_hshfsyje");//含税货返使用金额
|
||||||
if (actpayamt.compareTo(tqq9_hshfsyje.add(tqq9_hsxfsyje)) < 0) {
|
BigDecimal tqq9_hsxfsyje = pm_purorderbill.getBigDecimal("tqq9_hsxfsyje");//含税现返使用金额
|
||||||
this.addErrorMessage(dataEntity, "单据号:" + billno + ",付款金额小于采购订单返利金额,不允许付款");
|
if (actpayamt.compareTo(tqq9_hshfsyje.add(tqq9_hsxfsyje)) < 0) {
|
||||||
|
this.addErrorMessage(dataEntity, "单据号:" + billno + ",付款金额小于采购订单返利金额,不允许付款");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (DynamicObject dynamicObject : entry) {
|
for (DynamicObject dynamicObject : entry) {
|
||||||
|
|
@ -185,7 +186,7 @@ public class PayBillOperationPlugin extends AbstractOperationServicePlugIn imple
|
||||||
String bodyString = HttpRequestUtils.doGet(Use_URL, bodyMap, tokenMap);
|
String bodyString = HttpRequestUtils.doGet(Use_URL, bodyMap, tokenMap);
|
||||||
HashMap map = gson.fromJson(bodyString, HashMap.class);
|
HashMap map = gson.fromJson(bodyString, HashMap.class);
|
||||||
Boolean data = (Boolean) map.get("data");
|
Boolean data = (Boolean) map.get("data");
|
||||||
if (!data) {
|
if (data == null || !data) {
|
||||||
this.getOperationResult().setMessage("付款单:" + billno + ",审核时扣除订单金额失败");
|
this.getOperationResult().setMessage("付款单:" + billno + ",审核时扣除订单金额失败");
|
||||||
} else {
|
} else {
|
||||||
pm_purorderbill.set("tqq9_isrebatecalculate", true);
|
pm_purorderbill.set("tqq9_isrebatecalculate", true);
|
||||||
|
|
@ -207,7 +208,7 @@ public class PayBillOperationPlugin extends AbstractOperationServicePlugIn imple
|
||||||
String bodyString = HttpRequestUtils.doGet(Use_URL, bodyMap, tokenMap);
|
String bodyString = HttpRequestUtils.doGet(Use_URL, bodyMap, tokenMap);
|
||||||
HashMap map = gson.fromJson(bodyString, HashMap.class);
|
HashMap map = gson.fromJson(bodyString, HashMap.class);
|
||||||
Boolean data = (Boolean) map.get("data");
|
Boolean data = (Boolean) map.get("data");
|
||||||
if (!data) {
|
if (data == null || !data) {
|
||||||
this.getOperationResult().setMessage("付款单:" + billno + ",审核时扣除订单金额失败");
|
this.getOperationResult().setMessage("付款单:" + billno + ",审核时扣除订单金额失败");
|
||||||
} else {
|
} else {
|
||||||
pm_purorderbill.set("tqq9_isrebatecalculate", true);
|
pm_purorderbill.set("tqq9_isrebatecalculate", true);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
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.AfterOperationArgs;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
|
|
@ -29,17 +30,57 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
private final static Log logger = LogFactory.getLog(PurOrderBillRebatePlugin.class);
|
private final static Log logger = LogFactory.getLog(PurOrderBillRebatePlugin.class);
|
||||||
private final static HashMap<String, String> tokenMap = new HashMap<String, String>() {{
|
// private final static HashMap<String, String> tokenMap = new HashMap<String, String>() {{
|
||||||
put("Authorization", "Bearer b96dad1eb4f84c41bae651162aeacdd3");
|
// put("Authorization", "Bearer b96dad1eb4f84c41bae651162aeacdd3");
|
||||||
}};
|
// }};
|
||||||
|
|
||||||
|
|
||||||
private static String Push_URL;
|
private static String Push_URL;
|
||||||
|
private static String FLXT_TOKEN;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
||||||
new QFilter[]{new QFilter("number", QCP.equals, "FLXT_CreatRule_Url")});
|
new QFilter[]{new QFilter("number", QCP.equals, "FLXT_CreatRule_Url")});
|
||||||
Push_URL = url != null ? url.getString("name") : null;
|
Push_URL = url != null ? url.getString("name") : null;
|
||||||
|
DynamicObject token = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
||||||
|
new QFilter[]{new QFilter("number", QCP.equals, "FLXT_TOKEN")});
|
||||||
|
FLXT_TOKEN = token != null ? token.getString("name") : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("name");
|
||||||
|
e.getFieldKeys().add("tqq9_rulestype");
|
||||||
|
e.getFieldKeys().add("tqq9_startdate");
|
||||||
|
e.getFieldKeys().add("tqq9_enddate");
|
||||||
|
e.getFieldKeys().add("tqq9_supplier");
|
||||||
|
e.getFieldKeys().add("tqq9_estimatepro");
|
||||||
|
e.getFieldKeys().add("tqq9_targetamount");
|
||||||
|
e.getFieldKeys().add("tqq9_rebatebrand");
|
||||||
|
e.getFieldKeys().add("tqq9_rebategoods");
|
||||||
|
e.getFieldKeys().add("tqq9_rebatesub");
|
||||||
|
e.getFieldKeys().add("tqq9_guangzhoulici");
|
||||||
|
e.getFieldKeys().add("tqq9_shanghailici");
|
||||||
|
e.getFieldKeys().add("tqq9_beijinglichi");
|
||||||
|
e.getFieldKeys().add("tqq9_gzlcbl");
|
||||||
|
e.getFieldKeys().add("tqq9_shlcbl");
|
||||||
|
e.getFieldKeys().add("tqq9_bjlcbl");
|
||||||
|
e.getFieldKeys().add("tqq9_excl_start_base");
|
||||||
|
e.getFieldKeys().add("tqq9_excl_end_base");
|
||||||
|
e.getFieldKeys().add("tqq9_proportion");
|
||||||
|
e.getFieldKeys().add("tqq9_istax");
|
||||||
|
e.getFieldKeys().add("tqq9_rebatesettlespe");
|
||||||
|
e.getFieldKeys().add("tqq9_cal_amt");
|
||||||
|
e.getFieldKeys().add("tqq9_calc_procurement");
|
||||||
|
e.getFieldKeys().add("tqq9_excludnum");
|
||||||
|
e.getFieldKeys().add("tqq9_startexcludate");
|
||||||
|
e.getFieldKeys().add("tqq9_endexcludate");
|
||||||
|
e.getFieldKeys().add("tqq9_exclunopur");
|
||||||
|
e.getFieldKeys().add("tqq9_exclupur");
|
||||||
|
e.getFieldKeys().add("tqq9_purchaseorder");
|
||||||
|
e.getFieldKeys().add("tqq9_rebateamount");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -47,7 +88,9 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement
|
||||||
super.afterExecuteOperationTransaction(e);
|
super.afterExecuteOperationTransaction(e);
|
||||||
for (DynamicObject dataEntity : e.getDataEntities()) {
|
for (DynamicObject dataEntity : e.getDataEntities()) {
|
||||||
// HashMap<String, Object> bodyMap = new HashMap<>();
|
// HashMap<String, Object> bodyMap = new HashMap<>();
|
||||||
JSONObject bodyMap=new JSONObject();
|
HashMap<String, String> tokenMap = new HashMap<String, String>();
|
||||||
|
tokenMap.put("Authorization", FLXT_TOKEN);
|
||||||
|
JSONObject bodyMap = new JSONObject();
|
||||||
String name = dataEntity.getString("name");//规则名称
|
String name = dataEntity.getString("name");//规则名称
|
||||||
String tqq9_rulestype = dataEntity.getString("tqq9_rulestype");//规则类型
|
String tqq9_rulestype = dataEntity.getString("tqq9_rulestype");//规则类型
|
||||||
Integer type = Integer.valueOf(tqq9_rulestype);//规则类型
|
Integer type = Integer.valueOf(tqq9_rulestype);//规则类型
|
||||||
|
|
@ -60,20 +103,20 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement
|
||||||
DynamicObjectCollection tqq9_supplier = dataEntity.getDynamicObjectCollection("tqq9_supplier");//返利供应商
|
DynamicObjectCollection tqq9_supplier = dataEntity.getDynamicObjectCollection("tqq9_supplier");//返利供应商
|
||||||
StringBuilder supplierIds = new StringBuilder();
|
StringBuilder supplierIds = new StringBuilder();
|
||||||
for (DynamicObject dynamicObject : tqq9_supplier) {
|
for (DynamicObject dynamicObject : tqq9_supplier) {
|
||||||
supplierIds.append(",").append(dynamicObject.getString("tqq9_ztsupplierid"));
|
supplierIds.append(",").append(dynamicObject.getDynamicObject("fbasedataid").getString("id"));
|
||||||
}
|
}
|
||||||
BigDecimal tqq9_estimatepro = dataEntity.getBigDecimal("tqq9_estimatepro");//预测比例
|
BigDecimal tqq9_estimatepro = dataEntity.getBigDecimal("tqq9_estimatepro");//预测比例
|
||||||
BigDecimal tqq9_targetamount = dataEntity.getBigDecimal("tqq9_targetamount");//预测总金额
|
BigDecimal tqq9_targetamount = dataEntity.getBigDecimal("tqq9_targetamount");//预测总金额
|
||||||
DynamicObjectCollection tqq9_rebatebrand = dataEntity.getDynamicObjectCollection("tqq9_rebatebrand");//返利品牌
|
DynamicObjectCollection tqq9_rebatebrand = dataEntity.getDynamicObjectCollection("tqq9_rebatebrand");//返利品牌
|
||||||
StringBuilder rebatebrandIds = new StringBuilder();
|
StringBuilder rebatebrandIds = new StringBuilder();
|
||||||
for (DynamicObject dynamicObject : tqq9_rebatebrand) {
|
for (DynamicObject dynamicObject : tqq9_rebatebrand) {
|
||||||
rebatebrandIds.append(",").append(dynamicObject.getString("tqq9_ztbrandid"));
|
rebatebrandIds.append(",").append(dynamicObject.getDynamicObject("fbasedataid").getString("id"));
|
||||||
}
|
}
|
||||||
DynamicObjectCollection tqq9_rebategoods = dataEntity.getDynamicObjectCollection("tqq9_rebategoods");//返利商品
|
DynamicObjectCollection tqq9_rebategoods = dataEntity.getDynamicObjectCollection("tqq9_rebategoods");//返利商品
|
||||||
StringBuilder rebategoodsIds = new StringBuilder();
|
StringBuilder rebategoodsIds = new StringBuilder();
|
||||||
if (tqq9_rebategoods.size() > 0) {
|
if (tqq9_rebategoods.size() > 0) {
|
||||||
for (DynamicObject dynamicObject : tqq9_rebategoods) {
|
for (DynamicObject dynamicObject : tqq9_rebategoods) {
|
||||||
rebategoodsIds.append(",").append(dynamicObject.getString("number"));
|
rebategoodsIds.append(",").append(dynamicObject.getDynamicObject("fbasedataid").getString("number"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String tqq9_rebatesub = dataEntity.getString("tqq9_rebatesub");//分配类型
|
String tqq9_rebatesub = dataEntity.getString("tqq9_rebatesub");//分配类型
|
||||||
|
|
@ -153,11 +196,11 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement
|
||||||
bodyMap.put("type", type);
|
bodyMap.put("type", type);
|
||||||
bodyMap.put("startTime", startTimeString);
|
bodyMap.put("startTime", startTimeString);
|
||||||
bodyMap.put("endTime", tqq9_enddateString);
|
bodyMap.put("endTime", tqq9_enddateString);
|
||||||
bodyMap.put("supplierIds", supplierIds.substring(1));
|
bodyMap.put("supplierIds", (supplierIds.length() == 0) ? null : supplierIds.substring(1));
|
||||||
bodyMap.put("predictedProportion", tqq9_estimatepro);
|
bodyMap.put("predictedProportion", tqq9_estimatepro);
|
||||||
bodyMap.put("predictedAggregateMoney", tqq9_targetamount);
|
bodyMap.put("predictedAggregateMoney", tqq9_targetamount);
|
||||||
bodyMap.put("brandIds", rebatebrandIds.substring(1));
|
bodyMap.put("brandIds", (rebatebrandIds.length() == 0) ? null : rebatebrandIds.substring(1));
|
||||||
bodyMap.put("productIds", rebategoodsIds.substring(1));
|
bodyMap.put("productIds", (rebategoodsIds.length() == 0) ? null : rebategoodsIds.substring(1));
|
||||||
bodyMap.put("distributeType", distributeType);
|
bodyMap.put("distributeType", distributeType);
|
||||||
bodyMap.put("distributeCity", distributeCity);
|
bodyMap.put("distributeCity", distributeCity);
|
||||||
bodyMap.put("isTax", isTax);
|
bodyMap.put("isTax", isTax);
|
||||||
|
|
@ -173,9 +216,15 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement
|
||||||
String tqq9_excludnum = dataEntity.getString("tqq9_excludnum");//排除后基数
|
String tqq9_excludnum = dataEntity.getString("tqq9_excludnum");//排除后基数
|
||||||
Integer isInclude = Integer.valueOf(tqq9_excludnum);//计算采购指标
|
Integer isInclude = Integer.valueOf(tqq9_excludnum);//计算采购指标
|
||||||
Date tqq9_startexcludate = dataEntity.getDate("tqq9_startexcludate");//排除返利计算开始时间
|
Date tqq9_startexcludate = dataEntity.getDate("tqq9_startexcludate");//排除返利计算开始时间
|
||||||
String noStartTime = String.valueOf(tqq9_startexcludate.getTime());
|
String noStartTime = null;
|
||||||
|
String noEndTime = null;
|
||||||
|
if (tqq9_startexcludate != null) {
|
||||||
|
noStartTime = String.valueOf(tqq9_startexcludate.getTime());
|
||||||
|
}
|
||||||
Date tqq9_endexcludate = dataEntity.getDate("tqq9_endexcludate");//排除返利计算结束时间
|
Date tqq9_endexcludate = dataEntity.getDate("tqq9_endexcludate");//排除返利计算结束时间
|
||||||
String noEndTime = String.valueOf(tqq9_endexcludate.getTime());
|
if (tqq9_endexcludate != null) {
|
||||||
|
noEndTime = String.valueOf(tqq9_endexcludate.getTime());
|
||||||
|
}
|
||||||
Integer noStatus = 0;
|
Integer noStatus = 0;
|
||||||
if (tqq9_startexcludate != null && tqq9_endexcludate != null) {
|
if (tqq9_startexcludate != null && tqq9_endexcludate != null) {
|
||||||
noStatus = 1;
|
noStatus = 1;
|
||||||
|
|
@ -184,36 +233,36 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement
|
||||||
StringBuilder exclunopurIds = new StringBuilder();
|
StringBuilder exclunopurIds = new StringBuilder();
|
||||||
if (tqq9_exclunopur.size() > 0) {
|
if (tqq9_exclunopur.size() > 0) {
|
||||||
for (DynamicObject dynamicObject : tqq9_exclunopur) {
|
for (DynamicObject dynamicObject : tqq9_exclunopur) {
|
||||||
exclunopurIds.append(",").append(dynamicObject.getString("id"));
|
exclunopurIds.append(",").append(dynamicObject.getDynamicObject("fbasedataid").getString("billno"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObjectCollection tqq9_exclupur = dataEntity.getDynamicObjectCollection("tqq9_exclupur");//排除采购订单
|
DynamicObjectCollection tqq9_exclupur = dataEntity.getDynamicObjectCollection( "tqq9_exclupur");//排除采购订单
|
||||||
StringBuilder exclupurIds = new StringBuilder();
|
StringBuilder exclupurIds = new StringBuilder();
|
||||||
if (tqq9_exclupur.size() > 0) {
|
if (tqq9_exclupur.size() > 0) {
|
||||||
for (DynamicObject dynamicObject : tqq9_exclunopur) {
|
for (DynamicObject dynamicObject : tqq9_exclunopur) {
|
||||||
exclupurIds.append(",").append(dynamicObject.getString("id"));
|
exclupurIds.append(",").append(dynamicObject.getDynamicObject("fbasedataid").getString("billno"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bodyMap.put("noOrderIds", exclupurIds.substring(1));
|
bodyMap.put("noOrderIds", (exclupurIds.length() == 0) ? null : exclupurIds.substring(1));
|
||||||
bodyMap.put("calculationMoneyType", calculationMoneyType);
|
bodyMap.put("calculationMoneyType", calculationMoneyType);
|
||||||
bodyMap.put("calculationPurchaseType", calculationPurchaseType);
|
bodyMap.put("calculationPurchaseType", calculationPurchaseType);
|
||||||
bodyMap.put("calculationProportion", calculationProportion);
|
bodyMap.put("calculationProportion", calculationProportion);
|
||||||
bodyMap.put("isInclude", isInclude);
|
bodyMap.put("isInclude", isInclude);
|
||||||
bodyMap.put("noStartTime", noStartTime);
|
bodyMap.put("noStartTime", noStartTime);
|
||||||
bodyMap.put("noEndTime", noEndTime);
|
bodyMap.put("noEndTime", noEndTime);
|
||||||
bodyMap.put("noTimeOrderIds", exclunopurIds);
|
bodyMap.put("noTimeOrderIds", (exclunopurIds.length() == 0) ? null : exclunopurIds.substring(1));
|
||||||
bodyMap.put("noStatus", noStatus);
|
bodyMap.put("noStatus", noStatus);
|
||||||
} else {
|
} else {
|
||||||
DynamicObjectCollection tqq9_purchaseorder = dataEntity.getDynamicObjectCollection("tqq9_purchaseorder");//特殊订单
|
DynamicObjectCollection tqq9_purchaseorder = dataEntity.getDynamicObjectCollection("tqq9_purchaseorder");//特殊订单
|
||||||
StringBuilder purchaseorderIds = new StringBuilder();
|
StringBuilder purchaseorderIds = new StringBuilder();
|
||||||
if (tqq9_purchaseorder.size() > 0) {
|
if (tqq9_purchaseorder.size() > 0) {
|
||||||
for (DynamicObject dynamicObject : tqq9_purchaseorder) {
|
for (DynamicObject dynamicObject : tqq9_purchaseorder) {
|
||||||
purchaseorderIds.append(",").append(dynamicObject.getString("id"));
|
purchaseorderIds.append(",").append(dynamicObject.getDynamicObject("fbasedataid").getString("billno"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal tqq9_rebateamount = dataEntity.getBigDecimal("tqq9_rebateamount");//返利金额
|
BigDecimal tqq9_rebateamount = dataEntity.getBigDecimal("tqq9_rebateamount");//返利金额
|
||||||
bodyMap.put("orderIds", purchaseorderIds);
|
bodyMap.put("orderIds", (purchaseorderIds.length() == 0) ? null : purchaseorderIds.substring(1));
|
||||||
bodyMap.put("returnMoney", tqq9_rebateamount);
|
bodyMap.put("returnMoney", tqq9_rebateamount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,8 +271,8 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement
|
||||||
try {
|
try {
|
||||||
String bodyString = HttpRequestUtils.postJson(Push_URL, bodyMap.toString(), tokenMap);
|
String bodyString = HttpRequestUtils.postJson(Push_URL, bodyMap.toString(), tokenMap);
|
||||||
JSONObject map = gson.fromJson(bodyString, JSONObject.class);
|
JSONObject map = gson.fromJson(bodyString, JSONObject.class);
|
||||||
Boolean data = map.getBoolean("data");
|
Integer data = map.getInteger("data");
|
||||||
if (!data) {
|
if (data == null) {
|
||||||
this.getOperationResult().setMessage("返利规则:" + name + ",审核时创建返利规则失败");
|
this.getOperationResult().setMessage("返利规则:" + name + ",审核时创建返利规则失败");
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue