|
|
@@ -19,30 +19,29 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@SpringBootApplication
|
|
|
-public class GetDataByViewApplication implements CommandLineRunner{
|
|
|
+public class GetDataByViewApplication implements CommandLineRunner {
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(GetDataByViewApplication.class);
|
|
|
|
|
|
@Autowired
|
|
|
private LISViewRepository lisViewRepository;
|
|
|
-
|
|
|
@Autowired
|
|
|
private IBPSRepository ibpsRepository;
|
|
|
-
|
|
|
@Autowired
|
|
|
private HandleData handleData;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ConfigurableApplicationContext context;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ImportRunner importRunner;
|
|
|
|
|
|
@Value("${importMode}")
|
|
|
private String importMode;
|
|
|
|
|
|
- public List<String> lisTableList = Arrays.asList("V_JT_TestCodeRerunRecord", "V_JT_QCMonthReport","V_JT_OutOfControlReport","V_JT_InfectiousReport");//
|
|
|
-// public List<String> lisTableList = Arrays.asList("V_JT_QCMonthReport");//
|
|
|
+ // 新增读取 outOfControlMode 配置
|
|
|
+ @Value("${outOfControlMode}")
|
|
|
+ private String outOfControlMode;
|
|
|
+
|
|
|
+ public List<String> lisTableList = Arrays.asList("V_JT_TestCodeRerunRecord", "V_JT_QCMonthReport","V_JT_InfectiousReport");
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
SpringApplication.run(GetDataByViewApplication.class, args);
|
|
|
@@ -50,30 +49,51 @@ public class GetDataByViewApplication implements CommandLineRunner{
|
|
|
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
- log.info("<-------------new turn start...------------->");
|
|
|
- if(importMode.equals("0")){
|
|
|
- ibpsRepository.getBasicData();
|
|
|
- for(String lisTable : lisTableList){
|
|
|
- List<Map<String, Object>> retList = lisViewRepository.query(lisTable);
|
|
|
- if(retList != null){
|
|
|
- handleData.startHandleData(retList,lisTable);
|
|
|
- }
|
|
|
+ if (importMode.equals("0")) {
|
|
|
+ // 如果处于 outOfControlMode=1,则只跑这一张表
|
|
|
+ if ("1".equals(outOfControlMode)) {
|
|
|
+ executeSingleTable("V_JT_OutOfControlReport");
|
|
|
+ } else {
|
|
|
+ // 否则保持原有全量逻辑
|
|
|
+ executeFullSync();
|
|
|
}
|
|
|
- //质量指标接口
|
|
|
- List<Map<String, Object>>qualityIndicatorList = ibpsRepository.getUndoQualityIndicator();
|
|
|
- handleData.HandQIData(qualityIndicatorList);
|
|
|
-
|
|
|
- //定期推送能力监督
|
|
|
- handleData.AbilityMonitor();
|
|
|
-
|
|
|
- log.info("<-- -----------this turn finish...------------->");
|
|
|
- context.close(); // 直接关闭上下文
|
|
|
- }else{
|
|
|
+ context.close(); // 跑完依然正常关闭上下文
|
|
|
+ } else {
|
|
|
String currentDir = System.getProperty("user.dir");
|
|
|
String filePath = currentDir + File.separator + "权限申请.txt";
|
|
|
importRunner.importPermissionRequest(filePath);
|
|
|
- context.close(); // 直接关闭上下文
|
|
|
+ context.close();
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 抽取出的完整数据同步逻辑(原封不动保留)
|
|
|
+ */
|
|
|
+ private void executeFullSync() {
|
|
|
+ log.info("<-------------new turn start...------------->");
|
|
|
+ ibpsRepository.getBasicData();
|
|
|
+ for (String lisTable : lisTableList) {
|
|
|
+ List<Map<String, Object>> retList = lisViewRepository.query(lisTable);
|
|
|
+ if (retList != null) {
|
|
|
+ handleData.startHandleData(retList, lisTable);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> qualityIndicatorList = ibpsRepository.getUndoQualityIndicator();
|
|
|
+ handleData.HandQIData(qualityIndicatorList);
|
|
|
+ handleData.AbilityMonitor();
|
|
|
+ log.info("<-- -----------this turn finish...------------->");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单表执行逻辑
|
|
|
+ */
|
|
|
+ private void executeSingleTable(String tableName) {
|
|
|
+ log.info("<-------------[Single Mode] {} start...------------->", tableName);
|
|
|
+ ibpsRepository.getBasicData();
|
|
|
+ List<Map<String, Object>> retList = lisViewRepository.query(tableName);
|
|
|
+ if (retList != null) {
|
|
|
+ handleData.startHandleData(retList, tableName);
|
|
|
+ }
|
|
|
+ log.info("<-- -----------[Single Mode] {} finish...------------->", tableName);
|
|
|
}
|
|
|
}
|