Browse Source

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

zouxuan 5 years ago
parent
commit
e8dac87c02

+ 1 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -250,10 +250,9 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     
     /**
      * 从指定时间开始查询学的线上可数
-     * @param startDate 指定的开始时间
      * @return
      */
-    List<StudentCourseTimesDto> queryStudentCourseTimesOfOnline(Date startDate);
+    List<StudentCourseTimesDto> queryStudentNotStartCourseTimesOfOnline();
 
     List<StudentTeacherCourseDto> findAllStudentCourseInfo();
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -18,7 +18,7 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
 
     int countStudents(Map<String, Object> params);
 
-    List<Student> queryByOperatingTag(Integer operatingTag);
+    List<Student> queryByOperatingTempTag(Integer operatingTag);
 
     int batchUpdate(@Param("studentList") List<Student> studentList);
 

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentExtracurricularExercisesSituationDao.java

@@ -44,5 +44,14 @@ public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Lon
      */
     List<TeacherExercisesServiceDto> findTeacherExercisesServiceSituations(@Param("monday") String monday,
                                                                            @Param("teacherIds") List<Integer> teacherIds);
+
+    /**
+     * @describe 统计上周数据今日跟新的条数
+     * @author Joburgess
+     * @date 2020/4/20
+     * @param sunday:
+     * @return int
+     */
+    int findLastWeekTodayUpdateNum(@Param("sunday") String sunday);
 	
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java

@@ -17,6 +17,8 @@ public class Student {
 
 	private Integer operatingTag;
 
+	private Integer operatingTempTag;
+
 	private Integer teacherId;
 	
 	/**  */
@@ -86,6 +88,14 @@ public class Student {
 		this.operatingTag = operatingTag;
 	}
 
+	public Integer getOperatingTempTag() {
+		return operatingTempTag;
+	}
+
+	public void setOperatingTempTag(Integer operatingTempTag) {
+		this.operatingTempTag = operatingTempTag;
+	}
+
 	public Integer getTeacherId() {
 		return teacherId;
 	}

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -1,12 +1,12 @@
 package com.ym.mec.biz.service;
 
+import java.text.ParseException;
+
 import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.page.StudentQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
-import java.text.ParseException;
-
 public interface StudentService extends BaseService<Integer, Student> {
 
     PageInfo findStudentVipGroupList(StudentQueryInfo queryInfo);
@@ -18,7 +18,7 @@ public interface StudentService extends BaseService<Integer, Student> {
      * @return
      * @throws ParseException 
      */
-    boolean updateOperatingTag() throws ParseException;
+    boolean updateOperatingTempTag();
 
     /**
      * @describe 初始化教师编号

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EduPracticeGroupServiceImpl.java

@@ -442,6 +442,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
 
                 sysUserCashAccountService.updateBalance(practiceGroupBuyParams.getStudentId(), studentPaymentOrder.getExpectAmount().negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,operatorInfo+",教务代买");
 
+                studentPaymentOrder.setPayTime(now);
                 this.orderCallback(studentPaymentOrder);
 
                 Map<String,Object> result=new HashMap<>();

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java

@@ -189,6 +189,13 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 	@Transactional(rollbackFor = Exception.class)
 	public void exercisesSituationStatistics() {
 		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+		if(nowDate.getDayOfWeek()==DayOfWeek.MONDAY){
+			nowDate = nowDate.plusDays(-1);
+			int lastWeekTodayUpdateNum = studentExtracurricularExercisesSituationDao.findLastWeekTodayUpdateNum(nowDate.toString());
+			if(lastWeekTodayUpdateNum>0){
+				nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+			}
+		}
 		LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
 		LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
 		List<Practice4ExercisesSituationDto> noPracticeStudents = courseScheduleStudentPaymentDao.findNoPracticeStudentIdsOnWeek(monDayDate.toString(),sunDayDate.toString());

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

@@ -282,7 +282,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         OrderTypeEnum type = OrderTypeEnum.SPORADIC;
-        String receiver = "PER";
+        String receiver = "c419";
 
         Integer userId = sporadicPayDto.getUserId();
         String orderNo = idGeneratorService.generatorId("payment") + "";

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

@@ -154,8 +154,11 @@ public class PayServiceImpl implements PayService {
                 company = "yaming";
             }
         }
-        if (receiver.equals("sdaya")) {
-            company = "sdaya";
+        Set<String> companies = new HashSet<>();
+        companies.add("sdaya");
+        companies.add("c419");
+        if (companies.contains(receiver)) {
+            company = receiver;
             receiver = null;
         }
 

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

@@ -2979,6 +2979,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
                 sysUserCashAccountService.updateBalance(practiceGroupBuyParams.getStudentId(), studentPaymentOrder.getExpectAmount().negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"网管课购买");
 
+                studentPaymentOrder.setPayTime(now);
                 this.orderCallback(studentPaymentOrder);
 
                 Map<String,Object> result=new HashMap<>();
@@ -3345,6 +3346,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
                 sysUserCashAccountService.updateBalance(userId, newOrder.getExpectAmount().negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"网管课购买");
 
+                newOrder.setPayTime(new Date());
                 this.orderCallback(newOrder);
 
                 Map<String,Object> result=new HashMap<>();

+ 34 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -1,5 +1,18 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
 import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dto.StudentCourseTimesDto;
@@ -12,15 +25,6 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
 
 @Service
 public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implements StudentService {
@@ -69,26 +73,39 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 	}
 
 	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public boolean updateOperatingTag() throws ParseException {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-		Date date = sdf.parse("2020-02-08");
-		List<StudentCourseTimesDto> studentCourseTimesDtoList = courseScheduleStudentPaymentDao.queryStudentCourseTimesOfOnline(date);
+	public boolean updateOperatingTempTag() {
+		List<StudentCourseTimesDto> studentCourseTimesDtoList = courseScheduleStudentPaymentDao.queryStudentNotStartCourseTimesOfOnline();
 		Map<Integer,StudentCourseTimesDto> map = studentCourseTimesDtoList.stream().collect(Collectors.toMap(StudentCourseTimesDto::getUserId, s -> s));
 		//查询服务指标为0的用户
-		List<Student> studentList = studentDao.queryByOperatingTag(0);
+		List<Student> unlabeledStudentList = studentDao.queryByOperatingTempTag(0);
 		
 		List<Student> updateStudentList = new ArrayList<Student>();
 		StudentCourseTimesDto dto = null;
-		for(Student s : studentList){
+		for(Student s : unlabeledStudentList){
+			if(s.getOperatingTag() == 1){
+				continue;
+			}
 			dto = map.get(s.getUserId());
 			if(dto != null){
-				if(dto.getTotalCourseTimes() != dto.getFreePracticeCourseTimes()){
+				if(dto.getTotalCourseTimes() > 0 && dto.getTotalCourseTimes() != dto.getFreePracticeCourseTimes()){
+					s.setOperatingTempTag(1);
 					s.setOperatingTag(1);
 					updateStudentList.add(s);
 				}
 			}
 		}
+
+		List<Student> labeledStudentList = studentDao.queryByOperatingTempTag(1);
+		for(Student s : labeledStudentList){
+			dto = map.get(s.getUserId());
+			if(dto != null){
+				if(dto.getTotalCourseTimes() == dto.getFreePracticeCourseTimes()){
+					s.setOperatingTempTag(0);
+					s.setOperatingTag(0);
+					updateStudentList.add(s);
+				}
+			}
+		}
 		
 		if(updateStudentList.size() > 0){
 			studentDao.batchUpdate(updateStudentList);

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

@@ -483,7 +483,7 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 					String practiceNum = practiceStudentsNum.get(e.getId()) ==null ? "0" : practiceStudentsNum.get(e.getId());
 					String vipNum = vipStudentsNum.get(e.getId()) ==null ? "0" : vipStudentsNum.get(e.getId());
 					String practiceAndVipNum = practiceAndVipStudentsNum.get(e.getId()) ==null ? "0" : practiceAndVipStudentsNum.get(e.getId());
-					int allNum = Integer.parseInt(practiceNum) + Integer.parseInt(vipNum) + Integer.parseInt(practiceAndVipNum);
+					int allNum = Integer.parseInt(practiceNum) + Integer.parseInt(vipNum) - Integer.parseInt(practiceAndVipNum);
 					BigDecimal operatingIndex = new BigDecimal(allNum).multiply(new BigDecimal(100)).divide(new BigDecimal(studentNum), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
 					e.setOperatingIndex(operatingIndex);
 				}else {

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

@@ -382,13 +382,13 @@
 		DELETE FROM course_schedule_student_payment WHERE music_group_id_=#{groupId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 	</delete>
 	
-	<select id="queryStudentCourseTimesOfOnline" resultMap="studentCourseTimesDto">
+	<select id="queryStudentNotStartCourseTimesOfOnline" resultMap="studentCourseTimesDto">
 		SELECT cssp.`user_id_`,count(*) totalTimes, 
 		sum(case when (pg.buy_months_ > 0) then 1 ELSE 0 END) practiceTmes,
 		sum(case when (pg.buy_months_ IS NULL AND cssp.`group_type_` = 'PRACTICE' ) then 1 ELSE 0 END) freePracticeTimes
 		FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs on cssp.course_schedule_id_ = cs.id_
 		LEFT JOIN practice_group pg ON pg.id_ = cs.music_group_id_ AND cs.group_type_ = 'PRACTICE'
-		WHERE cs.`teach_mode_` = 'ONLINE' AND cs.`class_date_` &gt;= #{startDate}
+		WHERE cs.`teach_mode_` = 'ONLINE' AND cs.status_ = 'NOT_START'
 		GROUP BY cssp.`user_id_`
 	</select>
 

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -248,4 +248,7 @@
 		GROUP BY
 			teacher_id_;
     </select>
+    <select id="findLastWeekTodayUpdateNum" resultType="int">
+		SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE sunday_=#{sunday} AND DATE_FORMAT(update_time_,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d')
+    </select>
 </mapper>

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

@@ -11,6 +11,7 @@
         <result column="subject_id_list_" property="subjectIdList"/>
         <result column="service_tag_" property="serviceTag"/>
         <result column="operating_tag_" property="operatingTag"/>
+        <result column="operating_temp_tag_" property="operatingTempTag"/>
         <result column="teacher_id_" property="teacherId"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
@@ -46,6 +47,9 @@
         <if test="operatingTag != null">
             operating_tag_,
         </if>
+        <if test="operatingTempTag != null">
+            operating_temp_tag_,
+        </if>
         teacher_id_,create_time_,update_time_)
         VALUES
         (#{userId},#{subjectIdList},
@@ -70,6 +74,9 @@
             <if test="operatingTag != null">
                 operating_tag_ = #{operatingTag},
             </if>
+            <if test="operatingTempTag != null">
+                operating_temp_tag_ = #{operatingTempTag},
+            </if>
             <if test="teacherId != null">
                 teacher_id_=#{teacherId},
             </if>
@@ -119,10 +126,10 @@
         </where>
     </sql>
 
-    <select id="queryByOperatingTag" resultMap="Student">
+    <select id="queryByOperatingTempTag" resultMap="Student">
         SELECT *
         FROM student
-        WHERE operating_tag_ = #{operatingTag}
+        WHERE operating_temp_tag_ = #{operatingTempTag}
     </select>
 
     <update id="batchUpdate" parameterType="java.util.List">
@@ -138,6 +145,9 @@
                 <if test="item.operatingTag != null">
                     operating_tag_ = #{item.operatingTag},
                 </if>
+                <if test="item.operatingTempTag != null">
+                    operating_temp_tag_ = #{item.operatingTempTag},
+                </if>
                 <if test="item.teacherId != null">
                     teacher_id_=#{item.teacherId},
                 </if>

+ 20 - 6
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -1,15 +1,29 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.biz.service.*;
-import com.ym.mec.common.controller.BaseController;
+import java.util.Date;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.text.ParseException;
-import java.util.Date;
+import com.ym.mec.biz.service.CourseHomeworkService;
+import com.ym.mec.biz.service.CourseReviewService;
+import com.ym.mec.biz.service.CourseScheduleEvaluateService;
+import com.ym.mec.biz.service.CourseScheduleService;
+import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
+import com.ym.mec.biz.service.CoursesGroupService;
+import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
+import com.ym.mec.biz.service.MusicGroupStudentFeeService;
+import com.ym.mec.biz.service.PracticeGroupService;
+import com.ym.mec.biz.service.StudentCourseHomeworkService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.biz.service.TeacherAttendanceService;
+import com.ym.mec.biz.service.TeacherCourseStatisticsService;
+import com.ym.mec.biz.service.TenantPaymentOrderService;
+import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.common.controller.BaseController;
 
 @RequestMapping("task")
 @RestController
@@ -221,7 +235,7 @@ public class TaskController extends BaseController {
 
 	//更新学生运营指标
 	@GetMapping("/updateStudentOperatingTag")
-	public void updateStudentOperatingTag() throws ParseException{
-		studentService.updateOperatingTag();
+	public void updateStudentOperatingTag(){
+		studentService.updateOperatingTempTag();
 	}
 }