tao.mo

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

mt
2024年12月18日17:39:06
Showing 39 changed files with 1001 additions and 832 deletions
...@@ -196,13 +196,13 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS ...@@ -196,13 +196,13 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
196 } 196 }
197 } 197 }
198 /** 198 /**
199 - * Todo 初始化插入预清关文件推送任务日志,szl添加 199 + * Todo 初始化插入预清关文件推送邮件任务日志,szl添加
200 */ 200 */
201 201
202 /** 202 /**
203 - * 初始化插入预清关文件邮件推送日志,mt添加 203 + * 初始化插入预清关文件推送日志,mt添加
204 */ 204 */
205 - PushOb pushOb = pushObUtil.initPushOb(consignment,user); 205 + PushOb pushOb = pushObUtil.initPushOb(consignment,uploadRecord,user);
206 /** 206 /**
207 * 初始化插入提醒发件人邮件日志 207 * 初始化插入提醒发件人邮件日志
208 */ 208 */
......
...@@ -52,10 +52,10 @@ public class AttachmentUtil { ...@@ -52,10 +52,10 @@ public class AttachmentUtil {
52 private void initAttachment(Attachment attachment,String bizType,User user) throws Exception{ 52 private void initAttachment(Attachment attachment,String bizType,User user) throws Exception{
53 DictionaryEntries attachmentBizTypeEntries = cacheSystem.getDicAttachmentBizType(AttachmentBizTypeEnum.getCodeByExt1(bizType)); 53 DictionaryEntries attachmentBizTypeEntries = cacheSystem.getDicAttachmentBizType(AttachmentBizTypeEnum.getCodeByExt1(bizType));
54 attachment.setBizTypeCode(attachmentBizTypeEntries.getCode()); 54 attachment.setBizTypeCode(attachmentBizTypeEntries.getCode());
55 - attachment.setBizTypeName(attachmentBizTypeEntries.getEnglishName()); 55 + attachment.setBizTypeName(attachmentBizTypeEntries.getDescription());
56 DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentFileType(AttachmentFileTypeEnum.FILE.getCode()); 56 DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentFileType(AttachmentFileTypeEnum.FILE.getCode());
57 attachment.setFileTypeCode(attachmentFileTypeEntries.getCode()); 57 attachment.setFileTypeCode(attachmentFileTypeEntries.getCode());
58 - attachment.setFileTypeName(attachmentFileTypeEntries.getEnglishName()); 58 + attachment.setFileTypeName(attachmentFileTypeEntries.getDescription());
59 attachment.setStatus(StatusEnum.YES.getCode()); 59 attachment.setStatus(StatusEnum.YES.getCode());
60 attachment.setCreateUserId(user.getId()); 60 attachment.setCreateUserId(user.getId());
61 attachment.setCreateUserName(user.getUserName()); 61 attachment.setCreateUserName(user.getUserName());
......
...@@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; ...@@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
7 import com.fedex.connect.common.model.bi.DictionaryEntries; 7 import com.fedex.connect.common.model.bi.DictionaryEntries;
8 import com.fedex.connect.common.model.biz.Consignment; 8 import com.fedex.connect.common.model.biz.Consignment;
9 import com.fedex.connect.common.model.biz.PushOb; 9 import com.fedex.connect.common.model.biz.PushOb;
10 +import com.fedex.connect.common.model.biz.UploadRecord;
10 import com.fedex.connect.common.model.sys.User; 11 import com.fedex.connect.common.model.sys.User;
11 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
12 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
...@@ -29,14 +30,15 @@ public class PushObUtil { ...@@ -29,14 +30,15 @@ public class PushObUtil {
29 * @param 30 * @param
30 * @return com.fedex.connect.common.model.biz.PushOb 31 * @return com.fedex.connect.common.model.biz.PushOb
31 */ 32 */
32 - public PushOb initPushOb(Consignment consignment, User user) throws Exception{ 33 + public PushOb initPushOb(Consignment consignment, UploadRecord uploadRecord, User user) throws Exception{
33 DictionaryEntries pushObStatus = cacheSystem.getDicPushObStatus(PushObStatusEnum.TO_BE_SENT.getCode()); 34 DictionaryEntries pushObStatus = cacheSystem.getDicPushObStatus(PushObStatusEnum.TO_BE_SENT.getCode());
34 PushOb pushOb = new PushOb(); 35 PushOb pushOb = new PushOb();
35 pushOb.setConsignmentId(consignment.getId()); 36 pushOb.setConsignmentId(consignment.getId());
36 pushOb.setConsignmentCode(consignment.getConsignmentCode()); 37 pushOb.setConsignmentCode(consignment.getConsignmentCode());
37 pushOb.setPushNum(DigitConstants.DIGIT_ZERO_LONG); 38 pushOb.setPushNum(DigitConstants.DIGIT_ZERO_LONG);
38 pushOb.setStatusCode(pushObStatus.getCode()); 39 pushOb.setStatusCode(pushObStatus.getCode());
39 - pushOb.setStatusName(pushObStatus.getEnglishName()); 40 + pushOb.setStatusName(pushObStatus.getDescription());
41 + pushOb.setUploadRecordId(uploadRecord.getId());
40 pushOb.setCreateUserId(user.getId()); 42 pushOb.setCreateUserId(user.getId());
41 pushOb.setCreateUserName(user.getUserName()); 43 pushOb.setCreateUserName(user.getUserName());
42 pushOb.setModifyUserId(user.getId()); 44 pushOb.setModifyUserId(user.getId());
......
...@@ -38,4 +38,4 @@ export: ...@@ -38,4 +38,4 @@ export:
38 38
39 upload: 39 upload:
40 path: 40 path:
41 - attachment: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/attachment
...\ No newline at end of file ...\ No newline at end of file
41 + attachment: /var/share/iclearConnect/upload/attachment
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
19 <result column="MODIFY_TIME" jdbcType="TIMESTAMP" property="modifyTime" /> 19 <result column="MODIFY_TIME" jdbcType="TIMESTAMP" property="modifyTime" />
20 <result column="MODIFY_USER_ID" jdbcType="NUMERIC" property="modifyUserId" /> 20 <result column="MODIFY_USER_ID" jdbcType="NUMERIC" property="modifyUserId" />
21 <result column="MODIFY_USER_NAME" jdbcType="VARCHAR" property="modifyUserName" /> 21 <result column="MODIFY_USER_NAME" jdbcType="VARCHAR" property="modifyUserName" />
22 + <result column="UPLOAD_RECORD_ID" jdbcType="NUMERIC" property="uploadRecordId" />
22 </resultMap> 23 </resultMap>
23 <sql id="Example_Where_Clause"> 24 <sql id="Example_Where_Clause">
24 <where> 25 <where>
...@@ -81,7 +82,7 @@ ...@@ -81,7 +82,7 @@
81 <sql id="Base_Column_List"> 82 <sql id="Base_Column_List">
82 ID, CONSIGNMENT_CODE, CONSIGNMENT_ID, PUSH_TIME, STATUS_CODE, STATUS_NAME, PUSH_NUM, 83 ID, CONSIGNMENT_CODE, CONSIGNMENT_ID, PUSH_TIME, STATUS_CODE, STATUS_NAME, PUSH_NUM,
83 FILE_PATH, FILE_BACK_PATH, FILE_NAME, REMARK, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME, 84 FILE_PATH, FILE_BACK_PATH, FILE_NAME, REMARK, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME,
84 - MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME 85 + MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME, UPLOAD_RECORD_ID
85 </sql> 86 </sql>
86 <select id="selectByExample" parameterType="com.fedex.connect.common.model.biz.PushObExample" resultMap="BaseResultMap"> 87 <select id="selectByExample" parameterType="com.fedex.connect.common.model.biz.PushObExample" resultMap="BaseResultMap">
87 <include refid="OracleDialectPrefix" /> 88 <include refid="OracleDialectPrefix" />
...@@ -125,13 +126,15 @@ ...@@ -125,13 +126,15 @@
125 PUSH_NUM, FILE_PATH, FILE_BACK_PATH, 126 PUSH_NUM, FILE_PATH, FILE_BACK_PATH,
126 FILE_NAME, REMARK, CREATE_TIME, 127 FILE_NAME, REMARK, CREATE_TIME,
127 CREATE_USER_ID, CREATE_USER_NAME, MODIFY_TIME, 128 CREATE_USER_ID, CREATE_USER_NAME, MODIFY_TIME,
128 - MODIFY_USER_ID, MODIFY_USER_NAME) 129 + MODIFY_USER_ID, MODIFY_USER_NAME, UPLOAD_RECORD_ID
130 + )
129 values (#{id,jdbcType=NUMERIC}, #{consignmentCode,jdbcType=VARCHAR}, #{consignmentId,jdbcType=NUMERIC}, 131 values (#{id,jdbcType=NUMERIC}, #{consignmentCode,jdbcType=VARCHAR}, #{consignmentId,jdbcType=NUMERIC},
130 #{pushTime,jdbcType=TIMESTAMP}, #{statusCode,jdbcType=VARCHAR}, #{statusName,jdbcType=VARCHAR}, 132 #{pushTime,jdbcType=TIMESTAMP}, #{statusCode,jdbcType=VARCHAR}, #{statusName,jdbcType=VARCHAR},
131 #{pushNum,jdbcType=NUMERIC}, #{filePath,jdbcType=VARCHAR}, #{fileBackPath,jdbcType=VARCHAR}, 133 #{pushNum,jdbcType=NUMERIC}, #{filePath,jdbcType=VARCHAR}, #{fileBackPath,jdbcType=VARCHAR},
132 #{fileName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 134 #{fileName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
133 #{createUserId,jdbcType=NUMERIC}, #{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, 135 #{createUserId,jdbcType=NUMERIC}, #{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
134 - #{modifyUserId,jdbcType=NUMERIC}, #{modifyUserName,jdbcType=VARCHAR}) 136 + #{modifyUserId,jdbcType=NUMERIC}, #{modifyUserName,jdbcType=VARCHAR}, #{uploadRecordId,jdbcType=NUMERIC}
137 + )
135 </insert> 138 </insert>
136 <insert id="insertSelective" parameterType="com.fedex.connect.common.model.biz.PushOb"> 139 <insert id="insertSelective" parameterType="com.fedex.connect.common.model.biz.PushOb">
137 <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long"> 140 <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
...@@ -188,6 +191,9 @@ ...@@ -188,6 +191,9 @@
188 <if test="modifyUserName != null"> 191 <if test="modifyUserName != null">
189 MODIFY_USER_NAME, 192 MODIFY_USER_NAME,
190 </if> 193 </if>
194 + <if test="uploadRecordId != null">
195 + UPLOAD_RECORD_ID,
196 + </if>
191 </trim> 197 </trim>
192 <trim prefix="values (" suffix=")" suffixOverrides=","> 198 <trim prefix="values (" suffix=")" suffixOverrides=",">
193 #{id,jdbcType=NUMERIC}, 199 #{id,jdbcType=NUMERIC},
...@@ -239,6 +245,9 @@ ...@@ -239,6 +245,9 @@
239 <if test="modifyUserName != null"> 245 <if test="modifyUserName != null">
240 #{modifyUserName,jdbcType=VARCHAR}, 246 #{modifyUserName,jdbcType=VARCHAR},
241 </if> 247 </if>
248 + <if test="uploadRecordId != null">
249 + #{uploadRecordId,jdbcType=NUMERIC},
250 + </if>
242 </trim> 251 </trim>
243 </insert> 252 </insert>
244 <select id="countByExample" parameterType="com.fedex.connect.common.model.biz.PushObExample" resultType="java.lang.Long"> 253 <select id="countByExample" parameterType="com.fedex.connect.common.model.biz.PushObExample" resultType="java.lang.Long">
...@@ -301,6 +310,9 @@ ...@@ -301,6 +310,9 @@
301 <if test="record.modifyUserName != null"> 310 <if test="record.modifyUserName != null">
302 MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR}, 311 MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
303 </if> 312 </if>
313 + <if test="record.uploadRecordId != null">
314 + UPLOAD_RECORD_ID = #{record.uploadRecordId,jdbcType=NUMERIC},
315 + </if>
304 </set> 316 </set>
305 <if test="_parameter != null"> 317 <if test="_parameter != null">
306 <include refid="Update_By_Example_Where_Clause" /> 318 <include refid="Update_By_Example_Where_Clause" />
...@@ -324,7 +336,8 @@ ...@@ -324,7 +336,8 @@
324 CREATE_USER_NAME = #{record.createUserName,jdbcType=VARCHAR}, 336 CREATE_USER_NAME = #{record.createUserName,jdbcType=VARCHAR},
325 MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP}, 337 MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
326 MODIFY_USER_ID = #{record.modifyUserId,jdbcType=NUMERIC}, 338 MODIFY_USER_ID = #{record.modifyUserId,jdbcType=NUMERIC},
327 - MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR} 339 + MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
340 + UPLOAD_RECORD_ID = #{record.uploadRecordId,jdbcType=NUMERIC}
328 <if test="_parameter != null"> 341 <if test="_parameter != null">
329 <include refid="Update_By_Example_Where_Clause" /> 342 <include refid="Update_By_Example_Where_Clause" />
330 </if> 343 </if>
...@@ -380,6 +393,9 @@ ...@@ -380,6 +393,9 @@
380 <if test="modifyUserName != null"> 393 <if test="modifyUserName != null">
381 MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR}, 394 MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
382 </if> 395 </if>
396 + <if test="uploadRecordId != null">
397 + UPLOAD_RECORD_ID = #{uploadRecordId,jdbcType=NUMERIC},
398 + </if>
383 </set> 399 </set>
384 where ID = #{id,jdbcType=NUMERIC} 400 where ID = #{id,jdbcType=NUMERIC}
385 </update> 401 </update>
...@@ -400,7 +416,8 @@ ...@@ -400,7 +416,8 @@
400 CREATE_USER_NAME = #{createUserName,jdbcType=VARCHAR}, 416 CREATE_USER_NAME = #{createUserName,jdbcType=VARCHAR},
401 MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP}, 417 MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
402 MODIFY_USER_ID = #{modifyUserId,jdbcType=NUMERIC}, 418 MODIFY_USER_ID = #{modifyUserId,jdbcType=NUMERIC},
403 - MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR} 419 + MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
420 + UPLOAD_RECORD_ID = #{uploadRecordId,jdbcType=NUMERIC}
404 where ID = #{id,jdbcType=NUMERIC} 421 where ID = #{id,jdbcType=NUMERIC}
405 </update> 422 </update>
406 <sql id="OracleDialectPrefix"> 423 <sql id="OracleDialectPrefix">
......
...@@ -94,6 +94,11 @@ public class PushOb implements Serializable { ...@@ -94,6 +94,11 @@ public class PushOb implements Serializable {
94 */ 94 */
95 private String modifyUserName; 95 private String modifyUserName;
96 96
97 + /**
98 + * 用户上传记录表ID
99 + */
100 + private Long uploadRecordId;
101 +
97 private static final long serialVersionUID = 1L; 102 private static final long serialVersionUID = 1L;
98 103
99 public Long getId() { 104 public Long getId() {
...@@ -232,6 +237,14 @@ public class PushOb implements Serializable { ...@@ -232,6 +237,14 @@ public class PushOb implements Serializable {
232 this.modifyUserName = modifyUserName == null ? null : modifyUserName.trim(); 237 this.modifyUserName = modifyUserName == null ? null : modifyUserName.trim();
233 } 238 }
234 239
240 + public Long getUploadRecordId() {
241 + return uploadRecordId;
242 + }
243 +
244 + public void setUploadRecordId(Long uploadRecordId) {
245 + this.uploadRecordId = uploadRecordId;
246 + }
247 +
235 @Override 248 @Override
236 public String toString() { 249 public String toString() {
237 StringBuilder sb = new StringBuilder(); 250 StringBuilder sb = new StringBuilder();
...@@ -255,6 +268,7 @@ public class PushOb implements Serializable { ...@@ -255,6 +268,7 @@ public class PushOb implements Serializable {
255 sb.append(", modifyTime=").append(modifyTime); 268 sb.append(", modifyTime=").append(modifyTime);
256 sb.append(", modifyUserId=").append(modifyUserId); 269 sb.append(", modifyUserId=").append(modifyUserId);
257 sb.append(", modifyUserName=").append(modifyUserName); 270 sb.append(", modifyUserName=").append(modifyUserName);
271 + sb.append(", uploadRecordId=").append(uploadRecordId);
258 sb.append(", serialVersionUID=").append(serialVersionUID); 272 sb.append(", serialVersionUID=").append(serialVersionUID);
259 sb.append("]"); 273 sb.append("]");
260 return sb.toString(); 274 return sb.toString();
......
...@@ -35,12 +35,12 @@ public class PushObDetail implements Serializable { ...@@ -35,12 +35,12 @@ public class PushObDetail implements Serializable {
35 private String statusName; 35 private String statusName;
36 36
37 /** 37 /**
38 - * 推送文件类型字典CODE,关联数据字典表。指定字典目录CODE:PUSH_OB_FILE_TYPE 38 + * 推送文件类型字典CODE,关联数据字典表。指定字典目录CODE:ATTACHMENT_BIZ_TYPE,取值Ext1 字段值
39 */ 39 */
40 private String fileTypeCode; 40 private String fileTypeCode;
41 41
42 /** 42 /**
43 - * 推送文件类型名称(XXX、XXX 43 + * 推送文件类型名称(AWB、INV、PKL、OTH
44 */ 44 */
45 private String fileType; 45 private String fileType;
46 46
......
...@@ -1234,6 +1234,66 @@ public class PushObExample { ...@@ -1234,6 +1234,66 @@ public class PushObExample {
1234 addCriterion("MODIFY_USER_NAME not between", value1, value2, "modifyUserName"); 1234 addCriterion("MODIFY_USER_NAME not between", value1, value2, "modifyUserName");
1235 return (Criteria) this; 1235 return (Criteria) this;
1236 } 1236 }
1237 +
1238 + public Criteria andUploadRecordIdIsNull() {
1239 + addCriterion("UPLOAD_RECORD_ID is null");
1240 + return (Criteria) this;
1241 + }
1242 +
1243 + public Criteria andUploadRecordIdIsNotNull() {
1244 + addCriterion("UPLOAD_RECORD_ID is not null");
1245 + return (Criteria) this;
1246 + }
1247 +
1248 + public Criteria andUploadRecordIdEqualTo(Long value) {
1249 + addCriterion("UPLOAD_RECORD_ID =", value, "uploadRecordId");
1250 + return (Criteria) this;
1251 + }
1252 +
1253 + public Criteria andUploadRecordIdNotEqualTo(Long value) {
1254 + addCriterion("UPLOAD_RECORD_ID <>", value, "uploadRecordId");
1255 + return (Criteria) this;
1256 + }
1257 +
1258 + public Criteria andUploadRecordIdGreaterThan(Long value) {
1259 + addCriterion("UPLOAD_RECORD_ID >", value, "uploadRecordId");
1260 + return (Criteria) this;
1261 + }
1262 +
1263 + public Criteria andUploadRecordIdGreaterThanOrEqualTo(Long value) {
1264 + addCriterion("UPLOAD_RECORD_ID >=", value, "uploadRecordId");
1265 + return (Criteria) this;
1266 + }
1267 +
1268 + public Criteria andUploadRecordIdLessThan(Long value) {
1269 + addCriterion("UPLOAD_RECORD_ID <", value, "uploadRecordId");
1270 + return (Criteria) this;
1271 + }
1272 +
1273 + public Criteria andUploadRecordIdLessThanOrEqualTo(Long value) {
1274 + addCriterion("UPLOAD_RECORD_ID <=", value, "uploadRecordId");
1275 + return (Criteria) this;
1276 + }
1277 +
1278 + public Criteria andUploadRecordIdIn(List<Long> values) {
1279 + addCriterion("UPLOAD_RECORD_ID in", values, "uploadRecordId");
1280 + return (Criteria) this;
1281 + }
1282 +
1283 + public Criteria andUploadRecordIdNotIn(List<Long> values) {
1284 + addCriterion("UPLOAD_RECORD_ID not in", values, "uploadRecordId");
1285 + return (Criteria) this;
1286 + }
1287 +
1288 + public Criteria andUploadRecordIdBetween(Long value1, Long value2) {
1289 + addCriterion("UPLOAD_RECORD_ID between", value1, value2, "uploadRecordId");
1290 + return (Criteria) this;
1291 + }
1292 +
1293 + public Criteria andUploadRecordIdNotBetween(Long value1, Long value2) {
1294 + addCriterion("UPLOAD_RECORD_ID not between", value1, value2, "uploadRecordId");
1295 + return (Criteria) this;
1296 + }
1237 } 1297 }
1238 1298
1239 public static class Criteria extends GeneratedCriteria { 1299 public static class Criteria extends GeneratedCriteria {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
40 sys:系统 系统相关表,例如kafka表 40 sys:系统 系统相关表,例如kafka表
41 log: 日志 日志记录表,例如邮件发送日志表 41 log: 日志 日志记录表,例如邮件发送日志表
42 --> 42 -->
43 - <javaModelGenerator targetPackage="com.fedex.connect.common.model.sys" targetProject="src/main/java"> 43 + <javaModelGenerator targetPackage="com.fedex.connect.common.model.biz" targetProject="src/main/java">
44 <!---enableSubPackages:如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性--> 44 <!---enableSubPackages:如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性-->
45 <property name="enableSubPackages" value="false"/> 45 <property name="enableSubPackages" value="false"/>
46 <!--该属性只对MyBatis3有效,如果true就会使用构造方法入参,如果false就会使用setter方式。默认为false--> 46 <!--该属性只对MyBatis3有效,如果true就会使用构造方法入参,如果false就会使用setter方式。默认为false-->
...@@ -52,13 +52,13 @@ ...@@ -52,13 +52,13 @@
52 </javaModelGenerator> 52 </javaModelGenerator>
53 53
54 <!-- 生成映射文件*.xml的位置--> 54 <!-- 生成映射文件*.xml的位置-->
55 - <sqlMapGenerator targetPackage="mapper.sys" targetProject="src/main/java/com/fedex/connect/common"> 55 + <sqlMapGenerator targetPackage="mapper.biz" targetProject="src/main/java/com/fedex/connect/common">
56 <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false--> 56 <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false-->
57 <property name="enableSubPackages" value="false"/> 57 <property name="enableSubPackages" value="false"/>
58 </sqlMapGenerator> 58 </sqlMapGenerator>
59 59
60 <!-- 生成DAO的包名和位置 --> 60 <!-- 生成DAO的包名和位置 -->
61 - <javaClientGenerator type="XMLMAPPER" targetPackage="com.fedex.connect.common.dao.sys" targetProject="src/main/java"> 61 + <javaClientGenerator type="XMLMAPPER" targetPackage="com.fedex.connect.common.dao.biz" targetProject="src/main/java">
62 <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false--> 62 <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false-->
63 <property name="enableSubPackages" value="false"/> 63 <property name="enableSubPackages" value="false"/>
64 </javaClientGenerator> 64 </javaClientGenerator>
...@@ -135,14 +135,12 @@ ...@@ -135,14 +135,12 @@
135 <!-- selectByExampleQueryId="true">--> 135 <!-- selectByExampleQueryId="true">-->
136 <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_PUSH_OB.NEXTVAL FROM DUAL" />--> 136 <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_PUSH_OB.NEXTVAL FROM DUAL" />-->
137 <!-- </table>--> 137 <!-- </table>-->
138 -<!-- <table tableName="T_BIZ_PUSH_OB_DETAIL" domainObjectName="PushObDetail"--> 138 + <table tableName="T_BIZ_PUSH_OB_DETAIL" domainObjectName="PushObDetail"
139 -<!-- enableCountByExample="true" enableUpdateByExample="true"--> 139 + enableCountByExample="true" enableUpdateByExample="true"
140 -<!-- enableDeleteByExample="true" enableSelectByExample="true"--> 140 + enableDeleteByExample="true" enableSelectByExample="true"
141 -<!-- selectByExampleQueryId="true">--> 141 + selectByExampleQueryId="true">
142 -<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_PUSH_OB_DETAIL.NEXTVAL FROM DUAL" />--> 142 + <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_PUSH_OB_DETAIL.NEXTVAL FROM DUAL" />
143 -<!-- </table>--> 143 + </table>
144 -
145 -
146 144
147 <!-- <table tableName="T_BI_PORTCLEAR_EMAIL_MAPPING" domainObjectName="PortclearEmailMapping"--> 145 <!-- <table tableName="T_BI_PORTCLEAR_EMAIL_MAPPING" domainObjectName="PortclearEmailMapping"-->
148 <!-- enableCountByExample="true" enableUpdateByExample="true"--> 146 <!-- enableCountByExample="true" enableUpdateByExample="true"-->
...@@ -169,12 +167,12 @@ ...@@ -169,12 +167,12 @@
169 <!-- selectByExampleQueryId="true">--> 167 <!-- selectByExampleQueryId="true">-->
170 <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_KAFKA_TEMPORARY_STORAGE.NEXTVAL FROM DUAL" />--> 168 <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_KAFKA_TEMPORARY_STORAGE.NEXTVAL FROM DUAL" />-->
171 <!-- </table>--> 169 <!-- </table>-->
172 - <table schema="ICLEARIMP" tableName="T_SYS_PARAM_CONFIG" domainObjectName="ParamConfig" 170 +<!-- <table schema="ICLEARIMP" tableName="T_SYS_PARAM_CONFIG" domainObjectName="ParamConfig"-->
173 - enableCountByExample="true" enableUpdateByExample="true" 171 +<!-- enableCountByExample="true" enableUpdateByExample="true"-->
174 - enableDeleteByExample="true" enableSelectByExample="true" 172 +<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
175 - selectByExampleQueryId="true"> 173 +<!-- selectByExampleQueryId="true">-->
176 - <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_PARAM_CONFIG.NEXTVAL FROM DUAL" /> 174 +<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_PARAM_CONFIG.NEXTVAL FROM DUAL" />-->
177 - </table> 175 +<!-- </table>-->
178 <!-- <table tableName="T_SYS_PRIVILEGE" domainObjectName="Privilege"--> 176 <!-- <table tableName="T_SYS_PRIVILEGE" domainObjectName="Privilege"-->
179 <!-- enableCountByExample="true" enableUpdateByExample="true"--> 177 <!-- enableCountByExample="true" enableUpdateByExample="true"-->
180 <!-- enableDeleteByExample="true" enableSelectByExample="true"--> 178 <!-- enableDeleteByExample="true" enableSelectByExample="true"-->
...@@ -193,12 +191,12 @@ ...@@ -193,12 +191,12 @@
193 <!-- selectByExampleQueryId="true">--> 191 <!-- selectByExampleQueryId="true">-->
194 <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_ROLE_PRIVILEGE.NEXTVAL FROM DUAL" />--> 192 <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_ROLE_PRIVILEGE.NEXTVAL FROM DUAL" />-->
195 <!-- </table>--> 193 <!-- </table>-->
196 - <table schema="ICLEARIMP" tableName="T_SYS_USER" domainObjectName="User" 194 +<!-- <table schema="ICLEARIMP" tableName="T_SYS_USER" domainObjectName="User"-->
197 - enableCountByExample="true" enableUpdateByExample="true" 195 +<!-- enableCountByExample="true" enableUpdateByExample="true"-->
198 - enableDeleteByExample="true" enableSelectByExample="true" 196 +<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
199 - selectByExampleQueryId="true"> 197 +<!-- selectByExampleQueryId="true">-->
200 - <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_USER.NEXTVAL FROM DUAL" /> 198 +<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_USER.NEXTVAL FROM DUAL" />-->
201 - </table> 199 +<!-- </table>-->
202 <!-- <table schema="ICLEARIMP" tableName="T_SYS_USER_ROLE" domainObjectName="UserRole"--> 200 <!-- <table schema="ICLEARIMP" tableName="T_SYS_USER_ROLE" domainObjectName="UserRole"-->
203 <!-- enableCountByExample="true" enableUpdateByExample="true"--> 201 <!-- enableCountByExample="true" enableUpdateByExample="true"-->
204 <!-- enableDeleteByExample="true" enableSelectByExample="true"--> 202 <!-- enableDeleteByExample="true" enableSelectByExample="true"-->
......
...@@ -70,7 +70,7 @@ public interface BaseSeparatorConstants { ...@@ -70,7 +70,7 @@ public interface BaseSeparatorConstants {
70 String SEPARATOR_ASTERISK = "*"; 70 String SEPARATOR_ASTERISK = "*";
71 71
72 /** 72 /**
73 - * @Description 星号 73 + * @Description 反斜杠
74 * @Author mt 74 * @Author mt
75 * @Date 2024-11-11 75 * @Date 2024-11-11
76 */ 76 */
......
...@@ -24,6 +24,7 @@ public class DateUtil { ...@@ -24,6 +24,7 @@ public class DateUtil {
24 public static final String PATTERN_DATE_TIME_ORACLE = "yyyy-MM-dd hh:mi:ss"; 24 public static final String PATTERN_DATE_TIME_ORACLE = "yyyy-MM-dd hh:mi:ss";
25 public static final String PATTERN_DATE_TIME_MS = "yyyy-mm-dd hh24:mi:ss"; 25 public static final String PATTERN_DATE_TIME_MS = "yyyy-mm-dd hh24:mi:ss";
26 public static final String PATTERN_yyyyMMddHHmmss = "yyyyMMddHHmmss"; 26 public static final String PATTERN_yyyyMMddHHmmss = "yyyyMMddHHmmss";
27 + public static final String YYYYMMDDHH24MMSSSSS = "yyyyMMddHHmmssSSS";
27 28
28 private static SimpleDateFormat dateFormat = new SimpleDateFormat(); 29 private static SimpleDateFormat dateFormat = new SimpleDateFormat();
29 30
...@@ -47,6 +48,19 @@ public class DateUtil { ...@@ -47,6 +48,19 @@ public class DateUtil {
47 dateFormat.applyPattern(PATTERN_DATE_TIME); 48 dateFormat.applyPattern(PATTERN_DATE_TIME);
48 return dateFormat.format(date); 49 return dateFormat.format(date);
49 } 50 }
51 +
52 + /**
53 + * 用默认格式格式化日期
54 + *
55 + * @param date
56 + * @return
57 + */
58 + public static String yyyyMMddHH24mmssSSS(Date date) {
59 + SimpleDateFormat dateFormat = new SimpleDateFormat();
60 + dateFormat.applyPattern(YYYYMMDDHH24MMSSSSS);
61 + return dateFormat.format(date);
62 + }
63 +
50 /** 64 /**
51 * 用指定格式格式化日期 65 * 用指定格式格式化日期
52 * 66 *
......
...@@ -262,4 +262,43 @@ public class NIOFileUtils { ...@@ -262,4 +262,43 @@ public class NIOFileUtils {
262 } 262 }
263 return false; 263 return false;
264 } 264 }
265 +
266 + /**
267 + * @Author mt
268 + * @Description 移动文件
269 + * @Date 2024/5/30
270 + * @param sourcePath
271 + * @param targetPath
272 + * @return void
273 + */
274 + public void moveFile(String sourcePath,String targetPath) throws Exception{
275 + //覆盖方式移动
276 + Files.move(Paths.get(sourcePath),Paths.get(targetPath),StandardCopyOption.REPLACE_EXISTING);
277 + }
278 +
279 + /**
280 + * @Author mt
281 + * @Description 判断文件是否存在
282 + * @Date 2024/9/10
283 + * @param filePath
284 + * @return boolean
285 + */
286 + public boolean fileExists(String filePath){
287 + return new File(filePath).exists();
288 + }
289 +
290 + /**
291 + * @Author mt
292 + * @Description 如果文件夹不存在则创建文件夹
293 + * @Date 2024/5/29
294 + * @param targetFolder
295 + * @return void
296 + */
297 + public void mkdirs(String targetFolder){
298 + File folder = new File(targetFolder);
299 + // 文件夹不存在,则创建文件夹
300 + if (!folder.exists()) {
301 + folder.mkdirs();
302 + }
303 + }
265 } 304 }
......
...@@ -497,7 +497,7 @@ public class StringExtUtil { ...@@ -497,7 +497,7 @@ public class StringExtUtil {
497 * @param val ID值 497 * @param val ID值
498 * @return 498 * @return
499 */ 499 */
500 - public static String idLeftPadStr(Long val){ 500 + public static String idLeftPadStr(Long val, Integer len){
501 if (val == null){ 501 if (val == null){
502 return null; 502 return null;
503 } 503 }
...@@ -505,9 +505,8 @@ public class StringExtUtil { ...@@ -505,9 +505,8 @@ public class StringExtUtil {
505 return "0"; 505 return "0";
506 } 506 }
507 String valStr = val.toString(); 507 String valStr = val.toString();
508 - int len = valStr.length(); 508 + if (valStr.length() <= len){
509 - if (valStr.length() <= 10){ 509 + return StringUtils.leftPad(valStr,len,"0");
510 - return StringUtils.leftPad(valStr,10,"0");
511 } else { 510 } else {
512 return valStr; 511 return valStr;
513 } 512 }
...@@ -554,4 +553,10 @@ public class StringExtUtil { ...@@ -554,4 +553,10 @@ public class StringExtUtil {
554 } 553 }
555 } 554 }
556 555
556 + public static void main(String[] args){
557 + String fileName = "202410271_20241027113156.pdf";
558 + String f = fileName.substring(fileName.lastIndexOf("."));
559 + System.out.println(f);
560 + }
561 +
557 } 562 }
......
...@@ -75,4 +75,17 @@ public class PropertiesConfig { ...@@ -75,4 +75,17 @@ public class PropertiesConfig {
75 75
76 @Value("${export.mail.sendEmail.password}") 76 @Value("${export.mail.sendEmail.password}")
77 String emailPassword; 77 String emailPassword;
78 +
79 + //基础路径
80 + @Value("${imp001.path.work}")
81 + String imp001PathWork;
82 + //zip输出目录
83 + @Value("${imp001.path.final}")
84 + String imp001PathFinal;
85 + //文件备份目录
86 + @Value("${imp001.path.bak}")
87 + String imp001PathBak;
88 + //文件异常文件存放目录
89 + @Value("${imp001.path.error}")
90 + String imp001PathError;
78 } 91 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -6,7 +6,11 @@ package com.fedex.connect.task.constants; ...@@ -6,7 +6,11 @@ package com.fedex.connect.task.constants;
6 * @Date 2024/4/18 6 * @Date 2024/4/18
7 */ 7 */
8 public interface Constant { 8 public interface Constant {
9 - //TW001表头信息 9 + /**
10 + * @Author mt
11 + * @Description IMP001表头信息
12 + * @Date 2024/12/18
13 + */
10 interface IMP001_HEAD_KEYS{ 14 interface IMP001_HEAD_KEYS{
11 /** 15 /**
12 * 消息代码:IMP001报文标志 16 * 消息代码:IMP001报文标志
...@@ -15,14 +19,18 @@ public interface Constant { ...@@ -15,14 +19,18 @@ public interface Constant {
15 /** 19 /**
16 * 发送程序ID:TWEXP 20 * 发送程序ID:TWEXP
17 */ 21 */
18 - String SENDER_ID = "TWEXP"; 22 + String SENDER_ID = "PreCLR";
19 /** 23 /**
20 * 接受程序ID:IMP 24 * 接受程序ID:IMP
21 */ 25 */
22 String RECEIVER_ID = "IMP"; 26 String RECEIVER_ID = "IMP";
23 } 27 }
24 28
25 - //文件后缀字符串keys 29 + /**
30 + * @Author mt
31 + * @Description 文件后缀字符串keys
32 + * @Date 2024/12/18
33 + */
26 interface FILE_SUFFIX_KEYS{ 34 interface FILE_SUFFIX_KEYS{
27 /** 35 /**
28 * json字符串 36 * json字符串
......
1 -package com.fedex.connect.task.data.bo;
2 -
3 -import lombok.Data;
4 -
5 -import java.util.Date;
6 -
7 -/**
8 - * @Author mt
9 - * @Description 类说明 文件信息bo
10 - * @Date 2024/5/30
11 - */
12 -@Data
13 -public class Imp001FileInfoBo {
14 - //文件类型id
15 - Long fileTypeId;
16 - //文件类型名称
17 - String fileTypeName;
18 - //文件名称
19 - String fileName;
20 - //生成时间
21 - Date pushTime;
22 -}
1 package com.fedex.connect.task.data.bo; 1 package com.fedex.connect.task.data.bo;
2 2
3 -import com.fedex.connect.common.model.bi.DictionaryEntries; 3 +import com.fedex.connect.task.data.dto.imp001.Imp001Files;
4 import com.fedex.connect.task.data.dto.imp001.Imp001RootJsonDto; 4 import com.fedex.connect.task.data.dto.imp001.Imp001RootJsonDto;
5 import lombok.Data; 5 import lombok.Data;
6 6
7 -import java.util.Dictionary;
8 -import java.util.List;
9 -
10 /** 7 /**
11 * @Author mt 8 * @Author mt
12 - * @Description 类说明 tw001生成bo 9 + * @Description 类说明 imp001生成bo
13 * @Date 2024/5/24 10 * @Date 2024/5/24
14 */ 11 */
15 @Data 12 @Data
16 public class Imp001GenerateBo { 13 public class Imp001GenerateBo {
17 - //tw001报文对象 14 + //运单号
15 + String consignmentCode;
16 + //运单ID
17 + Long consignmentId;
18 + //imp001报文对象
18 Imp001RootJsonDto imp001RootJsonDto; 19 Imp001RootJsonDto imp001RootJsonDto;
19 - //tw001临时文件夹目录 20 + //imp001临时文件夹目录
20 String workFilePath; 21 String workFilePath;
21 //需要打包压缩包文件信息名称 22 //需要打包压缩包文件信息名称
22 - List<Imp001FileInfoBo> fileInfoList; 23 + Imp001Files[] fileInfos;
23 - //json Dir对象
24 - DictionaryEntries jsonDictionary;
25 //zip文件名称 24 //zip文件名称
26 String zipFileName; 25 String zipFileName;
27 //zip推送目标目录 26 //zip推送目标目录
......
...@@ -13,15 +13,14 @@ import java.io.Serializable; ...@@ -13,15 +13,14 @@ import java.io.Serializable;
13 public class Imp001Consignment implements Serializable { 13 public class Imp001Consignment implements Serializable {
14 /** 14 /**
15 * @Author mt 15 * @Author mt
16 - * @Description 提单号码 16 + * @Description 每个报文只有一个12位运单号
17 - * 12位数字,提单号码,可以重复 17 + * @Date 2024年12月18日
18 - * @Date 2024/5/23
19 */ 18 */
20 private String deliveryNo; 19 private String deliveryNo;
21 /** 20 /**
22 * @Author mt 21 * @Author mt
23 - * @Description 联络人 22 + * @Description 运单附带文件数量
24 - * @Date 2024/5/23 23 + * @Date 2024年12月18日
25 */ 24 */
26 private Integer attachedFilesCount; 25 private Integer attachedFilesCount;
27 } 26 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -24,7 +24,7 @@ public class Imp001Job { ...@@ -24,7 +24,7 @@ public class Imp001Job {
24 @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_INTERVAL) 24 @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_INTERVAL)
25 @Scheduled(cron = "${export.task.allocation.sendOb}") 25 @Scheduled(cron = "${export.task.allocation.sendOb}")
26 public void sendObTask() { 26 public void sendObTask() {
27 - //sendObService.sendOb(); 27 + sendObService.sendOb();
28 } 28 }
29 29
30 /** 30 /**
...@@ -33,6 +33,6 @@ public class Imp001Job { ...@@ -33,6 +33,6 @@ public class Imp001Job {
33 @ProcessingInterval 33 @ProcessingInterval
34 @Scheduled(cron = "${export.task.allocation.sendObRetry}") 34 @Scheduled(cron = "${export.task.allocation.sendObRetry}")
35 public void sendObRetryTask() { 35 public void sendObRetryTask() {
36 - //sendObService.sendObRetry(); 36 + sendObService.sendObRetry();
37 } 37 }
38 } 38 }
......
1 package com.fedex.connect.task.repository.base; 1 package com.fedex.connect.task.repository.base;
2 2
3 -import com.fedex.connect.common.dao.biz.AttachmentMapper; 3 +import com.fedex.connect.common.dao.biz.*;
4 -import com.fedex.connect.common.dao.biz.ConsignmentMapper;
5 -import com.fedex.connect.common.dao.biz.EmailMapper;
6 -import com.fedex.connect.common.dao.biz.PushObMapper;
7 import com.fedex.connect.common.dao.log.EmailHistoryMapper; 4 import com.fedex.connect.common.dao.log.EmailHistoryMapper;
8 import com.fedex.connect.common.dao.sys.KafkaStorageHistoryMapper; 5 import com.fedex.connect.common.dao.sys.KafkaStorageHistoryMapper;
9 import com.fedex.connect.common.dao.sys.KafkaTemporaryStorageMapper; 6 import com.fedex.connect.common.dao.sys.KafkaTemporaryStorageMapper;
...@@ -23,6 +20,8 @@ public class AbstractDaoRepository { ...@@ -23,6 +20,8 @@ public class AbstractDaoRepository {
23 @Autowired 20 @Autowired
24 protected PushObMapper pushObMapper; 21 protected PushObMapper pushObMapper;
25 @Autowired 22 @Autowired
23 + protected PushObDetailMapper pushObDetailMapper;
24 + @Autowired
26 protected KafkaTemporaryStorageMapperExt kafkaTemporaryStorageMapperExt; 25 protected KafkaTemporaryStorageMapperExt kafkaTemporaryStorageMapperExt;
27 @Autowired 26 @Autowired
28 protected RedisSlabMapperExt redisSlabMapperExt; 27 protected RedisSlabMapperExt redisSlabMapperExt;
......
...@@ -15,10 +15,8 @@ public interface AttachmentExtMapper { ...@@ -15,10 +15,8 @@ public interface AttachmentExtMapper {
15 "WHERE a.BIZ_ID = #{bizId}") 15 "WHERE a.BIZ_ID = #{bizId}")
16 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId); 16 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId);
17 17
18 - @Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = " + 18 + @Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = #{uploadRecordId} AND BIZ_ID = #{consignmentId} AND STATUS = 1")
19 - "(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE " + 19 + List<Attachment> queryAttachmentInfo(@Param("uploadRecordId") Long uploadRecordId,@Param("consignmentId") Long consignmentId);
20 - " CONSIGNMENT_ID = #{consignmentId}) AND STATUS = 1")
21 - List<Attachment> queryAttachmentInfo(@Param("consignmentId") Long consignmentId);
22 20
23 /** 21 /**
24 * 根据修改日期查询数据 22 * 根据修改日期查询数据
...@@ -26,6 +24,6 @@ public interface AttachmentExtMapper { ...@@ -26,6 +24,6 @@ public interface AttachmentExtMapper {
26 * @return 24 * @return
27 */ 25 */
28 @Select("SELECT * FROM T_BIZ_ATTACHMENT " + 26 @Select("SELECT * FROM T_BIZ_ATTACHMENT " +
29 - "WHERE MODIFY_TIME < TO_DATE(#{date}, 'YYYY-MM-DD') AND STATUS = 1") 27 + "WHERE MODIFY_TIME &lt; TO_DATE(#{date}, 'YYYY-MM-DD') AND STATUS = 1")
30 List<Attachment> findAttachmentsOlderThan(@Param("date") String date); 28 List<Attachment> findAttachmentsOlderThan(@Param("date") String date);
31 } 29 }
......
...@@ -10,7 +10,7 @@ public interface IAttachmentRepository { ...@@ -10,7 +10,7 @@ public interface IAttachmentRepository {
10 10
11 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId); 11 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId);
12 12
13 - List<Attachment> queryAttachmentInfo(Long consignmentId); 13 + List<Attachment> queryAttachmentInfo(Long uploadRecordId,Long consignmentId);
14 14
15 List<Attachment> findAttachmentsOlderThan(String date); 15 List<Attachment> findAttachmentsOlderThan(String date);
16 16
......
1 +package com.fedex.connect.task.repository.repo.biz;
2 +
3 +import com.fedex.connect.common.model.biz.PushObDetail;
4 +
5 +import java.util.List;
6 +
7 +public interface IPushObDetailRepository {
8 + /**
9 + * @Author mt
10 + * @Description 功能说明 批量插入
11 + * @Date 2024/5/30
12 + * @param record
13 + * @return void
14 + */
15 + void batchInsert(List<PushObDetail> record);
16 +}
...@@ -17,8 +17,8 @@ public class AttachmentRepositoryImpl extends AbstractDaoRepository implements I ...@@ -17,8 +17,8 @@ public class AttachmentRepositoryImpl extends AbstractDaoRepository implements I
17 } 17 }
18 18
19 @Override 19 @Override
20 - public List<Attachment> queryAttachmentInfo(Long consignmentId){ 20 + public List<Attachment> queryAttachmentInfo(Long uploadRecordId,Long consignmentId){
21 - return attachmentExtMapper.queryAttachmentInfo(consignmentId); 21 + return attachmentExtMapper.queryAttachmentInfo(uploadRecordId,consignmentId);
22 } 22 }
23 23
24 @Override 24 @Override
......
1 +package com.fedex.connect.task.repository.repo.biz.impl;
2 +
3 +import com.fedex.connect.common.dependencies.util.Utils;
4 +import com.fedex.connect.common.model.biz.PushObDetail;
5 +import com.fedex.connect.task.repository.base.AbstractDaoRepository;
6 +import com.fedex.connect.task.repository.repo.biz.IPushObDetailRepository;
7 +import org.springframework.stereotype.Repository;
8 +
9 +import java.util.List;
10 +import java.util.Objects;
11 +
12 +/**
13 + * @Author mt
14 + * @Description 推送明细日志repository
15 + * @Date 2024/5/30
16 + */
17 +@Repository
18 +public class PushObDetailRepository extends AbstractDaoRepository implements IPushObDetailRepository {
19 + /**
20 + * @Author mt
21 + * @Description 功能说明 批量插入
22 + * @Date 2024/5/30
23 + * @param record
24 + * @return void
25 + */
26 + public void batchInsert(List<PushObDetail> record){
27 + Utils.listOf(record).stream().filter(Objects::nonNull).forEach(r->{
28 + pushObDetailMapper.insert(r);
29 + });
30 + }
31 +}
...@@ -3,6 +3,7 @@ package com.fedex.connect.task.service.base; ...@@ -3,6 +3,7 @@ package com.fedex.connect.task.service.base;
3 import com.fedex.connect.common.dependencies.repository.repo.sys.IRedisSlabRepository; 3 import com.fedex.connect.common.dependencies.repository.repo.sys.IRedisSlabRepository;
4 import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository; 4 import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository;
5 import com.fedex.connect.task.repository.repo.biz.IEmailRepository; 5 import com.fedex.connect.task.repository.repo.biz.IEmailRepository;
6 +import com.fedex.connect.task.repository.repo.biz.IPushObDetailRepository;
6 import com.fedex.connect.task.repository.repo.biz.IPushObRepository; 7 import com.fedex.connect.task.repository.repo.biz.IPushObRepository;
7 import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository; 8 import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository;
8 import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository; 9 import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository;
...@@ -31,5 +32,7 @@ public class BaseService { ...@@ -31,5 +32,7 @@ public class BaseService {
31 @Autowired 32 @Autowired
32 protected IPushObRepository pushObRepository; 33 protected IPushObRepository pushObRepository;
33 @Autowired 34 @Autowired
35 + protected IPushObDetailRepository pushObDetailRepository;
36 + @Autowired
34 protected IParamConfigRepository paramConfigRepository; 37 protected IParamConfigRepository paramConfigRepository;
35 } 38 }
...\ No newline at end of file ...\ No newline at end of file
......
1 +package com.fedex.connect.task.service.biz;
2 +
3 +import com.fedex.connect.common.model.biz.PushObDetail;
4 +
5 +import java.util.List;
6 +
7 +public interface IPushObDetailService {
8 + /**
9 + * @Author mt
10 + * @Description 功能说明 批量插入
11 + * @Date 2024/5/30
12 + * @param record
13 + * @return void
14 + */
15 + void batchInsert(List<PushObDetail> record);
16 +}
1 package com.fedex.connect.task.service.biz; 1 package com.fedex.connect.task.service.biz;
2 2
3 public interface IPushObService { 3 public interface IPushObService {
4 - ///** 4 + /**
5 - // * @Author mt 5 + * @Author mt
6 - // * @Description 推送Imp001报文数据zip包文件 6 + * @Description 推送Imp001报文数据zip包文件
7 - // * @Date 2024/8/2 7 + * @Date 2024/8/2
8 - // * @param 8 + * @param
9 - // * @return void 9 + * @return void
10 - // */ 10 + */
11 - //void sendOb(); 11 + void sendOb();
12 - ///** 12 + /**
13 - // * @Author mt 13 + * @Author mt
14 - // * @Description 推送Imp001文件错误重试 14 + * @Description 推送Imp001文件错误重试
15 - // * @Date 2024/8/2 15 + * @Date 2024/8/2
16 - // * @param 16 + * @param
17 - // * @return void 17 + * @return void
18 - // */ 18 + */
19 - //void sendObRetry(); 19 + void sendObRetry();
20 } 20 }
...\ No newline at end of file ...\ No newline at end of file
......
1 +package com.fedex.connect.task.service.biz.impl;
2 +
3 +import com.fedex.connect.common.model.biz.PushObDetail;
4 +import com.fedex.connect.task.service.base.BaseService;
5 +import com.fedex.connect.task.service.biz.IPushObDetailService;
6 +import org.springframework.stereotype.Service;
7 +
8 +import java.util.List;
9 +
10 +/**
11 + * @Author mt
12 + * @Description 类说明 推送明细日志
13 + * @Date 2024/5/30
14 + */
15 +@Service
16 +public class PushObDetailServiceImpl extends BaseService implements IPushObDetailService {
17 + /**
18 + * @Author mt
19 + * @Description 功能说明 批量插入
20 + * @Date 2024/5/30
21 + * @param record
22 + * @return void
23 + */
24 + public void batchInsert(List<PushObDetail> record){
25 + pushObDetailRepository.batchInsert(record);
26 + }
27 +}
1 package com.fedex.connect.task.service.biz.impl; 1 package com.fedex.connect.task.service.biz.impl;
2 2
3 +import com.fedex.connect.common.dependencies.cache.CacheSystem;
3 import com.fedex.connect.common.dependencies.contants.ParamConfigConstants; 4 import com.fedex.connect.common.dependencies.contants.ParamConfigConstants;
4 import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum; 5 import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum;
5 import com.fedex.connect.common.dependencies.util.Utils; 6 import com.fedex.connect.common.dependencies.util.Utils;
7 +import com.fedex.connect.common.model.bi.DictionaryEntries;
6 import com.fedex.connect.common.model.biz.PushOb; 8 import com.fedex.connect.common.model.biz.PushOb;
7 import com.fedex.connect.common.model.sys.ParamConfig; 9 import com.fedex.connect.common.model.sys.ParamConfig;
8 import com.fedex.connect.task.data.bo.Imp001GenerateBo; 10 import com.fedex.connect.task.data.bo.Imp001GenerateBo;
9 import com.fedex.connect.task.service.base.BaseService; 11 import com.fedex.connect.task.service.base.BaseService;
10 import com.fedex.connect.task.service.biz.IPushObService; 12 import com.fedex.connect.task.service.biz.IPushObService;
11 13
14 +import com.fedex.connect.task.utils.biz.imp001.Imp001GenerateUtil;
15 +import com.fedex.connect.task.utils.biz.imp001.Imp001PushUtil;
16 +import com.fedex.connect.task.utils.biz.imp001.Imp001RecordLogUtil;
12 import lombok.extern.slf4j.Slf4j; 17 import lombok.extern.slf4j.Slf4j;
13 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
...@@ -20,92 +25,102 @@ import java.util.Objects; ...@@ -20,92 +25,102 @@ import java.util.Objects;
20 /** 25 /**
21 * @Author mt 26 * @Author mt
22 * @Description 发送Imp001到进口组 27 * @Description 发送Imp001到进口组
23 - * @Date 2024/5/24 28 + * @Date 2024年12月18日
24 */ 29 */
25 @Slf4j 30 @Slf4j
26 @Service 31 @Service
27 public class PushObServiceImpl extends BaseService implements IPushObService { 32 public class PushObServiceImpl extends BaseService implements IPushObService {
28 - //@Autowired 33 + @Autowired
29 - //Imp001GenerateUtil imp001GenerateUtil; 34 + Imp001GenerateUtil imp001GenerateUtil;
30 - //@Autowired 35 + @Autowired
31 - //Imp001PushUtil imp001PushUtil; 36 + Imp001PushUtil imp001PushUtil;
32 - //@Autowired 37 + @Autowired
33 - //Imp001RecordLogUtil imp001RecordLogUtil; 38 + Imp001RecordLogUtil imp001RecordLogUtil;
34 - // 39 + @Autowired
35 - ///** 40 + CacheSystem cacheSystem;
36 - // * 推送OB报文数据zip包文件 41 +
37 - // */ 42 + /**
38 - //@Override 43 + * 推送OB报文数据zip包文件
39 - //public void sendOb() { 44 + */
40 - // //获取每次处理数据量量参数 45 + @Override
41 - // ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER); 46 + public void sendOb() {
42 - // Long rownum = Long.parseLong(paramConfig.getValue()); 47 + //获取每次处理数据量量参数
43 - // //获取需要处理的记录 48 + ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
44 - // List<PushOb> pushObList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode(),rownum); 49 + Long rownum = Long.parseLong(paramConfig.getValue());
45 - // //推送imp001数据 50 + //获取需要处理的记录
46 - // this.pushOb(pushObList); 51 + List<PushOb> pushObList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode(),rownum);
47 - //} 52 + //推送imp001数据
48 - // 53 + this.pushOb(pushObList);
49 - ///** 54 + }
50 - // * 推送OB文件错误重试 55 +
51 - // */ 56 + /**
52 - //@Override 57 + * 推送OB文件错误重试
53 - //public void sendObRetry() { 58 + */
54 - // //获取每次处理数据量量参数 59 + @Override
55 - // Map<String,ParamConfig> paramConfig = paramConfigRepository.findValueByCodes(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER, 60 + public void sendObRetry() {
56 - // ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER); 61 + //获取每次处理数据量量参数
57 - // //推送IMP001重试处理数量 62 + Map<String,ParamConfig> paramConfig = paramConfigRepository.findValueByCodes(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER,
58 - // ParamConfig retryNumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER); 63 + ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
59 - // Long retryNum = Long.parseLong(retryNumConfig.getCode()); 64 + //推送IMP001重试处理数量
60 - // //推送IMP001定时任务处理数量 65 + ParamConfig retryNumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
61 - // ParamConfig rownumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER); 66 + Long retryNum = Long.parseLong(retryNumConfig.getCode());
62 - // Long rownum = Long.parseLong(rownumConfig.getCode()); 67 + //推送IMP001定时任务处理数量
63 - // //获取需要重新处理的记录:处理4次以下,并且推送失败的 68 + ParamConfig rownumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
64 - // List<PushOb> errPushObLog = pushObRepository.findErrPushOb(retryNum, PushObStatusEnum.PUSH_FAILED.getCode(),rownum); 69 + Long rownum = Long.parseLong(rownumConfig.getCode());
65 - // if (errPushObLog!=null && !errPushObLog.isEmpty()){ 70 + //获取需要重新处理的记录:处理4次以下,并且推送失败的
66 - // log.info("sendObRetryTask : sendObRetry size: "+errPushObLog.size()); 71 + List<PushOb> errPushObLog = pushObRepository.findErrPushOb(retryNum, PushObStatusEnum.PUSH_FAILED.getCode(),rownum);
67 - // //重新推送tw001数据 72 + if (errPushObLog!=null && !errPushObLog.isEmpty()){
68 - // this.pushOb(errPushObLog); 73 + log.info("sendObRetryTask : sendObRetry size: "+errPushObLog.size());
69 - // }else{ 74 + //重新推送tw001数据
70 - // log.info("sendObRetryTask : No data found for sendObRetry!"); 75 + this.pushOb(errPushObLog);
71 - // } 76 + }else{
72 - //} 77 + log.info("sendObRetryTask : No data found for sendObRetry!");
73 - // 78 + }
74 - ///** 79 + }
75 - // * @Author mt 80 +
76 - // * @Description 推送tw001数据 81 + /**
77 - // * @Date 2024/5/29 82 + * @Author mt
78 - // * @param pushObList 83 + * @Description 推送imp001数据
79 - // * @return void 84 + * @Date 2024/5/29
80 - // */ 85 + * @param pushObList
81 - //private void pushOb(List<PushOb> pushObList){ 86 + * @return void
82 - // Utils.listOf(pushObList).stream().filter(Objects::nonNull).forEach(ob ->{ 87 + */
83 - // boolean flag = false; 88 + private void pushOb(List<PushOb> pushObList){
84 - // String errorMsg = ""; 89 + /**
85 - // Imp001GenerateBo imp001GenerateBo = null; 90 + * 推送成功状态字典
86 - // try { 91 + */
87 - // //生成tw001 json对象dto 92 + DictionaryEntries pushSuccessEntries = cacheSystem.getDicPushObStatus(PushObStatusEnum.PUSH_SUCCESSFUL.getCode());
88 - // imp001GenerateBo = imp001GenerateUtil.generateImp001Json(ob); 93 + /**
89 - // //根据tw001 json对象生成并且推送zip包 94 + * 推送失败状态字典
90 - // imp001PushUtil.pushImp001(imp001GenerateBo); 95 + */
91 - // flag = true; 96 + DictionaryEntries pushFailedEntries = cacheSystem.getDicPushObStatus(PushObStatusEnum.PUSH_FAILED.getCode());
92 - // }catch(Exception ex){ 97 + Utils.listOf(pushObList).stream().filter(Objects::nonNull).forEach(ob ->{
93 - // log.error("pushOb error : ",ex); 98 + boolean flag = false;
94 - // errorMsg = ex.getMessage(); 99 + String errorMsg = "";
95 - // flag = false; 100 + Imp001GenerateBo imp001GenerateBo = null;
96 - // }finally{ 101 + try {
97 - // /** 102 + //生成imp001 json对象dto
98 - // * 如果生成失败,推送失败,则不会记录推送日志明细,更新推送日志表。 103 + imp001GenerateBo = imp001GenerateUtil.generateImp001Json(ob);
99 - // * 记录日志,并且备份 104 + //根据imp001 json对象生成并且推送zip包
100 - // */ 105 + imp001PushUtil.pushImp001(imp001GenerateBo);
101 - // if(flag){ 106 + flag = true;
102 - // //推送成功 107 + }catch(Exception ex){
103 - // imp001RecordLogUtil.pushSuccessRecordLog(imp001GenerateBo, ob); 108 + log.error("pushOb error : ",ex);
104 - // }else{ 109 + errorMsg = ex.getMessage();
105 - // //推送失败 110 + flag = false;
106 - // imp001RecordLogUtil.pushFailRecordLog(imp001GenerateBo, ob, errorMsg); 111 + }finally{
107 - // } 112 + /**
108 - // } 113 + * 如果生成失败,推送失败,则不会记录推送日志明细,更新推送日志表。
109 - // }); 114 + * 记录日志,并且备份
110 - //} 115 + */
116 + if(flag){
117 + //推送成功
118 + imp001RecordLogUtil.pushSuccessRecordLog(imp001GenerateBo, ob, pushSuccessEntries);
119 + }else{
120 + //推送失败
121 + imp001RecordLogUtil.pushFailRecordLog(imp001GenerateBo, ob, pushFailedEntries, errorMsg);
122 + }
123 + }
124 + });
125 + }
111 } 126 }
...\ No newline at end of file ...\ No newline at end of file
......
1 -//package com.fedex.connect.task.utils.biz.imp001;
2 -//
3 -//import com.fedex.connect.common.dependencies.cache.CacheSystem;
4 -//import com.fedex.connect.common.dependencies.util.NIOFileUtils;
5 -//import com.fedex.connect.common.model.bi.DictionaryEntries;
6 -//import com.fedex.connect.common.model.biz.Attachment;
7 -//import com.fedex.connect.common.model.biz.Consignment;
8 -//import com.fedex.connect.common.model.biz.PushOb;
9 -//import com.fedex.connect.task.config.PropertiesConfig;
10 -//import com.fedex.connect.task.data.bo.Imp001FileInfoBo;
11 -//import com.fedex.connect.task.data.bo.Imp001GenerateBo;
12 -//import com.fedex.connect.task.data.dto.imp001.*;
13 -//import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository;
14 -//import com.fedex.connect.task.repository.repo.biz.IConsignmentRepository;
15 -//import com.fedex.export.common.util.DateUtil;
16 -//import com.fedex.export.common.util.NioFileUtils;
17 -//import com.fedex.export.common.util.StringExtUtil;
18 -//import com.fedex.export.common.util.Utils;
19 -//import com.fedex.export.config.PropertiesConfig;
20 -//import com.fedex.export.constants.Constant;
21 -//import com.fedex.export.data.bo.Imp001FileInfoBo;
22 -//import com.fedex.export.data.bo.Imp001GenerateBo;
23 -//import com.fedex.export.data.dto.tw001.*;
24 -//import com.fedex.export.repository.entity.*;
25 -//import com.fedex.export.repository.entity.log.PushObLog;
26 -//import com.fedex.export.service.business.IDeclareCheckInfoService;
27 -//import com.fedex.export.service.business.IDeclareCustomsFileService;
28 -//import com.fedex.export.service.business.IDeclareInfoService;
29 -//import com.fedex.export.service.business.IUploadFileService;
30 -//import com.fedex.export.service.system.ISysDictionaryService;
31 -//import lombok.extern.slf4j.Slf4j;
32 -//import org.apache.commons.lang3.StringUtils;
33 -//import org.springframework.beans.factory.annotation.Autowired;
34 -//import org.springframework.stereotype.Component;
35 -//
36 -//import java.io.IOException;
37 -//import java.util.*;
38 -//
39 -///**
40 -// * @Author mt
41 -// * @Description imp001报文生成json,util
42 -// * @Date 2024/5/24
43 -// */
44 -//@Slf4j
45 -//@Component
46 -//public class Imp001GenerateUtil {
47 -// @Autowired
48 -// CacheSystem cacheSystem;
49 -// @Autowired
50 -// private IAttachmentRepository attachmentRepository;
51 -// @Autowired
52 -// private NIOFileUtils nioFileUtils;
53 -// @Autowired
54 -// private PropertiesConfig propertiesConfig;
55 -//
56 -// /**
57 -// * @Author mt
58 -// * @Description 生成imp001报文json对象
59 -// * @Date 2024/11/21
60 -// * @param pushOb
61 -// * @return Imp001GenerateBo
62 -// */
63 -// public Imp001GenerateBo generateImp001Json(PushOb pushOb) throws IOException{
64 -// Imp001RootJsonDto tw001RootJsonDto = new Imp001RootJsonDto();
65 -// List<Attachment> attachmentList = attachmentRepository.queryAttachmentInfo(pushOb.getConsignmentId());
66 -// //生成IMP001报文数据
67 -// Imp001Data imp001Data = new Imp001Data();
68 -// Imp001Consignments[] consignments = new Imp001Consignments[1];
69 -// Imp001Consignments imp001Consignments = new Imp001Consignments();
70 -// //生成运单数据
71 -// Imp001Consignment imp001Consignment = new Imp001Consignment();
72 -// //运单号
73 -// imp001Consignment.setDeliveryNo(pushOb.getConsignmentCode());
74 -// //附件个数
75 -// imp001Consignment.setAttachedFilesCount(attachmentList.size());
76 -// //生成文件列表数据
77 -// Imp001Files[] files = this.generateFiles(attachmentList);
78 -// /***************设置对象赋值***************/
79 -// imp001Consignments.setConsignment(imp001Consignment);
80 -// imp001Consignments.setFiles(files);
81 -// consignments[0] = imp001Consignments;
82 -// imp001Data.setConsignments(consignments);
83 -// //初始化TW001表头信息
84 -// this.initImp001Head(tw001RootJsonDto);
85 -// tw001RootJsonDto.setData(imp001Data);
86 -// //返回对象
87 -// Imp001GenerateBo tw001GenerateBo = new Imp001GenerateBo();
88 -// tw001GenerateBo.setDeclareInfo(declareInfo);
89 -// tw001GenerateBo.setImp001RootJsonDto(tw001RootJsonDto);
90 -// //获取生成tw001临时文件夹目录
91 -// String workFilePath = this.generateWorkPath(declareInfo.getDeliveryNo(),declareInfo.getDeclareId());
92 -// tw001GenerateBo.setWorkFilePath(workFilePath);
93 -// List<Imp001FileInfoBo> fileInfoLists = new ArrayList<Imp001FileInfoBo>();
94 -// //存在图案商标则添加
95 -// if(checkInfo != null && checkInfo.getBrandImage() != null){
96 -// //初始化图案商标文件对象
97 -// Imp001FileInfoBo fileInfoBo = this.initFileInfo(pushFileTypeMap,Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_5,checkInfo.getBrandImage());
98 -// fileInfoLists.add(fileInfoBo);
99 -// }
100 -// if(files != null){
101 -// for (Imp001Files file : files) {
102 -// //获取文件类型 1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件
103 -// String fileTypeCode = this.getfileType(file.getSource());
104 -// //初始化文件对象:1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件
105 -// Imp001FileInfoBo fileInfoBo = this.initFileInfo(pushFileTypeMap,fileTypeCode,file.getName());
106 -// fileInfoLists.add(fileInfoBo);
107 -// }
108 -// }
109 -// //设置文件信息
110 -// tw001GenerateBo.setFileInfoList(fileInfoLists);
111 -// //设置jsonDic
112 -// tw001GenerateBo.setJsonDictionary(pushFileTypeMap.get(Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_4));
113 -// return tw001GenerateBo;
114 -// }
115 -//
116 -// /**
117 -// * @Author mt
118 -// * @Description 初始化TW001表头信息
119 -// * @Date 2024/11/21
120 -// * @param imp001RootJsonDto
121 -// * @return void
122 -// */
123 -// private void initImp001Head(Imp001RootJsonDto imp001RootJsonDto){
124 -// String UUIDStr=String.valueOf(UUID.randomUUID());
125 -// //消息代码/类型
126 -// imp001RootJsonDto.setMessageId(UUIDStr);
127 -// //消息代码/类型
128 -// imp001RootJsonDto.setMessageCode(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.MESSAGE_CODE);
129 -// //发送程序ID
130 -// imp001RootJsonDto.setSenderId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.SENDER_ID);
131 -// //接受程序ID
132 -// imp001RootJsonDto.setReceiverId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.RECEIVER_ID);
133 -// String sendTime = String.valueOf(System.currentTimeMillis());
134 -// //发送时间,时间戳
135 -// imp001RootJsonDto.setSendTime(sendTime);
136 -// }
137 -//
138 -// /**
139 -// * @Author mt
140 -// * @Description 功能说明
141 -// * @Date 2024/5/30
142 -// * @param source 1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件
143 -// * @return java.lang.String
144 -// */
145 -// private String getfileType(Integer source){
146 -// if(source.equals(Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_1)){
147 -// return Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_1;
148 -// }else if(source.equals(Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_2)){
149 -// return Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_2;
150 -// }else if(source.equals(Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_3)){
151 -// return Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_3;
152 -// }
153 -// return null;
154 -// }
155 -//
156 -// /**
157 -// * @Author mt
158 -// * @Description 功能说明 初始化fileInfo
159 -// * @Date 2024/5/30
160 -// * @param pushFileTypeMap
161 -// * @param fileTypeCode
162 -// * @param fileName
163 -// * @return com.fedex.export.data.bo.Imp001FileInfoBo
164 -// */
165 -// private Imp001FileInfoBo initFileInfo(Map<String,SysDictionary> pushFileTypeMap, String fileTypeCode, String fileName){
166 -// Imp001FileInfoBo fileInfoBo = new Imp001FileInfoBo();
167 -// //类型编码不为空则初始化文件id,文件类型
168 -// if(StringUtils.isNotEmpty(fileTypeCode)) {
169 -// SysDictionary fileTypeDic = pushFileTypeMap.get(fileTypeCode);
170 -// if (fileTypeDic != null) {
171 -// fileInfoBo.setFileTypeId(fileTypeDic.getId());
172 -// fileInfoBo.setFileTypeName(fileTypeDic.getChineseName());
173 -// }
174 -// }
175 -// fileInfoBo.setPushTime(new Date());
176 -// fileInfoBo.setFileName(fileName);
177 -// return fileInfoBo;
178 -// }
179 -//
180 -// /**
181 -// * @Author mt
182 -// * @Description 生成文件对象集合vo,并且将文件复制到指定目录
183 -// * @Date 2024/11/21
184 -// * @param attachmentList
185 -// * @return com.fedex.connect.task.data.dto.imp001.Imp001Files[]
186 -// */
187 -// private Imp001Files[] generateFiles(List<Attachment> attachmentList) throws IOException{
188 -// if(attachmentList == null || attachmentList.size() == 0){
189 -// return null;
190 -// }
191 -// Imp001Files[] tw001Files = new Imp001Files[attachmentList.size()];
192 -// for(int i = 0 ; i < attachmentList.size() ; i ++){
193 -// Attachment attachment = attachmentList.get(i);
194 -// Imp001Files file = new Imp001Files();
195 -// //获取附件业务类型
196 -// DictionaryEntries attBizType = cacheSystem.getDicAttachmentBizType(attachment.getBizTypeCode());
197 -// //运单、发票、箱单、其他
198 -// String bizTypeCode = attBizType.getExt1();
199 -// if(StringUtils.isEmpty(bizTypeCode)){
200 -// continue;
201 -// }
202 -// //重置文件名称,并且复制源文件到指定目录
203 -// String fileName = this.generateFileName(uploadFile, deliveryNo, declareId);
204 -// if(fileName == null){
205 -// continue;
206 -// }
207 -// //文件名称
208 -// file.setName(fileName);
209 -// //文件来源
210 -// file.setSource(source);
211 -// //文件后缀转换为小写
212 -// String suffix = uploadFile.getType();
213 -// if(suffix != null){
214 -// suffix = suffix.toLowerCase();
215 -// }
216 -// //文件名后缀
217 -// file.setSuffix(suffix);
218 -// //文件大小
219 -// file.setFileSizeByte(uploadFile.getFileSizeByte() == null ? null : uploadFile.getFileSizeByte().intValue());
220 -// tw001Files[i] = file;
221 -// }
222 -// return tw001Files;
223 -// }
224 -//
225 -// /**
226 -// * @Author mt
227 -// * @Description 重置文件名称,并且复制源文件到指定目录
228 -// * @Date 2024/5/29
229 -// * @param uploadFile
230 -// * @param deliveryNo
231 -// * @param declareId
232 -// * @return java.lang.String
233 -// */
234 -// private String generateFileName(UploadFile uploadFile,String deliveryNo,Long declareId) throws IOException{
235 -// String generateFileName = null;
236 -// if(!Utils.isEmpty(uploadFile.getName())){
237 -// generateFileName = deliveryNo
238 -// + Constant.COMMON_KEYS.UNDER_LINE + StringExtUtil.idLeftPadStr(uploadFile.getId())
239 -// + Constant.COMMON_KEYS.UNDER_LINE + uploadFile.getName()
240 -// + Constant.COMMON_KEYS.UNDER_LINE + DateUtil.yyyyMMddHH24mmssSSS(new Date()) + uploadFile.getType();
241 -// }
242 -// //获取源文件目录 实际文件路径:/var/share/icleartw/upload/declareFile/202401/476/出口報關申請表_20240116_132402_827.pdf
243 -// String sourceFilePath = uploadFile.getServerPath() + Constant.COMMON_KEYS.BACK_SLASH + uploadFile.getServerName();
244 -// //获取复制目标目录
245 -// String targetFilePath = this.generateWorkPath(deliveryNo,declareId) + generateFileName;
246 -// //原始文件存在则复制文件
247 -// if(nioFileUtils.fileExists(sourceFilePath)){
248 -// //复制文件到指定目录
249 -// nioFileUtils.copyFile(sourceFilePath,targetFilePath);
250 -// return generateFileName;
251 -// }else{
252 -// return null;
253 -// }
254 -// }
255 -//
256 -// /**
257 -// * @Author mt
258 -// * @Description 生成文件夹目录 /var/share/icleartw/TWIMPORT/work/yyyy-MM-dd/运单号_运单ID/
259 -// * @Date 2024/5/29
260 -// * @param deliveryNo
261 -// * @param declareId
262 -// * @return java.lang.String
263 -// */
264 -// private String generateWorkPath(String deliveryNo,Long declareId){
265 -// String yyyyMMdd = DateUtil.format(new Date());
266 -// String fileDir = propertiesConfig.getTw001PathWork() + Constant.COMMON_KEYS.BACK_SLASH +
267 -// yyyyMMdd + Constant.COMMON_KEYS.BACK_SLASH +
268 -// deliveryNo + Constant.COMMON_KEYS.UNDER_LINE + declareId + Constant.COMMON_KEYS.BACK_SLASH;
269 -// //如果目录不存在则创建完整目录
270 -// nioFileUtils.mkdirs(fileDir);
271 -// return fileDir;
272 -// }
273 -//}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.fedex.connect.task.utils.biz.imp001;
2 +
3 +import com.fedex.connect.common.dependencies.cache.CacheSystem;
4 +import com.fedex.connect.common.dependencies.contants.BaseSeparatorConstants;
5 +import com.fedex.connect.common.dependencies.contants.DigitConstants;
6 +import com.fedex.connect.common.dependencies.util.DateUtil;
7 +import com.fedex.connect.common.dependencies.util.NIOFileUtils;
8 +import com.fedex.connect.common.dependencies.util.StringExtUtil;
9 +import com.fedex.connect.common.dependencies.util.Utils;
10 +import com.fedex.connect.common.model.bi.DictionaryEntries;
11 +import com.fedex.connect.common.model.biz.Attachment;
12 +import com.fedex.connect.common.model.biz.PushOb;
13 +import com.fedex.connect.task.config.PropertiesConfig;
14 +import com.fedex.connect.task.constants.Constant;
15 +import com.fedex.connect.task.data.bo.Imp001GenerateBo;
16 +import com.fedex.connect.task.data.dto.imp001.*;
17 +import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository;
18 +import lombok.extern.slf4j.Slf4j;
19 +import org.apache.commons.lang3.StringUtils;
20 +import org.springframework.beans.factory.annotation.Autowired;
21 +import org.springframework.stereotype.Component;
22 +
23 +import java.io.IOException;
24 +import java.util.Date;
25 +import java.util.List;
26 +import java.util.UUID;
27 +
28 +/**
29 + * @Author mt
30 + * @Description imp001报文生成json,util
31 + * @Date 2024/5/24
32 + */
33 +@Slf4j
34 +@Component
35 +public class Imp001GenerateUtil {
36 + @Autowired
37 + CacheSystem cacheSystem;
38 + @Autowired
39 + private IAttachmentRepository attachmentRepository;
40 + @Autowired
41 + private NIOFileUtils nioFileUtils;
42 + @Autowired
43 + private PropertiesConfig propertiesConfig;
44 +
45 + /**
46 + * @Author mt
47 + * @Description 生成imp001报文json对象
48 + * @Date 2024/11/21
49 + * @param pushOb
50 + * @return Imp001GenerateBo
51 + */
52 + public Imp001GenerateBo generateImp001Json(PushOb pushOb) throws IOException{
53 + Imp001RootJsonDto imp001RootJsonDto = new Imp001RootJsonDto();
54 + List<Attachment> attachmentList = attachmentRepository.queryAttachmentInfo(pushOb.getUploadRecordId(),pushOb.getConsignmentId());
55 + //生成IMP001报文数据
56 + Imp001Data imp001Data = new Imp001Data();
57 + Imp001Consignments[] consignments = new Imp001Consignments[1];
58 + Imp001Consignments imp001Consignments = new Imp001Consignments();
59 + //生成运单数据
60 + Imp001Consignment imp001Consignment = new Imp001Consignment();
61 + //运单号
62 + imp001Consignment.setDeliveryNo(pushOb.getConsignmentCode());
63 + //附件个数
64 + imp001Consignment.setAttachedFilesCount(attachmentList.size());
65 + //生成文件列表数据
66 + Imp001Files[] files = this.generateFiles(attachmentList,pushOb.getConsignmentCode(),pushOb.getConsignmentId());
67 + /***************设置对象赋值***************/
68 + imp001Consignments.setConsignment(imp001Consignment);
69 + imp001Consignments.setFiles(files);
70 + consignments[0] = imp001Consignments;
71 + imp001Data.setConsignments(consignments);
72 + //初始化IMP001表头信息
73 + this.initImp001Head(imp001RootJsonDto);
74 + imp001RootJsonDto.setData(imp001Data);
75 + //返回对象
76 + Imp001GenerateBo imp001GenerateBo = new Imp001GenerateBo();
77 + imp001GenerateBo.setImp001RootJsonDto(imp001RootJsonDto);
78 + //获取生成imp001临时文件夹目录
79 + String workFilePath = this.generateWorkPath(pushOb.getConsignmentCode(),pushOb.getConsignmentId());
80 + imp001GenerateBo.setWorkFilePath(workFilePath);
81 + //设置文件信息
82 + imp001GenerateBo.setFileInfos(files);
83 + //设置运单号
84 + imp001GenerateBo.setConsignmentCode(pushOb.getConsignmentCode());
85 + //设置运单ID
86 + imp001GenerateBo.setConsignmentId(pushOb.getConsignmentId());
87 + return imp001GenerateBo;
88 + }
89 +
90 + /**
91 + * @Author mt
92 + * @Description 初始化imp001表头信息
93 + * @Date 2024/11/21
94 + * @param imp001RootJsonDto
95 + * @return void
96 + */
97 + private void initImp001Head(Imp001RootJsonDto imp001RootJsonDto){
98 + String UUIDStr=String.valueOf(UUID.randomUUID());
99 + //消息代码/类型
100 + imp001RootJsonDto.setMessageId(UUIDStr);
101 + //消息代码/类型
102 + imp001RootJsonDto.setMessageCode(Constant.IMP001_HEAD_KEYS.MESSAGE_CODE);
103 + //发送程序ID
104 + imp001RootJsonDto.setSenderId(Constant.IMP001_HEAD_KEYS.SENDER_ID);
105 + //接受程序ID
106 + imp001RootJsonDto.setReceiverId(Constant.IMP001_HEAD_KEYS.RECEIVER_ID);
107 + String sendTime = String.valueOf(System.currentTimeMillis());
108 + //发送时间,时间戳
109 + imp001RootJsonDto.setSendTime(sendTime);
110 + }
111 +
112 + /**
113 + * @Author mt
114 + * @Description 生成文件对象集合vo,并且将文件复制到指定目录
115 + * @Date 2024/11/21
116 + * @param attachmentList
117 + * @return com.fedex.connect.task.data.dto.imp001.Imp001Files[]
118 + */
119 + private Imp001Files[] generateFiles(List<Attachment> attachmentList,String consignmentCode,Long consignmentId) throws IOException{
120 + if(attachmentList == null || attachmentList.size() == 0){
121 + return null;
122 + }
123 + Imp001Files[] imp001Files = new Imp001Files[attachmentList.size()];
124 + for(int i = 0 ; i < attachmentList.size() ; i ++){
125 + Attachment attachment = attachmentList.get(i);
126 + Imp001Files file = new Imp001Files();
127 + //获取附件业务类型
128 + DictionaryEntries attBizType = cacheSystem.getDicAttachmentBizType(attachment.getBizTypeCode());
129 + //运单、发票、箱单、其他
130 + String bizTypeCode = attBizType.getExt1();
131 + if(StringUtils.isEmpty(bizTypeCode)){
132 + continue;
133 + }
134 + //重置文件名称,并且复制源文件到指定目录
135 + String fileName = this.generateFileName(attachment, (i+1),bizTypeCode, consignmentCode, consignmentId);
136 + if(fileName == null){
137 + continue;
138 + }
139 + //文件名称
140 + file.setName(fileName);
141 + //文件来源
142 + file.setContentType(bizTypeCode);
143 + //获取文件后缀,文件后缀转换为小写
144 + String suffix = fileName.substring(fileName.lastIndexOf(BaseSeparatorConstants.SEPARATOR_POINT));
145 + if(suffix != null){
146 + suffix = suffix.toLowerCase();
147 + }
148 + //文件名后缀
149 + file.setSuffix(suffix);
150 + //文件大小
151 + file.setFileSizeByte(attachment.getFileSize() == null ? null : attachment.getFileSize().intValue());
152 + imp001Files[i] = file;
153 + }
154 + return imp001Files;
155 + }
156 +
157 + /**
158 + * @Author mt
159 + * @Description 重置文件名称,并且复制源文件到指定目录
160 + * @Date 2024/12/18
161 + * @param attachment
162 + * @param consignmentCode
163 + * @param consignmentId
164 + * @return java.lang.String
165 + */
166 + private String generateFileName(Attachment attachment,
167 + Integer index,
168 + String bizTypeCode,
169 + String consignmentCode,
170 + Long consignmentId) throws IOException{
171 + String generateFileName = null;
172 + String fileName = attachment.getFileName();
173 + if(!Utils.isEmpty(fileName)){
174 + //获取文件后缀
175 + String fileSuffix = fileName.substring(fileName.lastIndexOf(BaseSeparatorConstants.SEPARATOR_POINT));
176 + /**
177 + * AWB_12位运单号_10位运单ID_三位文件顺序号_yyyyMMddHHmmssSSS
178 + */
179 + generateFileName = bizTypeCode + BaseSeparatorConstants.SEPARATOR_UNDERLINE + consignmentCode
180 + + BaseSeparatorConstants.SEPARATOR_UNDERLINE + StringExtUtil.idLeftPadStr(attachment.getId(), DigitConstants.DIGIT_TEN)
181 + + BaseSeparatorConstants.SEPARATOR_UNDERLINE + StringExtUtil.idLeftPadStr(index.longValue(), DigitConstants.DIGIT_THREE)
182 + + BaseSeparatorConstants.SEPARATOR_UNDERLINE + DateUtil.yyyyMMddHH24mmssSSS(new Date()) + fileSuffix;
183 + }
184 + //获取源文件目录 实际文件路径:/var/share/iclearConnect/upload/attachment/2024-12-18/313913426666/AWB_202412161_20241218131852_001.pdf
185 + String sourceFilePath = attachment.getFilePath() + BaseSeparatorConstants.SEPARATOR_SLASH + attachment.getFileName();
186 + //获取复制目标目录
187 + String targetFilePath = this.generateWorkPath(consignmentCode,consignmentId) + generateFileName;
188 + //原始文件存在则复制文件
189 + if(nioFileUtils.fileExists(sourceFilePath)){
190 + //复制文件到指定目录
191 + nioFileUtils.copyFile(sourceFilePath,targetFilePath);
192 + return generateFileName;
193 + }else{
194 + return null;
195 + }
196 + }
197 +
198 + /**
199 + * @Author mt
200 + * @Description 生成文件夹目录 /var/share/iClearPreCLR/ToIMPORT/work/yyyy-MM-dd/运单号_运单ID/
201 + * @Date 2024/12/18
202 + * @param consignmentCode
203 + * @param consignmentId
204 + * @return java.lang.String
205 + */
206 + private String generateWorkPath(String consignmentCode,Long consignmentId){
207 + String yyyyMMdd = DateUtil.format(new Date());
208 + String fileDir = propertiesConfig.getImp001PathWork() + BaseSeparatorConstants.SEPARATOR_SLASH +
209 + yyyyMMdd + BaseSeparatorConstants.SEPARATOR_SLASH +
210 + consignmentCode + BaseSeparatorConstants.SEPARATOR_UNDERLINE + consignmentId + BaseSeparatorConstants.SEPARATOR_SLASH;
211 + //如果目录不存在则创建完整目录
212 + nioFileUtils.mkdirs(fileDir);
213 + return fileDir;
214 + }
215 +}
...\ No newline at end of file ...\ No newline at end of file
......
1 -//package com.fedex.connect.task.utils.biz.imp001;
2 -//
3 -//import com.fedex.connect.task.config.PropertiesConfig;
4 -//import com.fedex.connect.task.data.bo.Imp001GenerateBo;
5 -//import com.fedex.export.common.util.*;
6 -//import com.fedex.export.config.PropertiesConfig;
7 -//import com.fedex.export.constants.Constant;
8 -//import com.fedex.export.data.bo.Imp001FileInfoBo;
9 -//import com.fedex.export.data.bo.Imp001GenerateBo;
10 -//import com.fedex.export.repository.entity.DeclareInfo;
11 -//import com.fedex.export.repository.entity.SysDictionary;
12 -//import lombok.extern.slf4j.Slf4j;
13 -//import org.slf4j.Logger;
14 -//import org.slf4j.LoggerFactory;
15 -//import org.springframework.beans.factory.annotation.Autowired;
16 -//import org.springframework.stereotype.Component;
17 -//
18 -//import java.io.File;
19 -//import java.io.FileOutputStream;
20 -//import java.util.ArrayList;
21 -//import java.util.Date;
22 -//import java.util.List;
23 -//import java.util.Objects;
24 -//
25 -///**
26 -// * @Author mt
27 -// * @Description tw001报文推送,util
28 -// * @Date 2024/5/29
29 -// */
30 -//@Slf4j
31 -//@Component
32 -//public class Imp001PushUtil {
33 -// @Autowired
34 -// PropertiesConfig propertiesConfig;
35 -// @Autowired
36 -// ZipUtils zipUtils;
37 -// @Autowired
38 -// NioFileUtils nioFileUtils;
39 -//
40 -// /**
41 -// * @Author mt
42 -// * @Description 推送imp001
43 -// * @Date 2024/11/21
44 -// * @param imp001GenerateBo
45 -// * @return void
46 -// */
47 -// public void pushImp001(Imp001GenerateBo imp001GenerateBo) throws Exception{
48 -// long start = System.currentTimeMillis();
49 -// //生成zip临时文件到指定临时目录
50 -// String zipFileName = this.toZips(imp001GenerateBo);
51 -// //zip原始临时目录,zip为临时文件
52 -// String zipSourceTempFilePath = imp001GenerateBo.getWorkFilePath() + zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP;
53 -// //推送zip文件最终目录
54 -// String zipTargetFilePath = propertiesConfig.getTw001PathFinal() + zipFileName;
55 -// //记录zip文件名称
56 -// tw001GenerateBo.setZipFileName(zipFileName);
57 -// //记录zip文件目标路径
58 -// tw001GenerateBo.setZipFileTargetPath(zipTargetFilePath);
59 -// //如果目录不存在则创建完整目录
60 -// nioFileUtils.mkdirs(propertiesConfig.getTw001PathFinal());
61 -// //推送zip临时文件到指定目标目录,复制文件到指定目录,采用
62 -// String zipTargetTempFilePath = zipTargetFilePath + Constant.FILE_SUFFIX_KEYS.TEMP;
63 -// //复制文件至目标目录,为临时文件
64 -// nioFileUtils.copyFile(zipSourceTempFilePath,zipTargetTempFilePath);
65 -// log.info("复制到目标目录完成 sourceTempFilePath : {} , targetTempFilePath : {} ",zipSourceTempFilePath,zipTargetTempFilePath);
66 -// //重命名为正式文件
67 -// nioFileUtils.moveFile(zipTargetTempFilePath,zipTargetFilePath);
68 -// log.info("重命名为正式文件成功 zipTargetTempFilePath : {} , zipTargetFilePath : {} ",zipTargetTempFilePath,zipTargetFilePath);
69 -// long end = System.currentTimeMillis();
70 -// log.info("运单号TW001:{} 推送完成,总计耗时:{} ms",tw001GenerateBo.getDeclareInfo().getDeliveryNo() ,(end - start));
71 -// }
72 -//
73 -// /**
74 -// * @Author mt
75 -// * @Description 功能说明 生成zip临时文件到指定临时目录
76 -// * @Date 2024/5/30
77 -// * @param tw001GenerateBo
78 -// * @return java.lang.String
79 -// */
80 -// private String toZips(Imp001GenerateBo tw001GenerateBo) throws Exception{
81 -// /******************初始化需要压缩文件列表****************/
82 -// List<File> filesList = new ArrayList<File>();
83 -// //生成json文件名称
84 -// String jsonFileName = this.generateJsonFileName(tw001GenerateBo,"", Constant.FILE_SUFFIX_KEYS.JSON);
85 -// //生成json文件
86 -// JsonToJava.createJsonFile(JsonToJava.toJson(tw001GenerateBo.getTw001RootJsonDto()),
87 -// tw001GenerateBo.getWorkFilePath(), jsonFileName);
88 -// //获取json完整路径
89 -// String jsonFilePath = tw001GenerateBo.getWorkFilePath() + jsonFileName;
90 -// filesList.add(new File(jsonFilePath));
91 -// //文件名称
92 -// Utils.listOf(tw001GenerateBo.getFileInfoList()).stream().filter(Objects::nonNull).forEach(fileInfo ->{
93 -// //文件如果存在则添加到文件集合中
94 -// File file = new File(tw001GenerateBo.getWorkFilePath() + fileInfo.getFileName());
95 -// if(file.exists()){
96 -// filesList.add(file);
97 -// }
98 -// });
99 -// //初始化json文件对象,并添加到文件集合中
100 -// this.initJsonFileInfo(tw001GenerateBo,jsonFileName);
101 -// //生成zip文件名称 .zip
102 -// String zipFileName = this.generateJsonFileName(tw001GenerateBo, Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.MESSAGE_CODE, Constant.FILE_SUFFIX_KEYS.ZIP);
103 -// //生成zip临时文件名称 .temp
104 -// String zipTempFileName = zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP;
105 -// FileOutputStream fos = null;
106 -// try{
107 -// //完整zip临时文件名称
108 -// File zipTemp = new File(tw001GenerateBo.getWorkFilePath() + zipTempFileName);
109 -// fos = new FileOutputStream(zipTemp);
110 -// zipUtils.toZip(filesList, fos);
111 -// }catch(Exception ex){
112 -// log.error("生成压缩包错误:{}",ex.getMessage(),ex);
113 -// throw ex;
114 -// }finally{
115 -// try {
116 -// if (fos != null) {
117 -// fos.close();
118 -// fos = null;
119 -// }
120 -// } catch (Exception e) {
121 -// log.error(e.getMessage(),e);
122 -// throw e;
123 -// }
124 -// }
125 -// return zipFileName;
126 -// }
127 -//
128 -// /**
129 -// * @Author mt
130 -// * @Description 功能说明 初始化json文件对象
131 -// * @Date 2024/5/30
132 -// * @param tw001GenerateBo
133 -// * @param jsonFileName
134 -// * @return void
135 -// */
136 -// private void initJsonFileInfo(Imp001GenerateBo tw001GenerateBo,String jsonFileName){
137 -// SysDictionary jsonDic = tw001GenerateBo.getJsonDictionary();
138 -// Imp001FileInfoBo fileInfoBo = new Imp001FileInfoBo();
139 -// fileInfoBo.setFileName(jsonFileName);
140 -// fileInfoBo.setFileTypeId(jsonDic.getId());
141 -// fileInfoBo.setFileTypeName(jsonDic.getChineseName());
142 -// fileInfoBo.setPushTime(new Date());
143 -// tw001GenerateBo.getFileInfoList().add(fileInfoBo);
144 -// }
145 -//
146 -// /**
147 -// * @Author mt
148 -// * @Description 功能说明 生成文件名称
149 -// * @Date 2024/5/30
150 -// * @param tw001GenerateBo
151 -// * @param prefix 前缀
152 -// * @param suffix 后缀
153 -// * @return java.lang.String
154 -// */
155 -// private String generateJsonFileName(Imp001GenerateBo tw001GenerateBo,String prefix,String suffix){
156 -// DeclareInfo declareInfo = tw001GenerateBo.getDeclareInfo();
157 -// String fileName = prefix + declareInfo.getDeliveryNo() + Constant.COMMON_KEYS.UNDER_LINE
158 -// + StringExtUtil.idLeftPadStr(declareInfo.getDeclareId()) + Constant.COMMON_KEYS.UNDER_LINE +
159 -// DateUtil.yyyyMMddHH24mmssSSS(new Date()) + suffix;
160 -// return fileName;
161 -// }
162 -//}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.fedex.connect.task.utils.biz.imp001;
2 +
3 +import com.fedex.connect.common.dependencies.contants.BaseSeparatorConstants;
4 +import com.fedex.connect.common.dependencies.contants.DigitConstants;
5 +import com.fedex.connect.common.dependencies.util.*;
6 +import com.fedex.connect.task.config.PropertiesConfig;
7 +import com.fedex.connect.task.constants.Constant;
8 +import com.fedex.connect.task.data.bo.Imp001GenerateBo;
9 +import com.fedex.connect.task.data.dto.imp001.Imp001Files;
10 +import lombok.extern.slf4j.Slf4j;
11 +import org.springframework.beans.factory.annotation.Autowired;
12 +import org.springframework.stereotype.Component;
13 +
14 +import java.io.File;
15 +import java.io.FileOutputStream;
16 +import java.util.ArrayList;
17 +import java.util.Date;
18 +import java.util.List;
19 +
20 +/**
21 + * @Author mt
22 + * @Description imp001报文推送,util
23 + * @Date 2024/5/29
24 + */
25 +@Slf4j
26 +@Component
27 +public class Imp001PushUtil {
28 + @Autowired
29 + PropertiesConfig propertiesConfig;
30 + @Autowired
31 + ZipUtils zipUtils;
32 + @Autowired
33 + NIOFileUtils nioFileUtils;
34 +
35 + /**
36 + * @Author mt
37 + * @Description 推送imp001
38 + * @Date 2024/11/21
39 + * @param imp001GenerateBo
40 + * @return void
41 + */
42 + public void pushImp001(Imp001GenerateBo imp001GenerateBo) throws Exception{
43 + long start = System.currentTimeMillis();
44 + //生成zip临时文件到指定临时目录
45 + String zipFileName = this.toZips(imp001GenerateBo);
46 + //zip原始临时目录,zip为临时文件
47 + String zipSourceTempFilePath = imp001GenerateBo.getWorkFilePath() + zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP;
48 + //推送zip文件最终目录
49 + String zipTargetFilePath = propertiesConfig.getImp001PathFinal() + zipFileName;
50 + //记录zip文件名称
51 + imp001GenerateBo.setZipFileName(zipFileName);
52 + //记录zip文件目标路径
53 + imp001GenerateBo.setZipFileTargetPath(zipTargetFilePath);
54 + //如果目录不存在则创建完整目录
55 + nioFileUtils.mkdirs(propertiesConfig.getImp001PathFinal());
56 + //推送zip临时文件到指定目标目录,复制文件到指定目录,采用
57 + String zipTargetTempFilePath = zipTargetFilePath + Constant.FILE_SUFFIX_KEYS.TEMP;
58 + //复制文件至目标目录,为临时文件
59 + nioFileUtils.copyFile(zipSourceTempFilePath,zipTargetTempFilePath);
60 + log.info("复制到目标目录完成 sourceTempFilePath : {} , targetTempFilePath : {} ",zipSourceTempFilePath,zipTargetTempFilePath);
61 + //重命名为正式文件
62 + nioFileUtils.moveFile(zipTargetTempFilePath,zipTargetFilePath);
63 + log.info("重命名为正式文件成功 zipTargetTempFilePath : {} , zipTargetFilePath : {} ",zipTargetTempFilePath,zipTargetFilePath);
64 + long end = System.currentTimeMillis();
65 + log.info("运单号IMP001:{} 推送完成,总计耗时:{} ms",imp001GenerateBo.getConsignmentCode() ,(end - start));
66 + }
67 +
68 + /**
69 + * @Author mt
70 + * @Description 功能说明 生成zip临时文件到指定临时目录,将用户上传,以及生成的json文件打包进zip文件中
71 + * @Date 2024/5/30
72 + * @param imp001GenerateBo
73 + * @return java.lang.String
74 + */
75 + private String toZips(Imp001GenerateBo imp001GenerateBo) throws Exception{
76 + /******************初始化需要压缩文件列表****************/
77 + List<File> filesList = new ArrayList<File>();
78 + //生成json文件名称
79 + String jsonFileName = this.generateJsonFileName(imp001GenerateBo,"", Constant.FILE_SUFFIX_KEYS.JSON);
80 + //生成json文件
81 + JsonToJava.createJsonFile(JsonToJava.toJson(imp001GenerateBo.getImp001RootJsonDto()),
82 + imp001GenerateBo.getWorkFilePath(), jsonFileName);
83 + //获取json完整路径
84 + String jsonFilePath = imp001GenerateBo.getWorkFilePath() + jsonFileName;
85 + filesList.add(new File(jsonFilePath));
86 + //文件名称
87 + Imp001Files[] fileInfos = imp001GenerateBo.getFileInfos();
88 + if(fileInfos != null && fileInfos.length > 0){
89 + for (Imp001Files fileInfo : fileInfos) {
90 + //文件如果存在则添加到文件集合中
91 + File file = new File(imp001GenerateBo.getWorkFilePath() + fileInfo.getName());
92 + if(file.exists()){
93 + filesList.add(file);
94 + }
95 + }
96 + }
97 + //生成zip文件名称 .zip
98 + String zipFileName = this.generateJsonFileName(imp001GenerateBo, Constant.IMP001_HEAD_KEYS.MESSAGE_CODE, Constant.FILE_SUFFIX_KEYS.ZIP);
99 + //生成zip临时文件名称 .temp
100 + String zipTempFileName = zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP;
101 + FileOutputStream fos = null;
102 + try{
103 + //完整zip临时文件名称
104 + File zipTemp = new File(imp001GenerateBo.getWorkFilePath() + zipTempFileName);
105 + fos = new FileOutputStream(zipTemp);
106 + zipUtils.toZip(filesList, fos);
107 + }catch(Exception ex){
108 + log.error("生成压缩包错误:{}",ex.getMessage(),ex);
109 + throw ex;
110 + }finally{
111 + try {
112 + if (fos != null) {
113 + fos.close();
114 + fos = null;
115 + }
116 + } catch (Exception e) {
117 + log.error(e.getMessage(),e);
118 + throw e;
119 + }
120 + }
121 + return zipFileName;
122 + }
123 +
124 + /**
125 + * @Author mt
126 + * @Description 功能说明 生成文件名称
127 + * @Date 2024年12月18日
128 + * @param imp001GenerateBo
129 + * @param prefix 前缀
130 + * @param suffix 后缀
131 + * @return java.lang.String
132 + */
133 + private String generateJsonFileName(Imp001GenerateBo imp001GenerateBo,String prefix,String suffix){
134 + String fileName = prefix + imp001GenerateBo.getConsignmentCode() + BaseSeparatorConstants.SEPARATOR_UNDERLINE
135 + + StringExtUtil.idLeftPadStr(imp001GenerateBo.getConsignmentId(), DigitConstants.DIGIT_TEN) + BaseSeparatorConstants.SEPARATOR_UNDERLINE +
136 + DateUtil.yyyyMMddHH24mmssSSS(new Date()) + suffix;
137 + return fileName;
138 + }
139 +}
...\ No newline at end of file ...\ No newline at end of file
......
1 -//package com.fedex.connect.task.utils.biz.imp001; 1 +package com.fedex.connect.task.utils.biz.imp001;
2 -// 2 +
3 -//import com.fedex.connect.common.model.biz.PushOb; 3 +import com.fedex.connect.common.dependencies.contants.BaseSeparatorConstants;
4 -//import com.fedex.connect.task.config.PropertiesConfig; 4 +import com.fedex.connect.common.dependencies.util.DateUtil;
5 -//import com.fedex.connect.task.data.bo.Imp001GenerateBo; 5 +import com.fedex.connect.common.dependencies.util.NIOFileUtils;
6 -//import com.fedex.export.common.enums.PushLogEnum; 6 +import com.fedex.connect.common.model.bi.DictionaryEntries;
7 -//import com.fedex.export.common.util.DateUtil; 7 +import com.fedex.connect.common.model.biz.PushOb;
8 -//import com.fedex.export.common.util.NioFileUtils; 8 +import com.fedex.connect.common.model.biz.PushObDetail;
9 -//import com.fedex.export.common.util.Utils; 9 +import com.fedex.connect.task.config.PropertiesConfig;
10 -//import com.fedex.export.config.PropertiesConfig; 10 +import com.fedex.connect.task.constants.Constant;
11 -//import com.fedex.export.constants.Constant; 11 +import com.fedex.connect.task.data.bo.Imp001GenerateBo;
12 -//import com.fedex.export.data.bo.Imp001GenerateBo; 12 +import com.fedex.connect.task.data.dto.imp001.Imp001Files;
13 -//import com.fedex.export.repository.entity.DeclareInfo; 13 +import com.fedex.connect.task.repository.repo.biz.IPushObRepository;
14 -//import com.fedex.export.repository.entity.log.PushObDetail; 14 +import com.fedex.connect.task.service.biz.IPushObDetailService;
15 -//import com.fedex.export.repository.entity.log.PushObLog; 15 +import lombok.extern.slf4j.Slf4j;
16 -//import com.fedex.export.repository.repo.business.IPushObLogRepository; 16 +import org.springframework.beans.factory.annotation.Autowired;
17 -//import com.fedex.export.service.business.IPushObDetailService; 17 +import org.springframework.stereotype.Component;
18 -//import lombok.extern.slf4j.Slf4j; 18 +
19 -//import org.slf4j.Logger; 19 +import java.util.ArrayList;
20 -//import org.slf4j.LoggerFactory; 20 +import java.util.Date;
21 -//import org.springframework.beans.factory.annotation.Autowired; 21 +import java.util.List;
22 -//import org.springframework.stereotype.Component; 22 +import java.util.Objects;
23 -// 23 +
24 -//import java.util.ArrayList; 24 +/**
25 -//import java.util.Date; 25 + * @Author mt
26 -//import java.util.List; 26 + * @Description 类说明 推送tw001完成,记录日志,并且备份数据
27 -//import java.util.Objects; 27 + * @Date 2024/5/30
28 -// 28 + */
29 -///** 29 +@Slf4j
30 -// * @Author mt 30 +@Component
31 -// * @Description 类说明 推送tw001完成,记录日志,并且备份数据 31 +public class Imp001RecordLogUtil {
32 -// * @Date 2024/5/30 32 + @Autowired
33 -// */ 33 + PropertiesConfig propertiesConfig;
34 -//@Slf4j 34 + @Autowired
35 -//@Component 35 + IPushObRepository pushObLogRepository;
36 -//public class Imp001RecordLogUtil { 36 + @Autowired
37 -// @Autowired 37 + IPushObDetailService pushObDetailService;
38 -// PropertiesConfig propertiesConfig; 38 + @Autowired
39 -// @Autowired 39 + NIOFileUtils nioFileUtils;
40 -// IPushObLogRepository pushObLogRepository; 40 +
41 -// @Autowired 41 + /**
42 -// IPushObDetailService pushObDetailService; 42 + * @Author mt
43 -// @Autowired 43 + * @Description 推送成功记录日志
44 -// NioFileUtils nioFileUtils; 44 + * @Date 2024/12/18
45 -// 45 + * @param imp001GenerateBo
46 -// /** 46 + * @param obLog
47 -// * @Author mt 47 + * @param pushSuccessEntries
48 -// * @Description 推送成功记录日志 48 + * @return void
49 -// * @Date 2024/11/21 49 + */
50 -// * @param imp001GenerateBo 50 + public void pushSuccessRecordLog(Imp001GenerateBo imp001GenerateBo, PushOb obLog, DictionaryEntries pushSuccessEntries){
51 -// * @param obLog 51 + try {
52 -// * @return void 52 + if(Objects.nonNull(imp001GenerateBo)){
53 -// */ 53 + //备份文件,并且记录日志
54 -// public void pushSuccessRecordLog(Imp001GenerateBo imp001GenerateBo, PushOb obLog){ 54 + String targetPath = this.recordLog(imp001GenerateBo,obLog , propertiesConfig.getImp001PathBak(),pushSuccessEntries,null);
55 -// try { 55 + obLog.setFileName(imp001GenerateBo.getZipFileName());
56 -// if(Objects.nonNull(imp001GenerateBo)){ 56 + obLog.setFilePath(imp001GenerateBo.getZipFileTargetPath());
57 -// //备份文件,并且记录日志 57 + obLog.setFileBackPath(targetPath);
58 -// String targetPath = this.recordLog(imp001GenerateBo,obLog , propertiesConfig.getTw001PathBak(),PushLogEnum.PUSHED_SUCCESS,null); 58 + }
59 -// obLog.setFileName(imp001GenerateBo.getZipFileName()); 59 + obLog.setPushNum(obLog.getPushNum() + 1);
60 -// obLog.setFilePath(imp001GenerateBo.getZipFileTargetPath()); 60 + obLog.setStatusCode(pushSuccessEntries.getCode());
61 -// obLog.setFileBackPath(targetPath); 61 + obLog.setStatusName(pushSuccessEntries.getDescription());
62 -// } 62 + obLog.setPushTime(new Date());
63 -// obLog.setPushNum(obLog.getPushNum() + 1); 63 + obLog.setRemark("");
64 -// obLog.setPushStatus(PushLogEnum.PUSHED_SUCCESS.getKey()); 64 + //更新推送日志主表
65 -// obLog.setPushStatusDescribe(PushLogEnum.PUSHED_SUCCESS.getValue()); 65 + pushObLogRepository.updateById(obLog);
66 -// obLog.setPushTime(new Date()); 66 + }catch(Exception ex){
67 -// obLog.setRemark(""); 67 + log.error("pushSuccessRecordLog : {} " ,ex.getMessage(),ex);
68 -// //更新推送日志主表 68 + }
69 -// pushObLogRepository.updateById(obLog); 69 + }
70 -// }catch(Exception ex){ 70 +
71 -// log.error("pushSuccessRecordLog : {} " ,ex.getMessage(),ex); 71 + /**
72 -// } 72 + * @Author mt
73 -// } 73 + * @Description 推送失败记录日志
74 -// 74 + * @Date 2024/12/18
75 -// /** 75 + * @param tw001GenerateBo
76 -// * @Author mt 76 + * @param obLog
77 -// * @Description 功能说明 推送失败记录日志 77 + * @param pushFailedEntries
78 -// * @Date 2024/5/30 78 + * @param errorMsg
79 -// * @param tw001GenerateBo 79 + * @return void
80 -// * @param errorMsg 80 + */
81 -// * @return void 81 + public void pushFailRecordLog(Imp001GenerateBo tw001GenerateBo, PushOb obLog, DictionaryEntries pushFailedEntries, String errorMsg){
82 -// */ 82 + try {
83 -// public void pushFailRecordLog(Imp001GenerateBo tw001GenerateBo, PushOb obLog, String errorMsg){ 83 + if(Objects.nonNull(tw001GenerateBo)){
84 -// try { 84 + //备份文件,并且记录失败日志
85 -// if(Objects.nonNull(tw001GenerateBo)){ 85 + String targetPath = this.recordLog(tw001GenerateBo,obLog,propertiesConfig.getImp001PathError(),pushFailedEntries,errorMsg);
86 -// //备份文件,并且记录失败日志 86 + obLog.setFileName(tw001GenerateBo.getZipFileName());
87 -// String targetPath = this.recordLog(tw001GenerateBo,obLog,propertiesConfig.getTw001PathError(),PushLogEnum.PUSH_FAILED,errorMsg); 87 + obLog.setFilePath(tw001GenerateBo.getZipFileTargetPath());
88 -// obLog.setFileName(tw001GenerateBo.getZipFileName()); 88 + obLog.setFileBackPath(targetPath);
89 -// obLog.setFilePath(tw001GenerateBo.getZipFileTargetPath()); 89 + }
90 -// obLog.setFileBackPath(targetPath); 90 + obLog.setPushNum(obLog.getPushNum() + 1);
91 -// } 91 + obLog.setStatusCode(pushFailedEntries.getCode());
92 -// obLog.setPushNum(obLog.getPushNum() + 1); 92 + obLog.setStatusName(pushFailedEntries.getDescription());
93 -// obLog.setPushStatus(PushLogEnum.PUSH_FAILED.getKey()); 93 + obLog.setPushTime(new Date());
94 -// obLog.setPushStatusDescribe(PushLogEnum.PUSH_FAILED.getValue()); 94 + obLog.setRemark(errorMsg);
95 -// obLog.setPushTime(new Date()); 95 + //更新推送日志主表
96 -// obLog.setRemark(errorMsg); 96 + pushObLogRepository.updateById(obLog);
97 -// //更新推送日志主表 97 + }catch(Exception ex){
98 -// pushObLogRepository.updateById(obLog); 98 + log.error("pushFailRecordLog : {} " ,ex.getMessage(),ex);
99 -// }catch(Exception ex){ 99 + }
100 -// log.error("pushFailRecordLog : {} " ,ex.getMessage(),ex); 100 + }
101 -// } 101 +
102 -// } 102 + /**
103 -// 103 + * @Author mt
104 -// /** 104 + * @Description 功能说明 备份文件
105 -// * @Author mt 105 + * @Date 2024/5/30
106 -// * @Description 功能说明 备份文件 106 + * @param tw001GenerateBo
107 -// * @Date 2024/5/30 107 + * @param tarPath
108 -// * @param tw001GenerateBo 108 + * @return 返回目标备份路径
109 -// * @param tarPath 109 + */
110 -// * @return 返回目标备份路径 110 + private String recordLog(Imp001GenerateBo tw001GenerateBo,
111 -// */ 111 + PushOb obLog,
112 -// private String recordLog(Imp001GenerateBo tw001GenerateBo, 112 + String tarPath,
113 -// PushOb obLog, 113 + DictionaryEntries pushStatusEntries,
114 -// String tarPath, 114 + String remark){
115 -// PushLogEnum pushLogEnum, 115 + String returnTargetPath = "";
116 -// String remark){ 116 + try{
117 -// String returnTargetPath = ""; 117 + //文件原始路径
118 -// try{ 118 + String sourcePath = tw001GenerateBo.getWorkFilePath();
119 -// DeclareInfo declareInfo = tw001GenerateBo.getDeclareInfo(); 119 + //生成文件目标路径
120 -// //文件原始路径 120 + String targetPath = this.generateFilePath(tw001GenerateBo.getConsignmentCode(),tw001GenerateBo.getConsignmentId(),tarPath);
121 -// String sourcePath = tw001GenerateBo.getWorkFilePath(); 121 + returnTargetPath = targetPath;
122 -// //生成文件目标路径 122 + //推送文件明细
123 -// String targetPath = this.generateFilePath(declareInfo.getDeliveryNo(),declareInfo.getDeclareId(),tarPath); 123 + List<PushObDetail> pushObDetailList = new ArrayList<>();
124 -// returnTargetPath = targetPath; 124 +
125 -// //推送文件明细 125 + Imp001Files[] fileInfos = tw001GenerateBo.getFileInfos();
126 -// List<PushObDetail> pushObDetailList = new ArrayList<>(); 126 + for (Imp001Files fileInfo : fileInfos) {
127 -// Utils.listOf(tw001GenerateBo.getFileInfoList()).stream().filter(Objects::nonNull).forEach(o->{ 127 + try {
128 -// try { 128 + //源文件完整路径
129 -// //源文件完整路径 129 + String sPath = sourcePath + fileInfo.getName();
130 -// String sPath = sourcePath + o.getFileName(); 130 + //目标文件完整路径
131 -// //目标文件完整路径 131 + String tPath = targetPath + fileInfo.getName();
132 -// String tPath = targetPath + o.getFileName(); 132 + //备份文件
133 -// //备份文件 133 + nioFileUtils.moveFile(sPath, tPath);
134 -// nioFileUtils.moveFile(sPath, tPath); 134 + //记录日志明细表
135 -// //记录日志明细表 135 + PushObDetail pushObDetail = new PushObDetail();
136 -// PushObDetail pushObDetail = new PushObDetail(); 136 + pushObDetail.setCreateTime(new Date());
137 -// pushObDetail.setCreateTime(new Date()); 137 + pushObDetail.setConsignmentId(tw001GenerateBo.getConsignmentId());
138 -// pushObDetail.setDeclareId(declareInfo.getDeclareId()); 138 + pushObDetail.setConsignmentCode(tw001GenerateBo.getConsignmentCode());
139 -// pushObDetail.setDeliveryNo(declareInfo.getDeliveryNo()); 139 + pushObDetail.setPushObId(obLog.getId());
140 -// pushObDetail.setPushLogId(obLog.getId()); 140 +
141 -// pushObDetail.setPushStatus(pushLogEnum.getKey()); 141 + pushObDetail.setStatusCode(pushStatusEntries.getCode());
142 -// pushObDetail.setPushStatusDescribe(pushLogEnum.getValue()); 142 + pushObDetail.setStatusName(pushStatusEntries.getDescription());
143 -// pushObDetail.setFileTypeId(o.getFileTypeId()); 143 + pushObDetail.setFileType(fileInfo.getContentType());
144 -// pushObDetail.setFileType(o.getFileTypeName()); 144 + pushObDetail.setFileName(fileInfo.getName());
145 -// pushObDetail.setFileName(o.getFileName()); 145 + pushObDetail.setPushTime(new Date());
146 -// pushObDetail.setPushTime(new Date()); 146 + pushObDetail.setRemark(remark);
147 -// pushObDetail.setRemark(remark); 147 + pushObDetailList.add(pushObDetail);
148 -// pushObDetailList.add(pushObDetail); 148 + }catch(Exception ex){
149 -// }catch(Exception ex){ 149 + log.error("move file error : {} ",ex.getMessage(),ex);
150 -// log.error("move file error : {} ",ex.getMessage(),ex); 150 + }
151 -// } 151 + }
152 -// }); 152 + //批量插入推送日志明细
153 -// //批量插入推送日志明细 153 + pushObDetailService.batchInsert(pushObDetailList);
154 -// pushObDetailService.batchInsert(pushObDetailList); 154 + log.info("batchInsert size : {} ",pushObDetailList.size());
155 -// log.info("batchInsert size : {} ",pushObDetailList.size()); 155 + //zip包源文件完整路径
156 -// //zip包源文件完整路径 156 + String sPath = sourcePath + tw001GenerateBo.getZipFileName() + Constant.FILE_SUFFIX_KEYS.TEMP;
157 -// String sPath = sourcePath + tw001GenerateBo.getZipFileName() + Constant.FILE_SUFFIX_KEYS.TEMP; 157 + //zip包目标文件完整路径
158 -// //zip包目标文件完整路径 158 + String tPath = targetPath + tw001GenerateBo.getZipFileName();
159 -// String tPath = targetPath + tw001GenerateBo.getZipFileName(); 159 + //备份zip包文件
160 -// //备份zip包文件 160 + nioFileUtils.moveFile(sPath, tPath);
161 -// nioFileUtils.moveFile(sPath, tPath); 161 + //删除临时目录文件夹
162 -// //删除临时目录文件夹 162 + nioFileUtils.deleteDir(log,sourcePath,true);
163 -// nioFileUtils.deleteDir(log,sourcePath,true); 163 + log.info("删除临时目录文件夹 sourcePath : {} ",sourcePath);
164 -// log.info("删除临时目录文件夹 sourcePath : {} ",sourcePath); 164 + }catch(Exception ex){
165 -// }catch(Exception ex){ 165 + log.error("recordLog error : {} ",ex.getMessage(),ex);
166 -// log.error("recordLog error : {} ",ex.getMessage(),ex); 166 + }
167 -// } 167 + return returnTargetPath;
168 -// return returnTargetPath; 168 + }
169 -// } 169 +
170 -// 170 + /**
171 -// /** 171 + * @Author mt
172 -// * @Author mt 172 + * @Description 功能说明 生成目标文件夹路径
173 -// * @Description 功能说明 生成目标文件夹路径 173 + * @Date 2024/5/30
174 -// * @Date 2024/5/30 174 + * @param filePath
175 -// * @param filePath 175 + * @return java.lang.String
176 -// * @return java.lang.String 176 + */
177 -// */ 177 + private String generateFilePath(String consignmentCode,Long consignmentId,String filePath){
178 -// private String generateFilePath(String deliveryNo,Long declareId,String filePath){ 178 + String yyyyMMdd = DateUtil.format(new Date());
179 -// String yyyyMMdd = DateUtil.format(new Date()); 179 + String fileDir = filePath + yyyyMMdd + BaseSeparatorConstants.SEPARATOR_SLASH +
180 -// String fileDir = filePath + yyyyMMdd + Constant.COMMON_KEYS.BACK_SLASH + 180 + consignmentCode + BaseSeparatorConstants.SEPARATOR_UNDERLINE + consignmentId + BaseSeparatorConstants.SEPARATOR_SLASH;
181 -// deliveryNo + Constant.COMMON_KEYS.UNDER_LINE + declareId + Constant.COMMON_KEYS.BACK_SLASH; 181 + //如果目录不存在则创建完整目录
182 -// //如果目录不存在则创建完整目录 182 + nioFileUtils.mkdirs(fileDir);
183 -// nioFileUtils.mkdirs(fileDir); 183 + return fileDir;
184 -// return fileDir; 184 + }
185 -// } 185 +}
186 -//}
......
...@@ -268,15 +268,15 @@ public class ConFileEmailUtil { ...@@ -268,15 +268,15 @@ public class ConFileEmailUtil {
268 //如果失败次数小于三则更新为待处理,继续处理 268 //如果失败次数小于三则更新为待处理,继续处理
269 if (result){ 269 if (result){
270 conPushEmail.setTypeCode(success.getCode()); 270 conPushEmail.setTypeCode(success.getCode());
271 - conPushEmail.setTypeName(success.getEnglishName()); 271 + conPushEmail.setTypeName(success.getDescription());
272 }else { 272 }else {
273 if (conPushEmail.getSendNum()<3){ 273 if (conPushEmail.getSendNum()<3){
274 conPushEmail.setTypeCode(pending.getCode()); 274 conPushEmail.setTypeCode(pending.getCode());
275 - conPushEmail.setTypeName(pending.getEnglishName()); 275 + conPushEmail.setTypeName(pending.getDescription());
276 conPushEmail.setSendNum(conPushEmail.getSendNum()+1); 276 conPushEmail.setSendNum(conPushEmail.getSendNum()+1);
277 }else { 277 }else {
278 conPushEmail.setTypeCode(failed.getCode()); 278 conPushEmail.setTypeCode(failed.getCode());
279 - conPushEmail.setTypeName(failed.getEnglishName()); 279 + conPushEmail.setTypeName(failed.getDescription());
280 } 280 }
281 } 281 }
282 } 282 }
......
...@@ -122,15 +122,15 @@ public class DuplicateEmailUtil { ...@@ -122,15 +122,15 @@ public class DuplicateEmailUtil {
122 email.setSendTime(new Date()); 122 email.setSendTime(new Date());
123 if (result){ 123 if (result){
124 email.setStatusCode(success.getCode()); 124 email.setStatusCode(success.getCode());
125 - email.setStatusName(success.getEnglishName()); 125 + email.setStatusName(success.getDescription());
126 }else { 126 }else {
127 if (email.getSendNum()<3){ 127 if (email.getSendNum()<3){
128 email.setStatusCode(pending.getCode()); 128 email.setStatusCode(pending.getCode());
129 - email.setStatusName(pending.getEnglishName()); 129 + email.setStatusName(pending.getDescription());
130 email.setSendNum(email.getSendNum()+1); 130 email.setSendNum(email.getSendNum()+1);
131 }else { 131 }else {
132 email.setStatusCode(failed.getCode()); 132 email.setStatusCode(failed.getCode());
133 - email.setStatusName(failed.getEnglishName()); 133 + email.setStatusName(failed.getDescription());
134 } 134 }
135 } 135 }
136 } 136 }
......
...@@ -41,10 +41,10 @@ rpc: ...@@ -41,10 +41,10 @@ rpc:
41 rpcKafkaReceive1: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive 41 rpcKafkaReceive1: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive
42 rpcKafkaReceive2: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive 42 rpcKafkaReceive2: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive
43 43
44 -tw001: 44 +imp001:
45 path: 45 path:
46 #基础路径 46 #基础路径
47 - basePath: /var/share/icleartw/TWIMPORT/ 47 + basePath: /var/share/iClearPreCLR/ToIMPORT/
48 #json生成路径 48 #json生成路径
49 work: ${tw001.path.basePath}work/ 49 work: ${tw001.path.basePath}work/
50 #zip输出目录 50 #zip输出目录
......
...@@ -21,10 +21,10 @@ rpc: ...@@ -21,10 +21,10 @@ rpc:
21 rpcKafkaReceive1: https://pjea0179.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive 21 rpcKafkaReceive1: https://pjea0179.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive
22 rpcKafkaReceive2: https://pjea0180.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive 22 rpcKafkaReceive2: https://pjea0180.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive
23 23
24 -tw001: 24 +imp001:
25 path: 25 path:
26 #基础路径 26 #基础路径
27 - basePath: /var/share/icleartw/TWIMPORT/ 27 + basePath: /var/share/iClearPreCLR/ToIMPORT/
28 #json生成路径 28 #json生成路径
29 work: ${tw001.path.basePath}work/ 29 work: ${tw001.path.basePath}work/
30 #zip输出目录 30 #zip输出目录
......
...@@ -21,10 +21,10 @@ rpc: ...@@ -21,10 +21,10 @@ rpc:
21 rpcKafkaReceive1: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive 21 rpcKafkaReceive1: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive
22 rpcKafkaReceive2: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive 22 rpcKafkaReceive2: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive
23 23
24 -tw001: 24 +imp001:
25 path: 25 path:
26 #基础路径 26 #基础路径
27 - basePath: /app/Oracle/Middleware/user_projects/domains/base_domain/exportTw/TWIMPORT/ 27 + basePath: /app/Oracle/Middleware/user_projects/domains/base_domain/iClearPreCLR/ToIMPORT/
28 #json生成路径 28 #json生成路径
29 work: ${tw001.path.basePath}work/ 29 work: ${tw001.path.basePath}work/
30 #zip输出目录 30 #zip输出目录
......
...@@ -21,10 +21,10 @@ rpc: ...@@ -21,10 +21,10 @@ rpc:
21 rpcKafkaReceive1: http://ujea0145.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive 21 rpcKafkaReceive1: http://ujea0145.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive
22 rpcKafkaReceive2: http://ujea0146.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive 22 rpcKafkaReceive2: http://ujea0146.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive
23 23
24 -tw001: 24 +imp001:
25 path: 25 path:
26 #基础路径 26 #基础路径
27 - basePath: /var/share/icleartw/TWIMPORT/ 27 + basePath: /var/share/iClearPreCLR/ToIMPORT/
28 #json生成路径 28 #json生成路径
29 work: ${tw001.path.basePath}work/ 29 work: ${tw001.path.basePath}work/
30 #zip输出目录 30 #zip输出目录
......