Browse Source

Merge remote-tracking branch 'origin/master'

周箭河 5 years ago
parent
commit
330fd3f386

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
 import com.ym.mec.biz.dal.dto.UserGoodsDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
 import com.ym.mec.biz.dal.entity.Goods;
@@ -7,6 +8,7 @@ import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
@@ -181,4 +183,18 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @return
      */
     List<StudentPaymentOrderExportDto> ExportQueryPage(Map<String, Object> params);
+
+    /**
+     * 获取零星收费订单列表
+     * @param queryInfo
+     * @return
+     */
+    List<SporadicChargeInfoDto> sporadicQueryPage( Map<String, Object> queryInfo);
+
+    /**
+     * COUNT零星收费订单列表
+     * @param params
+     * @return
+     */
+    int countSporadicPage(Map<String, Object> params);
 }

+ 86 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SporadicChargeInfoDto.java

@@ -0,0 +1,86 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class SporadicChargeInfoDto{
+    private String organName;
+
+    private String title;
+
+    private String type;
+
+    private BigDecimal amount;
+
+    private Date createTime;
+
+    private Date payTime;
+
+    private String username;
+
+    private String payStatus;
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(Date payTime) {
+        this.payTime = payTime;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPayStatus() {
+        return payStatus;
+    }
+
+    public void setPayStatus(String payStatus) {
+        this.payStatus = payStatus;
+    }
+}

+ 37 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SporadicOrderQueryInfo.java

@@ -0,0 +1,37 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+public class SporadicOrderQueryInfo extends QueryInfo {
+
+    private String organId;
+
+    private Integer chargeType;
+
+    private String payStatus;
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
+    public Integer getChargeType() {
+        return chargeType;
+    }
+
+    public void setChargeType(Integer chargeType) {
+        this.chargeType = chargeType;
+    }
+
+    public String getPayStatus() {
+        return payStatus;
+    }
+
+    public void setPayStatus(String payStatus) {
+        this.payStatus = payStatus;
+    }
+}

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

@@ -4,12 +4,15 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
+import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface StudentPaymentOrderService extends BaseService<Long, StudentPaymentOrder> {
@@ -79,4 +82,11 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
 
 
 	List<StudentPaymentOrderExportDto> ExportQueryPage(Map<String, Object> params);
+
+	/**
+	 * 获取零星收费订单列表
+	 * @param queryInfo
+	 * @return
+	 */
+	PageInfo<SporadicChargeInfoDto> sporadicQueryPage(SporadicOrderQueryInfo queryInfo);
 }

+ 18 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -382,12 +382,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			studentNumCourseMap=MapUtil.convertIntegerMap(studentNumCourseMaps);
 		}
 		for (CourseScheduleDto courseScheduleDto : teacherCourseSchedulesWithDate) {
-//			Long studentNum=studentNumCourseMap.get(courseScheduleDto.getId());
-//			if(Objects.nonNull(studentNum)){
-//				courseScheduleDto.setStudentAttendanceIsFirstTime(studentNum>0?0:1);
-//			}else{
-//				courseScheduleDto.setStudentAttendanceIsFirstTime(1);
-//			}
+			Long studentNum=studentNumCourseMap.get(courseScheduleDto.getId());
+			if(Objects.nonNull(studentNum)){
+				courseScheduleDto.setStudentAttendanceIsFirstTime(studentNum>0?0:1);
+			}else{
+				courseScheduleDto.setStudentAttendanceIsFirstTime(1);
+			}
 
 			if(now.before(courseScheduleDto.getStartClassTime())){
 				courseScheduleDto.setStatus(CourseStatusEnum.NOT_START);
@@ -1038,6 +1038,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 						courseSchedules.get(courseStartDates.size()-1).setTeachMode(vipGroupCourseAdjustInfo.getTeachMode());
 						if(vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)){
 							courseSchedules.get(courseStartDates.size()-1).setSchoolId(vipGroupCourseAdjustInfo.getSchoolId());
+						}else{
+							courseSchedules.get(courseStartDates.size()-1).setSchoolId(null);
 						}
 					}
 				}
@@ -1324,10 +1326,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 					throw new BizException("请设置教学点");
 				}
 
-				if(Objects.nonNull(newCourseSchedule.getTeachMode())){
-					oldCourseSchedule.setTeachMode(newCourseSchedule.getTeachMode());
-				}
-
 				if(schoolIsChange){
 					oldCourseSchedule.setSchoolId(newCourseSchedule.getSchoolId());
 				}
@@ -1404,6 +1402,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			if(Objects.nonNull(newCourseSchedule.getSchoolId())){
 				oldCourseSchedule.setSchoolId(newCourseSchedule.getSchoolId());
 			}
+
+			if(Objects.nonNull(newCourseSchedule.getTeachMode())){
+				oldCourseSchedule.setTeachMode(newCourseSchedule.getTeachMode());
+				if(newCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
+					oldCourseSchedule.setSchoolId(null);
+				}
+			}
+
 			oldCourseSchedule.setActualTeacherId(newCourseSchedule.getActualTeacherId());
 			courseScheduleDao.update(oldCourseSchedule);
 			//删除被修改的教师课酬记录和考勤记录
@@ -2038,4 +2044,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}
 		return courseSchedules;
 	}
+
+
 }

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -10,9 +10,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
+import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.util.collection.MapUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -234,4 +238,24 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     public List<StudentPaymentOrderExportDto> ExportQueryPage(Map<String, Object> params) {
         return studentPaymentOrderDao.ExportQueryPage(params);
     }
+
+    @Override
+    public PageInfo<SporadicChargeInfoDto> sporadicQueryPage(SporadicOrderQueryInfo queryInfo) {
+        PageInfo<SporadicChargeInfoDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+
+        List<SporadicChargeInfoDto> dataList = null;
+        int count = studentPaymentOrderDao.countSporadicPage(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = studentPaymentOrderDao.sporadicQueryPage(params);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
 }

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

@@ -195,6 +195,9 @@
             <if test="schoolId != null">
                 schoole_id_ = #{schoolId},
             </if>
+            <if test="schoolId == null">
+                schoole_id_ = null,
+            </if>
             <if test="teachMode != null">
                 teach_mode_ = #{teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -565,7 +568,7 @@
             (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
             AND cs.class_date_ = DATE_FORMAT(#{classDate},'%Y%m%d')
             AND csts.user_id_ = #{teacherId} AND cg.del_flag_ = 0
-            AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ )&lt;NOW()
+            AND CONCAT( cs.class_date_, ' ', cs.end_class_time_ )&lt;NOW()
         ORDER BY start_class_time_
     </select>
 
@@ -1026,6 +1029,9 @@
                 <if test="item.schoolId != null">
                     schoole_id_ = #{item.schoolId},
                 </if>
+                <if test="item.schoolId == null">
+                    schoole_id_ = null,
+                </if>
                 <if test="item.teachMode != null">
                     teach_mode_ = #{item.teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 </if>
@@ -1649,7 +1655,7 @@
         LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
         LEFT JOIN class_group cg ON cg.id_=cs.class_group_id_
         LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND cssp.user_id_ = sa.user_id_
-        WHERE CONCAT(cs.class_date_,' ',cs.end_class_time_) &lt;= now() AND sa.id_ IS NULL
+        WHERE CONCAT(cs.class_date_,' ',cs.end_class_time_) &lt;= DATE_ADD(NOW(),INTERVAL -1 HOUR) AND sa.id_ IS NULL
     </select>
     <select id="getNextCourseSchedule" resultMap="CourseSchedule">
         SELECT

+ 44 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -428,4 +428,48 @@
         <include refid="queryPaymentOrder"/>
         ORDER BY spo.id_ ASC
     </select>
+    <resultMap id="SporadicChargeInfoDtoMap" type="com.ym.mec.biz.dal.dto.SporadicChargeInfoDto">
+        <result property="organName" column="organ_name_"/>
+        <result property="title" column="title_"/>
+        <result property="type" column="type_"/>
+        <result property="amount" column="amount_"/>
+        <result property="createTime" column="create_time_"/>
+        <result property="payTime" column="pay_time_"/>
+        <result property="username" column="username_"/>
+        <result property="payStatus" column="pay_status_"/>
+    </resultMap>
+    <select id="sporadicQueryPage" resultMap="SporadicChargeInfoDtoMap">
+        SELECT o.name_ organ_name_,sci.title_,sci.charge_type_ type_,
+        spo.actual_amount_ amount_,spo.create_time_,spo.pay_time_,su.username_,spo.status_ pay_status_
+        FROM student_payment_order spo
+        LEFT JOIN sys_user su ON spo.user_id_ = su.id_
+        LEFT JOIN organization o ON o.id_ = spo.organ_id_
+        LEFT JOIN sporadic_charge_info sci ON sci.id_ = spo.music_group_id_
+        WHERE spo.type_ = 'SPORADIC'
+        <include refid="sporadicQueryPageSql"/>
+        ORDER BY spo.id_ DESC
+        <include refid="global.limit"/>
+    </select>
+    <select id="countSporadicPage" resultType="java.lang.Integer">
+        SELECT COUNT(spo.id_)
+        FROM student_payment_order spo
+        LEFT JOIN sys_user su ON spo.user_id_ = su.id_
+        LEFT JOIN sporadic_charge_info sci ON sci.id_ = spo.music_group_id_
+        WHERE spo.type_ = 'SPORADIC'
+        <include refid="sporadicQueryPageSql"/>
+    </select>
+    <sql id="sporadicQueryPageSql">
+        <if test="organId != null">
+            AND FIND_IN_SET(spo.organ_id_,#{organId})
+        </if>
+        <if test="search != null">
+            AND (sci.title_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%'))
+        </if>
+        <if test="chargeType != null">
+            AND sci.charge_type_ = #{chargeType}
+        </if>
+        <if test="payStatus != null">
+            AND spo.status_ = #{payStatus}
+        </if>
+    </sql>
 </mapper>

+ 25 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentOrderController.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
@@ -81,6 +82,30 @@ public class StudentPaymentOrderController extends BaseController {
         return succeed(studentPaymentOrderPageInfo);
     }
 
+    @ApiOperation(value = "获取零星收费订单列表")
+    @GetMapping("/sporadicQueryPage")
+    @PreAuthorize("@pcs.hasPermissions('order/sporadicQueryPage')")
+    public Object sporadicQueryPage(SporadicOrderQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if (!sysUser.getIsSuperAdmin()) {
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+                return failed("用户所在分部异常");
+            } else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                    return failed("非法请求");
+                }
+            }
+        }
+        return succeed(studentPaymentOrderService.sporadicQueryPage(queryInfo));
+    }
+
     @ApiOperation(value = "获取订单列表1")
     @GetMapping("/queryPage1")
     @PreAuthorize("@pcs.hasPermissions('order/queryPage1')")