OA插件流程结束

This commit is contained in:
hecan 2024-09-26 09:55:36 +08:00
parent 0f6ee62126
commit f6dc71c3d6
6 changed files with 331 additions and 97 deletions

View File

@ -1,4 +1,10 @@
package com.hzya.frame.plugin.dgx.oa.dao; package com.hzya.frame.plugin.dgx.oa.dao;
public interface ISalesOrderDao { import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.dgx.oa.entity.SalesOrderEntity;
public interface ISalesOrderDao extends IBaseDao<SalesOrderEntity,String> {
//将U9C销售订单号回写到OA
Integer updateSalesOrderDocNo(SalesOrderEntity salesOrderEntity);
} }

View File

@ -2,8 +2,13 @@ package com.hzya.frame.plugin.dgx.oa.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.dgx.oa.dao.ISalesOrderDao; import com.hzya.frame.plugin.dgx.oa.dao.ISalesOrderDao;
import com.hzya.frame.plugin.dgx.oa.entity.SalesOrderEntity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository(value = "SalesOrderDaoImpl") @Repository(value = "SalesOrderDaoImpl")
public class SalesOrderDaoImpl extends MybatisGenericDao implements ISalesOrderDao { public class SalesOrderDaoImpl extends MybatisGenericDao<SalesOrderEntity,String> implements ISalesOrderDao {
@Override
public Integer updateSalesOrderDocNo(SalesOrderEntity salesOrderEntity) {
return super.update("SalesOrderEntity_update_DocNo",salesOrderEntity);
}
} }

View File

@ -2,6 +2,8 @@ package com.hzya.frame.plugin.dgx.oa.entity;
import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.entity.BaseEntity;
import java.util.List;
/** /**
* *
* @content 销售订单 * @content 销售订单
@ -18,9 +20,32 @@ public class SalesOrderEntity extends BaseEntity {
private String businessDate;//日期 private String businessDate;//日期
private String saleDepartment;//部门 private String saleDepartment;//部门
private String seller;//业务员 private String seller;//业务员
private String isPriceIncludeTax;//价格是否含税 private boolean isPriceIncludeTax;//价格是否含税
private String memo;//备注 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() { public String getOrgCode() {
return orgCode; return orgCode;
} }
@ -77,11 +102,11 @@ public class SalesOrderEntity extends BaseEntity {
this.seller = seller; this.seller = seller;
} }
public String getIsPriceIncludeTax() { public boolean getIsPriceIncludeTax() {
return isPriceIncludeTax; return isPriceIncludeTax;
} }
public void setIsPriceIncludeTax(String isPriceIncludeTax) { public void setIsPriceIncludeTax(boolean isPriceIncludeTax) {
this.isPriceIncludeTax = isPriceIncludeTax; this.isPriceIncludeTax = isPriceIncludeTax;
} }
@ -92,4 +117,172 @@ public class SalesOrderEntity extends BaseEntity {
public void setMemo(String memo) { public void setMemo(String memo) {
this.memo = 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;
}
} }

View File

@ -2,9 +2,10 @@ package com.hzya.frame.plugin.dgx.oa.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService; import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.plugin.dgx.oa.entity.SalesOrderEntity;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
public interface ISalesOrderService extends IBaseService { public interface ISalesOrderService extends IBaseService<SalesOrderEntity,String> {
/** /**
* *

View File

@ -1,18 +1,44 @@
package com.hzya.frame.plugin.dgx.oa.service.impl; package com.hzya.frame.plugin.dgx.oa.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; 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.ISalesOrderDao;
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.OAWorkflowEventDataEntity;
import com.hzya.frame.plugin.dgx.oa.seeyon.service.impl.CfsLogServiceImpl;
import com.hzya.frame.plugin.dgx.oa.service.IPaymentOrderService; import com.hzya.frame.plugin.dgx.oa.service.IPaymentOrderService;
import com.hzya.frame.plugin.dgx.u9c.service.impl.AcquireTokenServiceImpl;
import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.BaseResult;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service(value = "PaymentOrderServiceImpl") @Service(value = "PaymentOrderServiceImpl")
public class PaymentOrderServiceImpl extends BaseService implements IPaymentOrderService { public class PaymentOrderServiceImpl extends BaseService implements IPaymentOrderService {
@Autowired
private CfsLogServiceImpl cfsLogService;
private IPaymentOrderDao paymentOrderDao;
@Autowired
public void setPaymentOrderDao(IPaymentOrderDao dao) {
this.paymentOrderDao = dao;
this.dao=dao;
}
private static String URLTEST="http://122.224.56.190:8082";
@Autowired
private AcquireTokenServiceImpl acquireTokenService;
//将付款单推送U9C //将付款单推送U9C
@Override @Override
public Object queryPaymentOrderToU9C(JSONObject json) { public Object queryPaymentOrderToU9C(JSONObject json) {
@ -78,47 +104,42 @@ public class PaymentOrderServiceImpl extends BaseService implements IPaymentOrde
//此处调用中台上得api接口转发到付款单保存 //此处调用中台上得api接口转发到付款单保存
}*/ }*/
JSONObject jsonObject = json.getJSONObject("jsonStr");
logger.info("====付款单得formApp为:{}=====",jsonObject.getString("formApp"));
//付款单得formAppid
if(!checkStr(jsonObject.getString("formApp")) && jsonObject.getString("formApp").equals("")){
return BaseResult.getFailureMessageEntity("formApp不能为空");
}
PaymentOrderEntity paymentOrderEntity = jsonObject.toJavaObject(PaymentOrderEntity.class);
if(null == paymentOrderEntity){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
try {
String token = acquireTokenService.getToken();
logger.info("获取得德广信U9Ctoken为{}",token);
if(StrUtil.isNotEmpty(token)){
String params = JSONObject.toJSONString(paymentOrderEntity);
//调用U9C付款单新增接口
logger.info("====OA付款单传递德广信U9C得请求参数为:{}======",params);
String body = HttpRequest.post(URLTEST + "/U9C/webapi/PayBill/Create").header("toke", token).header("content-type", "application/json").body(params).execute().body();
logger.info("====OA付款单传递德广信U9C得返回参数为:{}======",body);
JSONObject jsonBody = JSONObject.parseObject(body);
JSONArray jsonArray = jsonBody.getJSONArray("Data");
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(jsonArray.get(0)));
String mCode = jsonData.getString("");
logger.info("=====德广信U9C付款单新增返回得付款订单号为:{}===",mCode);
paymentOrderEntity.setDocNo(mCode);
paymentOrderDao.updatePaymentOrderDocNo(paymentOrderEntity);
OAWorkflowEventDataEntity oaWorkflowEventDataEntity=new OAWorkflowEventDataEntity();
oaWorkflowEventDataEntity.setId(jsonObject.getString("id"));
oaWorkflowEventDataEntity.setFormApp(jsonObject.getString("formApp"));
oaWorkflowEventDataEntity.setBusinessDataStr(paymentOrderEntity.getDocNo());
cfsLogService.importCfsLog(new CfsLogEntity("销售订单","formmain_0666",oaWorkflowEventDataEntity,body));
}
}catch (Exception e){
logger.info("========OA付款单推送U9C失败:{}=========",e.getMessage());
}
JSONObject jsonMain=new JSONObject();
jsonMain.put("SrcBillOrgCode","浙江德广信电子科技股份有限公司");//来源组织
jsonMain.put("BizOrgCode","浙江德广信电子科技股份有限公司");//业务组织
jsonMain.put("DocumentTypeCode","APP001");//单据类型
jsonMain.put("PayObjType","浙江德广信电子科技股份有限公司");//付款对象
jsonMain.put("SuppCode","XM001");//供应商
jsonMain.put("SuppName","厦门仪迈环保科技有限公司");//供应商名称
jsonMain.put("SuppSiteCode","FJ001");//供应商位置
jsonMain.put("SuppSiteName","福建厦门");//供应商位置名称
jsonMain.put("CustCode","060358");//客户
jsonMain.put("CustName","杭州特阀科技有限公司");//客户名称
jsonMain.put("CustSiteCode","ZJ001");//客户位置
jsonMain.put("CustSiteName","浙江杭州");//客户位置名称
jsonMain.put("PayDate","2024-09-14");//付款日期
jsonMain.put("PCCode","C001");//币种
jsonMain.put("Note","测试付款单");//备注
JSONArray jsonArray=new JSONArray();
JSONObject jsonDetails=new JSONObject();
jsonDetails.put("LineNum","10");//行号
jsonDetails.put("SettlementMethodCode","01");//结算方式
jsonDetails.put("NoteNo","02");//票据号
jsonDetails.put("PayBkAccCode","19015801040022687");//付款银行账号
jsonDetails.put("PayBACCode","C001");//账户币种
JSONObject jsonDesc=new JSONObject();
jsonDesc.put("PrivateDescSeg2","");//睿本云订单号
jsonDetails.put("DescFlexField",jsonDesc);
JSONArray jsonArrayUseLine=new JSONArray();
JSONObject jsonPayBillUse=new JSONObject();
jsonPayBillUse.put("LineNum","10");//行号
jsonPayBillUse.put("BizOrgCode","浙江德广信电子科技股份有限公司");//业务组织
jsonPayBillUse.put("Money","9.9");//金额
jsonPayBillUse.put("SettlementFee","0.9");//手续费
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接口转发到付款单保存
return null; return null;
} }

View File

@ -1,17 +1,23 @@
package com.hzya.frame.plugin.dgx.oa.service.impl; package com.hzya.frame.plugin.dgx.oa.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; 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.ISalesOrderDao;
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.OAWorkflowEventDataEntity;
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.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.database.entity.SysApplicationDatabaseEntity;
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; 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.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -19,11 +25,28 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Service(value = "SalesOrderServiceImpl") @Service(value = "SalesOrderServiceImpl")
public class SalesOrderServiceImpl extends BaseService implements ISalesOrderService { public class SalesOrderServiceImpl extends BaseService<SalesOrderEntity,String> implements ISalesOrderService {
private ISalesOrderDao salesOrderDao;
@Autowired
public void setSalesOrderDao(ISalesOrderDao dao) {
this.salesOrderDao = dao;
this.dao=dao;
}
private static String URLTEST="http://122.224.56.190:8082";
@Autowired @Autowired
private ISysApplicationDatabaseDao sysApplicationDatabaseDao; private ISysApplicationDatabaseDao sysApplicationDatabaseDao;
@Autowired
private AcquireTokenServiceImpl acquireTokenService;
@Autowired
private CfsLogServiceImpl cfsLogService;
//查询OA销售订单传递U9C //查询OA销售订单传递U9C
@Override @Override
public Object querySalesOrderToU9C(JSONObject json) { public Object querySalesOrderToU9C(JSONObject json) {
@ -97,56 +120,41 @@ public class SalesOrderServiceImpl extends BaseService implements ISalesOrderSer
} }
}catch (Exception e){ }catch (Exception e){
logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage()); logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage());
}*/ }
return null;*/
JSONObject jsonObject = json.getJSONObject("jsonStr");
logger.info("====销售订单得formApp为:{}=====",jsonObject.getString("formApp"));
//销售订单得formAppid
if(!checkStr(jsonObject.getString("formApp")) && jsonObject.getString("formApp").equals("")){
return BaseResult.getFailureMessageEntity("formApp不能为空");
}
SalesOrderEntity salesOrderEntity = jsonObject.toJavaObject(SalesOrderEntity.class);
if(null == salesOrderEntity){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
try { try {
JSONObject jsonMain=new JSONObject(); String token = acquireTokenService.getToken();
jsonMain.put("OrgCode","浙江德广信电子科技股份有限公司");//组织 logger.info("获取得德广信U9Ctoken为{}",token);
jsonMain.put("DocumentType","S01");//单据类型 if(StrUtil.isNotEmpty(token)){
jsonMain.put("DocNo","20240914XH");//单号 String params = JSONObject.toJSONString(salesOrderEntity);
jsonMain.put("OrderBy","厦门仪迈环保科技有限公司");//客户 //调用U9C销售订单新增接口
jsonMain.put("BusinessDate","2024-09-14");//日期 logger.info("====OA销售订单传递德广信U9C得请求参数为:{}======",params);
jsonMain.put("SaleDepartment","-2263079745369980889");//部门 String body = HttpRequest.post(URLTEST + "/U9C/webapi/SO/Create").header("toke", token).header("content-type", "application/json").body(params).execute().body();
jsonMain.put("Seller","");//业务员 logger.info("====OA销售订单传递德广信U9C得返回参数为:{}======",body);
jsonMain.put("IsPriceIncludeTax",true);//价格是否含税 JSONObject jsonBody = JSONObject.parseObject(body);
jsonMain.put("Memo","测试销售订单");//备注 JSONArray jsonArray = jsonBody.getJSONArray("Data");
JSONArray jsonArray=new JSONArray(); JSONObject jsonData = JSON.parseObject(JSON.toJSONString(jsonArray.get(0)));
JSONObject jsonDetails=new JSONObject(); String mCode = jsonData.getString("m_code");
jsonDetails.put("ShipTogetherFlag","-1");//成套发货标志 logger.info("=====德广信U9C销售订单新增返回得销售订单号为:{}===",mCode);
jsonDetails.put("TradePath","");//贸易路径 salesOrderEntity.setDocNo(mCode);
jsonDetails.put("DocLineNo","10");//行号 salesOrderDao.updateSalesOrderDocNo(salesOrderEntity);
jsonDetails.put("ItemCode","LH01");//料号 OAWorkflowEventDataEntity oaWorkflowEventDataEntity=new OAWorkflowEventDataEntity();
jsonDetails.put("OrderByQtyTU","1");//数量 oaWorkflowEventDataEntity.setId(jsonObject.getString("id"));
jsonDetails.put("OrderByQtyPU","1");//计价数量 oaWorkflowEventDataEntity.setFormApp(jsonObject.getString("formApp"));
jsonDetails.put("FinallyPriceTC","1");//最终价 oaWorkflowEventDataEntity.setBusinessDataStr(salesOrderEntity.getDocNo());
jsonDetails.put("NetMoneyTC","1");//未税价格 cfsLogService.importCfsLog(new CfsLogEntity("销售订单","formmain_0666",oaWorkflowEventDataEntity,body));
jsonDetails.put("TaxMoneyTC","1");//税额 }
jsonDetails.put("DiscountTC","13%");//折扣率
jsonDetails.put("TotalMoneyTC","1");//价税合计
jsonDetails.put("PriceSource","测试");//价格来源
jsonDetails.put("TaxSchedule","YZ08");//税组合
jsonDetails.put("Memo","测试销售订单明细");//备注
jsonDetails.put("FreeType","0");//免费品类型
JSONObject jsonDesc=new JSONObject();
jsonDesc.put("PrivateDescSeg2","");//睿本云订单号
jsonDetails.put("DescFlexField",jsonDesc);
JSONArray jsonArrayLineDTO=new JSONArray();
JSONObject jsonObjectShiplineDTO=new JSONObject();
jsonObjectShiplineDTO.put("ItemCode","LH01");//料号
jsonObjectShiplineDTO.put("SupplySource","纺织业");//供应来源
jsonObjectShiplineDTO.put("DemandTransformType","纺织");//供应类型
jsonObjectShiplineDTO.put("ShiperOrg","厦门仪迈环保科技有限公司");//货主组织
jsonObjectShiplineDTO.put("SupplyOrg","厦门仪迈环保科技有限公司");//供应组织
jsonObjectShiplineDTO.put("RequireDate","2024-09-14");//交期
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){ }catch (Exception e){
logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage()); logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage());
} }