浏览代码

Merge remote-tracking branch 'origin/saas' into saas

hgw 3 年之前
父节点
当前提交
9576f77ddf

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationCourseUnitPriceSettingsService.java

@@ -25,4 +25,6 @@ public interface OrganizationCourseUnitPriceSettingsService extends BaseService<
 	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseTypeAndChargeType(Integer organId, CourseScheduleType courseType, Integer chargeTypeId);
 
 	List<OrganizationCourseUnitPriceSettings> querySingle(Integer organId, String courseType, Integer tenantId);
+
+    int save(List<OrganizationCourseUnitPriceSettings> organizationCourseUnitPriceSettingsList);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -2437,6 +2437,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<CourseSchedule> courseScheduleList = new ArrayList<>();
 
         for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
+            List<ClassGroupTeacherMapper> teacherMappers = classGroup4MixDto.getClassGroupTeacherMapperList();
+            Set<Integer> collect = teacherMappers.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+            if(teacherMappers.size() != collect.size()){
+                throw new BizException("主教与助教存在冲突");
+            }
             //3、插入班级排课信息
             LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
 

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationCourseUnitPriceSettingsServiceImpl.java

@@ -11,6 +11,7 @@ import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
 import com.ym.mec.biz.service.OrganizationCourseUnitPriceSettingsService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
 
 @Service
 public class OrganizationCourseUnitPriceSettingsServiceImpl extends BaseServiceImpl<Integer, OrganizationCourseUnitPriceSettings>  implements OrganizationCourseUnitPriceSettingsService {
@@ -39,4 +40,17 @@ public class OrganizationCourseUnitPriceSettingsServiceImpl extends BaseServiceI
 		return organizationCourseUnitPriceSettingsDao.querySingle(organId, courseType, tenantId);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public int save(List<OrganizationCourseUnitPriceSettings> organizationCourseUnitPriceSettingsList) {
+		int successCount = 0;
+		for (OrganizationCourseUnitPriceSettings ocup : organizationCourseUnitPriceSettingsList) {
+			if (ocup.getId() != null) {
+				successCount += organizationCourseUnitPriceSettingsDao.update(ocup);
+			} else {
+				successCount += organizationCourseUnitPriceSettingsDao.insert(ocup);
+			}
+		}
+		return successCount;
+	}
 }

+ 11 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantConfigServiceImpl.java

@@ -1,5 +1,15 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.Date;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Consumer;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
@@ -9,17 +19,6 @@ import com.ym.mec.biz.dal.entity.TenantConfig;
 import com.ym.mec.biz.service.TenantConfigService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.WrapperUtil;
-import com.ym.mec.common.tenant.TenantContextHolder;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Date;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.function.Consumer;
 
 /**
  * @author hgw
@@ -52,7 +51,7 @@ public class TenantConfigServiceImpl extends ServiceImpl<TenantConfigDao, Tenant
 
     @Override
 	public TenantConfig queryByTenantId(Integer tenantId) {
-		return getOne(new WrapperUtil<TenantConfig>().hasEq("tenant_id_", TenantContextHolder.getTenantId())
+		return getOne(new WrapperUtil<TenantConfig>().hasEq("tenant_id_", tenantId)
 				.queryWrapper());
 	}
 

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/OrganizationCourseUnitPriceSettingsMapper.xml

@@ -125,7 +125,8 @@
 		GROUP BY course_type_
 	</select>
 	<select id="querySingle" resultType="com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings">
-		select * from organization_course_unit_price_settings where organ_id_ = #{organId} and course_type_ = #{courseType}
+		select * from organization_course_unit_price_settings
+		where organ_id_ = #{organId} and course_type_ = #{courseType}
 		<if test="tenantId != -1">
 			and tenant_id_ = #{tenantId}
 		</if>

+ 14 - 1
mec-web/src/main/java/com/ym/mec/web/controller/OrganizationCourseUnitPriceSettingsController.java

@@ -45,7 +45,7 @@ public class OrganizationCourseUnitPriceSettingsController extends BaseControlle
 	public Object querySingle(@PathVariable("organId")Integer organId,
 							  @PathVariable("courseType")String courseType) {
 		Integer tenantId = TenantContextHolder.getTenantId();
-		return organizationCourseUnitPriceSettingsService.querySingle(organId, courseType, tenantId);
+		return succeed(organizationCourseUnitPriceSettingsService.querySingle(organId, courseType, tenantId));
 	}
 
 	@ApiOperation(value = "新增对象")
@@ -77,6 +77,19 @@ public class OrganizationCourseUnitPriceSettingsController extends BaseControlle
 		return succeed();
 	}
 
+	@ApiOperation(value = "根据是否已有插入或更新")
+	@PostMapping(value = "/save", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/save')")
+	@AuditLogAnnotation(operateName = "修改分部课程单价")
+	public Object save(@RequestBody List<OrganizationCourseUnitPriceSettings> organizationCourseUnitPriceSettingsList) {
+		for (OrganizationCourseUnitPriceSettings ocup : organizationCourseUnitPriceSettingsList) {
+			if (ocup.getId() == null) {
+				ocup.setUpdateTime(new Date());
+			}
+		}
+		return succeed(organizationCourseUnitPriceSettingsService.save(organizationCourseUnitPriceSettingsList));
+	}
+
 	@ApiOperation(value = "删除收费类型")
 	@PostMapping("/del/{id}")
 	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/del')")