parent
79090ce005
commit
bf0cd28b0d
|
|
@ -1,25 +1,16 @@
|
|||
package tqq9.lc123.cloud.app.plugin.operate.pm;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.FWUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 采购申请单
|
||||
|
|
@ -35,7 +26,7 @@ public class PurApplySubmitToFwPlugin extends AbstractOperationServicePlugIn {
|
|||
List<Object> successPkIds = operationResult.getSuccessPkIds();
|
||||
for (Object successPkId : successPkIds) {
|
||||
DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "pm_purapplybill");
|
||||
String resultStr = FWImpl.pushFwPurApply(bill);
|
||||
FWImpl.pushFwPurApply(bill)
|
||||
if(StringUtils.isNotBlank(resultStr)){
|
||||
JSONObject resultObj = JSONObject.parseObject(resultStr);
|
||||
String code = resultObj.getString("code");
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class FWImpl {
|
|||
}
|
||||
}
|
||||
DynamicObject creator = dataEntity.getDynamicObject("creator");//创建人
|
||||
String tqq9_fwuserid= "363";
|
||||
String tqq9_fwuserid= null;
|
||||
if(creator != null){
|
||||
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(), creator.getDynamicObjectType().getName(), "id,name,number,tqq9_fwuserid");
|
||||
tqq9_fwuserid = creator.getString("tqq9_fwuserid");
|
||||
|
|
@ -59,7 +59,468 @@ public class FWImpl {
|
|||
mainTable.put("bmbm", bmbm);
|
||||
|
||||
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
|
||||
return fwRestfulUtils.doAction("api/cube/restful/interface/saveOrUpdateModeData/CK", mainTable, tqq9_fwuserid, "推送仓库信息", number);
|
||||
return fwRestfulUtils.pushBaseData(mainTable, tqq9_fwuserid, number, "bd_warehouse", null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 采购供应商推送泛微
|
||||
* @param bill
|
||||
* @return
|
||||
*/
|
||||
public static String syncSupplier(DynamicObject bill){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String gysmc = bill.getString("name");
|
||||
String gysbh = bill.getString("number");
|
||||
DynamicObject creator = bill.getDynamicObject("creator");
|
||||
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(), "bos_user", "tqq9_fwuserid,id,number");
|
||||
String cjr = creator.getString("tqq9_fwuserid");
|
||||
Date createtime = bill.getDate("createtime");
|
||||
String cjsj = sdf.format(createtime);
|
||||
String cjbm = null;
|
||||
DynamicObject tqq9_dept = bill.getDynamicObject("tqq9_dept");
|
||||
if(tqq9_dept != null){
|
||||
String number = tqq9_dept.getString("number");
|
||||
cjbm = FWUtils.getFwOrgNumberByKdOrgNumber(number);
|
||||
}
|
||||
DynamicObject org = bill.getDynamicObject("org");
|
||||
String orgNumber = org.getString("number");
|
||||
String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber);
|
||||
int gysfl = 0;
|
||||
String tqq9_combofield5_gysfl = bill.getString("tqq9_combofield5_gysfl");
|
||||
if ("02".equals(tqq9_combofield5_gysfl)){
|
||||
gysfl = 1;
|
||||
}
|
||||
|
||||
String cjlx = "";
|
||||
String tqq9_mulcombofield = bill.getString("tqq9_mulcombofield");
|
||||
if(StringUtils.isNotBlank(tqq9_mulcombofield)){
|
||||
if(tqq9_mulcombofield.contains("A")){
|
||||
cjlx = cjlx + "," + "0";
|
||||
}
|
||||
if(tqq9_mulcombofield.contains("B")){
|
||||
cjlx = cjlx + "," + "1";
|
||||
}
|
||||
if(StringUtils.isNotBlank(cjlx)){
|
||||
cjlx = cjlx.substring(1);
|
||||
}
|
||||
}
|
||||
String gysqyzz = "";
|
||||
String tqq9_mulcombofield1 = bill.getString("tqq9_mulcombofield1");
|
||||
if(StringUtils.isNotBlank(tqq9_mulcombofield1)){
|
||||
if(tqq9_mulcombofield1.contains("A")){
|
||||
gysqyzz = gysqyzz + "," + "0";
|
||||
}
|
||||
if(tqq9_mulcombofield1.contains("B")){
|
||||
gysqyzz = gysqyzz + "," + "1";
|
||||
}
|
||||
if(tqq9_mulcombofield1.contains("C")){
|
||||
gysqyzz = gysqyzz + "," + "2";
|
||||
}
|
||||
if(StringUtils.isNotBlank(gysqyzz)){
|
||||
gysqyzz = gysqyzz.substring(1);
|
||||
}
|
||||
}
|
||||
int oazt = 0;
|
||||
int sfnbgys = 1;
|
||||
boolean chkisinternalcompany = bill.getBoolean("chkisinternalcompany");
|
||||
if (chkisinternalcompany){
|
||||
sfnbgys = 0;
|
||||
}
|
||||
String nbywdy = null;
|
||||
DynamicObject internal_company = bill.getDynamicObject("internal_company");
|
||||
if(internal_company != null){
|
||||
nbywdy = internal_company.getString("name");
|
||||
}
|
||||
int sfylqx = 1;
|
||||
boolean tqq9_sfylqx = bill.getBoolean("tqq9_sfylqx");
|
||||
if(tqq9_sfylqx){
|
||||
sfylqx = 0;
|
||||
}
|
||||
int sfcggys = 1;
|
||||
boolean tqq9_ispur = bill.getBoolean("tqq9_ispur");
|
||||
if (tqq9_ispur){
|
||||
sfcggys = 0;
|
||||
}
|
||||
int zzsyzxyxts = bill.getInt("tqq9_minvaliddays");
|
||||
int sfyyyzz = 1;
|
||||
boolean tqq9_gysyyzz = bill.getBoolean("tqq9_gysyyzz");
|
||||
if(tqq9_gysyyzz){
|
||||
sfyyyzz = 0;
|
||||
}
|
||||
int sfyylqxscxkz = 1;
|
||||
boolean tqq9_gysylqxscxkz = bill.getBoolean("tqq9_gysylqxscxkz");
|
||||
if(tqq9_gysylqxscxkz){
|
||||
sfyylqxscxkz = 0;
|
||||
}
|
||||
int sfyylqxjyxkz = 1;
|
||||
boolean tqq9_gysylqxjyxkz = bill.getBoolean("tqq9_gysylqxjyxkz");
|
||||
if(tqq9_gysylqxjyxkz){
|
||||
sfyylqxjyxkz = 0;
|
||||
}
|
||||
int sfydelylqxjybapz = 1;
|
||||
boolean tqq9_gysdelylqxjybapz = bill.getBoolean("tqq9_gysdelylqxjybapz");
|
||||
if(tqq9_gysdelylqxjybapz){
|
||||
sfydelylqxjybapz = 0;
|
||||
}
|
||||
int sfyyljgzhxkz = 1;
|
||||
boolean tqq9_gysyljgzxxkz = bill.getBoolean("tqq9_gysyljgzxxkz");
|
||||
if(tqq9_gysyljgzxxkz){
|
||||
sfyyljgzhxkz = 0;
|
||||
}
|
||||
int sfyhzpxkz = 1;
|
||||
boolean tqq9_gyshzpxkz = bill.getBoolean("tqq9_gyshzpxkz");
|
||||
if(tqq9_gyshzpxkz){
|
||||
sfyhzpxkz = 0;
|
||||
}
|
||||
int sfyzlbzs = 1;
|
||||
boolean tqq9_gyszlbzs = bill.getBoolean("tqq9_gyszlbzs");
|
||||
if(tqq9_gyszlbzs){
|
||||
sfyzlbzs = 0;
|
||||
}
|
||||
int sfyfrwtsqs = 1;
|
||||
boolean tqq9_gysfrwtsqs = bill.getBoolean("tqq9_gysfrwtsqs");
|
||||
if(tqq9_gysfrwtsqs){
|
||||
sfyfrwtsqs = 0;
|
||||
}
|
||||
String bz = bill.getString("tqq9_bzgys");
|
||||
String tyshxydm = bill.getString("tqq9_textfield33");
|
||||
String yyzzbh = bill.getString("tqq9_textfield13");
|
||||
String fddbr = bill.getString("tqq9_textfield210");
|
||||
String clrq = null;
|
||||
Date tqq9_datefield51 = bill.getDate("tqq9_datefield51");
|
||||
if(tqq9_datefield51 != null){
|
||||
clrq = sdf.format(tqq9_datefield51);
|
||||
}
|
||||
String qsrq = null;
|
||||
Date tqq9_yyzzqsrq1 = bill.getDate("tqq9_yyzzqsrq1");
|
||||
if(tqq9_yyzzqsrq1 != null){
|
||||
qsrq = sdf.format(tqq9_yyzzqsrq1);
|
||||
}
|
||||
String sxrq = null;
|
||||
Date tqq9_datefield91 = bill.getDate("tqq9_datefield91");
|
||||
if(tqq9_datefield91 != null){
|
||||
sxrq = sdf.format(tqq9_datefield91);
|
||||
}
|
||||
String zczb = bill.getString("tqq9_textfield3_zczb1");
|
||||
String zs = bill.getString("tqq9_textfield4_zs1");
|
||||
int ylxs = 1;
|
||||
boolean tqq9_yyzzsfylxs1 = bill.getBoolean("tqq9_yyzzsfylxs1");
|
||||
if (tqq9_yyzzsfylxs1){
|
||||
ylxs = 0;
|
||||
}
|
||||
String ylqxscxkzbh = bill.getString("tqq9_textfield18");
|
||||
String qymc2 = bill.getString("tqq9_textfield22");
|
||||
String fddbr2 = bill.getString("tqq9_textfield19");
|
||||
String qyfzr2 = bill.getString("tqq9_textfield15");
|
||||
String zs2 = bill.getString("tqq9_textfield20");
|
||||
String scdz2 = bill.getString("tqq9_textfield21");
|
||||
String qsrq2 = null;
|
||||
Date tqq9_datefield = bill.getDate("tqq9_datefield");
|
||||
if(tqq9_datefield != null){
|
||||
qsrq2 = sdf.format(tqq9_datefield);
|
||||
}
|
||||
String sxrq2 = null;
|
||||
Date tqq9_datefield1 = bill.getDate("tqq9_datefield1");
|
||||
if(tqq9_datefield1 != null){
|
||||
sxrq2 = sdf.format(tqq9_datefield1);
|
||||
}
|
||||
String scfwelcpfl = "";
|
||||
DynamicObjectCollection tqq9_scfwelcpfl = bill.getDynamicObjectCollection("tqq9_scfwelcpfl");
|
||||
for (DynamicObject exclunopur : tqq9_scfwelcpfl) {
|
||||
long id = exclunopur.getLong("fbasedataid.id");
|
||||
exclunopur = BusinessDataServiceHelper.loadSingle(id, "tqq9_reggoodstype", "id,name,number");
|
||||
scfwelcpfl = scfwelcpfl + "," + exclunopur.getString("name");
|
||||
}
|
||||
if(StringUtils.isNotBlank(scfwelcpfl)){
|
||||
scfwelcpfl = scfwelcpfl.substring(1);
|
||||
}
|
||||
String scfwslcpfl = "";
|
||||
DynamicObjectCollection tqq9_scfwslcpfl = bill.getDynamicObjectCollection("tqq9_scfwslcpfl");
|
||||
for (DynamicObject exclunopur : tqq9_scfwslcpfl) {
|
||||
long id = exclunopur.getLong("fbasedataid.id");
|
||||
exclunopur = BusinessDataServiceHelper.loadSingle(id, "tqq9_reggoodstype", "id,name,number");
|
||||
scfwslcpfl = scfwslcpfl + "," + exclunopur.getString("name");
|
||||
}
|
||||
if(StringUtils.isNotBlank(scfwslcpfl)){
|
||||
scfwslcpfl = scfwslcpfl.substring(1);
|
||||
}
|
||||
String ylqxjyxkzbh = bill.getString("tqq9_textfield16");
|
||||
String qymc3 = bill.getString("tqq9_textfield17");
|
||||
String jyfs = bill.getString("tqq9_textfield27");
|
||||
String zs3 = bill.getString("tqq9_textfield28");
|
||||
String jycs3 = bill.getString("tqq9_jycs");
|
||||
String kfdz3 = bill.getString("tqq9_kfdz");
|
||||
String fddbr111 = bill.getString("tqq9_fddbr");
|
||||
String qyfzr111 = bill.getString("tqq9_textfield7");
|
||||
String qsrq111 = null;
|
||||
Date tqq9_datefield20 = bill.getDate("tqq9_datefield20");
|
||||
if(tqq9_datefield20 != null){
|
||||
qsrq111 = sdf.format(tqq9_datefield20);
|
||||
}
|
||||
String sxrq111 = null;
|
||||
Date tqq9_datefield21 = bill.getDate("tqq9_datefield21");
|
||||
if(tqq9_datefield21 != null){
|
||||
sxrq111 = sdf.format(tqq9_datefield21);
|
||||
}
|
||||
String scfwslcpfl111 = "";
|
||||
DynamicObjectCollection tqq9_jyfwslcpfl = bill.getDynamicObjectCollection("tqq9_jyfwslcpfl");
|
||||
for (DynamicObject exclunopur : tqq9_jyfwslcpfl) {
|
||||
long id = exclunopur.getLong("fbasedataid.id");
|
||||
exclunopur = BusinessDataServiceHelper.loadSingle(id, "tqq9_reggoodstype", "id,name,number");
|
||||
scfwslcpfl111 = scfwslcpfl111 + "," + exclunopur.getString("name");
|
||||
}
|
||||
if(StringUtils.isNotBlank(scfwslcpfl111)){
|
||||
scfwslcpfl111 = scfwslcpfl111.substring(1);
|
||||
}
|
||||
String delylqxjybah = bill.getString("tqq9_textfield26");
|
||||
String qymc4 = bill.getString("tqq9_textfield24");
|
||||
String jyfs4 = bill.getString("tqq9_textfield8");
|
||||
String zs4 = bill.getString("tqq9_textfield25");
|
||||
String jycs4 = bill.getString("tqq9_textfield23");
|
||||
String kfdz4 = bill.getString("tqq9_textfield9");
|
||||
String fddbr4 = bill.getString("tqq9_textfield10");
|
||||
String qyfzr4 = bill.getString("tqq9_textfield11");
|
||||
String scfwelcpfl4 = "";
|
||||
DynamicObjectCollection tqq9_jyfwelcpfl = bill.getDynamicObjectCollection("tqq9_jyfwelcpfl");
|
||||
for (DynamicObject exclunopur : tqq9_jyfwelcpfl) {
|
||||
long id = exclunopur.getLong("fbasedataid.id");
|
||||
exclunopur = BusinessDataServiceHelper.loadSingle(id, "tqq9_reggoodstype", "id,name,number");
|
||||
scfwelcpfl4 = scfwelcpfl4 + "," + exclunopur.getString("name");
|
||||
}
|
||||
if(StringUtils.isNotBlank(scfwelcpfl4)){
|
||||
scfwelcpfl4 = scfwelcpfl4.substring(1);
|
||||
}
|
||||
String barq = null;
|
||||
Date tqq9_datefield4 = bill.getDate("tqq9_datefield4");
|
||||
if(tqq9_datefield4 != null){
|
||||
barq = sdf.format(tqq9_datefield4);
|
||||
}
|
||||
String yljgmc = bill.getString("tqq9_textfield29");
|
||||
String dz5 = bill.getString("tqq9_textfield30");
|
||||
String djh5 = bill.getString("tqq9_textfield31");
|
||||
String fddbr5 = bill.getString("tqq9_textfield32");
|
||||
String zyfzr5 = bill.getString("tqq9_zyfzr");
|
||||
String zlxm5 = bill.getString("tqq9_textfield12");
|
||||
String qsrq5 = null;
|
||||
Date tqq9_datefield6 = bill.getDate("tqq9_datefield6");
|
||||
if(tqq9_datefield6 != null){
|
||||
qsrq5 = sdf.format(tqq9_datefield6);
|
||||
}
|
||||
String sxrq5 = null;
|
||||
Date tqq9_datefield22 = bill.getDate("tqq9_datefield22");
|
||||
if(tqq9_datefield22 != null){
|
||||
sxrq5 = sdf.format(tqq9_datefield22);
|
||||
}
|
||||
String xkzh = bill.getString("tqq9_textxkzh");
|
||||
String xkzbfrq = null;
|
||||
Date tqq9_licensestartdate = bill.getDate("tqq9_licensestartdate");
|
||||
if(tqq9_licensestartdate != null){
|
||||
xkzbfrq = sdf.format(tqq9_licensestartdate);
|
||||
}
|
||||
String xkzjzrq = null;
|
||||
Date tqq9_licenseenddate = bill.getDate("tqq9_licenseenddate");
|
||||
if(tqq9_licenseenddate != null){
|
||||
xkzjzrq = sdf.format(tqq9_licenseenddate);
|
||||
}
|
||||
int syyxts = bill.getInt("tqq9_integerfield");
|
||||
String qymc6 = bill.getString("tqq9_qymc");
|
||||
String zlbzxyyxqz = null;
|
||||
Date tqq9_zlbzxyyxqz = bill.getDate("tqq9_zlbzxyyxqz");
|
||||
if(tqq9_zlbzxyyxqz != null){
|
||||
zlbzxyyxqz = sdf.format(tqq9_zlbzxyyxqz);
|
||||
}
|
||||
int syyxts5 = bill.getInt("tqq9_validdays_zlbz");
|
||||
String ryxm = bill.getString("tqq9_ryxm");
|
||||
String sfzh = bill.getString("tqq9_sfz");
|
||||
String qyrq6 = null;
|
||||
Date tqq9_qyrq = bill.getDate("tqq9_qyrq");
|
||||
if(tqq9_qyrq != null){
|
||||
qyrq6 = sdf.format(tqq9_qyrq);
|
||||
}
|
||||
String tyrq6 = null;
|
||||
Date tqq9_datefield7 = bill.getDate("tqq9_datefield7");
|
||||
if(tqq9_datefield7 != null){
|
||||
tyrq6 = sdf.format(tqq9_datefield7);
|
||||
}
|
||||
String sqcpx = bill.getString("tqq9_textfield37");
|
||||
String sqqy = bill.getString("tqq9_textfield41");
|
||||
String lxdh = bill.getString("tqq9_textfield42");
|
||||
int syyxts6 = bill.getInt("tqq9_validdays_frsq");
|
||||
String qylx = null;
|
||||
String tqq9_combofield31 = bill.getString("tqq9_combofield31");
|
||||
if("A".equals(tqq9_combofield31)){
|
||||
qylx = "0";
|
||||
}else if("B".equals(tqq9_combofield31)){
|
||||
qylx = "1";
|
||||
}else if("C".equals(tqq9_combofield31)){
|
||||
qylx = "2";
|
||||
}else if("D".equals(tqq9_combofield31)){
|
||||
qylx = "3";
|
||||
}else if("E".equals(tqq9_combofield31)){
|
||||
qylx = "4";
|
||||
}else if("F".equals(tqq9_combofield31)){
|
||||
qylx = "5";
|
||||
}
|
||||
String bgyy = bill.getString("tqq9_bgyy");
|
||||
String bgms = bill.getString("tqq9_bgms");
|
||||
|
||||
//联系人明细
|
||||
JSONArray recordsArr1 = new JSONArray();
|
||||
DynamicObjectCollection entry_linkman = bill.getDynamicObjectCollection("entry_linkman");
|
||||
for (DynamicObject linkman : entry_linkman) {
|
||||
String xxdz = linkman.getString("tqq9_textfield_xxdz");
|
||||
String lxr = linkman.getString("contactperson");
|
||||
String sj = linkman.getString("mobile");
|
||||
String dh = linkman.getString("phone");
|
||||
String yx = linkman.getString("email");
|
||||
int sfmr = 1;
|
||||
boolean isdefault_linkman = linkman.getBoolean("isdefault_linkman");
|
||||
if(isdefault_linkman){
|
||||
sfmr = 0;
|
||||
}
|
||||
|
||||
JSONObject et = new JSONObject();
|
||||
et.put("xxdz", xxdz);
|
||||
et.put("lxr", lxr);
|
||||
et.put("sj", sj);
|
||||
et.put("dh", dh);
|
||||
et.put("yx", yx);
|
||||
et.put("sfmr", sfmr);
|
||||
|
||||
recordsArr1.add(et);
|
||||
}
|
||||
|
||||
//银行明细
|
||||
JSONArray recordsArr2 = new JSONArray();
|
||||
DynamicObjectCollection entry_bank = bill.getDynamicObjectCollection("entry_bank");
|
||||
for (DynamicObject bankEntry : entry_bank) {
|
||||
String skfmc = bankEntry.getString("accountname");
|
||||
String khyh = null;
|
||||
DynamicObject bank = bankEntry.getDynamicObject("bank");
|
||||
if(bank != null){
|
||||
khyh = bank.getString("name");
|
||||
}
|
||||
String yhzh = bankEntry.getString("bankaccount");
|
||||
int sfmr = 1;
|
||||
boolean isdefault_bank = bankEntry.getBoolean("isdefault_bank");
|
||||
if(isdefault_bank){
|
||||
sfmr = 0;
|
||||
}
|
||||
String bze = null;
|
||||
DynamicObject currency = bankEntry.getDynamicObject("currency");
|
||||
if(currency != null){
|
||||
bze = currency.getString("number");
|
||||
}
|
||||
|
||||
JSONObject p = new JSONObject();
|
||||
p.put("skfmc", skfmc);
|
||||
p.put("khyh", khyh);
|
||||
p.put("yhzh", yhzh);
|
||||
p.put("sfmr", sfmr);
|
||||
p.put("bz", bze);
|
||||
|
||||
recordsArr2.add(p);
|
||||
}
|
||||
|
||||
//组装单头
|
||||
JSONObject mainTable = new JSONObject();
|
||||
mainTable.put("lcbh", gysbh);
|
||||
mainTable.put("cjr", cjr);
|
||||
mainTable.put("cjbm", cjbm);
|
||||
mainTable.put("cjsj", cjsj);
|
||||
mainTable.put("gysbh", gysbh);
|
||||
mainTable.put("gysfl", gysfl);
|
||||
mainTable.put("cjlx", cjlx);
|
||||
mainTable.put("sfnbgys", sfnbgys);
|
||||
mainTable.put("nbywdy", nbywdy);
|
||||
mainTable.put("sfylqx", sfylqx);
|
||||
mainTable.put("oazt", "1");
|
||||
mainTable.put("sfcggys", sfcggys);
|
||||
mainTable.put("gysqyzz", gysqyzz);
|
||||
mainTable.put("zzsyzxyxts", zzsyzxyxts);
|
||||
mainTable.put("sfyyyzz", sfyyyzz);
|
||||
mainTable.put("sfyylqxscxkz", sfyylqxscxkz);
|
||||
mainTable.put("sfyylqxjyxkz", sfyylqxjyxkz);
|
||||
mainTable.put("sfydelylqxjybapz", sfydelylqxjybapz);
|
||||
mainTable.put("sfyyljgzhxkz", sfyyljgzhxkz);
|
||||
mainTable.put("sfyhzpxkz", sfyhzpxkz);
|
||||
mainTable.put("sfyzlbzs", sfyzlbzs);
|
||||
mainTable.put("sfyfrwtsqs", sfyfrwtsqs);
|
||||
mainTable.put("bz", bz);
|
||||
mainTable.put("qymc", gysmc);
|
||||
mainTable.put("qylx", qylx);
|
||||
mainTable.put("tyshxydm", tyshxydm);
|
||||
mainTable.put("yyzzbh", yyzzbh);
|
||||
mainTable.put("fddbr", fddbr);
|
||||
mainTable.put("clrq", clrq);
|
||||
mainTable.put("qsrq", qsrq);
|
||||
mainTable.put("sxrq", sxrq);
|
||||
mainTable.put("zczb", zczb);
|
||||
mainTable.put("zs", zs);
|
||||
mainTable.put("ylxs", ylxs);
|
||||
mainTable.put("ylqxscxkzbh", ylqxscxkzbh);
|
||||
mainTable.put("qymc2", qymc2);
|
||||
mainTable.put("fddbr2", fddbr2);
|
||||
mainTable.put("qyfzr2", qyfzr2);
|
||||
mainTable.put("zs2", zs2);
|
||||
mainTable.put("scdz2", scdz2);
|
||||
mainTable.put("qsrq2", qsrq2);
|
||||
mainTable.put("sxrq2", sxrq2);
|
||||
mainTable.put("scfwelcpfl", scfwelcpfl);
|
||||
mainTable.put("scfwslcpfl", scfwslcpfl);
|
||||
mainTable.put("ylqxjyxkzbh", ylqxjyxkzbh);
|
||||
mainTable.put("qymc3", qymc3);
|
||||
mainTable.put("jyfs", jyfs);
|
||||
mainTable.put("zs3", zs3);
|
||||
mainTable.put("jycs3", jycs3);
|
||||
mainTable.put("kfdz3", kfdz3);
|
||||
mainTable.put("qsrq111", qsrq111);
|
||||
mainTable.put("sxrq111", sxrq111);
|
||||
mainTable.put("scfwslcpfl111", scfwslcpfl111);
|
||||
mainTable.put("fddbr111", fddbr111);
|
||||
mainTable.put("qyfzr111", qyfzr111);
|
||||
mainTable.put("delylqxjybah", delylqxjybah);
|
||||
mainTable.put("qymc4", qymc4);
|
||||
mainTable.put("jyfs4", jyfs4);
|
||||
mainTable.put("zs4", zs4);
|
||||
mainTable.put("jycs4", jycs4);
|
||||
mainTable.put("kfdz4", kfdz4);
|
||||
mainTable.put("fddbr4", fddbr4);
|
||||
mainTable.put("qyfzr4", qyfzr4);
|
||||
mainTable.put("scfwelcpfl4", scfwelcpfl4);
|
||||
mainTable.put("barq", barq);
|
||||
mainTable.put("yljgmc", yljgmc);
|
||||
mainTable.put("dz5", dz5);
|
||||
mainTable.put("djh5", djh5);
|
||||
mainTable.put("fddbr5", fddbr5);
|
||||
mainTable.put("zyfzr5", zyfzr5);
|
||||
mainTable.put("zlxm5", zlxm5);
|
||||
// mainTable.put("qsrq5", qsrq5);
|
||||
// mainTable.put("sxrq5", sxrq5);
|
||||
// mainTable.put("bz5", bz5);
|
||||
mainTable.put("bgyy5", bgyy);
|
||||
mainTable.put("bgms5", bgms);
|
||||
mainTable.put("xkzh", xkzh);
|
||||
mainTable.put("xkzbfrq", xkzbfrq);
|
||||
mainTable.put("xkzjzrq", xkzjzrq);
|
||||
mainTable.put("syyxts", syyxts);
|
||||
mainTable.put("qymc6", qymc6);
|
||||
mainTable.put("zlbzxyyxqz", zlbzxyyxqz);
|
||||
mainTable.put("syyxts5", syyxts5);
|
||||
mainTable.put("ryxm", ryxm);
|
||||
mainTable.put("sfzh", sfzh);
|
||||
mainTable.put("qyrq6", qyrq6);
|
||||
mainTable.put("tyrq6", tyrq6);
|
||||
mainTable.put("sqcpx", sqcpx);
|
||||
mainTable.put("sqqy", sqqy);
|
||||
mainTable.put("lxdh", lxdh);
|
||||
mainTable.put("syyxts6", syyxts6);
|
||||
mainTable.put("KDBillType", "bd_supplier");
|
||||
mainTable.put("ywgz", ywgz);
|
||||
|
||||
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
|
||||
fwRestfulUtils.pushBaseData(mainTable, cjr, gysbh, "bd_supplier", recordsArr1, recordsArr2);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4877,24 +5338,24 @@ public class FWImpl {
|
|||
}else if ("5".equals(materialtype)){
|
||||
wllx = "特征件";
|
||||
}
|
||||
String ywzx = "";
|
||||
String ywzxdx = "";
|
||||
DynamicObjectCollection serviceattribute = bill.getDynamicObjectCollection("serviceattribute");
|
||||
for (DynamicObject attribute : serviceattribute) {
|
||||
long id = attribute.getLong("fbasedataid.id");
|
||||
attribute = BusinessDataServiceHelper.loadSingle(id, "bd_serviceattribute", "id,name,number,operatorid");
|
||||
String number = attribute.getString("number");
|
||||
if(number.contains("1001")){
|
||||
ywzx = ywzx + "," + "0";
|
||||
ywzxdx = ywzxdx + ",0";
|
||||
}else if (number.equals("2001")){
|
||||
ywzx = ywzx + "," + "1";
|
||||
ywzxdx = ywzxdx + ",1";
|
||||
}else if (number.equals("2002")){
|
||||
ywzx = ywzx + "," + "2";
|
||||
ywzxdx = ywzxdx + ",2";
|
||||
}else if (number.equals("2003")){
|
||||
ywzx = ywzx + "," + "3";
|
||||
ywzxdx = ywzxdx + ",3";
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(ywzx)){
|
||||
ywzx = ywzx.substring(1);
|
||||
if(StringUtils.isNotBlank(ywzxdx)){
|
||||
ywzxdx = ywzxdx.substring(1);
|
||||
}
|
||||
String ym = bill.getString("tqq9_ym");
|
||||
String ssbm = null;
|
||||
|
|
@ -5021,8 +5482,8 @@ public class FWImpl {
|
|||
m27.put("fieldName", "wllx");
|
||||
m27.put("fieldValue", wllx);
|
||||
JSONObject m28 = new JSONObject();
|
||||
m28.put("fieldName", "ywzx");
|
||||
m28.put("fieldValue", ywzx);
|
||||
m28.put("fieldName", "ywzxdx");
|
||||
m28.put("fieldValue", ywzxdx);
|
||||
JSONObject m29 = new JSONObject();
|
||||
m29.put("fieldName", "ym");
|
||||
m29.put("fieldValue", ym);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
|
|
@ -39,6 +40,98 @@ public class FWRestfulUtils {
|
|||
private static final String FW_password = ConfigUtils.getThirdConfigByNumber("FW_password");//获取泛微接口授权密码
|
||||
private static final String FW_appid = ConfigUtils.getThirdConfigByNumber("FW_appid");//FW_appid
|
||||
|
||||
/**
|
||||
* 推送基础资料
|
||||
* @param mainTable
|
||||
* @param fwuserid
|
||||
* @param billno
|
||||
* @param details
|
||||
* @return
|
||||
*/
|
||||
public String pushBaseData(JSONObject mainTable, String fwuserid, String billno, String entityName, JSONArray... details){
|
||||
String requestName = "推送采购供应商信息";
|
||||
|
||||
//restful接口url
|
||||
String url = FW_Main_URL + "api/cube/restful/interface/saveOrUpdateModeData/CGGYS";
|
||||
//获取时间戳
|
||||
String currentTimeTamp = getTimestamp();
|
||||
|
||||
//header
|
||||
Map<String, Object> header = new HashMap<>();
|
||||
header.put("systemid", FW_systemid);
|
||||
header.put("currentDateTime", currentTimeTamp);
|
||||
//Md5是:系统标识+密码+时间戳 并且md5加密的结果
|
||||
String md5Source = FW_systemid + FW_password + currentTimeTamp;
|
||||
String md5OfStr = getMD5Str(md5Source).toLowerCase();
|
||||
header.put("Md5",md5OfStr);
|
||||
//封装operationinfo参数
|
||||
JSONObject operationinfo = new JSONObject();
|
||||
operationinfo.put("operator", fwuserid);
|
||||
|
||||
//封装mainTable参数
|
||||
Map<String, Object> dataParam = new HashMap<>();
|
||||
dataParam.put("mainTable",mainTable);
|
||||
dataParam.put("operationinfo",operationinfo);
|
||||
if("bd_supplier".equals(entityName)){
|
||||
dataParam.put("detail1", details[0]);
|
||||
dataParam.put("detail2", details[1]);
|
||||
}
|
||||
System.out.println("===请求参数dataparam==="+dataParam);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("data",dataParam);
|
||||
|
||||
Map<String, Object>[] arr = new Map[1];
|
||||
arr[0] = dataParam;
|
||||
|
||||
Map<String, Object> datajson = new HashMap<>();
|
||||
datajson.put("header", header);
|
||||
datajson.put("data", arr);
|
||||
|
||||
//装填参数
|
||||
List<BasicNameValuePair> list = new ArrayList<>();
|
||||
list.add(new BasicNameValuePair("datajson", JSON.toJSONString(datajson)));
|
||||
|
||||
DynamicObject pushlog = BusinessDataServiceHelper.newDynamicObject("tqq9_fwpushlog");
|
||||
pushlog.set("name", requestName);
|
||||
pushlog.set("tqq9_billno", billno);
|
||||
pushlog.set("tqq9_url", url);
|
||||
pushlog.set("tqq9_header_tag", JSON.toJSONString(header));
|
||||
pushlog.set("tqq9_body_tag", JSON.toJSONString(list));
|
||||
pushlog.set("enable", "1");
|
||||
pushlog.set("status", "C");
|
||||
|
||||
//当前日期
|
||||
String currentDate = getCurrentDate();
|
||||
//当前时间
|
||||
String currentTime = getCurrentTime();
|
||||
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
CloseableHttpResponse response;// 响应类,
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
try{
|
||||
httpPost.addHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8"));
|
||||
response = httpClient.execute(httpPost);
|
||||
pushlog.set("tqq9_returnstring_tag", response.toString());
|
||||
if (response != null && response.getEntity() != null) {
|
||||
//返回信息
|
||||
String resulString = EntityUtils.toString(response.getEntity());
|
||||
System.out.println("成功"+ resulString);
|
||||
OperationServiceHelper.executeOperate("save", "tqq9_fwpushlog", new DynamicObject[]{pushlog}, OperateOption.create());
|
||||
return resulString;
|
||||
}else{
|
||||
pushlog.set("tqq9_returnstring_tag", response.toString());
|
||||
OperationServiceHelper.executeOperate("save", "tqq9_fwpushlog", new DynamicObject[]{pushlog}, OperateOption.create());
|
||||
System.out.println("获取数据失败,请查看日志"+ currentDate +" "+ currentTime);
|
||||
}
|
||||
}catch (Exception e){
|
||||
System.out.println("请求失败"+ currentDate +" "+ currentTime +"====errormsg:"+e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 第一步:
|
||||
|
|
@ -89,88 +182,6 @@ public class FWRestfulUtils {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*restful接口调用案例
|
||||
*以getModeDataPageList为例
|
||||
*/
|
||||
public String doAction(String url, JSONObject mainTable, String fwuserid, String requestName, String billno){
|
||||
CloseableHttpResponse response;// 响应类,
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
|
||||
//restful接口url
|
||||
url = FW_Main_URL + url;
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
//当前日期
|
||||
String currentDate = getCurrentDate();
|
||||
//当前时间
|
||||
String currentTime = getCurrentTime();
|
||||
//获取时间戳
|
||||
String currentTimeTamp = getTimestamp();
|
||||
|
||||
//header
|
||||
Map<String, Object> header = new HashMap<>();
|
||||
header.put("systemid", FW_systemid);
|
||||
header.put("currentDateTime", currentTimeTamp);
|
||||
//Md5是:系统标识+密码+时间戳 并且md5加密的结果
|
||||
String md5Source = FW_systemid + FW_password + currentTimeTamp;
|
||||
String md5OfStr = getMD5Str(md5Source).toLowerCase();
|
||||
header.put("Md5",md5OfStr);
|
||||
|
||||
//封装mainTable参数
|
||||
Map<String, Object> dataParam = new HashMap<>();
|
||||
dataParam.put("mainTable",mainTable);
|
||||
|
||||
//封装operationinfo参数
|
||||
JSONObject operationinfo = new JSONObject();
|
||||
operationinfo.put("operator", fwuserid);
|
||||
dataParam.put("operationinfo",operationinfo);
|
||||
System.out.println("===请求参数dataparam==="+dataParam);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("data",dataParam);
|
||||
|
||||
Map<String, Object>[] arr = new Map[1];
|
||||
arr[0] = dataParam;
|
||||
|
||||
Map<String, Object> datajson = new HashMap<>();
|
||||
datajson.put("header", header);
|
||||
datajson.put("data", arr);
|
||||
|
||||
//装填参数
|
||||
List<BasicNameValuePair> list = new ArrayList<>();
|
||||
list.add(new BasicNameValuePair("datajson", JSON.toJSONString(datajson)));
|
||||
|
||||
DynamicObject pushlog = BusinessDataServiceHelper.newDynamicObject("tqq9_fwpushlog");
|
||||
pushlog.set("name", requestName);
|
||||
pushlog.set("tqq9_billno", billno);
|
||||
pushlog.set("tqq9_url", url);
|
||||
pushlog.set("tqq9_header_tag", JSON.toJSONString(header));
|
||||
pushlog.set("tqq9_body_tag", JSON.toJSONString(list));
|
||||
pushlog.set("enable", "1");
|
||||
pushlog.set("status", "C");
|
||||
|
||||
try{
|
||||
httpPost.addHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8"));
|
||||
response = httpClient.execute(httpPost);
|
||||
pushlog.set("tqq9_returnstring_tag", response.toString());
|
||||
if (response != null && response.getEntity() != null) {
|
||||
//返回信息
|
||||
String resulString = EntityUtils.toString(response.getEntity());
|
||||
System.out.println("成功"+ resulString);
|
||||
OperationServiceHelper.executeOperate("save", "tqq9_fwpushlog", new DynamicObject[]{pushlog}, OperateOption.create());
|
||||
return resulString;
|
||||
}else{
|
||||
pushlog.set("tqq9_returnstring_tag", response.toString());
|
||||
OperationServiceHelper.executeOperate("save", "tqq9_fwpushlog", new DynamicObject[]{pushlog}, OperateOption.create());
|
||||
System.out.println("获取数据失败,请查看日志"+currentDate+" "+currentTime);
|
||||
}
|
||||
}catch (Exception e){
|
||||
System.out.println("请求失败"+currentDate+" "+currentTime+"====errormsg:"+e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用泛微流程接口
|
||||
* @param mainData
|
||||
|
|
|
|||
Loading…
Reference in New Issue