|
@@ -198,14 +198,13 @@ public class ChenYuTestScheduled {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取合同段列表 TODO 接口数据待确认
|
|
|
+ * 获取合同段列表
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 * * * ?")
|
|
|
- @Scheduled(fixedDelay = 20000)
|
|
|
+ @Scheduled(cron = "0 0 * * * ?")
|
|
|
public void getContractSectByProjCode() {
|
|
|
-// if (!SystemUtils.isLinux()) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
+ if (!SystemUtils.isLinux()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
contractCodeMap.clear();
|
|
|
String token = getToken();
|
|
@@ -234,32 +233,30 @@ public class ChenYuTestScheduled {
|
|
|
List<String> codes = new ArrayList<>();
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
JSONObject obj = data.getJSONObject(i);
|
|
|
- String code = obj.getString("Code");
|
|
|
String name = obj.getString("Name");
|
|
|
-// if (StringUtil.isNotBlank(code)) {
|
|
|
-// codes.add(code);
|
|
|
-// }
|
|
|
- contractCodeMap.put(name, Long.valueOf(i));
|
|
|
+ if (StringUtil.isNotBlank(name)) {
|
|
|
+ codes.add(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtil.isEmpty(codes)) {
|
|
|
+ log.info("No valid contract codes found");
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
-// if (CollectionUtil.isEmpty(codes)) {
|
|
|
-// log.info("No valid contract codes found");
|
|
|
-// return;
|
|
|
-// }
|
|
|
-
|
|
|
-// // 构建参数化查询
|
|
|
-// String placeholders = String.join(",", Collections.nCopies(codes.size(), "?"));
|
|
|
-// String sql = "SELECT * FROM m_contract_info WHERE contract_number IN (" + placeholders + ")";
|
|
|
-//
|
|
|
-// List<ContractInfo> contracts = jdbcTemplate.query(
|
|
|
-// sql,
|
|
|
-// codes.toArray(),
|
|
|
-// new BeanPropertyRowMapper<>(ContractInfo.class)
|
|
|
-// );
|
|
|
-
|
|
|
-// for (ContractInfo contract : contracts) {
|
|
|
-// contractCodeMap.put(contract.getContractNumber(), contract.getId());
|
|
|
-// }
|
|
|
+ // 构建参数化查询
|
|
|
+ String placeholders = String.join(",", Collections.nCopies(codes.size(), "?"));
|
|
|
+ String sql = "SELECT * FROM m_contract_info WHERE contract_number IN (" + placeholders + ")";
|
|
|
+
|
|
|
+ List<ContractInfo> contracts = jdbcTemplate.query(
|
|
|
+ sql,
|
|
|
+ codes.toArray(),
|
|
|
+ new BeanPropertyRowMapper<>(ContractInfo.class)
|
|
|
+ );
|
|
|
+
|
|
|
+ for (ContractInfo contract : contracts) {
|
|
|
+ contractCodeMap.put(contract.getContractNumber(), contract.getId());
|
|
|
+ }
|
|
|
|
|
|
log.info("Loaded {} contract mappings", contractCodeMap.size());
|
|
|
} catch (Exception e) {
|