Compare commits

..

No commits in common. "c32f3dc2ccedb2efb7e21e903d4f86e45c4408bd" and "52398adc76761cd0a91b8f82fc16415257709097" have entirely different histories.

2 changed files with 0 additions and 374 deletions

View File

@ -1,55 +0,0 @@
package tqq9.lc123.cloud.app.plugin.operate.ap;
import com.alibaba.fastjson.JSONObject;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
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 java.util.List;
/**
* 暂估应付单提交后推送泛微
*/
public class ApBusBillSubmitToFwOp extends AbstractOperationServicePlugIn {
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
OperationResult operationResult = this.getOperationResult();
List<Object> successPkIds = operationResult.getSuccessPkIds();
for (Object successPkId : successPkIds) {
DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "ap_busbill");
DynamicObject billtype = bill.getDynamicObject("billtype");
if (null != billtype) {
//采购费用暂估
String number = billtype.getString("number");
if ("ap_busbill_purfee_BT_S".equals(number)) {
String resultStr = FWImpl.pushFwApBusBill(bill);
if (StringUtils.isNotBlank(resultStr)) {
JSONObject resultObj = JSONObject.parseObject(resultStr);
String code = resultObj.getString("code");
if ("SUCCESS".equals(code)) {
bill.set("tqq9_issuccess", true);
JSONObject data = resultObj.getJSONObject("data");
if (data != null) {
String requestid = data.getString("requestid");
bill.set("tqq9_fwrequestid", requestid);
SaveServiceHelper.save(new DynamicObject[]{bill});
}
}
}
}
}
}
}
}

View File

@ -2851,323 +2851,4 @@ public class FWImpl {
*/
return null;
}
/**
* 暂估应付单推送泛微
*/
public static String pushFwApBusBill(DynamicObject bill) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String tqq9_fwrequestid = bill.getString("tqq9_fwrequestid");//泛微流程ID
String billno = bill.getString("billno");//流程编号
DynamicObject creator = bill.getDynamicObject("creator");//创建人
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(), "bos_user", "tqq9_fwuserid,id,number");
String sqr = creator.getString("tqq9_fwuserid");//申请人
String bm = null;//部门
DynamicObject tqq9_dept = bill.getDynamicObject("tqq9_dept");//创建部门
if (tqq9_dept != null) {
String number = tqq9_dept.getString("number");
bm = FWUtils.getFwOrgNumberByKdOrgNumber(number);
}
Date createtime = bill.getDate("createtime");
String sqrq = sdf.format(createtime);//申请日期
DynamicObject org = bill.getDynamicObject("org");
String orgNumber = org.getString("number");
String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber);//业务归属
int djlx = 0;//单据类型 0-采购费用暂估
Date bizdate = bill.getDate("bizdate");
String djrq = sdf.format(bizdate);//单据日期
DynamicObject payorg = bill.getDynamicObject("payorg");
String fkzz = null;//付款组织
if (null != payorg) {
String payOrgNumber = payorg.getString("number");
fkzz = FWUtils.getFwOrgNumberByKdOrgNumber(payOrgNumber);
}
//001 预付后付
//002 款到发货
//003 货到付款
//004 月末结账
int fkfs = 0;// 付款方式 0-货到付款 1-款到发货 2-预付后付 3-月末结账
DynamicObject paycond = bill.getDynamicObject("paycond");//付款条件
if (null != paycond) {
String number = paycond.getString("number");
if ("003".equals(number)) {
fkfs = 0;
} else if ("002".equals(number)) {
fkfs = 1;
} else if ("001".equals(number)) {
fkfs = 2;
} else if ("004".equals(number)) {
fkfs = 3;
}
}
String fktj = null;//付款条件
String purmode = bill.getString("purmode");//付款方式
if ("CASH".equals(purmode)) {
fktj = "现购";
} else if ("CREDIT".equals(purmode)) {
fktj = "赊购";
}
//0-现金 1-电汇 2-信用证 3-票据 4-供应链金融
//1 JSFS01 现金
//2 JSFS04 电汇
//3 JSFS08 信用证到单
//4 JSFS09 应收票据背书
//5 JSFS12 票据退票
//6 JSFS16_S 信用证开立
//7 LC001 供应链金融
int jsfs = 0;
DynamicObject settlementtype = bill.getDynamicObject("settlementtype");
if (settlementtype != null) {
String number = settlementtype.getString("number");
if ("JSFS01".equals(number)) {
jsfs = 0;
} else if ("JSFS04".equals(number)) {
jsfs = 1;
} else if ("JSFS08".equals(number) || "JSFS16_S".equals(number)) {
jsfs = 2;
} else if ("JSFS09".equals(number) || "JSFS12".equals(number)) {
jsfs = 3;
} else if ("LC001".equals(number)) {
jsfs = 4;
}
}
//0-全电普票 1-全电专票 2-形式发票 3-其他发票
//全电普票 SP00001_S
//全电专票 SP00002_S
//其他发票 SP00003_S
//形式发票 SP00004_S
int fplb = 0;
DynamicObject invoicebiztype = bill.getDynamicObject("invoicebiztype");
if (null != invoicebiztype) {
String number = invoicebiztype.getString("number");
if ("SP00001_S".equals(number)) {
fplb = 0;
} else if ("SP00002_S".equals(number)) {
fplb = 1;
} else if ("SP00004_S".equals(number)) {
fplb = 2;
} else if ("SP00003_S".equals(number)) {
fplb = 3;
}
}
int kxxz = 0;//款项性质 0-材料采购
int djzt = 0;//单据状态 0-审核中 1-已审核
String bz = bill.getString("remark");//备注
BigDecimal yfje = bill.getBigDecimal("pricetaxtotal");//应付金额
BigDecimal se = bill.getBigDecimal("tax");//税额
//0- 1-
int sflrhsj = 0;//是否录入含税价
boolean isincludetax = bill.getBoolean("isincludetax");
if (isincludetax) {
sflrhsj = 0;
} else {
sflrhsj = 1;
}
int sflrzj;//是否录入总价
boolean ispricetotal = bill.getBoolean("ispricetotal");
if (ispricetotal) {
sflrzj = 0;
} else {
sflrzj = 1;
}
int sffyft;//是否费用分摊 isincludetax
boolean isexpensealloc = bill.getBoolean("isexpensealloc");
if (isexpensealloc) {
sffyft = 0;
} else {
sffyft = 1;
}
String jsgys = null;
DynamicObject asstact = bill.getDynamicObject("asstact");
if (null != asstact) {
jsgys = asstact.getString("number");
}
JSONObject detail1 = new JSONObject();
JSONArray recordsArr1 = new JSONArray();
DynamicObjectCollection entries = bill.getDynamicObjectCollection("entry");
for (DynamicObject entry : entries) {
//1 001 运费
//2 002 运杂费
//3 003 质保金/押金
//4 004 维修费
// 0-运费 1-运杂费 2-质保金
int fyxm = 0;//费用项目
DynamicObject e_expenseitem = entry.getDynamicObject("e_expenseitem");
if (e_expenseitem != null) {
String number = e_expenseitem.getString("number");
if ("001".equals(number)) {
fyxm = 0;
} else if ("002".equals(number)) {
fyxm = 1;
} else if ("003".equals(number)) {
fyxm = 2;
}
}
String jldw = null;//计量单位
DynamicObject e_measureunit = entry.getDynamicObject("e_measureunit");
if (null != e_measureunit) {
jldw = e_measureunit.getString("name");
}
BigDecimal sl = entry.getBigDecimal("e_quantity");//数量
BigDecimal hsdj = entry.getBigDecimal("e_taxunitprice");//含税单价
BigDecimal rage = entry.getBigDecimal("e_taxrate");//税率
BigDecimal entry_se = entry.getBigDecimal("e_tax");//税额
BigDecimal entry_yfje = entry.getBigDecimal("e_pricetaxtotal");//应付金额
JSONObject e1 = new JSONObject();
e1.put("fieldName", "fyxm");
e1.put("fieldValue", fyxm);
JSONObject e2 = new JSONObject();
e2.put("fieldName", "jldw");
e2.put("fieldValue", jldw);
JSONObject e3 = new JSONObject();
e3.put("fieldName", "sl");
e3.put("fieldValue", sl == null || sl.compareTo(BigDecimal.ZERO) == 0 ? 0 : sl);
JSONObject e4 = new JSONObject();
e4.put("fieldName", "hsdj");
e4.put("fieldValue", hsdj == null || hsdj.compareTo(BigDecimal.ZERO) == 0 ? 0 : hsdj);
JSONObject e5 = new JSONObject();
e5.put("fieldName", "rage");
e5.put("fieldValue", rage == null || rage.compareTo(BigDecimal.ZERO) == 0 ? 0 : rage);
JSONObject e6 = new JSONObject();
e6.put("fieldName", "se");
e6.put("fieldValue", entry_se == null || entry_se.compareTo(BigDecimal.ZERO) == 0 ? 0 : entry_se);
JSONObject e7 = new JSONObject();
e7.put("fieldName", "yfje");
e7.put("fieldValue", entry_yfje == null || entry_yfje.compareTo(BigDecimal.ZERO) == 0 ? 0 : entry_yfje);
List<JSONObject> elist = Arrays.asList(e1, e2, e3, e4, e5, e6, e7);
JSONArray recordsArr = new JSONArray();
recordsArr.addAll(elist);
JSONObject recordObj = new JSONObject();
recordObj.put("recordOrder", 0);
recordObj.put("workflowRequestTableFields", recordsArr);
recordsArr1.add(recordObj);
}
detail1.put("tableDBName", "formtable_main_107_dt1");
detail1.put("workflowRequestTableRecords", recordsArr1);
if (StringUtils.isNotBlank(tqq9_fwrequestid)) {
detail1.put("deleteAll", "1");
}
JSONArray detailRootArr = new JSONArray();
detailRootArr.add(detail1);
//构建主表数据
JSONObject m1 = new JSONObject();//
m1.put("fieldName", "KDBillType");
m1.put("fieldValue", "ap_busbill");
JSONObject m2 = new JSONObject();//
m2.put("fieldName", "lcbh");
m2.put("fieldValue", billno);
JSONObject m3 = new JSONObject();//
m3.put("fieldName", "sqr");
m3.put("fieldValue", sqr);
JSONObject m4 = new JSONObject();//
m4.put("fieldName", "bm");
m4.put("fieldValue", bm);
JSONObject m5 = new JSONObject();//
m5.put("fieldName", "sqrq");
m5.put("fieldValue", sqrq);
JSONObject m6 = new JSONObject();//
m6.put("fieldName", "ywgz");
m6.put("fieldValue", ywgz);
JSONObject m7 = new JSONObject();//
m7.put("fieldName", "djlx");
m7.put("fieldValue", djlx);
JSONObject m8 = new JSONObject();//
m8.put("fieldName", "djrq");
m8.put("fieldValue", djrq);
JSONObject m9 = new JSONObject();//
m9.put("fieldName", "fkzz");
m9.put("fieldValue", fkzz);
JSONObject m10 = new JSONObject();//fkfs
m10.put("fieldName", "fplb");
m10.put("fieldValue", fplb);
JSONObject m11 = new JSONObject();//
m11.put("fieldName", "kxxz");
m11.put("fieldValue", kxxz);
JSONObject m12 = new JSONObject();//
m12.put("fieldName", "djzt");
m12.put("fieldValue", djzt);
JSONObject m13 = new JSONObject();//
m13.put("fieldName", "yfje");
m13.put("fieldValue", yfje == null || yfje.compareTo(BigDecimal.ZERO) == 0 ? 0 : yfje);
JSONObject m14 = new JSONObject();//
m14.put("fieldName", "fkfs");
m14.put("fieldValue", fkfs);
JSONObject m15 = new JSONObject();//
m15.put("fieldName", "bz");
m15.put("fieldValue", bz);
JSONObject m16 = new JSONObject();//
m16.put("fieldName", "sflrhsj");
m16.put("fieldValue", sflrhsj);
JSONObject m17 = new JSONObject();//
m17.put("fieldName", "se");
m17.put("fieldValue", se == null || se.compareTo(BigDecimal.ZERO) == 0 ? 0 : se);
JSONObject m18 = new JSONObject();//
m18.put("fieldName", "fktj");
m18.put("fieldValue", fktj);
JSONObject m19 = new JSONObject();//
m19.put("fieldName", "jsfs");
m19.put("fieldValue", jsfs);
JSONObject m20 = new JSONObject();//
m20.put("fieldName", "sflrzj");
m20.put("fieldValue", sflrzj);
JSONObject m21 = new JSONObject();//
m21.put("fieldName", "sffyft");
m21.put("fieldValue", sffyft);
JSONObject m22 = new JSONObject();//
m22.put("fieldName", "jsgys");
m22.put("fieldValue", jsgys);
List<JSONObject> mlist = new ArrayList<>(Arrays.asList(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16,
m17, m18, m19, m20, m21, m22));
JSONArray mainArr = new JSONArray();
mainArr.addAll(mlist);
String fw_wfid_zgyfd = ConfigUtils.getThirdConfigByNumber("FW_WFID_ZGYFD");
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
//如果单据上纯在泛微流程id重新提交调用泛微提交接口如果没有泛微流程id就调用新增接口
return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "采购费用申请流程", fw_wfid_zgyfd, billno, tqq9_fwrequestid);
}
}