Showing
53 changed files
with
1849 additions
and
200 deletions
| ... | @@ -6,15 +6,16 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | ... | @@ -6,15 +6,16 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; |
| 7 | import org.springframework.boot.builder.SpringApplicationBuilder; | 7 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 9 | import org.springframework.context.annotation.ComponentScan; | 10 | import org.springframework.context.annotation.ComponentScan; |
| 10 | import org.springframework.transaction.annotation.EnableTransactionManagement; | 11 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| 11 | import org.springframework.web.WebApplicationInitializer; | 12 | import org.springframework.web.WebApplicationInitializer; |
| 13 | +import org.springframework.web.client.RestTemplate; | ||
| 12 | import springfox.documentation.swagger2.annotations.EnableSwagger2; | 14 | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| 13 | 15 | ||
| 14 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) | 16 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) |
| 15 | -@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.customer.repository.dao"}) | 17 | +@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.common.dependencies.repository.dao","com.fedex.connect.customer.repository.dao"}) |
| 16 | @EnableTransactionManagement | 18 | @EnableTransactionManagement |
| 17 | -@ComponentScan(basePackages = {"com.fedex.connect.common.dependencies.i18n", "com.fedex.connect.customer"}) | ||
| 18 | @EnableSwagger2 | 19 | @EnableSwagger2 |
| 19 | public class CustomerApplication extends SpringBootServletInitializer implements WebApplicationInitializer { | 20 | public class CustomerApplication extends SpringBootServletInitializer implements WebApplicationInitializer { |
| 20 | public static void main(String[] args) { | 21 | public static void main(String[] args) { |
| ... | @@ -25,4 +26,9 @@ public class CustomerApplication extends SpringBootServletInitializer implements | ... | @@ -25,4 +26,9 @@ public class CustomerApplication extends SpringBootServletInitializer implements |
| 25 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | 26 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| 26 | return builder.sources(CustomerApplication.class); | 27 | return builder.sources(CustomerApplication.class); |
| 27 | } | 28 | } |
| 29 | + | ||
| 30 | + @Bean | ||
| 31 | + public RestTemplate restTemplate() { | ||
| 32 | + return new RestTemplate(); | ||
| 33 | + } | ||
| 28 | } | 34 | } | ... | ... |
| ... | @@ -14,19 +14,20 @@ import java.util.Locale; | ... | @@ -14,19 +14,20 @@ import java.util.Locale; |
| 14 | */ | 14 | */ |
| 15 | public class MessageLocaleResolver implements LocaleResolver { | 15 | public class MessageLocaleResolver implements LocaleResolver { |
| 16 | 16 | ||
| 17 | - @Value("${export.language}") | 17 | +// @Value("${export.language}") |
| 18 | - private String exportTwLanguage; | 18 | +// private String exportTwLanguage; |
| 19 | 19 | ||
| 20 | @Override | 20 | @Override |
| 21 | public Locale resolveLocale(HttpServletRequest request) { | 21 | public Locale resolveLocale(HttpServletRequest request) { |
| 22 | - Locale locale; | 22 | +// Locale locale; |
| 23 | - if (StringUtils.isNotEmpty(exportTwLanguage)) { | 23 | +// if (StringUtils.isNotEmpty(exportTwLanguage)) { |
| 24 | - //获取知道配置文件中的语言为: exportTwLanguage; | 24 | +// //获取知道配置文件中的语言为: exportTwLanguage; |
| 25 | - locale = new Locale(exportTwLanguage); | 25 | +// locale = new Locale(exportTwLanguage); |
| 26 | - } else { | 26 | +// } else { |
| 27 | - //读取不到指定语言文件,采用默认中文。即默认的message.properties | 27 | +// //读取不到指定语言文件,采用默认中文。即默认的message.properties |
| 28 | - locale = Locale.getDefault(); | 28 | +// locale = Locale.getDefault(); |
| 29 | - } | 29 | +// } |
| 30 | + Locale locale = request.getLocale(); | ||
| 30 | return locale; | 31 | return locale; |
| 31 | } | 32 | } |
| 32 | 33 | ... | ... |
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/util/RPCUtils.java
0 → 100644
| 1 | +package com.fedex.connect.common.dependencies.util; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | +import org.springframework.core.ParameterizedTypeReference; | ||
| 6 | +import org.springframework.http.*; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | +import org.springframework.web.client.RestTemplate; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * rpc调用工具类 | ||
| 12 | + * mt | ||
| 13 | + * 2023年8月31日15:26:40 | ||
| 14 | + */ | ||
| 15 | +@Component | ||
| 16 | +public class RPCUtils { | ||
| 17 | + @Autowired | ||
| 18 | + private RestTemplate restTemplate; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 没有返回值的RPC调用 | ||
| 22 | + * | ||
| 23 | + * @param url 请求地址 | ||
| 24 | + * @param body 请求体 | ||
| 25 | + * @return | ||
| 26 | + */ | ||
| 27 | + public Integer rpcInvoke(String url, String body) { | ||
| 28 | + try { | ||
| 29 | + HttpHeaders headers = new HttpHeaders(); | ||
| 30 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 31 | + HttpEntity<String> httpEntity = new HttpEntity<>(body, headers); | ||
| 32 | + ResponseEntity resp = restTemplate.exchange(url, HttpMethod.POST, httpEntity, | ||
| 33 | + new ParameterizedTypeReference<String>() { | ||
| 34 | + }); | ||
| 35 | + HttpStatus httpStatus = resp.getStatusCode(); | ||
| 36 | + return httpStatus.value(); | ||
| 37 | + } catch (Exception e) { | ||
| 38 | + throw e; | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 有实体类有返回值的RPC调用 | ||
| 44 | + * | ||
| 45 | + * @param url 请求地址 | ||
| 46 | + * @param body 请求体 | ||
| 47 | + * @param r 返回值类型 | ||
| 48 | + * @param <R> 返回值类 | ||
| 49 | + * @return | ||
| 50 | + */ | ||
| 51 | + public <R> R rpcResponseInvoke(String url, String body, Class<R> r) { | ||
| 52 | + try { | ||
| 53 | + if (body != null) { | ||
| 54 | + HttpHeaders headers = new HttpHeaders(); | ||
| 55 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 56 | + HttpEntity<String> httpEntity = new HttpEntity<>(body, headers); | ||
| 57 | + ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, httpEntity, | ||
| 58 | + new ParameterizedTypeReference<String>() { | ||
| 59 | + }); | ||
| 60 | +// String bodyJson = JSON.toJSONString(resp.getBody()); | ||
| 61 | + String bodyJson = resp.getBody(); | ||
| 62 | + R res = JSON.parseObject(bodyJson, r); | ||
| 63 | + return res; | ||
| 64 | + } else { | ||
| 65 | + ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, null, | ||
| 66 | + new ParameterizedTypeReference<String>() { | ||
| 67 | + }); | ||
| 68 | +// String bodyJson = JSON.toJSONString(resp.getBody()); | ||
| 69 | + String bodyJson = resp.getBody(); | ||
| 70 | + R res = JSON.parseObject(bodyJson, r); | ||
| 71 | + return res; | ||
| 72 | + } | ||
| 73 | + } catch (Exception e) { | ||
| 74 | + throw e; | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.fedex.connect.common.dependencies.autoconfiguration.AutoConfiguration | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -6,12 +6,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | ... | @@ -6,12 +6,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; |
| 7 | import org.springframework.boot.builder.SpringApplicationBuilder; | 7 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 9 | import org.springframework.transaction.annotation.EnableTransactionManagement; | 10 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| 10 | import org.springframework.web.WebApplicationInitializer; | 11 | import org.springframework.web.WebApplicationInitializer; |
| 12 | +import org.springframework.web.client.RestTemplate; | ||
| 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; | 13 | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| 12 | 14 | ||
| 13 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) | 15 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) |
| 14 | -@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.kafka.repository.dao"}) | 16 | +@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.common.dependencies.repository.dao","com.fedex.connect.kafka.repository.dao"}) |
| 15 | @EnableTransactionManagement | 17 | @EnableTransactionManagement |
| 16 | @EnableSwagger2 | 18 | @EnableSwagger2 |
| 17 | public class KafkaApplication extends SpringBootServletInitializer implements WebApplicationInitializer { | 19 | public class KafkaApplication extends SpringBootServletInitializer implements WebApplicationInitializer { |
| ... | @@ -23,4 +25,9 @@ public class KafkaApplication extends SpringBootServletInitializer implements We | ... | @@ -23,4 +25,9 @@ public class KafkaApplication extends SpringBootServletInitializer implements We |
| 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | 25 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| 24 | return builder.sources(KafkaApplication.class); | 26 | return builder.sources(KafkaApplication.class); |
| 25 | } | 27 | } |
| 28 | + | ||
| 29 | + @Bean | ||
| 30 | + public RestTemplate restTemplate() { | ||
| 31 | + return new RestTemplate(); | ||
| 32 | + } | ||
| 26 | } | 33 | } | ... | ... |
| ... | @@ -203,6 +203,11 @@ public class Dm501Util { | ... | @@ -203,6 +203,11 @@ public class Dm501Util { |
| 203 | AssignmentFieldUtils.assignmentTableBaseField(resultConsignment); | 203 | AssignmentFieldUtils.assignmentTableBaseField(resultConsignment); |
| 204 | rsConsignment = resultConsignment; | 204 | rsConsignment = resultConsignment; |
| 205 | }else{ | 205 | }else{ |
| 206 | + //原产国全称 | ||
| 207 | +// String originCountry = consignment.getOriginCountry(); | ||
| 208 | + //发货人国家二字码 | ||
| 209 | +// String shipperCountry = consignment.getShipperCountry(); | ||
| 210 | + | ||
| 206 | BeanUtils.copyProperties(ceInfo,consignment); | 211 | BeanUtils.copyProperties(ceInfo,consignment); |
| 207 | rsConsignment = consignment; | 212 | rsConsignment = consignment; |
| 208 | } | 213 | } | ... | ... |
| ... | @@ -6,12 +6,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | ... | @@ -6,12 +6,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; |
| 7 | import org.springframework.boot.builder.SpringApplicationBuilder; | 7 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 9 | import org.springframework.transaction.annotation.EnableTransactionManagement; | 10 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| 10 | import org.springframework.web.WebApplicationInitializer; | 11 | import org.springframework.web.WebApplicationInitializer; |
| 12 | +import org.springframework.web.client.RestTemplate; | ||
| 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; | 13 | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| 12 | 14 | ||
| 13 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) | 15 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) |
| 14 | -@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.manager.repository.dao"}) | 16 | +@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.common.dependencies.repository.dao","com.fedex.connect.manager.repository.dao"}) |
| 15 | @EnableTransactionManagement | 17 | @EnableTransactionManagement |
| 16 | @EnableSwagger2 | 18 | @EnableSwagger2 |
| 17 | public class ManagerApplication extends SpringBootServletInitializer implements WebApplicationInitializer { | 19 | public class ManagerApplication extends SpringBootServletInitializer implements WebApplicationInitializer { |
| ... | @@ -23,4 +25,9 @@ public class ManagerApplication extends SpringBootServletInitializer implements | ... | @@ -23,4 +25,9 @@ public class ManagerApplication extends SpringBootServletInitializer implements |
| 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | 25 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| 24 | return builder.sources(ManagerApplication.class); | 26 | return builder.sources(ManagerApplication.class); |
| 25 | } | 27 | } |
| 28 | + | ||
| 29 | + @Bean | ||
| 30 | + public RestTemplate restTemplate() { | ||
| 31 | + return new RestTemplate(); | ||
| 32 | + } | ||
| 26 | } | 33 | } | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | url: jdbc:oracle:thin:@192.168.1.250:1521:orcl | 3 | url: jdbc:oracle:thin:@192.168.1.250:1521:orcl |
| 4 | - username: icleartw | 4 | + username: iclearimp |
| 5 | - password: icleartw | 5 | + password: iclearimp |
| 6 | driver-class-name: oracle.jdbc.OracleDriver | 6 | driver-class-name: oracle.jdbc.OracleDriver |
| 7 | profiles: | 7 | profiles: |
| 8 | #系统环境 | 8 | #系统环境 | ... | ... |
| ... | @@ -6,14 +6,17 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | ... | @@ -6,14 +6,17 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; |
| 7 | import org.springframework.boot.builder.SpringApplicationBuilder; | 7 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 10 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 9 | import org.springframework.transaction.annotation.EnableTransactionManagement; | 11 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| 10 | import org.springframework.web.WebApplicationInitializer; | 12 | import org.springframework.web.WebApplicationInitializer; |
| 13 | +import org.springframework.web.client.RestTemplate; | ||
| 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; | 14 | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| 12 | 15 | ||
| 13 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) | 16 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) |
| 14 | -@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.task.repository.dao"}) | 17 | +@MapperScan({"com.fedex.connect.common.dao.*.**","com.fedex.connect.common.dependencies.repository.dao","com.fedex.connect.task.repository.dao"}) |
| 15 | @EnableTransactionManagement | 18 | @EnableTransactionManagement |
| 16 | -@EnableSwagger2 | 19 | +@EnableScheduling |
| 17 | public class TaskApplication extends SpringBootServletInitializer implements WebApplicationInitializer { | 20 | public class TaskApplication extends SpringBootServletInitializer implements WebApplicationInitializer { |
| 18 | public static void main(String[] args) { | 21 | public static void main(String[] args) { |
| 19 | SpringApplication.run(TaskApplication.class, args); | 22 | SpringApplication.run(TaskApplication.class, args); |
| ... | @@ -23,4 +26,9 @@ public class TaskApplication extends SpringBootServletInitializer implements Web | ... | @@ -23,4 +26,9 @@ public class TaskApplication extends SpringBootServletInitializer implements Web |
| 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | 26 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| 24 | return builder.sources(TaskApplication.class); | 27 | return builder.sources(TaskApplication.class); |
| 25 | } | 28 | } |
| 29 | + | ||
| 30 | + @Bean | ||
| 31 | + public RestTemplate restTemplate() { | ||
| 32 | + return new RestTemplate(); | ||
| 33 | + } | ||
| 26 | } | 34 | } | ... | ... |
| 1 | +package com.fedex.connect.task.annotation; | ||
| 2 | + | ||
| 3 | +import java.lang.annotation.*; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author mt | ||
| 7 | + * @Description 输出执行时间日志 | ||
| 8 | + * @Date 2024/5/23 | ||
| 9 | + */ | ||
| 10 | +@Target({ ElementType.PARAMETER, ElementType.METHOD }) | ||
| 11 | +@Retention(RetentionPolicy.RUNTIME) | ||
| 12 | +@Documented | ||
| 13 | +public @interface ProcessingTime { | ||
| 14 | + | ||
| 15 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.aspect; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.aspectj.lang.ProceedingJoinPoint; | ||
| 5 | +import org.aspectj.lang.Signature; | ||
| 6 | +import org.aspectj.lang.annotation.Around; | ||
| 7 | +import org.aspectj.lang.annotation.Aspect; | ||
| 8 | +import org.aspectj.lang.annotation.Pointcut; | ||
| 9 | +import org.aspectj.lang.reflect.MethodSignature; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +import java.lang.reflect.Method; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * @Author mt | ||
| 18 | + * @Description 当前记录各定时任务执行时间 | ||
| 19 | + * @Date 2024/5/23 | ||
| 20 | + */ | ||
| 21 | +@Aspect | ||
| 22 | +@Slf4j | ||
| 23 | +@Component | ||
| 24 | +public class ExecuteAspect { | ||
| 25 | + private Logger log = LoggerFactory.getLogger(ExecuteAspect.class); | ||
| 26 | + | ||
| 27 | + @Pointcut("@annotation(com.fedex.connect.task.annotation.ProcessingTime)") | ||
| 28 | + public void executePointCut() | ||
| 29 | + { | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * aop输出方法执行时间 | ||
| 34 | + * @param pjp | ||
| 35 | + * @return | ||
| 36 | + */ | ||
| 37 | + @Around(value = "executePointCut()") | ||
| 38 | + public Object executeAround(ProceedingJoinPoint pjp){ | ||
| 39 | + Object obj = null; | ||
| 40 | + try { | ||
| 41 | + Signature signature = pjp.getSignature(); | ||
| 42 | + MethodSignature methodSignature = (MethodSignature) signature; | ||
| 43 | + Method method = methodSignature.getMethod(); | ||
| 44 | + long begin = System.currentTimeMillis(); | ||
| 45 | + log.info("{} Job Task Start......", method.getName()); | ||
| 46 | + obj = pjp.proceed(); | ||
| 47 | + long end = System.currentTimeMillis(); | ||
| 48 | + log.info("{} Job Task end......execution time--{}ms", method.getName(),(end-begin)); | ||
| 49 | + }catch(Throwable throwable){ | ||
| 50 | + log.error("ExecuteAspect.executeAround error : " + throwable.getMessage() , throwable); | ||
| 51 | + } | ||
| 52 | + return obj; | ||
| 53 | + } | ||
| 54 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.config; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | +import org.springframework.beans.factory.annotation.Value; | ||
| 5 | +import org.springframework.context.annotation.Configuration; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description 类说明 所有properties | ||
| 10 | + * @Date 2024年4月18日20:59:34 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +@Configuration | ||
| 14 | +public class PropertiesConfig { | ||
| 15 | + @Value("${spring.profiles.env}") | ||
| 16 | + private String env; | ||
| 17 | + | ||
| 18 | + @Value("${rpc.url.rpcKafkaReceive1}") | ||
| 19 | + private String rpcKafkaReceive145; | ||
| 20 | + | ||
| 21 | + @Value("${rpc.url.rpcKafkaReceive2}") | ||
| 22 | + private String rpcKafkaReceive146; | ||
| 23 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/config/SchedulingConfigurerConfig.java
0 → 100644
| 1 | +package com.fedex.connect.task.config; | ||
| 2 | + | ||
| 3 | +import org.springframework.context.annotation.Configuration; | ||
| 4 | +import org.springframework.scheduling.annotation.SchedulingConfigurer; | ||
| 5 | +import org.springframework.scheduling.config.ScheduledTaskRegistrar; | ||
| 6 | + | ||
| 7 | +import java.util.concurrent.Executors; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 动态定时任务 | ||
| 11 | + * @author Administrator | ||
| 12 | + */ | ||
| 13 | +@Configuration | ||
| 14 | +public class SchedulingConfigurerConfig implements SchedulingConfigurer { | ||
| 15 | + | ||
| 16 | + @Override | ||
| 17 | + public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { | ||
| 18 | + //设定一个长度10的定时任务线程池 | ||
| 19 | + scheduledTaskRegistrar.setScheduler(Executors.newScheduledThreadPool(10)); | ||
| 20 | + } | ||
| 21 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 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; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.bi.DictionaryEntries; | ||
| 4 | +import com.fedex.connect.task.data.dto.imp001.Imp001RootJsonDto; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.util.Dictionary; | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Author mt | ||
| 12 | + * @Description 类说明 tw001生成bo | ||
| 13 | + * @Date 2024/5/24 | ||
| 14 | + */ | ||
| 15 | +@Data | ||
| 16 | +public class Imp001GenerateBo { | ||
| 17 | + //tw001报文对象 | ||
| 18 | + Imp001RootJsonDto imp001RootJsonDto; | ||
| 19 | + //tw001临时文件夹目录 | ||
| 20 | + String workFilePath; | ||
| 21 | + //需要打包压缩包文件信息名称 | ||
| 22 | + List<Imp001FileInfoBo> fileInfoList; | ||
| 23 | + //json Dir对象 | ||
| 24 | + DictionaryEntries jsonDictionary; | ||
| 25 | + //zip文件名称 | ||
| 26 | + String zipFileName; | ||
| 27 | + //zip推送目标目录 | ||
| 28 | + String zipFileTargetPath; | ||
| 29 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.data.bo; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description tw001推送bo | ||
| 10 | + * @Date 2024/5/30 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class Imp001PushBo { | ||
| 14 | + //压缩包中文件列表 | ||
| 15 | + List<String> filePaths; | ||
| 16 | + //zip文件完整名称 | ||
| 17 | + String zipFilePath; | ||
| 18 | +} |
server/task-schedule/src/main/java/com/fedex/connect/task/data/dto/imp001/Imp001Consignment.java
0 → 100644
| 1 | +package com.fedex.connect.task.data.dto.imp001; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.arithmetic.AESUtil; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.apache.commons.lang3.StringUtils; | ||
| 6 | + | ||
| 7 | +import java.io.Serializable; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author mt | ||
| 11 | + * @Description 申报信息 | ||
| 12 | + * @Date 2024/5/23 | ||
| 13 | + */ | ||
| 14 | +@Data | ||
| 15 | +public class Imp001Consignment implements Serializable { | ||
| 16 | + /** | ||
| 17 | + * @Author mt | ||
| 18 | + * @Description 提单号码 | ||
| 19 | + * 12位数字,提单号码,可以重复 | ||
| 20 | + * @Date 2024/5/23 | ||
| 21 | + */ | ||
| 22 | + private String deliveryNo; | ||
| 23 | + /** | ||
| 24 | + * @Author mt | ||
| 25 | + * @Description 联络人 | ||
| 26 | + * @Date 2024/5/23 | ||
| 27 | + */ | ||
| 28 | + private String liaisons; | ||
| 29 | + /** | ||
| 30 | + * @Author mt | ||
| 31 | + * @Description 货物输出统一编号 | ||
| 32 | + * 8-12位,数字加英文大写 | ||
| 33 | + * @Date 2024/5/23 | ||
| 34 | + */ | ||
| 35 | + private String consigneeNo; | ||
| 36 | + /** | ||
| 37 | + * @Author mt | ||
| 38 | + * @Description 联络人email | ||
| 39 | + * 标准邮件格式:xxx@xx.com | ||
| 40 | + * @Date 2024/5/23 | ||
| 41 | + */ | ||
| 42 | + private String email; | ||
| 43 | + /** | ||
| 44 | + * @Author mt | ||
| 45 | + * @Description 联络电话 | ||
| 46 | + * 包含:数字、空格-()()#::,,;;+. | ||
| 47 | + * @Date 2024/5/23 | ||
| 48 | + */ | ||
| 49 | + private String tel; | ||
| 50 | + /** | ||
| 51 | + * @Author mt | ||
| 52 | + * @Description 分机 | ||
| 53 | + * 包含:数字、空格-()()#::,,;;+. | ||
| 54 | + * @Date 2024/5/23 | ||
| 55 | + */ | ||
| 56 | + private String extensionTel; | ||
| 57 | + /** | ||
| 58 | + * @Author mt | ||
| 59 | + * @Description 行动电话 | ||
| 60 | + * 包含:数字、空格-()()#::,,;;+. | ||
| 61 | + * @Date 2024/5/23 | ||
| 62 | + */ | ||
| 63 | + private String phone; | ||
| 64 | + /** | ||
| 65 | + * @Author mt | ||
| 66 | + * @Description 特殊交代事项 | ||
| 67 | + * @Date 2024/5/23 | ||
| 68 | + */ | ||
| 69 | + private String customsClearanceInstruction; | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * @Author mt | ||
| 73 | + * @Description 对部分字段进行解密 | ||
| 74 | + * @Date 2024/6/13 | ||
| 75 | + * @param | ||
| 76 | + * @return void | ||
| 77 | + */ | ||
| 78 | + public void decode() { | ||
| 79 | + if (StringUtils.isNotBlank(this.getLiaisons())){ | ||
| 80 | + this.setLiaisons(AESUtil.decode_default(this.getLiaisons())); | ||
| 81 | + } | ||
| 82 | + if (StringUtils.isNotBlank(this.getTel())){ | ||
| 83 | + this.setTel(AESUtil.decode_default(this.getTel())); | ||
| 84 | + } | ||
| 85 | + if (StringUtils.isNotBlank(this.getPhone())){ | ||
| 86 | + this.setPhone(AESUtil.decode_default(this.getPhone())); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/data/dto/imp001/Imp001Consignments.java
0 → 100644
| 1 | +package com.fedex.connect.task.data.dto.imp001; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.io.Serializable; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description 申报信息集合 | ||
| 10 | + * @Date 2024/5/23 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class Imp001Consignments implements Serializable { | ||
| 14 | + /** | ||
| 15 | + * @Author mt | ||
| 16 | + * @Description 申报信息 | ||
| 17 | + * @Date 2024/5/23 | ||
| 18 | + */ | ||
| 19 | + private Imp001Consignment consignment; | ||
| 20 | + /** | ||
| 21 | + * @Author mt | ||
| 22 | + * @Description 文件列表信息 | ||
| 23 | + * @Date 2024/5/23 | ||
| 24 | + */ | ||
| 25 | + private Imp001Files[] files; | ||
| 26 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/data/dto/imp001/Imp001Data.java
0 → 100644
| 1 | +package com.fedex.connect.task.data.dto.imp001; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.io.Serializable; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description 数据 | ||
| 10 | + * @Date 2024/5/23 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class Imp001Data implements Serializable { | ||
| 14 | + /** | ||
| 15 | + * @Author mt | ||
| 16 | + * @Description 运单集合 | ||
| 17 | + * @Date 2024/5/23 | ||
| 18 | + */ | ||
| 19 | + private Imp001Consignments[] consignments; | ||
| 20 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/data/dto/imp001/Imp001Files.java
0 → 100644
| 1 | +package com.fedex.connect.task.data.dto.imp001; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.io.Serializable; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description 文件列表信息 | ||
| 10 | + * @Date 2024/5/23 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class Imp001Files implements Serializable { | ||
| 14 | + /** | ||
| 15 | + * @Author mt | ||
| 16 | + * @Description 文件名称 | ||
| 17 | + * 使用iclearConnect中存储的文件名称,文件名没有固定格式(因为客户上传的文件名是不固定的) | ||
| 18 | + * @Date 2024/5/23 | ||
| 19 | + */ | ||
| 20 | + private String name; | ||
| 21 | + /** | ||
| 22 | + * @Author mt | ||
| 23 | + * @Description 文件来源 | ||
| 24 | + * "文件类型 | ||
| 25 | + * (1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件)" | ||
| 26 | + * @Date 2024/5/23 | ||
| 27 | + */ | ||
| 28 | + private Integer source; | ||
| 29 | + /** | ||
| 30 | + * @Author mt | ||
| 31 | + * @Description 文件名后缀 | ||
| 32 | + * 小写 | ||
| 33 | + * @Date 2024/5/23 | ||
| 34 | + */ | ||
| 35 | + private String suffix; | ||
| 36 | + /** | ||
| 37 | + * @Author mt | ||
| 38 | + * @Description 文件大小 | ||
| 39 | + * 字节数 | ||
| 40 | + * @Date 2024/5/23 | ||
| 41 | + */ | ||
| 42 | + private Integer fileSizeByte; | ||
| 43 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/data/dto/imp001/Imp001RootJsonDto.java
0 → 100644
| 1 | +package com.fedex.connect.task.data.dto.imp001; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.annotation.JSONField; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.io.Serializable; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author mt | ||
| 10 | + * @Description tw001消息主体 | ||
| 11 | + * @Date 2024/5/23 | ||
| 12 | + */ | ||
| 13 | +@Data | ||
| 14 | +public class Imp001RootJsonDto implements Serializable { | ||
| 15 | + //由发送方定义的序列号,唯一 UUID JSON自动生成 | ||
| 16 | + @JSONField(name="messageId",ordinal = 1) | ||
| 17 | + private String messageId; | ||
| 18 | + | ||
| 19 | + //消息代码/类型 | ||
| 20 | + @JSONField(name="messageCode",ordinal = 2) | ||
| 21 | + private String messageCode; | ||
| 22 | + | ||
| 23 | + //发送程序ID | ||
| 24 | + @JSONField(name="senderId",ordinal = 3) | ||
| 25 | + private String senderId; | ||
| 26 | + | ||
| 27 | + //接受程序ID | ||
| 28 | + @JSONField(name="receiverId",ordinal = 4) | ||
| 29 | + private String receiverId; | ||
| 30 | + | ||
| 31 | + //发送时间,时间戳 | ||
| 32 | + @JSONField(name="sendTime",ordinal = 5) | ||
| 33 | + private String sendTime; | ||
| 34 | + | ||
| 35 | + @JSONField(name="data",ordinal = 6) | ||
| 36 | + private Imp001Data data; | ||
| 37 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.job; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.task.annotation.ProcessingTime; | ||
| 4 | +import com.fedex.connect.task.service.biz.IPushObService; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author mt | ||
| 11 | + * @Description IMP001申报数据推送任务 | ||
| 12 | + * @Date 2024/11/5 | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +public class Imp001Job { | ||
| 16 | + | ||
| 17 | + @Autowired | ||
| 18 | + protected IPushObService sendObService; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 推送Imp001数据给到进口组 | ||
| 22 | + */ | ||
| 23 | + @ProcessingTime | ||
| 24 | + @Scheduled(cron = "${export.task.allocation.sendOb}") | ||
| 25 | + public void sendObTask() { | ||
| 26 | + sendObService.sendOb(); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 推送OB数据错误重试 | ||
| 31 | + */ | ||
| 32 | + @ProcessingTime | ||
| 33 | + @Scheduled(cron = "${export.task.allocation.sendObRetry}") | ||
| 34 | + public void sendObRetryTask() { | ||
| 35 | + sendObService.sendObRetry(); | ||
| 36 | + } | ||
| 37 | +} |
| 1 | +package com.fedex.connect.task.job; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.task.annotation.ProcessingTime; | ||
| 4 | +import com.fedex.connect.task.service.sys.IKafkaDmService; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author mt | ||
| 11 | + * @Description kafka定时任务,处理kafka相关数据 | ||
| 12 | + * @Date 2024/6/17 | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +public class KafkaJob { | ||
| 16 | + | ||
| 17 | + @Autowired | ||
| 18 | + private IKafkaDmService kafkaDmService; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * kafka补偿定时任务 | ||
| 22 | + */ | ||
| 23 | + @ProcessingTime | ||
| 24 | + @Scheduled(cron = "${export.task.allocation.kafkaRetry}") | ||
| 25 | + public void kafkaRetryTask() { | ||
| 26 | + kafkaDmService.scanKafkaTemporaryStorage(); | ||
| 27 | + } | ||
| 28 | +} |
server/task-schedule/src/main/java/com/fedex/connect/task/repository/base/AbstractDaoRepository.java
0 → 100644
| 1 | +package com.fedex.connect.task.repository.base; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dao.sys.KafkaStorageHistoryMapper; | ||
| 4 | +import com.fedex.connect.common.dao.sys.KafkaTemporaryStorageMapper; | ||
| 5 | +import com.fedex.connect.task.repository.dao.KafkaTemporaryStorageMapperExt; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | + | ||
| 10 | +public class AbstractDaoRepository { | ||
| 11 | + protected Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 12 | + @Autowired | ||
| 13 | + protected KafkaTemporaryStorageMapperExt kafkaTemporaryStorageMapperExt; | ||
| 14 | + @Autowired | ||
| 15 | + protected KafkaTemporaryStorageMapper kafkaTemporaryStorageMapper; | ||
| 16 | + @Autowired | ||
| 17 | + protected KafkaStorageHistoryMapper kafkaStorageHistoryMapper; | ||
| 18 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.repository.dao; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | +import org.apache.ibatis.annotations.Mapper; | ||
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | + | ||
| 7 | +import java.util.Date; | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * kafka临时表dao | ||
| 12 | + * mt | ||
| 13 | + * 2022年11月3日15:30:53 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface KafkaTemporaryStorageMapperExt { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 查找临时表中大于一个小时待处理以及处理失败,并且处理次数小于3次 | ||
| 20 | + * @return | ||
| 21 | + */ | ||
| 22 | + List<KafkaTemporaryStorage> findKafkaTemporaryStoragePending(@Param("curDate") Date curDate); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 根据集合批量删除kafka临时表 | ||
| 26 | + * @param list | ||
| 27 | + * @return | ||
| 28 | + */ | ||
| 29 | + int deleteInBatch(@Param("list") List<KafkaTemporaryStorage> list); | ||
| 30 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
| 3 | + <!-- | ||
| 4 | + mapper为映射的根节点,用来管理DAO接口 | ||
| 5 | + namespace指定DAO接口的完整类名,表示mapper配置文件管理哪个DAO接口(包.接口名) | ||
| 6 | + mybatis会依据这个接口动态创建一个实现类去实现这个接口,而这个实现类是一个Mapper对象 | ||
| 7 | + --> | ||
| 8 | +<mapper namespace="com.fedex.connect.task.repository.dao.KafkaTemporaryStorageMapperExt"> | ||
| 9 | + <resultMap id="BaseResultMap" type="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> | ||
| 10 | + <id column="ID" jdbcType="NUMERIC" property="id" /> | ||
| 11 | + <result column="MESSAGE_ID" jdbcType="VARCHAR" property="messageId" /> | ||
| 12 | + <result column="MESSAGE_CODE" jdbcType="VARCHAR" property="messageCode" /> | ||
| 13 | + <result column="SENDER_ID" jdbcType="VARCHAR" property="senderId" /> | ||
| 14 | + <result column="RECEIVER_ID" jdbcType="VARCHAR" property="receiverId" /> | ||
| 15 | + <result column="SEND_TIME" jdbcType="TIMESTAMP" property="sendTime" /> | ||
| 16 | + <result column="CONSIGNMENT_CODE" jdbcType="VARCHAR" property="consignmentCode" /> | ||
| 17 | + <result column="FREQUENCY" jdbcType="NUMERIC" property="frequency" /> | ||
| 18 | + <result column="STATUS" jdbcType="NUMERIC" property="status" /> | ||
| 19 | + <result column="REMARK" jdbcType="VARCHAR" property="remark" /> | ||
| 20 | + <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> | ||
| 21 | + </resultMap> | ||
| 22 | + | ||
| 23 | + <sql id="Base_Column_List"> | ||
| 24 | + ID, MESSAGE_ID, MESSAGE_CODE, SENDER_ID, RECEIVER_ID, SEND_TIME, CONSIGNMENT_CODE, | ||
| 25 | + FREQUENCY, STATUS, REMARK, CREATE_TIME | ||
| 26 | + </sql> | ||
| 27 | + | ||
| 28 | + <select id="findKafkaTemporaryStoragePending" resultMap="BaseResultMap"> | ||
| 29 | + SELECT * FROM T_SYS_KAFKA_TEMPORARY_STORAGE | ||
| 30 | + WHERE (cast(#{curDate,jdbcType=TIMESTAMP} as date) - CREATE_TIME) * 24 * 60 >= 10 | ||
| 31 | + AND (STATUS = 0 OR STATUS = 2) AND ROWNUM <= 1000 | ||
| 32 | + </select> | ||
| 33 | + | ||
| 34 | + <delete id="deleteInBatch"> | ||
| 35 | + DELETE T_SYS_KAFKA_TEMPORARY_STORAGE WHERE ID IN | ||
| 36 | + <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> | ||
| 37 | + #{item.id} | ||
| 38 | + </foreach> | ||
| 39 | + </delete> | ||
| 40 | +</mapper> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.repository.repo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * kafka历史表dao | ||
| 9 | + * mt | ||
| 10 | + * 2022年11月3日15:30:53 | ||
| 11 | + */ | ||
| 12 | +public interface IKafkaStorageHistoryRepository { | ||
| 13 | + KafkaStorageHistory save(KafkaStorageHistory entity); | ||
| 14 | + void saveAll(List<KafkaStorageHistory> list); | ||
| 15 | +} |
| 1 | +package com.fedex.connect.task.repository.repo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * kafka临时表dao | ||
| 9 | + * mt | ||
| 10 | + * 2022年11月3日15:30:53 | ||
| 11 | + */ | ||
| 12 | +public interface IKafkaTemporaryStorageRepository { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 查找临时表中大于一个小时待处理以及处理失败,并且处理次数小于3次 | ||
| 16 | + * @return | ||
| 17 | + */ | ||
| 18 | + List<KafkaTemporaryStorage> findKafkaTemporaryStoragePending(); | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 批量删除kafka临时表 | ||
| 22 | + * @param list | ||
| 23 | + * @return | ||
| 24 | + */ | ||
| 25 | + int deleteInBatch(List<KafkaTemporaryStorage> list); | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 批量保存 | ||
| 29 | + * @param list | ||
| 30 | + * @return | ||
| 31 | + */ | ||
| 32 | + List<KafkaTemporaryStorage> saveAll(List<KafkaTemporaryStorage> list); | ||
| 33 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 4 | +import com.fedex.connect.task.repository.base.AbstractDaoRepository; | ||
| 5 | +import com.fedex.connect.task.repository.repo.IKafkaStorageHistoryRepository; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * kafka历史表dao | ||
| 12 | + * mt | ||
| 13 | + * 2022年11月3日15:30:53 | ||
| 14 | + */ | ||
| 15 | +@Repository | ||
| 16 | +public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository implements IKafkaStorageHistoryRepository { | ||
| 17 | + @Override | ||
| 18 | + public KafkaStorageHistory save(KafkaStorageHistory entity){ | ||
| 19 | + if(entity != null) { | ||
| 20 | + if (entity.getId() == null || entity.getId().longValue() <= 0) { | ||
| 21 | + kafkaStorageHistoryMapper.insertSelective(entity); | ||
| 22 | + } else if (entity.getId() != null && entity.getId().longValue() > 0){ | ||
| 23 | + kafkaStorageHistoryMapper.updateByPrimaryKeySelective(entity); | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + return entity; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public void saveAll(List<KafkaStorageHistory> list){ | ||
| 31 | + list.stream().forEach(p->{ | ||
| 32 | + if(p.getId() == null || p.getId().longValue() <=0){ | ||
| 33 | + kafkaStorageHistoryMapper.insertSelective(p); | ||
| 34 | + }else if(p.getId() != null && p.getId().longValue() >0){ | ||
| 35 | + kafkaStorageHistoryMapper.updateByPrimaryKeySelective(p); | ||
| 36 | + } | ||
| 37 | + }); | ||
| 38 | + } | ||
| 39 | +} |
| 1 | +package com.fedex.connect.task.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | +import com.fedex.connect.task.repository.base.AbstractDaoRepository; | ||
| 5 | +import com.fedex.connect.task.repository.repo.IKafkaTemporaryStorageRepository; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | + | ||
| 8 | +import java.util.Date; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * kafka临时表dao | ||
| 13 | + * mt | ||
| 14 | + * 2022年11月3日15:30:53 | ||
| 15 | + */ | ||
| 16 | +@Repository | ||
| 17 | +public class KafkaTemporaryStorageRepositoryImpl extends AbstractDaoRepository implements IKafkaTemporaryStorageRepository { | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + public List<KafkaTemporaryStorage> findKafkaTemporaryStoragePending() { | ||
| 21 | + Date curDate = new Date(); | ||
| 22 | + return kafkaTemporaryStorageMapperExt.findKafkaTemporaryStoragePending(curDate); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public int deleteInBatch(List<KafkaTemporaryStorage> list) { | ||
| 27 | + return kafkaTemporaryStorageMapperExt.deleteInBatch(list); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public List<KafkaTemporaryStorage> saveAll(List<KafkaTemporaryStorage> list) { | ||
| 32 | + list.stream().forEach(p->{ | ||
| 33 | + if(p.getId() == null || p.getId().longValue() <=0){ | ||
| 34 | + kafkaTemporaryStorageMapper.insertSelective(p); | ||
| 35 | + }else if(p.getId() != null && p.getId().longValue() >0){ | ||
| 36 | + kafkaTemporaryStorageMapper.updateByPrimaryKeySelective(p); | ||
| 37 | + } | ||
| 38 | + }); | ||
| 39 | + return list; | ||
| 40 | + } | ||
| 41 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.service.base; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.task.repository.repo.IKafkaStorageHistoryRepository; | ||
| 4 | +import com.fedex.connect.task.repository.repo.IKafkaTemporaryStorageRepository; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description 用于管理公共Service | ||
| 10 | + * @Date 2024/4/18 | ||
| 11 | + */ | ||
| 12 | +public class BaseService { | ||
| 13 | + @Autowired | ||
| 14 | + protected IKafkaTemporaryStorageRepository kafKaTemporaryStorageRepository; | ||
| 15 | + @Autowired | ||
| 16 | + protected IKafkaStorageHistoryRepository kafkaStorageHistoryRepository; | ||
| 17 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/service/biz/IPushObService.java
0 → 100644
| 1 | +package com.fedex.connect.task.service.biz; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.biz.Consignment; | ||
| 4 | + | ||
| 5 | +public interface IPushObService { | ||
| 6 | + /** | ||
| 7 | + * @Author mt | ||
| 8 | + * @Description 保存pushLog表记录 | ||
| 9 | + * @Date 2024/8/2 | ||
| 10 | + * @param consignment | ||
| 11 | + * @return void | ||
| 12 | + */ | ||
| 13 | + void savePushLog(Consignment consignment); | ||
| 14 | + /** | ||
| 15 | + * @Author mt | ||
| 16 | + * @Description 推送Imp001报文数据zip包文件 | ||
| 17 | + * @Date 2024/8/2 | ||
| 18 | + * @param | ||
| 19 | + * @return void | ||
| 20 | + */ | ||
| 21 | + void sendOb(); | ||
| 22 | + /** | ||
| 23 | + * @Author mt | ||
| 24 | + * @Description 推送Imp001文件错误重试 | ||
| 25 | + * @Date 2024/8/2 | ||
| 26 | + * @param | ||
| 27 | + * @return void | ||
| 28 | + */ | ||
| 29 | + void sendObRetry(); | ||
| 30 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/service/biz/impl/PushObServiceImpl.java
0 → 100644
| 1 | +package com.fedex.connect.task.service.biz.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.biz.Consignment; | ||
| 4 | +import com.fedex.connect.common.model.biz.PushOb; | ||
| 5 | +import com.fedex.connect.task.service.base.BaseService; | ||
| 6 | +import com.fedex.connect.task.service.biz.IPushObService; | ||
| 7 | +import lombok.extern.slf4j.Slf4j; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @Author mt | ||
| 14 | + * @Description 发送Imp001到进口组 | ||
| 15 | + * @Date 2024/5/24 | ||
| 16 | + */ | ||
| 17 | +@Slf4j | ||
| 18 | +@Service | ||
| 19 | +public class PushObServiceImpl extends BaseService implements IPushObService { | ||
| 20 | + | ||
| 21 | + public void savePushLog(Consignment consignment){ | ||
| 22 | + | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 推送OB报文数据zip包文件 | ||
| 27 | + */ | ||
| 28 | + @Override | ||
| 29 | + public void sendOb() { | ||
| 30 | + | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 推送OB文件错误重试 | ||
| 35 | + */ | ||
| 36 | + @Override | ||
| 37 | + public void sendObRetry() { | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * @Author mt | ||
| 43 | + * @Description 推送tw001数据 | ||
| 44 | + * @Date 2024/5/29 | ||
| 45 | + * @param pushObList | ||
| 46 | + * @return void | ||
| 47 | + */ | ||
| 48 | + private void pushOb(List<PushOb> pushObList){ | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/service/sys/impl/KafkaDmServiceImpl.java
0 → 100644
| 1 | +package com.fedex.connect.task.service.sys.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | +import com.fedex.connect.task.service.base.BaseService; | ||
| 5 | +import com.fedex.connect.task.service.sys.IKafkaDmService; | ||
| 6 | +import com.fedex.connect.task.utils.sys.KafkaDmUtil; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @Author mt | ||
| 14 | + * @Description kafka操作service | ||
| 15 | + * @Date 2024/4/18 | ||
| 16 | + */ | ||
| 17 | +@Service | ||
| 18 | +public class KafkaDmServiceImpl extends BaseService implements IKafkaDmService { | ||
| 19 | + | ||
| 20 | + @Autowired | ||
| 21 | + KafkaDmUtil kafkaDmUtil; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * @Author mt | ||
| 25 | + * @Description 查询临时表中创建时间为一小时之前,处理次数小于3次数据 | ||
| 26 | + * @Date 2024/5/14 | ||
| 27 | + * @param | ||
| 28 | + * @return void | ||
| 29 | + */ | ||
| 30 | + public void scanKafkaTemporaryStorage(){ | ||
| 31 | + List<KafkaTemporaryStorage> kafKaTemporaryStorageList = kafKaTemporaryStorageRepository.findKafkaTemporaryStoragePending(); | ||
| 32 | + //kafka数据下发至kafka模块 | ||
| 33 | + kafkaDmUtil.kafKaTemporaryStorageRetry(kafKaTemporaryStorageList); | ||
| 34 | + } | ||
| 35 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/utils/biz/imp001/Imp001GenerateUtil.java
0 → 100644
| 1 | +//package com.fedex.connect.task.utils.biz.imp001; | ||
| 2 | +// | ||
| 3 | +//import com.fedex.export.common.util.DateUtil; | ||
| 4 | +//import com.fedex.export.common.util.NioFileUtils; | ||
| 5 | +//import com.fedex.export.common.util.StringExtUtil; | ||
| 6 | +//import com.fedex.export.common.util.Utils; | ||
| 7 | +//import com.fedex.export.config.PropertiesConfig; | ||
| 8 | +//import com.fedex.export.constants.Constant; | ||
| 9 | +//import com.fedex.export.data.bo.Imp001FileInfoBo; | ||
| 10 | +//import com.fedex.export.data.bo.Imp001GenerateBo; | ||
| 11 | +//import com.fedex.export.data.dto.tw001.*; | ||
| 12 | +//import com.fedex.export.repository.entity.*; | ||
| 13 | +//import com.fedex.export.repository.entity.log.PushObLog; | ||
| 14 | +//import com.fedex.export.service.business.IDeclareCheckInfoService; | ||
| 15 | +//import com.fedex.export.service.business.IDeclareCustomsFileService; | ||
| 16 | +//import com.fedex.export.service.business.IDeclareInfoService; | ||
| 17 | +//import com.fedex.export.service.business.IUploadFileService; | ||
| 18 | +//import com.fedex.export.service.system.ISysDictionaryService; | ||
| 19 | +//import lombok.extern.slf4j.Slf4j; | ||
| 20 | +//import org.apache.commons.lang3.StringUtils; | ||
| 21 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
| 22 | +//import org.springframework.stereotype.Component; | ||
| 23 | +// | ||
| 24 | +//import java.io.IOException; | ||
| 25 | +//import java.util.*; | ||
| 26 | +// | ||
| 27 | +///** | ||
| 28 | +// * @Author mt | ||
| 29 | +// * @Description tw001报文生成json,util | ||
| 30 | +// * @Date 2024/5/24 | ||
| 31 | +// */ | ||
| 32 | +//@Slf4j | ||
| 33 | +//@Component | ||
| 34 | +//public class Tw001GenerateUtil { | ||
| 35 | +// @Autowired | ||
| 36 | +// private ISysDictionaryService sysDictionaryService; | ||
| 37 | +// @Autowired | ||
| 38 | +// private IDeclareInfoService declareInfoService; | ||
| 39 | +// @Autowired | ||
| 40 | +// private IDeclareCheckInfoService declareCheckInfoService; | ||
| 41 | +// @Autowired | ||
| 42 | +// private IDeclareCustomsFileService declareCustomsFileService; | ||
| 43 | +// @Autowired | ||
| 44 | +// private IUploadFileService uploadFileService; | ||
| 45 | +// @Autowired | ||
| 46 | +// private NioFileUtils nioFileUtils; | ||
| 47 | +// @Autowired | ||
| 48 | +// private PropertiesConfig propertiesConfig; | ||
| 49 | +// | ||
| 50 | +// /** | ||
| 51 | +// * @Author mt | ||
| 52 | +// * @Description 生成tw001报文json对象 | ||
| 53 | +// * @Date 2024/5/27 | ||
| 54 | +// * @param pushObLog | ||
| 55 | +// * @return com.fedex.export.data.dto.tw001.Imp001RootJsonDto | ||
| 56 | +// */ | ||
| 57 | +// public Imp001GenerateBo generateTw001Json(PushObLog pushObLog) throws IOException{ | ||
| 58 | +// Imp001RootJsonDto tw001RootJsonDto = new Imp001RootJsonDto(); | ||
| 59 | +// //根据运单id | ||
| 60 | +// DeclareInfo declareInfo = declareInfoService.findByDeclareId(pushObLog.getDeclareId()); | ||
| 61 | +// DeclareCheckInfo declareCheckInfo = declareCheckInfoService.findByDeclareId(pushObLog.getDeclareId()); | ||
| 62 | +// DeclareCustomsFile declareCustomsFile = declareCustomsFileService.findByDeclareId(pushObLog.getDeclareId()); | ||
| 63 | +// List<UploadFile> uploadFiles = uploadFileService.findFilesByCusFileId(declareCustomsFile); | ||
| 64 | +// //获取文件类型字典集合 | ||
| 65 | +// Map<String,SysDictionary> pushFileTypeMap = sysDictionaryService.findDicByCodeGroup(Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.CODE_GROUP); | ||
| 66 | +// //生成TW001报文数据 | ||
| 67 | +// Imp001Data tw001Data = new Imp001Data(); | ||
| 68 | +// Imp001Consignments[] consignments = new Imp001Consignments[1]; | ||
| 69 | +// Imp001Consignments tw001Consignments = new Imp001Consignments(); | ||
| 70 | +// //生成运单数据 | ||
| 71 | +// Imp001Consignment consignment = this.generateConsignment(declareInfo); | ||
| 72 | +// //生成检核表数据 | ||
| 73 | +// Tw001CheckInfo checkInfo = this.generateCheckInfo(declareCheckInfo,declareInfo.getDeliveryNo()); | ||
| 74 | +// //生成文件列表数据 | ||
| 75 | +// Imp001Files[] files = this.generateFiles(uploadFiles,declareInfo.getDeliveryNo(),declareInfo.getDeclareId()); | ||
| 76 | +// /***************设置对象赋值***************/ | ||
| 77 | +// tw001Consignments.setConsignment(consignment); | ||
| 78 | +// tw001Consignments.setCheckInfo(checkInfo); | ||
| 79 | +// tw001Consignments.setFiles(files); | ||
| 80 | +// consignments[0] = tw001Consignments; | ||
| 81 | +// tw001Data.setConsignments(consignments); | ||
| 82 | +// //初始化TW001表头信息 | ||
| 83 | +// this.initTw001Head(tw001RootJsonDto); | ||
| 84 | +// tw001RootJsonDto.setData(tw001Data); | ||
| 85 | +// //返回对象 | ||
| 86 | +// Imp001GenerateBo tw001GenerateBo = new Imp001GenerateBo(); | ||
| 87 | +// tw001GenerateBo.setDeclareInfo(declareInfo); | ||
| 88 | +// tw001GenerateBo.setTw001RootJsonDto(tw001RootJsonDto); | ||
| 89 | +// //获取生成tw001临时文件夹目录 | ||
| 90 | +// String workFilePath = this.generateWorkPath(declareInfo.getDeliveryNo(),declareInfo.getDeclareId()); | ||
| 91 | +// tw001GenerateBo.setWorkFilePath(workFilePath); | ||
| 92 | +// List<Imp001FileInfoBo> fileInfoLists = new ArrayList<Imp001FileInfoBo>(); | ||
| 93 | +// //存在图案商标则添加 | ||
| 94 | +// if(checkInfo != null && checkInfo.getBrandImage() != null){ | ||
| 95 | +// //初始化图案商标文件对象 | ||
| 96 | +// Imp001FileInfoBo fileInfoBo = this.initFileInfo(pushFileTypeMap,Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_5,checkInfo.getBrandImage()); | ||
| 97 | +// fileInfoLists.add(fileInfoBo); | ||
| 98 | +// } | ||
| 99 | +// if(files != null){ | ||
| 100 | +// for (Imp001Files file : files) { | ||
| 101 | +// //获取文件类型 1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件 | ||
| 102 | +// String fileTypeCode = this.getfileType(file.getSource()); | ||
| 103 | +// //初始化文件对象:1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件 | ||
| 104 | +// Imp001FileInfoBo fileInfoBo = this.initFileInfo(pushFileTypeMap,fileTypeCode,file.getName()); | ||
| 105 | +// fileInfoLists.add(fileInfoBo); | ||
| 106 | +// } | ||
| 107 | +// } | ||
| 108 | +// //设置文件信息 | ||
| 109 | +// tw001GenerateBo.setFileInfoList(fileInfoLists); | ||
| 110 | +// //设置jsonDic | ||
| 111 | +// tw001GenerateBo.setJsonDictionary(pushFileTypeMap.get(Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_4)); | ||
| 112 | +// return tw001GenerateBo; | ||
| 113 | +// } | ||
| 114 | +// | ||
| 115 | +// /** | ||
| 116 | +// * @Author mt | ||
| 117 | +// * @Description 初始化TW001表头信息 | ||
| 118 | +// * @Date 2024/5/31 | ||
| 119 | +// * @param tw001RootJsonDto | ||
| 120 | +// * @return void | ||
| 121 | +// */ | ||
| 122 | +// private void initTw001Head(Imp001RootJsonDto tw001RootJsonDto){ | ||
| 123 | +// String UUIDStr=String.valueOf(UUID.randomUUID()); | ||
| 124 | +// //消息代码/类型 | ||
| 125 | +// tw001RootJsonDto.setMessageId(UUIDStr); | ||
| 126 | +// //消息代码/类型 | ||
| 127 | +// tw001RootJsonDto.setMessageCode(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.MESSAGE_CODE); | ||
| 128 | +// //发送程序ID | ||
| 129 | +// tw001RootJsonDto.setSenderId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.SENDER_ID); | ||
| 130 | +// //接受程序ID | ||
| 131 | +// tw001RootJsonDto.setReceiverId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.RECEIVER_ID); | ||
| 132 | +// String sendTime = String.valueOf(System.currentTimeMillis()); | ||
| 133 | +// //发送时间,时间戳 | ||
| 134 | +// tw001RootJsonDto.setSendTime(sendTime); | ||
| 135 | +// } | ||
| 136 | +// | ||
| 137 | +// /** | ||
| 138 | +// * @Author mt | ||
| 139 | +// * @Description 功能说明 | ||
| 140 | +// * @Date 2024/5/30 | ||
| 141 | +// * @param source 1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件 | ||
| 142 | +// * @return java.lang.String | ||
| 143 | +// */ | ||
| 144 | +// private String getfileType(Integer source){ | ||
| 145 | +// if(source.equals(Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_1)){ | ||
| 146 | +// return Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_1; | ||
| 147 | +// }else if(source.equals(Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_2)){ | ||
| 148 | +// return Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_2; | ||
| 149 | +// }else if(source.equals(Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_3)){ | ||
| 150 | +// return Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.PUSH_STATUS_OB_3; | ||
| 151 | +// } | ||
| 152 | +// return null; | ||
| 153 | +// } | ||
| 154 | +// | ||
| 155 | +// /** | ||
| 156 | +// * @Author mt | ||
| 157 | +// * @Description 功能说明 初始化fileInfo | ||
| 158 | +// * @Date 2024/5/30 | ||
| 159 | +// * @param pushFileTypeMap | ||
| 160 | +// * @param fileTypeCode | ||
| 161 | +// * @param fileName | ||
| 162 | +// * @return com.fedex.export.data.bo.Imp001FileInfoBo | ||
| 163 | +// */ | ||
| 164 | +// private Imp001FileInfoBo initFileInfo(Map<String,SysDictionary> pushFileTypeMap,String fileTypeCode,String fileName){ | ||
| 165 | +// Imp001FileInfoBo fileInfoBo = new Imp001FileInfoBo(); | ||
| 166 | +// //类型编码不为空则初始化文件id,文件类型 | ||
| 167 | +// if(StringUtils.isNotEmpty(fileTypeCode)) { | ||
| 168 | +// SysDictionary fileTypeDic = pushFileTypeMap.get(fileTypeCode); | ||
| 169 | +// if (fileTypeDic != null) { | ||
| 170 | +// fileInfoBo.setFileTypeId(fileTypeDic.getId()); | ||
| 171 | +// fileInfoBo.setFileTypeName(fileTypeDic.getChineseName()); | ||
| 172 | +// } | ||
| 173 | +// } | ||
| 174 | +// fileInfoBo.setPushTime(new Date()); | ||
| 175 | +// fileInfoBo.setFileName(fileName); | ||
| 176 | +// return fileInfoBo; | ||
| 177 | +// } | ||
| 178 | +// | ||
| 179 | +// /** | ||
| 180 | +// * @Author mt | ||
| 181 | +// * @Description 生成运单对象vo | ||
| 182 | +// * @Date 2024/5/27 | ||
| 183 | +// * @param declareInfo | ||
| 184 | +// * @return com.fedex.export.data.dto.tw001.Imp001Consignment | ||
| 185 | +// */ | ||
| 186 | +// private Imp001Consignment generateConsignment(DeclareInfo declareInfo){ | ||
| 187 | +// if(declareInfo == null){ | ||
| 188 | +// return null; | ||
| 189 | +// } | ||
| 190 | +// Imp001Consignment tw001Consignment = new Imp001Consignment(); | ||
| 191 | +// //提单号码 | ||
| 192 | +// tw001Consignment.setDeliveryNo(declareInfo.getDeliveryNo()); | ||
| 193 | +// //联络人 | ||
| 194 | +// tw001Consignment.setLiaisons(declareInfo.getLiaisons()); | ||
| 195 | +// //货物输出统一编号 | ||
| 196 | +// tw001Consignment.setConsigneeNo(declareInfo.getConsigneeNo()); | ||
| 197 | +// //联络人email | ||
| 198 | +// tw001Consignment.setEmail(declareInfo.getEmail()); | ||
| 199 | +// //联络电话 | ||
| 200 | +// tw001Consignment.setTel(declareInfo.getTel()); | ||
| 201 | +// //分机号 | ||
| 202 | +// tw001Consignment.setExtensionTel(declareInfo.getExtensionTel()); | ||
| 203 | +// //行动电话 | ||
| 204 | +// tw001Consignment.setPhone(declareInfo.getPhone()); | ||
| 205 | +// //特殊交代事项 | ||
| 206 | +// tw001Consignment.setCustomsClearanceInstruction(declareInfo.getCustomsClearanceInstruction()); | ||
| 207 | +// //对字段进行解密 | ||
| 208 | +// tw001Consignment.decode(); | ||
| 209 | +// return tw001Consignment; | ||
| 210 | +// } | ||
| 211 | +// | ||
| 212 | +// /** | ||
| 213 | +// * @Author mt | ||
| 214 | +// * @Description 生成检核表对象vo | ||
| 215 | +// * @Date 2024/5/27 | ||
| 216 | +// * @param declareCheckInfo | ||
| 217 | +// * @param deliveryNo | ||
| 218 | +// * @return com.fedex.export.data.dto.tw001.Tw001CheckInfo | ||
| 219 | +// */ | ||
| 220 | +// private Tw001CheckInfo generateCheckInfo(DeclareCheckInfo declareCheckInfo,String deliveryNo) throws IOException{ | ||
| 221 | +// if(declareCheckInfo == null){ | ||
| 222 | +// return null; | ||
| 223 | +// } | ||
| 224 | +// Tw001CheckInfo tw001CheckInfo = new Tw001CheckInfo(); | ||
| 225 | +// //报单类别(数据字典的KEY值,多个KEY分号拼接) | ||
| 226 | +// tw001CheckInfo.setCustomsDeclarationType(declareCheckInfo.getCustomsDeclarationType()); | ||
| 227 | +// //是否为电子冲退税报单 | ||
| 228 | +// tw001CheckInfo.setTaxRefundFormFlag(declareCheckInfo.getTaxRefundFormFlag() == null ? null : declareCheckInfo.getTaxRefundFormFlag().intValue()); | ||
| 229 | +// //监管编号-5个字元,包含中文英文大写 | ||
| 230 | +// tw001CheckInfo.setSupervisoryNo(declareCheckInfo.getSupervisoryNo()); | ||
| 231 | +// //原进口报单号码 | ||
| 232 | +// tw001CheckInfo.setOriginalImportEntryNo(declareCheckInfo.getOriginalImportEntryNo()); | ||
| 233 | +// //用料清表文号 | ||
| 234 | +// tw001CheckInfo.setListOfMaterialsNo(declareCheckInfo.getListOfMaterialsNo()); | ||
| 235 | +// //出口统计方式(数据字典KEY值,多个KEY分号拼接) | ||
| 236 | +// tw001CheckInfo.setExportStatisticsMethod(declareCheckInfo.getExportStatisticsMethod()); | ||
| 237 | +// //出口统计方式其他附加信息 | ||
| 238 | +// tw001CheckInfo.setMethodAdditional(declareCheckInfo.getMethodAdditional()); | ||
| 239 | +// //指定报关日 | ||
| 240 | +// tw001CheckInfo.setDayOfEntry(declareCheckInfo.getDayOfEntry()); | ||
| 241 | +// //中文品名 | ||
| 242 | +// tw001CheckInfo.setChineseName(declareCheckInfo.getChineseName()); | ||
| 243 | +// //税则 | ||
| 244 | +// tw001CheckInfo.setTaxRules(declareCheckInfo.getTaxRules()); | ||
| 245 | +// //报关金额 | ||
| 246 | +// tw001CheckInfo.setCustomsDeclarationAmount(declareCheckInfo.getCustomsDeclarationAmount()); | ||
| 247 | +// //报关金额币别 | ||
| 248 | +// tw001CheckInfo.setCurrencyCd(declareCheckInfo.getCurrencyCd()); | ||
| 249 | +// //是否有商标 | ||
| 250 | +// tw001CheckInfo.setBrandFlag(declareCheckInfo.getBrandFlag() == null ? null : declareCheckInfo.getBrandFlag().intValue()); | ||
| 251 | +// //文字商标 | ||
| 252 | +// tw001CheckInfo.setBrandTxt(declareCheckInfo.getBrandTxt()); | ||
| 253 | +// //图案商标名称 | ||
| 254 | +// String brandImage = this.brandImage(declareCheckInfo,deliveryNo); | ||
| 255 | +// //图案商标 | ||
| 256 | +// tw001CheckInfo.setBrandImage(brandImage); | ||
| 257 | +// //产证 | ||
| 258 | +// tw001CheckInfo.setPropertyCertificate(declareCheckInfo.getPropertyCertificate()); | ||
| 259 | +// //ECFA产证 | ||
| 260 | +// tw001CheckInfo.setEcfaPropertyCertificate(declareCheckInfo.getEcfaPropertyCertificate()); | ||
| 261 | +// //ECFA产证编号 | ||
| 262 | +// tw001CheckInfo.setEcfaPropertyCertificateNo(declareCheckInfo.getEcfaPropertyCertificateNo()); | ||
| 263 | +// //申请 | ||
| 264 | +// tw001CheckInfo.setApplyFor(declareCheckInfo.getApplyFor()); | ||
| 265 | +// return tw001CheckInfo; | ||
| 266 | +// } | ||
| 267 | +// | ||
| 268 | +// /** | ||
| 269 | +// * @Author mt | ||
| 270 | +// * @Description 生成文件对象集合vo,并且将文件复制到指定目录 | ||
| 271 | +// * @Date 2024/5/27 | ||
| 272 | +// * @param uploadFiles | ||
| 273 | +// * @return com.fedex.export.data.dto.tw001.Imp001Files[] | ||
| 274 | +// */ | ||
| 275 | +// private Imp001Files[] generateFiles(List<UploadFile> uploadFiles,String deliveryNo,Long declareId) throws IOException{ | ||
| 276 | +// if(uploadFiles == null || uploadFiles.size() == 0){ | ||
| 277 | +// return null; | ||
| 278 | +// } | ||
| 279 | +// Imp001Files[] tw001Files = new Imp001Files[uploadFiles.size()]; | ||
| 280 | +// for(int i = 0 ; i < uploadFiles.size() ; i ++){ | ||
| 281 | +// UploadFile uploadFile = uploadFiles.get(i); | ||
| 282 | +// Imp001Files file = new Imp001Files(); | ||
| 283 | +// //获取文件类型 | ||
| 284 | +// Integer source = this.sourceType(uploadFile.getName(),uploadFile.getSource()); | ||
| 285 | +// if(source == null){ | ||
| 286 | +// continue; | ||
| 287 | +// } | ||
| 288 | +// //重置文件名称,并且复制源文件到指定目录 | ||
| 289 | +// String fileName = this.generateFileName(uploadFile, deliveryNo, declareId); | ||
| 290 | +// if(fileName == null){ | ||
| 291 | +// continue; | ||
| 292 | +// } | ||
| 293 | +// //文件名称 | ||
| 294 | +// file.setName(fileName); | ||
| 295 | +// //文件来源 | ||
| 296 | +// file.setSource(source); | ||
| 297 | +// //文件后缀转换为小写 | ||
| 298 | +// String suffix = uploadFile.getType(); | ||
| 299 | +// if(suffix != null){ | ||
| 300 | +// suffix = suffix.toLowerCase(); | ||
| 301 | +// } | ||
| 302 | +// //文件名后缀 | ||
| 303 | +// file.setSuffix(suffix); | ||
| 304 | +// //文件大小 | ||
| 305 | +// file.setFileSizeByte(uploadFile.getFileSizeByte() == null ? null : uploadFile.getFileSizeByte().intValue()); | ||
| 306 | +// tw001Files[i] = file; | ||
| 307 | +// } | ||
| 308 | +// return tw001Files; | ||
| 309 | +// } | ||
| 310 | +// | ||
| 311 | +// /** | ||
| 312 | +// * @Author mt | ||
| 313 | +// * @Description 重置文件名称,并且复制源文件到指定目录 | ||
| 314 | +// * @Date 2024/5/29 | ||
| 315 | +// * @param uploadFile | ||
| 316 | +// * @param deliveryNo | ||
| 317 | +// * @param declareId | ||
| 318 | +// * @return java.lang.String | ||
| 319 | +// */ | ||
| 320 | +// private String generateFileName(UploadFile uploadFile,String deliveryNo,Long declareId) throws IOException{ | ||
| 321 | +// String generateFileName = null; | ||
| 322 | +// if(!Utils.isEmpty(uploadFile.getName())){ | ||
| 323 | +// generateFileName = deliveryNo | ||
| 324 | +// + Constant.COMMON_KEYS.UNDER_LINE + StringExtUtil.idLeftPadStr(uploadFile.getId()) | ||
| 325 | +// + Constant.COMMON_KEYS.UNDER_LINE + uploadFile.getName() | ||
| 326 | +// + Constant.COMMON_KEYS.UNDER_LINE + DateUtil.yyyyMMddHH24mmssSSS(new Date()) + uploadFile.getType(); | ||
| 327 | +// } | ||
| 328 | +// //获取源文件目录 实际文件路径:/var/share/icleartw/upload/declareFile/202401/476/出口報關申請表_20240116_132402_827.pdf | ||
| 329 | +// String sourceFilePath = uploadFile.getServerPath() + Constant.COMMON_KEYS.BACK_SLASH + uploadFile.getServerName(); | ||
| 330 | +// //获取复制目标目录 | ||
| 331 | +// String targetFilePath = this.generateWorkPath(deliveryNo,declareId) + generateFileName; | ||
| 332 | +// //原始文件存在则复制文件 | ||
| 333 | +// if(nioFileUtils.fileExists(sourceFilePath)){ | ||
| 334 | +// //复制文件到指定目录 | ||
| 335 | +// nioFileUtils.copyFile(sourceFilePath,targetFilePath); | ||
| 336 | +// return generateFileName; | ||
| 337 | +// }else{ | ||
| 338 | +// return null; | ||
| 339 | +// } | ||
| 340 | +// } | ||
| 341 | +// | ||
| 342 | +// /** | ||
| 343 | +// * @Author mt | ||
| 344 | +// * @Description 获取文件类型 | ||
| 345 | +// * @Date 2024/5/27 | ||
| 346 | +// * @param name 文件名称 | ||
| 347 | +// * @param sourceType 1:用户上传。2:系统生成。3:图案商标 | ||
| 348 | +// * @return java.lang.Integer | ||
| 349 | +// * (1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件) | ||
| 350 | +// */ | ||
| 351 | +// private Integer sourceType(String name,Long sourceType){ | ||
| 352 | +// //1:用户上传。2:系统生成。3:图案商标 | ||
| 353 | +// if(sourceType.equals(Constant.SEND_TW001_KEYS.UPLOAD_SOURCE_2)){ | ||
| 354 | +// if(name.equals(Constant.SEND_TW001_KEYS.APPLICATION_FORM)){ | ||
| 355 | +// //出口報關申請表 | ||
| 356 | +// return Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_1; | ||
| 357 | +// }else if(name.equals(Constant.SEND_TW001_KEYS.REVIEW_FORM)){ | ||
| 358 | +// //出口報關檢核表 | ||
| 359 | +// return Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_2; | ||
| 360 | +// } | ||
| 361 | +// }else if(sourceType.equals(Constant.SEND_TW001_KEYS.UPLOAD_SOURCE_1)){ | ||
| 362 | +// return Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_3; | ||
| 363 | +// } | ||
| 364 | +// //如果类型为图案商标则返回null | ||
| 365 | +// return null; | ||
| 366 | +// } | ||
| 367 | +// | ||
| 368 | +// /** | ||
| 369 | +// * @Author mt | ||
| 370 | +// * @Description COMPRESS_12位运单号_10位运单ID_yyyyMMddHHmmssSSS.jpeg 图案商标名称,并且复制源文件到指定目录 | ||
| 371 | +// * 【可上传类型:圖片格式僅支持bmp,jpg,jpeg,png格式,大小不超過2M】 | ||
| 372 | +// * @Date 2024/5/27 | ||
| 373 | +// * @param checkInfo | ||
| 374 | +// * @param deliveryNo | ||
| 375 | +// * @return java.lang.String | ||
| 376 | +// */ | ||
| 377 | +// private String brandImage(DeclareCheckInfo checkInfo,String deliveryNo) throws IOException{ | ||
| 378 | +// String resBrandImage = null; | ||
| 379 | +// //图案商标名称不为空,并且存在后缀 | ||
| 380 | +// if(!Utils.isEmpty(checkInfo.getBrandImage()) && checkInfo.getBrandImage().lastIndexOf(Constant.COMMON_KEYS.SPOT) > 0){ | ||
| 381 | +// String suffix = checkInfo.getBrandImage().substring(checkInfo.getBrandImage().lastIndexOf(Constant.COMMON_KEYS.SPOT)); | ||
| 382 | +// resBrandImage = Constant.SEND_TW001_KEYS.COMPRESS | ||
| 383 | +// + Constant.COMMON_KEYS.UNDER_LINE + deliveryNo | ||
| 384 | +// + Constant.COMMON_KEYS.UNDER_LINE + StringExtUtil.idLeftPadStr(checkInfo.getDeclareId()) | ||
| 385 | +// + Constant.COMMON_KEYS.UNDER_LINE + | ||
| 386 | +// DateUtil.yyyyMMddHH24mmssSSS(new Date()) + suffix; | ||
| 387 | +// //获取源文件目录 | ||
| 388 | +// String sourceFilePath = checkInfo.getBrandImage(); | ||
| 389 | +// //获取复制目标目录 | ||
| 390 | +// String targetFilePath = this.generateWorkPath(deliveryNo,checkInfo.getDeclareId()) + resBrandImage; | ||
| 391 | +// //复制文件到指定目录 | ||
| 392 | +// nioFileUtils.copyFile(sourceFilePath,targetFilePath); | ||
| 393 | +// } | ||
| 394 | +// return resBrandImage; | ||
| 395 | +// } | ||
| 396 | +// | ||
| 397 | +// /** | ||
| 398 | +// * @Author mt | ||
| 399 | +// * @Description 生成文件夹目录 /var/share/icleartw/TWIMPORT/work/yyyy-MM-dd/运单号_运单ID/ | ||
| 400 | +// * @Date 2024/5/29 | ||
| 401 | +// * @param deliveryNo | ||
| 402 | +// * @param declareId | ||
| 403 | +// * @return java.lang.String | ||
| 404 | +// */ | ||
| 405 | +// private String generateWorkPath(String deliveryNo,Long declareId){ | ||
| 406 | +// String yyyyMMdd = DateUtil.format(new Date()); | ||
| 407 | +// String fileDir = propertiesConfig.getTw001PathWork() + Constant.COMMON_KEYS.BACK_SLASH + | ||
| 408 | +// yyyyMMdd + Constant.COMMON_KEYS.BACK_SLASH + | ||
| 409 | +// deliveryNo + Constant.COMMON_KEYS.UNDER_LINE + declareId + Constant.COMMON_KEYS.BACK_SLASH; | ||
| 410 | +// //如果目录不存在则创建完整目录 | ||
| 411 | +// nioFileUtils.mkdirs(fileDir); | ||
| 412 | +// return fileDir; | ||
| 413 | +// } | ||
| 414 | +//} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/utils/biz/imp001/Imp001PushUtil.java
0 → 100644
| 1 | +//package com.fedex.connect.task.utils.biz.imp001; | ||
| 2 | +// | ||
| 3 | +//import com.fedex.export.common.util.*; | ||
| 4 | +//import com.fedex.export.config.PropertiesConfig; | ||
| 5 | +//import com.fedex.export.constants.Constant; | ||
| 6 | +//import com.fedex.export.data.bo.Imp001FileInfoBo; | ||
| 7 | +//import com.fedex.export.data.bo.Imp001GenerateBo; | ||
| 8 | +//import com.fedex.export.repository.entity.DeclareInfo; | ||
| 9 | +//import com.fedex.export.repository.entity.SysDictionary; | ||
| 10 | +//import org.slf4j.Logger; | ||
| 11 | +//import org.slf4j.LoggerFactory; | ||
| 12 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +//import org.springframework.stereotype.Component; | ||
| 14 | +// | ||
| 15 | +//import java.io.File; | ||
| 16 | +//import java.io.FileOutputStream; | ||
| 17 | +//import java.util.ArrayList; | ||
| 18 | +//import java.util.Date; | ||
| 19 | +//import java.util.List; | ||
| 20 | +//import java.util.Objects; | ||
| 21 | +// | ||
| 22 | +///** | ||
| 23 | +// * @Author mt | ||
| 24 | +// * @Description tw001报文推送,util | ||
| 25 | +// * @Date 2024/5/29 | ||
| 26 | +// */ | ||
| 27 | +//@Component | ||
| 28 | +//public class Tw001PushUtil { | ||
| 29 | +// private static Logger log = LoggerFactory.getLogger(Tw001PushUtil.class); | ||
| 30 | +// @Autowired | ||
| 31 | +// PropertiesConfig propertiesConfig; | ||
| 32 | +// @Autowired | ||
| 33 | +// ZipUtils zipUtils; | ||
| 34 | +// @Autowired | ||
| 35 | +// NioFileUtils nioFileUtils; | ||
| 36 | +// | ||
| 37 | +// /** | ||
| 38 | +// * @Author mt | ||
| 39 | +// * @Description 推送tw001 | ||
| 40 | +// * @Date 2024/5/29 | ||
| 41 | +// * @param tw001GenerateBo | ||
| 42 | +// * @return com.fedex.export.data.dto.tw001.Imp001RootJsonDto | ||
| 43 | +// */ | ||
| 44 | +// public void pushTw001(Imp001GenerateBo tw001GenerateBo) throws Exception{ | ||
| 45 | +// long start = System.currentTimeMillis(); | ||
| 46 | +// //生成zip临时文件到指定临时目录 | ||
| 47 | +// String zipFileName = this.toZips(tw001GenerateBo); | ||
| 48 | +// //zip原始临时目录,zip为临时文件 | ||
| 49 | +// String zipSourceTempFilePath = tw001GenerateBo.getWorkFilePath() + zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP; | ||
| 50 | +// //推送zip文件最终目录 | ||
| 51 | +// String zipTargetFilePath = propertiesConfig.getTw001PathFinal() + zipFileName; | ||
| 52 | +// //记录zip文件名称 | ||
| 53 | +// tw001GenerateBo.setZipFileName(zipFileName); | ||
| 54 | +// //记录zip文件目标路径 | ||
| 55 | +// tw001GenerateBo.setZipFileTargetPath(zipTargetFilePath); | ||
| 56 | +// //如果目录不存在则创建完整目录 | ||
| 57 | +// nioFileUtils.mkdirs(propertiesConfig.getTw001PathFinal()); | ||
| 58 | +// //推送zip临时文件到指定目标目录,复制文件到指定目录,采用 | ||
| 59 | +// String zipTargetTempFilePath = zipTargetFilePath + Constant.FILE_SUFFIX_KEYS.TEMP; | ||
| 60 | +// //复制文件至目标目录,为临时文件 | ||
| 61 | +// nioFileUtils.copyFile(zipSourceTempFilePath,zipTargetTempFilePath); | ||
| 62 | +// log.info("复制到目标目录完成 sourceTempFilePath : {} , targetTempFilePath : {} ",zipSourceTempFilePath,zipTargetTempFilePath); | ||
| 63 | +// //重命名为正式文件 | ||
| 64 | +// nioFileUtils.moveFile(zipTargetTempFilePath,zipTargetFilePath); | ||
| 65 | +// log.info("重命名为正式文件成功 zipTargetTempFilePath : {} , zipTargetFilePath : {} ",zipTargetTempFilePath,zipTargetFilePath); | ||
| 66 | +// long end = System.currentTimeMillis(); | ||
| 67 | +// log.info("运单号TW001:{} 推送完成,总计耗时:{} ms",tw001GenerateBo.getDeclareInfo().getDeliveryNo() ,(end - start)); | ||
| 68 | +// } | ||
| 69 | +// | ||
| 70 | +// /** | ||
| 71 | +// * @Author mt | ||
| 72 | +// * @Description 功能说明 生成zip临时文件到指定临时目录 | ||
| 73 | +// * @Date 2024/5/30 | ||
| 74 | +// * @param tw001GenerateBo | ||
| 75 | +// * @return java.lang.String | ||
| 76 | +// */ | ||
| 77 | +// private String toZips(Imp001GenerateBo tw001GenerateBo) throws Exception{ | ||
| 78 | +// /******************初始化需要压缩文件列表****************/ | ||
| 79 | +// List<File> filesList = new ArrayList<File>(); | ||
| 80 | +// //生成json文件名称 | ||
| 81 | +// String jsonFileName = this.generateJsonFileName(tw001GenerateBo,"", Constant.FILE_SUFFIX_KEYS.JSON); | ||
| 82 | +// //生成json文件 | ||
| 83 | +// JsonToJava.createJsonFile(JsonToJava.toJson(tw001GenerateBo.getTw001RootJsonDto()), | ||
| 84 | +// tw001GenerateBo.getWorkFilePath(), jsonFileName); | ||
| 85 | +// //获取json完整路径 | ||
| 86 | +// String jsonFilePath = tw001GenerateBo.getWorkFilePath() + jsonFileName; | ||
| 87 | +// filesList.add(new File(jsonFilePath)); | ||
| 88 | +// //文件名称 | ||
| 89 | +// Utils.listOf(tw001GenerateBo.getFileInfoList()).stream().filter(Objects::nonNull).forEach(fileInfo ->{ | ||
| 90 | +// //文件如果存在则添加到文件集合中 | ||
| 91 | +// File file = new File(tw001GenerateBo.getWorkFilePath() + fileInfo.getFileName()); | ||
| 92 | +// if(file.exists()){ | ||
| 93 | +// filesList.add(file); | ||
| 94 | +// } | ||
| 95 | +// }); | ||
| 96 | +// //初始化json文件对象,并添加到文件集合中 | ||
| 97 | +// this.initJsonFileInfo(tw001GenerateBo,jsonFileName); | ||
| 98 | +// //生成zip文件名称 .zip | ||
| 99 | +// String zipFileName = this.generateJsonFileName(tw001GenerateBo, Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.MESSAGE_CODE, Constant.FILE_SUFFIX_KEYS.ZIP); | ||
| 100 | +// //生成zip临时文件名称 .temp | ||
| 101 | +// String zipTempFileName = zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP; | ||
| 102 | +// FileOutputStream fos = null; | ||
| 103 | +// try{ | ||
| 104 | +// //完整zip临时文件名称 | ||
| 105 | +// File zipTemp = new File(tw001GenerateBo.getWorkFilePath() + zipTempFileName); | ||
| 106 | +// fos = new FileOutputStream(zipTemp); | ||
| 107 | +// zipUtils.toZip(filesList, fos); | ||
| 108 | +// }catch(Exception ex){ | ||
| 109 | +// log.error("生成压缩包错误:{}",ex.getMessage(),ex); | ||
| 110 | +// throw ex; | ||
| 111 | +// }finally{ | ||
| 112 | +// try { | ||
| 113 | +// if (fos != null) { | ||
| 114 | +// fos.close(); | ||
| 115 | +// fos = null; | ||
| 116 | +// } | ||
| 117 | +// } catch (Exception e) { | ||
| 118 | +// log.error(e.getMessage(),e); | ||
| 119 | +// throw e; | ||
| 120 | +// } | ||
| 121 | +// } | ||
| 122 | +// return zipFileName; | ||
| 123 | +// } | ||
| 124 | +// | ||
| 125 | +// /** | ||
| 126 | +// * @Author mt | ||
| 127 | +// * @Description 功能说明 初始化json文件对象 | ||
| 128 | +// * @Date 2024/5/30 | ||
| 129 | +// * @param tw001GenerateBo | ||
| 130 | +// * @param jsonFileName | ||
| 131 | +// * @return void | ||
| 132 | +// */ | ||
| 133 | +// private void initJsonFileInfo(Imp001GenerateBo tw001GenerateBo,String jsonFileName){ | ||
| 134 | +// SysDictionary jsonDic = tw001GenerateBo.getJsonDictionary(); | ||
| 135 | +// Imp001FileInfoBo fileInfoBo = new Imp001FileInfoBo(); | ||
| 136 | +// fileInfoBo.setFileName(jsonFileName); | ||
| 137 | +// fileInfoBo.setFileTypeId(jsonDic.getId()); | ||
| 138 | +// fileInfoBo.setFileTypeName(jsonDic.getChineseName()); | ||
| 139 | +// fileInfoBo.setPushTime(new Date()); | ||
| 140 | +// tw001GenerateBo.getFileInfoList().add(fileInfoBo); | ||
| 141 | +// } | ||
| 142 | +// | ||
| 143 | +// /** | ||
| 144 | +// * @Author mt | ||
| 145 | +// * @Description 功能说明 生成文件名称 | ||
| 146 | +// * @Date 2024/5/30 | ||
| 147 | +// * @param tw001GenerateBo | ||
| 148 | +// * @param prefix 前缀 | ||
| 149 | +// * @param suffix 后缀 | ||
| 150 | +// * @return java.lang.String | ||
| 151 | +// */ | ||
| 152 | +// private String generateJsonFileName(Imp001GenerateBo tw001GenerateBo,String prefix,String suffix){ | ||
| 153 | +// DeclareInfo declareInfo = tw001GenerateBo.getDeclareInfo(); | ||
| 154 | +// String fileName = prefix + declareInfo.getDeliveryNo() + Constant.COMMON_KEYS.UNDER_LINE | ||
| 155 | +// + StringExtUtil.idLeftPadStr(declareInfo.getDeclareId()) + Constant.COMMON_KEYS.UNDER_LINE + | ||
| 156 | +// DateUtil.yyyyMMddHH24mmssSSS(new Date()) + suffix; | ||
| 157 | +// return fileName; | ||
| 158 | +// } | ||
| 159 | +//} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/utils/biz/imp001/Imp001RecordLogUtil.java
0 → 100644
| 1 | +//package com.fedex.connect.task.utils.biz.imp001; | ||
| 2 | +// | ||
| 3 | +//import com.fedex.export.common.enums.PushLogEnum; | ||
| 4 | +//import com.fedex.export.common.util.DateUtil; | ||
| 5 | +//import com.fedex.export.common.util.NioFileUtils; | ||
| 6 | +//import com.fedex.export.common.util.Utils; | ||
| 7 | +//import com.fedex.export.config.PropertiesConfig; | ||
| 8 | +//import com.fedex.export.constants.Constant; | ||
| 9 | +//import com.fedex.export.data.bo.Imp001GenerateBo; | ||
| 10 | +//import com.fedex.export.repository.entity.DeclareInfo; | ||
| 11 | +//import com.fedex.export.repository.entity.log.PushObDetail; | ||
| 12 | +//import com.fedex.export.repository.entity.log.PushObLog; | ||
| 13 | +//import com.fedex.export.repository.repo.business.IPushObLogRepository; | ||
| 14 | +//import com.fedex.export.service.business.IPushObDetailService; | ||
| 15 | +//import org.slf4j.Logger; | ||
| 16 | +//import org.slf4j.LoggerFactory; | ||
| 17 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | +//import org.springframework.stereotype.Component; | ||
| 19 | +// | ||
| 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完成,记录日志,并且备份数据 | ||
| 28 | +// * @Date 2024/5/30 | ||
| 29 | +// */ | ||
| 30 | +//@Component | ||
| 31 | +//public class Tw001RecordLogUtil { | ||
| 32 | +// private static Logger log = LoggerFactory.getLogger(Tw001RecordLogUtil.class); | ||
| 33 | +// @Autowired | ||
| 34 | +// PropertiesConfig propertiesConfig; | ||
| 35 | +// @Autowired | ||
| 36 | +// IPushObLogRepository pushObLogRepository; | ||
| 37 | +// @Autowired | ||
| 38 | +// IPushObDetailService pushObDetailService; | ||
| 39 | +// @Autowired | ||
| 40 | +// NioFileUtils nioFileUtils; | ||
| 41 | +// | ||
| 42 | +// /** | ||
| 43 | +// * @Author mt | ||
| 44 | +// * @Description 功能说明 推送成功记录日志 | ||
| 45 | +// * @Date 2024/5/30 | ||
| 46 | +// * @param tw001GenerateBo | ||
| 47 | +// * @return void | ||
| 48 | +// */ | ||
| 49 | +// public void pushSuccessRecordLog(Imp001GenerateBo tw001GenerateBo, PushObLog obLog){ | ||
| 50 | +// try { | ||
| 51 | +// if(Objects.nonNull(tw001GenerateBo)){ | ||
| 52 | +// //备份文件,并且记录日志 | ||
| 53 | +// String targetPath = this.recordLog(tw001GenerateBo,obLog , propertiesConfig.getTw001PathBak(),PushLogEnum.PUSHED_SUCCESS,null); | ||
| 54 | +// obLog.setFileName(tw001GenerateBo.getZipFileName()); | ||
| 55 | +// obLog.setFilePath(tw001GenerateBo.getZipFileTargetPath()); | ||
| 56 | +// obLog.setFileBackPath(targetPath); | ||
| 57 | +// } | ||
| 58 | +// obLog.setPushNum(obLog.getPushNum() + 1); | ||
| 59 | +// obLog.setPushStatus(PushLogEnum.PUSHED_SUCCESS.getKey()); | ||
| 60 | +// obLog.setPushStatusDescribe(PushLogEnum.PUSHED_SUCCESS.getValue()); | ||
| 61 | +// obLog.setPushTime(new Date()); | ||
| 62 | +// obLog.setRemark(""); | ||
| 63 | +// //更新推送日志主表 | ||
| 64 | +// pushObLogRepository.updateById(obLog); | ||
| 65 | +// }catch(Exception ex){ | ||
| 66 | +// log.error("pushSuccessRecordLog : {} " ,ex.getMessage(),ex); | ||
| 67 | +// } | ||
| 68 | +// } | ||
| 69 | +// | ||
| 70 | +// /** | ||
| 71 | +// * @Author mt | ||
| 72 | +// * @Description 功能说明 推送失败记录日志 | ||
| 73 | +// * @Date 2024/5/30 | ||
| 74 | +// * @param tw001GenerateBo | ||
| 75 | +// * @param errorMsg | ||
| 76 | +// * @return void | ||
| 77 | +// */ | ||
| 78 | +// public void pushFailRecordLog(Imp001GenerateBo tw001GenerateBo, PushObLog obLog, String errorMsg){ | ||
| 79 | +// try { | ||
| 80 | +// if(Objects.nonNull(tw001GenerateBo)){ | ||
| 81 | +// //备份文件,并且记录失败日志 | ||
| 82 | +// String targetPath = this.recordLog(tw001GenerateBo,obLog,propertiesConfig.getTw001PathError(),PushLogEnum.PUSH_FAILED,errorMsg); | ||
| 83 | +// obLog.setFileName(tw001GenerateBo.getZipFileName()); | ||
| 84 | +// obLog.setFilePath(tw001GenerateBo.getZipFileTargetPath()); | ||
| 85 | +// obLog.setFileBackPath(targetPath); | ||
| 86 | +// } | ||
| 87 | +// obLog.setPushNum(obLog.getPushNum() + 1); | ||
| 88 | +// obLog.setPushStatus(PushLogEnum.PUSH_FAILED.getKey()); | ||
| 89 | +// obLog.setPushStatusDescribe(PushLogEnum.PUSH_FAILED.getValue()); | ||
| 90 | +// obLog.setPushTime(new Date()); | ||
| 91 | +// obLog.setRemark(errorMsg); | ||
| 92 | +// //更新推送日志主表 | ||
| 93 | +// pushObLogRepository.updateById(obLog); | ||
| 94 | +// }catch(Exception ex){ | ||
| 95 | +// log.error("pushFailRecordLog : {} " ,ex.getMessage(),ex); | ||
| 96 | +// } | ||
| 97 | +// } | ||
| 98 | +// | ||
| 99 | +// /** | ||
| 100 | +// * @Author mt | ||
| 101 | +// * @Description 功能说明 备份文件 | ||
| 102 | +// * @Date 2024/5/30 | ||
| 103 | +// * @param tw001GenerateBo | ||
| 104 | +// * @param tarPath | ||
| 105 | +// * @return 返回目标备份路径 | ||
| 106 | +// */ | ||
| 107 | +// private String recordLog(Imp001GenerateBo tw001GenerateBo, | ||
| 108 | +// PushObLog obLog, | ||
| 109 | +// String tarPath, | ||
| 110 | +// PushLogEnum pushLogEnum, | ||
| 111 | +// String remark){ | ||
| 112 | +// String returnTargetPath = ""; | ||
| 113 | +// try{ | ||
| 114 | +// DeclareInfo declareInfo = tw001GenerateBo.getDeclareInfo(); | ||
| 115 | +// //文件原始路径 | ||
| 116 | +// String sourcePath = tw001GenerateBo.getWorkFilePath(); | ||
| 117 | +// //生成文件目标路径 | ||
| 118 | +// String targetPath = this.generateFilePath(declareInfo.getDeliveryNo(),declareInfo.getDeclareId(),tarPath); | ||
| 119 | +// returnTargetPath = targetPath; | ||
| 120 | +// //推送文件明细 | ||
| 121 | +// List<PushObDetail> pushObDetailList = new ArrayList<>(); | ||
| 122 | +// Utils.listOf(tw001GenerateBo.getFileInfoList()).stream().filter(Objects::nonNull).forEach(o->{ | ||
| 123 | +// try { | ||
| 124 | +// //源文件完整路径 | ||
| 125 | +// String sPath = sourcePath + o.getFileName(); | ||
| 126 | +// //目标文件完整路径 | ||
| 127 | +// String tPath = targetPath + o.getFileName(); | ||
| 128 | +// //备份文件 | ||
| 129 | +// nioFileUtils.moveFile(sPath, tPath); | ||
| 130 | +// //记录日志明细表 | ||
| 131 | +// PushObDetail pushObDetail = new PushObDetail(); | ||
| 132 | +// pushObDetail.setCreateTime(new Date()); | ||
| 133 | +// pushObDetail.setDeclareId(declareInfo.getDeclareId()); | ||
| 134 | +// pushObDetail.setDeliveryNo(declareInfo.getDeliveryNo()); | ||
| 135 | +// pushObDetail.setPushLogId(obLog.getId()); | ||
| 136 | +// pushObDetail.setPushStatus(pushLogEnum.getKey()); | ||
| 137 | +// pushObDetail.setPushStatusDescribe(pushLogEnum.getValue()); | ||
| 138 | +// pushObDetail.setFileTypeId(o.getFileTypeId()); | ||
| 139 | +// pushObDetail.setFileType(o.getFileTypeName()); | ||
| 140 | +// pushObDetail.setFileName(o.getFileName()); | ||
| 141 | +// pushObDetail.setPushTime(new Date()); | ||
| 142 | +// pushObDetail.setRemark(remark); | ||
| 143 | +// pushObDetailList.add(pushObDetail); | ||
| 144 | +// }catch(Exception ex){ | ||
| 145 | +// log.error("move file error : {} ",ex.getMessage(),ex); | ||
| 146 | +// } | ||
| 147 | +// }); | ||
| 148 | +// //批量插入推送日志明细 | ||
| 149 | +// pushObDetailService.batchInsert(pushObDetailList); | ||
| 150 | +// log.info("batchInsert size : {} ",pushObDetailList.size()); | ||
| 151 | +// //zip包源文件完整路径 | ||
| 152 | +// String sPath = sourcePath + tw001GenerateBo.getZipFileName() + Constant.FILE_SUFFIX_KEYS.TEMP; | ||
| 153 | +// //zip包目标文件完整路径 | ||
| 154 | +// String tPath = targetPath + tw001GenerateBo.getZipFileName(); | ||
| 155 | +// //备份zip包文件 | ||
| 156 | +// nioFileUtils.moveFile(sPath, tPath); | ||
| 157 | +// //删除临时目录文件夹 | ||
| 158 | +// nioFileUtils.deleteDir(log,sourcePath,true); | ||
| 159 | +// log.info("删除临时目录文件夹 sourcePath : {} ",sourcePath); | ||
| 160 | +// }catch(Exception ex){ | ||
| 161 | +// log.error("recordLog error : {} ",ex.getMessage(),ex); | ||
| 162 | +// } | ||
| 163 | +// return returnTargetPath; | ||
| 164 | +// } | ||
| 165 | +// | ||
| 166 | +// /** | ||
| 167 | +// * @Author mt | ||
| 168 | +// * @Description 功能说明 生成目标文件夹路径 | ||
| 169 | +// * @Date 2024/5/30 | ||
| 170 | +// * @param filePath | ||
| 171 | +// * @return java.lang.String | ||
| 172 | +// */ | ||
| 173 | +// private String generateFilePath(String deliveryNo,Long declareId,String filePath){ | ||
| 174 | +// String yyyyMMdd = DateUtil.format(new Date()); | ||
| 175 | +// String fileDir = filePath + yyyyMMdd + Constant.COMMON_KEYS.BACK_SLASH + | ||
| 176 | +// deliveryNo + Constant.COMMON_KEYS.UNDER_LINE + declareId + Constant.COMMON_KEYS.BACK_SLASH; | ||
| 177 | +// //如果目录不存在则创建完整目录 | ||
| 178 | +// nioFileUtils.mkdirs(fileDir); | ||
| 179 | +// return fileDir; | ||
| 180 | +// } | ||
| 181 | +//} |
| 1 | +package com.fedex.connect.task.utils.sys; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.fedex.connect.common.dependencies.util.JsonToJava; | ||
| 5 | +import com.fedex.connect.common.dependencies.util.RPCUtils; | ||
| 6 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 7 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 8 | +import com.fedex.connect.task.config.PropertiesConfig; | ||
| 9 | +import com.fedex.connect.task.repository.repo.IKafkaStorageHistoryRepository; | ||
| 10 | +import com.fedex.connect.task.repository.repo.IKafkaTemporaryStorageRepository; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +import java.util.*; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * @Author mt | ||
| 18 | + * @Description 定时任务处理kafka异常数据补偿 | ||
| 19 | + * @Date 2024/5/14 | ||
| 20 | + */ | ||
| 21 | +@Component | ||
| 22 | +public class KafkaDmUtil { | ||
| 23 | + @Autowired | ||
| 24 | + protected IKafkaTemporaryStorageRepository kafKaTemporaryStorageRepository; | ||
| 25 | + @Autowired | ||
| 26 | + protected IKafkaStorageHistoryRepository kafkaStorageHistoryRepository; | ||
| 27 | + | ||
| 28 | + @Autowired | ||
| 29 | + RPCUtils rpcUtils; | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + PropertiesConfig propertiesConfig; | ||
| 33 | + | ||
| 34 | + public void kafKaTemporaryStorageRetry(List<KafkaTemporaryStorage> kafKaTemporaryStorageList){ | ||
| 35 | + //待更新状态并下发消息集合 | ||
| 36 | + List<KafkaTemporaryStorage> issuedList = new ArrayList<KafkaTemporaryStorage>(); | ||
| 37 | + //待删除临时表,并备份历史表消息集合 | ||
| 38 | + List<KafkaTemporaryStorage> backHisList = new ArrayList<KafkaTemporaryStorage>(); | ||
| 39 | + kafKaTemporaryStorageList.forEach(kts ->{ | ||
| 40 | + //判断是否已经处理3次 | ||
| 41 | + if(kts.getFrequency().intValue() >= 3){ | ||
| 42 | + //标注状态为2失败 | ||
| 43 | + kts.setStatus(2L); | ||
| 44 | + //备注重新处理原因 | ||
| 45 | + kts.setRemark((kts.getRemark() == null ? "" : kts.getRemark()) + "--->处理次数达到3次进行备份。"); | ||
| 46 | + backHisList.add(kts); | ||
| 47 | + }else{ | ||
| 48 | + //处理次数加一 | ||
| 49 | + kts.setFrequency(kts.getFrequency() + 1L); | ||
| 50 | + //备注重新处理原因 | ||
| 51 | + kts.setRemark((kts.getRemark() == null ? "" : kts.getRemark()) + "--->定时扫描任务重新下发"); | ||
| 52 | + issuedList.add(kts); | ||
| 53 | + } | ||
| 54 | + }); | ||
| 55 | + /***已处理3次数据不再进行下发,直接删除临时表记录,添加历史表记录***/ | ||
| 56 | + if(backHisList.size() > 0){ | ||
| 57 | + kafKaTemporaryStorageRepository.deleteInBatch(backHisList); | ||
| 58 | + //kafka临时表转历史表,并且将临时表id置空 | ||
| 59 | + List<KafkaStorageHistory> kafKaStorageHistoryList = this.convertTempToHis(backHisList); | ||
| 60 | + //保存至历史表 | ||
| 61 | + kafkaStorageHistoryRepository.saveAll(kafKaStorageHistoryList); | ||
| 62 | + } | ||
| 63 | + /***更新临时表状态,并实体数据转换为json字符串进行数据下发***/ | ||
| 64 | + if(issuedList.size() > 0) { | ||
| 65 | + kafKaTemporaryStorageRepository.saveAll(issuedList); | ||
| 66 | + Map<String,List<String>> messageMap = new HashMap<String,List<String>>(); | ||
| 67 | + issuedList.forEach(kts -> { | ||
| 68 | + String message = JSONObject.toJSONString(kts); | ||
| 69 | + //数据封装至map | ||
| 70 | + this.pushMessageMap(kts.getMessageCode(),message,messageMap); | ||
| 71 | + }); | ||
| 72 | + String json = JsonToJava.toJson(messageMap); | ||
| 73 | + Random random = new Random(); | ||
| 74 | + String url = ""; | ||
| 75 | + //kafka模块未做LB,通过随机数控制调用随机其中一台 | ||
| 76 | + if(random.nextBoolean()){ | ||
| 77 | + url = this.propertiesConfig.getRpcKafkaReceive145(); | ||
| 78 | + }else{ | ||
| 79 | + url = this.propertiesConfig.getRpcKafkaReceive146(); | ||
| 80 | + } | ||
| 81 | + //调用kafka rpc接口获取发送kafka结果 | ||
| 82 | + rpcUtils.rpcResponseInvoke(url, json, String.class); | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 将数据封装至map | ||
| 88 | + * @param messageCode | ||
| 89 | + * @param message | ||
| 90 | + * @param messageMap | ||
| 91 | + */ | ||
| 92 | + private void pushMessageMap(String messageCode,String message,Map<String,List<String>> messageMap){ | ||
| 93 | + //将数据进行分类 | ||
| 94 | + if(messageMap.containsKey(messageCode)){ | ||
| 95 | + List<String> messageList = messageMap.get(messageCode); | ||
| 96 | + messageList.add(message); | ||
| 97 | + messageMap.put(messageCode,messageList); | ||
| 98 | + }else{ | ||
| 99 | + List<String> messageList = new ArrayList<String>(); | ||
| 100 | + messageList.add(message); | ||
| 101 | + messageMap.put(messageCode,messageList); | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 移出kafka临时表id值,并将临时表对象转换为kafka历史表对象 | ||
| 107 | + * @param kafKaTemporaryStorageList | ||
| 108 | + */ | ||
| 109 | + private static List<KafkaStorageHistory> convertTempToHis(List<KafkaTemporaryStorage> kafKaTemporaryStorageList){ | ||
| 110 | + List<KafkaStorageHistory> kafKaStorageHistoryList = new ArrayList<KafkaStorageHistory>(); | ||
| 111 | + kafKaTemporaryStorageList.forEach(kts ->{ | ||
| 112 | + String json = JSONObject.toJSONString(kts); | ||
| 113 | + KafkaStorageHistory his = JSONObject.parseObject(json, KafkaStorageHistory.class); | ||
| 114 | + his.setId(null); | ||
| 115 | + kafKaStorageHistoryList.add(his); | ||
| 116 | + }); | ||
| 117 | + return kafKaStorageHistoryList; | ||
| 118 | + } | ||
| 119 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -2,65 +2,27 @@ spring: | ... | @@ -2,65 +2,27 @@ spring: |
| 2 | #JDBC连接信息 | 2 | #JDBC连接信息 |
| 3 | datasource: | 3 | datasource: |
| 4 | url: jdbc:oracle:thin:@192.168.1.250:1521:orcl | 4 | url: jdbc:oracle:thin:@192.168.1.250:1521:orcl |
| 5 | - username: icleartw | 5 | + username: iclearimp |
| 6 | - password: icleartw | 6 | + password: iclearimp |
| 7 | driver-class-name: oracle.jdbc.OracleDriver | 7 | driver-class-name: oracle.jdbc.OracleDriver |
| 8 | profiles: | 8 | profiles: |
| 9 | #系统环境 | 9 | #系统环境 |
| 10 | env: dev | 10 | env: dev |
| 11 | 11 | ||
| 12 | -allocation: | ||
| 13 | - nodeId: 1 | ||
| 14 | - | ||
| 15 | export: | 12 | export: |
| 16 | - mail: | ||
| 17 | - smtp: | ||
| 18 | - host: smtp.qiye.aliyun.com | ||
| 19 | - port: 25 | ||
| 20 | - needauth: true | ||
| 21 | - proxy: | ||
| 22 | - startFlag: false | ||
| 23 | - host: sin-proxy.apac.fedex.com | ||
| 24 | - port: 3128 | ||
| 25 | - mailAccountFlag: true | ||
| 26 | -# propertyPath: | ||
| 27 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 28 | - language: zh_TW | ||
| 29 | task: | 13 | task: |
| 30 | allocation: | 14 | allocation: |
| 31 | - #定时重发送申报信息邮件 | ||
| 32 | - sendDeclareInfoMail: 0 0/5 * * * ? | ||
| 33 | - #定时获取邮件发送结果回执(读取html界面) | ||
| 34 | - readHtmlReceipt: 0 0/1 * * * ? | ||
| 35 | - #定时任务处理邮件回执超时 | ||
| 36 | - receiptTimout: 0 0/3 * * * ? | ||
| 37 | - #同步HTML结果到Declare | ||
| 38 | - syncHtmlToDeclare: 0 0/1 * * * ? | ||
| 39 | - #CE晚来数据补偿发送邮件 | ||
| 40 | - ceCompensate: 0 0/1 * * * ? | ||
| 41 | - #EDD邮件或者清关组邮件,每一小时轮巡监控超过10票失败,发送预警邮件 | ||
| 42 | - warningEmail: 0 0/1 * * * ? | ||
| 43 | - #进口预清关补偿发送邮件(发送失败的邮件补偿发送) | ||
| 44 | - ceLogCompensate: 0 0/1 * * * ? | ||
| 45 | #kafka补偿定时任务 | 15 | #kafka补偿定时任务 |
| 46 | kafkaRetry: 0 0/1 * * * ? | 16 | kafkaRetry: 0 0/1 * * * ? |
| 47 | #推送ob zip包文件任务 | 17 | #推送ob zip包文件任务 |
| 48 | sendOb: 0 0/1 * * * ? | 18 | sendOb: 0 0/1 * * * ? |
| 49 | #推送ob文件异常重试任务 | 19 | #推送ob文件异常重试任务 |
| 50 | sendObRetry: 0 0/1 * * * ? | 20 | sendObRetry: 0 0/1 * * * ? |
| 51 | - #定时清理文件夹 | ||
| 52 | - clearFolders: 0 0/1 * * * ? | ||
| 53 | -url: | ||
| 54 | - proxy_hostname: sin-proxy.apac.fedex.com | ||
| 55 | - mailHtmlReceipt: http://47.103.140.98:8088/IcTw/Index_of_report_silkConvListRpt.html | ||
| 56 | - baseUrl: http://192.168.1.251/IcTw/ | ||
| 57 | - fedex: fedex.png | ||
| 58 | - line: line.png | ||
| 59 | 21 | ||
| 60 | rpc: | 22 | rpc: |
| 61 | url: | 23 | url: |
| 62 | - rpcKafkaReceive145: http://localhost:8088/icleartwkafka/rpcKafka/rpcKafkaReceive | 24 | + rpcKafkaReceive1: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive |
| 63 | - rpcKafkaReceive146: http://localhost:8088/icleartwkafka/rpcKafka/rpcKafkaReceive | 25 | + rpcKafkaReceive2: http://localhost:8082/kafka-cndc-server/rpcKafka/rpcKafkaReceive |
| 64 | 26 | ||
| 65 | tw001: | 27 | tw001: |
| 66 | path: | 28 | path: | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - jndi-name: jdbc/icleartwDS | 3 | + jndi-name: jdbc/iclearConnectDS |
| 4 | profiles: | 4 | profiles: |
| 5 | #系统环境 | 5 | #系统环境 |
| 6 | env: prod | 6 | env: prod |
| 7 | 7 | ||
| 8 | -allocation: | ||
| 9 | - nodeId: 1 | ||
| 10 | - | ||
| 11 | export: | 8 | export: |
| 12 | - mail: | ||
| 13 | - smtp: | ||
| 14 | - host: mapper.gslb.fedex.com | ||
| 15 | - port: 25 | ||
| 16 | - needauth: true | ||
| 17 | - proxy: | ||
| 18 | - startFlag: true | ||
| 19 | - host: sg2-proxy.apac.fedex.com | ||
| 20 | - port: 3128 | ||
| 21 | - mailAccountFlag: false | ||
| 22 | -# propertyPath: | ||
| 23 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 24 | - language: zh_TW | ||
| 25 | task: | 9 | task: |
| 26 | allocation: | 10 | allocation: |
| 27 | - #定时重发送申报信息邮件 | ||
| 28 | - sendDeclareInfoMail: 0 0/5 * * * ? | ||
| 29 | - #定时获取邮件发送结果回执(读取html界面) | ||
| 30 | - readHtmlReceipt: 0 0/3 * * * ? | ||
| 31 | - #定时任务处理邮件回执超时 | ||
| 32 | - receiptTimout: 0 0/3 * * * ? | ||
| 33 | - #同步HTML结果到Declare | ||
| 34 | - syncHtmlToDeclare: 0 0/1 * * * ? | ||
| 35 | - #CE晚来数据补偿发送邮件 | ||
| 36 | - ceCompensate: 0 0/5 * * * ? | ||
| 37 | - #EDD邮件或者清关组邮件,每一小时轮巡监控超过10票失败,发送预警邮件 | ||
| 38 | - warningEmail: 0 0 0/1 * * ? | ||
| 39 | - #进口预清关补偿发送邮件(发送失败的邮件补偿发送) | ||
| 40 | - ceLogCompensate: 0 0/10 * * * ? | ||
| 41 | #kafka补偿定时任务 | 11 | #kafka补偿定时任务 |
| 42 | kafkaRetry: 0 0/1 * * * ? | 12 | kafkaRetry: 0 0/1 * * * ? |
| 43 | #推送ob zip包文件任务 | 13 | #推送ob zip包文件任务 |
| 44 | sendOb: 0 0/1 * * * ? | 14 | sendOb: 0 0/1 * * * ? |
| 45 | #推送ob zip包文件异常重试任务 | 15 | #推送ob zip包文件异常重试任务 |
| 46 | sendObRetry: 0 0/3 * * * ? | 16 | sendObRetry: 0 0/3 * * * ? |
| 47 | - #定时清理文件夹 | ||
| 48 | - clearFolders: 0 0 01 * * ? | ||
| 49 | -url: | ||
| 50 | - proxy_hostname: sin-proxy.apac.fedex.com | ||
| 51 | - mailHtmlReceipt: http://155.161.252.18/report/silkConvListRpt/ | ||
| 52 | - baseUrl: https://exportdeclaration-tw.apac.fedex.com/IcTw/ | ||
| 53 | - fedex: fedex.png | ||
| 54 | - line: line.png | ||
| 55 | - | ||
| 56 | rpc: | 17 | rpc: |
| 57 | url: | 18 | url: |
| 58 | - rpcKafkaReceive145: https://pjea0179.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive | 19 | + rpcKafkaReceive1: https://pjea0179.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive |
| 59 | - rpcKafkaReceive146: https://pjea0180.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive | 20 | + rpcKafkaReceive2: https://pjea0180.prod.apac.fedex.com:9002/icleartwkafka/rpcKafka/rpcKafkaReceive |
| 60 | 21 | ||
| 61 | tw001: | 22 | tw001: |
| 62 | path: | 23 | path: | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - jndi-name: jdbc/icleartwDS | 3 | + jndi-name: jdbc/iclearConnectDS |
| 4 | profiles: | 4 | profiles: |
| 5 | #系统环境 | 5 | #系统环境 |
| 6 | env: test | 6 | env: test |
| 7 | 7 | ||
| 8 | -allocation: | ||
| 9 | - nodeId: 1 | ||
| 10 | - | ||
| 11 | export: | 8 | export: |
| 12 | - mail: | ||
| 13 | - smtp: | ||
| 14 | - host: smtp.qiye.aliyun.com | ||
| 15 | - port: 25 | ||
| 16 | - needauth: true | ||
| 17 | - proxy: | ||
| 18 | - startFlag: false | ||
| 19 | - host: sin-proxy.apac.fedex.com | ||
| 20 | - port: 3128 | ||
| 21 | - mailAccountFlag: true | ||
| 22 | -# propertyPath: | ||
| 23 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 24 | - language: zh_TW | ||
| 25 | task: | 9 | task: |
| 26 | allocation: | 10 | allocation: |
| 27 | - #定时重发送申报信息邮件 | ||
| 28 | - sendDeclareInfoMail: 0 0/5 * * * ? | ||
| 29 | - #定时获取邮件发送结果回执(读取html界面) | ||
| 30 | - readHtmlReceipt: 0 0/3 * * * ? | ||
| 31 | - #定时任务处理邮件回执超时 | ||
| 32 | - receiptTimout: 0 0/3 * * * ? | ||
| 33 | - #同步HTML结果到Declare | ||
| 34 | - syncHtmlToDeclare: 0 0/1 * * * ? | ||
| 35 | - #CE晚来数据补偿发送邮件 | ||
| 36 | - ceCompensate: 0 0/1 * * * ? | ||
| 37 | - #EDD邮件或者清关组邮件,每一小时轮巡监控超过10票失败,发送预警邮件 | ||
| 38 | - warningEmail: 0 0/1 * * * ? | ||
| 39 | - #进口预清关补偿发送邮件(发送失败的邮件补偿发送) | ||
| 40 | - ceLogCompensate: 0 0/1 * * * ? | ||
| 41 | #kafka补偿定时任务 | 11 | #kafka补偿定时任务 |
| 42 | kafkaRetry: 0 0/1 * * * ? | 12 | kafkaRetry: 0 0/1 * * * ? |
| 43 | #推送ob zip包文件任务 | 13 | #推送ob zip包文件任务 |
| 44 | sendOb: 0 0/1 * * * ? | 14 | sendOb: 0 0/1 * * * ? |
| 45 | #推送ob zip包文件异常重试任务 | 15 | #推送ob zip包文件异常重试任务 |
| 46 | sendObRetry: 0 0/1 * * * ? | 16 | sendObRetry: 0 0/1 * * * ? |
| 47 | - #定时清理文件夹 | ||
| 48 | - clearFolders: 0 0/1 * * * ? | ||
| 49 | -url: | ||
| 50 | - proxy_hostname: sin-proxy.apac.fedex.com | ||
| 51 | - mailHtmlReceipt: http://47.103.140.98:8088/IcTw/Index_of_report_silkConvListRpt.html | ||
| 52 | - baseUrl: http://192.168.1.251/IcTw/ | ||
| 53 | - fedex: fedex.png | ||
| 54 | - line: line.png | ||
| 55 | - | ||
| 56 | rpc: | 17 | rpc: |
| 57 | url: | 18 | url: |
| 58 | - rpcKafkaReceive145: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive | 19 | + rpcKafkaReceive1: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive |
| 59 | - rpcKafkaReceive146: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive | 20 | + rpcKafkaReceive2: http://47.103.140.98:7010/icleartwkafka/rpcKafka/rpcKafkaReceive |
| 60 | 21 | ||
| 61 | tw001: | 22 | tw001: |
| 62 | path: | 23 | path: | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - jndi-name: jdbc/icleartwDS | 3 | + jndi-name: jdbc/iclearConnectDS |
| 4 | profiles: | 4 | profiles: |
| 5 | #系统环境 | 5 | #系统环境 |
| 6 | env: uat | 6 | env: uat |
| 7 | 7 | ||
| 8 | -allocation: | ||
| 9 | - nodeId: 1 | ||
| 10 | - | ||
| 11 | export: | 8 | export: |
| 12 | - mail: | ||
| 13 | - smtp: | ||
| 14 | - host: mapper.gslb.fedex.com | ||
| 15 | - port: 25 | ||
| 16 | - needauth: true | ||
| 17 | - proxy: | ||
| 18 | - startFlag: true | ||
| 19 | - host: sg2-proxy.apac.fedex.com | ||
| 20 | - port: 3128 | ||
| 21 | - mailAccountFlag: false | ||
| 22 | -# propertyPath: | ||
| 23 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 24 | - language: zh_TW | ||
| 25 | task: | 9 | task: |
| 26 | allocation: | 10 | allocation: |
| 27 | - #定时重发送申报信息邮件 | ||
| 28 | - sendDeclareInfoMail: 0 0/5 * * * ? | ||
| 29 | - #定时获取邮件发送结果回执(读取html界面) | ||
| 30 | - readHtmlReceipt: 0 0/3 * * * ? | ||
| 31 | - #定时任务处理邮件回执超时 | ||
| 32 | - receiptTimout: 0 0/3 * * * ? | ||
| 33 | - #同步HTML结果到Declare | ||
| 34 | - syncHtmlToDeclare: 0 0/1 * * * ? | ||
| 35 | - #CE晚来数据补偿发送邮件 | ||
| 36 | - ceCompensate: 0 0/5 * * * ? | ||
| 37 | - #EDD邮件或者清关组邮件,每一小时轮巡监控超过10票失败,发送预警邮件 | ||
| 38 | - warningEmail: 0 0 0/1 * * ? | ||
| 39 | - #进口预清关补偿发送邮件(发送失败的邮件补偿发送) | ||
| 40 | - ceLogCompensate: 0 0/10 * * * ? | ||
| 41 | #kafka补偿定时任务 | 11 | #kafka补偿定时任务 |
| 42 | kafkaRetry: 0 0/1 * * * ? | 12 | kafkaRetry: 0 0/1 * * * ? |
| 43 | #推送ob zip包文件任务 | 13 | #推送ob zip包文件任务 |
| 44 | sendOb: 0 0/1 * * * ? | 14 | sendOb: 0 0/1 * * * ? |
| 45 | #推送ob zip包文件异常重试任务 | 15 | #推送ob zip包文件异常重试任务 |
| 46 | sendObRetry: 0 0/3 * * * ? | 16 | sendObRetry: 0 0/3 * * * ? |
| 47 | - #定时清理文件夹 | ||
| 48 | - clearFolders: 0 0 01 * * ? | ||
| 49 | -url: | ||
| 50 | - proxy_hostname: sin-proxy.apac.fedex.com | ||
| 51 | - mailHtmlReceipt: http://155.161.252.18/report/silkConvListRpt/ | ||
| 52 | - baseUrl: https://exportdeclarationuat-tw.apac.fedex.com/IcTw/ | ||
| 53 | - fedex: fedex.png | ||
| 54 | - line: line.png | ||
| 55 | - | ||
| 56 | rpc: | 17 | rpc: |
| 57 | url: | 18 | url: |
| 58 | - rpcKafkaReceive145: http://ujea0145.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive | 19 | + rpcKafkaReceive1: http://ujea0145.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive |
| 59 | - rpcKafkaReceive146: http://ujea0146.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive | 20 | + rpcKafkaReceive2: http://ujea0146.nonprod.apac.fedex.com:9001/icleartwkafka/rpcKafka/rpcKafkaReceive |
| 60 | 21 | ||
| 61 | tw001: | 22 | tw001: |
| 62 | path: | 23 | path: | ... | ... |
| 1 | -spring.redis.host=223.166.86.220 | ||
| 2 | -spring.redis.port=6333 | ||
| 3 | -spring.redis.password=!QAZ2wsx | ||
| 4 | -spring.redis.timeout=3000 | ||
| 5 | -spring.redis.jedis.pool.max-active=50 | ||
| 6 | -spring.redis.jedis.pool.max-wait=-1 | ||
| 7 | -spring.redis.jedis.pool.max-idle=4 | ||
| 8 | -spring.redis.jedis.pool.min-idle=0 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
File mode changed
File mode changed
-
Please register or login to post a comment