浏览代码

Merge remote-tracking branch 'origin/master'

Joburgess 5 年之前
父节点
当前提交
4c0c97cd17

+ 2 - 4
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysUserServiceImpl.java

@@ -146,9 +146,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 				SysUser sysUser = sysUserDao.findUserBySalt("TEACHER");
 				if(sysUser != null){
 					sysUser.setPhone(phone);
-					sysUser.setPassword(null);
 					sysUser.setUpdateTime(date);
-					sysUser.setSalt(null);
+					sysUser.setSalt("noReplace");
 					sysUserDao.update(sysUser);
 					return queryUserInfoByPhone(phone);
 				}
@@ -156,9 +155,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 				SysUser sysUser = sysUserDao.findUserBySalt("STUDENT");
 				if(sysUser != null){
 					sysUser.setPhone(phone);
-					sysUser.setPassword(null);
 					sysUser.setUpdateTime(date);
-					sysUser.setSalt(null);
+					sysUser.setSalt("noReplace");
 					sysUserDao.update(sysUser);
 					return queryUserInfoByPhone(phone);
 				}

+ 1 - 1
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -192,6 +192,6 @@
         SELECT GROUP_CONCAT(name_) FROM organization WHERE FIND_IN_SET(id_,#{organId})
     </select>
     <select id="findUserBySalt" resultMap="SysUser">
-        SELECT * FROM sys_user WHERE salt_ IS NOT NULL AND salt_ != '' AND user_type_ = #{userType} LIMIT 1
+        SELECT * FROM sys_user WHERE salt_ IS NOT NULL AND salt_ = 'replace' AND user_type_ = #{userType} LIMIT 1
     </select>
 </mapper>

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupStudentMapperService.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.service.BaseService;
 
+import java.io.IOException;
 import java.util.List;
 
 public interface ClassGroupStudentMapperService extends BaseService<Long, ClassGroupStudentMapper> {
@@ -52,4 +53,11 @@ public interface ClassGroupStudentMapperService extends BaseService<Long, ClassG
      * @throws Exception
      */
     boolean addStudents(Integer classGroupId, String userIdsStr, GroupType groupType) throws Exception;
+
+    /**
+     * 获取节假日
+     * @param year
+     * @return
+     */
+    Object queryHoliday(String year) throws IOException;
 }

+ 12 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -1632,12 +1632,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             dataList.forEach(e -> {
                 e.setMixClassGroupName(classGroupNames.get(e.getMixClassGroupId()));
                 List<CourseScheduleTeacherSalary> currentBishopTeacher = courseScheduleBishopTeacherMaps.get(e.getCourseScheduleId().longValue());
+                List<CourseScheduleTeacherSalary> TeachingTeachers = new ArrayList<>();
                 if (!Objects.isNull(currentBishopTeacher)&&!CollectionUtils.isEmpty(currentBishopTeacher)) {
                     e.setMasterTeacherId(currentBishopTeacher.get(0).getUserId());
                     e.setMasterTeacherName(currentBishopTeacher.get(0).getUserName());
+                }else {
+                    currentBishopTeacher = new ArrayList<>();
                 }
+                TeachingTeachers.addAll(currentBishopTeacher);
                 List<CourseScheduleTeacherSalary> currentCourseTeachingTeachers = courseScheduleTeachingTeacherMaps.get(e.getCourseScheduleId().longValue());
-                if (CollectionUtils.isEmpty(currentCourseTeachingTeachers)&&!CollectionUtils.isEmpty(currentBishopTeacher)) {
+                if(Objects.isNull(currentCourseTeachingTeachers) || CollectionUtils.isEmpty(currentCourseTeachingTeachers)){
+                    currentCourseTeachingTeachers = new ArrayList<>();
+                }
+                TeachingTeachers.addAll(currentCourseTeachingTeachers);
+                e.setTeachingTeachers(TeachingTeachers);
+                e.setTeacherNum(TeachingTeachers.size());
+                /*if (CollectionUtils.isEmpty(currentCourseTeachingTeachers) && !CollectionUtils.isEmpty(currentBishopTeacher)) {
                     currentCourseTeachingTeachers = new ArrayList<>();
                     if (currentBishopTeacher != null) {
                         currentCourseTeachingTeachers.add(currentBishopTeacher.get(0));
@@ -1649,12 +1659,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                         currentCourseTeachingTeachers.add(currentBishopTeacher.get(0));
                     }
                     e.setTeachingTeachers(currentCourseTeachingTeachers);
-                    if(Objects.isNull(currentCourseTeachingTeachers)){
-                        e.setTeacherNum(0);
-                    }else{
-                        e.setTeacherNum(currentCourseTeachingTeachers.size());
-                    }
-                }
+                }*/
             });
         }
         if (count == 0) {

+ 16 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -11,10 +11,12 @@ import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
+import com.ym.mec.util.http.HttpUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
 
@@ -37,6 +39,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
     @Autowired
     private ImFeignService imFeignService;
 
+    private static String holidayUrl = "http://tool.bitefu.net/jiari/?d=";
+
     @Override
     public BaseDAO<Long, ClassGroupStudentMapper> getDAO() {
         return classGroupStudentMapperDao;
@@ -146,10 +150,12 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
 
-        for (String userIdStr : userIdStrSet) {
+        Iterator<String> iterator = userIdStrSet.iterator();
+        while (iterator.hasNext()) {
+        	String userIdStr = iterator.next();
             List<ClassGroupStudentMapper> highClassGroupHasUser = classGroupStudentMapperDao.findHighClassGroupHasUser(classGroup.getMusicGroupId(), Integer.parseInt(userIdStr), classGroup.getType());
             if (highClassGroupHasUser != null && highClassGroupHasUser.size() >= 0) {
-                userIdStrSet.remove(userIdStr);
+            	iterator.remove();
                 continue;
             }
 
@@ -179,7 +185,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             }
             imGroupMemberList.add(new ImGroupMember(userIdStr));
         }
-        classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
+		if (classGroupStudentMappers.size() > 0) {
+			classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
+		}
 
         //添加进IM群组
         ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
@@ -227,4 +235,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
         return true;
     }
+
+    @Override
+    public Object queryHoliday(String year) throws IOException {
+        return HttpUtil.get(holidayUrl + year,null);
+    }
 }

+ 43 - 36
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -1,23 +1,27 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.MusicGroupPurchaseListService;
-import com.ym.mec.common.exception.BizException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
-import java.util.*;
-
 @Service
 public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrderDetail> implements StudentPaymentOrderDetailService {
 
@@ -44,33 +48,36 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     }
 
     @Override
-    public List<Goods> getMusicalList(String musicGroupId) {
-        List<StudentPaymentOrderDetail> applyOrder = findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
-        if (applyOrder == null || applyOrder.size() == 0) {
-            return null;
-        }
-        String goodsIdsStr = "";
-        for (StudentPaymentOrderDetail studentPaymentOrderDetail : applyOrder) {
-            if (studentPaymentOrderDetail.getGoodsIdList() != null && !studentPaymentOrderDetail.getGoodsIdList().isEmpty()) {
-                goodsIdsStr += studentPaymentOrderDetail.getGoodsIdList() + ",";
-            }
-        }
-        goodsIdsStr = goodsIdsStr.substring(0, goodsIdsStr.length() - 1);
-
-        String[] goodSIdArr = goodsIdsStr.split(",");
-
-        List<Goods> goodies = goodsService.findGoodsByIds(goodsIdsStr);
-
-        for (Goods goods : goodies) {
-            goods.setSellCount(0);
-            for (String goodsIdStr : goodSIdArr) {
-                if (goods.getId().equals(Integer.parseInt(goodsIdStr))) {
-                    goods.setSellCount(goods.getSellCount() + 1);
-                }
-            }
-        }
-        return goodies;
-    }
+	public List<Goods> getMusicalList(String musicGroupId) {
+		List<StudentPaymentOrderDetail> applyOrder = findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
+		if (applyOrder == null || applyOrder.size() == 0) {
+			return null;
+		}
+		String goodsIdsStr = "";
+		for (StudentPaymentOrderDetail studentPaymentOrderDetail : applyOrder) {
+			if (studentPaymentOrderDetail.getGoodsIdList() != null && !studentPaymentOrderDetail.getGoodsIdList().isEmpty()) {
+				goodsIdsStr += studentPaymentOrderDetail.getGoodsIdList() + ",";
+			}
+		}
+		if (StringUtils.isNotBlank(goodsIdsStr)) {
+			goodsIdsStr = goodsIdsStr.substring(0, goodsIdsStr.length() - 1);
+
+			String[] goodSIdArr = goodsIdsStr.split(",");
+
+			List<Goods> goodies = goodsService.findGoodsByIds(goodsIdsStr);
+
+			for (Goods goods : goodies) {
+				goods.setSellCount(0);
+				for (String goodsIdStr : goodSIdArr) {
+					if (goods.getId().equals(Integer.parseInt(goodsIdStr))) {
+						goods.setSellCount(goods.getSellCount() + 1);
+					}
+				}
+			}
+			return goodies;
+		}
+		return null;
+	}
 
     @Override
     public Boolean verifyMusicalList(String musicGroupId) throws BizException {

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

@@ -574,7 +574,7 @@
         IF(ISNULL(ta.sign_out_status_),3,ta.sign_out_status_) sign_out_status_
         FROM course_schedule cs
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
-        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
+        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_ AND ta.teacher_id_ = cs.actual_teacher_id_
         LEFT JOIN class_group_relation cgr ON cgr.sub_class_group_id_ = cs.class_group_id_
         LEFT JOIN class_group_teacher_mapper cgtm ON cgtm.class_group_id_ = cs.class_group_id_
         <include refid="queryMusicGroupCourseScheduleSql"/>
@@ -586,7 +586,7 @@
         SELECT COUNT(cs.id_)
         FROM course_schedule cs
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
-        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
+        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_ AND ta.teacher_id_ = cs.actual_teacher_id_
         LEFT JOIN class_group_teacher_mapper cgtm ON cgtm.class_group_id_ = cs.class_group_id_
         <include refid="queryMusicGroupCourseScheduleSql"/>
     </select>

+ 14 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupStudentController.java

@@ -11,10 +11,13 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.io.IOException;
+
 @RequestMapping("classGroupStudent")
 @Api(tags = "班级学生服务")
 @RestController
@@ -65,4 +68,15 @@ public class ClassGroupStudentController extends BaseController {
         return succeed(classGroupStudentMapperService.addStudents(classGroupId, userIdsStr, GroupType.MUSIC));
     }
 
+    /**
+     * 获取节假日
+     * @param year
+     * @return
+     */
+    @ApiOperation(value = "获取节假日")
+    @GetMapping("/queryHoliday")
+    @PreAuthorize("@pcs.hasPermissions('classGroupStudent/queryHoliday')")
+    public Object queryHoliday(String year) throws IOException {
+        return succeed(classGroupStudentMapperService.queryHoliday(year));
+    }
 }

+ 9 - 8
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupDefaultClassesUnitPriceController.java

@@ -1,13 +1,11 @@
 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.entity.VipGroupDefaultClassesUnitPrice;
-import com.ym.mec.biz.service.VipGroupDefaultClassesUnitPriceService;
-import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.models.auth.In;
+
+import java.util.Date;
+import java.util.Objects;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -15,8 +13,11 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Date;
-import java.util.Objects;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.VipGroupDefaultClassesUnitPrice;
+import com.ym.mec.biz.service.VipGroupDefaultClassesUnitPriceService;
+import com.ym.mec.common.controller.BaseController;
 
 @Api(tags = "vip课默认单价")
 @RequestMapping("vipGroupDefaultClassesUnitPrice")