增加提单功能
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.bms.price.airbill.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/** 空运提单主表 srv_bill_air */
|
||||
@Data
|
||||
public class SrvBillAir
|
||||
{
|
||||
private String guid;
|
||||
private String billCode;
|
||||
private Integer billType;
|
||||
private Integer blStatus;
|
||||
private Integer warningStatus;
|
||||
private Integer warningCount;
|
||||
private String startAirport;
|
||||
private String endAirport;
|
||||
private String desPort;
|
||||
private String routeName;
|
||||
private String airType;
|
||||
private Integer pieceNumber;
|
||||
private BigDecimal volume;
|
||||
private BigDecimal actualWeight;
|
||||
private BigDecimal actualVolume;
|
||||
private BigDecimal volumeWeight;
|
||||
private String airCompany;
|
||||
private String sendManCode;
|
||||
private String acceptManCode;
|
||||
private String dataFrom;
|
||||
private String createManCode;
|
||||
private Date createTime;
|
||||
private String modifierCode;
|
||||
private Date modifyTime;
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.bms.price.airbill.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/** 空运提单财务表 srv_bill_air_finance */
|
||||
@Data
|
||||
public class SrvBillAirFinance
|
||||
{
|
||||
private String guid;
|
||||
private String billCode;
|
||||
private Integer blCheck;
|
||||
private String checkRemark;
|
||||
private Integer blConfirm;
|
||||
private String confirmManCode;
|
||||
private Date confirmTime;
|
||||
private BigDecimal price;
|
||||
private BigDecimal amount;
|
||||
private String calcExp;
|
||||
private String calcRe;
|
||||
private String priceRemark;
|
||||
private BigDecimal baoguanFee;
|
||||
private BigDecimal baoguanOtherFee;
|
||||
private BigDecimal stockFee;
|
||||
private BigDecimal desPortAgentFee;
|
||||
private BigDecimal airOtherFee;
|
||||
private BigDecimal otherFee;
|
||||
private String compensateRemark;
|
||||
private String chargeManCode;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.bms.price.airbill.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/** 空运航班干线表 srv_bill_air_flight */
|
||||
@Data
|
||||
public class SrvBillAirFlight
|
||||
{
|
||||
private String guid;
|
||||
private String billCode;
|
||||
private String airNo;
|
||||
private String actualAirNo;
|
||||
private String airOmpanyAgent;
|
||||
private String desPortAgentCode;
|
||||
private String boardNo;
|
||||
private Integer bandBoxCount;
|
||||
private BigDecimal bandVolume;
|
||||
private BigDecimal bandBoxWeight;
|
||||
private BigDecimal divisorValue;
|
||||
private Date firstLandingTime;
|
||||
private Date secondTakeoffTime;
|
||||
private Date airDelayTime;
|
||||
private String trunkDestinations;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.bms.price.airbill.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/** 空运提单操作派送表 srv_bill_air_op */
|
||||
@Data
|
||||
public class SrvBillAirOp
|
||||
{
|
||||
private String guid;
|
||||
private String billCode;
|
||||
private Integer blRetrieval;
|
||||
private Date retrievalDate;
|
||||
private String retrievalManCode;
|
||||
private Integer pickBoxCount;
|
||||
private Integer pickCountReal;
|
||||
private String declareCode;
|
||||
private String clearanceCode;
|
||||
private String qingguanAgent;
|
||||
private String clearanceOpCode;
|
||||
private String stockAddr;
|
||||
private String stockOutRemark;
|
||||
private Integer deliverCount;
|
||||
private Integer firstDeliverCount;
|
||||
private Integer lastDeliverCount;
|
||||
private String acDeliverDiff;
|
||||
private String deliverEndDiff;
|
||||
private Integer checkOrderCount;
|
||||
private Integer checkLeaveCount;
|
||||
private Date internalCheckTime;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.bms.price.airbill.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/** 空运提单时效轨迹表 srv_bill_air_track */
|
||||
@Data
|
||||
public class SrvBillAirTrack
|
||||
{
|
||||
private String guid;
|
||||
private String billCode;
|
||||
private Date startTimePlan;
|
||||
private Date arriveTimePlan;
|
||||
private Date shippingDate;
|
||||
private Date startTime;
|
||||
private Date arriveTime;
|
||||
private Date arriveStockTime;
|
||||
private Date clearanceTime;
|
||||
private Date endOprateTime;
|
||||
private Integer blBgfx;
|
||||
private Date bgfxTime;
|
||||
private Date updateTimeBgfx;
|
||||
private Integer blSjqf;
|
||||
private Date sjqfTime;
|
||||
private Date updateTimeSjqf;
|
||||
private Integer blSjdd;
|
||||
private Date sjddTime;
|
||||
private Date updateTimeSjdd;
|
||||
private Integer blTzdc;
|
||||
private Date tzdcTime;
|
||||
private String updateTimeTzdc;
|
||||
private Integer blThdc;
|
||||
private Date thdcTime;
|
||||
private Date updateTimeThdc;
|
||||
private Integer blQgwc;
|
||||
private Date qgwcTime;
|
||||
private Date updateTimeQgwc;
|
||||
private Integer blGxfc;
|
||||
private Date gxfcTime;
|
||||
private String updateTimeGxfc;
|
||||
private Integer blFjh;
|
||||
private Date fjhTime;
|
||||
private String updateTimeFjh;
|
||||
private Integer blTrackGenBg;
|
||||
private Integer blTrackGenBgfx;
|
||||
private Integer blTrackGenQf;
|
||||
private Integer blTrackGenDd;
|
||||
private Integer blTrackGenQg;
|
||||
private Integer blTrackGenDc;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.bms.price.airbill.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Oracle WEISHI_USER.TAB_BILL_AIR 只读
|
||||
*/
|
||||
public interface OracleBillAirMapper
|
||||
{
|
||||
List<Map<String, Object>> selectAllBillAir();
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.bms.price.airbill.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.bms.price.airbill.domain.SrvBillAir;
|
||||
import com.bms.price.airbill.domain.SrvBillAirFinance;
|
||||
import com.bms.price.airbill.domain.SrvBillAirFlight;
|
||||
import com.bms.price.airbill.domain.SrvBillAirOp;
|
||||
import com.bms.price.airbill.domain.SrvBillAirTrack;
|
||||
|
||||
/**
|
||||
* 空运提单镜像表 upsert
|
||||
*/
|
||||
public interface SrvBillAirSyncMapper
|
||||
{
|
||||
int upsertBillAir(@Param("list") List<SrvBillAir> list);
|
||||
|
||||
int upsertBillAirFinance(@Param("list") List<SrvBillAirFinance> list);
|
||||
|
||||
int upsertBillAirFlight(@Param("list") List<SrvBillAirFlight> list);
|
||||
|
||||
int upsertBillAirOp(@Param("list") List<SrvBillAirOp> list);
|
||||
|
||||
int upsertBillAirTrack(@Param("list") List<SrvBillAirTrack> list);
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
package com.bms.price.airbill.sync;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bms.price.airbill.domain.SrvBillAir;
|
||||
import com.bms.price.airbill.domain.SrvBillAirFinance;
|
||||
import com.bms.price.airbill.domain.SrvBillAirFlight;
|
||||
import com.bms.price.airbill.domain.SrvBillAirOp;
|
||||
import com.bms.price.airbill.domain.SrvBillAirTrack;
|
||||
|
||||
/**
|
||||
* Oracle TAB_BILL_AIR -> srv_bill_air* 全量同步编排(按 guid 幂等 upsert)
|
||||
*/
|
||||
@Service
|
||||
public class BillAirSyncService
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(BillAirSyncService.class);
|
||||
|
||||
@Autowired
|
||||
private OracleBillAirReader reader;
|
||||
|
||||
@Autowired
|
||||
private BillAirSyncWriter writer;
|
||||
|
||||
public String syncFromOracle()
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
List<Map<String, Object>> rows = reader.readAll();
|
||||
List<SrvBillAir> airList = new ArrayList<>(rows.size());
|
||||
List<SrvBillAirFinance> financeList = new ArrayList<>(rows.size());
|
||||
List<SrvBillAirFlight> flightList = new ArrayList<>(rows.size());
|
||||
List<SrvBillAirOp> opList = new ArrayList<>(rows.size());
|
||||
List<SrvBillAirTrack> trackList = new ArrayList<>(rows.size());
|
||||
int skip = 0;
|
||||
for (Map<String, Object> row : rows)
|
||||
{
|
||||
String guid = str(row, "GUID");
|
||||
String billCode = str(row, "BILL_CODE");
|
||||
if (guid == null || billCode == null)
|
||||
{
|
||||
skip++;
|
||||
continue;
|
||||
}
|
||||
airList.add(toAir(row, guid, billCode));
|
||||
financeList.add(toFinance(row, guid, billCode));
|
||||
flightList.add(toFlight(row, guid, billCode));
|
||||
opList.add(toOp(row, guid, billCode));
|
||||
trackList.add(toTrack(row, guid, billCode));
|
||||
}
|
||||
int airN = writer.writeAir(airList);
|
||||
int finN = writer.writeFinance(financeList);
|
||||
int flightN = writer.writeFlight(flightList);
|
||||
int opN = writer.writeOp(opList);
|
||||
int trackN = writer.writeTrack(trackList);
|
||||
String summary = String.format(
|
||||
"billAir sync done: oracle=%d skip=%d air=%d finance=%d flight=%d op=%d track=%d costMs=%d",
|
||||
rows.size(), skip, airN, finN, flightN, opN, trackN, System.currentTimeMillis() - start);
|
||||
log.info(summary);
|
||||
return summary;
|
||||
}
|
||||
|
||||
private static SrvBillAir toAir(Map<String, Object> row, String guid, String billCode)
|
||||
{
|
||||
SrvBillAir a = new SrvBillAir();
|
||||
a.setGuid(guid);
|
||||
a.setBillCode(billCode);
|
||||
a.setBillType(integer(row, "BILL_TYPE"));
|
||||
a.setBlStatus(integer(row, "BL_STATUS"));
|
||||
a.setWarningStatus(integer(row, "WARNING_STATUS"));
|
||||
a.setWarningCount(integer(row, "WARNING_COUNT"));
|
||||
a.setStartAirport(str(row, "START_AIRPORT"));
|
||||
a.setEndAirport(str(row, "END_AIRPORT"));
|
||||
a.setDesPort(str(row, "DES_PORT"));
|
||||
a.setRouteName(str(row, "ROUTE_NAME"));
|
||||
a.setAirType(str(row, "AIR_TYPE"));
|
||||
a.setPieceNumber(integer(row, "PIECE_NUMBER"));
|
||||
a.setVolume(decimal(row, "VOLUME"));
|
||||
a.setActualWeight(decimal(row, "ACTUAL_WEIGHT"));
|
||||
a.setActualVolume(decimal(row, "ACTUAL_VOLUME"));
|
||||
a.setVolumeWeight(decimal(row, "VOLUME_WEIGHT"));
|
||||
a.setAirCompany(str(row, "AIR_COMPANY"));
|
||||
a.setSendManCode(str(row, "SEND_MAN_CODE"));
|
||||
a.setAcceptManCode(str(row, "ACCEPT_MAN_CODE"));
|
||||
a.setDataFrom(str(row, "DATA_FROM"));
|
||||
a.setCreateManCode(str(row, "CREATE_MAN_CODE"));
|
||||
a.setCreateTime(date(row, "CREATE_TIME"));
|
||||
a.setModifierCode(str(row, "MODIFIER_CODE"));
|
||||
a.setModifyTime(date(row, "MODIFY_TIME"));
|
||||
a.setRemark(str(row, "REMARK"));
|
||||
return a;
|
||||
}
|
||||
|
||||
private static SrvBillAirFinance toFinance(Map<String, Object> row, String guid, String billCode)
|
||||
{
|
||||
SrvBillAirFinance f = new SrvBillAirFinance();
|
||||
f.setGuid(guid);
|
||||
f.setBillCode(billCode);
|
||||
f.setBlCheck(integer(row, "BL_CHECK"));
|
||||
f.setCheckRemark(str(row, "CHECK_REMARK"));
|
||||
f.setBlConfirm(integer(row, "BL_CONFIRM"));
|
||||
f.setConfirmManCode(str(row, "CONFIRM_MAN_CODE"));
|
||||
f.setConfirmTime(date(row, "CONFIRM_TIME"));
|
||||
f.setPrice(decimal(row, "PRICE"));
|
||||
f.setAmount(decimal(row, "AMOUNT"));
|
||||
f.setCalcExp(str(row, "CALC_EXP"));
|
||||
f.setCalcRe(asText(row, "CALC_RE"));
|
||||
f.setPriceRemark(str(row, "PRICE_REMARK"));
|
||||
f.setBaoguanFee(decimal(row, "BAOGUAN_FEE"));
|
||||
f.setBaoguanOtherFee(decimal(row, "BAOGUAN_OTHER_FEE"));
|
||||
f.setStockFee(decimal(row, "STOCK_FEE"));
|
||||
f.setDesPortAgentFee(decimal(row, "DES_PORT_AGENT_FEE"));
|
||||
f.setAirOtherFee(decimal(row, "AIR_OTHER_FEE"));
|
||||
f.setOtherFee(decimal(row, "OTHER_FEE"));
|
||||
f.setCompensateRemark(str(row, "COMPENSATE_REMARK"));
|
||||
f.setChargeManCode(str(row, "CHARGE_MAN_CODE"));
|
||||
return f;
|
||||
}
|
||||
|
||||
private static SrvBillAirFlight toFlight(Map<String, Object> row, String guid, String billCode)
|
||||
{
|
||||
SrvBillAirFlight fl = new SrvBillAirFlight();
|
||||
fl.setGuid(guid);
|
||||
fl.setBillCode(billCode);
|
||||
fl.setAirNo(str(row, "AIR_NO"));
|
||||
fl.setActualAirNo(str(row, "ACTUAL_AIR_NO"));
|
||||
fl.setAirOmpanyAgent(str(row, "AIR_OMPANY_AGENT"));
|
||||
fl.setDesPortAgentCode(str(row, "DES_PORT_AGENT"));
|
||||
fl.setBoardNo(str(row, "BOARD_NO"));
|
||||
fl.setBandBoxCount(integer(row, "BAND_BOX_COUNT"));
|
||||
fl.setBandVolume(decimal(row, "BAND_VOLUME"));
|
||||
fl.setBandBoxWeight(decimal(row, "BAND_BOX_WEIGHT"));
|
||||
fl.setDivisorValue(decimal(row, "DIVISOR_VALUE"));
|
||||
fl.setFirstLandingTime(date(row, "FIRST_LANDING_TIME"));
|
||||
fl.setSecondTakeoffTime(date(row, "SECOND_TAKEOFF_TIME"));
|
||||
fl.setAirDelayTime(date(row, "AIR_DELAY_TIME"));
|
||||
fl.setTrunkDestinations(str(row, "TRUNK_DESTINATIONS"));
|
||||
return fl;
|
||||
}
|
||||
|
||||
private static SrvBillAirOp toOp(Map<String, Object> row, String guid, String billCode)
|
||||
{
|
||||
SrvBillAirOp o = new SrvBillAirOp();
|
||||
o.setGuid(guid);
|
||||
o.setBillCode(billCode);
|
||||
o.setBlRetrieval(integer(row, "BL_RETRIEVAL"));
|
||||
o.setRetrievalDate(date(row, "RETRIEVAL_DATE"));
|
||||
o.setRetrievalManCode(str(row, "RETRIEVAL_MAN_CODE"));
|
||||
o.setPickBoxCount(integer(row, "PICK_BOX_COUNT"));
|
||||
o.setPickCountReal(integer(row, "PICK_COUNT_REAL"));
|
||||
o.setDeclareCode(str(row, "DECLARE_CODE"));
|
||||
o.setClearanceCode(str(row, "CLEARANCE_CODE"));
|
||||
o.setQingguanAgent(str(row, "QINGGUAN_AGENT"));
|
||||
o.setClearanceOpCode(str(row, "CLEARANCE_OP_CODE"));
|
||||
o.setStockAddr(str(row, "STOCK_ADDR"));
|
||||
o.setStockOutRemark(str(row, "STOCK_OUT_REMARK"));
|
||||
o.setDeliverCount(integer(row, "DELIVER_COUNT"));
|
||||
o.setFirstDeliverCount(integer(row, "FIRST_DELIVER_COUNT"));
|
||||
o.setLastDeliverCount(integer(row, "LAST_DELIVER_COUNT"));
|
||||
o.setAcDeliverDiff(asText(row, "AC_DELIVER_DIFF"));
|
||||
o.setDeliverEndDiff(asText(row, "DELIVER_END_DIFF"));
|
||||
o.setCheckOrderCount(integer(row, "CHECK_ORDER_COUNT"));
|
||||
o.setCheckLeaveCount(integer(row, "CHECK_LEAVE_COUNT"));
|
||||
o.setInternalCheckTime(date(row, "INTERNAL_CHECK_TIME"));
|
||||
return o;
|
||||
}
|
||||
|
||||
private static SrvBillAirTrack toTrack(Map<String, Object> row, String guid, String billCode)
|
||||
{
|
||||
SrvBillAirTrack t = new SrvBillAirTrack();
|
||||
t.setGuid(guid);
|
||||
t.setBillCode(billCode);
|
||||
t.setStartTimePlan(date(row, "START_TIME_PLAN"));
|
||||
t.setArriveTimePlan(date(row, "ARRIVE_TIME_PLAN"));
|
||||
t.setShippingDate(date(row, "SHIPPING_DATE"));
|
||||
t.setStartTime(date(row, "START_TIME"));
|
||||
t.setArriveTime(date(row, "ARRIVE_TIME"));
|
||||
t.setArriveStockTime(date(row, "ARRIVE_STOCK_TIME"));
|
||||
t.setClearanceTime(date(row, "CLEARANCE_TIME"));
|
||||
t.setEndOprateTime(date(row, "END_OPRATE_TIME"));
|
||||
t.setBlBgfx(integer(row, "BL_BGFX"));
|
||||
t.setBgfxTime(date(row, "BGFX_TIME"));
|
||||
t.setUpdateTimeBgfx(date(row, "UPDATE_TIME_BGFX"));
|
||||
t.setBlSjqf(integer(row, "BL_SJQF"));
|
||||
t.setSjqfTime(date(row, "SJQF_TIME"));
|
||||
t.setUpdateTimeSjqf(date(row, "UPDATE_TIME_SJQF"));
|
||||
t.setBlSjdd(integer(row, "BL_SJDD"));
|
||||
t.setSjddTime(date(row, "SJDD_TIME"));
|
||||
t.setUpdateTimeSjdd(date(row, "UPDATE_TIME_SJDD"));
|
||||
t.setBlTzdc(integer(row, "BL_TZDC"));
|
||||
t.setTzdcTime(date(row, "TZDC_TIME"));
|
||||
t.setUpdateTimeTzdc(dateText(row, "UPDATE_TIME_TZDC"));
|
||||
t.setBlThdc(integer(row, "BL_THDC"));
|
||||
t.setThdcTime(date(row, "THDC_TIME"));
|
||||
t.setUpdateTimeThdc(date(row, "UPDATE_TIME_THDC"));
|
||||
t.setBlQgwc(integer(row, "BL_QGWC"));
|
||||
t.setQgwcTime(date(row, "QGWC_TIME"));
|
||||
t.setUpdateTimeQgwc(date(row, "UPDATE_TIME_QGWC"));
|
||||
t.setBlGxfc(integer(row, "BL_GXFC"));
|
||||
t.setGxfcTime(date(row, "GXFC_TIME"));
|
||||
t.setUpdateTimeGxfc(dateText(row, "UPDATE_TIME_GXFC"));
|
||||
t.setBlFjh(integer(row, "BL_FJH"));
|
||||
t.setFjhTime(date(row, "FJH_TIME"));
|
||||
t.setUpdateTimeFjh(dateText(row, "UPDATE_TIME_FJH"));
|
||||
t.setBlTrackGenBg(integer(row, "BL_TRACK_GEN_BG"));
|
||||
t.setBlTrackGenBgfx(integer(row, "BL_TRACK_GEN_BGFX"));
|
||||
t.setBlTrackGenQf(integer(row, "BL_TRACK_GEN_QF"));
|
||||
t.setBlTrackGenDd(integer(row, "BL_TRACK_GEN_DD"));
|
||||
t.setBlTrackGenQg(integer(row, "BL_TRACK_GEN_QG"));
|
||||
t.setBlTrackGenDc(integer(row, "BL_TRACK_GEN_DC"));
|
||||
return t;
|
||||
}
|
||||
|
||||
private static String str(Map<String, Object> row, String key)
|
||||
{
|
||||
Object v = row.get(key);
|
||||
if (v == null)
|
||||
{
|
||||
v = row.get(key.toLowerCase());
|
||||
}
|
||||
if (v == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String s = String.valueOf(v).trim();
|
||||
return s.isEmpty() ? null : s;
|
||||
}
|
||||
|
||||
private static String asText(Map<String, Object> row, String key)
|
||||
{
|
||||
Object v = get(row, key);
|
||||
if (v == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(v);
|
||||
}
|
||||
|
||||
private static String dateText(Map<String, Object> row, String key)
|
||||
{
|
||||
Date d = date(row, key);
|
||||
if (d == null)
|
||||
{
|
||||
String s = str(row, key);
|
||||
return s;
|
||||
}
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d);
|
||||
}
|
||||
|
||||
private static Object get(Map<String, Object> row, String key)
|
||||
{
|
||||
Object v = row.get(key);
|
||||
return v != null ? v : row.get(key.toLowerCase());
|
||||
}
|
||||
|
||||
private static Integer integer(Map<String, Object> row, String key)
|
||||
{
|
||||
Object v = get(row, key);
|
||||
if (v == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (v instanceof Number)
|
||||
{
|
||||
return ((Number) v).intValue();
|
||||
}
|
||||
try
|
||||
{
|
||||
return Integer.valueOf(String.valueOf(v).trim());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static BigDecimal decimal(Map<String, Object> row, String key)
|
||||
{
|
||||
Object v = get(row, key);
|
||||
if (v == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (v instanceof BigDecimal)
|
||||
{
|
||||
return (BigDecimal) v;
|
||||
}
|
||||
if (v instanceof Number)
|
||||
{
|
||||
return BigDecimal.valueOf(((Number) v).doubleValue());
|
||||
}
|
||||
try
|
||||
{
|
||||
return new BigDecimal(String.valueOf(v).trim());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Date date(Map<String, Object> row, String key)
|
||||
{
|
||||
Object v = get(row, key);
|
||||
if (v == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (v instanceof Date)
|
||||
{
|
||||
return (Date) v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.bms.price.airbill.sync;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.bms.price.airbill.domain.SrvBillAir;
|
||||
import com.bms.price.airbill.domain.SrvBillAirFinance;
|
||||
import com.bms.price.airbill.domain.SrvBillAirFlight;
|
||||
import com.bms.price.airbill.domain.SrvBillAirOp;
|
||||
import com.bms.price.airbill.domain.SrvBillAirTrack;
|
||||
import com.bms.price.airbill.mapper.SrvBillAirSyncMapper;
|
||||
|
||||
/**
|
||||
* 空运提单镜像表写库(MASTER,分批 upsert)
|
||||
*/
|
||||
@Service
|
||||
public class BillAirSyncWriter
|
||||
{
|
||||
private static final int BATCH_SIZE = 200;
|
||||
|
||||
@Autowired
|
||||
private SrvBillAirSyncMapper mapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int writeAir(List<SrvBillAir> list)
|
||||
{
|
||||
return batch(list, mapper::upsertBillAir);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int writeFinance(List<SrvBillAirFinance> list)
|
||||
{
|
||||
return batch(list, mapper::upsertBillAirFinance);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int writeFlight(List<SrvBillAirFlight> list)
|
||||
{
|
||||
return batch(list, mapper::upsertBillAirFlight);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int writeOp(List<SrvBillAirOp> list)
|
||||
{
|
||||
return batch(list, mapper::upsertBillAirOp);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int writeTrack(List<SrvBillAirTrack> list)
|
||||
{
|
||||
return batch(list, mapper::upsertBillAirTrack);
|
||||
}
|
||||
|
||||
private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> fn)
|
||||
{
|
||||
int rows = 0;
|
||||
for (int from = 0; from < list.size(); from += BATCH_SIZE)
|
||||
{
|
||||
rows += fn.applyAsInt(list.subList(from, Math.min(from + BATCH_SIZE, list.size())));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.bms.price.airbill.sync;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.bms.common.annotation.DataSource;
|
||||
import com.bms.common.enums.DataSourceType;
|
||||
import com.bms.price.airbill.mapper.OracleBillAirMapper;
|
||||
|
||||
/**
|
||||
* Oracle 空运提单只读(SLAVE)。独立 Bean,保证 @DataSource 切面生效。
|
||||
*/
|
||||
@Service
|
||||
public class OracleBillAirReader
|
||||
{
|
||||
@Autowired
|
||||
private OracleBillAirMapper oracleBillAirMapper;
|
||||
|
||||
@DataSource(DataSourceType.SLAVE)
|
||||
public List<Map<String, Object>> readAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageHelper.clearPage();
|
||||
return oracleBillAirMapper.selectAllBillAir();
|
||||
}
|
||||
finally
|
||||
{
|
||||
PageHelper.clearPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.bms.price.airbill.task;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.bms.common.utils.StringUtils;
|
||||
import com.bms.price.airbill.sync.BillAirSyncService;
|
||||
|
||||
/**
|
||||
* 老系统空运提单每日同步任务。
|
||||
* sys_job.invoke_target = billAirSyncTask.syncFromOracle()
|
||||
*/
|
||||
@Component("billAirSyncTask")
|
||||
public class BillAirSyncTask
|
||||
{
|
||||
@Autowired
|
||||
private BillAirSyncService billAirSyncService;
|
||||
|
||||
/**
|
||||
* 全量同步 Oracle TAB_BILL_AIR -> srv_bill_air / finance / flight / op / track
|
||||
*/
|
||||
public void syncFromOracle()
|
||||
{
|
||||
String summary = billAirSyncService.syncFromOracle();
|
||||
if (StringUtils.isEmpty(summary))
|
||||
{
|
||||
throw new RuntimeException("老系统空运提单同步未返回结果");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bms.price.airbill.mapper.OracleBillAirMapper">
|
||||
|
||||
<select id="selectAllBillAir" resultType="java.util.HashMap" fetchSize="500">
|
||||
SELECT GUID, BILL_CODE, BILL_TYPE, BL_STATUS, WARNING_STATUS, WARNING_COUNT,
|
||||
START_AIRPORT, END_AIRPORT, DES_PORT, ROUTE_NAME, AIR_TYPE,
|
||||
PIECE_NUMBER, VOLUME, ACTUAL_WEIGHT, ACTUAL_VOLUME, VOLUME_WEIGHT,
|
||||
AIR_COMPANY, SEND_MAN_CODE, ACCEPT_MAN_CODE, DATA_FROM,
|
||||
CREATE_MAN_CODE, CREATE_TIME, MODIFIER_CODE, MODIFY_TIME, REMARK,
|
||||
BL_CHECK, CHECK_REMARK, BL_CONFIRM, CONFIRM_MAN_CODE, CONFIRM_TIME,
|
||||
PRICE, AMOUNT, CALC_EXP, CALC_RE, PRICE_REMARK,
|
||||
BAOGUAN_FEE, BAOGUAN_OTHER_FEE, STOCK_FEE, DES_PORT_AGENT_FEE,
|
||||
AIR_OTHER_FEE, OTHER_FEE, COMPENSATE_REMARK, CHARGE_MAN_CODE,
|
||||
AIR_NO, ACTUAL_AIR_NO, AIR_OMPANY_AGENT, DES_PORT_AGENT, BOARD_NO,
|
||||
BAND_BOX_COUNT, BAND_VOLUME, BAND_BOX_WEIGHT, DIVISOR_VALUE,
|
||||
FIRST_LANDING_TIME, SECOND_TAKEOFF_TIME, AIR_DELAY_TIME, TRUNK_DESTINATIONS,
|
||||
BL_RETRIEVAL, RETRIEVAL_DATE, RETRIEVAL_MAN_CODE, PICK_BOX_COUNT, PICK_COUNT_REAL,
|
||||
DECLARE_CODE, CLEARANCE_CODE, QINGGUAN_AGENT, CLEARANCE_OP_CODE,
|
||||
STOCK_ADDR, STOCK_OUT_REMARK, DELIVER_COUNT, FIRST_DELIVER_COUNT, LAST_DELIVER_COUNT,
|
||||
AC_DELIVER_DIFF, DELIVER_END_DIFF, CHECK_ORDER_COUNT, CHECK_LEAVE_COUNT, INTERNAL_CHECK_TIME,
|
||||
START_TIME_PLAN, ARRIVE_TIME_PLAN, SHIPPING_DATE, START_TIME, ARRIVE_TIME,
|
||||
ARRIVE_STOCK_TIME, CLEARANCE_TIME, END_OPRATE_TIME,
|
||||
BL_BGFX, BGFX_TIME, UPDATE_TIME_BGFX,
|
||||
BL_SJQF, SJQF_TIME, UPDATE_TIME_SJQF,
|
||||
BL_SJDD, SJDD_TIME, UPDATE_TIME_SJDD,
|
||||
BL_TZDC, TZDC_TIME, UPDATE_TIME_TZDC,
|
||||
BL_THDC, THDC_TIME, UPDATE_TIME_THDC,
|
||||
BL_QGWC, QGWC_TIME, UPDATE_TIME_QGWC,
|
||||
BL_GXFC, GXFC_TIME, UPDATE_TIME_GXFC,
|
||||
BL_FJH, FJH_TIME, UPDATE_TIME_FJH,
|
||||
BL_TRACK_GEN_BG, BL_TRACK_GEN_BGFX, BL_TRACK_GEN_QF, BL_TRACK_GEN_DD,
|
||||
BL_TRACK_GEN_QG, BL_TRACK_GEN_DC
|
||||
FROM WEISHI_USER.TAB_BILL_AIR
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,220 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bms.price.airbill.mapper.SrvBillAirSyncMapper">
|
||||
|
||||
<insert id="upsertBillAir">
|
||||
INSERT INTO srv_bill_air (
|
||||
guid, bill_code, bill_type, bl_status, warning_status, warning_count,
|
||||
start_airport, end_airport, des_port, route_name, air_type,
|
||||
piece_number, volume, actual_weight, actual_volume, volume_weight,
|
||||
air_company, send_man_code, accept_man_code, data_from,
|
||||
create_man_code, create_time, modifier_code, modify_time, remark
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.guid}, #{it.billCode}, #{it.billType}, #{it.blStatus}, #{it.warningStatus}, #{it.warningCount},
|
||||
#{it.startAirport}, #{it.endAirport}, #{it.desPort}, #{it.routeName}, #{it.airType},
|
||||
#{it.pieceNumber}, #{it.volume}, #{it.actualWeight}, #{it.actualVolume}, #{it.volumeWeight},
|
||||
#{it.airCompany}, #{it.sendManCode}, #{it.acceptManCode}, #{it.dataFrom},
|
||||
#{it.createManCode}, #{it.createTime}, #{it.modifierCode}, #{it.modifyTime}, #{it.remark})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bill_code = VALUES(bill_code),
|
||||
bill_type = VALUES(bill_type),
|
||||
bl_status = VALUES(bl_status),
|
||||
warning_status = VALUES(warning_status),
|
||||
warning_count = VALUES(warning_count),
|
||||
start_airport = VALUES(start_airport),
|
||||
end_airport = VALUES(end_airport),
|
||||
des_port = VALUES(des_port),
|
||||
route_name = VALUES(route_name),
|
||||
air_type = VALUES(air_type),
|
||||
piece_number = VALUES(piece_number),
|
||||
volume = VALUES(volume),
|
||||
actual_weight = VALUES(actual_weight),
|
||||
actual_volume = VALUES(actual_volume),
|
||||
volume_weight = VALUES(volume_weight),
|
||||
air_company = VALUES(air_company),
|
||||
send_man_code = VALUES(send_man_code),
|
||||
accept_man_code = VALUES(accept_man_code),
|
||||
data_from = VALUES(data_from),
|
||||
create_man_code = VALUES(create_man_code),
|
||||
create_time = VALUES(create_time),
|
||||
modifier_code = VALUES(modifier_code),
|
||||
modify_time = VALUES(modify_time),
|
||||
remark = VALUES(remark)
|
||||
</insert>
|
||||
|
||||
<insert id="upsertBillAirFinance">
|
||||
INSERT INTO srv_bill_air_finance (
|
||||
guid, bill_code, bl_check, check_remark, bl_confirm, confirm_man_code, confirm_time,
|
||||
price, amount, calc_exp, calc_re, price_remark,
|
||||
baoguan_fee, baoguan_other_fee, stock_fee, des_port_agent_fee,
|
||||
air_other_fee, other_fee, compensate_remark, charge_man_code
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.guid}, #{it.billCode}, #{it.blCheck}, #{it.checkRemark}, #{it.blConfirm}, #{it.confirmManCode}, #{it.confirmTime},
|
||||
#{it.price}, #{it.amount}, #{it.calcExp}, #{it.calcRe}, #{it.priceRemark},
|
||||
#{it.baoguanFee}, #{it.baoguanOtherFee}, #{it.stockFee}, #{it.desPortAgentFee},
|
||||
#{it.airOtherFee}, #{it.otherFee}, #{it.compensateRemark}, #{it.chargeManCode})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bill_code = VALUES(bill_code),
|
||||
bl_check = VALUES(bl_check),
|
||||
check_remark = VALUES(check_remark),
|
||||
bl_confirm = VALUES(bl_confirm),
|
||||
confirm_man_code = VALUES(confirm_man_code),
|
||||
confirm_time = VALUES(confirm_time),
|
||||
price = VALUES(price),
|
||||
amount = VALUES(amount),
|
||||
calc_exp = VALUES(calc_exp),
|
||||
calc_re = VALUES(calc_re),
|
||||
price_remark = VALUES(price_remark),
|
||||
baoguan_fee = VALUES(baoguan_fee),
|
||||
baoguan_other_fee = VALUES(baoguan_other_fee),
|
||||
stock_fee = VALUES(stock_fee),
|
||||
des_port_agent_fee = VALUES(des_port_agent_fee),
|
||||
air_other_fee = VALUES(air_other_fee),
|
||||
other_fee = VALUES(other_fee),
|
||||
compensate_remark = VALUES(compensate_remark),
|
||||
charge_man_code = VALUES(charge_man_code)
|
||||
</insert>
|
||||
|
||||
<insert id="upsertBillAirFlight">
|
||||
INSERT INTO srv_bill_air_flight (
|
||||
guid, bill_code, air_no, actual_air_no, air_ompany_agent, des_port_agent_code,
|
||||
board_no, band_box_count, band_volume, band_box_weight, divisor_value,
|
||||
first_landing_time, second_takeoff_time, air_delay_time, trunk_destinations
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.guid}, #{it.billCode}, #{it.airNo}, #{it.actualAirNo}, #{it.airOmpanyAgent}, #{it.desPortAgentCode},
|
||||
#{it.boardNo}, #{it.bandBoxCount}, #{it.bandVolume}, #{it.bandBoxWeight}, #{it.divisorValue},
|
||||
#{it.firstLandingTime}, #{it.secondTakeoffTime}, #{it.airDelayTime}, #{it.trunkDestinations})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bill_code = VALUES(bill_code),
|
||||
air_no = VALUES(air_no),
|
||||
actual_air_no = VALUES(actual_air_no),
|
||||
air_ompany_agent = VALUES(air_ompany_agent),
|
||||
des_port_agent_code = VALUES(des_port_agent_code),
|
||||
board_no = VALUES(board_no),
|
||||
band_box_count = VALUES(band_box_count),
|
||||
band_volume = VALUES(band_volume),
|
||||
band_box_weight = VALUES(band_box_weight),
|
||||
divisor_value = VALUES(divisor_value),
|
||||
first_landing_time = VALUES(first_landing_time),
|
||||
second_takeoff_time = VALUES(second_takeoff_time),
|
||||
air_delay_time = VALUES(air_delay_time),
|
||||
trunk_destinations = VALUES(trunk_destinations)
|
||||
</insert>
|
||||
|
||||
<insert id="upsertBillAirOp">
|
||||
INSERT INTO srv_bill_air_op (
|
||||
guid, bill_code, bl_retrieval, retrieval_date, retrieval_man_code,
|
||||
pick_box_count, pick_count_real, declare_code, clearance_code, qingguan_agent,
|
||||
clearance_op_code, stock_addr, stock_out_remark, deliver_count,
|
||||
first_deliver_count, last_deliver_count, ac_deliver_diff, deliver_end_diff,
|
||||
check_order_count, check_leave_count, internal_check_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.guid}, #{it.billCode}, #{it.blRetrieval}, #{it.retrievalDate}, #{it.retrievalManCode},
|
||||
#{it.pickBoxCount}, #{it.pickCountReal}, #{it.declareCode}, #{it.clearanceCode}, #{it.qingguanAgent},
|
||||
#{it.clearanceOpCode}, #{it.stockAddr}, #{it.stockOutRemark}, #{it.deliverCount},
|
||||
#{it.firstDeliverCount}, #{it.lastDeliverCount}, #{it.acDeliverDiff}, #{it.deliverEndDiff},
|
||||
#{it.checkOrderCount}, #{it.checkLeaveCount}, #{it.internalCheckTime})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bill_code = VALUES(bill_code),
|
||||
bl_retrieval = VALUES(bl_retrieval),
|
||||
retrieval_date = VALUES(retrieval_date),
|
||||
retrieval_man_code = VALUES(retrieval_man_code),
|
||||
pick_box_count = VALUES(pick_box_count),
|
||||
pick_count_real = VALUES(pick_count_real),
|
||||
declare_code = VALUES(declare_code),
|
||||
clearance_code = VALUES(clearance_code),
|
||||
qingguan_agent = VALUES(qingguan_agent),
|
||||
clearance_op_code = VALUES(clearance_op_code),
|
||||
stock_addr = VALUES(stock_addr),
|
||||
stock_out_remark = VALUES(stock_out_remark),
|
||||
deliver_count = VALUES(deliver_count),
|
||||
first_deliver_count = VALUES(first_deliver_count),
|
||||
last_deliver_count = VALUES(last_deliver_count),
|
||||
ac_deliver_diff = VALUES(ac_deliver_diff),
|
||||
deliver_end_diff = VALUES(deliver_end_diff),
|
||||
check_order_count = VALUES(check_order_count),
|
||||
check_leave_count = VALUES(check_leave_count),
|
||||
internal_check_time = VALUES(internal_check_time)
|
||||
</insert>
|
||||
|
||||
<insert id="upsertBillAirTrack">
|
||||
INSERT INTO srv_bill_air_track (
|
||||
guid, bill_code, start_time_plan, arrive_time_plan, shipping_date,
|
||||
start_time, arrive_time, arrive_stock_time, clearance_time, end_oprate_time,
|
||||
bl_bgfx, bgfx_time, update_time_bgfx,
|
||||
bl_sjqf, sjqf_time, update_time_sjqf,
|
||||
bl_sjdd, sjdd_time, update_time_sjdd,
|
||||
bl_tzdc, tzdc_time, update_time_tzdc,
|
||||
bl_thdc, thdc_time, update_time_thdc,
|
||||
bl_qgwc, qgwc_time, update_time_qgwc,
|
||||
bl_gxfc, gxfc_time, update_time_gxfc,
|
||||
bl_fjh, fjh_time, update_time_fjh,
|
||||
bl_track_gen_bg, bl_track_gen_bgfx, bl_track_gen_qf, bl_track_gen_dd,
|
||||
bl_track_gen_qg, bl_track_gen_dc
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.guid}, #{it.billCode}, #{it.startTimePlan}, #{it.arriveTimePlan}, #{it.shippingDate},
|
||||
#{it.startTime}, #{it.arriveTime}, #{it.arriveStockTime}, #{it.clearanceTime}, #{it.endOprateTime},
|
||||
#{it.blBgfx}, #{it.bgfxTime}, #{it.updateTimeBgfx},
|
||||
#{it.blSjqf}, #{it.sjqfTime}, #{it.updateTimeSjqf},
|
||||
#{it.blSjdd}, #{it.sjddTime}, #{it.updateTimeSjdd},
|
||||
#{it.blTzdc}, #{it.tzdcTime}, #{it.updateTimeTzdc},
|
||||
#{it.blThdc}, #{it.thdcTime}, #{it.updateTimeThdc},
|
||||
#{it.blQgwc}, #{it.qgwcTime}, #{it.updateTimeQgwc},
|
||||
#{it.blGxfc}, #{it.gxfcTime}, #{it.updateTimeGxfc},
|
||||
#{it.blFjh}, #{it.fjhTime}, #{it.updateTimeFjh},
|
||||
#{it.blTrackGenBg}, #{it.blTrackGenBgfx}, #{it.blTrackGenQf}, #{it.blTrackGenDd},
|
||||
#{it.blTrackGenQg}, #{it.blTrackGenDc})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bill_code = VALUES(bill_code),
|
||||
start_time_plan = VALUES(start_time_plan),
|
||||
arrive_time_plan = VALUES(arrive_time_plan),
|
||||
shipping_date = VALUES(shipping_date),
|
||||
start_time = VALUES(start_time),
|
||||
arrive_time = VALUES(arrive_time),
|
||||
arrive_stock_time = VALUES(arrive_stock_time),
|
||||
clearance_time = VALUES(clearance_time),
|
||||
end_oprate_time = VALUES(end_oprate_time),
|
||||
bl_bgfx = VALUES(bl_bgfx),
|
||||
bgfx_time = VALUES(bgfx_time),
|
||||
update_time_bgfx = VALUES(update_time_bgfx),
|
||||
bl_sjqf = VALUES(bl_sjqf),
|
||||
sjqf_time = VALUES(sjqf_time),
|
||||
update_time_sjqf = VALUES(update_time_sjqf),
|
||||
bl_sjdd = VALUES(bl_sjdd),
|
||||
sjdd_time = VALUES(sjdd_time),
|
||||
update_time_sjdd = VALUES(update_time_sjdd),
|
||||
bl_tzdc = VALUES(bl_tzdc),
|
||||
tzdc_time = VALUES(tzdc_time),
|
||||
update_time_tzdc = VALUES(update_time_tzdc),
|
||||
bl_thdc = VALUES(bl_thdc),
|
||||
thdc_time = VALUES(thdc_time),
|
||||
update_time_thdc = VALUES(update_time_thdc),
|
||||
bl_qgwc = VALUES(bl_qgwc),
|
||||
qgwc_time = VALUES(qgwc_time),
|
||||
update_time_qgwc = VALUES(update_time_qgwc),
|
||||
bl_gxfc = VALUES(bl_gxfc),
|
||||
gxfc_time = VALUES(gxfc_time),
|
||||
update_time_gxfc = VALUES(update_time_gxfc),
|
||||
bl_fjh = VALUES(bl_fjh),
|
||||
fjh_time = VALUES(fjh_time),
|
||||
update_time_fjh = VALUES(update_time_fjh),
|
||||
bl_track_gen_bg = VALUES(bl_track_gen_bg),
|
||||
bl_track_gen_bgfx = VALUES(bl_track_gen_bgfx),
|
||||
bl_track_gen_qf = VALUES(bl_track_gen_qf),
|
||||
bl_track_gen_dd = VALUES(bl_track_gen_dd),
|
||||
bl_track_gen_qg = VALUES(bl_track_gen_qg),
|
||||
bl_track_gen_dc = VALUES(bl_track_gen_dc)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,169 @@
|
||||
-- =====================================================================
|
||||
-- 空运提单:镜像表 + 每日 02:00 同步任务(生产库执行)
|
||||
-- 来源:Oracle WEISHI_USER.TAB_BILL_AIR,按 guid / bill_code 1:1 拆分
|
||||
-- 相关脚本(可选执行):
|
||||
-- sql/price/air_bill_type_dict.sql
|
||||
-- sql/price/air_bill_menu.sql
|
||||
-- =====================================================================
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `srv_bill_air` (
|
||||
`guid` varchar(64) NOT NULL COMMENT '主键',
|
||||
`bill_code` varchar(64) NOT NULL COMMENT '提单号',
|
||||
`bill_type` int(11) DEFAULT NULL COMMENT '提单类型',
|
||||
`bl_status` int(11) DEFAULT NULL COMMENT '状态',
|
||||
`warning_status` tinyint(4) DEFAULT NULL COMMENT '预警状态',
|
||||
`warning_count` int(11) DEFAULT NULL COMMENT '预警次数',
|
||||
`start_airport` varchar(64) DEFAULT NULL COMMENT '始发机场',
|
||||
`end_airport` varchar(64) DEFAULT NULL COMMENT '目的机场',
|
||||
`des_port` varchar(64) DEFAULT NULL COMMENT '目的港',
|
||||
`route_name` varchar(64) DEFAULT NULL COMMENT '航线名称',
|
||||
`air_type` varchar(64) DEFAULT NULL COMMENT '空运类型',
|
||||
`piece_number` int(11) DEFAULT NULL COMMENT '总件数',
|
||||
`volume` decimal(20,3) DEFAULT NULL COMMENT '总体积',
|
||||
`actual_weight` decimal(20,2) DEFAULT NULL COMMENT '实际重量',
|
||||
`actual_volume` decimal(20,3) DEFAULT NULL COMMENT '实际体积',
|
||||
`volume_weight` decimal(20,3) DEFAULT NULL COMMENT '体积重',
|
||||
`air_company` varchar(64) DEFAULT NULL COMMENT '航空公司',
|
||||
`send_man_code` varchar(64) DEFAULT NULL COMMENT '发货人编码',
|
||||
`accept_man_code` varchar(64) DEFAULT NULL COMMENT '收货人编码',
|
||||
`data_from` varchar(64) DEFAULT NULL COMMENT '数据来源',
|
||||
`create_man_code` varchar(64) DEFAULT NULL COMMENT '创建人工号',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`modifier_code` varchar(64) DEFAULT NULL COMMENT '修改人工号',
|
||||
`modify_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '总备注',
|
||||
PRIMARY KEY (`guid`),
|
||||
UNIQUE KEY `uk_bill_code` (`bill_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='空运提单主表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `srv_bill_air_finance` (
|
||||
`guid` varchar(64) NOT NULL COMMENT '主键',
|
||||
`bill_code` varchar(64) NOT NULL COMMENT '提单号',
|
||||
`bl_check` tinyint(4) DEFAULT NULL COMMENT '是否核对',
|
||||
`check_remark` varchar(64) DEFAULT NULL COMMENT '核对备注',
|
||||
`bl_confirm` int(11) DEFAULT NULL COMMENT '是否确认',
|
||||
`confirm_man_code` varchar(64) DEFAULT NULL COMMENT '确认人工号',
|
||||
`confirm_time` datetime DEFAULT NULL COMMENT '确认时间',
|
||||
`price` decimal(20,2) DEFAULT NULL COMMENT '单价',
|
||||
`amount` decimal(20,2) DEFAULT NULL COMMENT '金额',
|
||||
`calc_exp` varchar(64) DEFAULT NULL COMMENT '应付计算',
|
||||
`calc_re` varchar(64) DEFAULT NULL COMMENT '应收计算',
|
||||
`price_remark` varchar(128) DEFAULT NULL COMMENT '价格备注',
|
||||
`baoguan_fee` decimal(20,4) DEFAULT NULL COMMENT '报关费',
|
||||
`baoguan_other_fee` decimal(20,4) DEFAULT NULL COMMENT '报关其他费用',
|
||||
`stock_fee` decimal(20,4) DEFAULT NULL COMMENT '仓储费',
|
||||
`des_port_agent_fee` decimal(20,4) DEFAULT NULL COMMENT '目的港代理费',
|
||||
`air_other_fee` decimal(20,4) DEFAULT NULL COMMENT '空运其他费用',
|
||||
`other_fee` decimal(20,4) DEFAULT NULL COMMENT '其他费用',
|
||||
`compensate_remark` varchar(64) DEFAULT NULL COMMENT '索赔备注',
|
||||
`charge_man_code` varchar(64) DEFAULT NULL COMMENT '计费人工号',
|
||||
PRIMARY KEY (`guid`),
|
||||
UNIQUE KEY `uk_bill_code` (`bill_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='空运提单财务费用表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `srv_bill_air_flight` (
|
||||
`guid` varchar(64) NOT NULL COMMENT '主键',
|
||||
`bill_code` varchar(64) NOT NULL COMMENT '提单号',
|
||||
`air_no` varchar(64) DEFAULT NULL COMMENT '航班号',
|
||||
`actual_air_no` varchar(64) DEFAULT NULL COMMENT '实际航班号',
|
||||
`air_ompany_agent` varchar(128) DEFAULT NULL COMMENT '航空公司代理',
|
||||
`des_port_agent_code` varchar(64) DEFAULT NULL COMMENT '目的港代理编码',
|
||||
`board_no` varchar(64) DEFAULT NULL COMMENT '板号',
|
||||
`band_box_count` int(11) DEFAULT NULL COMMENT '打板箱数',
|
||||
`band_volume` decimal(20,2) DEFAULT NULL COMMENT '打板体积',
|
||||
`band_box_weight` decimal(20,2) DEFAULT NULL COMMENT '打板重量',
|
||||
`divisor_value` decimal(20,3) DEFAULT NULL COMMENT '体积系数',
|
||||
`first_landing_time` datetime DEFAULT NULL COMMENT '首程落地时间',
|
||||
`second_takeoff_time` datetime DEFAULT NULL COMMENT '二程起飞时间',
|
||||
`air_delay_time` datetime DEFAULT NULL COMMENT '航班延误时间',
|
||||
`trunk_destinations` varchar(64) DEFAULT NULL COMMENT '干线目的地',
|
||||
PRIMARY KEY (`guid`),
|
||||
UNIQUE KEY `uk_bill_code` (`bill_code`),
|
||||
KEY `idx_air_no` (`air_no`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='空运航班干线表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `srv_bill_air_op` (
|
||||
`guid` varchar(64) NOT NULL COMMENT '主键',
|
||||
`bill_code` varchar(64) NOT NULL COMMENT '提单号',
|
||||
`bl_retrieval` tinyint(4) DEFAULT NULL COMMENT '是否提货',
|
||||
`retrieval_date` datetime DEFAULT NULL COMMENT '提货日期',
|
||||
`retrieval_man_code` varchar(64) DEFAULT NULL COMMENT '提货人工号',
|
||||
`pick_box_count` int(11) DEFAULT NULL COMMENT '提货箱数',
|
||||
`pick_count_real` int(11) DEFAULT NULL COMMENT '实际提货件数',
|
||||
`declare_code` varchar(64) DEFAULT NULL COMMENT '报关公司编码',
|
||||
`clearance_code` varchar(64) DEFAULT NULL COMMENT '清关编码',
|
||||
`qingguan_agent` varchar(64) DEFAULT NULL COMMENT '清关代理',
|
||||
`clearance_op_code` varchar(64) DEFAULT NULL COMMENT '清关操作人工号',
|
||||
`stock_addr` varchar(64) DEFAULT NULL COMMENT '出仓仓库地址',
|
||||
`stock_out_remark` varchar(500) DEFAULT NULL COMMENT '出库备注',
|
||||
`deliver_count` int(11) DEFAULT NULL COMMENT '派送件数',
|
||||
`first_deliver_count` int(11) DEFAULT NULL COMMENT '首批派送件数',
|
||||
`last_deliver_count` int(11) DEFAULT NULL COMMENT '末批派送件数',
|
||||
`ac_deliver_diff` varchar(64) DEFAULT NULL COMMENT '派送差异',
|
||||
`deliver_end_diff` varchar(64) DEFAULT NULL COMMENT '派送完成差异',
|
||||
`check_order_count` int(11) DEFAULT NULL COMMENT '查验订单数',
|
||||
`check_leave_count` int(11) DEFAULT NULL COMMENT '查验放行数',
|
||||
`internal_check_time` datetime DEFAULT NULL COMMENT '内部查验时间',
|
||||
PRIMARY KEY (`guid`),
|
||||
UNIQUE KEY `uk_bill_code` (`bill_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='空运提单操作派送表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `srv_bill_air_track` (
|
||||
`guid` varchar(64) NOT NULL COMMENT '主键',
|
||||
`bill_code` varchar(64) NOT NULL COMMENT '提单号',
|
||||
`start_time_plan` datetime DEFAULT NULL COMMENT '计划起飞时间',
|
||||
`arrive_time_plan` datetime DEFAULT NULL COMMENT '计划到达时间',
|
||||
`shipping_date` datetime DEFAULT NULL COMMENT '发货日期',
|
||||
`start_time` datetime DEFAULT NULL COMMENT '起飞时间',
|
||||
`arrive_time` datetime DEFAULT NULL COMMENT '到达时间',
|
||||
`arrive_stock_time` datetime DEFAULT NULL COMMENT '到仓时间',
|
||||
`clearance_time` datetime DEFAULT NULL COMMENT '清关时间',
|
||||
`end_oprate_time` datetime DEFAULT NULL COMMENT '结束操作时间',
|
||||
`bl_bgfx` tinyint(4) DEFAULT NULL,
|
||||
`bgfx_time` datetime DEFAULT NULL,
|
||||
`update_time_bgfx` datetime DEFAULT NULL,
|
||||
`bl_sjqf` tinyint(4) DEFAULT NULL,
|
||||
`sjqf_time` datetime DEFAULT NULL,
|
||||
`update_time_sjqf` datetime DEFAULT NULL,
|
||||
`bl_sjdd` tinyint(4) DEFAULT NULL,
|
||||
`sjdd_time` datetime DEFAULT NULL,
|
||||
`update_time_sjdd` datetime DEFAULT NULL,
|
||||
`bl_tzdc` tinyint(4) DEFAULT NULL,
|
||||
`tzdc_time` datetime DEFAULT NULL,
|
||||
`update_time_tzdc` varchar(64) DEFAULT NULL,
|
||||
`bl_thdc` tinyint(4) DEFAULT NULL,
|
||||
`thdc_time` datetime DEFAULT NULL,
|
||||
`update_time_thdc` datetime DEFAULT NULL,
|
||||
`bl_qgwc` tinyint(4) DEFAULT NULL,
|
||||
`qgwc_time` datetime DEFAULT NULL,
|
||||
`update_time_qgwc` datetime DEFAULT NULL,
|
||||
`bl_gxfc` tinyint(4) DEFAULT NULL,
|
||||
`gxfc_time` datetime DEFAULT NULL,
|
||||
`update_time_gxfc` varchar(64) DEFAULT NULL,
|
||||
`bl_fjh` tinyint(4) DEFAULT NULL,
|
||||
`fjh_time` datetime DEFAULT NULL,
|
||||
`update_time_fjh` varchar(64) DEFAULT NULL,
|
||||
`bl_track_gen_bg` tinyint(4) DEFAULT NULL,
|
||||
`bl_track_gen_bgfx` tinyint(4) DEFAULT NULL,
|
||||
`bl_track_gen_qf` tinyint(4) DEFAULT NULL,
|
||||
`bl_track_gen_dd` tinyint(4) DEFAULT NULL,
|
||||
`bl_track_gen_qg` tinyint(4) DEFAULT NULL,
|
||||
`bl_track_gen_dc` tinyint(4) DEFAULT NULL,
|
||||
PRIMARY KEY (`guid`),
|
||||
UNIQUE KEY `uk_bill_code` (`bill_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='空运提单时效轨迹表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 定时任务:老系统 Oracle TAB_BILL_AIR -> srv_bill_air* 提单每日同步
|
||||
-- 调用目标:billAirSyncTask.syncFromOracle()
|
||||
-- cron 0 0 2 * * ? = 每天 02:00:00;concurrent=1 禁止并发;misfire=3 放弃错过的执行
|
||||
-- 幂等:按 guid upsert,可重复执行
|
||||
-- ----------------------------
|
||||
INSERT INTO sys_job (job_name, job_group, invoke_target, cron_expression,
|
||||
misfire_policy, concurrent, status, create_by, create_time, remark)
|
||||
SELECT N'老系统空运提单每日同步', 'DEFAULT', 'billAirSyncTask.syncFromOracle()', '0 0 2 * * ?',
|
||||
'3', '1', '0', 'admin', NOW(),
|
||||
N'每天02:00从Oracle(WEISHI_USER.TAB_BILL_AIR,只读账号)全量同步到srv_bill_air/finance/flight/op/track;按guid upsert,可重复执行'
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM sys_job WHERE invoke_target = 'billAirSyncTask.syncFromOracle()');
|
||||
Reference in New Issue
Block a user