Browse Source

2024年3月27日14:30:34

纪新园 1 year ago
parent
commit
e718f0035b

+ 234 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsServiceImpl.java

@@ -219,6 +219,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 								.in(FeeCenter::getPid, ids)
 								.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 								.eq(FeeCenter::getIsDeleted, 0));
+							for (FeeCenter item : feeCenterListMh) {
+								BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+								if (bCorps != null) {
+									item.setCorpCnName(bCorps.getShortName());
+								}
+								BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+								if (bCorp != null) {
+									item.setBillCorpCnName(bCorp.getShortName());
+								}
+							}
 							for (Bills item : billsList) {
 								List<FeeCenter> feeCenterList = feeCenterListMh.stream()
 									.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
@@ -289,6 +299,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						.eq(FeeCenter::getPid, bills.getId())
 						.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 						.eq(FeeCenter::getIsDeleted, 0));
+					for (FeeCenter item : feeCenterList) {
+						BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+						if (bCorps != null) {
+							item.setCorpCnName(bCorps.getShortName());
+						}
+						BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+						if (bCorp != null) {
+							item.setBillCorpCnName(bCorp.getShortName());
+						}
+					}
 					if (!feeCenterList.isEmpty()) {
 						List<FeeCenter> feeCenters = feeCenterList.stream()
 							.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
@@ -364,6 +384,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 							.eq(FeeCenter::getIsDeleted, 0));
 						if (!feeCenterList.isEmpty()) {
+							for (FeeCenter item : feeCenterList) {
+								BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+								if (bCorps != null) {
+									item.setCorpCnName(bCorps.getShortName());
+								}
+								BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+								if (bCorp != null) {
+									item.setBillCorpCnName(bCorp.getShortName());
+								}
+							}
 							List<FeeCenter> feeCenters = feeCenterList.stream()
 								.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 									Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode()))), ArrayList::new));
@@ -431,6 +461,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							.eq(FeeCenter::getPid, details.getId())
 							.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 							.eq(FeeCenter::getIsDeleted, 0));
+						for (FeeCenter item : feeCenterListMh) {
+							BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+							if (bCorps != null) {
+								item.setCorpCnName(bCorps.getShortName());
+							}
+							BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+							if (bCorp != null) {
+								item.setBillCorpCnName(bCorp.getShortName());
+							}
+						}
 						List<FeeCenter> feeCenterList1 = feeCenterListMh.stream()
 							.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 								Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode()))), ArrayList::new));
@@ -694,6 +734,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());
@@ -801,6 +849,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());
@@ -1356,6 +1412,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());
@@ -1447,6 +1511,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());
@@ -1579,6 +1651,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 										}
 									}
 									feeCenterListMh.addAll(amendFeeCenterList);
+									for (FeeCenter items : feeCenterListMh) {
+										BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
+										if (bCorps != null) {
+											items.setCorpCnName(bCorps.getShortName());
+										}
+										BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(items.getBillCorpId())).findFirst().orElse(null);
+										if (bCorp != null) {
+											items.setBillCorpCnName(bCorp.getShortName());
+										}
+									}
 									List<FeeCenter> feeCenterList = feeCenterListMh.stream()
 										.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 											Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode() + f.getReportType()))), ArrayList::new));
@@ -1729,6 +1811,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						}
 						feeCenterList.addAll(amendFeeCenterList);
 						if (!feeCenterList.isEmpty()) {
+							for (FeeCenter item : feeCenterList) {
+								BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+								if (bCorps != null) {
+									item.setCorpCnName(bCorps.getShortName());
+								}
+								BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+								if (bCorp != null) {
+									item.setBillCorpCnName(bCorp.getShortName());
+								}
+							}
 							feeCenterList.stream().filter(e -> ObjectUtils.isNull(e.getReportType())).forEach(e -> e.setReportType("0"));
 							List<FeeCenter> feeCenters = feeCenterList.stream()
 								.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
@@ -1882,6 +1974,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							}
 							feeCenterList.addAll(amendFeeCenterList);
 							if (!feeCenterList.isEmpty()) {
+								for (FeeCenter item : feeCenterList) {
+									BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+									if (bCorps != null) {
+										item.setCorpCnName(bCorps.getShortName());
+									}
+									BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+									if (bCorp != null) {
+										item.setBillCorpCnName(bCorp.getShortName());
+									}
+								}
 								feeCenterList.stream().filter(e -> ObjectUtils.isNull(e.getReportType())).forEach(e -> e.setReportType("0"));
 								List<FeeCenter> feeCenters = feeCenterList.stream()
 									.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
@@ -2032,6 +2134,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 								}
 							}
 							feeCenterListMh.addAll(amendFeeCenterList);
+							for (FeeCenter item : feeCenterListMh) {
+								BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+								if (bCorps != null) {
+									item.setCorpCnName(bCorps.getShortName());
+								}
+								BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+								if (bCorp != null) {
+									item.setBillCorpCnName(bCorp.getShortName());
+								}
+							}
 							List<FeeCenter> feeCenterList1 = feeCenterListMh.stream()
 								.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 									Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode() + f.getReportType()))), ArrayList::new));
@@ -2417,6 +2529,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 										}
 									}
 									feeCenterListMh.addAll(amendFeeCenterList);
+									for (FeeCenter items : feeCenterListMh) {
+										BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
+										if (bCorps != null) {
+											items.setCorpCnName(bCorps.getShortName());
+										}
+										BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(items.getBillCorpId())).findFirst().orElse(null);
+										if (bCorp != null) {
+											items.setBillCorpCnName(bCorp.getShortName());
+										}
+									}
 									List<FeeCenter> feeCenterList = feeCenterListMh.stream()
 										.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 											Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode() + f.getReportType()))), ArrayList::new));
@@ -2567,6 +2689,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						}
 						feeCenterList.addAll(amendFeeCenterList);
 						if (!feeCenterList.isEmpty()) {
+							for (FeeCenter item : feeCenterList) {
+								BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+								if (bCorps != null) {
+									item.setCorpCnName(bCorps.getShortName());
+								}
+								BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+								if (bCorp != null) {
+									item.setBillCorpCnName(bCorp.getShortName());
+								}
+							}
 							feeCenterList.stream().filter(e -> ObjectUtils.isNull(e.getReportType())).forEach(e -> e.setReportType("0"));
 							List<FeeCenter> feeCenters = feeCenterList.stream()
 								.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
@@ -2720,6 +2852,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							}
 							feeCenterList.addAll(amendFeeCenterList);
 							if (!feeCenterList.isEmpty()) {
+								for (FeeCenter item : feeCenterList) {
+									BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+									if (bCorps != null) {
+										item.setCorpCnName(bCorps.getShortName());
+									}
+									BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+									if (bCorp != null) {
+										item.setBillCorpCnName(bCorp.getShortName());
+									}
+								}
 								feeCenterList.stream().filter(e -> ObjectUtils.isNull(e.getReportType())).forEach(e -> e.setReportType("0"));
 								List<FeeCenter> feeCenters = feeCenterList.stream()
 									.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
@@ -2870,6 +3012,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 								}
 							}
 							feeCenterListMh.addAll(amendFeeCenterList);
+							for (FeeCenter item : feeCenterListMh) {
+								BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+								if (bCorps != null) {
+									item.setCorpCnName(bCorps.getShortName());
+								}
+								BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+								if (bCorp != null) {
+									item.setBillCorpCnName(bCorp.getShortName());
+								}
+							}
 							List<FeeCenter> feeCenterList1 = feeCenterListMh.stream()
 								.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 									Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode() + f.getReportType()))), ArrayList::new));
@@ -3210,6 +3362,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 								.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 								.eq(FeeCenter::getIsDeleted, 0));
 							for (AeaBills item : billsList) {
+								for (FeeCenter items : feeCenterListMh) {
+									BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
+									if (bCorps != null) {
+										items.setCorpCnName(bCorps.getShortName());
+									}
+									BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(items.getBillCorpId())).findFirst().orElse(null);
+									if (bCorp != null) {
+										items.setBillCorpCnName(bCorp.getShortName());
+									}
+								}
 								List<FeeCenter> feeCenterList = feeCenterListMh.stream()
 									.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 										Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode()))), ArrayList::new));
@@ -3280,6 +3442,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 						.eq(FeeCenter::getIsDeleted, 0));
 					if (!feeCenterList.isEmpty()) {
+						for (FeeCenter item : feeCenterList) {
+							BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+							if (bCorps != null) {
+								item.setCorpCnName(bCorps.getShortName());
+							}
+							BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+							if (bCorp != null) {
+								item.setBillCorpCnName(bCorp.getShortName());
+							}
+						}
 						List<FeeCenter> feeCenters = feeCenterList.stream()
 							.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 								Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode()))), ArrayList::new));
@@ -3354,6 +3526,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 							.eq(FeeCenter::getIsDeleted, 0));
 						if (!feeCenterList.isEmpty()) {
+							for (FeeCenter item : feeCenterList) {
+								BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+								if (bCorps != null) {
+									item.setCorpCnName(bCorps.getShortName());
+								}
+								BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+								if (bCorp != null) {
+									item.setBillCorpCnName(bCorp.getShortName());
+								}
+							}
 							List<FeeCenter> feeCenters = feeCenterList.stream()
 								.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 									Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode()))), ArrayList::new));
@@ -3421,6 +3603,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							.eq(FeeCenter::getPid, details.getId())
 							.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 							.eq(FeeCenter::getIsDeleted, 0));
+						for (FeeCenter item : feeCenterListMh) {
+							BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+							if (bCorps != null) {
+								item.setCorpCnName(bCorps.getShortName());
+							}
+							BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+							if (bCorp != null) {
+								item.setBillCorpCnName(bCorp.getShortName());
+							}
+						}
 						List<FeeCenter> feeCenterList1 = feeCenterListMh.stream()
 							.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 								Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode()))), ArrayList::new));
@@ -3647,6 +3839,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());
@@ -3754,6 +3954,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());
@@ -3834,6 +4042,16 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 					.eq(FeeCenter::getIsDeleted, 0));
 				if (!feeCenterList.isEmpty()) {
+					for (FeeCenter item : feeCenterList) {
+						BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+						if (bCorps != null) {
+							item.setCorpCnName(bCorps.getShortName());
+						}
+						BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+						if (bCorp != null) {
+							item.setBillCorpCnName(bCorp.getShortName());
+						}
+					}
 					List<FeeCenter> feeCenters = feeCenterList.stream()
 						.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
 							Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode()))), ArrayList::new));
@@ -3984,6 +4202,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());
@@ -4080,6 +4306,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				BigDecimal amountProfitLoc;
 				List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
 				for (FeeCenter item : feeCenterList) {
+					BCorps bCorps = bCorpsLists.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().orElse(null);
+					if (bCorps != null) {
+						item.setCorpCnName(bCorps.getShortName());
+					}
+					BCorps bCorp = bCorpsLists.stream().filter(e -> e.getId().equals(item.getBillCorpId())).findFirst().orElse(null);
+					if (bCorp != null) {
+						item.setBillCorpCnName(bCorp.getShortName());
+					}
 					if (MagicValues.D.equals(item.getDc())) {
 						if (MagicValues.USD.equals(item.getCurCode())) {
 							amountDrUsd = amountDrUsd.add(item.getAmount());

+ 102 - 14
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml

@@ -1710,8 +1710,8 @@ ORDER BY
     <select id="salesmanProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
         SELECT
             BO.charge_member as chargeMember,
-            SUM(BO.debit_amount) AS amount,
-            SUM(BOI.quantity) AS quantity,
+            SUM( bdf.delivery_amount ) AS amount,
+            SUM( bdf.actual_quantity ) AS quantity,
             SUM(BOI.purchaseAmount) AS purchaseAmount,
             SUM(BO.this_used_profit) AS thisUsedProfit,
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
@@ -1732,6 +1732,21 @@ ORDER BY
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        bd.org_order_no,
+        SUM( bdi.delivery_amount ) AS delivery_amount,
+        SUM( bdi.actual_quantity ) AS actual_quantity
+        FROM
+        business_delivery bd
+        LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
+        WHERE
+        bd.tenant_id = '681169'
+        AND bd.is_deleted = 0
+        AND bd.bill_type = 'FH'
+        GROUP BY
+        bd.org_order_no
+        ) bdf ON BO.morder_no = bdf.org_order_no
         LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
         <where>
             BO.tenant_id = #{statisticsVo.tenantId}
@@ -1819,8 +1834,8 @@ ORDER BY
     <select id="salesmanProfitExport" resultType="org.springblade.purchase.sales.excel.SalesmanProfitExcel">
         SELECT
         BO.charge_member as chargeMember,
-        SUM(BO.debit_amount) AS amount,
-        SUM(BOI.quantity) AS quantity,
+        SUM( bdf.delivery_amount ) AS amount,
+        SUM( bdf.actual_quantity ) AS quantity,
         SUM(BOI.purchaseAmount) AS purchaseAmount,
         SUM(BO.this_used_profit) AS thisUsedProfit,
         SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
@@ -1841,6 +1856,21 @@ ORDER BY
         GROUP BY
         pid
         ) BOI ON BOI.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        bd.org_order_no,
+        SUM( bdi.delivery_amount ) AS delivery_amount,
+        SUM( bdi.actual_quantity ) AS actual_quantity
+        FROM
+        business_delivery bd
+        LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
+        WHERE
+        bd.tenant_id = '681169'
+        AND bd.is_deleted = 0
+        AND bd.bill_type = 'FH'
+        GROUP BY
+        bd.org_order_no
+        ) bdf ON BO.morder_no = bdf.org_order_no
         LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
         <where>
             BO.tenant_id = #{statisticsVo.tenantId}
@@ -1873,8 +1903,8 @@ ORDER BY
     <select id="customerProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
         SELECT
             BCD.cname AS corpName,
-            SUM( BO.debit_amount ) AS amount,
-            SUM( BOI.quantity ) AS quantity,
+            SUM( bdf.delivery_amount ) AS amount,
+            SUM( bdf.actual_quantity ) AS quantity,
             SUM( BOI.purchaseAmount ) AS purchaseAmount,
             SUM( BO.this_used_profit ) AS thisUsedProfit,
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
@@ -1899,6 +1929,21 @@ ORDER BY
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        bd.org_order_no,
+        SUM( bdi.delivery_amount ) AS delivery_amount,
+        SUM( bdi.actual_quantity ) AS actual_quantity
+        FROM
+        business_delivery bd
+        LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
+        WHERE
+        bd.tenant_id = '681169'
+        AND bd.is_deleted = 0
+        AND bd.bill_type = 'FH'
+        GROUP BY
+        bd.org_order_no
+        ) bdf ON BO.morder_no = bdf.org_order_no
         LEFT JOIN basic_corps_desc BCD ON BCD.id = BO.corp_id
         LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
         <where>
@@ -1996,8 +2041,8 @@ ORDER BY
     <select id="customerProfitExport" resultType="org.springblade.purchase.sales.excel.CustomerProfitExcel">
         SELECT
         BCD.cname AS corpName,
-        SUM( BO.debit_amount ) AS amount,
-        SUM( BOI.quantity ) AS quantity,
+        SUM( bdf.delivery_amount ) AS amount,
+        SUM( bdf.actual_quantity ) AS quantity,
         SUM( BOI.purchaseAmount ) AS purchaseAmount,
         SUM( BO.this_used_profit ) AS thisUsedProfit,
         SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
@@ -2018,6 +2063,21 @@ ORDER BY
         GROUP BY
         pid
         ) BOI ON BOI.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        bd.org_order_no,
+        SUM( bdi.delivery_amount ) AS delivery_amount,
+        SUM( bdi.actual_quantity ) AS actual_quantity
+        FROM
+        business_delivery bd
+        LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
+        WHERE
+        bd.tenant_id = '681169'
+        AND bd.is_deleted = 0
+        AND bd.bill_type = 'FH'
+        GROUP BY
+        bd.org_order_no
+        ) bdf ON BO.morder_no = bdf.org_order_no
         LEFT JOIN basic_corps_desc BCD ON BCD.id = BO.corp_id
         LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
         <where>
@@ -2048,9 +2108,8 @@ ORDER BY
     <select id="brandProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
         SELECT
             BGD.brand AS brand,
-            SUM( BO.debit_amount ) AS amount,
-            SUM( BOI.purchaseAmount ) AS purchaseAmount,
-            SUM( BOI.quantity ) AS quantity,
+            SUM( bdf.delivery_amount ) AS amount,
+            SUM( bdf.actual_quantity ) AS quantity,
             SUM( BO.this_used_profit ) AS thisUsedProfit,
             FORMAT(( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ),2) AS price,
             FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ),2) AS singleGrossProfit,
@@ -2072,6 +2131,21 @@ ORDER BY
                 GROUP BY
                     pid
             ) BOI ON BOI.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        bd.org_order_no,
+        SUM( bdi.delivery_amount ) AS delivery_amount,
+        SUM( bdi.actual_quantity ) AS actual_quantity
+        FROM
+        business_delivery bd
+        LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
+        WHERE
+        bd.tenant_id = '681169'
+        AND bd.is_deleted = 0
+        AND bd.bill_type = 'FH'
+        GROUP BY
+        bd.org_order_no
+        ) bdf ON BO.morder_no = bdf.org_order_no
          LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
         <where>
             BO.tenant_id = #{statisticsVo.tenantId}
@@ -2149,9 +2223,8 @@ ORDER BY
     <select id="brandProfitExport" resultType="org.springblade.purchase.sales.excel.BrandProfitExcel">
         SELECT
         BGD.brand AS brand,
-        SUM( BO.debit_amount ) AS amount,
-        SUM( BOI.purchaseAmount ) AS purchaseAmount,
-        SUM( BOI.quantity ) AS quantity,
+        SUM( bdf.delivery_amount ) AS amount,
+        SUM( bdf.actual_quantity ) AS quantity,
         SUM( BO.this_used_profit ) AS thisUsedProfit,
         FORMAT(( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ),2) AS price,
         FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ),2) AS singleGrossProfit,
@@ -2173,6 +2246,21 @@ ORDER BY
         GROUP BY
         pid
         ) BOI ON BOI.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        bd.org_order_no,
+        SUM( bdi.delivery_amount ) AS delivery_amount,
+        SUM( bdi.actual_quantity ) AS actual_quantity
+        FROM
+        business_delivery bd
+        LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
+        WHERE
+        bd.tenant_id = '681169'
+        AND bd.is_deleted = 0
+        AND bd.bill_type = 'FH'
+        GROUP BY
+        bd.org_order_no
+        ) bdf ON BO.morder_no = bdf.org_order_no
         LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
         <where>
             BO.tenant_id = #{statisticsVo.tenantId}

+ 13 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsDescController.java

@@ -418,6 +418,19 @@ public class CorpsDescController extends BladeController {
 	}
 
 	/**
+	 * app新增或修改客户
+	 */
+	@PostMapping("/appSubmitV1")
+	@ApiOperationSupport(order = 16)
+	@ApiOperation(value = "新增或修改", notes = "传入corpsDesc")
+	public R appSubmitV1(@Valid @RequestBody PjCorpsDesc corpsDesc) {
+		if (StringUtils.isBlank(corpsDesc.getTenantId())) {
+			corpsDesc.setTenantId(SecureUtil.getTenantId());
+		}
+		return corpsDescService.saveCorpsDescApp(corpsDesc);
+	}
+
+	/**
 	 * 是否存在
 	 */
 	@GetMapping("/whetherExistence")

+ 2 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/ICorpsDescService.java

@@ -116,4 +116,6 @@ public interface ICorpsDescService extends IService<PjCorpsDesc> {
 	List<PjCorpsDesc> selectPartsCorpsStatistics(PjCorpsDesc corpsDescDto);
 
 	List<PjCorpsDesc> selectPartsCorpsDesc(PjCorpsDesc corpsDescDto);
+
+	R saveCorpsDescApp(PjCorpsDesc corpsDesc);
 }

+ 182 - 10
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/impl/CorpsDescServiceImpl.java

@@ -42,6 +42,8 @@ import org.springblade.salesPart.vo.CorpsDescVO;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
+import org.springblade.system.user.entity.UserInfo;
+import org.springblade.system.user.enums.UserEnum;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -661,6 +663,175 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 		return baseMapper.selectPartsCorpsDesc(corpsDescDto);
 	}
 
+	@Override
+	public R saveCorpsDescApp(PjCorpsDesc corpsDesc) {
+		Long userId = SecureUtil.getUserId();
+		Long deptId = Long.valueOf(AuthUtil.getDeptId());
+		Date date = new Date();
+		if (null == corpsDesc.getInitials() || "".equals(corpsDesc.getInitials())) {//首字母为空
+			//获得名称首字母
+			String initials = getSpells(corpsDesc.getCname());
+			corpsDesc.setInitials(initials.substring(0, 1));
+		}
+		R<Dept> resDept = sysClient.getDept(Long.parseLong(AuthUtil.getDeptId()));
+		if (!resDept.isSuccess() || ObjectUtils.isNull(resDept.getData())) {
+			throw new RuntimeException("未找到小程序id");
+		}
+		String deptName = resDept.getData().getFullName();
+		//保存客户信息
+		corpsDesc.setCorpType("KH");
+		if (StringUtils.isBlank(corpsDesc.getCname())) {
+			return R.data(200, "error", "客户名称不能为空");
+		}
+		User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
+		if (ObjectUtils.isNull(user)) {
+			//用户不存在,注册用户
+			User saveUser = new User();
+			saveUser.setAppletsId(resDept.getData().getAppletsId());
+			saveUser.setTenantId(AuthUtil.getTenantId());
+			saveUser.setAccount(corpsDesc.getTel());
+			saveUser.setName(corpsDesc.getTel());
+			saveUser.setRealName(corpsDesc.getTel());
+			saveUser.setUserType(4);
+			saveUser.setPhone(corpsDesc.getTel());
+			saveUser.setDeptId(AuthUtil.getDeptId());
+			//获取注册用户类型
+			R<String> r = sysClient.getRoleIds(AuthUtil.getTenantId(), "客户");
+			if (r.isSuccess() && ObjectUtils.isNotNull(r.getData())) {
+				saveUser.setRoleId(r.getData());
+			} else {
+				saveUser.setRoleId("");
+			}
+			saveUser.setPassword("123456");
+			R<Boolean> result = userClient.saveUser(saveUser);
+			if (!result.isSuccess()) {
+				throw new RuntimeException(result.getMsg());
+			}
+			R<UserInfo> resu = userClient.userInfo(AuthUtil.getTenantId(), corpsDesc.getTel(), UserEnum.WECHAT.getName());
+			if (resu.isSuccess()) {
+				user = resu.getData().getUser();
+			} else {
+				throw new RuntimeException("创建用户失败");
+			}
+		}
+		if (null == corpsDesc.getId()) {
+			corpsDesc.setTenantId(SecureUtil.getTenantId());
+			corpsDesc.setCreateDept(Long.valueOf(SecureUtil.getDeptId()));
+			corpsDesc.setCreateTime(date);
+			corpsDesc.setCreateUser(userId);
+			corpsDesc.setPriceSystem("售价1");
+			corpsDesc.setSalesCompanyId(deptId);
+			corpsDesc.setSalesCompanyName(deptName);
+			baseMapper.insert(corpsDesc);
+			Long pId = corpsDesc.getId();
+			String tenantId = corpsDesc.getTenantId();
+
+			//保存客户联系人信息
+			PjCorpsAttn corpsAttn = new PjCorpsAttn();
+			if (ObjectUtils.isNotNull(user)) {
+				long count = corpsAttnService.count(new LambdaQueryWrapper<PjCorpsAttn>()
+					.eq(PjCorpsAttn::getUserId, user.getId())
+					.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
+					.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
+					.eq(PjCorpsAttn::getIsDeleted, 0));
+				if (count > 0) {
+					throw new RuntimeException("手机号已存在,提交失败");
+				}
+				corpsAttn.setUserId(user.getId());
+			}
+			corpsAttn.setCname(corpsDesc.getAttn());
+			corpsAttn.setTel(corpsDesc.getTel());
+			corpsAttn.setTenantId(AuthUtil.getTenantId());
+			corpsAttn.setPid(corpsDesc.getId());
+			corpsAttn.setCreateTime(new Date());
+			corpsAttn.setTenantId(AuthUtil.getTenantId());
+			corpsAttn.setCreateUser(AuthUtil.getUserId());
+			corpsAttn.setSalesCompanyId(deptId);
+			corpsAttn.setSalesCompanyName(deptName);
+			corpsAttnService.save(corpsAttn);
+
+			//保存客户地址信息
+			PjCorpsAddr corpsAddr = new PjCorpsAddr();
+			corpsAddr.setContacts(corpsDesc.getAttn());
+			corpsAddr.setTel(corpsDesc.getTel());
+			corpsAddr.setBelongtoarea(corpsDesc.getAddr());
+			corpsAddr.setDetailedAddress(corpsDesc.getDetails());
+			corpsAddr.setTenantId(AuthUtil.getTenantId());
+			corpsAddr.setPid(corpsDesc.getId());
+			corpsAddr.setCreateTime(new Date());
+			corpsAddr.setTenantId(AuthUtil.getTenantId());
+			corpsAddr.setCreateUser(AuthUtil.getUserId());
+			corpsAddr.setDefaultAddres("1");
+			corpsAddrService.save(corpsAddr);
+			//保存客户与类别对应关系
+			this.saveOrUpdateTypeDesc(corpsDesc, userId, pId, date, tenantId);
+		} else {
+			corpsDesc.setUpdateTime(new Date());
+			corpsDesc.setUpdateUser(AuthUtil.getUserId());
+			baseMapper.updateById(corpsDesc);
+			PjCorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
+				.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
+				.eq(PjCorpsAttn::getPid, corpsDesc.getId())
+				.eq(PjCorpsAttn::getTel, corpsDesc.getTel()));
+			if (ObjectUtils.isNotNull(corpsAttn)) {
+				if (ObjectUtils.isNotNull(user)) {
+					corpsAttn.setUserId(user.getId());
+				}
+				corpsAttn.setCname(corpsDesc.getAttn());
+				corpsAttn.setTel(corpsDesc.getTel());
+				corpsAttn.setSalesCompanyId(deptId);
+				corpsAttn.setSalesCompanyName(deptName);
+				corpsAttnService.updateById(corpsAttn);
+			} else {
+				//保存客户联系人信息
+				PjCorpsAttn corpsAttn1 = new PjCorpsAttn();
+				if (ObjectUtils.isNotNull(user)) {
+					corpsAttn1.setUserId(user.getId());
+				}
+				corpsAttn1.setCname(corpsDesc.getAttn());
+				corpsAttn1.setTel(corpsDesc.getTel());
+				corpsAttn1.setTenantId(AuthUtil.getTenantId());
+				corpsAttn1.setPid(corpsDesc.getId());
+				corpsAttn1.setCreateTime(new Date());
+				corpsAttn1.setCreateUser(AuthUtil.getUserId());
+				corpsAttn1.setSalesCompanyId(deptId);
+				corpsAttn1.setSalesCompanyName(deptName);
+				corpsAttnService.save(corpsAttn1);
+			}
+
+			PjCorpsAddr corpsAddr = corpsAddrService.getOne(new LambdaQueryWrapper<PjCorpsAddr>().eq(PjCorpsAddr::getIsDeleted, 0)
+				.eq(PjCorpsAddr::getTenantId, AuthUtil.getTenantId())
+				.eq(PjCorpsAddr::getPid, corpsDesc.getId())
+				.eq(PjCorpsAddr::getTel, corpsDesc.getTel()));
+			if (ObjectUtils.isNotNull(corpsAddr)) {
+				corpsAddr.setContacts(corpsDesc.getAttn());
+				corpsAddr.setTel(corpsDesc.getTel());
+				corpsAddr.setBelongtoarea(corpsDesc.getAddr());
+				corpsAddr.setDetailedAddress(corpsDesc.getDetails());
+				corpsAddr.setSalesCompanyId(deptId);
+				corpsAddr.setSalesCompanyName(deptName);
+				corpsAddrService.updateById(corpsAddr);
+			} else {
+				//保存客户地址信息
+				PjCorpsAddr corpsAddr1 = new PjCorpsAddr();
+				corpsAddr1.setContacts(corpsDesc.getAttn());
+				corpsAddr1.setTel(corpsDesc.getTel());
+				corpsAddr1.setBelongtoarea(corpsDesc.getAddr());
+				corpsAddr1.setDetailedAddress(corpsDesc.getDetails());
+				corpsAddr1.setTenantId(AuthUtil.getTenantId());
+				corpsAddr1.setPid(corpsDesc.getId());
+				corpsAddr1.setCreateTime(new Date());
+				corpsAddr1.setTenantId(AuthUtil.getTenantId());
+				corpsAddr1.setCreateUser(AuthUtil.getUserId());
+				corpsAddr1.setSalesCompanyId(deptId);
+				corpsAddr1.setSalesCompanyName(deptName);
+				corpsAddr1.setDefaultAddres("0");
+				corpsAddrService.save(corpsAddr1);
+			}
+		}
+		return R.data(corpsDesc);
+	}
+
 	/**
 	 * 小程序新增或修改 客户详情
 	 *
@@ -673,32 +844,37 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 	public R saveCorpsDesc(PjCorpsDesc corpsDesc) {
 		Long userId = SecureUtil.getUserId();
 		Long deptId = Long.valueOf(AuthUtil.getDeptId());
-		String deptName = sysClient.getDept(Long.valueOf(AuthUtil.getDeptId())).getData().getFullName();
 		Date date = new Date();
-		if (null == corpsDesc.getInitials() || "" == corpsDesc.getInitials()) {//首字母为空
+		if (null == corpsDesc.getInitials() || "".equals(corpsDesc.getInitials())) {//首字母为空
 			//获得名称首字母
 			String initials = getSpells(corpsDesc.getCname());
 			corpsDesc.setInitials(initials.substring(0, 1));
 		}
-
+		R<Dept> resDept = sysClient.getDept(Long.parseLong(AuthUtil.getDeptId()));
+		if (!resDept.isSuccess() || ObjectUtils.isNull(resDept.getData())) {
+			throw new RuntimeException("未找到小程序id");
+		}
+		String deptName = resDept.getData().getFullName();
 		//保存客户信息
 		corpsDesc.setCorpType("KH");
 		if (StringUtils.isBlank(corpsDesc.getCname())) {
 			return R.data(200, "error", "客户名称不能为空");
 		}
 
-
 		PjCorpsDesc pjCorpsDesc = baseMapper.selectCorpsDescCname(corpsDesc.getCname(), AuthUtil.getDeptId(), AuthUtil.getTenantId());
 		if (ObjectUtils.isNotNull(pjCorpsDesc)) {
 			pjCorpsDesc.setSalesCompanyId(deptId);
 			pjCorpsDesc.setSalesCompanyName(deptName);
 			baseMapper.updateById(pjCorpsDesc);
-
 			PjCorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
 				.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
 				.eq(PjCorpsAttn::getPid, pjCorpsDesc.getId())
 				.eq(PjCorpsAttn::getTel, corpsDesc.getTel()));
 			if (ObjectUtils.isNotNull(corpsAttn)) {
+				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
+				if (ObjectUtils.isNotNull(user)) {
+					corpsAttn.setUserId(user.getId());
+				}
 				corpsAttn.setCname(corpsDesc.getAttn());
 				corpsAttn.setTel(corpsDesc.getTel());
 				corpsAttn.setSalesCompanyId(deptId);
@@ -707,7 +883,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 			} else {
 				//保存客户联系人信息
 				PjCorpsAttn corpsAttn1 = new PjCorpsAttn();
-				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), null);
+				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
 				if (ObjectUtils.isNotNull(user)) {
 					corpsAttn1.setUserId(user.getId());
 				}
@@ -766,10 +942,6 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 
 				//保存客户联系人信息
 				PjCorpsAttn corpsAttn = new PjCorpsAttn();
-				R<Dept> resDept = sysClient.getDept(Long.parseLong(AuthUtil.getDeptId()));
-				if (!resDept.isSuccess() || ObjectUtils.isNull(resDept.getData())) {
-					throw new RuntimeException("未找到小程序id");
-				}
 				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
 				if (ObjectUtils.isNotNull(user)) {
 					long count = corpsAttnService.count(new LambdaQueryWrapper<PjCorpsAttn>()

+ 13 - 15
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -645,12 +645,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 					.eq(PjStockDesc::getTenantId, AuthUtil.getTenantId())
 					.eq(PjStockDesc::getIsDeleted, 0)
 					.eq(PjStockDesc::getSalesCompanyId, gdShip.getSalesCompanyId())
-					.in(PjStockDesc::getGoodsId, goodsIds)
-					.eq(PjStockDesc::getStorageId, gdShip.getStorageId()));
-				pjStockDescListAll = stockDescService.list(new LambdaQueryWrapper<PjStockDesc>()
-					.eq(PjStockDesc::getTenantId, AuthUtil.getTenantId())
-					.eq(PjStockDesc::getIsDeleted, 0)
-					.eq(PjStockDesc::getSalesCompanyId, gdShip.getSalesCompanyId())
 					.in(PjStockDesc::getGoodsId, goodsIds));
 				//查询所有上架商品
 				pjProductLaunch = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
@@ -664,7 +658,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			List<PjGoodsDesc> finalPjGoodsDescList = pjGoodsDescList;
 			List<PjStockDesc> finalPjStockDescList = pjStockDescList;
 			List<PjProductLaunch> finalPjProductLaunch = pjProductLaunch;
-			List<PjStockDesc> finalPjStockDescListAll = pjStockDescListAll;
 			list.forEach(e -> {
 				//获得商品
 				PjGoodsDesc goodsDesc = finalPjGoodsDescList.stream().filter(i -> i.getId().equals(e.getGoodsId())).findFirst().orElse(null);
@@ -720,11 +713,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 						throw new RuntimeException(goodsDesc.getCname() + "已开启批次号管理,请填写批次号");
 					}
 					if (!finalPjStockDescList.isEmpty()) {
-						stockOne = finalPjStockDescList.stream().filter(i -> i.getGoodsId().equals(goodsDesc.getId()) && ObjectUtils.isNotNull(i.getDot()) && i.getDot().equals(e.getDot())).findFirst().orElse(null);
+						stockOne = finalPjStockDescList.stream().filter(i -> i.getGoodsId().equals(goodsDesc.getId())
+							&& i.getStorageId().equals(gdShip.getStorageId())
+							&& ObjectUtils.isNotNull(i.getDot()) && i.getDot().equals(e.getDot())).findFirst().orElse(null);
 					}
 				} else {
 					if (!finalPjStockDescList.isEmpty()) {
-						stockOne = finalPjStockDescList.stream().filter(i -> i.getGoodsId().equals(goodsDesc.getId()) && "".equals(i.getDot()) || i.getDot() == null).findFirst().orElse(null);
+						stockOne = finalPjStockDescList.stream().filter(i -> i.getGoodsId().equals(goodsDesc.getId())
+							&& i.getStorageId().equals(gdShip.getStorageId())
+							&& "".equals(i.getDot()) || i.getDot() == null).findFirst().orElse(null);
 					}
 				}
 				if (ObjectUtil.isEmpty(stockOne)) {
@@ -752,15 +749,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 					}
 					stockDesc.setVersion(stockOne.getVersion());
 				}
-				boolean count = stockDescService.saveOrUpdate(stockDesc);
-				if (!count) {
-					throw new RuntimeException(stockOne.getCname() + "该产品库存正在操作,请稍后刷新在进行操作!");
-				}
+				pjStockDescListAll.add(stockDesc);
 				/* ----------------------修改上架库存---------------------- */
 				BigDecimal balanceQuantity = new BigDecimal("0.00");
-				if (!finalPjStockDescListAll.isEmpty()) {
+				if (!finalPjStockDescList.isEmpty()) {
 					//查询所有该商品的库存
-					List<PjStockDesc> stockDescList = finalPjStockDescListAll.stream().filter(i -> i.getGoodsId().equals(e.getGoodsId())).collect(Collectors.toList());
+					List<PjStockDesc> stockDescList = finalPjStockDescList.stream().filter(i -> i.getGoodsId().equals(e.getGoodsId())).collect(Collectors.toList());
 					if (!stockDescList.isEmpty()) {
 						balanceQuantity = stockDescList.stream().map(PjStockDesc::getBalanceQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 					}
@@ -786,6 +780,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			if (!res.isSuccess()) {
 				throw new RuntimeException(res.getMsg());
 			}
+			boolean count = stockDescService.saveOrUpdateBatch(pjStockDescListAll);
+			if (!count) {
+				throw new RuntimeException("正在操作,请稍后刷新在进行操作!");
+			}
 			gdShip.setNumberRows(list.size());
 			shipItemsService.saveBatch(shipItemsList);
 			orderItemsService.updateBatchById(list);

+ 12 - 2
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/controller/ProductLaunchController.java

@@ -105,7 +105,7 @@ public class ProductLaunchController extends BladeController {
 			.eq(PjProductLaunch::getIsDeleted, 0)
 			.eq(ObjectUtils.isNotNull(productLaunch.getBrandId()), PjProductLaunch::getBrandId, productLaunch.getBrandId())
 			.like(ObjectUtils.isNotNull(productLaunch.getBrandItem()), PjProductLaunch::getBrandItem, productLaunch.getBrandItem())
-			.eq(PjProductLaunch::getBillType, productLaunch.getBillType())
+			.eq(ObjectUtils.isNotNull(productLaunch.getBillType()), PjProductLaunch::getBillType, productLaunch.getBillType())
 		;
 		if (ObjectUtils.isNotEmpty(productLaunch.getExplosionProof())
 			|| ObjectUtils.isNotEmpty(productLaunch.getOriginalFactory())
@@ -381,7 +381,7 @@ public class ProductLaunchController extends BladeController {
 			.eq(PjProductLaunch::getIsDeleted, 0)
 			.eq(ObjectUtils.isNotNull(productLaunch.getBrandId()), PjProductLaunch::getBrandId, productLaunch.getBrandId())
 			.like(ObjectUtils.isNotNull(productLaunch.getBrandItem()), PjProductLaunch::getBrandItem, productLaunch.getBrandItem())
-			.eq(PjProductLaunch::getBillType, productLaunch.getBillType())
+			.eq(ObjectUtils.isNotNull(productLaunch.getBillType()), PjProductLaunch::getBillType, productLaunch.getBillType())
 		;
 		if (ObjectUtils.isNotEmpty(productLaunch.getExplosionProof())
 			|| ObjectUtils.isNotEmpty(productLaunch.getOriginalFactory())
@@ -403,6 +403,16 @@ public class ProductLaunchController extends BladeController {
 		} else {
 			lambdaQueryWrapper.apply(ObjectUtil.isNotEmpty(productLaunch.getSharedCompany()), "find_in_set('" + productLaunch.getSharedCompany() + "',shared_company)");//共享公司
 		}
+		if ("1".equals(productLaunch.getWhetherIntegral())) {
+			List<PjGoodsDesc> pjGoodsDescList = goodsDescService.list(new LambdaQueryWrapper<PjGoodsDesc>()
+				.eq(PjGoodsDesc::getWhetherIntegral, "1")
+				.eq(PjGoodsDesc::getIsDeleted, 0)
+				.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId()));
+			if (!pjGoodsDescList.isEmpty()) {
+				List<Long> goodsId = pjGoodsDescList.stream().map(PjGoodsDesc::getId).collect(Collectors.toList());
+				lambdaQueryWrapper.in(PjProductLaunch::getGoodsId, goodsId);
+			}
+		}
 		List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(lambdaQueryWrapper);
 		String deptId = pjProductLaunchList.stream().map(PjProductLaunch::getSharedCompany).filter(ObjectUtils::isNotNull).distinct().collect(Collectors.joining(","));
 		R<List<Dept>> deptList = iSysClient.selectByDeptIds(deptId);

+ 2 - 2
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/service/impl/ProductLaunchServiceImpl.java

@@ -994,7 +994,7 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
 
 			//获得商品信息
 			PjGoodsDesc pjGoodsDesc = pjGoodsDescsList.stream()
-				.filter(i -> i.getCname().equals(productLaunch.getCname())).findFirst().orElse(null);
+				.filter(i -> i.getCode().equals(e.getCode())).findFirst().orElse(null);
 		/*	PjGoodsDesc pjGoodsDesc = goodsDescMapper.selectOne(new LambdaQueryWrapper<PjGoodsDesc>()
 				.eq(PjGoodsDesc::getIsDeleted, 0)
 				.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
@@ -1049,7 +1049,7 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
 			// 如果名称相等 就认为重复
 			LambdaQueryWrapper<PjProductLaunch> queryWrapper = new LambdaQueryWrapper<>();
 			queryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
-				.eq(PjProductLaunch::getCname, productLaunch.getCname())
+				.eq(PjProductLaunch::getCname, pjGoodsDesc.getCname())
 				.eq(PjProductLaunch::getSalesCompanyId, productLaunch.getSalesCompanyId())
 				.eq(PjProductLaunch::getIsDeleted, 0)
 				.eq(PjProductLaunch::getBillType, 0);

+ 100 - 49
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/stock/controller/StockDescController.java

@@ -102,21 +102,7 @@ public class StockDescController extends BladeController {
 			.like(ObjectUtil.isNotEmpty(stockDesc.getDot()), PjStockDesc::getDot, stockDesc.getDot())
 			.orderByAsc(PjStockDesc::getCreateTime);
 		if ("0".equals(stockDesc.getWhether())) {
-			lambdaQueryWrapper.ne(PjStockDesc::getStoreInventory, 0);
-		}
-		if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
-			List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
-				.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
-				.eq(PjProductLaunch::getIsDeleted, 0)
-				.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
-			if (!pjProductLaunchList.isEmpty()) {
-				List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
-				if ("0".equals(stockDesc.getIfGrounding())) {
-					lambdaQueryWrapper.in(PjStockDesc::getGoodsId, ids);
-				} else {
-					lambdaQueryWrapper.ne(PjStockDesc::getGoodsId, ids);
-				}
-			}
+			lambdaQueryWrapper.ne(PjStockDesc::getBalanceQuantity, 0);
 		}
 		if (ObjectUtil.isNotEmpty(stockDesc.getCname())) {
 			List<PjGoodsDesc> pjGoodsDescs = goodsDescService.list(new LambdaQueryWrapper<PjGoodsDesc>()
@@ -125,11 +111,42 @@ public class StockDescController extends BladeController {
 				.like(PjGoodsDesc::getCnameInt, stockDesc.getCname()));
 			if (!pjGoodsDescs.isEmpty()) {
 				List<Long> ids = pjGoodsDescs.stream().map(PjGoodsDesc::getId).collect(Collectors.toList());
-				lambdaQueryWrapper.and(i -> i.like(PjStockDesc::getCname, stockDesc.getCname())
-					.or().in(PjStockDesc::getGoodsId, ids));
+				if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
+					List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
+						.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+						.eq(PjProductLaunch::getIsDeleted, 0)
+						.in(PjProductLaunch::getGoodsId, ids)
+						.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
+					if (!pjProductLaunchList.isEmpty()) {
+						List<Long> goodIds = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
+						if ("0".equals(stockDesc.getIfGrounding())) {
+							lambdaQueryWrapper.notIn(PjStockDesc::getGoodsId, goodIds);
+						} else {
+							lambdaQueryWrapper.in(PjStockDesc::getGoodsId, goodIds);
+						}
+					}
+				}else{
+					lambdaQueryWrapper.and(i -> i.like(PjStockDesc::getCname, stockDesc.getCname())
+						.or().in(PjStockDesc::getGoodsId, ids));
+				}
 			} else {
 				lambdaQueryWrapper.like(PjStockDesc::getCname, stockDesc.getCname());
 			}
+		}else{
+			if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
+				List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
+					.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+					.eq(PjProductLaunch::getIsDeleted, 0)
+					.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
+				if (!pjProductLaunchList.isEmpty()) {
+					List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
+					if ("0".equals(stockDesc.getIfGrounding())) {
+						lambdaQueryWrapper.notIn(PjStockDesc::getGoodsId, ids);
+					} else {
+						lambdaQueryWrapper.in(PjStockDesc::getGoodsId, ids);
+					}
+				}
+			}
 		}
 		IPage<PjStockDesc> pages = stockDescService.page(Condition.getPage(query), lambdaQueryWrapper);
 		if (!pages.getRecords().isEmpty()) {
@@ -343,20 +360,6 @@ public class StockDescController extends BladeController {
 		if ("0".equals(stockDesc.getWhether())) {
 			lambdaQueryWrapper.ne(PjStockDesc::getStoreInventory, 0);
 		}
-		if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
-			List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
-				.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
-				.eq(PjProductLaunch::getIsDeleted, 0)
-				.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
-			if (!pjProductLaunchList.isEmpty()) {
-				List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
-				if ("0".equals(stockDesc.getIfGrounding())) {
-					lambdaQueryWrapper.in(PjStockDesc::getGoodsId, ids);
-				} else {
-					lambdaQueryWrapper.ne(PjStockDesc::getGoodsId, ids);
-				}
-			}
-		}
 		if (ObjectUtil.isNotEmpty(stockDesc.getCname())) {
 			List<PjGoodsDesc> pjGoodsDescs = goodsDescService.list(new LambdaQueryWrapper<PjGoodsDesc>()
 				.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
@@ -364,11 +367,42 @@ public class StockDescController extends BladeController {
 				.like(PjGoodsDesc::getCnameInt, stockDesc.getCname()));
 			if (!pjGoodsDescs.isEmpty()) {
 				List<Long> ids = pjGoodsDescs.stream().map(PjGoodsDesc::getId).collect(Collectors.toList());
-				lambdaQueryWrapper.and(i -> i.like(PjStockDesc::getCname, stockDesc.getCname())
-					.or().in(PjStockDesc::getGoodsId, ids));
+				if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
+					List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
+						.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+						.eq(PjProductLaunch::getIsDeleted, 0)
+						.in(PjProductLaunch::getGoodsId, ids)
+						.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
+					if (!pjProductLaunchList.isEmpty()) {
+						List<Long> goodIds = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
+						if ("0".equals(stockDesc.getIfGrounding())) {
+							lambdaQueryWrapper.notIn(PjStockDesc::getGoodsId, goodIds);
+						} else {
+							lambdaQueryWrapper.in(PjStockDesc::getGoodsId, goodIds);
+						}
+					}
+				}else{
+					lambdaQueryWrapper.and(i -> i.like(PjStockDesc::getCname, stockDesc.getCname())
+						.or().in(PjStockDesc::getGoodsId, ids));
+				}
 			} else {
 				lambdaQueryWrapper.like(PjStockDesc::getCname, stockDesc.getCname());
 			}
+		}else{
+			if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
+				List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
+					.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+					.eq(PjProductLaunch::getIsDeleted, 0)
+					.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
+				if (!pjProductLaunchList.isEmpty()) {
+					List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
+					if ("0".equals(stockDesc.getIfGrounding())) {
+						lambdaQueryWrapper.notIn(PjStockDesc::getGoodsId, ids);
+					} else {
+						lambdaQueryWrapper.in(PjStockDesc::getGoodsId, ids);
+					}
+				}
+			}
 		}
 		List<PjStockDesc> list = stockDescService.list(lambdaQueryWrapper);
 
@@ -395,20 +429,6 @@ public class StockDescController extends BladeController {
 		if ("0".equals(stockDesc.getWhether())) {
 			lambdaQueryWrapper.ne(PjStockDesc::getStoreInventory, 0);
 		}
-		if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
-			List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
-				.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
-				.eq(PjProductLaunch::getIsDeleted, 0)
-				.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
-			if (!pjProductLaunchList.isEmpty()) {
-				List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
-				if ("0".equals(stockDesc.getIfGrounding())) {
-					lambdaQueryWrapper.in(PjStockDesc::getGoodsId, ids);
-				} else {
-					lambdaQueryWrapper.ne(PjStockDesc::getGoodsId, ids);
-				}
-			}
-		}
 		if (ObjectUtil.isNotEmpty(stockDesc.getCname())) {
 			List<PjGoodsDesc> pjGoodsDescs = goodsDescService.list(new LambdaQueryWrapper<PjGoodsDesc>()
 				.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
@@ -416,11 +436,42 @@ public class StockDescController extends BladeController {
 				.like(PjGoodsDesc::getCnameInt, stockDesc.getCname()));
 			if (!pjGoodsDescs.isEmpty()) {
 				List<Long> ids = pjGoodsDescs.stream().map(PjGoodsDesc::getId).collect(Collectors.toList());
-				lambdaQueryWrapper.and(i -> i.like(PjStockDesc::getCname, stockDesc.getCname())
-					.or().in(PjStockDesc::getGoodsId, ids));
+				if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
+					List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
+						.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+						.eq(PjProductLaunch::getIsDeleted, 0)
+						.in(PjProductLaunch::getGoodsId, ids)
+						.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
+					if (!pjProductLaunchList.isEmpty()) {
+						List<Long> goodIds = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
+						if ("0".equals(stockDesc.getIfGrounding())) {
+							lambdaQueryWrapper.notIn(PjStockDesc::getGoodsId, goodIds);
+						} else {
+							lambdaQueryWrapper.in(PjStockDesc::getGoodsId, goodIds);
+						}
+					}
+				}else{
+					lambdaQueryWrapper.and(i -> i.like(PjStockDesc::getCname, stockDesc.getCname())
+						.or().in(PjStockDesc::getGoodsId, ids));
+				}
 			} else {
 				lambdaQueryWrapper.like(PjStockDesc::getCname, stockDesc.getCname());
 			}
+		}else{
+			if ("0".equals(stockDesc.getIfGrounding()) || "1".equals(stockDesc.getIfGrounding())) {
+				List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
+					.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+					.eq(PjProductLaunch::getIsDeleted, 0)
+					.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
+				if (!pjProductLaunchList.isEmpty()) {
+					List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).collect(Collectors.toList());
+					if ("0".equals(stockDesc.getIfGrounding())) {
+						lambdaQueryWrapper.notIn(PjStockDesc::getGoodsId, ids);
+					} else {
+						lambdaQueryWrapper.in(PjStockDesc::getGoodsId, ids);
+					}
+				}
+			}
 		}
 		List<PjStockDesc> list = stockDescService.list(lambdaQueryWrapper);
 		Map<String, BigDecimal> map = new HashMap<>();