Bladeren bron

bug修改,tenantId查询遗漏,

zouxuan 3 jaren geleden
bovenliggende
commit
4375989391

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -5478,10 +5478,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			actualTeacherIds.addAll(courseSchedules.stream().map(e -> e.getTeacherId()).collect(Collectors.toSet()));
 			actualTeacherIds.addAll(courseSchedules.stream().map(e -> e.getOperatorId()).collect(Collectors.toSet()));
 			Set<Integer> schoolIds = courseSchedules.stream().map(e -> e.getSchoolId()).collect(Collectors.toSet());
-			Map<Integer, String> actualTeacherMap = getMap("sys_user", "id_", "real_name_", actualTeacherIds, Integer.class, String.class);
+			Map<Integer, String> actualTeacherMap = getMap("sys_user", "id_", "real_name_", actualTeacherIds,tenantId, Integer.class, String.class);
 			Map<Integer, String> schoolMap = new HashMap<>();
 			if(schoolIds != null && schoolIds.size() > 0){
-				schoolMap = getMap("school", "id_", "name_", schoolIds, Integer.class, String.class);
+				schoolMap = getMap("school", "id_", "name_", schoolIds,tenantId, Integer.class, String.class);
 			}
 			for (CourseScheduleModifyLog modifyLog : scheduleModifyLogs) {
 				CourseScheduleAuditDetailDto preAuditDetailDto = JSON.parseObject(modifyLog.getPreviousCourseSchedule(), CourseScheduleAuditDetailDto.class);

+ 3 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -21,6 +21,7 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
@@ -71,8 +72,8 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
         InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
         Map<String, String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.FINANCIAL_EXPENDITURE.getMsg());
         List<FinancialExpenditure> financialExpenditures = new ArrayList<>();
-        Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
-        Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);
+        Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, TenantContextHolder.getTenantId(), String.class, Integer.class);
+        Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, TenantContextHolder.getTenantId(), String.class, Integer.class);
         StringBuffer sb = new StringBuffer();
         for (String e : sheetsListMap.keySet()) {
             List<Map<String, Object>> sheet = sheetsListMap.get(e);

+ 1 - 40
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -202,7 +202,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
 		Map<String,String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.GOODS.getMsg());
 		List<Goods> goodsList = new ArrayList<>();
-		Map<String, Integer> map = getMap("goods_category","name_","id_",true,String.class,Integer.class);
+		Map<String, Integer> map = getMap("goods_category","name_","id_",true,TenantContextHolder.getTenantId(),String.class,Integer.class);
 		Map<String,String> courseViewTypeMap = new HashMap<>();
 		courseViewTypeMap.put("课程收费","0");
 		courseViewTypeMap.put("系统收费","1");
@@ -256,42 +256,6 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 						}
 						continue;
 					}
-					/*if (columnValue.equals("educationalShow")) {
-						for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
-							if (yesOrNoEnum.getMsg().equals(row.get(s).toString())) {
-								objectMap.put(columnValue, yesOrNoEnum);
-								break;
-							}
-						}
-						continue;
-					}
-					if (columnValue.equals("musicGroupShow")) {
-						for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
-							if (yesOrNoEnum.getMsg().equals(row.get(s).toString())) {
-								objectMap.put(columnValue, yesOrNoEnum);
-								break;
-							}
-						}
-						continue;
-					}
-					if (columnValue.equals("replacementShow")) {
-						for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
-							if (yesOrNoEnum.getMsg().equals(row.get(s).toString())) {
-								objectMap.put(columnValue, yesOrNoEnum);
-								break;
-							}
-						}
-						continue;
-					}
-					if (columnValue.equals("clientShow")) {
-						for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
-							if (yesOrNoEnum.getMsg().equals(row.get(s).toString())) {
-								objectMap.put(columnValue, yesOrNoEnum);
-								break;
-							}
-						}
-						continue;
-					}*/
 					if (columnValue.equals("stockWarning")) {
 						for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
 							if (yesOrNoEnum.getMsg().equals(row.get(s).toString())) {
@@ -392,9 +356,6 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			if(Objects.nonNull(newGoods.getDesc())&&!newGoods.getDesc().equals(existsGood.getDesc())){
 				existsGood.setDesc(newGoods.getDesc());
 			}
-//			if(Objects.nonNull(newGoods.getClientShow())&&!newGoods.getClientShow().equals(existsGood.getClientShow())){
-//				existsGood.setClientShow(newGoods.getClientShow());
-//			}
 			if(Objects.nonNull(newGoods.getStockWarning())&&!newGoods.getStockWarning().equals(existsGood.getStockWarning())){
 				existsGood.setStockWarning(newGoods.getStockWarning());
 			}

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -864,10 +864,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			dataList = musicGroupPaymentCalenderDao.queryAuditList(params);
 			List<Integer> collect = dataList.stream().map(e -> e.getOrganId()).collect(Collectors.toList());
 			collect.removeAll(Collections.singleton(null));
-			Map<Integer, String> organNameMap = getMap("organization", "id_", "name_", collect, Integer.class, String.class);
+			Map<Integer, String> organNameMap = getMap("organization", "id_", "name_", collect,queryInfo.getTenantId(), Integer.class, String.class);
 			List<Integer> operatorIds = dataList.stream().map(e -> e.getOperator()).collect(Collectors.toList());
 			operatorIds.removeAll(Collections.singleton(null));
-			Map<Integer, String> realNameMap = getMap("sys_user", "id_", "real_name_", operatorIds, Integer.class, String.class);
+			Map<Integer, String> realNameMap = getMap("sys_user", "id_", "real_name_", operatorIds,queryInfo.getTenantId(), Integer.class, String.class);
 			dataList.forEach(e->{
 				e.setOrganName(organNameMap.get(e.getOrganId()));
 				e.setOperatorName(realNameMap.get(e.getOperator()));
@@ -1197,10 +1197,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			params.put("offset", pageInfo.getOffset());
 			dataList = musicGroupPaymentCalenderDao.queryCalenderPage(params);
 			Set<Integer> organIdList = dataList.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
-			Map<Integer, String> organNameMap = getMap("organization", "id_", "name_", organIdList, Integer.class, String.class);
+			Map<Integer, String> organNameMap = getMap("organization", "id_", "name_", organIdList,queryInfo.getTenantId(), Integer.class, String.class);
 			List<Integer> operatorIds = dataList.stream().map(e -> e.getOperator()).collect(Collectors.toList());
 			operatorIds.removeAll(Collections.singleton(null));
-			Map<Integer, String> realNameMap = getMap("sys_user", "id_", "real_name_", operatorIds, Integer.class, String.class);
+			Map<Integer, String> realNameMap = getMap("sys_user", "id_", "real_name_", operatorIds,queryInfo.getTenantId(), Integer.class, String.class);
 			dataList.forEach(e->{
 				e.setOrganName(organNameMap.get(e.getOrganId()));
 				e.setOperatorName(realNameMap.get(e.getOperator()));

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -372,8 +372,8 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
         Map<String, String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.ROUTE_ORDER.getMsg());
         List<StudentPaymentRouteOrder> studentPaymentRouteOrders = new ArrayList<>();
-        Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
-        Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);
+        Map<String, Integer> organMap = getMap("organization", "name_", "id_", true,sysUser.getTenantId(), String.class, Integer.class);
+        Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true,sysUser.getTenantId(), String.class, Integer.class);
         StringBuffer sb = new StringBuffer();
         for (String e : sheetsListMap.keySet()) {
             List<Map<String, Object>> sheet = sheetsListMap.get(e);

+ 8 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -166,7 +166,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         }
 
         studentDao.lockUser(studentId);
-        SysUser student = sysUserFeignService.queryUserById(studentId);
+        SysUser student = studentDao.getUser(studentId);
         //如果教务老师为空,代表学员自己创建的订单
         if (studentGoodsSell.getTeacherId() == null) {
             //获取学生关联的所有教务老师列表
@@ -187,9 +187,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
         }
         List<Integer> goodsIds = goodsSellDtos.stream().map(GoodsSellDto::getGoodsId).collect(Collectors.toList());
-        Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds, Integer.class, String.class);
-        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, Integer.class, BigDecimal.class);
-        Map<Integer, BigDecimal> groupPriceMap = getMap("goods", "id_", "group_purchase_price_", goodsIds, Integer.class, BigDecimal.class);
+        Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds,student.getTenantId(), Integer.class, String.class);
+        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds,student.getTenantId(), Integer.class, BigDecimal.class);
+        Map<Integer, BigDecimal> groupPriceMap = getMap("goods", "id_", "group_purchase_price_", goodsIds,student.getTenantId(), Integer.class, BigDecimal.class);
         for (GoodsSellDto goodsSellDto : goodsSellDtos) {
             goodsSellDto.setGoodsType(integerStringMap.get(goodsSellDto.getGoodsId()));
             if (StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())) {
@@ -309,8 +309,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentDao.lockUser(studentId);
         List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(studentGoodsSell.getGoodsJson(), GoodsSellDto.class);
         List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
-        Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds, Integer.class, String.class);
-        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, Integer.class, BigDecimal.class);
+        Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds,studentGoodsSell.getTenantId(), Integer.class, String.class);
+        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds,studentGoodsSell.getTenantId(), Integer.class, BigDecimal.class);
         for (GoodsSellDto goodsSellDto : goodsSellDtos) {
             goodsSellDto.setGoodsType(integerStringMap.get(goodsSellDto.getGoodsId()));
             if (StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())) {
@@ -445,7 +445,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (studentInstrument != null && studentInstrument.getEndTime() != null && studentInstrument.getEndTime().compareTo(date) > 0) {
             repairInfo.setMaintenanceStatus(1);
         }
-        SysUser student = sysUserFeignService.queryUserById(repairInfo.getStudentId());
+        SysUser student = studentDao.getUser(repairInfo.getStudentId());
         repairInfo.setOrganId(student.getOrganId());
 
         BigDecimal amount = repairInfo.getAmount();
@@ -459,7 +459,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (StringUtils.isNotEmpty(goodsJson)) {
             List<RepairGoodsDto> repairGoodsDtos = JSONObject.parseArray(goodsJson, RepairGoodsDto.class);
             List<Integer> goodsIds = repairGoodsDtos.stream().map(e -> e.getId()).collect(Collectors.toList());
-            Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, Integer.class, BigDecimal.class);
+            Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds,student.getTenantId(), Integer.class, BigDecimal.class);
             repairGoodsDtos.forEach(e -> {
                 e.setGroupPurchasePrice(map.get(e.getId()));
             });

+ 2 - 2
mec-common/common-core/src/main/java/com/ym/mec/common/service/BaseService.java

@@ -86,7 +86,7 @@ public interface BaseService<PK extends Serializable, T> {
 	 * @param ids: key条件
 	 * @return java.util.List<java.util.Map>
 	 */
-	<K extends Collection, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue, K ids, Class<Y> keyType, Class<Z> valueType);
+	<K extends Collection, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue, K ids,Integer tenantId, Class<Y> keyType, Class<Z> valueType);
 
 	/**
 	 * @describe 获取columnKey-columnValue集合
@@ -107,7 +107,7 @@ public interface BaseService<PK extends Serializable, T> {
 	 * @param columnValue: value所对应的列名
 	 * @return java.util.List<java.util.Map>
 	 */
-	<K extends List, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue,Boolean hasDelFlag, Class<Y> keyType, Class<Z> valueType);
+	<K extends List, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue,Boolean hasDelFlag,Integer tenantId, Class<Y> keyType, Class<Z> valueType);
 
 
 }

+ 10 - 4
mec-common/common-core/src/main/java/com/ym/mec/common/service/impl/BaseServiceImpl.java

@@ -122,7 +122,7 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 
 
 	@Override
-	public <K extends Collection, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue, K ids, Class<Y> keyType, Class<Z> valueType){
+	public <K extends Collection, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue, K ids,Integer tenantId, Class<Y> keyType, Class<Z> valueType){
 		if(CollectionUtils.isEmpty(ids)){
 			return Collections.emptyMap();
 		}
@@ -132,6 +132,9 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 			SqlSession sqlSession = sqlSessionFactory.openSession();
 			Connection connection = sqlSession.getConnection();
 			sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName).append(" WHERE ").append(columnKey).append(" IN (").append(StringUtils.join(ids, ",")).append(")");
+			if(tenantId != null){
+				sql.append(" AND tenant_id_ = ").append(tenantId);
+			}
 			PreparedStatement ps = connection.prepareStatement(sql.toString());
 			ResultSet resultSet = ps.executeQuery();
 			while (resultSet.next()){
@@ -219,15 +222,18 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 
 
 	@Override
-	public <K extends List, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue,Boolean hasDelFlag, Class<Y> keyType, Class<Z> valueType){
+	public <K extends List, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue,Boolean hasDelFlag,Integer tenantId, Class<Y> keyType, Class<Z> valueType){
 		StringBuffer sql=new StringBuffer();
 		Map<Y,Z> result=new HashMap();
 		try {
 			SqlSession sqlSession = sqlSessionFactory.openSession();
 			Connection connection = sqlSession.getConnection();
-			sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName);
+			sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName).append(" WHERE 1 = 1");
 			if(hasDelFlag){
-				sql.append(" WHERE del_flag_ = 0");
+				sql.append(" AND del_flag_ = 0");
+			}
+			if(tenantId != null){
+				sql.append(" AND tenant_id_ = ").append(tenantId);
 			}
 			PreparedStatement ps = connection.prepareStatement(sql.toString());
 			ResultSet resultSet = ps.executeQuery();