Просмотр исходного кода

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 лет назад
Родитель
Сommit
e426b9cfb6

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupCategoryDao.java

@@ -10,6 +10,8 @@ public interface VipGroupCategoryDao extends BaseDAO<Integer, VipGroupCategory>
 
     List<VipGroupCategory> findAllByOrgan(String organId);
 
+    List<VipGroupCategory> findTeacherDefaultSalary(Integer userId);
+
     List<ConditionDto> findConditionCategorys();
 
 }

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

@@ -10,5 +10,7 @@ public interface VipGroupCategoryService extends BaseService<Integer, VipGroupCa
 
     List<VipGroupCategory> findAllByOrgan(String organId);
 
+    List<VipGroupCategory> findTeacherSalary(Integer userId);
+
     List<ConditionDto> findConditionCategorys();
 }

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

@@ -279,7 +279,7 @@ public class ContractServiceImpl implements ContractService {
 		if (calenders == null || calenders.size() == 0) {
 			params.put("paymentcalender", "一次性");
 		} else {
-			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining(",")));
+			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining(",")));
 		}
 		
 		params.put("isShowVisualSeal", false);
@@ -369,7 +369,7 @@ public class ContractServiceImpl implements ContractService {
 		if (calenders == null || calenders.size() == 0) {
 			params.put("paymentcalender", "一次性");
 		} else {
-			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining(",")));
+			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining(",")));
 		}
 		
 		params.put("isShowVisualSeal", true);

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

@@ -226,7 +226,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     return;
                 }
                 //计算教师责任总占比
-                double teacherLiabilityRatioSum = courseStudentComplaints.stream().mapToDouble(CourseScheduleComplaints::getTeacherLiabilityRatio).sum();
+                double teacherLiabilityRatioSum = courseStudentComplaints.stream().mapToDouble(courseScheduleComplaint->Objects.isNull(courseScheduleComplaint.getTeacherLiabilityRatio())?0:courseScheduleComplaint.getTeacherLiabilityRatio()).sum();
                 teacherLiabilityAllratio = new BigDecimal(teacherLiabilityRatioSum);
             } else {
                 //如果没有投诉,则教师和学生的责任占比为0
@@ -282,6 +282,9 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 }
                 if (!CollectionUtils.isEmpty(currentCourseScheduleComplaints)) {
                     Double temp = currentCourseScheduleComplaints.get(0).getStudentLiabilityRatio();
+                    if(Objects.isNull(temp)){
+                        temp=0.0;
+                    }
                     studentLiabilityRatio = new BigDecimal(temp);
                 } else {
                     studentLiabilityRatio = new BigDecimal(0);

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupCategoryServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dto.ConditionDto;
+import com.ym.mec.common.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -11,6 +12,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
 import java.util.List;
+import java.util.Objects;
 
 @Service
 public class VipGroupCategoryServiceImpl extends BaseServiceImpl<Integer, VipGroupCategory>  implements VipGroupCategoryService {
@@ -29,6 +31,14 @@ public class VipGroupCategoryServiceImpl extends BaseServiceImpl<Integer, VipGro
 	}
 
 	@Override
+	public List<VipGroupCategory> findTeacherSalary(Integer userId) {
+		if(Objects.isNull(userId)){
+			throw new BizException("请确定教师");
+		}
+		return vipGroupCategoryDao.findTeacherDefaultSalary(userId);
+	}
+
+	@Override
 	public List<ConditionDto> findConditionCategorys() {
 		return vipGroupCategoryDao.findConditionCategorys();
 	}

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

@@ -1,19 +1,19 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.ym.mec.biz.dal.dao.VipGroupDefaultClassesCycleDao;
 import com.ym.mec.biz.dal.entity.VipGroupDefaultClassesCycle;
 import com.ym.mec.biz.service.VipGroupDefaultClassesCycleService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
 
 @Service
 public class VipGroupDefaultClassesCycleServiceImpl extends BaseServiceImpl<Integer, VipGroupDefaultClassesCycle>  implements VipGroupDefaultClassesCycleService {
@@ -28,9 +28,6 @@ public class VipGroupDefaultClassesCycleServiceImpl extends BaseServiceImpl<Inte
 
 	@Override
 	public long insert(VipGroupDefaultClassesCycle bean) {
-		if(Objects.isNull(bean.getOrganId())){
-			throw new BizException("请指定部门");
-		}
 
 		if(vipGroupDefaultClassesCycleDao.countAll()<=0){
 			bean.setMinClassTimes(0);

+ 0 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -174,7 +174,6 @@
 		<where>
 			vg.id_=#{vipGroupId}
 			AND cs.group_type_='VIP'
-			AND FIND_IN_SET(#{organId},vg.organ_id_list_)
 			<if test="startTime!=null and endTime!=null">
 				AND (cs.class_date_ BETWEEN #{startTime} AND #{endTime})
 			</if>

+ 19 - 6
mec-biz/src/main/resources/config/mybatis/VipGroupCategoryMapper.xml

@@ -25,18 +25,32 @@
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="VipGroupCategory">
 		SELECT vgc.* FROM vip_group_category vgc
-		WHERE vgc.del_flag_=0
+		WHERE vgc.del_flag_!= 1
 		ORDER BY id_
 	</select>
 
 	<select id="findAllByOrgan" resultMap="VipGroupCategory">
 		SELECT vgc.*,vgdcup.online_classes_unit_price_,vgdcup.offline_classes_unit_price_ FROM vip_group_category vgc
 		LEFT JOIN vip_group_default_classes_unit_price_ vgdcup ON vgc.id_=vgdcup.vip_group_category_id_
-		WHERE vgc.del_flag_=0
+		WHERE vgc.del_flag_!= 1
 		AND FIND_IN_SET(vgdcup.organ_id_,#{organId})
 		ORDER BY id_
 	</select>
 
+	<select id="findTeacherDefaultSalary" resultMap="VipGroupCategory">
+		SELECT
+			vgc.*,
+			tdvgs.online_classes_salary_ online_classes_unit_price_,
+			tdvgs.offline_classes_salary_ offline_classes_unit_price_
+		FROM
+			vip_group_category vgc
+			LEFT JOIN teacher_default_vip_group_salary tdvgs ON vgc.id_ = tdvgs.vip_group_category_id_ AND tdvgs.user_id_=#{userId}
+		WHERE
+			vgc.del_flag_ = 0
+		ORDER BY
+			id_
+	</select>
+
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.VipGroupCategory"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
@@ -85,16 +99,15 @@
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="VipGroupCategory"
 		parameterType="map">
-		SELECT * FROM vip_group_category ORDER BY id_
+		SELECT * FROM vip_group_category where del_flag_ != 1 ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM
-		vip_group_category
+		SELECT COUNT(*) FROM vip_group_category where del_flag_ != 1
 	</select>
 	<select id="findConditionCategorys" resultType="com.ym.mec.biz.dal.dto.ConditionDto">
-      	select id_ id,name_ `name` from vip_group_category where del_flag_ = 0
+      	select id_ id,name_ `name` from vip_group_category where del_flag_ != 1
     </select>
 </mapper>

+ 0 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/service/impl/RedisIdGeneratorService.java

@@ -7,7 +7,6 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Service;

+ 19 - 30
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupCategoryController.java

@@ -1,15 +1,10 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.dal.entity.VipGroupCategory;
-import com.ym.mec.biz.service.VipGroupCategoryService;
-import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
+
+import java.util.Date;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -17,9 +12,12 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.VipGroupCategory;
+import com.ym.mec.biz.service.VipGroupCategoryService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.page.QueryInfo;
 
 @Api(tags = "vip课类别")
 @RequestMapping("vipGroupCategory")
@@ -43,27 +41,18 @@ public class VipGroupCategoryController extends BaseController {
 	@ApiOperation("全查询")
 	@GetMapping(value = "/queryAll")
     @PreAuthorize("@pcs.hasPermissions('vipGroupCategory/queryAll')")
-	public Object queryAll(String organId) {
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		if (sysUser == null) {
-			return failed("用户信息获取失败");
-		}
-		if (!sysUser.getIsSuperAdmin()) {
-			Employee employee = employeeDao.get(sysUser.getId());
-			if (StringUtils.isEmpty(organId)) {
-				organId = employee.getOrganIdList();
-			}else if(StringUtils.isEmpty(employee.getOrganIdList())){
-				return failed("用户所在分部异常");
-			}else {
-				List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-				if(!list.containsAll(Arrays.asList(organId.split(",")))){
-					return failed("非法请求");
-				}
-			}
-		}
-		return succeed(vipGroupCategoryService.findAllByOrgan(organId));
+	public Object queryAll(QueryInfo queryInfo) {
+		return succeed(vipGroupCategoryService.queryPage(queryInfo));
+	}
+
+	@ApiOperation("获取教师课酬")
+	@PostMapping(value = "/findTeacherDefaultSalary")
+	@PreAuthorize("@pcs.hasPermissions('vipGroupCategory/findTeacherDefaultSalary')")
+	public Object findTeacherDefaultSalary(Integer userId) {
+		return succeed(vipGroupCategoryService.findTeacherSalary(userId));
 	}
 
+
 	@ApiOperation("新增")
 	@PostMapping(value = "/add")
     @PreAuthorize("@pcs.hasPermissions('vipGroupCategory/add')")