浏览代码

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

zouxuan 5 年之前
父节点
当前提交
a13b2451ca

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

@@ -141,4 +141,5 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @return java.util.List<java.util.Map<java.lang.String,java.math.BigDecimal>>
 	 */
 	List<Map<String, BigDecimal>> countTeacherOnlineOfflineSalaryByClass(@Param("classGroupId") Integer classGroupId);
+
 }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysMessageQueryInfo.java

@@ -21,6 +21,10 @@ public class SysMessageQueryInfo extends QueryInfo {
 
 	@ApiModelProperty(value = "消息类型;1,表示短信;2,表示邮件; 3,app推送消息",required = false)
 	private Integer type;
+	
+	private String group;
+	
+	private Integer readStatus;
 
 	public Integer getStatus() {
 		return status;
@@ -62,4 +66,20 @@ public class SysMessageQueryInfo extends QueryInfo {
 		this.type = type;
 	}
 
+	public String getGroup() {
+		return group;
+	}
+
+	public void setGroup(String group) {
+		this.group = group;
+	}
+
+	public Integer getReadStatus() {
+		return readStatus;
+	}
+
+	public void setReadStatus(Integer readStatus) {
+		this.readStatus = readStatus;
+	}
+
 }

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

@@ -578,21 +578,57 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		CourseSchedule courseSchedule1 = courseScheduleDao.get(courseScheduleId1);
 		CourseSchedule courseSchedule2 = courseScheduleDao.get(courseScheduleId2);
 
+		//获取两个课程的主教、助教
+		List<Long> courseScheduleIds=new ArrayList<>();
+		courseScheduleIds.add(courseScheduleId1);
+		courseScheduleIds.add(courseScheduleId2);
+		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseScheduleIds);
+		Map<Long, List<CourseScheduleTeacherSalary>> courseScheduleTeacherSalaryByCourse = courseScheduleTeacherSalaries.stream()
+				.collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId));
+		//课程1的主教、助教
+		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries1 = courseScheduleTeacherSalaryByCourse.get(courseScheduleId1);
+		//课程2的主教、助教
+		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries2 = courseScheduleTeacherSalaryByCourse.get(courseScheduleId2);
+
+		Map<TeachTypeEnum, List<CourseScheduleTeacherSalary>> ct1 = courseScheduleTeacherSalaries1.stream()
+				.collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getTeacherRole));
+
+		Map<TeachTypeEnum, List<CourseScheduleTeacherSalary>> ct2 = courseScheduleTeacherSalaries2.stream()
+				.collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getTeacherRole));
+
+		//交换两节课的主教、助教
+		if(Objects.nonNull(ct1.get(TeachTypeEnum.BISHOP))){
+			courseSchedule1.setActualTeacherId(ct1.get(TeachTypeEnum.BISHOP).get(0).getUserId());
+		}else{
+			courseSchedule1.setActualTeacherId(null);
+		}
+		if(Objects.nonNull(ct2.get(TeachTypeEnum.BISHOP))){
+			courseSchedule2.setActualTeacherId(ct2.get(TeachTypeEnum.BISHOP).get(0).getUserId());
+		}else{
+			courseSchedule2.setActualTeacherId(null);
+		}
+		List<CourseScheduleTeacherSalary> ct1t = ct1.get(TeachTypeEnum.TEACHING);
+		if(CollectionUtils.isEmpty(ct1t)){
+			courseSchedule1.setTeachingTeacherIdList(null);
+		}else{
+			List<Integer> collect = ct1t.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toList());
+			collect.stream().distinct();
+			courseSchedule1.setTeachingTeacherIdList(collect);
+		}
+		List<CourseScheduleTeacherSalary> ct2t = ct2.get(TeachTypeEnum.TEACHING);
+		if(CollectionUtils.isEmpty(ct2t)){
+			courseSchedule2.setTeachingTeacherIdList(null);
+		}else{
+			List<Integer> collect = ct2t.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toList());
+			collect.stream().distinct();
+			courseSchedule2.setTeachingTeacherIdList(collect);
+		}
 		courseSchedule1.setId(courseScheduleId2);
 		courseSchedule2.setId(courseScheduleId1);
-
-		List<CourseSchedule> courseSchedules = courseScheduleDao.findCourseSchedulesByIds(new Long[]{courseScheduleId1, courseScheduleId2});
-
-		CourseSchedule temp=new CourseSchedule();
-		BeanUtils.copyProperties(courseSchedules.get(0),temp);
-		courseSchedules.get(0).setClassDate(courseSchedules.get(1).getClassDate());
-		courseSchedules.get(0).setStartClassTime(courseSchedules.get(1).getStartClassTime());
-		courseSchedules.get(0).setEndClassTime(courseSchedules.get(1).getEndClassTime());
-		courseSchedules.get(1).setClassDate(temp.getClassDate());
-		courseSchedules.get(1).setStartClassTime(temp.getStartClassTime());
-		courseSchedules.get(1).setEndClassTime(temp.getEndClassTime());
-		courseScheduleDao.update(courseSchedules.get(0));
-		courseScheduleDao.update(courseSchedules.get(1));
+		List<CourseSchedule> courseSchedules=new ArrayList<>();
+		courseSchedules.add(courseSchedule1);
+		courseSchedules.add(courseSchedule2);
+		classStartDateAdjust(courseSchedules);
 	}
 
 	@Override

+ 13 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java

@@ -4,12 +4,14 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.StudentAttendance;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
 import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
 import com.ym.mec.biz.service.StudentAttendanceService;
-import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -53,6 +55,8 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 	private MusicGroupQuitDao musicGroupQuitDao;
 	@Autowired
 	private SysMessageService sysMessageService;
+	@Autowired
+	private TeacherDao teacherDao;
 
 	@Override
 	public BaseDAO<Long, StudentAttendance> getDAO() {
@@ -199,8 +203,14 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 		ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.query(courseSchedule.getClassGroupId(), userId);
 		classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.LEAVE);
 		classGroupStudentMapperDao.update(classGroupStudentMapper);
-		
+
+		Map<Integer,String> sendArgs=new HashMap<>();
+		sendArgs.put(courseSchedule.getActualTeacherId(),teacherDao.get(courseSchedule.getActualTeacherId()).getPhone());
 		//发送消息至老师
+		sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
+				MessageTypeEnum.TEACHER_PUSH_STUDENT_LEAVE,
+				sendArgs,
+				null,0,null,courseSchedule.getName(),null);
 		
 		return true;
 	}

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/SysMessageMapper.xml

@@ -51,6 +51,9 @@
 			<if test="group != null">
 				and group_ = #{group}
 			</if>
+			<if test="readStatus != null">
+				and read_status_ = #{readStatus}
+			</if>
 		</where>
 	</sql>
 
@@ -152,6 +155,7 @@
     <select id="queryCount" parameterType="map" resultType="int">
 		select count(*) from sys_message
 		<include refid="queryCondition" />
+		order by create_on_ desc
 	</select>
 
 	<select id="queryPage" parameterType="map" resultMap="message">

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

@@ -513,7 +513,7 @@
             LEFT JOIN course_schedule cs ON vgcgm.class_group_id_=cs.class_group_id_
             LEFT JOIN course_schedule_teacher_salary csts ON cs.id_=csts.course_schedule_id_
         <include refid="teachingRecordQueryCondition"/>
-        ORDER BY cs.id_
+        ORDER BY start_class_time_
         <include refid="global.limit"/>
     </select>
     <select id="countTeachingRecord" resultType="int">

+ 1 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/config/FeignConfiguration.java

@@ -14,7 +14,7 @@ public class FeignConfiguration {
 		// 这里记录所有,根据实际情况选择合适的日志level
 		return Logger.Level.FULL;
 	}
-	
+
 	@Bean
 	public RequestInterceptor requestInterceptor(){
 		return new RequestHeaderConfiguration();

+ 1 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/security/PermissionCheckService.java

@@ -7,7 +7,7 @@ import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.stereotype.Component;
 
-@Component("pcs")
+//@Component("pcs")
 public class PermissionCheckService {
 
 	public boolean hasPermissions(String... permissions) {

+ 9 - 8
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -12,20 +12,18 @@ import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.thirdparty.adapay.Pay;
-import com.ym.mec.thirdparty.union.NotifyMsg;
 import com.ym.mec.thirdparty.yqpay.Msg;
 import com.ym.mec.thirdparty.yqpay.YqPayUtil;
-import com.ym.mec.thirdparty.yqpay.YqQueryService;
+import com.ym.mec.thirdparty.yqpay.YqPayFeignService;
+import com.ym.mec.thirdparty.yqpay.RsqMsg;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.snaker.engine.core.OrderService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
@@ -47,7 +45,7 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private MusicGroupService musicGroupService;
     @Autowired
-    private YqQueryService yqQueryService;
+    private YqPayFeignService yqQueryService;
 
 //    @PostMapping("/notify")
 //    public String notify(@ModelAttribute NotifyMsg notifyMsg) {
@@ -148,7 +146,7 @@ public class StudentOrderController extends BaseController {
     }
 
 
-    //@Scheduled(cron = "0/5 * * * * ?")
+    @Scheduled(cron = "0/5 * * * * ?")
     public void getOrderStatus() throws Exception {
         List<StudentPaymentOrder> payingOrders = studentPaymentOrderService.findOrdersByStatus(DealStatusEnum.ING, "YQPAY");
         String merOrderNos = ""; //
@@ -168,8 +166,11 @@ public class StudentOrderController extends BaseController {
         Map<String, Object> resultMap = new LinkedHashMap<>();
         resultMap.put("merOrderNoList", merOrderNos);
         Map<String, Object> requestMap = YqPayUtil.getRequestMap(notifyUrl, resultMap);
-        Msg queryRs = yqQueryService.orderQuery(requestMap);
-        // = yqQueryService.orderQuery(requestMap);
+
+        RsqMsg rsqMsg = new RsqMsg(requestMap);
+
+       Msg queryRs = yqQueryService.orderQuery(rsqMsg);
+
        logger.info("查询易乾结果" +queryRs.toString());
        //logger.info("查询易乾结果" + queryRs.toString());
         if (queryRs.getCode().equals("88")) {

+ 13 - 1
mec-thirdparty/pom.xml

@@ -84,6 +84,18 @@
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-openfeign</artifactId>
 		</dependency>
-    </dependencies>
+		<!-- https://mvnrepository.com/artifact/io.github.openfeign.form/feign-form-spring -->
+		<dependency>
+			<groupId>io.github.openfeign.form</groupId>
+			<artifactId>feign-form-spring</artifactId>
+			<version>2.0.5</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/io.github.openfeign.form/feign-form-spring -->
+		<dependency>
+			<groupId>io.github.openfeign.form</groupId>
+			<artifactId>feign-form-spring</artifactId>
+			<version>2.0.5</version>
+		</dependency>
+	</dependencies>
 
 </project>

+ 79 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/RsqMsg.java

@@ -0,0 +1,79 @@
+package com.ym.mec.thirdparty.yqpay;
+
+import java.util.Map;
+
+public class RsqMsg {
+    private String merNo;
+    private String version;
+    private String notifyUrl;
+    private String timestamp;
+    private String apiContent;
+    private String signType;
+    private String sign;
+
+    public RsqMsg(Map<String, Object> payMap) {
+        merNo = (String) payMap.get("merNo");
+        version = (String) payMap.get("version");
+        notifyUrl = (String) payMap.get("notifyUrl");
+        timestamp = (String) payMap.get("timestamp");
+        apiContent = (String) payMap.get("apiContent");
+        signType = (String) payMap.get("signType");
+        sign = (String) payMap.get("sign");
+    }
+
+    public String getMerNo() {
+        return merNo;
+    }
+
+    public void setMerNo(String merNo) {
+        this.merNo = merNo;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    public String getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getApiContent() {
+        return apiContent;
+    }
+
+    public void setApiContent(String apiContent) {
+        this.apiContent = apiContent;
+    }
+
+    public String getSignType() {
+        return signType;
+    }
+
+    public void setSignType(String signType) {
+        this.signType = signType;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+}

+ 51 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayFeignService.java

@@ -0,0 +1,51 @@
+package com.ym.mec.thirdparty.yqpay;
+
+import feign.Logger;
+import feign.codec.Encoder;
+import feign.form.spring.SpringFormEncoder;
+import org.springframework.beans.factory.ObjectFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.cloud.openfeign.support.SpringEncoder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+
+import java.util.Map;
+
+@FeignClient(value = "YqPayFeignService",url = "https://qyfquery.95epay.com",configuration = YqPayFeignService.FormSupportConfig.class)
+public interface YqPayFeignService {
+
+    @PostMapping(name = "订单查询", value = "/query/trade/tradeQuery",
+            consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
+            produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}
+    )
+    Msg orderQuery(RsqMsg rsqMsg);
+
+    @RequestMapping(name = "用户信息查询", value = "/query/account/queryAccount", method = RequestMethod.POST)
+    String queryAccount(@RequestParam Map<String, Object> map);
+
+    @RequestMapping(name = "对账查询", value = "/query/bill/billQuery", method = RequestMethod.POST)
+    String billQuery(@RequestParam Map<String, Object> map);
+
+
+    class FormSupportConfig {
+
+
+        @Autowired
+        private ObjectFactory<HttpMessageConverters> messageConverters;
+        // new一个form编码器,实现支持form表单提交
+        @Bean
+        public Encoder feignFormEncoder() {
+            return new SpringFormEncoder(new SpringEncoder(messageConverters));
+        }
+        // 开启Feign的日志
+        @Bean
+        public Logger.Level logger() {
+            return Logger.Level.FULL;
+        }
+    }
+
+    }

+ 0 - 21
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqQueryService.java

@@ -1,21 +0,0 @@
-package com.ym.mec.thirdparty.yqpay;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.Map;
-
-@FeignClient(value = "yqQuery", url = "https://qyfquery.95epay.com")
-public interface YqQueryService {
-
-    @RequestMapping(name = "订单查询", value = "/query/trade/tradeQuery", method = RequestMethod.POST)
-    Msg orderQuery(@RequestParam Map<String, Object> map);
-
-    @RequestMapping(name = "用户信息查询", value = "/query/account/queryAccount", method = RequestMethod.POST)
-    String queryAccount(@RequestParam Map<String, Object> map);
-
-    @RequestMapping(name = "对账查询", value = "/query/bill/billQuery", method = RequestMethod.POST)
-    String billQuery(@RequestParam Map<String, Object> map);
-}

+ 50 - 0
mec-web/src/main/java/com/ym/mec/web/config/PermissionCheckService.java

@@ -0,0 +1,50 @@
+package com.ym.mec.web.config;
+
+import java.util.Collection;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.stereotype.Component;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.common.security.SecurityUtils;
+
+@Component("pcs")
+public class PermissionCheckService {
+	
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	public boolean hasPermissions(String... permissions) {
+		Authentication authentication = SecurityUtils.getAuthentication();
+		if (authentication == null) {
+			return false;
+		}
+
+		SysUser user = sysUserFeignService.queryUserInfo();
+		if(user.getIsSuperAdmin()){
+			return true;
+		}
+
+		Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
+
+		for (String perm : permissions) {
+			for (GrantedAuthority authority : authorities) {
+				if (StringUtils.equalsIgnoreCase(perm, authority.getAuthority())) {
+					return true;
+				}
+			}
+		}
+
+		return false;
+	}
+
+	public boolean hasRoles(String... roles) {
+
+		return hasPermissions(roles);
+	}
+
+}