Browse Source

市场导入

guomengjiao 1 week ago
parent
commit
6e642c9739

+ 22 - 10
modules/report/src/main/java/com/jeesite/modules/report/service/ResearchReportService.java

@@ -950,15 +950,15 @@ public class ResearchReportService extends CrudService<ResearchReportDao, Resear
 				boolean isSave = true;
 				ResearchReportMarketScaleDto dto = list.get(i);
 				if(StringUtils.isBlank(dto.getReportCode())){
-					msg.append("第"+(i+1)+"行,报告代码不能为空!");
+					msg.append("第"+(i+1)+"行,报告代码不能为空!<br/>");
 					isSave = false;
 				}
 				if(StringUtils.isBlank(dto.getReportRegion())){
-					msg.append("第"+(i+1)+"行,版本不能为空!");
+					msg.append("第"+(i+1)+"行,版本不能为空!<br/>");
 					isSave = false;
 				}
 				if(StringUtils.isBlank(dto.getMarketScale())){
-					msg.append("第"+(i+1)+"行,市场规模不能为空!");
+					msg.append("第"+(i+1)+"行,市场规模不能为空!<br/>");
 					isSave = false;
 				}
 				if(isSave){
@@ -977,7 +977,13 @@ public class ResearchReportService extends CrudService<ResearchReportDao, Resear
 				for (int i = 0; i < updateList.size(); i += batchSize) {
 					int end = Math.min(i + batchSize, updateList.size());
 					List<ResearchReport> subList = updateList.subList(i, end);
-					saveCount += subList.stream().mapToInt(sb -> dao.updateMarketScale(sb)).sum();
+					saveCount += subList.stream().mapToInt(sb -> {
+						Integer countTemp = dao.updateMarketScale(sb);
+						if(countTemp <= 0){
+							msg.append("报告代码(版本):" + sb.getReportCode() + "(" + (Constants.reportRegion.WORLD_KEY.equals(sb.getReportRegion()) ? Constants.reportRegion.WORLD_VALUE : Constants.reportRegion.CHINA_VALUE) + ")不存在!<br/>");
+						}
+						return countTemp;
+					}).sum();
 				}
 			}
 		}else {
@@ -991,7 +997,7 @@ public class ResearchReportService extends CrudService<ResearchReportDao, Resear
 		}else if(saveCount > 0){
 			msg.insert(0,"数据部分导入成功,成功"+saveCount+"条,失败"+(total - saveCount)+"条!<br/>");
 		} else {
-			msg.insert(0,"数据导入失败,共"+total+"条!");
+			msg.insert(0,"数据导入失败,共"+total+"条!<br/>");
 		}
 		return msg.toString();
 	}
@@ -1011,15 +1017,15 @@ public class ResearchReportService extends CrudService<ResearchReportDao, Resear
 				boolean isSave = true;
 				ResearchReportMarketDrivenDto dto = list.get(i);
 				if(StringUtils.isBlank(dto.getReportCode())){
-					msg.append("第"+(i+1)+"行,报告代码不能为空!");
+					msg.append("第"+(i+1)+"行,报告代码不能为空!<br/>");
 					isSave = false;
 				}
 				if(StringUtils.isBlank(dto.getReportRegion())){
-					msg.append("第"+(i+1)+"行,版本不能为空!");
+					msg.append("第"+(i+1)+"行,版本不能为空!<br/>");
 					isSave = false;
 				}
 				if(StringUtils.isBlank(dto.getMarketDriven())){
-					msg.append("第"+(i+1)+"行,市场驱动不能为空!");
+					msg.append("第"+(i+1)+"行,市场驱动不能为空!<br/>");
 					isSave = false;
 				}
 				if(isSave){
@@ -1038,7 +1044,13 @@ public class ResearchReportService extends CrudService<ResearchReportDao, Resear
 				for (int i = 0; i < updateList.size(); i += batchSize) {
 					int end = Math.min(i + batchSize, updateList.size());
 					List<ResearchReport> subList = updateList.subList(i, end);
-					saveCount += subList.stream().mapToInt(sb -> dao.updateMarketDriven(sb)).sum();
+					saveCount += subList.stream().mapToInt(sb -> {
+						Integer countTemp = dao.updateMarketDriven(sb);
+						if(countTemp <= 0){
+							msg.append("报告代码(版本):" + sb.getReportCode() + "(" + (Constants.reportRegion.WORLD_KEY.equals(sb.getReportRegion()) ? Constants.reportRegion.WORLD_VALUE : Constants.reportRegion.CHINA_VALUE) + ")不存在!<br/>");
+						}
+						return countTemp;
+					}).sum();
 				}
 			}
 		}else {
@@ -1052,7 +1064,7 @@ public class ResearchReportService extends CrudService<ResearchReportDao, Resear
 		}else if(saveCount > 0){
 			msg.insert(0,"数据部分导入成功,成功"+saveCount+"条,失败"+(total - saveCount)+"条!<br/>");
 		} else {
-			msg.insert(0,"数据导入失败,共"+total+"条!");
+			msg.insert(0,"数据导入失败,共"+total+"条!<br/>");
 		}
 		return msg.toString();
 	}