tao.mo

biz-customer、task-schedule | 修改 | 推送IMP001报文代码调整

mt
2024年12月18日17:39:06
Showing 39 changed files with 462 additions and 211 deletions
......@@ -196,13 +196,13 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
}
}
/**
* Todo 初始化插入预清关文件推送任务日志,szl添加
* Todo 初始化插入预清关文件推送邮件任务日志,szl添加
*/
/**
* 初始化插入预清关文件邮件推送日志,mt添加
* 初始化插入预清关文件推送日志,mt添加
*/
PushOb pushOb = pushObUtil.initPushOb(consignment,user);
PushOb pushOb = pushObUtil.initPushOb(consignment,uploadRecord,user);
/**
* 初始化插入提醒发件人邮件日志
*/
......
......@@ -52,10 +52,10 @@ public class AttachmentUtil {
private void initAttachment(Attachment attachment,String bizType,User user) throws Exception{
DictionaryEntries attachmentBizTypeEntries = cacheSystem.getDicAttachmentBizType(AttachmentBizTypeEnum.getCodeByExt1(bizType));
attachment.setBizTypeCode(attachmentBizTypeEntries.getCode());
attachment.setBizTypeName(attachmentBizTypeEntries.getEnglishName());
attachment.setBizTypeName(attachmentBizTypeEntries.getDescription());
DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentFileType(AttachmentFileTypeEnum.FILE.getCode());
attachment.setFileTypeCode(attachmentFileTypeEntries.getCode());
attachment.setFileTypeName(attachmentFileTypeEntries.getEnglishName());
attachment.setFileTypeName(attachmentFileTypeEntries.getDescription());
attachment.setStatus(StatusEnum.YES.getCode());
attachment.setCreateUserId(user.getId());
attachment.setCreateUserName(user.getUserName());
......
......@@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
import com.fedex.connect.common.model.bi.DictionaryEntries;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.biz.PushOb;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.common.model.sys.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,14 +30,15 @@ public class PushObUtil {
* @param
* @return com.fedex.connect.common.model.biz.PushOb
*/
public PushOb initPushOb(Consignment consignment, User user) throws Exception{
public PushOb initPushOb(Consignment consignment, UploadRecord uploadRecord, User user) throws Exception{
DictionaryEntries pushObStatus = cacheSystem.getDicPushObStatus(PushObStatusEnum.TO_BE_SENT.getCode());
PushOb pushOb = new PushOb();
pushOb.setConsignmentId(consignment.getId());
pushOb.setConsignmentCode(consignment.getConsignmentCode());
pushOb.setPushNum(DigitConstants.DIGIT_ZERO_LONG);
pushOb.setStatusCode(pushObStatus.getCode());
pushOb.setStatusName(pushObStatus.getEnglishName());
pushOb.setStatusName(pushObStatus.getDescription());
pushOb.setUploadRecordId(uploadRecord.getId());
pushOb.setCreateUserId(user.getId());
pushOb.setCreateUserName(user.getUserName());
pushOb.setModifyUserId(user.getId());
......
......@@ -38,4 +38,4 @@ export:
upload:
path:
attachment: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/attachment
\ No newline at end of file
attachment: /var/share/iclearConnect/upload/attachment
\ No newline at end of file
......
......@@ -19,6 +19,7 @@
<result column="MODIFY_TIME" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="MODIFY_USER_ID" jdbcType="NUMERIC" property="modifyUserId" />
<result column="MODIFY_USER_NAME" jdbcType="VARCHAR" property="modifyUserName" />
<result column="UPLOAD_RECORD_ID" jdbcType="NUMERIC" property="uploadRecordId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
......@@ -81,7 +82,7 @@
<sql id="Base_Column_List">
ID, CONSIGNMENT_CODE, CONSIGNMENT_ID, PUSH_TIME, STATUS_CODE, STATUS_NAME, PUSH_NUM,
FILE_PATH, FILE_BACK_PATH, FILE_NAME, REMARK, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME,
MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME
MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME, UPLOAD_RECORD_ID
</sql>
<select id="selectByExample" parameterType="com.fedex.connect.common.model.biz.PushObExample" resultMap="BaseResultMap">
<include refid="OracleDialectPrefix" />
......@@ -125,13 +126,15 @@
PUSH_NUM, FILE_PATH, FILE_BACK_PATH,
FILE_NAME, REMARK, CREATE_TIME,
CREATE_USER_ID, CREATE_USER_NAME, MODIFY_TIME,
MODIFY_USER_ID, MODIFY_USER_NAME)
MODIFY_USER_ID, MODIFY_USER_NAME, UPLOAD_RECORD_ID
)
values (#{id,jdbcType=NUMERIC}, #{consignmentCode,jdbcType=VARCHAR}, #{consignmentId,jdbcType=NUMERIC},
#{pushTime,jdbcType=TIMESTAMP}, #{statusCode,jdbcType=VARCHAR}, #{statusName,jdbcType=VARCHAR},
#{pushNum,jdbcType=NUMERIC}, #{filePath,jdbcType=VARCHAR}, #{fileBackPath,jdbcType=VARCHAR},
#{fileName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{createUserId,jdbcType=NUMERIC}, #{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
#{modifyUserId,jdbcType=NUMERIC}, #{modifyUserName,jdbcType=VARCHAR})
#{modifyUserId,jdbcType=NUMERIC}, #{modifyUserName,jdbcType=VARCHAR}, #{uploadRecordId,jdbcType=NUMERIC}
)
</insert>
<insert id="insertSelective" parameterType="com.fedex.connect.common.model.biz.PushOb">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
......@@ -188,6 +191,9 @@
<if test="modifyUserName != null">
MODIFY_USER_NAME,
</if>
<if test="uploadRecordId != null">
UPLOAD_RECORD_ID,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=NUMERIC},
......@@ -239,6 +245,9 @@
<if test="modifyUserName != null">
#{modifyUserName,jdbcType=VARCHAR},
</if>
<if test="uploadRecordId != null">
#{uploadRecordId,jdbcType=NUMERIC},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.fedex.connect.common.model.biz.PushObExample" resultType="java.lang.Long">
......@@ -301,6 +310,9 @@
<if test="record.modifyUserName != null">
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
</if>
<if test="record.uploadRecordId != null">
UPLOAD_RECORD_ID = #{record.uploadRecordId,jdbcType=NUMERIC},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -324,7 +336,8 @@
CREATE_USER_NAME = #{record.createUserName,jdbcType=VARCHAR},
MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
MODIFY_USER_ID = #{record.modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR}
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
UPLOAD_RECORD_ID = #{record.uploadRecordId,jdbcType=NUMERIC}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -380,6 +393,9 @@
<if test="modifyUserName != null">
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
</if>
<if test="uploadRecordId != null">
UPLOAD_RECORD_ID = #{uploadRecordId,jdbcType=NUMERIC},
</if>
</set>
where ID = #{id,jdbcType=NUMERIC}
</update>
......@@ -400,7 +416,8 @@
CREATE_USER_NAME = #{createUserName,jdbcType=VARCHAR},
MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
MODIFY_USER_ID = #{modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR}
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
UPLOAD_RECORD_ID = #{uploadRecordId,jdbcType=NUMERIC}
where ID = #{id,jdbcType=NUMERIC}
</update>
<sql id="OracleDialectPrefix">
......
......@@ -94,6 +94,11 @@ public class PushOb implements Serializable {
*/
private String modifyUserName;
/**
* 用户上传记录表ID
*/
private Long uploadRecordId;
private static final long serialVersionUID = 1L;
public Long getId() {
......@@ -232,6 +237,14 @@ public class PushOb implements Serializable {
this.modifyUserName = modifyUserName == null ? null : modifyUserName.trim();
}
public Long getUploadRecordId() {
return uploadRecordId;
}
public void setUploadRecordId(Long uploadRecordId) {
this.uploadRecordId = uploadRecordId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
......@@ -255,6 +268,7 @@ public class PushOb implements Serializable {
sb.append(", modifyTime=").append(modifyTime);
sb.append(", modifyUserId=").append(modifyUserId);
sb.append(", modifyUserName=").append(modifyUserName);
sb.append(", uploadRecordId=").append(uploadRecordId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
......
......@@ -35,12 +35,12 @@ public class PushObDetail implements Serializable {
private String statusName;
/**
* 推送文件类型字典CODE,关联数据字典表。指定字典目录CODE:PUSH_OB_FILE_TYPE
* 推送文件类型字典CODE,关联数据字典表。指定字典目录CODE:ATTACHMENT_BIZ_TYPE,取值Ext1 字段值
*/
private String fileTypeCode;
/**
* 推送文件类型名称(XXX、XXX
* 推送文件类型名称(AWB、INV、PKL、OTH
*/
private String fileType;
......
......@@ -1234,6 +1234,66 @@ public class PushObExample {
addCriterion("MODIFY_USER_NAME not between", value1, value2, "modifyUserName");
return (Criteria) this;
}
public Criteria andUploadRecordIdIsNull() {
addCriterion("UPLOAD_RECORD_ID is null");
return (Criteria) this;
}
public Criteria andUploadRecordIdIsNotNull() {
addCriterion("UPLOAD_RECORD_ID is not null");
return (Criteria) this;
}
public Criteria andUploadRecordIdEqualTo(Long value) {
addCriterion("UPLOAD_RECORD_ID =", value, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdNotEqualTo(Long value) {
addCriterion("UPLOAD_RECORD_ID <>", value, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdGreaterThan(Long value) {
addCriterion("UPLOAD_RECORD_ID >", value, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdGreaterThanOrEqualTo(Long value) {
addCriterion("UPLOAD_RECORD_ID >=", value, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdLessThan(Long value) {
addCriterion("UPLOAD_RECORD_ID <", value, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdLessThanOrEqualTo(Long value) {
addCriterion("UPLOAD_RECORD_ID <=", value, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdIn(List<Long> values) {
addCriterion("UPLOAD_RECORD_ID in", values, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdNotIn(List<Long> values) {
addCriterion("UPLOAD_RECORD_ID not in", values, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdBetween(Long value1, Long value2) {
addCriterion("UPLOAD_RECORD_ID between", value1, value2, "uploadRecordId");
return (Criteria) this;
}
public Criteria andUploadRecordIdNotBetween(Long value1, Long value2) {
addCriterion("UPLOAD_RECORD_ID not between", value1, value2, "uploadRecordId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -40,7 +40,7 @@
sys:系统 系统相关表,例如kafka表
log: 日志 日志记录表,例如邮件发送日志表
-->
<javaModelGenerator targetPackage="com.fedex.connect.common.model.sys" targetProject="src/main/java">
<javaModelGenerator targetPackage="com.fedex.connect.common.model.biz" targetProject="src/main/java">
<!---enableSubPackages:如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性-->
<property name="enableSubPackages" value="false"/>
<!--该属性只对MyBatis3有效,如果true就会使用构造方法入参,如果false就会使用setter方式。默认为false-->
......@@ -52,13 +52,13 @@
</javaModelGenerator>
<!-- 生成映射文件*.xml的位置-->
<sqlMapGenerator targetPackage="mapper.sys" targetProject="src/main/java/com/fedex/connect/common">
<sqlMapGenerator targetPackage="mapper.biz" targetProject="src/main/java/com/fedex/connect/common">
<!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false-->
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.fedex.connect.common.dao.sys" targetProject="src/main/java">
<javaClientGenerator type="XMLMAPPER" targetPackage="com.fedex.connect.common.dao.biz" targetProject="src/main/java">
<!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false-->
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
......@@ -135,14 +135,12 @@
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_PUSH_OB.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<!-- <table tableName="T_BIZ_PUSH_OB_DETAIL" domainObjectName="PushObDetail"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_PUSH_OB_DETAIL.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<table tableName="T_BIZ_PUSH_OB_DETAIL" domainObjectName="PushObDetail"
enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
<generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_PUSH_OB_DETAIL.NEXTVAL FROM DUAL" />
</table>
<!-- <table tableName="T_BI_PORTCLEAR_EMAIL_MAPPING" domainObjectName="PortclearEmailMapping"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
......@@ -169,12 +167,12 @@
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_KAFKA_TEMPORARY_STORAGE.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<table schema="ICLEARIMP" tableName="T_SYS_PARAM_CONFIG" domainObjectName="ParamConfig"
enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
<generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_PARAM_CONFIG.NEXTVAL FROM DUAL" />
</table>
<!-- <table schema="ICLEARIMP" tableName="T_SYS_PARAM_CONFIG" domainObjectName="ParamConfig"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_PARAM_CONFIG.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<!-- <table tableName="T_SYS_PRIVILEGE" domainObjectName="Privilege"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
......@@ -193,12 +191,12 @@
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_ROLE_PRIVILEGE.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<table schema="ICLEARIMP" tableName="T_SYS_USER" domainObjectName="User"
enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
<generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_USER.NEXTVAL FROM DUAL" />
</table>
<!-- <table schema="ICLEARIMP" tableName="T_SYS_USER" domainObjectName="User"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_USER.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<!-- <table schema="ICLEARIMP" tableName="T_SYS_USER_ROLE" domainObjectName="UserRole"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
......
......@@ -70,7 +70,7 @@ public interface BaseSeparatorConstants {
String SEPARATOR_ASTERISK = "*";
/**
* @Description 星号
* @Description 反斜杠
* @Author mt
* @Date 2024-11-11
*/
......
......@@ -24,6 +24,7 @@ public class DateUtil {
public static final String PATTERN_DATE_TIME_ORACLE = "yyyy-MM-dd hh:mi:ss";
public static final String PATTERN_DATE_TIME_MS = "yyyy-mm-dd hh24:mi:ss";
public static final String PATTERN_yyyyMMddHHmmss = "yyyyMMddHHmmss";
public static final String YYYYMMDDHH24MMSSSSS = "yyyyMMddHHmmssSSS";
private static SimpleDateFormat dateFormat = new SimpleDateFormat();
......@@ -47,6 +48,19 @@ public class DateUtil {
dateFormat.applyPattern(PATTERN_DATE_TIME);
return dateFormat.format(date);
}
/**
* 用默认格式格式化日期
*
* @param date
* @return
*/
public static String yyyyMMddHH24mmssSSS(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat();
dateFormat.applyPattern(YYYYMMDDHH24MMSSSSS);
return dateFormat.format(date);
}
/**
* 用指定格式格式化日期
*
......
......@@ -262,4 +262,43 @@ public class NIOFileUtils {
}
return false;
}
/**
* @Author mt
* @Description 移动文件
* @Date 2024/5/30
* @param sourcePath
* @param targetPath
* @return void
*/
public void moveFile(String sourcePath,String targetPath) throws Exception{
//覆盖方式移动
Files.move(Paths.get(sourcePath),Paths.get(targetPath),StandardCopyOption.REPLACE_EXISTING);
}
/**
* @Author mt
* @Description 判断文件是否存在
* @Date 2024/9/10
* @param filePath
* @return boolean
*/
public boolean fileExists(String filePath){
return new File(filePath).exists();
}
/**
* @Author mt
* @Description 如果文件夹不存在则创建文件夹
* @Date 2024/5/29
* @param targetFolder
* @return void
*/
public void mkdirs(String targetFolder){
File folder = new File(targetFolder);
// 文件夹不存在,则创建文件夹
if (!folder.exists()) {
folder.mkdirs();
}
}
}
......
......@@ -497,7 +497,7 @@ public class StringExtUtil {
* @param val ID值
* @return
*/
public static String idLeftPadStr(Long val){
public static String idLeftPadStr(Long val, Integer len){
if (val == null){
return null;
}
......@@ -505,9 +505,8 @@ public class StringExtUtil {
return "0";
}
String valStr = val.toString();
int len = valStr.length();
if (valStr.length() <= 10){
return StringUtils.leftPad(valStr,10,"0");
if (valStr.length() <= len){
return StringUtils.leftPad(valStr,len,"0");
} else {
return valStr;
}
......@@ -554,4 +553,10 @@ public class StringExtUtil {
}
}
public static void main(String[] args){
String fileName = "202410271_20241027113156.pdf";
String f = fileName.substring(fileName.lastIndexOf("."));
System.out.println(f);
}
}
......
......@@ -75,4 +75,17 @@ public class PropertiesConfig {
@Value("${export.mail.sendEmail.password}")
String emailPassword;
//基础路径
@Value("${imp001.path.work}")
String imp001PathWork;
//zip输出目录
@Value("${imp001.path.final}")
String imp001PathFinal;
//文件备份目录
@Value("${imp001.path.bak}")
String imp001PathBak;
//文件异常文件存放目录
@Value("${imp001.path.error}")
String imp001PathError;
}
\ No newline at end of file
......
......@@ -6,7 +6,11 @@ package com.fedex.connect.task.constants;
* @Date 2024/4/18
*/
public interface Constant {
//TW001表头信息
/**
* @Author mt
* @Description IMP001表头信息
* @Date 2024/12/18
*/
interface IMP001_HEAD_KEYS{
/**
* 消息代码:IMP001报文标志
......@@ -15,14 +19,18 @@ public interface Constant {
/**
* 发送程序ID:TWEXP
*/
String SENDER_ID = "TWEXP";
String SENDER_ID = "PreCLR";
/**
* 接受程序ID:IMP
*/
String RECEIVER_ID = "IMP";
}
//文件后缀字符串keys
/**
* @Author mt
* @Description 文件后缀字符串keys
* @Date 2024/12/18
*/
interface FILE_SUFFIX_KEYS{
/**
* json字符串
......
package com.fedex.connect.task.data.bo;
import lombok.Data;
import java.util.Date;
/**
* @Author mt
* @Description 类说明 文件信息bo
* @Date 2024/5/30
*/
@Data
public class Imp001FileInfoBo {
//文件类型id
Long fileTypeId;
//文件类型名称
String fileTypeName;
//文件名称
String fileName;
//生成时间
Date pushTime;
}
package com.fedex.connect.task.data.bo;
import com.fedex.connect.common.model.bi.DictionaryEntries;
import com.fedex.connect.task.data.dto.imp001.Imp001Files;
import com.fedex.connect.task.data.dto.imp001.Imp001RootJsonDto;
import lombok.Data;
import java.util.Dictionary;
import java.util.List;
/**
* @Author mt
* @Description 类说明 tw001生成bo
* @Description 类说明 imp001生成bo
* @Date 2024/5/24
*/
@Data
public class Imp001GenerateBo {
//tw001报文对象
//运单号
String consignmentCode;
//运单ID
Long consignmentId;
//imp001报文对象
Imp001RootJsonDto imp001RootJsonDto;
//tw001临时文件夹目录
//imp001临时文件夹目录
String workFilePath;
//需要打包压缩包文件信息名称
List<Imp001FileInfoBo> fileInfoList;
//json Dir对象
DictionaryEntries jsonDictionary;
Imp001Files[] fileInfos;
//zip文件名称
String zipFileName;
//zip推送目标目录
......
......@@ -13,15 +13,14 @@ import java.io.Serializable;
public class Imp001Consignment implements Serializable {
/**
* @Author mt
* @Description 提单号码
* 12位数字,提单号码,可以重复
* @Date 2024/5/23
* @Description 每个报文只有一个12位运单号
* @Date 2024年12月18日
*/
private String deliveryNo;
/**
* @Author mt
* @Description 联络人
* @Date 2024/5/23
* @Description 运单附带文件数量
* @Date 2024年12月18日
*/
private Integer attachedFilesCount;
}
\ No newline at end of file
......
......@@ -24,7 +24,7 @@ public class Imp001Job {
@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_INTERVAL)
@Scheduled(cron = "${export.task.allocation.sendOb}")
public void sendObTask() {
//sendObService.sendOb();
sendObService.sendOb();
}
/**
......@@ -33,6 +33,6 @@ public class Imp001Job {
@ProcessingInterval
@Scheduled(cron = "${export.task.allocation.sendObRetry}")
public void sendObRetryTask() {
//sendObService.sendObRetry();
sendObService.sendObRetry();
}
}
......
package com.fedex.connect.task.repository.base;
import com.fedex.connect.common.dao.biz.AttachmentMapper;
import com.fedex.connect.common.dao.biz.ConsignmentMapper;
import com.fedex.connect.common.dao.biz.EmailMapper;
import com.fedex.connect.common.dao.biz.PushObMapper;
import com.fedex.connect.common.dao.biz.*;
import com.fedex.connect.common.dao.log.EmailHistoryMapper;
import com.fedex.connect.common.dao.sys.KafkaStorageHistoryMapper;
import com.fedex.connect.common.dao.sys.KafkaTemporaryStorageMapper;
......@@ -23,6 +20,8 @@ public class AbstractDaoRepository {
@Autowired
protected PushObMapper pushObMapper;
@Autowired
protected PushObDetailMapper pushObDetailMapper;
@Autowired
protected KafkaTemporaryStorageMapperExt kafkaTemporaryStorageMapperExt;
@Autowired
protected RedisSlabMapperExt redisSlabMapperExt;
......
......@@ -15,10 +15,8 @@ public interface AttachmentExtMapper {
"WHERE a.BIZ_ID = #{bizId}")
List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId);
@Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = " +
"(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE " +
" CONSIGNMENT_ID = #{consignmentId}) AND STATUS = 1")
List<Attachment> queryAttachmentInfo(@Param("consignmentId") Long consignmentId);
@Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = #{uploadRecordId} AND BIZ_ID = #{consignmentId} AND STATUS = 1")
List<Attachment> queryAttachmentInfo(@Param("uploadRecordId") Long uploadRecordId,@Param("consignmentId") Long consignmentId);
/**
* 根据修改日期查询数据
......@@ -26,6 +24,6 @@ public interface AttachmentExtMapper {
* @return
*/
@Select("SELECT * FROM T_BIZ_ATTACHMENT " +
"WHERE MODIFY_TIME < TO_DATE(#{date}, 'YYYY-MM-DD') AND STATUS = 1")
"WHERE MODIFY_TIME &lt; TO_DATE(#{date}, 'YYYY-MM-DD') AND STATUS = 1")
List<Attachment> findAttachmentsOlderThan(@Param("date") String date);
}
......
......@@ -10,7 +10,7 @@ public interface IAttachmentRepository {
List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId);
List<Attachment> queryAttachmentInfo(Long consignmentId);
List<Attachment> queryAttachmentInfo(Long uploadRecordId,Long consignmentId);
List<Attachment> findAttachmentsOlderThan(String date);
......
package com.fedex.connect.task.repository.repo.biz;
import com.fedex.connect.common.model.biz.PushObDetail;
import java.util.List;
public interface IPushObDetailRepository {
/**
* @Author mt
* @Description 功能说明 批量插入
* @Date 2024/5/30
* @param record
* @return void
*/
void batchInsert(List<PushObDetail> record);
}
......@@ -17,8 +17,8 @@ public class AttachmentRepositoryImpl extends AbstractDaoRepository implements I
}
@Override
public List<Attachment> queryAttachmentInfo(Long consignmentId){
return attachmentExtMapper.queryAttachmentInfo(consignmentId);
public List<Attachment> queryAttachmentInfo(Long uploadRecordId,Long consignmentId){
return attachmentExtMapper.queryAttachmentInfo(uploadRecordId,consignmentId);
}
@Override
......
package com.fedex.connect.task.repository.repo.biz.impl;
import com.fedex.connect.common.dependencies.util.Utils;
import com.fedex.connect.common.model.biz.PushObDetail;
import com.fedex.connect.task.repository.base.AbstractDaoRepository;
import com.fedex.connect.task.repository.repo.biz.IPushObDetailRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Objects;
/**
* @Author mt
* @Description 推送明细日志repository
* @Date 2024/5/30
*/
@Repository
public class PushObDetailRepository extends AbstractDaoRepository implements IPushObDetailRepository {
/**
* @Author mt
* @Description 功能说明 批量插入
* @Date 2024/5/30
* @param record
* @return void
*/
public void batchInsert(List<PushObDetail> record){
Utils.listOf(record).stream().filter(Objects::nonNull).forEach(r->{
pushObDetailMapper.insert(r);
});
}
}
......@@ -3,6 +3,7 @@ package com.fedex.connect.task.service.base;
import com.fedex.connect.common.dependencies.repository.repo.sys.IRedisSlabRepository;
import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository;
import com.fedex.connect.task.repository.repo.biz.IEmailRepository;
import com.fedex.connect.task.repository.repo.biz.IPushObDetailRepository;
import com.fedex.connect.task.repository.repo.biz.IPushObRepository;
import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository;
import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository;
......@@ -31,5 +32,7 @@ public class BaseService {
@Autowired
protected IPushObRepository pushObRepository;
@Autowired
protected IPushObDetailRepository pushObDetailRepository;
@Autowired
protected IParamConfigRepository paramConfigRepository;
}
\ No newline at end of file
......
package com.fedex.connect.task.service.biz;
import com.fedex.connect.common.model.biz.PushObDetail;
import java.util.List;
public interface IPushObDetailService {
/**
* @Author mt
* @Description 功能说明 批量插入
* @Date 2024/5/30
* @param record
* @return void
*/
void batchInsert(List<PushObDetail> record);
}
package com.fedex.connect.task.service.biz;
public interface IPushObService {
///**
// * @Author mt
// * @Description 推送Imp001报文数据zip包文件
// * @Date 2024/8/2
// * @param
// * @return void
// */
//void sendOb();
///**
// * @Author mt
// * @Description 推送Imp001文件错误重试
// * @Date 2024/8/2
// * @param
// * @return void
// */
//void sendObRetry();
/**
* @Author mt
* @Description 推送Imp001报文数据zip包文件
* @Date 2024/8/2
* @param
* @return void
*/
void sendOb();
/**
* @Author mt
* @Description 推送Imp001文件错误重试
* @Date 2024/8/2
* @param
* @return void
*/
void sendObRetry();
}
\ No newline at end of file
......
package com.fedex.connect.task.service.biz.impl;
import com.fedex.connect.common.model.biz.PushObDetail;
import com.fedex.connect.task.service.base.BaseService;
import com.fedex.connect.task.service.biz.IPushObDetailService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author mt
* @Description 类说明 推送明细日志
* @Date 2024/5/30
*/
@Service
public class PushObDetailServiceImpl extends BaseService implements IPushObDetailService {
/**
* @Author mt
* @Description 功能说明 批量插入
* @Date 2024/5/30
* @param record
* @return void
*/
public void batchInsert(List<PushObDetail> record){
pushObDetailRepository.batchInsert(record);
}
}
package com.fedex.connect.task.service.biz.impl;
import com.fedex.connect.common.dependencies.cache.CacheSystem;
import com.fedex.connect.common.dependencies.contants.ParamConfigConstants;
import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum;
import com.fedex.connect.common.dependencies.util.Utils;
import com.fedex.connect.common.model.bi.DictionaryEntries;
import com.fedex.connect.common.model.biz.PushOb;
import com.fedex.connect.common.model.sys.ParamConfig;
import com.fedex.connect.task.data.bo.Imp001GenerateBo;
import com.fedex.connect.task.service.base.BaseService;
import com.fedex.connect.task.service.biz.IPushObService;
import com.fedex.connect.task.utils.biz.imp001.Imp001GenerateUtil;
import com.fedex.connect.task.utils.biz.imp001.Imp001PushUtil;
import com.fedex.connect.task.utils.biz.imp001.Imp001RecordLogUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -20,92 +25,102 @@ import java.util.Objects;
/**
* @Author mt
* @Description 发送Imp001到进口组
* @Date 2024/5/24
* @Date 2024年12月18日
*/
@Slf4j
@Service
public class PushObServiceImpl extends BaseService implements IPushObService {
//@Autowired
//Imp001GenerateUtil imp001GenerateUtil;
//@Autowired
//Imp001PushUtil imp001PushUtil;
//@Autowired
//Imp001RecordLogUtil imp001RecordLogUtil;
//
///**
// * 推送OB报文数据zip包文件
// */
//@Override
//public void sendOb() {
// //获取每次处理数据量量参数
// ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
// Long rownum = Long.parseLong(paramConfig.getValue());
// //获取需要处理的记录
// List<PushOb> pushObList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode(),rownum);
// //推送imp001数据
// this.pushOb(pushObList);
//}
//
///**
// * 推送OB文件错误重试
// */
//@Override
//public void sendObRetry() {
// //获取每次处理数据量量参数
// Map<String,ParamConfig> paramConfig = paramConfigRepository.findValueByCodes(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER,
// ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
// //推送IMP001重试处理数量
// ParamConfig retryNumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
// Long retryNum = Long.parseLong(retryNumConfig.getCode());
// //推送IMP001定时任务处理数量
// ParamConfig rownumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
// Long rownum = Long.parseLong(rownumConfig.getCode());
// //获取需要重新处理的记录:处理4次以下,并且推送失败的
// List<PushOb> errPushObLog = pushObRepository.findErrPushOb(retryNum, PushObStatusEnum.PUSH_FAILED.getCode(),rownum);
// if (errPushObLog!=null && !errPushObLog.isEmpty()){
// log.info("sendObRetryTask : sendObRetry size: "+errPushObLog.size());
// //重新推送tw001数据
// this.pushOb(errPushObLog);
// }else{
// log.info("sendObRetryTask : No data found for sendObRetry!");
// }
//}
//
///**
// * @Author mt
// * @Description 推送tw001数据
// * @Date 2024/5/29
// * @param pushObList
// * @return void
// */
//private void pushOb(List<PushOb> pushObList){
// Utils.listOf(pushObList).stream().filter(Objects::nonNull).forEach(ob ->{
// boolean flag = false;
// String errorMsg = "";
// Imp001GenerateBo imp001GenerateBo = null;
// try {
// //生成tw001 json对象dto
// imp001GenerateBo = imp001GenerateUtil.generateImp001Json(ob);
// //根据tw001 json对象生成并且推送zip包
// imp001PushUtil.pushImp001(imp001GenerateBo);
// flag = true;
// }catch(Exception ex){
// log.error("pushOb error : ",ex);
// errorMsg = ex.getMessage();
// flag = false;
// }finally{
// /**
// * 如果生成失败,推送失败,则不会记录推送日志明细,更新推送日志表。
// * 记录日志,并且备份
// */
// if(flag){
// //推送成功
// imp001RecordLogUtil.pushSuccessRecordLog(imp001GenerateBo, ob);
// }else{
// //推送失败
// imp001RecordLogUtil.pushFailRecordLog(imp001GenerateBo, ob, errorMsg);
// }
// }
// });
//}
@Autowired
Imp001GenerateUtil imp001GenerateUtil;
@Autowired
Imp001PushUtil imp001PushUtil;
@Autowired
Imp001RecordLogUtil imp001RecordLogUtil;
@Autowired
CacheSystem cacheSystem;
/**
* 推送OB报文数据zip包文件
*/
@Override
public void sendOb() {
//获取每次处理数据量量参数
ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
Long rownum = Long.parseLong(paramConfig.getValue());
//获取需要处理的记录
List<PushOb> pushObList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode(),rownum);
//推送imp001数据
this.pushOb(pushObList);
}
/**
* 推送OB文件错误重试
*/
@Override
public void sendObRetry() {
//获取每次处理数据量量参数
Map<String,ParamConfig> paramConfig = paramConfigRepository.findValueByCodes(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER,
ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
//推送IMP001重试处理数量
ParamConfig retryNumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
Long retryNum = Long.parseLong(retryNumConfig.getCode());
//推送IMP001定时任务处理数量
ParamConfig rownumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
Long rownum = Long.parseLong(rownumConfig.getCode());
//获取需要重新处理的记录:处理4次以下,并且推送失败的
List<PushOb> errPushObLog = pushObRepository.findErrPushOb(retryNum, PushObStatusEnum.PUSH_FAILED.getCode(),rownum);
if (errPushObLog!=null && !errPushObLog.isEmpty()){
log.info("sendObRetryTask : sendObRetry size: "+errPushObLog.size());
//重新推送tw001数据
this.pushOb(errPushObLog);
}else{
log.info("sendObRetryTask : No data found for sendObRetry!");
}
}
/**
* @Author mt
* @Description 推送imp001数据
* @Date 2024/5/29
* @param pushObList
* @return void
*/
private void pushOb(List<PushOb> pushObList){
/**
* 推送成功状态字典
*/
DictionaryEntries pushSuccessEntries = cacheSystem.getDicPushObStatus(PushObStatusEnum.PUSH_SUCCESSFUL.getCode());
/**
* 推送失败状态字典
*/
DictionaryEntries pushFailedEntries = cacheSystem.getDicPushObStatus(PushObStatusEnum.PUSH_FAILED.getCode());
Utils.listOf(pushObList).stream().filter(Objects::nonNull).forEach(ob ->{
boolean flag = false;
String errorMsg = "";
Imp001GenerateBo imp001GenerateBo = null;
try {
//生成imp001 json对象dto
imp001GenerateBo = imp001GenerateUtil.generateImp001Json(ob);
//根据imp001 json对象生成并且推送zip包
imp001PushUtil.pushImp001(imp001GenerateBo);
flag = true;
}catch(Exception ex){
log.error("pushOb error : ",ex);
errorMsg = ex.getMessage();
flag = false;
}finally{
/**
* 如果生成失败,推送失败,则不会记录推送日志明细,更新推送日志表。
* 记录日志,并且备份
*/
if(flag){
//推送成功
imp001RecordLogUtil.pushSuccessRecordLog(imp001GenerateBo, ob, pushSuccessEntries);
}else{
//推送失败
imp001RecordLogUtil.pushFailRecordLog(imp001GenerateBo, ob, pushFailedEntries, errorMsg);
}
}
});
}
}
\ No newline at end of file
......
......@@ -268,15 +268,15 @@ public class ConFileEmailUtil {
//如果失败次数小于三则更新为待处理,继续处理
if (result){
conPushEmail.setTypeCode(success.getCode());
conPushEmail.setTypeName(success.getEnglishName());
conPushEmail.setTypeName(success.getDescription());
}else {
if (conPushEmail.getSendNum()<3){
conPushEmail.setTypeCode(pending.getCode());
conPushEmail.setTypeName(pending.getEnglishName());
conPushEmail.setTypeName(pending.getDescription());
conPushEmail.setSendNum(conPushEmail.getSendNum()+1);
}else {
conPushEmail.setTypeCode(failed.getCode());
conPushEmail.setTypeName(failed.getEnglishName());
conPushEmail.setTypeName(failed.getDescription());
}
}
}
......
......@@ -122,15 +122,15 @@ public class DuplicateEmailUtil {
email.setSendTime(new Date());
if (result){
email.setStatusCode(success.getCode());
email.setStatusName(success.getEnglishName());
email.setStatusName(success.getDescription());
}else {
if (email.getSendNum()<3){
email.setStatusCode(pending.getCode());
email.setStatusName(pending.getEnglishName());
email.setStatusName(pending.getDescription());
email.setSendNum(email.getSendNum()+1);
}else {
email.setStatusCode(failed.getCode());
email.setStatusName(failed.getEnglishName());
email.setStatusName(failed.getDescription());
}
}
}
......
......@@ -41,10 +41,10 @@ rpc:
rpcKafkaReceive1: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive
rpcKafkaReceive2: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive
tw001:
imp001:
path:
#基础路径
basePath: /var/share/icleartw/TWIMPORT/
basePath: /var/share/iClearPreCLR/ToIMPORT/
#json生成路径
work: ${tw001.path.basePath}work/
#zip输出目录
......
......@@ -21,10 +21,10 @@ rpc:
rpcKafkaReceive1: https://pjea0179.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive
rpcKafkaReceive2: https://pjea0180.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive
tw001:
imp001:
path:
#基础路径
basePath: /var/share/icleartw/TWIMPORT/
basePath: /var/share/iClearPreCLR/ToIMPORT/
#json生成路径
work: ${tw001.path.basePath}work/
#zip输出目录
......
......@@ -21,10 +21,10 @@ rpc:
rpcKafkaReceive1: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive
rpcKafkaReceive2: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive
tw001:
imp001:
path:
#基础路径
basePath: /app/Oracle/Middleware/user_projects/domains/base_domain/exportTw/TWIMPORT/
basePath: /app/Oracle/Middleware/user_projects/domains/base_domain/iClearPreCLR/ToIMPORT/
#json生成路径
work: ${tw001.path.basePath}work/
#zip输出目录
......
......@@ -21,10 +21,10 @@ rpc:
rpcKafkaReceive1: http://ujea0145.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive
rpcKafkaReceive2: http://ujea0146.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive
tw001:
imp001:
path:
#基础路径
basePath: /var/share/icleartw/TWIMPORT/
basePath: /var/share/iClearPreCLR/ToIMPORT/
#json生成路径
work: ${tw001.path.basePath}work/
#zip输出目录
......