1、sql修改
This commit is contained in:
parent
4733326566
commit
6379f48756
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -257,9 +257,11 @@ public class DataLinkUpController {
|
||||
if ("销售".equals(ssyw)) {
|
||||
summaryService = new SaleDataSummaryServiceImpl();
|
||||
saleCountDimension = new SaleCountDimensionImpl();
|
||||
}else {
|
||||
}else if ("采购".equals(ssyw)){
|
||||
summaryService = new PurchaseDataSummaryServiceImpl();
|
||||
LOGGER.info("采购业务检测到,创建summaryService实例");
|
||||
}else {
|
||||
LOGGER.error("{}没有汇总类",ssyw);
|
||||
}
|
||||
|
||||
List<RowMap> bkgsMaps = DBSql.getMaps("SELECT BKGS FROM " + targetTable + " GROUP BY BKGS");
|
||||
@ -368,7 +370,7 @@ public class DataLinkUpController {
|
||||
hzb = "BO_EU_DWS_ORDER_YCLXH_HZ";
|
||||
}
|
||||
LOGGER.info("汇总板块数据——运营的接口");
|
||||
} else {
|
||||
} else if ("采购".equals(ssyw)){
|
||||
dataSyncService = new PurchaseDataSyncServiceImpl();
|
||||
if ("采购单".equals(tablename)){
|
||||
hzb = "BO_EU_DWD_ORDER_CGDD_HZ";
|
||||
@ -384,6 +386,8 @@ public class DataLinkUpController {
|
||||
LOGGER.error("当前表没有汇总表");
|
||||
}
|
||||
LOGGER.info("汇总板块数据——采购的接口");
|
||||
}else {
|
||||
LOGGER.error("{}当前表没有汇总表",ssyw);
|
||||
}
|
||||
|
||||
LOGGER.info("即将同步的数据:{}",plate);
|
||||
|
||||
@ -184,13 +184,13 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
}
|
||||
detailBO.set("RKDJ", rkdj); // 入库单价
|
||||
|
||||
// if ("泰山石膏".equals(bkgs)) {
|
||||
if ("泰山石膏".equals(bkgs)) {
|
||||
Double dhje = row.getDouble("DHJE");
|
||||
detailBO.set("RKJE", dhje != null ? dhje : 0.0); // 入库金额
|
||||
// } else {
|
||||
//// Double jshjhyf = row.getDouble("JSHJHYF");
|
||||
// detailBO.set("RKJE", jshjhyf != null ? jshjhyf : 0.0); // 入库金额
|
||||
// }
|
||||
} else {
|
||||
// Double jshjhyf = row.getDouble("JSHJHYF");
|
||||
detailBO.set("RKJE", jshjhyf != null ? jshjhyf : 0.0); // 入库金额
|
||||
}
|
||||
|
||||
detailBO.set("GYS", row.getString("GYSNAME")); // 供应商
|
||||
detailBO.set("DDBH", row.getString("CGDDH")); // 订单编号
|
||||
@ -257,7 +257,7 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
summaryBO.set("BKGS", bkgs1);
|
||||
summaryBO.set("WLMC", wlmc);
|
||||
summaryBO.set("RQ", djrq);
|
||||
// if (bkgs1.equals("泰山石膏")){
|
||||
if (bkgs1.equals("泰山石膏")){
|
||||
totalAmount = row.getDouble("tstotalAmount");
|
||||
double safeTotalAmount = totalAmount != null ? totalAmount : 0.0;
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")) {
|
||||
@ -279,29 +279,29 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
}
|
||||
}
|
||||
summaryBO.set("CGZE", safeTotalAmount);
|
||||
// }else {
|
||||
// totalAmount = row.getDouble("lptotalAmount");
|
||||
// double safeTotalAmount = totalAmount != null ? totalAmount : 0.0;
|
||||
// if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")) {
|
||||
// double adjustedQuantity = safeTotalQuantity / 1000;
|
||||
// summaryBO.set("CGZL", adjustedQuantity);
|
||||
// // 添加除零检查
|
||||
// if (safeTotalAmount != 0 && adjustedQuantity != 0) {
|
||||
// avgPrice = safeTotalAmount / adjustedQuantity;
|
||||
// } else {
|
||||
// avgPrice = 0.0;
|
||||
// }
|
||||
// } else {
|
||||
// summaryBO.set("CGZL", safeTotalQuantity);
|
||||
// // 添加除零检查
|
||||
// if (safeTotalAmount != 0 && safeTotalQuantity != 0) {
|
||||
// avgPrice = safeTotalAmount / safeTotalQuantity;
|
||||
// } else {
|
||||
// avgPrice = 0.0;
|
||||
// }
|
||||
// }
|
||||
// summaryBO.set("CGZE", safeTotalAmount);
|
||||
// }
|
||||
}else {
|
||||
totalAmount = row.getDouble("lptotalAmount");
|
||||
double safeTotalAmount = totalAmount != null ? totalAmount : 0.0;
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")) {
|
||||
double adjustedQuantity = safeTotalQuantity / 1000;
|
||||
summaryBO.set("CGZL", adjustedQuantity);
|
||||
// 添加除零检查
|
||||
if (safeTotalAmount != 0 && adjustedQuantity != 0) {
|
||||
avgPrice = safeTotalAmount / adjustedQuantity;
|
||||
} else {
|
||||
avgPrice = 0.0;
|
||||
}
|
||||
} else {
|
||||
summaryBO.set("CGZL", safeTotalQuantity);
|
||||
// 添加除零检查
|
||||
if (safeTotalAmount != 0 && safeTotalQuantity != 0) {
|
||||
avgPrice = safeTotalAmount / safeTotalQuantity;
|
||||
} else {
|
||||
avgPrice = 0.0;
|
||||
}
|
||||
}
|
||||
summaryBO.set("CGZE", safeTotalAmount);
|
||||
}
|
||||
summaryBO.set("PJDJ", avgPrice);
|
||||
bos.add(summaryBO);
|
||||
}
|
||||
@ -383,7 +383,7 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
double avgPrice = 0.0;
|
||||
double lyavgPrice = 0.0;
|
||||
double lmavgPrice = 0.0;
|
||||
// if (bkgs1.equals("泰山石膏")) {
|
||||
if (bkgs1.equals("泰山石膏")) {
|
||||
double totalAmount = currentMonthRow.getDouble("tstotalAmount");
|
||||
double lytotalAmount = currentMonthRow.getDouble("ly_tstotalAmount");
|
||||
double lmtotalAmount = currentMonthRow.getDouble("lm_tstotalAmount");
|
||||
@ -450,75 +450,75 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
summaryBO.set("CGZE", totalAmount);
|
||||
summaryBO.set("TQCGZE", lytotalAmount);
|
||||
summaryBO.set("SQCGZE", lmtotalAmount);
|
||||
// }
|
||||
// else {
|
||||
// double totalAmount = currentMonthRow.getDouble("lptotalAmount")==0.0?0.0:currentMonthRow.getDouble("lptotalAmount");
|
||||
// double lytotalAmount = currentMonthRow.getDouble("ly_lptotalAmount")==0.0?0.0:currentMonthRow.getDouble("ly_lptotalAmount");
|
||||
// double lmtotalAmount = currentMonthRow.getDouble("lm_lptotalAmount")==0.0?0.0:currentMonthRow.getDouble("lm_lptotalAmount");
|
||||
// double totalQuantity = 0.00;
|
||||
// double lytotalQuantity = 0.00;
|
||||
// double lmtotalQuantity = 0.00;
|
||||
// if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")) {
|
||||
// double Quantity = currentMonthRow.getDouble("totalQuantity")==0.0?0.0:currentMonthRow.getDouble("totalQuantity");
|
||||
// if (Quantity==0.00) {
|
||||
// totalQuantity = 0.0;
|
||||
// }else {
|
||||
// totalQuantity = BigDecimal.valueOf(Quantity)
|
||||
// .divide(BigDecimal.valueOf(1000), 4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
// }
|
||||
// double lyQuantity = currentMonthRow.getDouble("ly_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("ly_totalQuantity");
|
||||
// if (lyQuantity==0.0){
|
||||
// lytotalQuantity = 0.0;
|
||||
// }else {
|
||||
// lytotalQuantity = BigDecimal.valueOf(lyQuantity)
|
||||
// .divide(BigDecimal.valueOf(1000), 4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
// }
|
||||
// double lmQuantity = currentMonthRow.getDouble("lm_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("lm_totalQuantity");
|
||||
// if (lmQuantity==0.0){
|
||||
// lmtotalQuantity = 0.0;
|
||||
// }else {
|
||||
// lmtotalQuantity = BigDecimal.valueOf(lmQuantity)
|
||||
// .divide(BigDecimal.valueOf(1000), 4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
// }
|
||||
// summaryBO.set("CGZL", totalQuantity);
|
||||
// summaryBO.set("TQCGZL", lytotalQuantity);
|
||||
// summaryBO.set("SQCGZL", lmtotalQuantity);
|
||||
// }else {
|
||||
// double Quantity = currentMonthRow.getDouble("totalQuantity")==0.0?0.0:currentMonthRow.getDouble("totalQuantity");
|
||||
// double lyQuantity = currentMonthRow.getDouble("ly_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("ly_totalQuantity");
|
||||
// double lmQuantity = currentMonthRow.getDouble("lm_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("lm_totalQuantity");
|
||||
// totalQuantity = BigDecimal.valueOf(Quantity).doubleValue();
|
||||
// lytotalQuantity = BigDecimal.valueOf(lyQuantity).doubleValue();
|
||||
// lmtotalQuantity = BigDecimal.valueOf(lmQuantity).doubleValue();
|
||||
// summaryBO.set("CGZL", totalQuantity);
|
||||
// summaryBO.set("TQCGZL", lytotalQuantity);
|
||||
// summaryBO.set("SQCGZL", lmtotalQuantity);
|
||||
// }
|
||||
// // 添加除数非零检查
|
||||
// if (totalAmount != 0 && totalQuantity != 0) {
|
||||
// avgPrice = BigDecimal.valueOf(totalAmount)
|
||||
// .divide(BigDecimal.valueOf(totalQuantity), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
// } else {
|
||||
// avgPrice = 0;
|
||||
// }
|
||||
// //同期
|
||||
// if (lytotalAmount != 0 && lytotalQuantity != 0) {
|
||||
// lyavgPrice = BigDecimal.valueOf(lytotalAmount)
|
||||
// .divide(BigDecimal.valueOf(lytotalQuantity), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
// } else {
|
||||
// lyavgPrice = 0;
|
||||
// }
|
||||
// //上期
|
||||
// if (lmtotalAmount != 0 && lmtotalQuantity != 0) {
|
||||
// lmavgPrice = BigDecimal.valueOf(lmtotalAmount)
|
||||
// .divide(BigDecimal.valueOf(lmtotalQuantity), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
// } else {
|
||||
// lmavgPrice = 0;
|
||||
// }
|
||||
// summaryBO.set("CGZE", totalAmount);
|
||||
// summaryBO.set("TQCGZE", lytotalAmount);
|
||||
// summaryBO.set("SQCGZE", lmtotalAmount);
|
||||
// }
|
||||
}
|
||||
else {
|
||||
double totalAmount = currentMonthRow.getDouble("lptotalAmount")==0.0?0.0:currentMonthRow.getDouble("lptotalAmount");
|
||||
double lytotalAmount = currentMonthRow.getDouble("ly_lptotalAmount")==0.0?0.0:currentMonthRow.getDouble("ly_lptotalAmount");
|
||||
double lmtotalAmount = currentMonthRow.getDouble("lm_lptotalAmount")==0.0?0.0:currentMonthRow.getDouble("lm_lptotalAmount");
|
||||
double totalQuantity = 0.00;
|
||||
double lytotalQuantity = 0.00;
|
||||
double lmtotalQuantity = 0.00;
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")) {
|
||||
double Quantity = currentMonthRow.getDouble("totalQuantity")==0.0?0.0:currentMonthRow.getDouble("totalQuantity");
|
||||
if (Quantity==0.00) {
|
||||
totalQuantity = 0.0;
|
||||
}else {
|
||||
totalQuantity = BigDecimal.valueOf(Quantity)
|
||||
.divide(BigDecimal.valueOf(1000), 4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
double lyQuantity = currentMonthRow.getDouble("ly_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("ly_totalQuantity");
|
||||
if (lyQuantity==0.0){
|
||||
lytotalQuantity = 0.0;
|
||||
}else {
|
||||
lytotalQuantity = BigDecimal.valueOf(lyQuantity)
|
||||
.divide(BigDecimal.valueOf(1000), 4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
double lmQuantity = currentMonthRow.getDouble("lm_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("lm_totalQuantity");
|
||||
if (lmQuantity==0.0){
|
||||
lmtotalQuantity = 0.0;
|
||||
}else {
|
||||
lmtotalQuantity = BigDecimal.valueOf(lmQuantity)
|
||||
.divide(BigDecimal.valueOf(1000), 4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
summaryBO.set("CGZL", totalQuantity);
|
||||
summaryBO.set("TQCGZL", lytotalQuantity);
|
||||
summaryBO.set("SQCGZL", lmtotalQuantity);
|
||||
}else {
|
||||
double Quantity = currentMonthRow.getDouble("totalQuantity")==0.0?0.0:currentMonthRow.getDouble("totalQuantity");
|
||||
double lyQuantity = currentMonthRow.getDouble("ly_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("ly_totalQuantity");
|
||||
double lmQuantity = currentMonthRow.getDouble("lm_totalQuantity")==0.0?0.0:currentMonthRow.getDouble("lm_totalQuantity");
|
||||
totalQuantity = BigDecimal.valueOf(Quantity).doubleValue();
|
||||
lytotalQuantity = BigDecimal.valueOf(lyQuantity).doubleValue();
|
||||
lmtotalQuantity = BigDecimal.valueOf(lmQuantity).doubleValue();
|
||||
summaryBO.set("CGZL", totalQuantity);
|
||||
summaryBO.set("TQCGZL", lytotalQuantity);
|
||||
summaryBO.set("SQCGZL", lmtotalQuantity);
|
||||
}
|
||||
// 添加除数非零检查
|
||||
if (totalAmount != 0 && totalQuantity != 0) {
|
||||
avgPrice = BigDecimal.valueOf(totalAmount)
|
||||
.divide(BigDecimal.valueOf(totalQuantity), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
} else {
|
||||
avgPrice = 0;
|
||||
}
|
||||
//同期
|
||||
if (lytotalAmount != 0 && lytotalQuantity != 0) {
|
||||
lyavgPrice = BigDecimal.valueOf(lytotalAmount)
|
||||
.divide(BigDecimal.valueOf(lytotalQuantity), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
} else {
|
||||
lyavgPrice = 0;
|
||||
}
|
||||
//上期
|
||||
if (lmtotalAmount != 0 && lmtotalQuantity != 0) {
|
||||
lmavgPrice = BigDecimal.valueOf(lmtotalAmount)
|
||||
.divide(BigDecimal.valueOf(lmtotalQuantity), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
} else {
|
||||
lmavgPrice = 0;
|
||||
}
|
||||
summaryBO.set("CGZE", totalAmount);
|
||||
summaryBO.set("TQCGZE", lytotalAmount);
|
||||
summaryBO.set("SQCGZE", lmtotalAmount);
|
||||
}
|
||||
summaryBO.set("PJDJ", avgPrice);
|
||||
summaryBO.set("SQPJDJ", lmavgPrice);
|
||||
summaryBO.set("TQPJDJ", lyavgPrice);
|
||||
@ -556,7 +556,6 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
" WHERE BKGS = ? AND YEARMONTH >= ?";
|
||||
int update = DBSql.update(deleteSql, new Object[]{bkgs, yearMonth});
|
||||
LOGGER.info("采购_年月采购明细:{}年月物料采购月度汇总数据,板块公司:{},删除了{}条数据",yearMonth, bkgs, update);
|
||||
|
||||
String currentMonthSql = "SELECT CONCAT(c.Year, '-', LPAD(c.Month, 2, '0')) ASyear_month,c.Year AS year,c.Month AS month,c.WLMC AS WLMC," +
|
||||
" c.tstotalAmount AS tstotalAmount,c.lptotalAmount AS lptotalAmount,c.totalQuantity AS totalQuantity," +
|
||||
" ly.tstotalAmount AS LY_tstotalAmount,ly.lptotalAmount AS LY_lptotalAmount,ly.totalQuantity AS LY_totalQuantity," +
|
||||
@ -598,7 +597,7 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
bo.set("BKGS",bkgs);//板块
|
||||
bo.set("WLMC",wlmc);//物料名称
|
||||
bo.set("YEARMONTH",currentMonthRow.getString("ASyear_month"));//年月(YYYYMM)
|
||||
// if (bkgs.equals("泰山石膏")) {
|
||||
if (bkgs.equals("泰山石膏")) {
|
||||
Double tstotalAmount = currentMonthRow.getDouble("tstotalAmount");
|
||||
double tstotalAmount1 = tstotalAmount==null?0.0: tstotalAmount;
|
||||
Double totalQuantity = currentMonthRow.getDouble("totalQuantity");
|
||||
@ -612,22 +611,22 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
}
|
||||
bo.set("TQCGZE",currentMonthRow.getString("LY_tstotalAmount"));//同期采购总额
|
||||
bo.set("SQCGZE",currentMonthRow.getString("LM_tstotalAmount"));//上期采购总额
|
||||
// }
|
||||
// else {
|
||||
// Double tstotalAmount = currentMonthRow.getDouble("lptotalAmount");
|
||||
// double tstotalAmount1 = tstotalAmount==null?0.0: tstotalAmount;
|
||||
// Double totalQuantity = currentMonthRow.getDouble("totalQuantity");
|
||||
// double totalQuantity1 = totalQuantity==null?0.0: totalQuantity;
|
||||
// bo.set("CGZE", tstotalAmount1);//采购总额
|
||||
// bo.set("CGZL",totalQuantity1);//采购总量
|
||||
// if (tstotalAmount1!=0 && totalQuantity1!=0) {
|
||||
// bo.set("PJDJ", tstotalAmount1/totalQuantity1);//平均单价
|
||||
// }else {
|
||||
// bo.set("PJDJ", 0);//平均单价
|
||||
// }
|
||||
// bo.set("TQCGZE",currentMonthRow.getString("LY_lptotalAmount"));//同期采购总额
|
||||
// bo.set("SQCGZE",currentMonthRow.getString("LM_lptotalAmount"));//上期采购总额
|
||||
// }
|
||||
}
|
||||
else {
|
||||
Double tstotalAmount = currentMonthRow.getDouble("lptotalAmount");
|
||||
double tstotalAmount1 = tstotalAmount==null?0.0: tstotalAmount;
|
||||
Double totalQuantity = currentMonthRow.getDouble("totalQuantity");
|
||||
double totalQuantity1 = totalQuantity==null?0.0: totalQuantity;
|
||||
bo.set("CGZE", tstotalAmount1);//采购总额
|
||||
bo.set("CGZL",totalQuantity1);//采购总量
|
||||
if (tstotalAmount1!=0 && totalQuantity1!=0) {
|
||||
bo.set("PJDJ", tstotalAmount1/totalQuantity1);//平均单价
|
||||
}else {
|
||||
bo.set("PJDJ", 0);//平均单价
|
||||
}
|
||||
bo.set("TQCGZE",currentMonthRow.getString("LY_lptotalAmount"));//同期采购总额
|
||||
bo.set("SQCGZE",currentMonthRow.getString("LM_lptotalAmount"));//上期采购总额
|
||||
}
|
||||
bo.set("TQCGZL",currentMonthRow.getString("LY_totalQuantity"));//同期采购总量
|
||||
bo.set("SQCGZL",currentMonthRow.getString("LM_totalQuantity"));//上期采购总量
|
||||
bos.add(bo);
|
||||
|
||||
@ -264,7 +264,7 @@ public class SaleCountDimensionImpl implements DataSummaryService {
|
||||
try {
|
||||
// 第一个SQL:查询应收账款数据
|
||||
String receivableSql = "SELECT t1.RQ AS RQ, t1.XSZZ AS XSZZ, t1.QYGS AS QYGS, t1.BKGS AS BKGS," +
|
||||
" DATE_FORMAT( t1.RQ, '%Y-%m' ) ASyear_month, t1.RQ AS max_rq, (SUM( t1.YSYE )/1000) AS YSZK," +
|
||||
" DATE_FORMAT( t1.RQ, '%Y-%m' ) ASyear_month, t1.RQ AS max_rq, (SUM( t1.YSYE )/10000) AS YSZK," +
|
||||
" SUM(t1.LJHK) AS LJHK,SUM(t1.LJXS) AS LJXS," +
|
||||
" CASE " +
|
||||
" WHEN SUM(t1.LJXS) != 0 THEN SUM(t1.LJHK) / SUM(t1.LJXS)" +
|
||||
@ -424,7 +424,7 @@ public class SaleCountDimensionImpl implements DataSummaryService {
|
||||
" WHEN BKGS = '龙牌' AND LB_1 IN ('装饰石膏板', '鲁班装饰万能板', '石膏板') THEN '石膏板'" +
|
||||
" WHEN BKGS = '泰山石膏' AND LB_1 IN ('装饰板', '石膏板') THEN '石膏板'" +
|
||||
" ELSE LB_1" +
|
||||
" END" +
|
||||
" END," +
|
||||
" LB_2, LB_3, SQ, CS, QY, YEARMONTH";
|
||||
|
||||
// String querySql = "SELECT t1.DZRQ, t1.QYGS, t1.KCZZ, t1.LB_1, t1.LB_2, t1.LB_3, t1.SQ, t1.CS, t1.QY," +
|
||||
@ -552,7 +552,7 @@ public class SaleCountDimensionImpl implements DataSummaryService {
|
||||
" WHEN BKGS = '龙牌' AND LB_1 IN ('装饰石膏板', '鲁班装饰万能板', '石膏板') THEN '石膏板'" +
|
||||
" WHEN BKGS = '泰山石膏' AND LB_1 IN ('装饰板', '石膏板') THEN '石膏板'" +
|
||||
" ELSE LB_1" +
|
||||
" END AS LB_1," +
|
||||
" END ," +
|
||||
" LB_2, LB_3, SQ, CS, QY, YEARMONTH";
|
||||
|
||||
// String querySql = "SELECT curr.DZRQ,curr.QYGS,curr.KCZZ,curr.LB_1,curr.LB_2,curr.LB_3,curr.SQ,curr.CS,curr.QY," +
|
||||
|
||||
@ -82,7 +82,7 @@ public class SaleDataSummaryServiceImpl implements DataSummaryService {
|
||||
LOGGER.error("主配置中BKGS为空,无法进行汇总计算");
|
||||
return;
|
||||
}
|
||||
if (bkgs!="龙牌" || bkgs!="梦牌" || bkgs!="泰山石膏" || bkgs!="北新嘉宝莉" || bkgs!="北新涂料"){
|
||||
if (!"龙牌".equals(bkgs) || !"梦牌".equals(bkgs) || !"泰山石膏".equals(bkgs) || !"北新嘉宝莉".equals(bkgs) || !"北新涂料".equals(bkgs)){
|
||||
LOGGER.error("主配置中板块公司为:{},无需进行计算",bkgs);
|
||||
return;
|
||||
}
|
||||
@ -189,7 +189,7 @@ public class SaleDataSummaryServiceImpl implements DataSummaryService {
|
||||
String sql = "SELECT DZRQ,LB_1,LB_2,LB_3,BKGS,SQ,CS,SUM(XSSL) AS tssales, SUM(ZSSL) AS lpsales,SUM(SSJERMB) AS revenue" +
|
||||
" FROM " +SALES_DETAIL_TABLE+
|
||||
" WHERE LB_1 IN ('石膏板', '轻钢龙骨', '涂料') AND ("+sfSql+")" +
|
||||
" GROUP BY DZRQ,LB_1,LB_2,LB_3,BKGS,CS ORDER BY DZRQ";
|
||||
" GROUP BY DZRQ,LB_1,BKGS,CS ORDER BY DZRQ";
|
||||
|
||||
List<RowMap> maps = DBSql.getMaps(sql);
|
||||
if (maps!=null){
|
||||
|
||||
@ -813,14 +813,45 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
||||
bo.set(key, map.get(key));
|
||||
}
|
||||
}
|
||||
//修改产量类型1
|
||||
// if ("龙牌".equals(map.getString("BKGS"))
|
||||
// && ("装饰石膏板".equals(map.getString("LB_1")) || "鲁班装饰万能板".equals(map.getString("LB_1")))){
|
||||
// bo.set("LB_1","石膏板");
|
||||
// } else if ("泰山石膏".equals(map.getString("BKGS")) && ("装饰板".equals(map.getString("LB_1")))) {
|
||||
// bo.set("LB_1","石膏板");
|
||||
// }
|
||||
// LOGGER.info("泰山应收的数据:{}",bo.toJSONObject());
|
||||
//销售汇总表修改区域公司
|
||||
if ("梦牌".equals(bo.getString("BKGS"))) {
|
||||
String cs = StringUtils.isBlank(bo.getString("CS"))?"":bo.getString("CS");
|
||||
String sq = StringUtils.isBlank(bo.getString("SQ"))?"":bo.getString("SQ");
|
||||
boolean found = false; // 标记是否找到匹配
|
||||
for (BO bo1 : mpqyList) {
|
||||
String ss = bo1.getString("SS");
|
||||
if (ss.contains(cs)) {
|
||||
bo.set("QYGS", bo1.getString("QYGS"));
|
||||
found = true;
|
||||
break; // 找到后立即跳出循环
|
||||
} else if (ss.contains(sq)) {
|
||||
bo.set("QYGS", bo1.getString("QYGS"));
|
||||
found = true;
|
||||
break; // 找到后立即跳出循环
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
bo.set("QYGS", "其他"); // 循环结束后仍未找到则设為"其他"
|
||||
}
|
||||
}else if ("龙牌".equals(bo.getString("BKGS"))){
|
||||
String xszz = StringUtils.isBlank(bo.getString("XSZZ"))?"":bo.getString("XSZZ");
|
||||
boolean found = false; // 标记是否找到匹配
|
||||
// 修改龙牌的区域公司
|
||||
for (BO bo1 : lpqyList) {
|
||||
String swfb = bo1.getString("SWFB");
|
||||
String[] split = swfb.split(",");
|
||||
String qygs = bo1.getString("QYGS");
|
||||
for (String s : split) {
|
||||
if (xszz.equals(s)){
|
||||
bo.set("QYGS",qygs);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
bo.set("QYGS", "其他"); // 循环结束后仍未找到则设為"其他"
|
||||
}
|
||||
}
|
||||
bos.add(bo);
|
||||
}
|
||||
|
||||
@ -831,24 +862,6 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
||||
hasMore = pageData.size() == PAGE_SIZE;
|
||||
pageNo++;
|
||||
} while (hasMore);
|
||||
// 修改龙牌的区域公司
|
||||
for (BO bo1 : lpqyList) {
|
||||
String swfb = bo1.getString("SWFB");
|
||||
String[] split = swfb.split(",");
|
||||
String qygs = bo1.getString("QYGS");
|
||||
for (String s : split) {
|
||||
DBSql.getMap("UPDATE BO_EU_BNBM_DATALINKUP_XS_XSL_HZ SET QYGS = '"+qygs+"' WHERE XSZZ = '"+s+"'");
|
||||
DBSql.getMap("UPDATE BO_EU_BNBM_DATALINKUP_XS_YSL SET QYGS = '"+qygs+"' WHERE XSZZ = '"+s+"'");
|
||||
}
|
||||
}
|
||||
//销售汇总表修改区域公司
|
||||
// if ("梦牌".equals(map.getString("BKGS"))){
|
||||
// String cs = bo.getString("CS");
|
||||
// String sq = bo.getString("SQ");
|
||||
// }
|
||||
// for (BO bo1 : mpqyList) {
|
||||
//
|
||||
// }
|
||||
}catch (Exception e){
|
||||
LOGGER.error("汇总数据失败 [汇总表={}, 第几页={}]: {}",
|
||||
hzb, PAGE_SIZE, e.getMessage(), e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user