星空对接接口开发

This commit is contained in:
16358 2025-06-13 14:44:33 +08:00
parent 221eef78e8
commit 2086c976dd
4 changed files with 150 additions and 81 deletions

View File

@ -54,7 +54,6 @@ public class PoundappliServiceImpl extends ServiceImpl<PoundappliMapper, Poundap
@Override
public int insertPoundappli(Poundappli poundappli)
{
//设置编码时需要在后面拼上 |车号
poundappli.initAddFields(poundappli);
boolean save = save(poundappli);
if (save){

View File

@ -1,6 +1,9 @@
package com.ruoyi.webApi;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.bill.domain.Poundappli;
import com.ruoyi.bill.service.IPoundappliService;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysDictTypeService;
@ -11,8 +14,14 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
/**
@ -25,6 +34,8 @@ public class ApiTask {
private ISysConfigService sysConfigService;
@Autowired
private ISysDictTypeService dictTypeService;
@Autowired
private IPoundappliService poundappliService;
//登录星空接口
public String OAlogin(){
@ -128,19 +139,19 @@ public class ApiTask {
switch (dictValue){
case "SAL_DELIVERYNOTICE":
//保存数据
makePoundAppliFormData(dictValue);
makePoundAppliFormData(dictValue,oaData);
break;
case "PUR_ReceiveBill":
//保存数据
makePoundAppliFormData(dictValue);
makePoundAppliFormData(dictValue,oaData);
break;
case "STK_TRANSFERAPPLY":
//保存数据
makeMainPoundFormData(dictValue);
makeMainPoundFormData(dictValue,oaData);
break;
case "SP_InStock":
//保存数据
makeMainPoundFormData(dictValue);
makeMainPoundFormData(dictValue,oaData);
break;
default:
errorLog.append(errorCount++ + ""+ "获取数据失败!: 因未知错误导致返回参数为空!" + "\n");
@ -224,13 +235,64 @@ public class ApiTask {
return errorLog.toString();
}
//保存星空数据为中台<过磅申请>数据
public void makePoundAppliFormData(String formid){
/**
* 保存星空数据为中台<过磅申请>数据
* @param formid 星空单据id
* @param oaData 星空数据
*/
public void makePoundAppliFormData(String formid,String oaData){
// 1. oaData 解析为 JSONArray二维数组
JSONArray dataList = JSONArray.parseArray(oaData);
// 2. 遍历每一行数据
for (int i = 0; i < dataList.size(); i++) {
JSONArray row = dataList.getJSONArray(i);
String dateStr = row.getString(0); // 申请日期
DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
LocalDateTime localDateTime = LocalDateTime.parse(dateStr, formatter);
Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
String billNo = row.getString(1); // 申请单号
String carno = row.getString(2); // 车号
String company = row.getString(3); // 发货单位
String materialName = row.getString(4); // 物料名称
String specification = row.getString(5); // 物料规格
Double weight = row.getDouble(6); // 计划重量
// Double F_JLHCSL = row.getDouble(7); // 计划回传重量中台回传
// String F_YMZ = row.getString(8); // 原毛重中台回传
// String F_YPZ = row.getString(9); // 原皮重中台回传
// Integer F_JS = row.getInteger(10); // 件数中台回传
// Integer F_GMSHDW = row.getInteger(11); // 国贸收货单位中台回传
// Integer F_CYDW = row.getInteger(12); // 承运单位中台回传
// Integer F_BDMC = row.getInteger(13); // 磅点名称中台回传
String materialNumber = row.getString(14); // 物料编码
String fid = row.getString(15); // 单据头内码
String fentryid = row.getString(16); // 单据体内码
String sourceBillNo = row.getString(17); // 来源单号
// 3. 保存过磅申请
Poundappli poundappli = new Poundappli();
poundappli.setBsndt(date);
poundappli.setUsrcode(billNo);
poundappli.setCarno(carno);
poundappli.setSendunitid(Long.valueOf(company));
poundappli.setItmname(materialName);
poundappli.setSpecification(specification);
poundappli.setSrccleanmqty(new BigDecimal(weight));
poundappli.setItmno(materialNumber);
poundappli.setFid(fid);
poundappli.setFentity_fentryid(fentryid);
poundappli.setSrcbillusrcode(sourceBillNo);
poundappli.setOabilltype(formid);//星空单据类型
poundappli.setSrcbilltype("发货通知单");//来源单据类型
poundappliService.insertPoundappli(poundappli);
}
}
//保存星空数据为中台<主榜单>数据
public void makeMainPoundFormData(String formid){
/**保存星空数据为中台<主榜单>数据
* @param formid 星空单据id
* @param oaData 星空数据
*/
public void makeMainPoundFormData(String formid,String oaData){
}

View File

@ -90,78 +90,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertPoundappli" parameterType="Poundappli">
insert into t_data_poundappli
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="bllstate != null">bllstate,</if>
<if test="usrcode != null and usrcode != ''">usrcode,</if>
<if test="bsndt != null">bsndt,</if>
<if test="carno != null">carno,</if>
<if test="itmname != null">itmname,</if>
<if test="specification != null">specification,</if>
<if test="sendunitid != null">sendunitid,</if>
<if test="sendunitname != null">sendunitname,</if>
<if test="recentname != null">recentname,</if>
<if test="trnentname != null">trnentname,</if>
<if test="srcpunbll != null">srcpunbll,</if>
<if test="srcwghmqty != null">srcwghmqty,</if>
<if test="srcempmqty != null">srcempmqty,</if>
<if test="srccleanmqty != null">srccleanmqty,</if>
<if test="srcbsndt != null">srcbsndt,</if>
<if test="msrunit != null">msrunit,</if>
<if test="msrname != null">msrname,</if>
<if test="itmno != null">itmno,</if>
<if test="cardriver != null">cardriver,</if>
<if test="poundid != null">poundid,</if>
<if test="poundname != null">poundname,</if>
<if test="srcbillusrcode != null">srcbillusrcode,</if>
<if test="crtorgid != null">crtorgid,</if>
<if test="isinuse != null">isinuse,</if>
<if test="crtdt != null">crtdt,</if>
<if test="crtopr != null">crtopr,</if>
<if test="lstedtdt != null">lstedtdt,</if>
<if test="lstedtopr != null">lstedtopr,</if>
<if test="fid != null">fid,</if>
<if test="fentity_fentryid != null">fentity_fentryid,</if>
<if test="oabilltype != null">oabilltype,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="bllstate != null">#{bllstate},</if>
<if test="usrcode != null and usrcode != ''">#{usrcode},</if>
<if test="bsndt != null">#{bsndt},</if>
<if test="carno != null">#{carno},</if>
<if test="itmname != null">#{itmname},</if>
<if test="specification != null">#{specification},</if>
<if test="sendunitid != null">#{sendunitid},</if>
<if test="sendunitname != null">#{sendunitname},</if>
<if test="recentname != null">#{recentname},</if>
<if test="trnentname != null">#{trnentname},</if>
<if test="srcpunbll != null">#{srcpunbll},</if>
<if test="srcwghmqty != null">#{srcwghmqty},</if>
<if test="srcempmqty != null">#{srcempmqty},</if>
<if test="srccleanmqty != null">#{srccleanmqty},</if>
<if test="srcbsndt != null">#{srcbsndt},</if>
<if test="msrunit != null">#{msrunit},</if>
<if test="msrname != null">#{msrname},</if>
<if test="itmno != null">#{itmno},</if>
<if test="cardriver != null">#{cardriver},</if>
<if test="poundid != null">#{poundid},</if>
<if test="poundname != null">#{poundname},</if>
<if test="srcbillusrcode != null">#{srcbillusrcode},</if>
<if test="crtorgid != null">#{crtorgid},</if>
<if test="isinuse != null">#{isinuse},</if>
<if test="crtdt != null">#{crtdt},</if>
<if test="crtopr != null">#{crtopr},</if>
<if test="lstedtdt != null">#{lstedtdt},</if>
<if test="lstedtopr != null">#{lstedtopr},</if>
<if test="fid != null">#{fid},</if>
<if test="fentity_fentryid != null">#{fentity_fentryid},</if>
<if test="oabilltype != null">#{oabilltype},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
INSERT INTO t_data_poundappli
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="bllstate != null">bllstate,</if>
<if test="usrcode != null and usrcode != ''">usrcode,</if>
<if test="bsndt != null">bsndt,</if>
<if test="carno != null">carno,</if>
<if test="itmname != null">itmname,</if>
<if test="specification != null">specification,</if>
<if test="sendunitid != null">sendunitid,</if>
<if test="sendunitname != null">sendunitname,</if>
<if test="recentname != null">recentname,</if>
<if test="trnentname != null">trnentname,</if>
<if test="srcpunbll != null">srcpunbll,</if>
<if test="srcwghmqty != null">srcwghmqty,</if>
<if test="srcempmqty != null">srcempmqty,</if>
<if test="srccleanmqty != null">srccleanmqty,</if>
<if test="srcbsndt != null">srcbsndt,</if>
<if test="msrunit != null">msrunit,</if>
<if test="msrname != null">msrname,</if>
<if test="itmno != null">itmno,</if>
<if test="cardriver != null">cardriver,</if>
<if test="poundid != null">poundid,</if>
<if test="poundname != null">poundname,</if>
<if test="srcbillusrcode != null">srcbillusrcode,</if>
<if test="crtorgid != null">crtorgid,</if>
<if test="isinuse != null">isinuse,</if>
<if test="crtdt != null">crtdt,</if>
<if test="crtopr != null">crtopr,</if>
<if test="lstedtdt != null">lstedtdt,</if>
<if test="lstedtopr != null">lstedtopr,</if>
<if test="fid != null">fid,</if>
<if test="fentity_fentryid != null">fentity_fentryid,</if>
<if test="oabilltype != null">oabilltype,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="SELECT " suffix=" FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM t_data_poundappli WHERE fentity_fentryid = #{fentity_fentryid})">
<if test="id != null">#{id},</if><if test="id == null">NULL,</if>
<if test="bllstate != null">#{bllstate},</if><if test="bllstate == null">NULL,</if>
<if test="usrcode != null and usrcode != ''">#{usrcode},</if><if test="usrcode == null or usrcode == ''">NULL,</if>
<if test="bsndt != null">#{bsndt},</if><if test="bsndt == null">NULL,</if>
<if test="carno != null">#{carno},</if><if test="carno == null">NULL,</if>
<if test="itmname != null">#{itmname},</if><if test="itmname == null">NULL,</if>
<if test="specification != null">#{specification},</if><if test="specification == null">NULL,</if>
<if test="sendunitid != null">#{sendunitid},</if><if test="sendunitid == null">NULL,</if>
<if test="sendunitname != null">#{sendunitname},</if><if test="sendunitname == null">NULL,</if>
<if test="recentname != null">#{recentname},</if><if test="recentname == null">NULL,</if>
<if test="trnentname != null">#{trnentname},</if><if test="trnentname == null">NULL,</if>
<if test="srcpunbll != null">#{srcpunbll},</if><if test="srcpunbll == null">NULL,</if>
<if test="srcwghmqty != null">#{srcwghmqty},</if><if test="srcwghmqty == null">NULL,</if>
<if test="srcempmqty != null">#{srcempmqty},</if><if test="srcempmqty == null">NULL,</if>
<if test="srccleanmqty != null">#{srccleanmqty},</if><if test="srccleanmqty == null">NULL,</if>
<if test="srcbsndt != null">#{srcbsndt},</if><if test="srcbsndt == null">NULL,</if>
<if test="msrunit != null">#{msrunit},</if><if test="msrunit == null">NULL,</if>
<if test="msrname != null">#{msrname},</if><if test="msrname == null">NULL,</if>
<if test="itmno != null">#{itmno},</if><if test="itmno == null">NULL,</if>
<if test="cardriver != null">#{cardriver},</if><if test="cardriver == null">NULL,</if>
<if test="poundid != null">#{poundid},</if><if test="poundid == null">NULL,</if>
<if test="poundname != null">#{poundname},</if><if test="poundname == null">NULL,</if>
<if test="srcbillusrcode != null">#{srcbillusrcode},</if><if test="srcbillusrcode == null">NULL,</if>
<if test="crtorgid != null">#{crtorgid},</if><if test="crtorgid == null">NULL,</if>
<if test="isinuse != null">#{isinuse},</if><if test="isinuse == null">NULL,</if>
<if test="crtdt != null">#{crtdt},</if><if test="crtdt == null">NULL,</if>
<if test="crtopr != null">#{crtopr},</if><if test="crtopr == null">NULL,</if>
<if test="lstedtdt != null">#{lstedtdt},</if><if test="lstedtdt == null">NULL,</if>
<if test="lstedtopr != null">#{lstedtopr},</if><if test="lstedtopr == null">NULL,</if>
<if test="fid != null">#{fid},</if><if test="fid == null">NULL,</if>
<if test="fentity_fentryid != null">#{fentity_fentryid},</if><if test="fentity_fentryid == null">NULL,</if>
<if test="oabilltype != null">#{oabilltype},</if><if test="oabilltype == null">NULL,</if>
<if test="remark != null">#{remark},</if><if test="remark == null">NULL,</if>
</trim>
</insert>
<update id="updatePoundappli" parameterType="Poundappli">
update t_data_poundappli

View File

@ -21,6 +21,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.web.util.HtmlUtils;
/**
* 参数配置 信息操作处理
@ -87,6 +88,9 @@ public class SysConfigController extends BaseController
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
// 解码 configValue 中的 HTML 实体 &gt; -> >
if (config.getConfigValue() != null) config.setConfigValue(HtmlUtils.htmlUnescape(config.getConfigValue()));
config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config));
}
@ -103,6 +107,9 @@ public class SysConfigController extends BaseController
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
// 解码 configValue 中的 HTML 实体 &gt; -> >
if (config.getConfigValue() != null) config.setConfigValue(HtmlUtils.htmlUnescape(config.getConfigValue()));
config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config));
}