创建OA包以及销售订单和付款单

This commit is contained in:
hecan 2024-09-18 17:07:09 +08:00
parent 6b4bf0edb1
commit 9fbfa51c52
6 changed files with 412 additions and 0 deletions

View File

@ -0,0 +1,4 @@
package com.hzya.frame.plugin.dgx.oa.dao;
public interface ISalesOrderDao {
}

View File

@ -0,0 +1,9 @@
package com.hzya.frame.plugin.dgx.oa.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.dgx.oa.dao.ISalesOrderDao;
import org.springframework.stereotype.Repository;
@Repository(value = "SalesOrderDaoImpl")
public class SalesOrderDaoImpl extends MybatisGenericDao implements ISalesOrderDao {
}

View File

@ -0,0 +1,27 @@
package com.hzya.frame.plugin.dgx.oa.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
public interface IPaymentOrderService extends IBaseService {
/**
*
* @content 将OA付款单推送德广信U9C
* @Param
* @Return
* @Author hecan
* @Date 2024-09-06 15:32
* **/
Object queryPaymentOrderToU9C(JSONObject json);
/**
*
* @content 更新推送状态
* @Param
* @Return
* @Author hecan
* @Date 2024-09-18 17:01
* **/
Integer updatePaymentOrderStatus(JSONObject json);
}

View File

@ -0,0 +1,48 @@
package com.hzya.frame.plugin.dgx.oa.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
public interface ISalesOrderService extends IBaseService {
/**
*
* @content 查询OA销售订单数据推送到U9C
* @Param
* @Return
* @Author hecan
* @Date 2024-09-06 14:29
* **/
Object querySalesOrderToU9C(JSONObject json);
/**
*
* @content 将OA中已审核得销售订单推送U9C
* @Param
* @Return
* @Author hecan
* @Date 2024-09-06 16:59
* **/
Object querySalesOrderToU9CByAudit(JSONObject json);
/**
*
* @content 获取数据源以及头部参数
* @Param
* @Return
* @Author hecan
* @Date 2024-09-06 17:56
* **/
SysExtensionApiEntity getHeadsParasm(SysExtensionApiEntity sysExtensionApiEntity);
/**
*
* @content 更新推送状态
* @Param
* @Return
* @Author hecan
* @Date 2024-09-18 16:57
* **/
Integer updateSalesOrderStatus(JSONObject json);
}

View File

@ -0,0 +1,129 @@
package com.hzya.frame.plugin.dgx.oa.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.plugin.dgx.oa.service.IPaymentOrderService;
import com.hzya.frame.web.entity.BaseResult;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
@Service(value = "PaymentOrderServiceImpl")
public class PaymentOrderServiceImpl extends BaseService implements IPaymentOrderService {
//将付款单推送U9C
@Override
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 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;
}
@Override
public Integer updatePaymentOrderStatus(JSONObject json) {
return null;
}
}

View File

@ -0,0 +1,195 @@
package com.hzya.frame.plugin.dgx.oa.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.plugin.dgx.oa.service.ISalesOrderService;
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 org.apache.commons.collections.CollectionUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service(value = "SalesOrderServiceImpl")
public class SalesOrderServiceImpl extends BaseService implements ISalesOrderService {
@Autowired
private ISysApplicationDatabaseDao sysApplicationDatabaseDao;
//查询OA销售订单传递U9C
@Override
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());
}*/
try {
JSONObject jsonMain=new JSONObject();
jsonMain.put("OrgCode","浙江德广信电子科技股份有限公司");//组织
jsonMain.put("DocumentType","S01");//单据类型
jsonMain.put("DocNo","20240914XH");//单号
jsonMain.put("OrderBy","厦门仪迈环保科技有限公司");//客户
jsonMain.put("BusinessDate","2024-09-14");//日期
jsonMain.put("SaleDepartment","-2263079745369980889");//部门
jsonMain.put("Seller","");//业务员
jsonMain.put("IsPriceIncludeTax",true);//价格是否含税
jsonMain.put("Memo","测试销售订单");//备注
JSONArray jsonArray=new JSONArray();
JSONObject jsonDetails=new JSONObject();
jsonDetails.put("ShipTogetherFlag","-1");//成套发货标志
jsonDetails.put("TradePath","");//贸易路径
jsonDetails.put("DocLineNo","10");//行号
jsonDetails.put("ItemCode","LH01");//料号
jsonDetails.put("OrderByQtyTU","1");//数量
jsonDetails.put("OrderByQtyPU","1");//计价数量
jsonDetails.put("FinallyPriceTC","1");//最终价
jsonDetails.put("NetMoneyTC","1");//未税价格
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){
logger.info("========OA销售订单推送U9C失败:{}=========",e.getMessage());
}
return null;
}
//将已审核得销售订单传递U9C
@Override
public Object querySalesOrderToU9CByAudit(JSONObject json) {
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
public Integer updateSalesOrderStatus(JSONObject json) {
return null;
}
}