1、代码提交
This commit is contained in:
parent
d568c97995
commit
2748b84363
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -298,12 +298,12 @@ public class WaterproofPaintAccountsReceivableJob implements IJob {
|
|||||||
" WHERE XSZZ IN (" + inSaleOrgs + ") " +
|
" WHERE XSZZ IN (" + inSaleOrgs + ") " +
|
||||||
" AND FCUSTNAME IN (" + inCustNames + ") " +
|
" AND FCUSTNAME IN (" + inCustNames + ") " +
|
||||||
" AND (" + dateCondition + ") ";
|
" AND (" + dateCondition + ") ";
|
||||||
// if (bkgs.equals("北新防水")){
|
if (bkgs.equals("北新防水")){
|
||||||
// sql += " AND XSZZ !='北新防水工程(辽宁)有限公司' " +
|
sql += " AND XSZZ !='北新防水工程(辽宁)有限公司' " +
|
||||||
// "AND XSZZ != '北新防水工程(四川)有限公司' AND F_SFNBJY ='是'";
|
"AND XSZZ != '北新防水工程(四川)有限公司' AND F_SFNBJY ='是'";
|
||||||
// }else {
|
}else {
|
||||||
// sql += " AND F_SFNBJY ='是'";
|
sql += " AND F_SFNBJY ='是'";
|
||||||
// }
|
}
|
||||||
sql += " GROUP BY XSZZ, FCUSTNAME, DATE_FORMAT(DZRQ, '%Y-%m-%d')";
|
sql += " GROUP BY XSZZ, FCUSTNAME, DATE_FORMAT(DZRQ, '%Y-%m-%d')";
|
||||||
// LOGGER.info("应收单数据sql = " + sql);
|
// LOGGER.info("应收单数据sql = " + sql);
|
||||||
List<RowMap> queryResults = DBSql.getMaps(sql);
|
List<RowMap> queryResults = DBSql.getMaps(sql);
|
||||||
@ -355,12 +355,12 @@ public class WaterproofPaintAccountsReceivableJob implements IJob {
|
|||||||
" WHERE FSALEORGUNIT IN (" + inSaleOrgs + ") " +
|
" WHERE FSALEORGUNIT IN (" + inSaleOrgs + ") " +
|
||||||
" AND FCUSTNAME IN (" + inCustNames + ") " +
|
" AND FCUSTNAME IN (" + inCustNames + ") " +
|
||||||
" AND (" + dateCondition + ") ";
|
" AND (" + dateCondition + ") ";
|
||||||
// if (bkgs.equals("北新防水")){
|
if (bkgs.equals("北新防水")){
|
||||||
// sql += " AND FSALEORGUNIT !='北新防水工程(辽宁)有限公司' " +
|
sql += " AND FSALEORGUNIT !='北新防水工程(辽宁)有限公司' " +
|
||||||
// "AND FSALEORGUNIT != '北新防水工程(四川)有限公司' AND F_SFNBJY ='是'";
|
"AND FSALEORGUNIT != '北新防水工程(四川)有限公司' AND F_SFNBJY ='是'";
|
||||||
// }else {
|
}else {
|
||||||
// sql += " AND F_SFNBJY ='是'";
|
sql += " AND F_SFNBJY ='是'";
|
||||||
// }
|
}
|
||||||
sql += " GROUP BY FSALEORGUNIT, FCUSTNAME, DATE_FORMAT(FBILLDATE, '%Y-%m-%d')";
|
sql += " GROUP BY FSALEORGUNIT, FCUSTNAME, DATE_FORMAT(FBILLDATE, '%Y-%m-%d')";
|
||||||
|
|
||||||
// LOGGER.info("收款单数据sql = " + sql);
|
// LOGGER.info("收款单数据sql = " + sql);
|
||||||
@ -413,12 +413,12 @@ public class WaterproofPaintAccountsReceivableJob implements IJob {
|
|||||||
" WHERE FSALEORGUNIT IN (" + inSaleOrgs + ") " +
|
" WHERE FSALEORGUNIT IN (" + inSaleOrgs + ") " +
|
||||||
" AND FCUSTNAME IN (" + inCustNames + ") " +
|
" AND FCUSTNAME IN (" + inCustNames + ") " +
|
||||||
" AND (" + dateCondition + ") ";
|
" AND (" + dateCondition + ") ";
|
||||||
// if (bkgs.equals("北新防水")){
|
if (bkgs.equals("北新防水")){
|
||||||
// sql += " AND FSALEORGUNIT !='北新防水工程(辽宁)有限公司' " +
|
sql += " AND FSALEORGUNIT !='北新防水工程(辽宁)有限公司' " +
|
||||||
// "AND FSALEORGUNIT != '北新防水工程(四川)有限公司' AND F_SFNBJY ='是'";
|
"AND FSALEORGUNIT != '北新防水工程(四川)有限公司' AND F_SFNBJY ='是'";
|
||||||
// }else {
|
}else {
|
||||||
// sql += " AND F_SFNBJY ='是'";
|
sql += " AND F_SFNBJY ='是'";
|
||||||
// }
|
}
|
||||||
sql += " GROUP BY FSALEORGUNIT, FCUSTNAME, DATE_FORMAT(FBILLDATE, '%Y-%m-%d')";
|
sql += " GROUP BY FSALEORGUNIT, FCUSTNAME, DATE_FORMAT(FBILLDATE, '%Y-%m-%d')";
|
||||||
|
|
||||||
// LOGGER.info("收款退款单数据sql = " + sql);
|
// LOGGER.info("收款退款单数据sql = " + sql);
|
||||||
|
|||||||
@ -16,6 +16,8 @@ import java.time.LocalDate;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName: YyglbDbHtJob
|
* @ClassName: YyglbDbHtJob
|
||||||
@ -46,16 +48,27 @@ public class YyglbDbHtJob implements IJob {
|
|||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
LOGGER.error("删除运营_物料单耗出库表出错,删除范围为:{}-{}:e",year,monthValue,e.getLocalizedMessage());
|
LOGGER.error("删除运营_物料单耗出库表出错,删除范围为:{}-{}:e",year,monthValue,e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
List<RowMap> maps1 = DBSql.getMaps("SELECT FLZZ FROM BO_EU_BNBM_SCCK_HZ GROUP BY FLZZ");
|
|
||||||
try {
|
try {
|
||||||
for (String bkgs : bkgsArr) {
|
for (String bkgs : bkgsArr) {
|
||||||
|
List<RowMap> maps1 = DBSql.getMaps("SELECT FLZZ FROM BO_EU_BNBM_SCCK_HZ WHERE BKGS = '"+bkgs+"' " +
|
||||||
|
" AND (DJZT = '已审核' OR DJZT = '签字')" +
|
||||||
|
" AND YEAR = '" + year + "' AND MONTH = '" + monthValue + "' GROUP BY FLZZ");
|
||||||
for (RowMap map2 : maps1) {
|
for (RowMap map2 : maps1) {
|
||||||
BO bo = new BO();
|
BO bo = new BO();
|
||||||
for (String wlmckey : wlmcMap.keySet()) {
|
for (String wlmckey : wlmcMap.keySet()) {
|
||||||
String wlmcValue = wlmcMap.get(wlmckey);
|
String wlmcValue = wlmcMap.get(wlmckey);
|
||||||
RowMap map = DBSql.getMap("SELECT SUM(SFSL) AS SFSL FROM BO_EU_BNBM_SCCK_HZ WHERE BKGS = '" + bkgs + "' AND (DJZT = '已审核' OR DJZT = '签字') " +
|
String sql = "SELECT SUM(SFSL) AS SFSL FROM BO_EU_BNBM_SCCK_HZ WHERE BKGS = '" + bkgs + "' AND (DJZT = '已审核' OR DJZT = '签字') " +
|
||||||
" AND YEAR = '" + year + "' AND MONTH = '" + monthValue + "' AND WLMC LIKE '%" + wlmckey + "%' " +
|
" AND YEAR = '" + year + "' AND MONTH = '" + monthValue + "'" +
|
||||||
" AND FLZZ = '"+map2.getString("FLZZ")+"'");
|
" AND FLZZ = '"+map2.getString("FLZZ")+"'";
|
||||||
|
if (wlmckey.equals("石膏")){
|
||||||
|
sql+=" AND WLMC IN ('脱硫石膏','磷石膏','天然石膏')";
|
||||||
|
}else {
|
||||||
|
sql+=" AND WLMC LIKE '%" + wlmckey + "%' ";
|
||||||
|
}
|
||||||
|
if (bkgs.equals("泰山石膏")){
|
||||||
|
sql+="AND SCBM NOT LIKE '%穿孔板%' AND SCBM NOT LIKE '%装饰板%'";
|
||||||
|
}
|
||||||
|
RowMap map = DBSql.getMap(sql);
|
||||||
bo.set(wlmcValue,map.getString("SFSL"));
|
bo.set(wlmcValue,map.getString("SFSL"));
|
||||||
if (StringUtils.isNotBlank(map2.getString("FLZZ"))){
|
if (StringUtils.isNotBlank(map2.getString("FLZZ"))){
|
||||||
bo.set("FLZZ",map2.getString("FLZZ"));
|
bo.set("FLZZ",map2.getString("FLZZ"));
|
||||||
@ -83,10 +96,130 @@ public class YyglbDbHtJob implements IJob {
|
|||||||
boList.add(bo);
|
boList.add(bo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<BO> zzwhb = SDK.getBOAPI().query("BO_EU_BNBM_ZZWHB").list();
|
||||||
|
Map<String, BO> zzwhbMap = zzwhb.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
bo -> bo.getString("GSMC"), // Key映射器
|
||||||
|
bo -> bo, // Value映射器
|
||||||
|
(existing, replacement) -> replacement // 重复键处理策略
|
||||||
|
));
|
||||||
SDK.getBOAPI().createDataBO("BO_EU_YY_WLDHCKB",boList, UserContext.fromUID("admin"));
|
SDK.getBOAPI().createDataBO("BO_EU_YY_WLDHCKB",boList, UserContext.fromUID("admin"));
|
||||||
|
|
||||||
|
for (BO bo : boList) {
|
||||||
|
String nf = bo.getString("NF");
|
||||||
|
String yf = bo.getString("YF");
|
||||||
|
String bk = bo.getString("BK");
|
||||||
|
BO flzz = zzwhbMap.get(bo.getString("FLZZ"));
|
||||||
|
if (flzz!=null) {
|
||||||
|
BO detail = SDK.getBOAPI().query("BO_EU_YYGLB_DB_SGBYDDF_XMDBZ").addQuery("NF=", nf)
|
||||||
|
.addQuery("YF=", yf).addQuery("BK=", bk).addQuery("XM =", flzz.getString("JC")).detail();
|
||||||
|
try {
|
||||||
|
// 安全解析数值,添加异常处理
|
||||||
|
Double hmz = 0.00;
|
||||||
|
Double sg = 0.00;
|
||||||
|
Double mei = 0.00;
|
||||||
|
Double sgbzbcl = 0.00;
|
||||||
|
|
||||||
|
try {
|
||||||
|
hmz = StringUtils.isNotBlank(bo.getString("HMZ")) ? Double.parseDouble(bo.getString("HMZ").trim()) : 0.00;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
LOGGER.warn("HMZ格式错误,使用默认值0.00,原始值: {}", bo.getString("HMZ"));
|
||||||
|
hmz = 0.00;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
sg = StringUtils.isNotBlank(bo.getString("SG")) ? Double.parseDouble(bo.getString("SG").trim()) : 0.00;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
LOGGER.warn("SG格式错误,使用默认值0.00,原始值: {}", bo.getString("SG"));
|
||||||
|
sg = 0.00;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mei = StringUtils.isNotBlank(bo.getString("MEI")) ? Double.parseDouble(bo.getString("MEI").trim()) : 0.00;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
LOGGER.warn("MEI格式错误,使用默认值0.00,原始值: {}", bo.getString("MEI"));
|
||||||
|
mei = 0.00;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
sgbzbcl = StringUtils.isNotBlank(bo.getString("SGBZBCL")) ? Double.parseDouble(bo.getString("SGBZBCL").trim()) : 0.00;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
LOGGER.warn("SGBZBCL格式错误,使用默认值0.00,原始值: {}", bo.getString("SGBZBCL"));
|
||||||
|
sgbzbcl = 0.00;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查detail对象是否为空
|
||||||
|
if (detail == null) {
|
||||||
|
LOGGER.error("detail对象为null,无法进行计算和更新");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查flzz对象和JC字段
|
||||||
|
String jcValue = "";
|
||||||
|
if (flzz != null && StringUtils.isNotBlank(flzz.getString("JC"))) {
|
||||||
|
jcValue = flzz.getString("JC");
|
||||||
|
} else {
|
||||||
|
LOGGER.warn("flzz或JC字段为空,使用空字符串");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info("nf:{};yf:{};bk:{};jc:{};hmz:{};sg:{};mei:{};sgbzbcl:{}",
|
||||||
|
nf, yf, bk, jcValue, hmz, sg, mei, sgbzbcl);
|
||||||
|
|
||||||
|
if (sgbzbcl != null && sgbzbcl != 0.00) {
|
||||||
|
// 安全处理hmz
|
||||||
|
if (hmz != null && hmz != 0.00) {
|
||||||
|
double result = (hmz*1000000) / sgbzbcl;
|
||||||
|
detail.set("HMZ", result);
|
||||||
|
LOGGER.debug("HMZ计算结果: {} / {} = {}", hmz, sgbzbcl, result);
|
||||||
|
} else {
|
||||||
|
detail.set("HMZ", 0.00);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 安全处理sg
|
||||||
|
if (sg != null && sg != 0.00) {
|
||||||
|
double result = (sg*1000) / sgbzbcl;
|
||||||
|
detail.set("SG", result);
|
||||||
|
LOGGER.debug("SG计算结果: {} / {} = {}", sg, sgbzbcl, result);
|
||||||
|
} else {
|
||||||
|
detail.set("SG", 0.00);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 安全处理mei
|
||||||
|
if (mei != null && mei != 0.00) {
|
||||||
|
double result = (mei*1000) / sgbzbcl;
|
||||||
|
detail.set("MH", result);
|
||||||
|
LOGGER.debug("MH计算结果: {} / {} = {}", mei, sgbzbcl, result);
|
||||||
|
} else {
|
||||||
|
detail.set("MH", 0.00);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加数据库更新前的日志和异常处理
|
||||||
|
try {
|
||||||
|
SDK.getBOAPI().update("BO_EU_YYGLB_DB_SGBYDDF_XMDBZ", detail);
|
||||||
|
LOGGER.info("单耗对标计算成功更新,nf:{};yf:{};bk:{}", nf, yf, bk);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("更新数据库失败,nf:{};yf:{};bk:{};错误信息:{}",
|
||||||
|
nf, yf, bk, e.getMessage(), e);
|
||||||
|
// 可以根据需要决定是否抛出异常
|
||||||
|
throw new RuntimeException("数据库更新失败: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOGGER.warn("sgbzbcl为0或null,跳过计算,nf:{};yf:{};bk:{}", nf, yf, bk);
|
||||||
|
// 设置默认值
|
||||||
|
detail.set("HMZ", 0.00);
|
||||||
|
detail.set("SG", 0.00);
|
||||||
|
detail.set("MH", 0.00);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("单耗对标计算报错,错误时间范围为:{}-{},错误信息:{}",
|
||||||
|
nf, yf, e.getMessage(), e);
|
||||||
|
throw e; // 重新抛出异常
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
LOGGER.info("单耗对标计算完成时间范围为:{}-{}",year,monthValue);
|
LOGGER.info("单耗对标计算完成时间范围为:{}-{}",year,monthValue);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
LOGGER.error("单耗对标计算报错,错误时间范围为:{}-{}:{}",year,monthValue,e.getLocalizedMessage());
|
LOGGER.error("单耗对标计算报错,错误时间范围为:{}-{}:{}",year,monthValue,e.fillInStackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -207,6 +207,7 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
public void querySourceData(String ccId, String tableName,
|
public void querySourceData(String ccId, String tableName,
|
||||||
String timeField, Date startDated, Date endDated,String partitionField,
|
String timeField, Date startDated, Date endDated,String partitionField,
|
||||||
List<BO> fieldMappings, String targetTable,String jezd) {
|
List<BO> fieldMappings, String targetTable,String jezd) {
|
||||||
|
// LOGGER.info("ccId:{},tableName:{},timeField:{},startDated:{},endDated:{},partitionField:{},fieldMappings:{},targetTable:{},jezd:{}",ccId,tableName,timeField,startDated,endDated,partitionField,Arrays.asList(fieldMappings.toArray()),targetTable,jezd);
|
||||||
int totalRows = 0; // 总查询行数
|
int totalRows = 0; // 总查询行数
|
||||||
int totalSuccess = 0; // 总成功插入行数
|
int totalSuccess = 0; // 总成功插入行数
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
@ -239,12 +240,12 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
ccId, result, maxRetries, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), e.getMessage());
|
ccId, result, maxRetries, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), e.getMessage());
|
||||||
LOGGER.error(errorMsg, e);
|
LOGGER.error(errorMsg, e);
|
||||||
// 发送邮件通知
|
// 发送邮件通知
|
||||||
boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
// boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
||||||
if (eMailSync){
|
// if (eMailSync){
|
||||||
LOGGER.info("短信发送成功");
|
// LOGGER.info("短信发送成功");
|
||||||
}else {
|
// }else {
|
||||||
LOGGER.info("短信发送失败");
|
// LOGGER.info("短信发送失败");
|
||||||
}
|
// }
|
||||||
throw new RuntimeException(errorMsg, e);
|
throw new RuntimeException(errorMsg, e);
|
||||||
}
|
}
|
||||||
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
||||||
@ -775,6 +776,7 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void summarizeScopeData(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
public void summarizeScopeData(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
||||||
|
// LOGGER.info("targetTable:{},startDated:{},endDated:{},targetTimeField:{},hzb:{}",targetTable,startDated,endDated,targetTimeField,hzb);
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
boolean hasMore;
|
boolean hasMore;
|
||||||
String pageSql = "";
|
String pageSql = "";
|
||||||
@ -857,13 +859,15 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
hasMore = pageData.size() == PAGE_SIZE;
|
hasMore = pageData.size() == PAGE_SIZE;
|
||||||
pageNo++;
|
pageNo++;
|
||||||
} while (hasMore);
|
} while (hasMore);
|
||||||
int update = DBSql.update("UPDATE BO_EU_BNBM_SCRK_HZ a" +
|
if (hzb.equals("BO_EU_BNBM_SCRK_HZ")) {
|
||||||
" LEFT JOIN BO_EU_DATALINKUP_ZBXS b ON a.SGBZL = b.TYPE AND a.SGBHD = b.THICKNESS" +
|
int update = DBSql.update("UPDATE BO_EU_BNBM_SCRK_HZ a" +
|
||||||
" SET a.ZBCL = a.RKSL * b.ZBXS" +
|
" LEFT JOIN BO_EU_DATALINKUP_ZBXS b ON a.SGBZL = b.TYPE AND a.SGBHD = b.THICKNESS" +
|
||||||
" WHERE a.BKGS = '泰山石膏' " +
|
" SET a.ZBCL = a.RKSL * b.ZBXS" +
|
||||||
" AND a.WLMC LIKE '%石膏板%' " +
|
" WHERE a.BKGS = '泰山石膏' " +
|
||||||
" AND a.RKRQ >= '" + startDate + "'");
|
" AND a.WLMC LIKE '%石膏板%' " +
|
||||||
LOGGER.info("更新折标产量条数:{}-开始时间为:{}",update,startDate);
|
" AND a.RKRQ >= '" + startDate + "'");
|
||||||
|
LOGGER.info("更新折标产量条数:{}-开始时间为:{}", update, startDate);
|
||||||
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
LOGGER.error("汇总数据失败 [汇总表={}, 第几页={}]: {}",
|
LOGGER.error("汇总数据失败 [汇总表={}, 第几页={}]: {}",
|
||||||
hzb, PAGE_SIZE, e.getMessage(), e);
|
hzb, PAGE_SIZE, e.getMessage(), e);
|
||||||
|
|||||||
@ -67,6 +67,7 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateSummary(DateRange dateRange, BO mainConfig) {
|
public void calculateSummary(DateRange dateRange, BO mainConfig) {
|
||||||
|
// LOGGER.info("dateRange:{},mainConfig:{}",dateRange,mainConfig.toJSONObject().toJSONString());
|
||||||
try {
|
try {
|
||||||
// 从主配置获取BKGS值
|
// 从主配置获取BKGS值
|
||||||
String bkgs = mainConfig.getString("BKGS");
|
String bkgs = mainConfig.getString("BKGS");
|
||||||
|
|||||||
@ -232,6 +232,7 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
public void querySourceData(String ccId, String tableName,
|
public void querySourceData(String ccId, String tableName,
|
||||||
String timeField, Date startDated, Date endDated,String partitionField,
|
String timeField, Date startDated, Date endDated,String partitionField,
|
||||||
List<BO> fieldMappings, String targetTable,String jezd) {
|
List<BO> fieldMappings, String targetTable,String jezd) {
|
||||||
|
// LOGGER.info("ccId:{},tableName:{},timeField:{},startDated:{},endDated:{},partitionField:{},fieldMappings:{},targetTable:{},jezd:{}",ccId,tableName,timeField,startDated,endDated,partitionField,Arrays.asList(fieldMappings.toArray()),targetTable,jezd);
|
||||||
int totalRows = 0; // 总查询行数
|
int totalRows = 0; // 总查询行数
|
||||||
int totalSuccess = 0; // 总成功插入行数
|
int totalSuccess = 0; // 总成功插入行数
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
@ -264,12 +265,12 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
ccId, result, maxRetries, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), e.getMessage());
|
ccId, result, maxRetries, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), e.getMessage());
|
||||||
LOGGER.error(errorMsg, e);
|
LOGGER.error(errorMsg, e);
|
||||||
// 发送邮件通知
|
// 发送邮件通知
|
||||||
boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
// boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
||||||
if (eMailSync){
|
// if (eMailSync){
|
||||||
LOGGER.info("短信发送成功");
|
// LOGGER.info("短信发送成功");
|
||||||
}else {
|
// }else {
|
||||||
LOGGER.info("短信发送失败");
|
// LOGGER.info("短信发送失败");
|
||||||
}
|
// }
|
||||||
throw new RuntimeException(errorMsg, e);
|
throw new RuntimeException(errorMsg, e);
|
||||||
}
|
}
|
||||||
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
||||||
@ -812,7 +813,7 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void summarizeScopeData(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
public void summarizeScopeData(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
||||||
LOGGER.info("targetTable:{};startDated:{};endDated:{};targetTimeField:{};hzb:{}",targetTable,startDated,endDated,targetTimeField,hzb);
|
// LOGGER.info("targetTable:{};startDated:{};endDated:{};targetTimeField:{};hzb:{}",targetTable,startDated,endDated,targetTimeField,hzb);
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
boolean hasMore;
|
boolean hasMore;
|
||||||
String pageSql = "";
|
String pageSql = "";
|
||||||
|
|||||||
@ -70,6 +70,7 @@ public class SaleCountDimensionImpl implements DataSummaryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateSummary(DateRange dateRange, BO mainConfig) {
|
public void calculateSummary(DateRange dateRange, BO mainConfig) {
|
||||||
|
// LOGGER.info("dateRange:{},mainConfig:{}",dateRange,mainConfig.toJSONObject().toJSONString());
|
||||||
try {
|
try {
|
||||||
// 从主配置获取BKGS值
|
// 从主配置获取BKGS值
|
||||||
String bkgs = mainConfig.getString("BKGS");
|
String bkgs = mainConfig.getString("BKGS");
|
||||||
|
|||||||
@ -75,6 +75,7 @@ public class SaleDataSummaryServiceImpl implements DataSummaryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateSummary(DateRange dateRange, BO mainConfig) {
|
public void calculateSummary(DateRange dateRange, BO mainConfig) {
|
||||||
|
// LOGGER.info("dateRange:{},mainConfig:{}",dateRange,mainConfig.toJSONObject().toJSONString());
|
||||||
try {
|
try {
|
||||||
// 从主配置获取BKGS值
|
// 从主配置获取BKGS值
|
||||||
String bkgs = mainConfig.getString("BKGS");
|
String bkgs = mainConfig.getString("BKGS");
|
||||||
|
|||||||
@ -175,6 +175,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
public void querySourceData(String ccId, String tableName,
|
public void querySourceData(String ccId, String tableName,
|
||||||
String timeField, Date startDated, Date endDated,String partitionField,
|
String timeField, Date startDated, Date endDated,String partitionField,
|
||||||
List<BO> fieldMappings, String targetTable,String jezd) {
|
List<BO> fieldMappings, String targetTable,String jezd) {
|
||||||
|
// LOGGER.info("ccId:{},tableName:{},timeField:{},startDated:{},endDated:{},partitionField:{},fieldMappings:{},targetTable:{},jezd:{}",ccId,tableName,timeField,startDated,endDated,partitionField,Arrays.asList(fieldMappings.toArray()),targetTable,jezd);
|
||||||
int totalRows = 0; // 总查询行数
|
int totalRows = 0; // 总查询行数
|
||||||
int totalSuccess = 0; // 总成功插入行数
|
int totalSuccess = 0; // 总成功插入行数
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
@ -208,12 +209,12 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
ccId, result, maxRetries, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), e.getMessage());
|
ccId, result, maxRetries, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), e.getMessage());
|
||||||
LOGGER.error(errorMsg, e);
|
LOGGER.error(errorMsg, e);
|
||||||
// 发送邮件通知
|
// 发送邮件通知
|
||||||
boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
// boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
||||||
if (eMailSync){
|
// if (eMailSync){
|
||||||
LOGGER.info("短信发送成功");
|
// LOGGER.info("短信发送成功");
|
||||||
}else {
|
// }else {
|
||||||
LOGGER.info("短信发送失败");
|
// LOGGER.info("短信发送失败");
|
||||||
}
|
// }
|
||||||
throw new RuntimeException(errorMsg, e);
|
throw new RuntimeException(errorMsg, e);
|
||||||
}
|
}
|
||||||
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
||||||
@ -811,6 +812,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void summarizeScopeData(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
public void summarizeScopeData(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
||||||
|
// LOGGER.info("targetTable:{},startDated:{},endDated:{},targetTimeField:{},hzb:{}",targetTable,startDated,endDated,targetTimeField,hzb);
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
boolean hasMore;
|
boolean hasMore;
|
||||||
String pageSql = "";
|
String pageSql = "";
|
||||||
@ -959,6 +961,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void summarizeScopeDataYs(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
public void summarizeScopeDataYs(String targetTable, Date startDated, Date endDated, String targetTimeField, String hzb) {
|
||||||
|
// LOGGER.info("targetTable:{},startDated:{},endDated:{},targetTimeField:{},hzb:{}",targetTable,startDated,endDated,targetTimeField,hzb);
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
boolean hasMore;
|
boolean hasMore;
|
||||||
String pageSql = "";
|
String pageSql = "";
|
||||||
@ -1090,7 +1093,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
LocalDate now = LocalDate.now();
|
LocalDate now = LocalDate.now();
|
||||||
int dayOfMonth = now.getDayOfMonth();
|
int dayOfMonth = now.getDayOfMonth();
|
||||||
|
|
||||||
// if (dayOfMonth == 1) {
|
if (dayOfMonth == 1) {
|
||||||
try {
|
try {
|
||||||
LOGGER.info("开始执行每月1号的特殊数据处理任务");
|
LOGGER.info("开始执行每月1号的特殊数据处理任务");
|
||||||
|
|
||||||
@ -1148,7 +1151,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("每月1号任务执行失败: {}", e.getMessage(), e);
|
LOGGER.error("每月1号任务执行失败: {}", e.getMessage(), e);
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
LOGGER.error("汇总数据失败 [汇总表={}, 第几页={}]: {}",
|
LOGGER.error("汇总数据失败 [汇总表={}, 第几页={}]: {}",
|
||||||
hzb, PAGE_SIZE, e.getMessage(), e);
|
hzb, PAGE_SIZE, e.getMessage(), e);
|
||||||
@ -1167,6 +1170,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void querySourceDataYS(String ccId, String tableName, String timeField, Date startDated, Date endDated, String partitionField, List<BO> fieldMappings, String targetTable, String jezd) {
|
public void querySourceDataYS(String ccId, String tableName, String timeField, Date startDated, Date endDated, String partitionField, List<BO> fieldMappings, String targetTable, String jezd) {
|
||||||
|
// LOGGER.info("ccId:{},tableName:{},timeField:{},startDated:{},endDated:{},partitionField:{},fieldMappings:{},targetTable:{},jezd:{}",ccId,tableName,timeField,startDated,endDated,partitionField,Arrays.asList(fieldMappings.toArray()),targetTable,jezd);
|
||||||
int totalRows = 0; // 总查询行数
|
int totalRows = 0; // 总查询行数
|
||||||
int totalSuccess = 0; // 总成功插入行数
|
int totalSuccess = 0; // 总成功插入行数
|
||||||
int pageNo = 1;
|
int pageNo = 1;
|
||||||
@ -1199,12 +1203,12 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
ccId, result, maxRetries, LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), e.getMessage());
|
ccId, result, maxRetries, LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), e.getMessage());
|
||||||
LOGGER.error(errorMsg, e);
|
LOGGER.error(errorMsg, e);
|
||||||
// 发送邮件通知
|
// 发送邮件通知
|
||||||
boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
// boolean eMailSync = SDK.getNotificationAPI().sendEMailSync(SEND_EMAIL_ACCOUNT_NUMBER, RECEIVE_EMAIL_ACCOUNT, null, "数据贯通数据库连接通知", errorMsg);
|
||||||
if (eMailSync){
|
// if (eMailSync){
|
||||||
LOGGER.info("短信发送成功");
|
// LOGGER.info("短信发送成功");
|
||||||
}else {
|
// }else {
|
||||||
LOGGER.info("短信发送失败");
|
// LOGGER.info("短信发送失败");
|
||||||
}
|
// }
|
||||||
throw new RuntimeException(errorMsg, e);
|
throw new RuntimeException(errorMsg, e);
|
||||||
}
|
}
|
||||||
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
LOGGER.warn("获取数据库连接失败(CC_ID: {}),第{}次重试...", ccId, retry + 1);
|
||||||
@ -1316,7 +1320,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
LocalDate now = LocalDate.now();
|
LocalDate now = LocalDate.now();
|
||||||
int dayOfMonth = now.getDayOfMonth();
|
int dayOfMonth = now.getDayOfMonth();
|
||||||
|
|
||||||
// if (dayOfMonth == 1) {
|
if (dayOfMonth == 1) {
|
||||||
try {
|
try {
|
||||||
LOGGER.info("开始执行每月1号的特殊数据处理任务");
|
LOGGER.info("开始执行每月1号的特殊数据处理任务");
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
@ -1417,7 +1421,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
LOGGER.error("每月1号任务执行失败: {}", e.getMessage(), e);
|
LOGGER.error("每月1号任务执行失败: {}", e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
LOGGER.info("从表[{}]共查询到{}条数据,成功同步{}条数据",
|
LOGGER.info("从表[{}]共查询到{}条数据,成功同步{}条数据",
|
||||||
tableName, totalRows, totalSuccess);
|
tableName, totalRows, totalSuccess);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user