From aba4b755a3afc61a07538e4bfd8217979919907d Mon Sep 17 00:00:00 2001
From: shicf <shi_chongfu@163.com>
Date: 星期一, 08 九月 2025 11:42:05 +0800
Subject: [PATCH] 生产实时查询,过站信息修改 制令单关联的工单数据 未找到日志输出
---
product-server-data-center/src/main/java/com/product/data/center/service/CommonService.java | 1280 ++++++++++++++++++++++++++++++++++------------------------
1 files changed, 749 insertions(+), 531 deletions(-)
diff --git a/product-server-data-center/src/main/java/com/product/data/center/service/CommonService.java b/product-server-data-center/src/main/java/com/product/data/center/service/CommonService.java
index 24bd2f2..90e2ad1 100644
--- a/product-server-data-center/src/main/java/com/product/data/center/service/CommonService.java
+++ b/product-server-data-center/src/main/java/com/product/data/center/service/CommonService.java
@@ -4,6 +4,7 @@
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
+import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.IdUtil;
import com.product.admin.service.PublicService;
import com.product.common.lang.StringUtils;
@@ -27,9 +28,7 @@
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.time.LocalDate;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -42,170 +41,389 @@
@Service("dataCommonService")
public class CommonService extends AbstractBaseService implements ICommonService {
- @Resource
- SysJobService sysJobService;
+ @Resource
+ SysJobService sysJobService;
- @Resource
- PublicService publicService;
+ @Resource
+ PublicService publicService;
- @Resource
- SyncDelRecordService syncDelRecordService;
+ @Resource
+ SyncDelRecordService syncDelRecordService;
- @Resource
- MesExternalService mesExternalService;
+ @Resource
+ MesExternalService mesExternalService;
- @Value("${data.system.name}")
- private String dataSystemName;
+ @Value("${data.system.name}")
+ private String dataSystemName;
- public void deleteCenterLog() {
- try {
- //鍦╩ysql鐨刬nformation_schema 琛ㄤ腑鏌ヨ鎸囧畾琛ㄦ槸鍚﹀瓨鍦�
- String tableName = "da_product_sys_data_center_log";
+ @Transactional
+ public void deleteCenterLogV2() {
+ try {
- //褰掓。7澶╁墠鐨勬暟鎹�
- //鎴鏃ユ湡
- Date endTime = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -7);
+ StringBuilder querySql = new StringBuilder(64);
- //鏍煎紡鍖栨棩鏈�
- String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd");
+ //select min(created_utc_datetime) as minTime,max(created_utc_datetime) as maxTime,min(id) min_id,max(id) max_id, date_format(created_utc_datetime,'%Y-%m') current_month from product_sys_data_center_log where created_utc_datetime <now() + interval -7 day and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) ) group by date_format(created_utc_datetime,'%Y-%m')
+ querySql.append(" select min(id) min_id,max(id) max_id, date_format(created_utc_datetime,'%Y%m') current_month ");
+ querySql.append(" from product_sys_data_center_log ");
+ querySql.append(" where created_utc_datetime <now() + interval -7 day and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) ) ");
+ querySql.append(" group by date_format(created_utc_datetime,'%Y%m') ");
- //鏍规嵁鎴鏃ユ湡鏌ヨ琛ㄤ腑鏈�澶с�佹渶灏忕殑鍒涘缓鏃堕棿鏍规嵁鍒涘缓鏃堕棿杩涜鍒嗚〃鎸夋湀鍒嗚〃
- String sql = "select min(created_utc_datetime) as minTime,max(created_utc_datetime) as maxTime from product_sys_data_center_log where created_utc_datetime <now() + interval -7 day and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) )";
+ DataTableEntity dt = getBaseDao().listTable(querySql.toString(), new Object[]{});
- FieldSetEntity fs = getBaseDao().getFieldSetEntityBySQL(sql, new Object[]{}, false);
+ if (DataTableEntity.isEmpty(dt)) {
+ return;
+ }
+ //鍦╩ysql鐨刬nformation_schema 琛ㄤ腑鏌ヨ鎸囧畾琛ㄦ槸鍚﹀瓨鍦�
+ String tableName = "da_product_sys_data_center_log";
- if (fs == null) {
- return;
- }
- //鏈�灏忔椂闂�
- Date minTime = fs.getDate("minTime");
+ //灏佽鎵�鏈夎〃鍚�
+ Set<String> allTableName = dt.getData().stream().map(e -> tableName + "_" + e.getString("current_month")).collect(Collectors.toSet());
- //鏈�澶ф椂闂�
- Date maxTime = fs.getDate("maxTime");
+ //鍦╩ysql鐨刬nformation_schema 琛ㄤ腑鏌ヨ鎵�鏈夌殑琛�
+ querySql.setLength(0);
+ querySql.append(" select TABLE_NAME table_name from information_schema.tables where table_schema = ? and " + BaseUtil.buildQuestionMarkFilter("TABLE_NAME", allTableName.size(), true));
+ String dataBaseName = getBaseDao().getDataBaseName();
+ Object[] params = new Object[allTableName.size() + 1];
+ params[0] = dataBaseName;
+ int index = 1;
+ for (String tableNameStr : allTableName) {
+ params[index] = tableNameStr;
+ index++;
+ }
+ DataTableEntity dataTableEntity = getBaseDao().listTable(querySql.toString(), params);
- //鏍规嵁鏈�灏忔椂闂村拰鏈�澶ф椂闂磋幏鍙栧尯闂村唴锛堝寘鍚渶灏忔椂闂村拰鏈�澶ф椂闂达級鐨勫勾鏈堟棩鏈熸牸寮忎负yyyy-MM
+ Set<String> existsTable = dataTableEntity.getData().stream().map(e -> e.getString("table_name")).collect(Collectors.toSet());
- List<DateTime> tableSuffixList = DateUtil.rangeToList(minTime, maxTime, DateField.MONTH);
+ //瀵规瘮琛ㄥ悕锛屽垱寤轰笉瀛樺湪鐨勮〃
+ allTableName.removeAll(existsTable);
+ for (String tableNameStr : allTableName) {
+ String createTableSql = "create table " + tableNameStr + " like product_sys_data_center_log";
+ getBaseDao().executeUpdate(createTableSql, new Object[]{});
+ }
- //鏌ヨ鏁版嵁搴撲腑鏄惁瀛樺湪琛�
+ querySql.setLength(0);
+ //鏌ヨdata_center_log琛ㄧ殑uuid瀛楁 created_utc_datetime鏈�鏂扮殑鏁版嵁鏍规嵁 config_uuid 鍜� type杩涜鍒嗙粍 涓� result = 1 or ( deal_flag = 1 AND deal_result = 1 ) 姣忕粍鍙彇鏈�鏂扮殑涓�鏉℃暟鎹�
+ querySql.append(" SELECT uuid,row_num,(select uuid from product_sys_data_center_log where pre_step_uuid = uuid and type=2) as pre_step_uuid ");
+ querySql.append(" FROM ( ");
+ querySql.append(" SELECT ");
+ querySql.append(" uuid, ");
+ querySql.append(" ROW_NUMBER() OVER (PARTITION BY config_uuid, type ORDER BY created_utc_datetime DESC) AS row_num ");
+ querySql.append(" FROM product_sys_data_center_log ");
+ querySql.append(" WHERE result = 1 OR (deal_flag = 1 AND deal_result = 1) ");
+ querySql.append(" ) AS subquery ");
+ querySql.append(" WHERE row_num = 1 ");
- Set<String> tableNameSet = tableSuffixList.stream().map(e -> tableName + "_" + DateUtil.format(e, "yyyyMM")).collect(Collectors.toSet());
- //鏌ヨ鏁版嵁搴撲腑瀛樺湪鐨勮〃
- String dataBaseName = getBaseDao().getDataBaseName();
- sql = "select TABLE_NAME table_name from information_schema.tables where table_schema = ? and " + BaseUtil.buildQuestionMarkFilter("TABLE_NAME", tableNameSet.size(), true);
+ //鏌ヨ闇�瑕佷繚鐣欑殑鏁版嵁uuid
+ DataTableEntity retainData = getBaseDao().listTable(querySql.toString(), new Object[]{});
+ String[] retainUuids = DataTableEntity.isEmpty(retainData) ? null : new String[retainData.getRows() * 2];
+ if (!DataTableEntity.isEmpty(retainData)) {
+ for (int i = 0; i < retainData.getRows(); i++) {
+ retainUuids[i] = retainData.getString(i, "uuid");
+ retainUuids[i + retainData.getRows()] = retainData.getString(i, "pre_step_uuid");
+ }
+ }
- Object[] params = new Object[tableNameSet.size() + 1];
- params[0] = dataBaseName;
- int index = 1;
- for (String tableNameStr : tableNameSet) {
- params[index] = tableNameStr;
- index++;
- }
- DataTableEntity dataTableEntity = getBaseDao().listTable(sql, params);
- if (!DataTableEntity.isEmpty(dataTableEntity)) {
- for (int i = 0; i < dataTableEntity.getRows(); i++) {
- String tableNameStr = dataTableEntity.getString(i, "table_name");
- tableNameSet.remove(tableNameStr);
- }
- }
- //鍒涘缓涓嶅瓨鍦ㄧ殑琛紝琛ㄧ粨鏋勪笌鍘熻〃涓�鑷�
- for (String tableNameStr : tableNameSet) {
- String createTableSql = "create table " + tableNameStr + " like product_sys_data_center_log";
- getBaseDao().executeUpdate(createTableSql, new Object[]{});
- }
- //鏌ヨ鍚勭被鍨嬮厤缃渶鍚庝竴娆℃垚鍔熺殑鏁版嵁
- String sqlFilter = "SELECT * FROM (SELECT uuid\n" +
- "FROM product_sys_data_center_log\n" +
- "WHERE uuid IN (\n" +
- "\tSELECT uuid\n" +
- "\tFROM product_sys_data_center_log\n" +
- "\tWHERE id IN (\n" +
- "\t\tSELECT max(a.id)\n" +
- "\t\tFROM product_sys_data_center_log a\n" +
- "\t\t\tJOIN product_sys_data_center_log b ON a.uuid = b.pre_step_uuid\n" +
- "\t\tWHERE a.type = 1\n" +
- "\t\t\tAND b.type = 2\n" +
- "\t\t\tAND (a.result = 1\n" +
- "\t\t\t\tOR (a.deal_flag = 1\n" +
- "\t\t\t\t\tAND a.deal_result = 1))\n" +
- "\t\t\tAND (b.result = 1\n" +
- "\t\t\t\tOR (b.deal_flag = 1\n" +
- "\t\t\t\t\tAND b.deal_result = 1))\n" +
- "\t\tGROUP BY a.config_uuid\n" +
- "\t)\n" +
- "\tUNION ALL\n" +
- "\tSELECT aa.uuid\n" +
- "\tFROM product_sys_data_center_log aa\n" +
- "\t\tJOIN product_sys_data_center_log bb ON aa.pre_step_uuid = bb.uuid\n" +
- "\tWHERE aa.type = 2\n" +
- "\t\tAND bb.type = 1\n" +
- "\t\tAND bb.id IN (\n" +
- "\t\t\tSELECT max(a.id)\n" +
- "\t\t\tFROM product_sys_data_center_log a\n" +
- "\t\t\t\tJOIN product_sys_data_center_log b ON a.uuid = b.pre_step_uuid\n" +
- "\t\t\tWHERE a.type = 1\n" +
- "\t\t\t\tAND b.type = 2\n" +
- "\t\t\t\tAND (a.result = 1\n" +
- "\t\t\t\t\tOR (a.deal_flag = 1\n" +
- "\t\t\t\t\t\tAND a.deal_result = 1))\n" +
- "\t\t\t\tAND (b.result = 1\n" +
- "\t\t\t\t\tOR (b.deal_flag = 1\n" +
- "\t\t\t\t\t\tAND b.deal_result = 1))\n" +
- "\t\t\tGROUP BY a.config_uuid\n" +
- "\t\t)\n" +
- "\tUNION ALL\n" +
- "\tSELECT uuid\n" +
- "\tFROM product_sys_data_center_log a\n" +
- "\tWHERE a.type = 5\n" +
- "\t\tAND detail != 3\n" +
- "\t\tAND (a.result = 1\n" +
- "\t\t\tOR (a.deal_flag = 1\n" +
- "\t\t\t\tAND a.deal_result = 1))\n" +
- ")) ddd";
- //鎻掑叆鏁版嵁鏍规嵁鍒涘缓鏃堕棿鐨勫勾鏈堝垎鍒彃鍏ュ埌瀵瑰簲鐨勮〃涓�
- for (DateTime dateTime : tableSuffixList) {
- String insertSql = "insert into " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " select * from product_sys_data_center_log where created_utc_datetime >= str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s') and created_utc_datetime < str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s') + interval 1 month" +
- " and id >(select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) ) and created_utc_datetime <now() + interval -7 day";
- getBaseDao().executeUpdate(insertSql, new Object[]{DateUtil.format(dateTime, "yyyy-MM"), DateUtil.format(dateTime, "yyyy-MM")});
+ for (int i = 0; i < dt.getRows(); i++) {
+ Integer minId = dt.getInt(i, "min_id");
+ Integer maxId = dt.getInt(i, "max_id");
+
+ String currentMonth = dt.getString(i, "current_month");
+
+ //鏌ヨmysql涓槸鍚﹀瓨鍦ㄨ〃
+
+ querySql.setLength(0);
+ int pageSize = 500;
+ //鍒嗛〉鏌ヨ閲囬泦鏃ュ織鏁版嵁7澶╁墠鐨勬渶澶у拰鏈�灏廼d
+ querySql.append(" select a.uuid as log_collect_uuid,b.uuid as log_extract_uuid from product_sys_data_center_log a");
+ querySql.append(" join product_sys_data_center_log b ");
+ querySql.append(" on a.uuid=b.pre_step_uuid ");
+ querySql.append(" where a.id >= ? and a.id <= ? and a.type=1 and (a.result = 1 or ( a.deal_flag = 1 AND a.deal_result = 1 ) ) and a.type=1 and b.type=2 limit ").append(pageSize);
+
+ while (true) {
+ DataTableEntity queryDt = getBaseDao().listTable(querySql.toString(), new Object[]{minId, maxId});
+ if (DataTableEntity.isEmpty(queryDt)) {
+ break;
+ }
+
+ //灏嗘煡璇㈠嚭鐨刲og_collect_uuid鍜宭og_extract_uuid鍒嗗埆瀛樺叆涓や釜list涓�
+ List<String> logCollectUuidList = new ArrayList<>();
+ List<String> logExtractUuidList = new ArrayList<>();
+ for (int j = 0; j < queryDt.getRows(); j++) {
+ logCollectUuidList.add(queryDt.getString(j, "log_collect_uuid"));
+ logExtractUuidList.add(queryDt.getString(j, "log_extract_uuid"));
+ }
+ //鏍规嵁鏌ヨ鍑虹殑uuid灏嗘暟鎹彃鍏ュ埌瀵瑰簲鐨勮〃涓紝浣跨敤insert into select鐨勬柟寮� 鏉′欢鏄� uuid in logCollectUuidList 鍜� logExtractUuidList 鐨勬暟鎹�
+ StringBuilder insertSql = new StringBuilder(64);
+ insertSql.append(" insert into ").append(tableName).append("_").append(currentMonth);
+
+ //灏唋ogCollectUuidList鍜宭ogExtractUuidList鍚堝苟涓轰竴涓暟缁勪笖鏁扮粍涓鏋滄湁rangeUuids涓殑鏁版嵁鍒欐帓闄�
+ Set<String> uuidSet = new HashSet<>();
+ uuidSet.addAll(logCollectUuidList);
+ uuidSet.addAll(logExtractUuidList);
+ uuidSet.removeAll(Arrays.asList(retainUuids));
+
+ String[] uuids = uuidSet.toArray(new String[0]);
+
+
+ insertSql.append(" select * from product_sys_data_center_log").append(" where (").append(BaseUtil.buildQuestionMarkFilter("uuid", uuids.length, true)).append(")");
+ //宸茬粡鍦ㄨ〃涓殑鏁版嵁杩涜鎺掗櫎
+ insertSql.append(" and uuid not in (select uuid from ").append(tableName).append("_").append(currentMonth).append(" )");
+ getBaseDao().executeUpdate(insertSql.toString(), uuids);
+
+ //鍒犻櫎閲囬泦銆佹彁鍙栨棩蹇楁暟鎹�
+ StringBuilder deleteSql = new StringBuilder(64);
+ deleteSql.append(" delete a from product_sys_data_center_log a ");
+ deleteSql.append(" where (").append(BaseUtil.buildQuestionMarkFilter("a.uuid", uuids.length, true)).append(")");
+ getBaseDao().executeUpdate(deleteSql.toString(), uuids);
+ if (pageSize != queryDt.getRows()) {
+ break;
+ }
+ }
+
+ //鍒嗛〉鍒犻櫎type>2鐨勬暟鎹�
+ querySql.setLength(0);
+ querySql.append(" select uuid,id from product_sys_data_center_log a");
+ querySql.append(" where id >= ? and id <= ? and type>2 and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) ) limit ").append(pageSize * 2);
+ while (true) {
+ DataTableEntity queryDt = getBaseDao().listTable(querySql.toString(), new Object[]{minId, maxId});
+ if (DataTableEntity.isEmpty(queryDt)) {
+ break;
+ }
+ //灏嗘煡璇㈠嚭鐨剈uid瀛樺叆list涓�
+ List<String> uuidList = queryDt.getData().stream().map(e -> e.getString("uuid")).collect(Collectors.toList());
+ //鎺掗櫎rangeUuids涓殑鏁版嵁
+ uuidList.removeAll(Arrays.asList(retainUuids));
+ if (uuidList.isEmpty()) {
+ if (queryDt.getRows() < pageSize * 2) {
+ break;
+ } else {
+ minId = queryDt.getData().stream().min(Comparator.comparingInt(e -> e.getInteger("id"))).get().getInteger("id");
+ }
+ }
+ //鏍规嵁鏌ヨ鍑虹殑uuid灏嗘暟鎹彃鍏ュ埌瀵瑰簲鐨勮〃涓紝浣跨敤insert into select鐨勬柟寮� 鏉′欢鏄� uuid in uuidList 鐨勬暟鎹�
+ StringBuilder insertSql = new StringBuilder(64);
+ insertSql.append(" insert into ").append(tableName).append("_").append(currentMonth);
+ insertSql.append(" select * from product_sys_data_center_log").append(" where (").append(BaseUtil.buildQuestionMarkFilter("uuid", uuidList.size(), true)).append(")");
+ //宸茬粡鍦ㄨ〃涓殑鏁版嵁杩涜鎺掗櫎
+ insertSql.append(" and uuid not in (select uuid from ").append(tableName).append("_").append(currentMonth).append(" )");
+ getBaseDao().executeUpdate(insertSql.toString(), uuidList.toArray());
+ //鍒犻櫎鍏朵粬鏃ュ織鏁版嵁
+ StringBuilder deleteSql = new StringBuilder(64);
+ deleteSql.append(" delete a from product_sys_data_center_log a ");
+ deleteSql.append(" where (").append(BaseUtil.buildQuestionMarkFilter("a.uuid", uuidList.size(), true)).append(")");
+ getBaseDao().executeUpdate(deleteSql.toString(), uuidList.toArray());
+ if (pageSize * 2 != queryDt.getRows()) {
+ break;
+ }
+ }
+ }
+
+
+ } catch (Exception e) {
+ SpringMVCContextHolder.getSystemLogger().error("deleteCenterLogV2 error");
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ public void deleteCenterLog() {
+ this.deleteCenterLogV2();
+ }
+
+ public void deleteCenterLogBak() {
+ try {
+ //鍦╩ysql鐨刬nformation_schema 琛ㄤ腑鏌ヨ鎸囧畾琛ㄦ槸鍚﹀瓨鍦�
+ String tableName = "da_product_sys_data_center_log";
+
+ //褰掓。7澶╁墠鐨勬暟鎹�
+ //鎴鏃ユ湡
+ Date endTime = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -7);
+
+ //鏍煎紡鍖栨棩鏈�
+ String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd");
+
+ //鏍规嵁鎴鏃ユ湡鏌ヨ琛ㄤ腑鏈�澶с�佹渶灏忕殑鍒涘缓鏃堕棿鏍规嵁鍒涘缓鏃堕棿杩涜鍒嗚〃鎸夋湀鍒嗚〃
+ String sql = "select min(created_utc_datetime) as minTime,max(created_utc_datetime) as maxTime from product_sys_data_center_log where created_utc_datetime <now() + interval -7 day and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) ) group by date_format(created_utc_datetime,'%Y-%m') ";
+
+ FieldSetEntity fs = getBaseDao().getFieldSetEntityBySQL(sql, new Object[]{}, false);
+
+ if (fs == null) {
+ return;
+ }
+ //鏈�灏忔椂闂�
+ Date minTime = fs.getDate("minTime");
+
+ //鏈�澶ф椂闂�
+ Date maxTime = fs.getDate("maxTime");
+
+ //鏍规嵁鏈�灏忔椂闂村拰鏈�澶ф椂闂磋幏鍙栧尯闂村唴锛堝寘鍚渶灏忔椂闂村拰鏈�澶ф椂闂达級鐨勫勾鏈堟棩鏈熸牸寮忎负yyyy-MM
+
+ List<DateTime> tableSuffixList = DateUtil.rangeToList(minTime, maxTime, DateField.MONTH);
+
+ //鏌ヨ鏁版嵁搴撲腑鏄惁瀛樺湪琛�
+
+ Set<String> tableNameSet = tableSuffixList.stream().map(e -> tableName + "_" + DateUtil.format(e, "yyyyMM")).collect(Collectors.toSet());
+
+ //鏌ヨ鏁版嵁搴撲腑瀛樺湪鐨勮〃
+ String dataBaseName = getBaseDao().getDataBaseName();
+ sql = "select TABLE_NAME table_name from information_schema.tables where table_schema = ? and " + BaseUtil.buildQuestionMarkFilter("TABLE_NAME", tableNameSet.size(), true);
+
+ Object[] params = new Object[tableNameSet.size() + 1];
+ params[0] = dataBaseName;
+ int index = 1;
+ for (String tableNameStr : tableNameSet) {
+ params[index] = tableNameStr;
+ index++;
+ }
+ DataTableEntity dataTableEntity = getBaseDao().listTable(sql, params);
+
+ if (!DataTableEntity.isEmpty(dataTableEntity)) {
+ for (int i = 0; i < dataTableEntity.getRows(); i++) {
+ String tableNameStr = dataTableEntity.getString(i, "table_name");
+ tableNameSet.remove(tableNameStr);
+ }
+ }
+ //鍒涘缓涓嶅瓨鍦ㄧ殑琛紝琛ㄧ粨鏋勪笌鍘熻〃涓�鑷�
+ for (String tableNameStr : tableNameSet) {
+ String createTableSql = "create table " + tableNameStr + " like product_sys_data_center_log";
+ getBaseDao().executeUpdate(createTableSql, new Object[]{});
+ }
+ //鏌ヨ鍚勭被鍨嬮厤缃渶鍚庝竴娆℃垚鍔熺殑鏁版嵁
+ String sqlFilter = "SELECT * FROM (SELECT uuid\n" +
+ "FROM product_sys_data_center_log\n" +
+ "WHERE uuid IN (\n" +
+ "\tSELECT uuid\n" +
+ "\tFROM product_sys_data_center_log\n" +
+ "\tWHERE id IN (\n" +
+ "\t\tSELECT max(a.id)\n" +
+ "\t\tFROM product_sys_data_center_log a\n" +
+ "\t\t\tJOIN product_sys_data_center_log b ON a.uuid = b.pre_step_uuid\n" +
+ "\t\tWHERE a.type = 1\n" +
+ "\t\t\tAND b.type = 2\n" +
+ "\t\t\tAND (a.result = 1\n" +
+ "\t\t\t\tOR (a.deal_flag = 1\n" +
+ "\t\t\t\t\tAND a.deal_result = 1))\n" +
+ "\t\t\tAND (b.result = 1\n" +
+ "\t\t\t\tOR (b.deal_flag = 1\n" +
+ "\t\t\t\t\tAND b.deal_result = 1))\n" +
+ "\t\tGROUP BY a.config_uuid\n" +
+ "\t)\n" +
+ "\tUNION ALL\n" +
+ "\tSELECT aa.uuid\n" +
+ "\tFROM product_sys_data_center_log aa\n" +
+ "\t\tJOIN product_sys_data_center_log bb ON aa.pre_step_uuid = bb.uuid\n" +
+ "\tWHERE aa.type = 2\n" +
+ "\t\tAND bb.type = 1\n" +
+ "\t\tAND bb.id IN (\n" +
+ "\t\t\tSELECT max(a.id)\n" +
+ "\t\t\tFROM product_sys_data_center_log a\n" +
+ "\t\t\t\tJOIN product_sys_data_center_log b ON a.uuid = b.pre_step_uuid\n" +
+ "\t\t\tWHERE a.type = 1\n" +
+ "\t\t\t\tAND b.type = 2\n" +
+ "\t\t\t\tAND (a.result = 1\n" +
+ "\t\t\t\t\tOR (a.deal_flag = 1\n" +
+ "\t\t\t\t\t\tAND a.deal_result = 1))\n" +
+ "\t\t\t\tAND (b.result = 1\n" +
+ "\t\t\t\t\tOR (b.deal_flag = 1\n" +
+ "\t\t\t\t\t\tAND b.deal_result = 1))\n" +
+ "\t\t\tGROUP BY a.config_uuid\n" +
+ "\t\t)\n" +
+ "\tUNION ALL\n" +
+ "\tSELECT uuid\n" +
+ "\tFROM product_sys_data_center_log a\n" +
+ "\tWHERE a.type = 5\n" +
+ "\t\tAND detail != 3\n" +
+ "\t\tAND (a.result = 1\n" +
+ "\t\t\tOR (a.deal_flag = 1\n" +
+ "\t\t\t\tAND a.deal_result = 1))\n" +
+ ")) ddd";
+ //鎻掑叆鏁版嵁鏍规嵁鍒涘缓鏃堕棿鐨勫勾鏈堝垎鍒彃鍏ュ埌瀵瑰簲鐨勮〃涓�
+ for (DateTime dateTime : tableSuffixList) {
+
+ String selectSql = "select * from product_sys_data_center_log where created_utc_datetime >= str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s') and created_utc_datetime < str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s') + interval 1 month" +
+ " and id >(select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) ) and created_utc_datetime <now() + interval -7 day";
+
+
+ //鑾峰彇datetime鎵�鍦ㄦ湀浠界殑绗竴澶�0鐐�0鍒�0绉� 鍜屾渶鍚庝竴澶�23鐐�59鍒�59绉�
+ DateTime beginOfMonth = DateUtil.beginOfMonth(dateTime);
+ DateTime endOfMonth = DateUtil.endOfMonth(dateTime);
+
+
+ int currentPage = 1;
+
+ int totalPage;
+ do {
+ //鍒嗛〉鏌ヨ鏁版嵁
+ DataTableEntity dt = getBaseDao().listTable(selectSql, new Object[]{DateUtil.format(dateTime, "yyyy-MM"), DateUtil.format(dateTime, "yyyy-MM")}, currentPage, 2000);
+ if (DataTableEntity.isEmpty(dt)) {
+ break;
+ }
+ totalPage = dt.getSqle().getTotalpage();
+ //鏇存敼dt鐨勮〃鍚嶈繘琛屾彃鍏�
+ dt.getMeta().setTableName(new Object[]{tableName + "_" + DateUtil.format(dateTime, "yyyyMM")});
+ getBaseDao().add(dt);
+ } while (totalPage > currentPage);
+// String insertSql = "insert into " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " select * from product_sys_data_center_log where created_utc_datetime >= str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s') and created_utc_datetime < str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s') + interval 1 month" +
+// " and id >(select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) and (result = 1 or ( deal_flag = 1 AND deal_result = 1 ) ) and created_utc_datetime <now() + interval -7 day";
+// getBaseDao().executeUpdate(insertSql, new Object[]{DateUtil.format(dateTime, "yyyy-MM"), DateUtil.format(dateTime, "yyyy-MM")});
// //鍒犻櫎鏁版嵁宸叉彃鍏ョ殑鏁版嵁
- StringBuilder deleteSql = new StringBuilder();
- deleteSql.append(" DELETE a FROM product_sys_data_center_log a INNER JOIN ");
- deleteSql.append(" product_sys_data_center_log b on a.uuid=b.pre_step_uuid and a.type=1 and b.type=2 ");
- deleteSql.append(" where ");
- deleteSql.append(" a.id>= (select ifnull(min(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
- deleteSql.append(" and a.id <= (select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
- deleteSql.append(" and (a.result = 1 or ( a.deal_flag = 1 AND a.deal_result = 1 ) ) ");
- deleteSql.append(" and a.type=1 ");
- deleteSql.append(" and a.uuid not in (").append(sqlFilter).append(") ");
- //鍏堝垹闄ら噰闆嗘棩蹇楁暟鎹�
- getBaseDao().executeUpdate(deleteSql.toString(), new Object[]{});
+ StringBuilder deleteSql = new StringBuilder();
+// deleteSql.append(" DELETE a FROM product_sys_data_center_log a INNER JOIN ");
+// deleteSql.append(" product_sys_data_center_log b on a.uuid=b.pre_step_uuid and a.type=1 and b.type=2 ");
+// deleteSql.append(" where ");
+// deleteSql.append(" a.id>= (select ifnull(min(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
+// deleteSql.append(" and a.id <= (select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
+// deleteSql.append(" and (a.result = 1 or ( a.deal_flag = 1 AND a.deal_result = 1 ) ) ");
+// deleteSql.append(" and a.type=1 ");
+// deleteSql.append(" and a.uuid not in (").append(sqlFilter).append(") ");
+// //鍏堝垹闄ら噰闆嗘棩蹇楁暟鎹�
+// getBaseDao().executeUpdate(deleteSql.toString(), new Object[]{});
- deleteSql.setLength(0);
- //鍐嶅垹闄ゆ彁鍙栨棩蹇楁暟鎹�
- deleteSql.append(" DELETE a FROM product_sys_data_center_log a LEFT JOIN ");
- deleteSql.append(" product_sys_data_center_log b on b.uuid=a.pre_step_uuid and b.type=1 and a.type=2 ");
- deleteSql.append(" where ");
- deleteSql.append(" a.id>= (select ifnull(min(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
- deleteSql.append(" and a.id <= (select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
- deleteSql.append(" and (a.result = 1 or ( a.deal_flag = 1 AND a.deal_result = 1 ) ) ");
- deleteSql.append(" and a.type=2 and b.id is null ");
- deleteSql.append(" and a.uuid not in (").append(sqlFilter).append(") ");
- getBaseDao().executeUpdate(deleteSql.toString(), new Object[]{});
+ //鍒犻櫎鏁版嵁宸叉彃鍏ョ殑鏁版嵁
- deleteSql.setLength(0);
- //鍐嶅垹闄ゅ叾浠栨棩蹇楁暟鎹�
- deleteSql.append(" DELETE FROM product_sys_data_center_log a ");
- deleteSql.append(" where ");
- deleteSql.append(" a.id>= (select ifnull(min(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
- deleteSql.append(" and a.id <= (select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
- deleteSql.append(" and (a.result = 1 or ( a.deal_flag = 1 AND a.deal_result = 1 ) ) ");
- deleteSql.append(" and a.type>2 ");
- deleteSql.append(" and a.uuid not in (").append(sqlFilter).append(") ");
- getBaseDao().executeUpdate(deleteSql.toString());
- }
+ //鏌ヨdata_center_log琛ㄤ腑鐨勫垱寤烘椂闂存槸7澶╁墠鐨勬暟鎹� 涓斿紑濮嬫椂闂存槸dateTime鐨勬暟鎹�
+
+
+ StringBuilder querySql = new StringBuilder(64);
+
+
+ querySql.append("select max(id) max_id,min(id) min_id from product_sys_data_center_log ");
+ querySql.append(" where created_utc_datetime >= str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s') and created_utc_datetime < str_to_date(concat(?, '-01 00:00:00'), '%Y-%m-%d %H:%i:%s')");
+
+
+ querySql.append("select id from ");
+ querySql.append(tableName).append("_").append(DateUtil.format(dateTime, "yyyyMM"));
+ querySql.append(" where type=1 and (result=1 or (deal_flag=1 and deal_result=1))");
+
+
+ deleteSql.setLength(0);
+ //鍐嶅垹闄ゆ彁鍙栨棩蹇楁暟鎹�
+ deleteSql.append(" DELETE a FROM product_sys_data_center_log a LEFT JOIN ");
+ deleteSql.append(" product_sys_data_center_log b on b.uuid=a.pre_step_uuid and b.type=1 and a.type=2 ");
+ deleteSql.append(" where ");
+ deleteSql.append(" a.id>= (select ifnull(min(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
+ deleteSql.append(" and a.id <= (select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
+ deleteSql.append(" and (a.result = 1 or ( a.deal_flag = 1 AND a.deal_result = 1 ) ) ");
+ deleteSql.append(" and a.type=2 and b.id is null ");
+ deleteSql.append(" and a.uuid not in (").append(sqlFilter).append(") ");
+
+ getBaseDao().executeUpdate(deleteSql.toString(), new Object[]{});
+
+ deleteSql.setLength(0);
+ //鍐嶅垹闄ゅ叾浠栨棩蹇楁暟鎹�
+ deleteSql.append(" DELETE FROM product_sys_data_center_log a ");
+ deleteSql.append(" where ");
+ deleteSql.append(" a.id>= (select ifnull(min(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
+ deleteSql.append(" and a.id <= (select ifnull(max(id),0) from " + tableName + "_" + DateUtil.format(dateTime, "yyyyMM") + " ) ");
+ deleteSql.append(" and (a.result = 1 or ( a.deal_flag = 1 AND a.deal_result = 1 ) ) ");
+ deleteSql.append(" and a.type>2 ");
+ deleteSql.append(" and a.uuid not in (").append(sqlFilter).append(") ");
+ getBaseDao().executeUpdate(deleteSql.toString());
+ }
// fs = null;
// do {
@@ -215,419 +433,419 @@
// //妫�鏌ユ槸鍚﹁繕鏈夋暟鎹�
// fs = getBaseDao().getFieldSetEntityBySQL(sql, new Object[]{}, false);
// } while (fs != null && fs.getInteger("del_count") != null && fs.getInteger("del_count") > 0);
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
- }
- }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
- /**
- * 鍒涘缓瀹氭椂浠诲姟
- *
- * @param taskName 浠诲姟鍚嶇О
- * @param isUsed 鏄惁鍚敤
- * @param corn 鎵ц鏃堕棿
- * @param executeExpression 鎵ц琛ㄨ揪寮忥紙bean.method)
- */
- private String createTimeTask(String timeTaskUuid, String taskName, boolean isUsed, String corn, String executeExpression) {
- FieldSetEntity fse = new FieldSetEntity();
- try {
- fse.setTableName("product_sys_timed_task");
- fse.setValue("uuid", timeTaskUuid);
- fse.setValue("job_name", taskName);//浠诲姟鍚嶇О
- fse.setValue("job_group", "system");//鍒嗙粍
- fse.setValue("invoke_target", executeExpression);//璋冪敤鐩爣瀛楃涓�
- fse.setValue("cron_expression", corn);//cron琛ㄨ揪寮�
- fse.setValue("misfire_policy", "3");//閿欒鎵ц绛栫暐 鍙墽琛屼竴娆�
- fse.setValue("concurrent", 0);//涓嶅厑璁稿苟鍙戞墽琛�
- fse.setValue("remark", taskName);
- fse.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
- fse.setValue("created_utc_datetime", new Date());
- fse.setValue("status", isUsed ? 1 : 0);
- fse.setValue("is_conceal", 1);
+ /**
+ * 鍒涘缓瀹氭椂浠诲姟
+ *
+ * @param taskName 浠诲姟鍚嶇О
+ * @param isUsed 鏄惁鍚敤
+ * @param corn 鎵ц鏃堕棿
+ * @param executeExpression 鎵ц琛ㄨ揪寮忥紙bean.method)
+ */
+ private String createTimeTask(String timeTaskUuid, String taskName, boolean isUsed, String corn, String executeExpression) {
+ FieldSetEntity fse = new FieldSetEntity();
+ try {
+ fse.setTableName("product_sys_timed_task");
+ fse.setValue("uuid", timeTaskUuid);
+ fse.setValue("job_name", taskName);//浠诲姟鍚嶇О
+ fse.setValue("job_group", "system");//鍒嗙粍
+ fse.setValue("invoke_target", executeExpression);//璋冪敤鐩爣瀛楃涓�
+ fse.setValue("cron_expression", corn);//cron琛ㄨ揪寮�
+ fse.setValue("misfire_policy", "3");//閿欒鎵ц绛栫暐 鍙墽琛屼竴娆�
+ fse.setValue("concurrent", 0);//涓嶅厑璁稿苟鍙戞墽琛�
+ fse.setValue("remark", taskName);
+ fse.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
+ fse.setValue("created_utc_datetime", new Date());
+ fse.setValue("status", isUsed ? 1 : 0);
+ fse.setValue("is_conceal", 1);
- if (!StringUtils.isEmpty(timeTaskUuid)) {
- BaseUtil.createCreatorAndCreationTime(fse);
- sysJobService.updateJob(fse);
- } else {
- sysJobService.insertJob(fse);
- }
- return fse.getUUID();
- } catch (Exception e) {
- e.printStackTrace();
- throw new BaseException(ErrorCode.CRATED_TIMED_TASK_FAIL);
- }
- }
+ if (!StringUtils.isEmpty(timeTaskUuid)) {
+ BaseUtil.createCreatorAndCreationTime(fse);
+ sysJobService.updateJob(fse);
+ } else {
+ sysJobService.insertJob(fse);
+ }
+ return fse.getUUID();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new BaseException(ErrorCode.CRATED_TIMED_TASK_FAIL);
+ }
+ }
- /**
- * 閫氱敤淇濆瓨
- *
- * @param fse
- * @param t
- */
- private void commonSave(FieldSetEntity fse, CallBackReturnValue<String, FieldSetEntity> t) {
- boolean isAdd = false;
- BaseUtil.createCreatorAndCreationTime(fse);
- if (StringUtils.isEmpty(fse.getUUID())) {
- fse.setValue(CmnConst.UUID, IdUtil.randomUUID());
- isAdd = true;
- } else if (!StringUtils.isEmpty(fse.getUUID()) && "add".equals(fse.getString(CoreConst.SYSTEM_DATA_OPERATE_TYPE))) {
- isAdd = true;
- }
- String timeTasksUid = t.invokeMethod(fse);
- fse.setValue(CmnConst.TIME_TASK_UUID, timeTasksUid);
- if (isAdd) {
- getBaseDao().add(fse);
- } else {
- getBaseDao().update(fse);
- }
- }
+ /**
+ * 閫氱敤淇濆瓨
+ *
+ * @param fse
+ * @param t
+ */
+ private void commonSave(FieldSetEntity fse, CallBackReturnValue<String, FieldSetEntity> t) {
+ boolean isAdd = false;
+ BaseUtil.createCreatorAndCreationTime(fse);
+ if (StringUtils.isEmpty(fse.getUUID())) {
+ fse.setValue(CmnConst.UUID, IdUtil.randomUUID());
+ isAdd = true;
+ } else if (!StringUtils.isEmpty(fse.getUUID()) && "add".equals(fse.getString(CoreConst.SYSTEM_DATA_OPERATE_TYPE))) {
+ isAdd = true;
+ }
+ String timeTasksUid = t.invokeMethod(fse);
+ fse.setValue(CmnConst.TIME_TASK_UUID, timeTasksUid);
+ if (isAdd) {
+ getBaseDao().add(fse);
+ } else {
+ getBaseDao().update(fse);
+ }
+ }
- /**
- * 淇濆瓨MES鏁版嵁鍚屾閰嶇疆
- *
- * @param fse
- * @return
- * @throws BaseException
- */
- @Transactional
- @Override
- public String saveMesSyncDataConfig(FieldSetEntity fse) throws BaseException {
- DataTableEntity subDt = fse.getSubDataTable("product_sys_data_sync_mes_sub");
- //鍥哄畾uuid
- fse.setValue("uuid", 1);
- DataTableEntity dt = getBaseDao().listTable(CmnConst.PRODUCT_MES_DEL_RECORD_CONFIG, "del_type=1");
- DataTableEntity subDataTable = null;
- if (!DataTableEntity.isEmpty(subDt)) {
- subDataTable = subDt.clones();
- int b = 0;
- for (int i = 0; i < subDt.getRows(); i++) {
- FieldSetEntity subFse = subDt.getFieldSetEntity(i);
- String dataType = subFse.getString("~type~");
- String uuid = subFse.getString(CmnConst.UUID);
- if ("del".equals(dataType)) {
- String timeTaskUid = subFse.getString(CmnConst.TIME_TASK_UUID);
- FieldSetEntity task = getBaseDao().getFieldSetEntity("product_sys_timed_task", timeTaskUid, false);
- if (task != null) {
- cancelTimeTask(task);
- }
- subDataTable.setFieldValue(b, "config_uuid", subFse.getUUID());
- } else {
- subFse.setValue("master_uuid", fse.getUUID());
- commonSave(subFse, fs -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "SYNC:" + fs.getString("table_name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("execution_time"), "dataSyncService.runTimeTask('" + fs.getUUID() + "')"));
- subDt.removeFieldSetEntity(i);
- subDataTable.setFieldValue(b, "uuid", subFse.getUUID());
- i--;
- }
- b++;
- }
- if (!DataTableEntity.isEmpty(subDt)) {
- Object[] objects = subDt.getData().stream().map(item -> item.getUUID()).toArray();
- getBaseDao().delete("product_sys_data_sync_mes_sub", objects);
- }
- }
- fse.removeSubData("product_sys_data_sync_mes_sub");
- getBaseDao().saveFieldSetEntity(fse);
- //鍒涘缓瑙﹀彂鍣�
+ /**
+ * 淇濆瓨MES鏁版嵁鍚屾閰嶇疆
+ *
+ * @param fse
+ * @return
+ * @throws BaseException
+ */
+ @Transactional
+ @Override
+ public String saveMesSyncDataConfig(FieldSetEntity fse) throws BaseException {
+ DataTableEntity subDt = fse.getSubDataTable("product_sys_data_sync_mes_sub");
+ //鍥哄畾uuid
+ fse.setValue("uuid", 1);
+ DataTableEntity dt = getBaseDao().listTable(CmnConst.PRODUCT_MES_DEL_RECORD_CONFIG, "del_type=1");
+ DataTableEntity subDataTable = null;
+ if (!DataTableEntity.isEmpty(subDt)) {
+ subDataTable = subDt.clones();
+ int b = 0;
+ for (int i = 0; i < subDt.getRows(); i++) {
+ FieldSetEntity subFse = subDt.getFieldSetEntity(i);
+ String dataType = subFse.getString("~type~");
+ String uuid = subFse.getString(CmnConst.UUID);
+ if ("del".equals(dataType)) {
+ String timeTaskUid = subFse.getString(CmnConst.TIME_TASK_UUID);
+ FieldSetEntity task = getBaseDao().getFieldSetEntity("product_sys_timed_task", timeTaskUid, false);
+ if (task != null) {
+ cancelTimeTask(task);
+ }
+ subDataTable.setFieldValue(b, "config_uuid", subFse.getUUID());
+ } else {
+ subFse.setValue("master_uuid", fse.getUUID());
+ commonSave(subFse, fs -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "SYNC:" + fs.getString("table_name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("execution_time"), "dataSyncService.runTimeTask('" + fs.getUUID() + "')"));
+ subDt.removeFieldSetEntity(i);
+ subDataTable.setFieldValue(b, "uuid", subFse.getUUID());
+ i--;
+ }
+ b++;
+ }
+ if (!DataTableEntity.isEmpty(subDt)) {
+ Object[] objects = subDt.getData().stream().map(item -> item.getUUID()).toArray();
+ getBaseDao().delete("product_sys_data_sync_mes_sub", objects);
+ }
+ }
+ fse.removeSubData("product_sys_data_sync_mes_sub");
+ getBaseDao().saveFieldSetEntity(fse);
+ //鍒涘缓瑙﹀彂鍣�
// //1 涓诲簱鍒犻櫎鍚庡悓姝ュ垹闄ゅ瓙搴�
- syncDelRecordService.createTrigger(subDataTable, fse.getString("data_source"), fse.getString("target_data_source"));
- return fse.getUUID();
- }
+ syncDelRecordService.createTrigger(subDataTable, fse.getString("data_source"), fse.getString("target_data_source"));
+ return fse.getUUID();
+ }
- /**
- * 鍙栨秷瀹氭椂浠诲姟
- *
- * @param fse
- * @throws BaseException
- */
- private void cancelTimeTask(FieldSetEntity fse) throws BaseException {
- try {
- this.sysJobService.deleteJob(fse);
- } catch (Exception e) {
- e.printStackTrace();
- SpringMVCContextHolder.getSystemLogger().error(e);
- throw new BaseException(ErrorCode.CANCEL_TIME_TASK_FAIL);
- }
- }
+ /**
+ * 鍙栨秷瀹氭椂浠诲姟
+ *
+ * @param fse
+ * @throws BaseException
+ */
+ private void cancelTimeTask(FieldSetEntity fse) throws BaseException {
+ try {
+ this.sysJobService.deleteJob(fse);
+ } catch (Exception e) {
+ e.printStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ throw new BaseException(ErrorCode.CANCEL_TIME_TASK_FAIL);
+ }
+ }
- /**
- * 閲囬泦閰嶇疆淇濆瓨
- *
- * @param fse
- * @return
- */
- @Override
- @Transactional
- public synchronized String saveCollectConfig(FieldSetEntity fse) throws BaseException {
- boolean isAdd = false;
- if (StringUtils.isEmpty(fse.getUUID())) {
- if (StringUtils.isEmpty(dataSystemName)) {
- //鏁版嵁鏉ユ簮绯荤粺鍚嶇О涓嶈兘涓虹┖
- throw new BaseException(ErrorCode.DATA_SYSTEM_NAME_CAN_NOT_EMPTY);
- }
- Pattern r = Pattern.compile("^[A-Za-z-]+$");
- Matcher m = r.matcher(dataSystemName);
- if (!m.matches()) {
- //鏁版嵁鏉ユ簮绯荤粺鍚嶇О鏍煎紡涓嶇
- throw new BaseException(ErrorCode.DATA_SYSTEM_NAME_FORMAT_UNQUALIFIED);
- }
- //鏂板
- FieldSetEntity fs = getBaseDao().getFieldSetEntityBySQL("SELECT\n" + "\t ifnull(MAX( id ),0)+1 id " + "FROM\n" + "\t( SELECT CONVERT(REPLACE ( id, ?, '' ),UNSIGNED int) id FROM product_sys_data_collect WHERE id LIKE concat(?,'%') ) a", new Object[]{dataSystemName, dataSystemName}, false);
- if (!FieldSetEntity.isEmpty(fs) && !StringUtils.isEmpty(fs.getString("id"))) {
- String id = fs.getString("id");
- DecimalFormat decimalFormat = new DecimalFormat("000000");
- id = decimalFormat.format(Integer.valueOf(id));
- fse.setValue("id", dataSystemName + id);
- } else {
- throw new BaseException(ErrorCode.UNIQUE_COLLECT_CREATE_FAIL);
- }
- isAdd = true;
- }
+ /**
+ * 閲囬泦閰嶇疆淇濆瓨
+ *
+ * @param fse
+ * @return
+ */
+ @Override
+ @Transactional
+ public synchronized String saveCollectConfig(FieldSetEntity fse) throws BaseException {
+ boolean isAdd = false;
+ if (StringUtils.isEmpty(fse.getUUID())) {
+ if (StringUtils.isEmpty(dataSystemName)) {
+ //鏁版嵁鏉ユ簮绯荤粺鍚嶇О涓嶈兘涓虹┖
+ throw new BaseException(ErrorCode.DATA_SYSTEM_NAME_CAN_NOT_EMPTY);
+ }
+ Pattern r = Pattern.compile("^[A-Za-z-]+$");
+ Matcher m = r.matcher(dataSystemName);
+ if (!m.matches()) {
+ //鏁版嵁鏉ユ簮绯荤粺鍚嶇О鏍煎紡涓嶇
+ throw new BaseException(ErrorCode.DATA_SYSTEM_NAME_FORMAT_UNQUALIFIED);
+ }
+ //鏂板
+ FieldSetEntity fs = getBaseDao().getFieldSetEntityBySQL("SELECT\n" + "\t ifnull(MAX( id ),0)+1 id " + "FROM\n" + "\t( SELECT CONVERT(REPLACE ( id, ?, '' ),UNSIGNED int) id FROM product_sys_data_collect WHERE id LIKE concat(?,'%') ) a", new Object[]{dataSystemName, dataSystemName}, false);
+ if (!FieldSetEntity.isEmpty(fs) && !StringUtils.isEmpty(fs.getString("id"))) {
+ String id = fs.getString("id");
+ DecimalFormat decimalFormat = new DecimalFormat("000000");
+ id = decimalFormat.format(Integer.valueOf(id));
+ fse.setValue("id", dataSystemName + id);
+ } else {
+ throw new BaseException(ErrorCode.UNIQUE_COLLECT_CREATE_FAIL);
+ }
+ isAdd = true;
+ }
- commonSave(fse, (fs) -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "DC:" + fs.getString("name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("frequency"), "dataCollectService.dataCollect('" + fs.getUUID() + "')"));
- saveDelRecordConfig(1, fse.getUUID());
- if (!"ch-kt".equals(dataSystemName)) {
- //瀛愬簱淇濆瓨鍚庡彂閫佸埌涓绘湇鍔�
- fse.setValue(CoreConst.SYSTEM_DATA_OPERATE_TYPE, isAdd ? "add" : "update");
- mesExternalService.remoteSaveCollectConfig(fse);
- }
- return fse.getUUID();
- }
+ commonSave(fse, (fs) -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "DC:" + fs.getString("name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("frequency"), "dataCollectService.dataCollect('" + fs.getUUID() + "')"));
+ saveDelRecordConfig(1, fse.getUUID());
+ if (!"ch-kt".equals(dataSystemName)) {
+ //瀛愬簱淇濆瓨鍚庡彂閫佸埌涓绘湇鍔�
+ fse.setValue(CoreConst.SYSTEM_DATA_OPERATE_TYPE, isAdd ? "add" : "update");
+ mesExternalService.remoteSaveCollectConfig(fse);
+ }
+ return fse.getUUID();
+ }
- /**
- * 閲囬泦閰嶇疆璇︽儏
- *
- * @param fse
- * @return
- */
- @Override
- public FieldSetEntity findCollectConfig(FieldSetEntity fse) throws BaseException {
- return publicService.getFieldSetEntity(fse, false);
- }
+ /**
+ * 閲囬泦閰嶇疆璇︽儏
+ *
+ * @param fse
+ * @return
+ */
+ @Override
+ public FieldSetEntity findCollectConfig(FieldSetEntity fse) throws BaseException {
+ return publicService.getFieldSetEntity(fse, false);
+ }
- /**
- * 閲囬泦閰嶇疆鍒犻櫎
- *
- * @param fse
- */
- @Override
- @Transactional
- public void delCollectConfig(FieldSetEntity fse) throws BaseException {
- String uuids = fse.getUUID();
- String[] split = uuids.split(",");
- DataTableEntity dt = getBaseDao().listTable("product_sys_timed_task", "uuid in " + "(SELECT time_task_uuid FROM product_sys_data_collect WHERE " + BaseUtil.buildQuestionMarkFilter("uuid", split, true) + ")");
- if (!DataTableEntity.isEmpty(dt)) {
- for (int i = 0; i < dt.getRows(); i++) {
- cancelTimeTask(dt.getFieldSetEntity(i));
- }
- }
- for (String s : split) {
- cancelDelRecordConfig(1, s);
- }
- publicService.delete(fse);
- }
+ /**
+ * 閲囬泦閰嶇疆鍒犻櫎
+ *
+ * @param fse
+ */
+ @Override
+ @Transactional
+ public void delCollectConfig(FieldSetEntity fse) throws BaseException {
+ String uuids = fse.getUUID();
+ String[] split = uuids.split(",");
+ DataTableEntity dt = getBaseDao().listTable("product_sys_timed_task", "uuid in " + "(SELECT time_task_uuid FROM product_sys_data_collect WHERE " + BaseUtil.buildQuestionMarkFilter("uuid", split, true) + ")");
+ if (!DataTableEntity.isEmpty(dt)) {
+ for (int i = 0; i < dt.getRows(); i++) {
+ cancelTimeTask(dt.getFieldSetEntity(i));
+ }
+ }
+ for (String s : split) {
+ cancelDelRecordConfig(1, s);
+ }
+ publicService.delete(fse);
+ }
- /**
- * 鎻愬彇閰嶇疆淇濆瓨
- *
- * @param fse
- * @return
- */
- @Override
- @Transactional
- public String saveExtractConfig(FieldSetEntity fse) throws BaseException {
- boolean isAdd = !StringUtils.isEmpty(fse.getUUID());
- commonSave(fse, (fs) -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "DE:" + fs.getString("extract_name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("extract_time"), "dataExtractService.startExtractData('" + fs.getUUID() + "')"));
- saveDelRecordConfig(2, fse.getUUID());
- if ("ch-kt".equals(dataSystemName)) {
- //涓绘湇鍔′繚瀛樺悗鍒嗗彂鍒板瓙鏈嶅姟涓�
- fse.setValue(CoreConst.SYSTEM_DATA_OPERATE_TYPE, isAdd ? "add" : "update");
- mesExternalService.remoteSaveExtractConfig(fse);
- }
- return fse.getUUID();
- }
+ /**
+ * 鎻愬彇閰嶇疆淇濆瓨
+ *
+ * @param fse
+ * @return
+ */
+ @Override
+ @Transactional
+ public String saveExtractConfig(FieldSetEntity fse) throws BaseException {
+ boolean isAdd = !StringUtils.isEmpty(fse.getUUID());
+ commonSave(fse, (fs) -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "DE:" + fs.getString("extract_name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("extract_time"), "dataExtractService.startExtractData('" + fs.getUUID() + "')"));
+ saveDelRecordConfig(2, fse.getUUID());
+ if ("ch-kt".equals(dataSystemName)) {
+ //涓绘湇鍔′繚瀛樺悗鍒嗗彂鍒板瓙鏈嶅姟涓�
+ fse.setValue(CoreConst.SYSTEM_DATA_OPERATE_TYPE, isAdd ? "add" : "update");
+ mesExternalService.remoteSaveExtractConfig(fse);
+ }
+ return fse.getUUID();
+ }
- /**
- * 鎻愬彇閰嶇疆鏌ヨ
- *
- * @param fse
- * @return
- */
- @Override
- public FieldSetEntity findExtractConfig(FieldSetEntity fse) throws BaseException {
- return publicService.getFieldSetEntity(fse, true);
- }
+ /**
+ * 鎻愬彇閰嶇疆鏌ヨ
+ *
+ * @param fse
+ * @return
+ */
+ @Override
+ public FieldSetEntity findExtractConfig(FieldSetEntity fse) throws BaseException {
+ return publicService.getFieldSetEntity(fse, true);
+ }
- /**
- * 鎻愬彇閰嶇疆鍒犻櫎
- *
- * @param fse
- */
- @Override
- @Transactional
- public void delExtractConfig(FieldSetEntity fse) throws BaseException {
- String uuids = fse.getUUID();
- String[] split = uuids.split(",");
- DataTableEntity dt = getBaseDao().listTable("product_sys_timed_task", "uuid in " + "(SELECT time_task_uuid FROM product_sys_data_extract_config WHERE " + BaseUtil.buildQuestionMarkFilter("uuid", split, true) + ")");
- if (!DataTableEntity.isEmpty(dt)) {
- for (int i = 0; i < dt.getRows(); i++) {
- cancelTimeTask(dt.getFieldSetEntity(i));
- }
- }
- for (String s : split) {
- cancelDelRecordConfig(2, s);
- }
- publicService.delete(fse);
- }
+ /**
+ * 鎻愬彇閰嶇疆鍒犻櫎
+ *
+ * @param fse
+ */
+ @Override
+ @Transactional
+ public void delExtractConfig(FieldSetEntity fse) throws BaseException {
+ String uuids = fse.getUUID();
+ String[] split = uuids.split(",");
+ DataTableEntity dt = getBaseDao().listTable("product_sys_timed_task", "uuid in " + "(SELECT time_task_uuid FROM product_sys_data_extract_config WHERE " + BaseUtil.buildQuestionMarkFilter("uuid", split, true) + ")");
+ if (!DataTableEntity.isEmpty(dt)) {
+ for (int i = 0; i < dt.getRows(); i++) {
+ cancelTimeTask(dt.getFieldSetEntity(i));
+ }
+ }
+ for (String s : split) {
+ cancelDelRecordConfig(2, s);
+ }
+ publicService.delete(fse);
+ }
- /**
- * 褰掓。閰嶇疆淇濆瓨
- *
- * @param fse
- * @return
- */
- @Override
- @Transactional
- public String saveArchivingConfig(FieldSetEntity fse) throws BaseException {
- String sourceDataSource = fse.getString("source_data_source");
- String targetDataSource = fse.getString("target_data_source");
- String[] dataSource = (sourceDataSource + "," + targetDataSource).split(",");
- StringBuilder sql = new StringBuilder();
- sql.append("SELECT db_type num FROM product_sys_data_sync_manager WHERE ");
- sql.append(BaseUtil.buildQuestionMarkFilter("uuid", dataSource.length, true));
- sql.append(" GROUP BY db_type ");
- DataTableEntity dt = getBaseDao().listTable(sql.toString(), dataSource);
- if (DataTableEntity.isEmpty(dt)) {
- throw new BaseException(ErrorCode.VERIFY_DATA_SOURCE_TYPE_FAIL);
- }
+ /**
+ * 褰掓。閰嶇疆淇濆瓨
+ *
+ * @param fse
+ * @return
+ */
+ @Override
+ @Transactional
+ public String saveArchivingConfig(FieldSetEntity fse) throws BaseException {
+ String sourceDataSource = fse.getString("source_data_source");
+ String targetDataSource = fse.getString("target_data_source");
+ String[] dataSource = (sourceDataSource + "," + targetDataSource).split(",");
+ StringBuilder sql = new StringBuilder();
+ sql.append("SELECT db_type num FROM product_sys_data_sync_manager WHERE ");
+ sql.append(BaseUtil.buildQuestionMarkFilter("uuid", dataSource.length, true));
+ sql.append(" GROUP BY db_type ");
+ DataTableEntity dt = getBaseDao().listTable(sql.toString(), dataSource);
+ if (DataTableEntity.isEmpty(dt)) {
+ throw new BaseException(ErrorCode.VERIFY_DATA_SOURCE_TYPE_FAIL);
+ }
/* 2022骞�10鏈�10鏃� 15:33:47 6c 闇�瑕佽兘澶熸敮鎸佷笉鍚屾暟鎹簱闂寸殑褰掓。
if (dt.getRows() != 1) {
throw new BaseException(ErrorCode.DATA_SOURCE_INCONFORMITY);
}*/
- if (StringUtils.equalsAny(dt.getString(0, "num"), "0", "1", "5")) {
- boolean isAdd = !StringUtils.isEmpty(fse.getUUID());
- commonSave(fse, (fs) -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "DA:" + fs.getString("name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("execute_time"), "dataArchivingService.dataArchivingEntry('" + fs.getUUID() + "')"));
- if ("ch-kt".equals(dataSystemName)) {
- //涓绘湇鍔′繚瀛樺悗鍒嗗彂鍒板瓙鏈嶅姟涓�
- fse.setValue(CoreConst.SYSTEM_DATA_OPERATE_TYPE, isAdd ? "add" : "update");
- mesExternalService.remoteSaveArchiveConfig(fse);
- }
- }
+ if (StringUtils.equalsAny(dt.getString(0, "num"), "0", "1", "5")) {
+ boolean isAdd = !StringUtils.isEmpty(fse.getUUID());
+ commonSave(fse, (fs) -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "DA:" + fs.getString("name"), fs.getBoolean(CmnConst.IS_USED), fs.getString("execute_time"), "dataArchivingService.dataArchivingEntry('" + fs.getUUID() + "')"));
+ if ("ch-kt".equals(dataSystemName)) {
+ //涓绘湇鍔′繚瀛樺悗鍒嗗彂鍒板瓙鏈嶅姟涓�
+ fse.setValue(CoreConst.SYSTEM_DATA_OPERATE_TYPE, isAdd ? "add" : "update");
+ mesExternalService.remoteSaveArchiveConfig(fse);
+ }
+ }
- return fse.getUUID();
- }
+ return fse.getUUID();
+ }
- /**
- * 褰掓。閰嶇疆璇︽儏
- *
- * @param fse
- * @return
- */
- @Override
- public FieldSetEntity findArchivingConfig(FieldSetEntity fse) throws BaseException {
- return publicService.getFieldSetEntity(fse, false);
- }
+ /**
+ * 褰掓。閰嶇疆璇︽儏
+ *
+ * @param fse
+ * @return
+ */
+ @Override
+ public FieldSetEntity findArchivingConfig(FieldSetEntity fse) throws BaseException {
+ return publicService.getFieldSetEntity(fse, false);
+ }
- /**
- * 褰掓。閰嶇疆鍒犻櫎
- *
- * @param fse
- */
- @Override
- @Transactional
- public void delArchivingConfig(FieldSetEntity fse) throws BaseException {
- String uuids = fse.getUUID();
- String[] split = uuids.split(",");
- DataTableEntity dt = getBaseDao().listTable("product_sys_timed_task", "uuid in " + "(SELECT time_task_uuid FROM product_sys_data_archiving_config WHERE " + BaseUtil.buildQuestionMarkFilter("uuid", split, true) + ")");
- if (!DataTableEntity.isEmpty(dt)) {
- for (int i = 0; i < dt.getRows(); i++) {
- cancelTimeTask(dt.getFieldSetEntity(i));
- }
- }
- publicService.delete(fse);
- }
+ /**
+ * 褰掓。閰嶇疆鍒犻櫎
+ *
+ * @param fse
+ */
+ @Override
+ @Transactional
+ public void delArchivingConfig(FieldSetEntity fse) throws BaseException {
+ String uuids = fse.getUUID();
+ String[] split = uuids.split(",");
+ DataTableEntity dt = getBaseDao().listTable("product_sys_timed_task", "uuid in " + "(SELECT time_task_uuid FROM product_sys_data_archiving_config WHERE " + BaseUtil.buildQuestionMarkFilter("uuid", split, true) + ")");
+ if (!DataTableEntity.isEmpty(dt)) {
+ for (int i = 0; i < dt.getRows(); i++) {
+ cancelTimeTask(dt.getFieldSetEntity(i));
+ }
+ }
+ publicService.delete(fse);
+ }
- /**
- * 璁㈠崟鏁版嵁楠岃瘉閰嶇疆淇濆瓨
- *
- * @param fse
- * @return
- */
- @Transactional
- @Override
- public String saveOrderDataVerification(FieldSetEntity fse) {
- fse.setValue(CmnConst.UUID, "1");
- commonSave(fse, fs -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "璁㈠崟鏁版嵁鍚屾楠岃瘉", fs.getBoolean(CmnConst.IS_USED), fs.getString("frequency_verification"), "orderDataValidationService.verificationEntryPoint"));
- return fse.getUUID();
- }
+ /**
+ * 璁㈠崟鏁版嵁楠岃瘉閰嶇疆淇濆瓨
+ *
+ * @param fse
+ * @return
+ */
+ @Transactional
+ @Override
+ public String saveOrderDataVerification(FieldSetEntity fse) {
+ fse.setValue(CmnConst.UUID, "1");
+ commonSave(fse, fs -> createTimeTask(fs.getString(CmnConst.TIME_TASK_UUID), "璁㈠崟鏁版嵁鍚屾楠岃瘉", fs.getBoolean(CmnConst.IS_USED), fs.getString("frequency_verification"), "orderDataValidationService.verificationEntryPoint"));
+ return fse.getUUID();
+ }
- /**
- * 淇濆瓨鍒犻櫎璁板綍閰嶇疆
- *
- * @param type
- * @param uuid
- */
- public void saveDelRecordConfig(int type, String uuid) {
- String sql = getDelRecordSql(type);
+ /**
+ * 淇濆瓨鍒犻櫎璁板綍閰嶇疆
+ *
+ * @param type
+ * @param uuid
+ */
+ public void saveDelRecordConfig(int type, String uuid) {
+ String sql = getDelRecordSql(type);
- DataTableEntity dt = getBaseDao().listTable(sql, new Object[]{uuid, dataSystemName});
- for (int i = 0; i < dt.getRows(); i++) {
- FieldSetEntity fse = dt.getFieldSetEntity(i);
- fse.setTableName(CmnConst.PRODUCT_MES_DEL_RECORD_CONFIG);
- fse.setValue("delete_sync_content", 1);
- syncDelRecordService.createTrigger(fse);
- }
+ DataTableEntity dt = getBaseDao().listTable(sql, new Object[]{uuid, dataSystemName});
+ for (int i = 0; i < dt.getRows(); i++) {
+ FieldSetEntity fse = dt.getFieldSetEntity(i);
+ fse.setTableName(CmnConst.PRODUCT_MES_DEL_RECORD_CONFIG);
+ fse.setValue("delete_sync_content", 1);
+ syncDelRecordService.createTrigger(fse);
+ }
- }
+ }
- private String getDelRecordSql(int type) {
- StringBuffer sql = new StringBuffer();
- sql.append("\n SELECT ");
- sql.append("\n c.uuid, ");
- sql.append("\n c.random_suffix,");
- sql.append("\n collect.uuid config_uuid, ");
- sql.append("\n collect.data_source, ");
- sql.append("\n extract.extract_target_source target_data_source, ");
- sql.append("\n collect.auto_field master_key_field, ");
- sql.append("\n collect.source_table table_name, ");
- sql.append("\n collect.id collect_id,2 del_type, ");
- sql.append("\n extract.collect_source_field collect_field,");
- sql.append("\n extract.extract_unique_field pre_master_field");
- sql.append("\n FROM ");
- sql.append("\n product_sys_data_collect collect ");
- sql.append("\n JOIN product_sys_data_extract_config extract ON upper( case when length(collect.target_table)>0 then collect.target_table else collect.source_table end ) = upper( extract.extract_source_table ) ");
- sql.append("\n LEFT JOIN product_mes_del_record_config c ON collect.uuid=c.config_uuid and c.del_type=2 ");
- sql.append(" WHERE ");
- if (1 == type) {
- //閲囬泦
- sql.append("\n collect.uuid=? ");
- } else {
- //鎻愬彇
- sql.append("\n extract.uuid=? ");
- }
- sql.append(" and collect.id like concat(?,'%')");
- return sql.toString();
- }
+ private String getDelRecordSql(int type) {
+ StringBuffer sql = new StringBuffer();
+ sql.append("\n SELECT ");
+ sql.append("\n c.uuid, ");
+ sql.append("\n c.random_suffix,");
+ sql.append("\n collect.uuid config_uuid, ");
+ sql.append("\n collect.data_source, ");
+ sql.append("\n extract.extract_target_source target_data_source, ");
+ sql.append("\n collect.auto_field master_key_field, ");
+ sql.append("\n collect.source_table table_name, ");
+ sql.append("\n collect.id collect_id,2 del_type, ");
+ sql.append("\n extract.collect_source_field collect_field,");
+ sql.append("\n extract.extract_unique_field pre_master_field");
+ sql.append("\n FROM ");
+ sql.append("\n product_sys_data_collect collect ");
+ sql.append("\n JOIN product_sys_data_extract_config extract ON upper( case when length(collect.target_table)>0 then collect.target_table else collect.source_table end ) = upper( extract.extract_source_table ) ");
+ sql.append("\n LEFT JOIN product_mes_del_record_config c ON collect.uuid=c.config_uuid and c.del_type=2 ");
+ sql.append(" WHERE ");
+ if (1 == type) {
+ //閲囬泦
+ sql.append("\n collect.uuid=? ");
+ } else {
+ //鎻愬彇
+ sql.append("\n extract.uuid=? ");
+ }
+ sql.append(" and collect.id like concat(?,'%')");
+ return sql.toString();
+ }
- public void cancelDelRecordConfig(int type, String uuid) {
- FieldSetEntity fieldSetEntity = new FieldSetEntity();
- fieldSetEntity.setTableName("temp");
- if (type == 1) {
- fieldSetEntity.setValue("uuid", uuid);
- syncDelRecordService.deleteTrigger(fieldSetEntity);
- } else {
- //鎻愬彇
- DataTableEntity dt = getBaseDao().listTable(CmnConst.PRODUCT_SYS_DATA_COLLECT, "UPPER(source_table) in (select upper(extract_source_table) from product_sys_data_extract_config where uuid =?) ", new Object[]{uuid});
- if (DataTableEntity.isEmpty(dt)) {
- return;
- }
- Object[] uuids = dt.getUuids();
- for (Object o : uuids) {
- fieldSetEntity.setValue("uuid", o);
- syncDelRecordService.deleteTrigger(fieldSetEntity);
- }
- }
+ public void cancelDelRecordConfig(int type, String uuid) {
+ FieldSetEntity fieldSetEntity = new FieldSetEntity();
+ fieldSetEntity.setTableName("temp");
+ if (type == 1) {
+ fieldSetEntity.setValue("uuid", uuid);
+ syncDelRecordService.deleteTrigger(fieldSetEntity);
+ } else {
+ //鎻愬彇
+ DataTableEntity dt = getBaseDao().listTable(CmnConst.PRODUCT_SYS_DATA_COLLECT, "UPPER(source_table) in (select upper(extract_source_table) from product_sys_data_extract_config where uuid =?) ", new Object[]{uuid});
+ if (DataTableEntity.isEmpty(dt)) {
+ return;
+ }
+ Object[] uuids = dt.getUuids();
+ for (Object o : uuids) {
+ fieldSetEntity.setValue("uuid", o);
+ syncDelRecordService.deleteTrigger(fieldSetEntity);
+ }
+ }
- }
+ }
}
--
Gitblit v1.9.2