销售订单和付款单推送接口
This commit is contained in:
parent
be5f91fd11
commit
cbae49fc0a
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.plugin.dgx.oa.entity;
|
package com.hzya.frame.plugin.dgx.oa.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.hzya.frame.web.entity.BaseEntity;
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,54 +14,8 @@ import java.util.List;
|
||||||
* @Date 2024-09-06 11:52
|
* @Date 2024-09-06 11:52
|
||||||
* **/
|
* **/
|
||||||
public class SalesOrderEntity extends BaseEntity {
|
public class SalesOrderEntity extends BaseEntity {
|
||||||
private String orgCode;//组织
|
|
||||||
private String documentType;//单据类型
|
|
||||||
private String docNo;//单号
|
private String docNo;//单号
|
||||||
private String orderBy;//客户
|
|
||||||
private String businessDate;//日期
|
|
||||||
private String saleDepartment;//部门
|
|
||||||
private String seller;//业务员
|
|
||||||
private boolean isPriceIncludeTax;//价格是否含税
|
|
||||||
private String memo;//备注
|
|
||||||
|
|
||||||
private String otherID;//第三方id
|
|
||||||
private String tC;//交易币编码
|
|
||||||
private String aC;//核币编码
|
|
||||||
private String shipToSite;//收货位置编码
|
|
||||||
private String billToSite;//立账位置编码
|
|
||||||
private String bargainMode;//成交方式
|
|
||||||
private String shippingPort;//装运港
|
|
||||||
private String aimPort;//目的港
|
|
||||||
private String isRollBack;//回滚
|
|
||||||
private String autoCreateSOM;//自动创建变更单
|
|
||||||
private String autoApproveSOM;//自动审核变更单
|
|
||||||
private List<SalesOrderDetailsEntity> sOLineDTOList;//销售订单明细
|
|
||||||
|
|
||||||
private String entCode;//企业编码
|
|
||||||
private String userCode;//用户编码
|
|
||||||
private String userPwd;//用户密码
|
|
||||||
private String cultureName;//语种
|
|
||||||
private String orgID;//组织ID
|
|
||||||
private String userID;//用户ID
|
|
||||||
private String userClientID;//用户IP
|
|
||||||
private String isPeriodBeginSO;//是否是期初订单
|
|
||||||
private String confirmTermCode;//立账条件
|
|
||||||
|
|
||||||
public String getOrgCode() {
|
|
||||||
return orgCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrgCode(String orgCode) {
|
|
||||||
this.orgCode = orgCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDocumentType() {
|
|
||||||
return documentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocumentType(String documentType) {
|
|
||||||
this.documentType = documentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDocNo() {
|
public String getDocNo() {
|
||||||
return docNo;
|
return docNo;
|
||||||
|
@ -69,220 +24,4 @@ public class SalesOrderEntity extends BaseEntity {
|
||||||
public void setDocNo(String docNo) {
|
public void setDocNo(String docNo) {
|
||||||
this.docNo = docNo;
|
this.docNo = docNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrderBy() {
|
|
||||||
return orderBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderBy(String orderBy) {
|
|
||||||
this.orderBy = orderBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBusinessDate() {
|
|
||||||
return businessDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBusinessDate(String businessDate) {
|
|
||||||
this.businessDate = businessDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSaleDepartment() {
|
|
||||||
return saleDepartment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSaleDepartment(String saleDepartment) {
|
|
||||||
this.saleDepartment = saleDepartment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeller() {
|
|
||||||
return seller;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeller(String seller) {
|
|
||||||
this.seller = seller;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getIsPriceIncludeTax() {
|
|
||||||
return isPriceIncludeTax;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsPriceIncludeTax(boolean isPriceIncludeTax) {
|
|
||||||
this.isPriceIncludeTax = isPriceIncludeTax;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMemo() {
|
|
||||||
return memo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMemo(String memo) {
|
|
||||||
this.memo = memo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOtherID() {
|
|
||||||
return otherID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOtherID(String otherID) {
|
|
||||||
this.otherID = otherID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String gettC() {
|
|
||||||
return tC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void settC(String tC) {
|
|
||||||
this.tC = tC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getaC() {
|
|
||||||
return aC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setaC(String aC) {
|
|
||||||
this.aC = aC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getShipToSite() {
|
|
||||||
return shipToSite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShipToSite(String shipToSite) {
|
|
||||||
this.shipToSite = shipToSite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBillToSite() {
|
|
||||||
return billToSite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBillToSite(String billToSite) {
|
|
||||||
this.billToSite = billToSite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBargainMode() {
|
|
||||||
return bargainMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBargainMode(String bargainMode) {
|
|
||||||
this.bargainMode = bargainMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getShippingPort() {
|
|
||||||
return shippingPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShippingPort(String shippingPort) {
|
|
||||||
this.shippingPort = shippingPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAimPort() {
|
|
||||||
return aimPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAimPort(String aimPort) {
|
|
||||||
this.aimPort = aimPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsRollBack() {
|
|
||||||
return isRollBack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsRollBack(String isRollBack) {
|
|
||||||
this.isRollBack = isRollBack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAutoCreateSOM() {
|
|
||||||
return autoCreateSOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoCreateSOM(String autoCreateSOM) {
|
|
||||||
this.autoCreateSOM = autoCreateSOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAutoApproveSOM() {
|
|
||||||
return autoApproveSOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoApproveSOM(String autoApproveSOM) {
|
|
||||||
this.autoApproveSOM = autoApproveSOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SalesOrderDetailsEntity> getsOLineDTOList() {
|
|
||||||
return sOLineDTOList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setsOLineDTOList(List<SalesOrderDetailsEntity> sOLineDTOList) {
|
|
||||||
this.sOLineDTOList = sOLineDTOList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEntCode() {
|
|
||||||
return entCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEntCode(String entCode) {
|
|
||||||
this.entCode = entCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserCode() {
|
|
||||||
return userCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserCode(String userCode) {
|
|
||||||
this.userCode = userCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserPwd() {
|
|
||||||
return userPwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserPwd(String userPwd) {
|
|
||||||
this.userPwd = userPwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCultureName() {
|
|
||||||
return cultureName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCultureName(String cultureName) {
|
|
||||||
this.cultureName = cultureName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrgID() {
|
|
||||||
return orgID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrgID(String orgID) {
|
|
||||||
this.orgID = orgID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserID() {
|
|
||||||
return userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserID(String userID) {
|
|
||||||
this.userID = userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserClientID() {
|
|
||||||
return userClientID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserClientID(String userClientID) {
|
|
||||||
this.userClientID = userClientID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsPeriodBeginSO() {
|
|
||||||
return isPeriodBeginSO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsPeriodBeginSO(String isPeriodBeginSO) {
|
|
||||||
this.isPeriodBeginSO = isPeriodBeginSO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConfirmTermCode() {
|
|
||||||
return confirmTermCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConfirmTermCode(String confirmTermCode) {
|
|
||||||
this.confirmTermCode = confirmTermCode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,6 @@ public interface ISalesOrderService extends IBaseService<SalesOrderEntity,String
|
||||||
* **/
|
* **/
|
||||||
Object querySalesOrderToU9CByAudit(JSONObject json);
|
Object querySalesOrderToU9CByAudit(JSONObject json);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @content 获取数据源以及头部参数
|
|
||||||
* @Param
|
|
||||||
* @Return
|
|
||||||
* @Author hecan
|
|
||||||
* @Date 2024-09-06 17:56
|
|
||||||
* **/
|
|
||||||
SysExtensionApiEntity getHeadsParasm(SysExtensionApiEntity sysExtensionApiEntity);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @content 更新推送状态
|
* @content 更新推送状态
|
||||||
|
|
|
@ -8,9 +8,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
import com.hzya.frame.plugin.dgx.oa.dao.IPaymentOrderDao;
|
import com.hzya.frame.plugin.dgx.oa.dao.IPaymentOrderDao;
|
||||||
import com.hzya.frame.plugin.dgx.oa.dao.ISalesOrderDao;
|
|
||||||
import com.hzya.frame.plugin.dgx.oa.entity.PaymentOrderEntity;
|
import com.hzya.frame.plugin.dgx.oa.entity.PaymentOrderEntity;
|
||||||
import com.hzya.frame.plugin.dgx.oa.entity.SalesOrderEntity;
|
|
||||||
import com.hzya.frame.plugin.dgx.oa.seeyon.entity.CfsLogEntity;
|
import com.hzya.frame.plugin.dgx.oa.seeyon.entity.CfsLogEntity;
|
||||||
import com.hzya.frame.plugin.dgx.oa.seeyon.entity.OAWorkflowEventDataEntity;
|
import com.hzya.frame.plugin.dgx.oa.seeyon.entity.OAWorkflowEventDataEntity;
|
||||||
import com.hzya.frame.plugin.dgx.oa.seeyon.service.impl.CfsLogServiceImpl;
|
import com.hzya.frame.plugin.dgx.oa.seeyon.service.impl.CfsLogServiceImpl;
|
||||||
|
@ -42,104 +40,63 @@ public class PaymentOrderServiceImpl extends BaseService implements IPaymentOrde
|
||||||
//将付款单推送U9C
|
//将付款单推送U9C
|
||||||
@Override
|
@Override
|
||||||
public Object queryPaymentOrderToU9C(JSONObject json) {
|
public Object queryPaymentOrderToU9C(JSONObject json) {
|
||||||
/*JSONObject jsonObject = json.getJSONObject("jsonStr");
|
|
||||||
if(!checkStr(jsonObject.getString("formApp"))){
|
|
||||||
return BaseResult.getFailureMessageEntity("formApp不能为空");
|
|
||||||
}
|
|
||||||
JSONObject businessDataStr = jsonObject.getJSONObject("businessDataStr");
|
|
||||||
if(null!=businessDataStr){
|
|
||||||
JSONObject formmainData = businessDataStr.getJSONObject("formmain_0673");//主表
|
|
||||||
JSONArray forsonData = businessDataStr.getJSONArray("formson_0674");//明细表
|
|
||||||
JSONObject jsonMain=new JSONObject();
|
|
||||||
jsonMain.put("SrcBillOrgCode",formmainData.getString(""));//来源组织
|
|
||||||
jsonMain.put("BizOrgCode",formmainData.getString(""));//业务组织
|
|
||||||
jsonMain.put("DocumentTypeCode","APP001");//单据类型
|
|
||||||
jsonMain.put("PayObjType",formmainData.getString("field0027"));//付款对象
|
|
||||||
jsonMain.put("SuppCode",formmainData.getString("field0030"));//供应商
|
|
||||||
jsonMain.put("SuppName",formmainData.getString("field0030"));//供应商名称
|
|
||||||
jsonMain.put("SuppSiteCode",formmainData.getString("field0019"));//供应商位置
|
|
||||||
jsonMain.put("SuppSiteName",formmainData.getString("field0019"));//供应商位置名称
|
|
||||||
jsonMain.put("CustCode",formmainData.getString(""));//客户
|
|
||||||
jsonMain.put("CustName",formmainData.getString(""));//客户名称
|
|
||||||
jsonMain.put("CustSiteCode",formmainData.getString(""));//客户位置
|
|
||||||
jsonMain.put("CustSiteName",formmainData.getString(""));//客户位置名称
|
|
||||||
jsonMain.put("PayDate",formmainData.getString("field0025"));//付款日期
|
|
||||||
jsonMain.put("PCCode","C001");//币种
|
|
||||||
jsonMain.put("Note",formmainData.getString(""));//备注
|
|
||||||
if(CollectionUtils.isNotEmpty(forsonData)){
|
|
||||||
JSONArray jsonArray=new JSONArray();
|
|
||||||
for (Object forsonDatum : forsonData) {
|
|
||||||
JSONObject jsonPayBillLines = JSON.parseObject(JSON.toJSONString(forsonDatum));
|
|
||||||
JSONObject jsonDetails=new JSONObject();
|
|
||||||
jsonDetails.put("LineNum",jsonPayBillLines.getString("field0001"));//行号
|
|
||||||
jsonDetails.put("SettlementMethodCode",jsonPayBillLines.getString("field0002"));//结算方式
|
|
||||||
jsonDetails.put("NoteNo",jsonPayBillLines.getString("field0003"));//票据号
|
|
||||||
jsonDetails.put("PayBkAccCode",jsonPayBillLines.getString("field0007"));//付款银行账号
|
|
||||||
jsonDetails.put("PayBACCode",jsonPayBillLines.getString("field0008"));//账户币种
|
|
||||||
JSONObject jsonDesc=new JSONObject();
|
|
||||||
jsonDesc.put("PrivateDescSeg2",jsonPayBillLines.getString(""));//睿本云订单号
|
|
||||||
jsonDetails.put("DescFlexField",jsonDesc);
|
|
||||||
|
|
||||||
JSONArray jsonPayBillUseLines = jsonPayBillLines.getJSONArray("");//某一个属性是用来获取PayBillUseLines得
|
|
||||||
if (CollectionUtils.isNotEmpty(jsonPayBillUseLines)) {
|
|
||||||
JSONArray jsonArrayUseLine=new JSONArray();
|
|
||||||
for (Object jsonPayBillUseLine : jsonPayBillUseLines) {
|
|
||||||
JSONObject PayBillUseLine = JSON.parseObject(JSON.toJSONString(jsonPayBillUseLine));
|
|
||||||
JSONObject jsonPayBillUse=new JSONObject();
|
|
||||||
jsonPayBillUse.put("LineNum",PayBillUseLine.getString(""));//行号
|
|
||||||
jsonPayBillUse.put("BizOrgCode",PayBillUseLine.getString(""));//业务组织
|
|
||||||
jsonPayBillUse.put("Money",PayBillUseLine.getString(""));//金额
|
|
||||||
jsonPayBillUse.put("SettlementFee",PayBillUseLine.getString(""));//手续费
|
|
||||||
jsonPayBillUse.put("PayProperty","0");//用途
|
|
||||||
jsonArrayUseLine.add(jsonPayBillUse);
|
|
||||||
jsonDetails.put("PayBillUseLines",jsonArrayUseLine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jsonArray.add(jsonDetails);
|
|
||||||
jsonMain.put("PayBillLines",jsonArray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String parasm = jsonMain.toJSONString();
|
|
||||||
logger.info("====OA付款单传递德广信U9C得请求参数为:{}======",parasm);
|
|
||||||
//此处调用中台上得api接口,转发到付款单保存
|
|
||||||
}*/
|
|
||||||
|
|
||||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||||
logger.info("====付款单得formApp为:{}=====",jsonObject.getString("formApp"));
|
String formApp = jsonObject.getString("formApp");
|
||||||
|
String id = jsonObject.getString("id");
|
||||||
|
String dataSourceCode = jsonObject.getString("dataSourceCode");
|
||||||
|
logger.info("====付款单得formApp为:{}=====",formApp);
|
||||||
//付款单得formAppid
|
//付款单得formAppid
|
||||||
if(!checkStr(jsonObject.getString("formApp")) && jsonObject.getString("formApp").equals("")){
|
if(!checkStr(formApp) && formApp.equals("-4485599744122928343")){
|
||||||
return BaseResult.getFailureMessageEntity("formApp不能为空");
|
return BaseResult.getFailureMessageEntity("formApp不能为空");
|
||||||
}
|
}
|
||||||
PaymentOrderEntity paymentOrderEntity = jsonObject.toJavaObject(PaymentOrderEntity.class);
|
jsonObject.remove("formApp");
|
||||||
if(null == paymentOrderEntity){
|
jsonObject.remove("id");
|
||||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
jsonObject.remove("grpDataSourceCode");
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
String token = acquireTokenService.getToken();
|
String token = acquireTokenService.getToken();
|
||||||
logger.info("获取得德广信U9Ctoken为:{}",token);
|
logger.info("获取得德广信U9Ctoken为:{}",token);
|
||||||
if(StrUtil.isNotEmpty(token)){
|
if(StrUtil.isNotEmpty(token)){
|
||||||
String params = JSONObject.toJSONString(paymentOrderEntity);
|
String params = jsonObject.toJSONString();
|
||||||
|
JSONObject jsonObject1 = JSONObject.parseObject(params);
|
||||||
|
JSONArray jsonArray1 = new JSONArray();
|
||||||
|
jsonArray1.add(jsonObject1);
|
||||||
|
String jsonStr = String.valueOf(jsonArray1);
|
||||||
//调用U9C付款单新增接口
|
//调用U9C付款单新增接口
|
||||||
logger.info("====OA付款单传递德广信U9C得请求参数为:{}======",params);
|
logger.info("====OA付款单传递德广信U9C得请求参数为:{}======",jsonStr);
|
||||||
String body = HttpRequest.post(URLTEST + "/U9C/webapi/PayBill/Create").header("toke", token).header("content-type", "application/json").body(params).execute().body();
|
String body = HttpRequest.post(URLTEST + "/U9C/webapi/PayBill/Create").header("token", token).header("content-type", "application/json").body(jsonStr).execute().body();
|
||||||
logger.info("====OA付款单传递德广信U9C得返回参数为:{}======",body);
|
logger.info("====OA付款单传递德广信U9C得返回参数为:{}======",body);
|
||||||
JSONObject jsonBody = JSONObject.parseObject(body);
|
JSONObject jsonBody = JSONObject.parseObject(body);
|
||||||
|
if(jsonBody.getString("Success").equals("true")){
|
||||||
JSONArray jsonArray = jsonBody.getJSONArray("Data");
|
JSONArray jsonArray = jsonBody.getJSONArray("Data");
|
||||||
|
if(CollectionUtils.isNotEmpty(jsonArray)){
|
||||||
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(jsonArray.get(0)));
|
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(jsonArray.get(0)));
|
||||||
String mCode = jsonData.getString("");
|
String mCode = jsonData.getString("Code");
|
||||||
logger.info("=====德广信U9C付款单新增返回得付款订单号为:{}===",mCode);
|
logger.info("=====德广信U9C付款单新增返回得付款订单号为:{}===",mCode);
|
||||||
|
if(StrUtil.isNotEmpty(mCode)){
|
||||||
|
/* PaymentOrderEntity paymentOrderEntity=new PaymentOrderEntity();
|
||||||
paymentOrderEntity.setDocNo(mCode);
|
paymentOrderEntity.setDocNo(mCode);
|
||||||
|
paymentOrderEntity.setId(id);
|
||||||
|
paymentOrderEntity.setDataSourceCode(dataSourceCode);
|
||||||
paymentOrderDao.updatePaymentOrderDocNo(paymentOrderEntity);
|
paymentOrderDao.updatePaymentOrderDocNo(paymentOrderEntity);
|
||||||
OAWorkflowEventDataEntity oaWorkflowEventDataEntity=new OAWorkflowEventDataEntity();
|
OAWorkflowEventDataEntity oaWorkflowEventDataEntity=new OAWorkflowEventDataEntity();
|
||||||
oaWorkflowEventDataEntity.setId(jsonObject.getString("id"));
|
oaWorkflowEventDataEntity.setId(id);
|
||||||
oaWorkflowEventDataEntity.setFormApp(jsonObject.getString("formApp"));
|
oaWorkflowEventDataEntity.setFormApp(formApp);
|
||||||
oaWorkflowEventDataEntity.setBusinessDataStr(paymentOrderEntity.getDocNo());
|
oaWorkflowEventDataEntity.setBusinessDataStr(paymentOrderEntity.getDocNo());
|
||||||
cfsLogService.importCfsLog(new CfsLogEntity("销售订单","formmain_0666",oaWorkflowEventDataEntity,body));
|
cfsLogService.importCfsLog(new CfsLogEntity("销售订单","formmain_0666",oaWorkflowEventDataEntity,body));*/
|
||||||
|
return BaseResult.getSuccessMessageEntity("付款单推送成功",mCode);
|
||||||
|
}else{
|
||||||
|
return BaseResult.getFailureMessageEntity("付款单推送失败",jsonBody.getString("ResMsg"));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return BaseResult.getFailureMessageEntity("付款单推送失败",jsonBody.getString("ResMsg"));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return BaseResult.getFailureMessageEntity("付款单推送失败",jsonBody.getString("ResMsg"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("========OA付款单推送U9C失败:{}=========",e.getMessage());
|
logger.info("========OA付款单推送U9C失败:{}=========",e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,11 @@ import com.hzya.frame.plugin.dgx.oa.seeyon.service.impl.CfsLogServiceImpl;
|
||||||
import com.hzya.frame.plugin.dgx.oa.service.ISalesOrderService;
|
import com.hzya.frame.plugin.dgx.oa.service.ISalesOrderService;
|
||||||
import com.hzya.frame.plugin.dgx.u9c.service.impl.AcquireTokenServiceImpl;
|
import com.hzya.frame.plugin.dgx.u9c.service.impl.AcquireTokenServiceImpl;
|
||||||
import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao;
|
import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao;
|
||||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
|
||||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
|
||||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service(value = "SalesOrderServiceImpl")
|
@Service(value = "SalesOrderServiceImpl")
|
||||||
public class SalesOrderServiceImpl extends BaseService<SalesOrderEntity,String> implements ISalesOrderService {
|
public class SalesOrderServiceImpl extends BaseService<SalesOrderEntity,String> implements ISalesOrderService {
|
||||||
|
@ -50,115 +46,64 @@ public class SalesOrderServiceImpl extends BaseService<SalesOrderEntity,String>
|
||||||
//查询OA销售订单传递U9C
|
//查询OA销售订单传递U9C
|
||||||
@Override
|
@Override
|
||||||
public Object querySalesOrderToU9C(JSONObject json) {
|
public Object querySalesOrderToU9C(JSONObject json) {
|
||||||
/* JSONObject jsonObject = json.getJSONObject("jsonStr");
|
|
||||||
if(!checkStr(jsonObject.getString("formApp"))){
|
|
||||||
return BaseResult.getFailureMessageEntity("formApp不能为空");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
JSONObject businessDataStr = jsonObject.getJSONObject("businessDataStr");
|
|
||||||
if(null !=businessDataStr){
|
|
||||||
JSONObject formmainData = businessDataStr.getJSONObject("formmain_0666");//主表
|
|
||||||
JSONArray forsonData = businessDataStr.getJSONArray("formson_0667");//明细表
|
|
||||||
JSONObject jsonMain=new JSONObject();
|
|
||||||
jsonMain.put("OrgCode",formmainData.getString(""));//组织
|
|
||||||
jsonMain.put("DocumentType","S01");//单据类型
|
|
||||||
jsonMain.put("DocNo",formmainData.getString("field0005"));//单号
|
|
||||||
jsonMain.put("OrderBy",formmainData.getString("field0009"));//客户
|
|
||||||
jsonMain.put("BusinessDate",formmainData.getString("field0017"));//日期
|
|
||||||
jsonMain.put("SaleDepartment",formmainData.getString("field0010"));//部门
|
|
||||||
jsonMain.put("Seller",formmainData.getString("field0006"));//业务员
|
|
||||||
jsonMain.put("IsPriceIncludeTax",true);//价格是否含税
|
|
||||||
jsonMain.put("Memo",formmainData.getString("field0020"));//备注
|
|
||||||
if(CollectionUtils.isNotEmpty(forsonData)){
|
|
||||||
JSONArray jsonArray=new JSONArray();
|
|
||||||
for (Object forsonDatum : forsonData) {
|
|
||||||
JSONObject jsonSOLineDTOList = JSON.parseObject(JSON.toJSONString(forsonDatum));
|
|
||||||
JSONObject jsonDetails=new JSONObject();
|
|
||||||
jsonDetails.put("ShipTogetherFlag","-1");//成套发货标志
|
|
||||||
jsonDetails.put("TradePath",jsonSOLineDTOList.getString(""));//贸易路径
|
|
||||||
jsonDetails.put("DocLineNo",jsonSOLineDTOList.getString("field0021"));//行号
|
|
||||||
jsonDetails.put("ItemCode",jsonSOLineDTOList.getString("field0028"));//料号
|
|
||||||
jsonDetails.put("OrderByQtyTU",jsonSOLineDTOList.getString("field0031"));//数量
|
|
||||||
jsonDetails.put("OrderByQtyPU",jsonSOLineDTOList.getString(""));//计价数量
|
|
||||||
jsonDetails.put("FinallyPriceTC",jsonSOLineDTOList.getString("field0036"));//最终价
|
|
||||||
jsonDetails.put("NetMoneyTC",jsonSOLineDTOList.getString("field0039"));//未税价格
|
|
||||||
jsonDetails.put("TaxMoneyTC",jsonSOLineDTOList.getString("field0040"));//税额
|
|
||||||
jsonDetails.put("DiscountTC",jsonSOLineDTOList.getString("field0037"));//折扣率
|
|
||||||
jsonDetails.put("TotalMoneyTC",jsonSOLineDTOList.getString("field0038"));//价税合计
|
|
||||||
jsonDetails.put("PriceSource",jsonSOLineDTOList.getString(""));//价格来源
|
|
||||||
jsonDetails.put("TaxSchedule","YZ08");//税组合
|
|
||||||
jsonDetails.put("Memo",jsonSOLineDTOList.getString("field0042"));//备注
|
|
||||||
jsonDetails.put("FreeType",jsonSOLineDTOList.getString("field0034"));//免费品类型
|
|
||||||
JSONObject jsonDesc=new JSONObject();
|
|
||||||
jsonDesc.put("PrivateDescSeg2",jsonSOLineDTOList.getString(""));//睿本云订单号
|
|
||||||
jsonDetails.put("DescFlexField",jsonDesc);
|
|
||||||
|
|
||||||
JSONArray jsonSOShiplineDTOList = jsonSOLineDTOList.getJSONArray("");//某一个属性是用来获取SOShiplineDTOList得
|
|
||||||
if(CollectionUtils.isNotEmpty(jsonSOShiplineDTOList)){
|
|
||||||
JSONArray jsonArrayLineDTO=new JSONArray();
|
|
||||||
for (Object o : jsonSOShiplineDTOList) {
|
|
||||||
JSONObject jsonSOShiplineDTOListObject = JSON.parseObject(JSON.toJSONString(o));
|
|
||||||
JSONObject jsonObjectShiplineDTO=new JSONObject();
|
|
||||||
jsonObjectShiplineDTO.put("ItemCode",jsonSOLineDTOList.getString("field0028"));//料号
|
|
||||||
jsonObjectShiplineDTO.put("SupplySource",jsonSOShiplineDTOListObject.getString(""));//供应来源
|
|
||||||
jsonObjectShiplineDTO.put("DemandTransformType",jsonSOShiplineDTOListObject.getString(""));//供应类型
|
|
||||||
jsonObjectShiplineDTO.put("ShiperOrg",jsonSOShiplineDTOListObject.getString(""));//货主组织
|
|
||||||
jsonObjectShiplineDTO.put("SupplyOrg",jsonSOShiplineDTOListObject.getString(""));//供应组织
|
|
||||||
jsonObjectShiplineDTO.put("RequireDate",jsonSOShiplineDTOListObject.getString(""));//交期
|
|
||||||
jsonArrayLineDTO.add(jsonObjectShiplineDTO);
|
|
||||||
jsonDetails.put("SOShiplineDTOList",jsonArrayLineDTO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonArray.add(jsonDetails);
|
|
||||||
jsonMain.put("SOLineDTOList",jsonArray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String parasm = jsonMain.toJSONString();
|
|
||||||
logger.info("====OA销售订单传递德广信U9C得请求参数为:{}======",parasm);
|
|
||||||
//此处调用中台上得api接口,转发到销售订单保存
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage());
|
|
||||||
}
|
|
||||||
return null;*/
|
|
||||||
|
|
||||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||||
logger.info("====销售订单得formApp为:{}=====",jsonObject.getString("formApp"));
|
String formApp = jsonObject.getString("formApp");
|
||||||
|
String id = jsonObject.getString("id");
|
||||||
|
String dataSourceCode = jsonObject.getString("dataSourceCode");
|
||||||
|
logger.info("====销售订单得formApp为:{}=====",formApp);
|
||||||
//销售订单得formAppid
|
//销售订单得formAppid
|
||||||
if(!checkStr(jsonObject.getString("formApp")) && jsonObject.getString("formApp").equals("")){
|
if(!checkStr(formApp) && formApp.equals("-4485599744122928342")){
|
||||||
return BaseResult.getFailureMessageEntity("formApp不能为空");
|
return BaseResult.getFailureMessageEntity("formApp不能为空");
|
||||||
}
|
}
|
||||||
SalesOrderEntity salesOrderEntity = jsonObject.toJavaObject(SalesOrderEntity.class);
|
jsonObject.remove("formApp");
|
||||||
if(null == salesOrderEntity){
|
jsonObject.remove("id");
|
||||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
jsonObject.remove("grpDataSourceCode");
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
String token = acquireTokenService.getToken();
|
String token = acquireTokenService.getToken();
|
||||||
logger.info("获取得德广信U9Ctoken为:{}",token);
|
logger.info("获取得德广信U9Ctoken为:{}",token);
|
||||||
if(StrUtil.isNotEmpty(token)){
|
if(StrUtil.isNotEmpty(token)){
|
||||||
String params = JSONObject.toJSONString(salesOrderEntity);
|
String params = jsonObject.toJSONString();
|
||||||
|
JSONObject jsonObject1 = JSONObject.parseObject(params);
|
||||||
|
JSONArray jsonArray1 = new JSONArray();
|
||||||
|
jsonArray1.add(jsonObject1);
|
||||||
|
String jsonStr = String.valueOf(jsonArray1);
|
||||||
//调用U9C销售订单新增接口
|
//调用U9C销售订单新增接口
|
||||||
logger.info("====OA销售订单传递德广信U9C得请求参数为:{}======",params);
|
logger.info("====OA销售订单传递德广信U9C得请求参数为:{}======",jsonStr);
|
||||||
String body = HttpRequest.post(URLTEST + "/U9C/webapi/SO/Create").header("toke", token).header("content-type", "application/json").body(params).execute().body();
|
String body = HttpRequest.post(URLTEST + "/U9C/webapi/SO/Create").header("token", token).header("content-type", "application/json").body(jsonStr).execute().body();
|
||||||
logger.info("====OA销售订单传递德广信U9C得返回参数为:{}======",body);
|
logger.info("====OA销售订单传递德广信U9C得返回参数为:{}======",body);
|
||||||
JSONObject jsonBody = JSONObject.parseObject(body);
|
JSONObject jsonBody = JSONObject.parseObject(body);
|
||||||
|
if(jsonBody.getString("Success").equals("true")){
|
||||||
JSONArray jsonArray = jsonBody.getJSONArray("Data");
|
JSONArray jsonArray = jsonBody.getJSONArray("Data");
|
||||||
|
if(CollectionUtils.isNotEmpty(jsonArray)) {
|
||||||
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(jsonArray.get(0)));
|
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(jsonArray.get(0)));
|
||||||
String mCode = jsonData.getString("m_code");
|
String mCode = jsonData.getString("m_code");
|
||||||
logger.info("=====德广信U9C销售订单新增返回得销售订单号为:{}===",mCode);
|
logger.info("=====德广信U9C销售订单新增返回得销售订单号为:{}===", mCode);
|
||||||
|
if (StrUtil.isNotEmpty(mCode)) {
|
||||||
|
/*SalesOrderEntity salesOrderEntity=new SalesOrderEntity();
|
||||||
salesOrderEntity.setDocNo(mCode);
|
salesOrderEntity.setDocNo(mCode);
|
||||||
|
salesOrderEntity.setId(id);
|
||||||
|
salesOrderEntity.setDataSourceCode(dataSourceCode);
|
||||||
salesOrderDao.updateSalesOrderDocNo(salesOrderEntity);
|
salesOrderDao.updateSalesOrderDocNo(salesOrderEntity);
|
||||||
OAWorkflowEventDataEntity oaWorkflowEventDataEntity=new OAWorkflowEventDataEntity();
|
OAWorkflowEventDataEntity oaWorkflowEventDataEntity = new OAWorkflowEventDataEntity();
|
||||||
oaWorkflowEventDataEntity.setId(jsonObject.getString("id"));
|
oaWorkflowEventDataEntity.setId(id);
|
||||||
oaWorkflowEventDataEntity.setFormApp(jsonObject.getString("formApp"));
|
oaWorkflowEventDataEntity.setFormApp(formApp);
|
||||||
oaWorkflowEventDataEntity.setBusinessDataStr(salesOrderEntity.getDocNo());
|
oaWorkflowEventDataEntity.setBusinessDataStr(salesOrderEntity.getDocNo());
|
||||||
cfsLogService.importCfsLog(new CfsLogEntity("销售订单","formmain_0666",oaWorkflowEventDataEntity,body));
|
cfsLogService.importCfsLog(new CfsLogEntity("销售订单", "formmain_0666", oaWorkflowEventDataEntity, body));*/
|
||||||
|
return BaseResult.getSuccessMessageEntity("销售订单推送成功", mCode);
|
||||||
|
}else{
|
||||||
|
return BaseResult.getFailureMessageEntity("销售订单推送失败",jsonBody.getString("ResMsg"));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return BaseResult.getFailureMessageEntity("销售订单推送失败",jsonBody.getString("ResMsg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return BaseResult.getFailureMessageEntity("销售订单推送失败",jsonBody.getString("ResMsg"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage());
|
logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,32 +113,6 @@ public class SalesOrderServiceImpl extends BaseService<SalesOrderEntity,String>
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysExtensionApiEntity getHeadsParasm(SysExtensionApiEntity sysExtensionApiEntity) {
|
|
||||||
try {
|
|
||||||
Map<String, String> headers = sysExtensionApiEntity.getHeaders();
|
|
||||||
String formmainTableName = headers.get("formmainTableName");
|
|
||||||
String forsonTableName = headers.get("forsonTableName");
|
|
||||||
SysApplicationEntity applicationEntity = sysExtensionApiEntity.getReceiveApp();
|
|
||||||
SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity();
|
|
||||||
sysApplicationDatabaseEntity.setSts("Y");
|
|
||||||
sysApplicationDatabaseEntity.setAppId(applicationEntity.getId());
|
|
||||||
sysApplicationDatabaseEntity.setDataSourceCode("master");
|
|
||||||
List<SysApplicationDatabaseEntity> sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity);
|
|
||||||
if (sysDataSourceEntities != null && sysDataSourceEntities.size() > 0) {
|
|
||||||
String parm = sysExtensionApiEntity.getBodys();
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(parm);
|
|
||||||
jsonObject.put("dataSourceCode", sysDataSourceEntities.get(0).getSourceCode());
|
|
||||||
jsonObject.put("formmainTableName",formmainTableName);
|
|
||||||
jsonObject.put("forsonTableName",forsonTableName);
|
|
||||||
sysExtensionApiEntity.setBodys(jsonObject.toJSONString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch (Exception e){
|
|
||||||
logger.info("====OA销售订单获取头部参数错误:{}======",e.getMessage());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新推送状态
|
//更新推送状态
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue