Showing
3 changed files
with
32 additions
and
19 deletions
| ... | @@ -18,4 +18,11 @@ public interface DeclearTaskRepository extends JpaSpecificationExecutor<DeclearT | ... | @@ -18,4 +18,11 @@ public interface DeclearTaskRepository extends JpaSpecificationExecutor<DeclearT |
| 18 | */ | 18 | */ |
| 19 | @Query( nativeQuery = true,value ="SELECT TOP 10 * FROM T_DECLEAR_TASK WHERE FILE_TYPE = 1 AND PUSH_NUMBER < 3 AND (RESPONSE_RESULTS IS NULL OR RESPONSE_RESULTS <> '0') ORDER BY OPERATION_TIME ASC" ) | 19 | @Query( nativeQuery = true,value ="SELECT TOP 10 * FROM T_DECLEAR_TASK WHERE FILE_TYPE = 1 AND PUSH_NUMBER < 3 AND (RESPONSE_RESULTS IS NULL OR RESPONSE_RESULTS <> '0') ORDER BY OPERATION_TIME ASC" ) |
| 20 | public List<DeclearTask> findDeclearTask(); | 20 | public List<DeclearTask> findDeclearTask(); |
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 根据运单号集合+创建时间 运单 | ||
| 24 | + * @return | ||
| 25 | + */ | ||
| 26 | + @Query( nativeQuery = true,value ="SELECT TOP 10 * FROM T_DECLEAR_TASK WHERE FILE_TYPE = 1 AND PUSH_NUMBER >= 3 AND (RESPONSE_RESULTS IS NULL OR RESPONSE_RESULTS <> '0') ORDER BY OPERATION_TIME ASC" ) | ||
| 27 | + public List<DeclearTask> findErrorDeclearTask(); | ||
| 21 | } | 28 | } | ... | ... |
| ... | @@ -39,15 +39,7 @@ public interface ReceiptMessageRepository extends JpaSpecificationExecutor<Recei | ... | @@ -39,15 +39,7 @@ public interface ReceiptMessageRepository extends JpaSpecificationExecutor<Recei |
| 39 | * @param | 39 | * @param |
| 40 | * @return | 40 | * @return |
| 41 | */ | 41 | */ |
| 42 | - @Query(nativeQuery = true, value = "SELECT RM.* FROM T_RECEIPT_MESSAGE RM INNER JOIN T_DECLEAR_TASK DT ON(RM.ID = DT.CHMSIGNMENT_ID) WHERE FILE_TYPE = 2 AND PUSH_NUMBER >= 3 AND RESPONSE_RESULTS ='失败' ORDER BY RM.NOTICE_DATE ASC") | 42 | + @Query(nativeQuery = true, value = "SELECT RM.* FROM T_RECEIPT_MESSAGE RM INNER JOIN T_DECLEAR_TASK DT ON(RM.ID = DT.CHMSIGNMENT_ID) WHERE FILE_TYPE = 2 AND PUSH_NUMBER >= 3 AND RESPONSE_RESULTS <> '0' ORDER BY RM.NOTICE_DATE ASC") |
| 43 | public List<ReceiptMessage> findReceiptMessageErrorReturnList(); | 43 | public List<ReceiptMessage> findReceiptMessageErrorReturnList(); |
| 44 | - /** | ||
| 45 | - * 推送失败申报数据 | ||
| 46 | - * | ||
| 47 | - * @param | ||
| 48 | - * @return | ||
| 49 | - */ | ||
| 50 | - @Query(nativeQuery = true, value = "SELECT RM.* FROM T_RECEIPT_MESSAGE RM INNER JOIN T_DECLEAR_TASK DT ON(RM.ID = DT.CHMSIGNMENT_ID) WHERE FILE_TYPE = 1 AND PUSH_NUMBER >= 3 AND RESPONSE_RESULTS ='失败' ORDER BY RM.NOTICE_DATE ASC") | ||
| 51 | - public List<ReceiptMessage> findReceiptMessageErrorDeclareList(); | ||
| 52 | 44 | ||
| 53 | } | 45 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -178,17 +178,11 @@ public class ApiService { | ... | @@ -178,17 +178,11 @@ public class ApiService { |
| 178 | }); | 178 | }); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | - /** | 181 | + public void pushMawbAcc(String token,List<DeclearTask> declearTaskList){ |
| 182 | - * 传输完整报文数据 | ||
| 183 | - * @param token | ||
| 184 | - * @throws Exception | ||
| 185 | - */ | ||
| 186 | - public void pushMawb(String token){ | ||
| 187 | try{ | 182 | try{ |
| 188 | /****************将Export对象转换成西门子交互实体对象****************/ | 183 | /****************将Export对象转换成西门子交互实体对象****************/ |
| 189 | //查询需要推送数据 | 184 | //查询需要推送数据 |
| 190 | List<Mawb> mawbList = new ArrayList<Mawb>(); | 185 | List<Mawb> mawbList = new ArrayList<Mawb>(); |
| 191 | - List<DeclearTask> declearTaskList = this.declearTaskRepository.findDeclearTask(); | ||
| 192 | declearTaskList.forEach(declearTask -> { | 186 | declearTaskList.forEach(declearTask -> { |
| 193 | Long consignmentId = declearTask.getChmsignmentId().longValue(); | 187 | Long consignmentId = declearTask.getChmsignmentId().longValue(); |
| 194 | //查询需要推送运单数据,并且转换 | 188 | //查询需要推送运单数据,并且转换 |
| ... | @@ -211,6 +205,18 @@ public class ApiService { | ... | @@ -211,6 +205,18 @@ public class ApiService { |
| 211 | ex.printStackTrace(); | 205 | ex.printStackTrace(); |
| 212 | } | 206 | } |
| 213 | } | 207 | } |
| 208 | + /** | ||
| 209 | + * 传输完整报文数据 | ||
| 210 | + * @param token | ||
| 211 | + * @throws Exception | ||
| 212 | + */ | ||
| 213 | + public void pushMawb(String token){ | ||
| 214 | + List<DeclearTask> declearTaskList = this.declearTaskRepository.findDeclearTask(); | ||
| 215 | + if (declearTaskList == null){ | ||
| 216 | + return; | ||
| 217 | + } | ||
| 218 | + this.pushMawbAcc(token,declearTaskList); | ||
| 219 | + } | ||
| 214 | 220 | ||
| 215 | /** | 221 | /** |
| 216 | * 将完整报文发送至西门子 | 222 | * 将完整报文发送至西门子 |
| ... | @@ -284,6 +290,13 @@ public class ApiService { | ... | @@ -284,6 +290,13 @@ public class ApiService { |
| 284 | //获取海关回执数据 | 290 | //获取海关回执数据 |
| 285 | List<ReceiptMessage> receiptMessageList = receiptMessageRepository.findReceiptMessageErrorReturnList(); | 291 | List<ReceiptMessage> receiptMessageList = receiptMessageRepository.findReceiptMessageErrorReturnList(); |
| 286 | if (receiptMessageList !=null && receiptMessageList.size() > 0){ | 292 | if (receiptMessageList !=null && receiptMessageList.size() > 0){ |
| 293 | + //去除微秒 | ||
| 294 | + for(int i = 0 ; i < receiptMessageList.size() ; i ++){ | ||
| 295 | + ReceiptMessage receiptMessage = receiptMessageList.get(i); | ||
| 296 | + Date noticeDate = DateUtils.string2Date(receiptMessage.getNoticeDate(),null); | ||
| 297 | + String nDate = DateUtils.formatDate(noticeDate,"yyyy-MM-dd HH:mm:ss"); | ||
| 298 | + receiptMessage.setNoticeDate(nDate); | ||
| 299 | + } | ||
| 287 | this.sendCustoms(token,receiptMessageList); | 300 | this.sendCustoms(token,receiptMessageList); |
| 288 | } | 301 | } |
| 289 | } | 302 | } |
| ... | @@ -294,9 +307,10 @@ public class ApiService { | ... | @@ -294,9 +307,10 @@ public class ApiService { |
| 294 | */ | 307 | */ |
| 295 | public void pushErrorDeclareDate(String token){ | 308 | public void pushErrorDeclareDate(String token){ |
| 296 | //获取海关申报数据 | 309 | //获取海关申报数据 |
| 297 | - List<ReceiptMessage> receiptMessageList = receiptMessageRepository.findReceiptMessageErrorDeclareList(); | 310 | + List<DeclearTask> declearTaskList = this.declearTaskRepository.findErrorDeclearTask(); |
| 298 | - if (receiptMessageList !=null && receiptMessageList.size() > 0){ | 311 | + if (declearTaskList == null){ |
| 299 | - this.sendCustoms(token,receiptMessageList); | 312 | + return; |
| 300 | } | 313 | } |
| 314 | + this.pushMawbAcc(token,declearTaskList); | ||
| 301 | } | 315 | } |
| 302 | } | 316 | } | ... | ... |
-
Please register or login to post a comment