Selaa lähdekoodia

Merge branch 'online1' of http://git.dayaedu.com/yonge/mec into network_room

 Conflicts:
	mec-im/src/main/java/com/ym/controller/RoomController.java
zouxuan 4 vuotta sitten
vanhempi
commit
7dd268db64
83 muutettua tiedostoa jossa 2798 lisäystä ja 916 poistoa
  1. 3 1
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java
  2. 2 2
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysMenuMapper.xml
  3. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  4. 17 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java
  5. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ImGroupDao.java
  6. 24 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  7. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCourseHomeworkDao.java
  8. 34 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentInstrumentDao.java
  9. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPreRegistrationDao.java
  10. 13 7
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  11. 40 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MaintenancePayDto.java
  12. 34 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PreRegisterSubjectDto.java
  13. 14 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RegisterPayDto.java
  14. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RepairGoodsDto.java
  15. 13 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherPersonalAttendanceDto.java
  16. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  17. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentAttendance.java
  18. 238 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java
  19. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java
  20. 117 46
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRepair.java
  21. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/GroupType.java
  22. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
  23. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderDetailTypeEnum.java
  24. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java
  25. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ProbationPeriodEnum.java
  26. 36 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/RepairStudentQueryInfo.java
  27. 101 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentInstrumentQueryInfo.java
  28. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ImGroupService.java
  29. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java
  30. 48 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentInstrumentService.java
  31. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPreRegistrationService.java
  32. 23 6
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  33. 9 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  34. 87 41
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  35. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java
  36. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupServiceImpl.java
  37. 63 190
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  38. 112 69
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java
  39. 331 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java
  40. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  41. 5 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  42. 35 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPreRegistrationServiceImpl.java
  43. 168 183
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  44. 34 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  45. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  46. 15 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java
  47. 25 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  48. 46 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  49. 16 1
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml
  50. 6 2
      mec-biz/src/main/resources/config/mybatis/ImGroupMapper.xml
  51. 26 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  52. 3 2
      mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  53. 8 7
      mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml
  54. 165 0
      mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml
  55. 3 0
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml
  56. 19 0
      mec-biz/src/main/resources/config/mybatis/StudentPreRegistrationMapper.xml
  57. 5 0
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  58. 20 9
      mec-biz/src/main/resources/config/mybatis/StudentRepairMapper.xml
  59. 3 8
      mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml
  60. 12 0
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  61. 3 0
      mec-client-api/src/main/java/com/ym/mec/im/WebFeignService.java
  62. 6 0
      mec-client-api/src/main/java/com/ym/mec/im/fallback/WebFeignServiceFallback.java
  63. 4 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  64. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  65. 0 2
      mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java
  66. 24 0
      mec-common/common-core/src/main/java/com/ym/mec/common/entity/Mapper.java
  67. 5 3
      mec-im/src/main/java/com/ym/controller/RoomController.java
  68. 4 15
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  69. 14 1
      mec-student/src/main/java/com/ym/mec/student/controller/ImGroupController.java
  70. 43 35
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  71. 24 3
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java
  72. 56 0
      mec-student/src/main/java/com/ym/mec/student/controller/StudentInstrumentController.java
  73. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/MaintenanceNoticeTask.java
  74. 3 3
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ImGroupController.java
  75. 9 0
      mec-web/src/main/java/com/ym/mec/web/controller/APIController.java
  76. 199 199
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  77. 11 4
      mec-web/src/main/java/com/ym/mec/web/controller/ImGroupController.java
  78. 10 10
      mec-web/src/main/java/com/ym/mec/web/controller/SporadicChargeInfoController.java
  79. 87 0
      mec-web/src/main/java/com/ym/mec/web/controller/StudentInstrumentController.java
  80. 19 9
      mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java
  81. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java
  82. 64 12
      mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java
  83. 13 4
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

+ 3 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.auth.web.controller;
 
+import com.ym.mec.im.WebFeignService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -56,7 +57,7 @@ public class UserController extends BaseController {
 	@Autowired
 	private IdGeneratorService smsCodeService;
 	@Autowired
-	private ESealPlugin eSealPlugin;
+	private WebFeignService webFeignService;
 	@Value("${message.debugMode}")
 	private boolean debugMode;
 	@Autowired
@@ -154,6 +155,7 @@ public class UserController extends BaseController {
 			ImResult register = imFeignService.register(new ImUserModel(sysUser.getId().toString(), username, sysUser.getAvatar()));
 			sysUser.setImToken(register.getToken());
 		}
+		webFeignService.updateNickName(sysUser.getId(),username,null);
 		password = new BCryptPasswordEncoder().encode(password);
 		sysUser.setPassword(password);
 		sysUser.setUpdateTime(new Date());

+ 2 - 2
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysMenuMapper.xml

@@ -40,8 +40,8 @@
     <insert id="insert" parameterType="com.ym.mec.auth.api.entity.SysMenu" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO sys_menu
-        (id_,name_,permission_,path_,parent_id_,icon_,component_,sort_,type_,create_time_,update_time_,hidden_,parent_permission_,memo_)
-        VALUES(#{id},#{name},#{permission},#{path},#{parentId},#{icon},#{component},#{sort},#{type},now(),now(),#{hid},#{parentPermission},#{memo})
+        (id_,name_,permission_,path_,parent_id_,icon_,component_,sort_,type_,create_time_,update_time_,hidden_,parent_permission_,memo_,keep_alive_)
+        VALUES(#{id},#{name},#{permission},#{path},#{parentId},#{icon},#{component},#{sort},#{type},now(),now(),#{hid},#{parentPermission},#{memo},#{keepAlive})
     </insert>
 
     <!-- 根据主键查询一条记录 -->

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1477,6 +1477,8 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     CourseSchedule findFirstCourseWithGroup(@Param("groupId") String groupId,
                                             @Param("groupType") GroupType groupType);
+    CourseSchedule findLastCourseWithGroup(@Param("groupId") String groupId,
+                                            @Param("groupType") GroupType groupType);
 
     List<CourseSchedule> findClassGroupLastTeacher(@Param("classGroupIds") List<Integer> classGroupIds);
 
@@ -1786,6 +1788,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
     /**
      * 获取还有剩余课程的学员
+     *
      * @param userIds
      * @param groupType
      * @return
@@ -1793,5 +1796,22 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<Integer> findHasCourseStudent(@Param("userIds") List<Integer> userIds, @Param("groupType") String groupType);
 
     List<CourseSchedule> queryByCourseScheduleIds(Map<String, Object> params);
+
     int countByCourseScheduleIds(Map<String, Object> params);
+
+    /**
+     * 获取乐团已开始的课程数
+     *
+     * @param musicGroupId
+     * @return
+     */
+    Integer getMusicGroupHasStartCourseNum(@Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 获取多乐团已开始的课程数
+     *
+     * @param musicGroupId
+     * @return
+     */
+    List<CourseSchedule> getMusicGroupsHasStartCourseNum(@Param("ids") List<String> ids);
 }

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java

@@ -130,6 +130,7 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
 
     /**
      * 获取乐团的商品
+     *
      * @return
      */
     List<MusicGroupGoodsAndDiscountDto> getMusicGroupGoodsAndDiscount(@Param("subjectId") Integer subjectId, @Param("type") String type);
@@ -138,9 +139,25 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
 
     /**
      * 是否存在已上架的商品编号
+     *
      * @param goodsId
      * @param status
      * @return
      */
     Boolean findByIdAndStatus(@Param("goodsId") String goodsId, @Param("status") int status);
+
+    /**
+     * 获取
+     *
+     * @param id
+     * @return
+     */
+    Goods getGoodsInfo(@Param("id") Integer id);
+
+    /**
+     * 根据id获取商品和分类
+     * @param goodsIds
+     * @return
+     */
+    List<Goods> getGoodiesAndCate(@Param("goodsIds") List<Integer> goodsIds);
 }

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

@@ -28,4 +28,6 @@ public interface ImGroupDao extends BaseDAO<Long, ImGroup> {
 	List<ImGroupMemberDto> queryMemberById(Long imGroupId);
 
 	ImGroupMemberDto queryMember(@Param("imGroupId") Long imGroupId, @Param("userId") Integer userId);
+
+    int updateNickname(@Param("userId") Integer userId, @Param("nickName") String nickName);
 }

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -309,8 +309,32 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
 
     /**
      * 获取
+     *
      * @param calenderIds
      * @return
      */
     List<String> queryMusicGroupIds(@Param("calenderIds") List<Long> calenderIds);
+
+    /**
+     * 获取乐团缴费项的批次数
+     *
+     * @param musicGroupId
+     * @return
+     */
+    List<MusicGroupPaymentCalender> getMusicGroupCalenderBatchNoTimes(@Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 获取多乐团的报名缴费项
+     *
+     * @return
+     */
+    List<MusicGroupPaymentCalender> getMusicGroupRegCalenderByIds(@Param("ids") List<String> ids);
+
+
+    /**
+     * 获取多乐团缴费项的批次数
+     *
+     * @return
+     */
+    List<MusicGroupPaymentCalender> getMusicGroupCalenderBatchNoByIds(@Param("ids") List<String> ids);
 }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCourseHomeworkDao.java

@@ -21,6 +21,9 @@ public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHom
     @Select("SELECT COUNT(*) FROM student_course_homework WHERE course_homework_id_=#{courseHomeworkID} AND attachments_ IS NOT NULL")
     int countCompletedStudentNum(Long courseHomeworkID);
 
+    @Select("SELECT COUNT(user_id_) FROM student_course_homework WHERE course_schedule_id_=#{courseId}")
+    int countHomeworkStudentNumWithCourse(Long courseId);
+
     /**
      * @Author: Joburgess
      * @Date: 2019/9/18

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentInstrumentDao.java

@@ -0,0 +1,34 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+public interface StudentInstrumentDao extends BaseDAO<Long, StudentInstrument> {
+
+    /**
+     * 批量添加
+     *
+     * @param studentInstruments
+     * @return
+     */
+    int batchAdd(@Param("studentInstruments") List<StudentInstrument> studentInstruments);
+
+    /**
+     * 批量修改
+     *
+     * @return
+     */
+    int batchUpdate();
+
+    /**
+     * 根据服务结束时间获取列表
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    List<StudentInstrument> getListByEndTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
+}

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPreRegistrationDao.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
 import com.ym.mec.biz.dal.dto.StudentPreRegistrationDto;
 import com.ym.mec.biz.dal.entity.StudentPreRegistration;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.entity.Mapper;
 
 public interface StudentPreRegistrationDao extends BaseDAO<Long, StudentPreRegistration> {
 
@@ -18,4 +19,9 @@ public interface StudentPreRegistrationDao extends BaseDAO<Long, StudentPreRegis
 	List<StudentPreRegistration> queryByMusicGroupId(String musicGroupId);
 	
 	List<StudentPreRegistrationDto> queryListForPage(Map<String,Object> params);
+	
+	//统计第一专业
+	List<Mapper> queryFirstSubjectNum(String musicGroupId);
+	
+	List<Mapper> querySecondSubjectNum(String musicGroupId);
 }

+ 13 - 7
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -427,6 +427,7 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 批量删除注册信息
+     *
      * @param ids
      * @return
      */
@@ -434,6 +435,7 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 获取学员声部名称
+     *
      * @param musicGroupId
      * @param studentId
      * @return
@@ -442,42 +444,46 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 获取学员声部名称
+     *
      * @param musicGroupId
      * @param studentIds
      * @return
      */
-    List<Map<Integer,String>> getStudentSubjectNameByStuIds(@Param("musicGroupId") String musicGroupId, @Param("studentIds") Collection<Integer> studentIds);
+    List<Map<Integer, String>> getStudentSubjectNameByStuIds(@Param("musicGroupId") String musicGroupId, @Param("studentIds") Collection<Integer> studentIds);
 
     /**
      * 将学员报名缴费状态更新至已缴费
+     *
      * @param calenderId
      */
     void updatePaymentStatusByClaenderId(Long calenderId);
 
     /**
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroup>
      * @describe 查询学员在读进行中乐团
      * @author Joburgess
      * @date 2021/1/29 0029
-     * @param studentIds:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroup>
      */
     List<MusicGroup> getStudentNormalMusicGroups(@Param("studentIds") Set<Integer> studentIds);
 
     /**
+     * @param userId:
+     * @return com.ym.mec.biz.dal.entity.MusicGroup
      * @describe 获取学员最后加入的在读进行中乐团
      * @author Joburgess
      * @date 2021/2/28 0028
-     * @param userId:
-     * @return com.ym.mec.biz.dal.entity.MusicGroup
      */
     MusicGroup getUserLastNormalMusicGroup(@Param("userId") Integer userId);
 
     /**
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentRegistration>
      * @describe 查询学员在读进行中乐团报名信息
      * @author Joburgess
      * @date 2021/2/25 0025
-     * @param studentIds:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentRegistration>
      */
     List<StudentRegistration> getStudentNormalRegistration(@Param("studentIds") Set<Integer> studentIds);
+
+    StudentRegistration getByUserIdAndMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId);
 }

+ 40 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MaintenancePayDto.java

@@ -0,0 +1,40 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+public class MaintenancePayDto {
+    @ApiModelProperty(value = "乐器列表id", required = true)
+    private Long id;
+
+    @ApiModelProperty(value = "支付金额", required = true)
+    private BigDecimal amount;
+
+    @ApiModelProperty(value = "是否使用余额", required = true)
+    private Boolean isUseBalance = false;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Boolean getUseBalance() {
+        return isUseBalance;
+    }
+
+    public void setUseBalance(Boolean useBalance) {
+        isUseBalance = useBalance;
+    }
+}

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PreRegisterSubjectDto.java

@@ -0,0 +1,34 @@
+package com.ym.mec.biz.dal.dto;
+
+public class PreRegisterSubjectDto {
+
+	private String subjectName;
+	
+	private int firstSubjectNum;
+	
+	private int secondSubjectNum;
+
+	public String getSubjectName() {
+		return subjectName;
+	}
+
+	public void setSubjectName(String subjectName) {
+		this.subjectName = subjectName;
+	}
+
+	public int getFirstSubjectNum() {
+		return firstSubjectNum;
+	}
+
+	public void setFirstSubjectNum(int firstSubjectNum) {
+		this.firstSubjectNum = firstSubjectNum;
+	}
+
+	public int getSecondSubjectNum() {
+		return secondSubjectNum;
+	}
+
+	public void setSecondSubjectNum(int secondSubjectNum) {
+		this.secondSubjectNum = secondSubjectNum;
+	}
+}

+ 14 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RegisterPayDto.java

@@ -14,11 +14,11 @@ public class RegisterPayDto {
     private BigDecimal amount;
     //报名id
     private Integer registerId;
-    //打包商品ids
+    //打包商品ids(废弃)
     private String goodsGroupIds;
-    //单独商品ids
+    //单独商品ids(废弃)
     private String goodsIds;
-    //教谱ids
+    //教谱ids(废弃)
     private String otherGoodsIds;
     //乐器id->type
     private Map<Long, String> goodsGroups;
@@ -32,6 +32,9 @@ public class RegisterPayDto {
     @ApiModelProperty(value = "新的乐团课程形态",required = false)
     private List<Integer> newCourse;
 
+    @ApiModelProperty(value = "购买乐器保养",required = false)
+    private Boolean buyMaintenance = false;
+
     public Integer getRegisterId() {
         return registerId;
     }
@@ -103,4 +106,12 @@ public class RegisterPayDto {
     public void setNewCourse(List<Integer> newCourse) {
         this.newCourse = newCourse;
     }
+
+    public Boolean getBuyMaintenance() {
+        return buyMaintenance;
+    }
+
+    public void setBuyMaintenance(Boolean buyMaintenance) {
+        this.buyMaintenance = buyMaintenance;
+    }
 }

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RepairGoodsDto.java

@@ -18,6 +18,15 @@ public class RepairGoodsDto {
     @ApiModelProperty(value = "商品编号", required = true)
     private Integer id;
 
+    @ApiModelProperty(value = "品牌", required = true)
+    private String brand;
+
+    @ApiModelProperty(value = "原价", required = true)
+    private BigDecimal marketPrice;
+
+    @ApiModelProperty(value = "型号", required = true)
+    private String specification;
+
     public BigDecimal getGroupPurchasePrice() {
         return groupPurchasePrice;
     }
@@ -49,4 +58,28 @@ public class RepairGoodsDto {
     public void setId(Integer id) {
         this.id = id;
     }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public BigDecimal getMarketPrice() {
+        return marketPrice;
+    }
+
+    public void setMarketPrice(BigDecimal marketPrice) {
+        this.marketPrice = marketPrice;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
 }

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherPersonalAttendanceDto.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 /**
@@ -27,6 +28,10 @@ public class TeacherPersonalAttendanceDto {
     @ApiModelProperty(value = "课程类型",required = false)
     private CourseSchedule.CourseScheduleType type;
 
+    /** 课程状态 */
+    @ApiModelProperty(value = "课程状态",required = false)
+    private CourseStatusEnum courseStatus;
+
     /** 班级名称 */
     @ApiModelProperty(value = "班级名称",required = false)
     private String name;
@@ -43,6 +48,14 @@ public class TeacherPersonalAttendanceDto {
     @ApiModelProperty(value = "备注",required = false)
     private String remark;
 
+    public CourseStatusEnum getCourseStatus() {
+        return courseStatus;
+    }
+
+    public void setCourseStatus(CourseStatusEnum courseStatus) {
+        this.courseStatus = courseStatus;
+    }
+
     public Integer getSignInStatus() {
         return signInStatus;
     }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java

@@ -174,6 +174,9 @@ public class MusicGroup {
 
 	private Boolean hasVerifyMusicalList = false;
 
+	@ApiModelProperty(value = "进行中,缴费按钮控制",required = true)
+	private Boolean isRemedy = false;
+
 	public String getRepairUserName() {
 		return repairUserName;
 	}
@@ -580,4 +583,12 @@ public class MusicGroup {
 	public void setCourseViewType(CourseViewTypeEnum courseViewType) {
 		this.courseViewType = courseViewType;
 	}
+
+	public Boolean getIsRemedy() {
+		return isRemedy;
+	}
+
+	public void setIsRemedy(Boolean remedy) {
+		isRemedy = remedy;
+	}
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentAttendance.java

@@ -47,8 +47,12 @@ public class StudentAttendance {
 	@ApiModelProperty(value = "学生姓名",required = false)
 	private String username;
 
+	//学员头像
 	private String avatar;
 
+	//老师头像
+	private String teacherAvatar;
+
 	/**  */
 	@ApiModelProperty(value = "声部列表",required = false)
 	private String subjectName;
@@ -86,6 +90,14 @@ public class StudentAttendance {
 	@ApiModelProperty(value = "缴费状态")
 	private String paymentStatus = "PAID_COMPLETED";
 
+	public String getTeacherAvatar() {
+		return teacherAvatar;
+	}
+
+	public void setTeacherAvatar(String teacherAvatar) {
+		this.teacherAvatar = teacherAvatar;
+	}
+
 	public YesOrNoEnum getVisitFlag() {
 		return visitFlag;
 	}

+ 238 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java

@@ -0,0 +1,238 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+@ApiModel(value = "com-ym-mec-biz-dal-entity-StudentInstrument")
+public class StudentInstrument {
+    @ApiModelProperty(value = "")
+    private Long id;
+
+    /**
+     * 学生id
+     */
+    @ApiModelProperty(value = "学生id")
+    private Integer studentId;
+
+    /**
+     * 分部id
+     */
+    @ApiModelProperty(value = "分部id")
+    private Integer organId;
+
+    /**
+     * 商品id
+     */
+    @ApiModelProperty(value = "商品id")
+    private Integer goodsId;
+
+    /**
+     * 分类id
+     */
+    @ApiModelProperty(value = "商品分类id")
+    private Integer goodsCategoryId;
+
+    /**
+     * 分类id
+     */
+    @ApiModelProperty(value = "商品分类名称")
+    private String goodsCategoryName;
+
+    /**
+     * 是否乐保 0-不是 1-是
+     */
+    @ApiModelProperty(value = "是否乐保 0-不是 1-是")
+    private Integer status;
+
+    /**
+     * 乐保开始时间
+     */
+    @ApiModelProperty(value = "乐保开始时间")
+    private Date startTime;
+
+    /**
+     * 乐保结束时间
+     */
+    @ApiModelProperty(value = "乐保结束时间")
+    private Date endTime;
+
+    /**
+     * 添加时间
+     */
+    @ApiModelProperty(value = "添加时间")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    @ApiModelProperty(value = "乐器名称")
+    private String goodsName;
+
+    @ApiModelProperty(value = "乐器品牌")
+    private String goodsBrand;
+
+    @ApiModelProperty(value = "乐器规格")
+    private String specification;
+
+    @ApiModelProperty(value = "乐器图片")
+    private String goodsImg;
+
+    @ApiModelProperty(value = "学生姓名")
+    private String studentName;
+
+    @ApiModelProperty(value = "联系电话")
+    private String phone;
+
+    @ApiModelProperty(value = "分部")
+    private String organName;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Integer getGoodsId() {
+        return goodsId;
+    }
+
+    public void setGoodsId(Integer goodsId) {
+        this.goodsId = goodsId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getGoodsName() {
+        return goodsName;
+    }
+
+    public void setGoodsName(String goodsName) {
+        this.goodsName = goodsName;
+    }
+
+
+    public String getGoodsImg() {
+        return goodsImg;
+    }
+
+    public void setGoodsImg(String goodsImg) {
+        this.goodsImg = goodsImg;
+    }
+
+    public String getGoodsBrand() {
+        return goodsBrand;
+    }
+
+    public void setGoodsBrand(String goodsBrand) {
+        this.goodsBrand = goodsBrand;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public Integer getGoodsCategoryId() {
+        return goodsCategoryId;
+    }
+
+    public void setGoodsCategoryId(Integer goodsCategoryId) {
+        this.goodsCategoryId = goodsCategoryId;
+    }
+
+    public String getGoodsCategoryName() {
+        return goodsCategoryName;
+    }
+
+    public void setGoodsCategoryName(String goodsCategoryName) {
+        this.goodsCategoryName = goodsCategoryName;
+    }
+}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java

@@ -51,6 +51,9 @@ public class StudentPaymentOrderDetail {
 	//减免费用
 	private BigDecimal remitFee;
 
+	//学生乐器id
+	private Long studentInstrumentId;
+
 	@ApiModelProperty(value = "子商品列表",required = false)
 	private List<Goods> childGoodsList;
 
@@ -154,4 +157,12 @@ public class StudentPaymentOrderDetail {
 	public void setChildGoodsList(List<Goods> childGoodsList) {
 		this.childGoodsList = childGoodsList;
 	}
+
+	public Long getStudentInstrumentId() {
+		return studentInstrumentId;
+	}
+
+	public void setStudentInstrumentId(Long studentInstrumentId) {
+		this.studentInstrumentId = studentInstrumentId;
+	}
 }

+ 117 - 46
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRepair.java

@@ -9,14 +9,45 @@ import java.util.Date;
 public class StudentRepair {
     private Integer id;
     /**
-    * 维修单号
-    */
+     * 维修单号
+     */
     @ApiModelProperty(value = "维修单号", required = false)
     private String transNo;
 
     /**
-    * 分部id
-    */
+     * 学员乐器id
+     */
+    @ApiModelProperty(value = "学员乐器id", required = false)
+    private Long studentInstrumentId;
+
+    /**
+     * 学员乐器id
+     */
+    @ApiModelProperty(value = "乐保状态0-无 1-有", required = false)
+    private Integer maintenanceStatus = 0;
+
+    /**
+     * 维修单名称
+     */
+    @ApiModelProperty(value = "维修单名称", required = false)
+    private String repairName;
+
+
+    /**
+     * 维修单名称
+     */
+    @ApiModelProperty(value = "维修图片", required = false)
+    private String repairImg;
+
+    /**
+     * 特权减免金额
+     */
+    @ApiModelProperty(value = "特权减免金额", required = false)
+    private BigDecimal exemptionAmount = BigDecimal.ZERO;
+
+    /**
+     * 分部id
+     */
     @ApiModelProperty(value = "分部id", required = false)
     private Integer organId;
 
@@ -28,32 +59,32 @@ public class StudentRepair {
 
 
     /**
-    * 分部名称
-    */
+     * 分部名称
+     */
     @ApiModelProperty(value = "分部名称", required = false)
     private String organName;
 
     /**
-    * 学生id
-    */
+     * 学生id
+     */
     @ApiModelProperty(value = "学生id", required = true)
     private Integer studentId;
 
     /**
-    * 学生姓名
-    */
+     * 学生姓名
+     */
     @ApiModelProperty(value = "学生姓名", required = false)
     private String studentName;
 
     /**
-    * 学生学校
-    */
+     * 学生学校
+     */
     @ApiModelProperty(value = "学生学校", required = false)
     private String studentSchool;
 
     /**
-    * 技师id
-    */
+     * 技师id
+     */
     @ApiModelProperty(value = "技师id", required = false)
     private Integer employeeId;
 
@@ -76,26 +107,26 @@ public class StudentRepair {
     private String employeeAddress;
 
     /**
-    * 乐器类型id
-    */
+     * 乐器类型id
+     */
     @ApiModelProperty(value = "乐器类型id", required = false)
     private Integer subjectId;
 
     /**
-    * 乐器类型名称
-    */
+     * 乐器类型名称
+     */
     @ApiModelProperty(value = "乐器类型名称", required = false)
     private String subjectName;
 
     /**
-    * 维修类型 0-线下 1-线上
-    */
+     * 维修类型 0-线下 1-线上
+     */
     @ApiModelProperty(value = "维修类型 0-线下 1-线上", required = false)
     private Integer type;
 
     /**
-    * 乐器编号
-    */
+     * 乐器编号
+     */
     @ApiModelProperty(value = "乐器编号", required = false)
     private String instrumentNo;
 
@@ -106,62 +137,62 @@ public class StudentRepair {
     private String feeList;
 
     /**
-    * 问题描述及解决方法
-    */
+     * 问题描述及解决方法
+     */
     @ApiModelProperty(value = "问题描述及解决方法", required = false)
     private String description;
 
     /**
-    * 维修金额
-    */
+     * 维修金额
+     */
     @ApiModelProperty(value = "维修金额", required = false)
     private BigDecimal amount;
 
     /**
-    * 维修完成时间
-    */
+     * 维修完成时间
+     */
     @ApiModelProperty(value = "维修完成时间", required = false)
     private Date finishTime;
 
     /**
-    * 乐器取回方式 0-自取 1-快递
-    */
+     * 乐器取回方式 0-自取 1-快递
+     */
     @ApiModelProperty(value = "乐器取回方式 0-自取 1-快递", required = false)
     private Integer sendType;
 
     /**
-    * 联系人
-    */
+     * 联系人
+     */
     @ApiModelProperty(value = "联系人", required = false)
     private String contactName;
 
     /**
-    * 联系方式
-    */
+     * 联系方式
+     */
     @ApiModelProperty(value = "联系方式", required = false)
     private String contactMobile;
 
     /**
-    * 快递地址
-    */
+     * 快递地址
+     */
     @ApiModelProperty(value = "快递地址", required = false)
     private String address;
 
     /**
-    * 所选商品
-    */
+     * 所选商品
+     */
     @ApiModelProperty(value = "商品", required = false)
     private String goodsJson;
 
     /**
-    * 支付状态 0-未支付 1-支付中 2-已支付
-    */
+     * 支付状态 0-未支付 1-支付中 2-已支付
+     */
     @ApiModelProperty(value = "支付状态 0-未支付 1-支付中 2-已支付", required = false)
     private Integer payStatus;
 
     /**
-    * 维修状态 0维修中,1已完成
-    */
+     * 维修状态 0维修中,1已完成
+     */
     @ApiModelProperty(value = "维修状态 0维修中,1已完成", required = false)
     private Integer repairStatus;
 
@@ -172,14 +203,14 @@ public class StudentRepair {
     private Boolean isUseBalancePayment;
 
     /**
-    * 送修时间
-    */
+     * 送修时间
+     */
     @ApiModelProperty(value = "送修时间", required = true)
     private Date createTime;
 
     /**
-    * 更新时间
-    */
+     * 更新时间
+     */
     @ApiModelProperty(value = "更新时间", required = false)
     private Date updateTime;
 
@@ -427,4 +458,44 @@ public class StudentRepair {
     public void setMusicGroupId(String musicGroupId) {
         this.musicGroupId = musicGroupId;
     }
+
+    public Long getStudentInstrumentId() {
+        return studentInstrumentId;
+    }
+
+    public void setStudentInstrumentId(Long studentInstrumentId) {
+        this.studentInstrumentId = studentInstrumentId;
+    }
+
+    public String getRepairName() {
+        return repairName;
+    }
+
+    public void setRepairName(String repairName) {
+        this.repairName = repairName;
+    }
+
+    public BigDecimal getExemptionAmount() {
+        return exemptionAmount;
+    }
+
+    public void setExemptionAmount(BigDecimal exemptionAmount) {
+        this.exemptionAmount = exemptionAmount;
+    }
+
+    public Integer getMaintenanceStatus() {
+        return maintenanceStatus;
+    }
+
+    public void setMaintenanceStatus(Integer maintenanceStatus) {
+        this.maintenanceStatus = maintenanceStatus;
+    }
+
+    public String getRepairImg() {
+        return repairImg;
+    }
+
+    public void setRepairImg(String repairImg) {
+        this.repairImg = repairImg;
+    }
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/GroupType.java

@@ -12,7 +12,8 @@ public enum GroupType implements BaseEnum<String, GroupType> {
 	REPAIR("乐器维修"),
 	GOODS_SELL("商品销售"),
 	OUTORDER("外部订单"),
-	SUBJECT_CHANGE("声部更换");
+	SUBJECT_CHANGE("声部更换"),
+	MAINTENANCE("乐保");
 
 	private String desc;
 

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -165,7 +165,8 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     SMS_REPAIR_SEND_COMPLETED("SMS_REPAIR_SEND_COMPLETED","乐器维修完成邮寄"),
     SMS_MUSIC_GROUP_PARENT_MEETING_NOTICE("SMS_MUSIC_GROUP_PARENT_MEETING_NOTICE","乐团家长会通知"),
     SMS_INSPECTION_NOTICE("SMS_INSPECTION_NOTICE","巡查日程提醒"),
-    TEACHER_SERVE_PUSH("TEACHER_SERVE_PUSH", "服务指标未完成提醒");
+    TEACHER_SERVE_PUSH("TEACHER_SERVE_PUSH", "服务指标未完成提醒"),
+    MAINTENANCE_NOTICE_PUSH("MAINTENANCE_NOTICE_PUSH", "乐保到期提醒");
 
 
 

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderDetailTypeEnum.java

@@ -24,7 +24,8 @@ public enum OrderDetailTypeEnum implements BaseEnum<String, OrderDetailTypeEnum>
     HIGH_ONLINE("HIGH_ONLINE", "网络基础训练课"),
     MUSIC_NETWORK("MUSIC_NETWORK", "乐团网管课"),
     CLASSROOM("CLASSROOM", "课堂课"),
-	DEGREE_REGISTRATION("DEGREE_REGISTRATION", "考级报名");
+	DEGREE_REGISTRATION("DEGREE_REGISTRATION", "考级报名"),
+    MAINTENANCE("MAINTENANCE","乐保服务");
 
     private String code;
 

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java

@@ -21,7 +21,8 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
 	OUTORDER("OUTORDER", "外部订单"),
 	REPAIR("REPAIR","乐器维修"),
 	SUBJECT_CHANGE("SUBJECT_CHANGE","声部更换"),
-	DEGREE_REGISTRATION("DEGREE_REGISTRATION", "考级报名");
+	DEGREE_REGISTRATION("DEGREE_REGISTRATION", "考级报名"),
+	MAINTENANCE("MAINTENANCE","乐保");
 
 
 	private String code;

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ProbationPeriodEnum.java

@@ -6,7 +6,8 @@ import com.ym.mec.common.enums.BaseEnum;
 public enum ProbationPeriodEnum implements BaseEnum<Integer, ProbationPeriodEnum> {
     NORMAL(0,"正式"),
     TRY(1,"试用"),
-    LEAVE(2,"离职");
+    LEAVE(2,"离职"),
+    INTERNSHIP(3,"实习");
 
     private Integer code;
 

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/RepairStudentQueryInfo.java

@@ -1,7 +1,9 @@
 package com.ym.mec.biz.dal.page;
 
 import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 public class RepairStudentQueryInfo extends QueryInfo {
@@ -26,6 +28,16 @@ public class RepairStudentQueryInfo extends QueryInfo {
 
     private Integer payStatus;
 
+    @ApiModelProperty(value = "乐器列表id",required = false)
+    private Long studentInstrumentId;
+
+    @ApiModelProperty(value = "特权减免金额",required = false)
+    private BigDecimal exemptionAmount;
+
+    @ApiModelProperty(value = "是否有减免金额0-否 1-是",required = false)
+    private Integer hasExemptionAmount;
+
+
     public Integer getSubjectId() {
         return subjectId;
     }
@@ -97,4 +109,28 @@ public class RepairStudentQueryInfo extends QueryInfo {
     public void setPayStatus(Integer payStatus) {
         this.payStatus = payStatus;
     }
+
+    public Long getStudentInstrumentId() {
+        return studentInstrumentId;
+    }
+
+    public void setStudentInstrumentId(Long studentInstrumentId) {
+        this.studentInstrumentId = studentInstrumentId;
+    }
+
+    public BigDecimal getExemptionAmount() {
+        return exemptionAmount;
+    }
+
+    public void setExemptionAmount(BigDecimal exemptionAmount) {
+        this.exemptionAmount = exemptionAmount;
+    }
+
+    public Integer getHasExemptionAmount() {
+        return hasExemptionAmount;
+    }
+
+    public void setHasExemptionAmount(Integer hasExemptionAmount) {
+        this.hasExemptionAmount = hasExemptionAmount;
+    }
 }

+ 101 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentInstrumentQueryInfo.java

@@ -0,0 +1,101 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class StudentInstrumentQueryInfo extends QueryInfo {
+
+    /**
+     * 学生id
+     */
+    @ApiModelProperty(value = "学生id", required = true)
+    private Integer studentId;
+
+    @ApiModelProperty(value = "分部ids", required = true)
+    private String organId;
+
+    /**
+     * 商品id
+     */
+    @ApiModelProperty(value = "商品id")
+    private Integer goodsId;
+
+    /**
+     * 分类id
+     */
+    @ApiModelProperty(value = "商品分类id")
+    private Integer goodsCategoryId;
+
+
+    @ApiModelProperty(value = "乐器品牌")
+    private String goodsBrand;
+
+    @ApiModelProperty(value = "乐器规格")
+    private String specification;
+
+    /**
+     * 是否乐保 0-不是 1-是
+     */
+    @ApiModelProperty(value = "是否乐保 0-不是 1-是")
+    private Integer status;
+
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
+    public Integer getGoodsId() {
+        return goodsId;
+    }
+
+    public void setGoodsId(Integer goodsId) {
+        this.goodsId = goodsId;
+    }
+
+    public Integer getGoodsCategoryId() {
+        return goodsCategoryId;
+    }
+
+    public void setGoodsCategoryId(Integer goodsCategoryId) {
+        this.goodsCategoryId = goodsCategoryId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getGoodsBrand() {
+        return goodsBrand;
+    }
+
+    public void setGoodsBrand(String goodsBrand) {
+        this.goodsBrand = goodsBrand;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+}

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

@@ -51,4 +51,12 @@ public interface ImGroupService extends BaseService<Long, ImGroup> {
 	 * @return
 	 */
 	ImGroupMemberDto queryMember(Long imGroupId, Integer userId);
+
+	/**
+	 * 修改用户在群、通讯录的备注
+	 * @param userId
+	 * @param nickName
+	 * @return
+	 */
+    int updateNickName(Integer userId, String nickName,String userType);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java

@@ -4,10 +4,13 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
+import com.ym.mec.biz.dal.entity.StudentInstrument;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
+import java.util.List;
+
 public interface StudentGoodsSellService extends BaseService<Integer, StudentGoodsSell> {
 
     /**
@@ -42,4 +45,12 @@ public interface StudentGoodsSellService extends BaseService<Integer, StudentGoo
      * @return com.ym.mec.common.page.PageInfo<com.ym.mec.biz.dal.dto.StudentGoodsSellDto>
      */
     PageInfo<StudentPaymentOrderDto> queryStudentPaymentOrders(GoodsSellQueryInfo queryInfo);
+
+
+    /**
+     * 将购买的乐器加入学生乐器列表
+     * @return
+     */
+    List<StudentInstrument> saveStudentInstrument(String orderNo);
+
 }

+ 48 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentInstrumentService.java

@@ -0,0 +1,48 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.MaintenancePayDto;
+import com.ym.mec.biz.dal.entity.StudentInstrument;
+
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.common.service.BaseService;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public interface StudentInstrumentService extends BaseService<Long, StudentInstrument> {
+
+    /**
+     * 乐保支付
+     */
+    Map pay(MaintenancePayDto maintenancePayDto) throws Exception;
+
+    /**
+     * 回调页面
+     *
+     * @param studentPaymentOrder
+     * @return
+     */
+    Boolean orderCallback(StudentPaymentOrder studentPaymentOrder);
+
+    /**
+     * 添加学生乐器
+     * @param studentInstrument
+     * @return
+     */
+    StudentInstrument addStudentInstrument(StudentInstrument studentInstrument);
+
+
+    /**
+     * 将订单详情乐器加入学生乐器列表
+     * @param order
+     * @return
+     */
+    Boolean addOrderDetail2Instrument(StudentPaymentOrder order);
+
+
+    /**
+     * 有效期到期前7天,推送提醒学员该乐器有效期即将到期
+     * @return
+     */
+    Boolean pushNotice();
+}

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPreRegistrationService.java

@@ -1,5 +1,8 @@
 package com.ym.mec.biz.service;
 
+import java.util.List;
+
+import com.ym.mec.biz.dal.dto.PreRegisterSubjectDto;
 import com.ym.mec.biz.dal.dto.StudentPreRegistrationDto;
 import com.ym.mec.biz.dal.entity.StudentPreRegistration;
 import com.ym.mec.common.page.PageInfo;
@@ -9,4 +12,6 @@ import com.ym.mec.common.service.BaseService;
 public interface StudentPreRegistrationService extends BaseService<Long, StudentPreRegistration> {
 	
 	public PageInfo<StudentPreRegistrationDto> queryListForPage(QueryInfo queryInfo);
+	
+	public List<PreRegisterSubjectDto> querySubjectNum(String musicGroupId);
 }

+ 23 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -83,17 +83,22 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 
     /**
      * 学生注册缴费订单
-     *
      * @param studentRegistration
      * @param amount
+     * @param orderNo
+     * @param paymentChannel
      * @param courseFee
      * @param goodsGroups
-     * @param goodsList
+     * @param remitFee
+     * @param courseRemitFee
+     * @param newCourses
+     * @param buyMaintenance
      * @return
+     * @throws Exception
      */
     StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
-                                 List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, List<CourseFormDto> courseForms,
-                                 BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses) throws Exception;
+                                 List<MusicGroupSubjectGoodsGroup> goodsGroups,BigDecimal remitFee, BigDecimal courseRemitFee,
+                                 List<MusicGroupPaymentCalenderCourseSettings> newCourses,Boolean buyMaintenance) throws Exception;
 
     /**
      * 学生注册缴费重新下订单
@@ -107,8 +112,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     StudentPaymentOrder reAddOrder(
             Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
-            List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList,
-            String musicGroupId, StudentPaymentOrder oldOrder, List<CourseFormDto> courseForms, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses) throws Exception;
+            List<MusicGroupSubjectGoodsGroup> goodsGroups, String musicGroupId, StudentPaymentOrder oldOrder, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses,Boolean buyMaintenance) throws Exception;
 
     /**
      * 查询用户指定乐团的报名信息
@@ -351,4 +355,17 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId);
 
+
+    /**
+     * 检查乐团是否能报名或缴费
+     * @return
+     */
+    String checkRegOrPayStatus(String musicGroupId);
+
+    /**
+     * 检查多乐团是否能报名或缴费
+     * @return
+     */
+    Map<String,Boolean> checkMusicGroupsRegOrPayStatus(List<String> ids);
+
 }

+ 9 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -503,6 +503,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			if(!GroupStatusEnum.NORMAL.equals(practiceGroup.getGroupStatus())){
 				throw new BizException("非进行中网管课不支持加课");
 			}
+			groupEndDate = practiceGroup.getCoursesExpireDate();
 			organId=practiceGroup.getOrganId();
 
 			List<TeacherDefaultPracticeGroupSalary> teacherDefaultPracticeGroupSalaryList = teacherDefaultPracticeGroupSalaryDao
@@ -639,7 +640,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 					}
 					if (groupEndDate != null) {
 						if (calendar.getTime().after(groupEndDate)) {
-							throw new BizException("排课时间超出排课截止日期({})", groupEndDate);
+							throw new BizException("排课时间超出排课截止日期({})", DateUtil.dateToString(groupEndDate, DateUtil.DATE_FORMAT_MIN));
 						}
 					}
 
@@ -4959,8 +4960,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     	if(practiceGroup == null){
 			throw new BizException("课程组不存在");
 		}
-    	if(!GroupStatusEnum.NORMAL.equals(practiceGroup.getGroupStatus())){
-    		throw new BizException("非进行中课程组不可编辑");
+		if(!GroupStatusEnum.NORMAL.equals(practiceGroup.getGroupStatus())&&!GroupStatusEnum.FINISH.equals(practiceGroup.getGroupStatus())){
+			throw new BizException("非正常状态课程组不可编辑");
 		}
 		if(courseStartDate.after(coursesExpireDate)){
 			throw new BizException("课程组有效结束时间不能早于课程组有效开始时间");
@@ -4981,6 +4982,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 //				throw new BizException("课程结束时间不得早于,{}", DateUtil.dateToString(courseExpiredDateTemp, "yyyy年MM月dd日"));
 //			}
 //		}
+		Date now = new Date();
 		CoursesGroupModifyLog coursesGroupModifyLog = new CoursesGroupModifyLog();
 		coursesGroupModifyLog.setGroupId(practiceGroupId);
 		coursesGroupModifyLog.setGroupType(PRACTICE.getCode());
@@ -4988,7 +4990,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		coursesGroupModifyLog.setPreviousGroup(JSONObject.toJSONString(practiceGroup));
 		practiceGroup.setCoursesStartDate(courseStartDate);
 		practiceGroup.setCoursesExpireDate(DateUtil.addSeconds(DateUtil.addDays(coursesExpireDate, 1),-1));
-		practiceGroup.setUpdateTime(new Date());
+		if(practiceGroup.getCoursesExpireDate().compareTo(now)>=0||DateUtil.isSameDay(practiceGroup.getCoursesExpireDate(), now)){
+			practiceGroup.setGroupStatus(GroupStatusEnum.NORMAL);
+		}
+		practiceGroup.setUpdateTime(now);
 		practiceGroupDao.update(practiceGroup);
 		coursesGroupModifyLog.setCurrentGroup(JSONObject.toJSONString(practiceGroup));
 		coursesGroupModifyLogDao.insert(coursesGroupModifyLog);

+ 87 - 41
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -251,11 +251,22 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
 
-            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+//            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
+//            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
 
-            //如果上课日期在转正日期之前的按80%结算
-            if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
+            //判断课程是否在试用期内
+            boolean trail = false;
+
+            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getEntryDate())>=0){
+                trail = true;
+            }
+            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())>=0){
+                trail = false;
+            }
+
+
+            //如果上课日期在试用期内按80%结算
+            if(trail){
                 expectSalary = expectSalary.multiply(new BigDecimal("0.8"));
                 deductReasons.add("未转正");
             }
@@ -265,10 +276,13 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             List<TeacherAttendance> courseTeacherAttendances = teacherCourseAttendanceMap.get(org.apache.commons.lang3.StringUtils.joinWith(":", courseScheduleTeacherSalary.getCourseScheduleId(), courseScheduleTeacherSalary.getUserId()));
 
-            TeacherAttendance teacherAttendance = courseTeacherAttendances.get(0);
+            TeacherAttendance teacherAttendance = null;
+            if(!CollectionUtils.isEmpty(courseTeacherAttendances)){
+                teacherAttendance = courseTeacherAttendances.get(0);
+            }
             if(CollectionUtils.isEmpty(courseTeacherAttendances)||Objects.isNull(teacherAttendance.getSignInStatus())){
                 //未签到扣除全部课酬
-                deductCost = deductCost.add(expectSalary);
+                deductCost = deductCost.add(expectSalary.abs());
                 deductReasons.add("未签到扣除全部课酬");
             }else if(YesOrNoEnum.NO.equals(teacherAttendance.getSignInStatus())){
                 //异常签到
@@ -276,18 +290,18 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 float signCourseTimeBetween = (float)signCourseTimeBetweenSeconds/(float)60;
                 if(signCourseTimeBetween<=1&&signCourseTimeBetween>-3){
                     //课程开始前1分钟至开始后3分钟进入教室
-                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)));
+                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)).abs());
                     deductReasons.add("课程开始前1分钟至开始后3分钟进入教室扣除一半课酬");
                 }else if(signCourseTimeBetween<=-3){
                     //课程开始后3分钟后进入教室
-                    deductCost = deductCost.add(expectSalary);
+                    deductCost = deductCost.add(expectSalary.abs());
                     deductReasons.add("课程开始后3分钟进入教室扣除全部课酬");
                 }
             }
 
             if(CollectionUtils.isEmpty(courseTeacherAttendances)||Objects.isNull(teacherAttendance.getSignOutStatus())){
                 //未签退扣除全部课酬
-                deductCost = deductCost.add(expectSalary);
+                deductCost = deductCost.add(expectSalary.abs());
                 deductReasons.add("未签退扣除全部课酬");
             }else if(YesOrNoEnum.NO.equals(teacherAttendance.getSignOutStatus())){
                 //异常签退
@@ -296,11 +310,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
                 if(signOutCourseTimeBetween>3){
                     //课程开始前20分钟至开始后3分钟退出教室
-                    deductCost = deductCost.add(expectSalary);
+                    deductCost = deductCost.add(expectSalary.abs());
                     deductReasons.add("课程结束前3分钟之前退出教室扣除全部课酬");
                 }else if(signOutCourseTimeBetween<=3&&signOutCourseTimeBetween>0){
                     //课程结束前3分钟后至课程结束前退出教室
-                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)));
+                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)).abs());
                     deductReasons.add("课程结束前3分钟后至课程结束前退出教室扣除一半课酬");
                 }
             }
@@ -368,10 +382,21 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
 
-            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+//            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
+//            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
 
-            if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
+            //判断课程是否在试用期内
+            boolean trail = false;
+
+            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getEntryDate())>=0){
+                trail = true;
+            }
+            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())>=0){
+                trail = false;
+            }
+
+            //如果上课日期在试用期内按80%结算
+            if(trail){
                 expectSalary = expectSalary.multiply(new BigDecimal("0.8"));
                 deductReasons.add("未转正");
             }
@@ -383,7 +408,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 //            TeacherAttendance teacherAttendance = courseTeacherAttendances.get(0);
             if(CollectionUtils.isEmpty(courseTeacherAttendances)||Objects.isNull(courseTeacherAttendances.get(0).getSignInStatus())){
                 //未签到扣除全部课酬
-                deductCost = deductCost.add(expectSalary);
+                deductCost = deductCost.add(expectSalary.abs());
                 deductReasons.add("未签到扣除全部课酬");
             }else if(YesOrNoEnum.NO.equals(courseTeacherAttendances.get(0).getSignInStatus())&&TeachModeEnum.ONLINE.equals(courseScheduleTeacherSalary.getCourseSchedule().getTeachMode())){
                 //异常签到
@@ -391,21 +416,21 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 float signCourseTimeBetween = (float)signCourseTimeBetweenSeconds/(float)60;
                 if(signCourseTimeBetween<=1&&signCourseTimeBetween>-3){
                     //课程开始前1分钟至开始后3分钟进入教室
-                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)));
+                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)).abs());
                     deductReasons.add("课程开始前1分钟至开始后3分钟进入教室扣除一半课酬");
                 }else if(signCourseTimeBetween<=-3){
                     //课程开始后3分钟后进入教室
-                    deductCost = deductCost.add(expectSalary);
+                    deductCost = deductCost.add(expectSalary.abs());
                     deductReasons.add("课程开始后3分钟进入教室扣除全部课酬");
                 }
             }else if(YesOrNoEnum.NO.equals(courseTeacherAttendances.get(0).getSignInStatus())&&TeachModeEnum.OFFLINE.equals(courseScheduleTeacherSalary.getCourseSchedule().getTeachMode())){
-                deductCost = deductCost.add(expectSalary);
+                deductCost = deductCost.add(expectSalary.abs());
                 deductReasons.add("点名时经纬度不在范围内扣除全部课酬");
             }
 
             if(CollectionUtils.isEmpty(courseTeacherAttendances)||Objects.isNull(courseTeacherAttendances.get(0).getSignOutStatus())){
                 //未签退扣除全部课酬
-                deductCost = deductCost.add(expectSalary);
+                deductCost = deductCost.add(expectSalary.abs());
                 deductReasons.add("未签退扣除全部课酬");
             }else if(YesOrNoEnum.NO.equals(courseTeacherAttendances.get(0).getSignOutStatus())&&TeachModeEnum.ONLINE.equals(courseScheduleTeacherSalary.getCourseSchedule().getTeachMode())){
                 //异常签退
@@ -414,15 +439,15 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
                 if(signOutCourseTimeBetween>3){
                     //课程开始前20分钟至开始后3分钟退出教室
-                    deductCost = deductCost.add(expectSalary);
+                    deductCost = deductCost.add(expectSalary.abs());
                     deductReasons.add("课程结束前3分钟之前退出教室扣除全部课酬");
                 }else if(signOutCourseTimeBetween<=3&&signOutCourseTimeBetween>0){
                     //课程结束前3分钟后至课程结束前退出教室
-                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)));
+                    deductCost = deductCost.add(expectSalary.divide(new BigDecimal(2)).abs());
                     deductReasons.add("课程结束前3分钟后至课程结束前退出教室扣除一半课酬");
                 }
             }else if(YesOrNoEnum.NO.equals(courseTeacherAttendances.get(0).getSignInStatus())&&TeachModeEnum.OFFLINE.equals(courseScheduleTeacherSalary.getCourseSchedule().getTeachMode())){
-                deductCost = deductCost.add(expectSalary);
+                deductCost = deductCost.add(expectSalary.abs());
                 deductReasons.add("点名时经纬度不在范围内扣除全部课酬");
             }
 
@@ -558,12 +583,22 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 }
 
                 //未转正
-                boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
+//                boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
                 //试用期
-                boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+//                boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+
+                //判断课程是否在试用期内
+                boolean trail = false;
+
+                if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&courseSchedule.getClassDate().compareTo(teacher.getEntryDate())>=0){
+                    trail = true;
+                }
+                if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())>=0){
+                    trail = false;
+                }
 
-                //如果上课日期在转正日期之前的按80%结算
-                if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
+                //如果上课日期在试用期内按80%结算
+                if(trail){
                     teacherSalary = teacherSalary.multiply(new BigDecimal("0.8"));
                     deductReasons.add("未转正");
                 }
@@ -576,7 +611,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 TeacherAttendance teacherAttendance = courseTeacherAttendances.get(0);
                 if(CollectionUtils.isEmpty(courseTeacherAttendances)||Objects.isNull(teacherAttendance.getSignInStatus())){
                     //未签到扣除全部课酬
-                    deductCost = deductCost.add(teacherSalary);
+                    deductCost = deductCost.add(teacherSalary.abs());
                     deductReasons.add("未签到扣除全部课酬");
                 }else if(YesOrNoEnum.NO.equals(teacherAttendance.getSignInStatus())){
                     //异常签到
@@ -584,18 +619,18 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     float signCourseTimeBetween = (float)signCourseTimeBetweenSeconds/(float)60;
                     if(signCourseTimeBetween<=1&&signCourseTimeBetween>-3){
                         //课程开始前1分钟至开始后3分钟进入教室
-                        deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)));
+                        deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)).abs());
                         deductReasons.add("课程开始前1分钟至开始后3分钟进入教室扣除一半课酬");
                     }else if(signCourseTimeBetween<=-3){
                         //课程开始后3分钟后进入教室
-                        deductCost = deductCost.add(teacherSalary);
+                        deductCost = deductCost.add(teacherSalary.abs());
                         deductReasons.add("课程开始后3分钟进入教室扣除全部课酬");
                     }
                 }
 
                 if(CollectionUtils.isEmpty(courseTeacherAttendances)||Objects.isNull(teacherAttendance.getSignOutStatus())){
                     //未签退扣除一半课酬
-                    deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)));
+                    deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)).abs());
                     deductReasons.add("未签退扣除一半课酬");
                 }else if(YesOrNoEnum.NO.equals(teacherAttendance.getSignOutStatus())){
                     //异常签退
@@ -604,11 +639,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
                     if(signOutCourseTimeBetween>3){
                         //课程开始前20分钟至开始后3分钟退出教室
-                        deductCost = deductCost.add(teacherSalary);
+                        deductCost = deductCost.add(teacherSalary.abs());
                         deductReasons.add("课程结束前3分钟之前退出教室扣除全部课酬");
                     }else if(signOutCourseTimeBetween<=3&&signOutCourseTimeBetween>0){
                         //课程结束前3分钟后至课程结束前退出教室
-                        deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)));
+                        deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)).abs());
                         deductReasons.add("课程结束前3分钟后至课程结束前退出教室扣除一半课酬");
                     }
                 }
@@ -643,10 +678,21 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 deductReasons.add("教学点补贴:" + subsidy);
             }
 
-            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+//            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
+//            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+
+            //判断课程是否在试用期内
+            boolean trail = false;
+
+            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&courseSchedule.getClassDate().compareTo(teacher.getEntryDate())>=0){
+                trail = true;
+            }
+            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())>=0){
+                trail = false;
+            }
 
-            if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
+            //如果上课日期在试用期内按80%结算
+            if(trail){
                 teacherSalary = teacherSalary.multiply(new BigDecimal("0.8"));
                 deductReasons.add("未转正");
             }
@@ -690,7 +736,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             if(Objects.isNull(teacherAttendance)||Objects.isNull(teacherAttendance.getSignInStatus())){
                 //无签到记录扣除全部课酬
-                deductCost = deductCost.add(teacherSalary);
+                deductCost = deductCost.add(teacherSalary.abs());
                 deductReasons.add("未签到扣除全部课酬");
             }else if(YesOrNoEnum.NO.equals(teacherAttendance.getSignInStatus())){
                 int signCourseTimeBetweenSeconds = DateUtil.secondsBetween(teacherAttendance.getSignInTime(), courseSchedule.getStartClassTime());
@@ -701,11 +747,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     deductReasons.add("未提前20分钟打卡扣除50元");
                 }else if(signCourseTimeBetween<=0&&signCourseTimeBetween>-30){
                     //迟到30分钟内扣除一半课酬
-                    deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)));
+                    deductCost = deductCost.add(teacherSalary.divide(new BigDecimal(2)).abs());
                     deductReasons.add("迟到30分钟内扣除一半课酬");
                 }else if(signCourseTimeBetween<=-30){
                     //迟到30分钟及以上扣除全部课酬
-                    deductCost = deductCost.add(teacherSalary);
+                    deductCost = deductCost.add(teacherSalary.abs());
                     deductReasons.add("迟到30分钟及以上扣除全部课酬");
                 }
                 if(!signInInRange){
@@ -719,14 +765,14 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             if(Objects.isNull(teacherAttendance)||Objects.isNull(teacherAttendance.getSignOutStatus())){
                 //未签退扣除全部课酬
-                deductCost = deductCost.add(teacherSalary);
+                deductCost = deductCost.add(teacherSalary.abs());
                 deductReasons.add("未签退扣除全部课酬");
             }else if(YesOrNoEnum.NO.equals(teacherAttendance.getSignOutStatus())){
                 int signOutCourseTimeBetweenSeconds = DateUtil.secondsBetween(teacherAttendance.getSignOutTime(), courseSchedule.getEndClassTime());
                 float signOutCourseTimeBetween = (float)signOutCourseTimeBetweenSeconds/(float) 60;
                 if(signOutCourseTimeBetween>3){
                     //早退
-                    deductCost = deductCost.add(teacherSalary);
+                    deductCost = deductCost.add(teacherSalary.abs());
                     deductReasons.add("早退扣除全部课酬");
                 }else if((signOutCourseTimeBetween<=3&&signOutCourseTimeBetween>0)||signOutCourseTimeBetween<=3600){
                     //异常签退,扣除50元
@@ -743,7 +789,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             if(!signInInRange&&!signOutInRange){
                 //签到签退GPS定位在指定距离外
-                deductCost = deductCost.add(teacherSalary);
+                deductCost = deductCost.add(teacherSalary.abs());
                 deductReasons.add("签到签退GPS定位在指定距离外,扣除全部课酬");
             }
 

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.service.ImGroupService;
 import com.ym.mec.biz.service.ImUserFriendService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,6 +60,8 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 	private ImUserFriendService imUserFriendService;
 	@Autowired
 	private OrganizationDao organizationDao;
+	@Autowired
+	private ImGroupService imGroupService;
 
 	@Override
 	public BaseDAO<Integer, Employee> getDAO() {
@@ -121,6 +124,7 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 		//新增用户角色
 		employeeDao.batchAddEmployeeRole(employee.getId(),employee.getRoleIds());
 		teacherDao.updateUser(employee);
+		imGroupService.updateNickName(employee.getUserId(),employee.getRealName(),"SYSTEM");
 	}
 
 	@Override

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupServiceImpl.java

@@ -3,6 +3,10 @@ package com.ym.mec.biz.service.impl;
 import java.util.Date;
 import java.util.List;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.common.entity.ImUserModel;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -38,6 +42,9 @@ public class ImGroupServiceImpl extends BaseServiceImpl<Long, ImGroup> implement
 	@Autowired
 	private ImFeignService imFeignService;
 
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
 	@Override
 	public BaseDAO<Long, ImGroup> getDAO() {
 		return imGroupDao;
@@ -119,4 +126,30 @@ public class ImGroupServiceImpl extends BaseServiceImpl<Long, ImGroup> implement
 		return imGroupDao.queryMember(imGroupId, userId);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public int updateNickName(Integer userId, String nickName,String userType) {
+		//修改群成员备注
+		int i = imGroupDao.updateNickname(userId, nickName);
+		//修改sysUser名称,如果包含学员的角色,那么修改userName。否则修改realName
+		SysUser sysUser = sysUserFeignService.queryUserById(userId);
+		if(StringUtils.isNotEmpty(userType)){
+			if("STUDENT" == userType){
+				sysUser.setUsername(nickName);
+			}else {
+				sysUser.setRealName(nickName);
+			}
+		}else {
+			if(sysUser.getUserType().contains("STUDENT")){
+				sysUser.setUsername(nickName);
+			}else {
+				sysUser.setRealName(nickName);
+			}
+			sysUserFeignService.updateSysUser(sysUser);
+		}
+		//同步融云基本信息
+		imFeignService.update(new ImUserModel(sysUser.getId().toString(),nickName,sysUser.getAvatar()));
+		return i;
+	}
+
 }

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

@@ -647,9 +647,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //获取课程价格
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
         BigDecimal courseFee = musicOneSubjectClassPlan.getFee() == null ? BigDecimal.ZERO : musicOneSubjectClassPlan.getFee();
-        if (studentRegistration.getTemporaryCourseFee() != null) {
-            courseFee = studentRegistration.getTemporaryCourseFee();
-        }
         orderAmount = orderAmount.add(courseFee);
 
         BigDecimal remitFee = BigDecimal.ZERO;
@@ -658,102 +655,31 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
-        if (studentRegistration.getTemporaryCourseFee() != null) {
-            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
-            for (StudentPaymentOrderDetail orderDetail : orderDetails) {
-                if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
-                    continue;
-                }
-                MusicGroupSubjectGoodsGroup musicGroupSubjectGoodsGroup = new MusicGroupSubjectGoodsGroup();
-                GoodsType goodsType = orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL) ? GoodsType.INSTRUMENT : GoodsType.ACCESSORIES;
-                musicGroupSubjectGoodsGroup.setType(goodsType);
-                musicGroupSubjectGoodsGroup.setGoodsIdList(orderDetail.getGoodsIdList());
-                musicGroupSubjectGoodsGroup.setPrice(orderDetail.getPrice());
-                musicGroupSubjectGoodsGroup.setKitGroupPurchaseType(orderDetail.getKitGroupPurchaseType());
-                goodsGroups.add(musicGroupSubjectGoodsGroup);
-
-                orderAmount = orderAmount.add(orderDetail.getPrice());
-            }
-        } else if (StringUtils.isNoneBlank(registerPayDto.getGoodsGroupIds())) {
-            goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(registerPayDto.getGoodsGroupIds());
-            for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
-                    goodsGroup.setPrice(musicOneSubjectClassPlan.getDepositFee());
-                    goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.LEASE);
-                }
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.FREE)) {
-                    goodsGroup.setPrice(new BigDecimal(0));
-                }
-                orderAmount = orderAmount.add(goodsGroup.getPrice());
-                //团购乐器减免课程费用
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && goodsGroup.getRemissionCourseFee() != null && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.GROUP)) {//团购
-                    orderAmount = orderAmount.subtract(goodsGroup.getRemissionCourseFee());
-                    courseFee = courseFee.subtract(goodsGroup.getRemissionCourseFee());
-                }
-            }
-        } else if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
+        if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
             String goodsGroupIds = registerPayDto.getGoodsGroups().keySet().stream().map(Object::toString).collect(Collectors.joining(","));
             goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(goodsGroupIds);
-            for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
-                Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
-                });
-
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
-                    String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
-                    if (!groupType.containsKey(kitGroupPurchaseType)) {
-                        throw new BizException("乐器提供方式不存在,请核查");
-                    }
-                    if (!kitGroupPurchaseType.equals("GROUP")) {
-                        goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
-                    } else {
-                        remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
-                    }
-                    goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
-                    remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
-                }
-                orderAmount = orderAmount.add(goodsGroup.getPrice());
-                goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
-            }
-            orderAmount = orderAmount.subtract(remitFee);
-        }
-
-        //单独辅件
-        List<Goods> goodsList = null;
-        if (registerPayDto.getGoodsIds() != null && !registerPayDto.getGoodsIds().equals("")) {
-            goodsList = goodsService.findGoodsByIds(registerPayDto.getGoodsIds());
-            for (Goods goods : goodsList) {
-                orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
-            }
         }
+        for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
+            Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
+            });
 
-        //单独教谱
-        List<Goods> otherGoodsList = null;
-        if (registerPayDto.getOtherGoodsIds() != null && !registerPayDto.getOtherGoodsIds().equals("")) {
-            otherGoodsList = goodsService.findGoodsByIds(registerPayDto.getOtherGoodsIds());
-            for (Goods goods : otherGoodsList) {
-                orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
-            }
-        }
-        //可选课程
-        List<CourseFormDto> courseForms = new ArrayList<>();
-        if (registerPayDto.getCourseKeys() != null && registerPayDto.getCourseKeys().size() > 0) {
-            MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
-            if (musicGroup.getCourseForm() == null) {
-                throw new BizException("可选课程不存在");
-            }
-            JSONObject courseForm = JSON.parseObject(musicGroup.getCourseForm());
-            for (String courseKey : registerPayDto.getCourseKeys()) {
-                if (courseForm.get(courseKey) == null) {
-                    throw new BizException("可选课程不存在");
+            if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
+                String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
+                if (!groupType.containsKey(kitGroupPurchaseType)) {
+                    throw new BizException("乐器提供方式不存在,请核查");
+                }
+                if (!kitGroupPurchaseType.equals("GROUP")) {
+                    goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
+                } else {
+                    remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
                 }
-                CourseFormDto courseFormDto = new CourseFormDto();
-                JSONObject jsonObject = JSON.parseObject(courseForm.getString(courseKey));
-                orderAmount = orderAmount.add(jsonObject.getBigDecimal("value"));
-                courseFormDto.setType(courseKey);
-                courseFormDto.setPrice(jsonObject.getBigDecimal("value"));
-                courseForms.add(courseFormDto);
+                goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
+                remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
             }
+            orderAmount = orderAmount.add(goodsGroup.getPrice());
+            goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
         }
+        orderAmount = orderAmount.subtract(remitFee);
 
         //新课程形态
         List<MusicGroupPaymentCalenderCourseSettings> newCourses = new ArrayList<>();
@@ -767,6 +693,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 orderAmount = orderAmount.add(calenderCourseSetting.getCourseCurrentPrice());
             }
         }
+        //乐器保养
+        if(registerPayDto.getBuyMaintenance()){
+            BigDecimal maintenancePrice = new BigDecimal(sysConfigDao.findConfigValue("maintenance_price"));
+            orderAmount = orderAmount.add(maintenancePrice);
+        }
 
         if (amount.compareTo(orderAmount) != 0) {
             throw new BizException("商品价格不符");
@@ -779,7 +710,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String channelType = "";
 
-        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, courseForms, remitFee, courseRemitFee, newCourses);
+        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, remitFee, courseRemitFee, newCourses,registerPayDto.getBuyMaintenance());
         studentPaymentOrder.setVersion(0);
 
         Date date = new Date();
@@ -867,9 +798,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //获取课程价格
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
         BigDecimal courseFee = musicOneSubjectClassPlan.getFee() == null ? BigDecimal.ZERO : musicOneSubjectClassPlan.getFee();
-        if (studentRegistration.getTemporaryCourseFee() != null) {
-            courseFee = studentRegistration.getTemporaryCourseFee();
-        }
         orderAmount = orderAmount.add(courseFee);
 
         BigDecimal remitFee = BigDecimal.ZERO;
@@ -879,100 +807,29 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
-        if (studentRegistration.getTemporaryCourseFee() != null) {
-            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
-            for (StudentPaymentOrderDetail orderDetail : orderDetails) {
-                if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
-                    continue;
-                }
-                MusicGroupSubjectGoodsGroup musicGroupSubjectGoodsGroup = new MusicGroupSubjectGoodsGroup();
-                GoodsType goodsType = orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL) ? GoodsType.INSTRUMENT : GoodsType.ACCESSORIES;
-                musicGroupSubjectGoodsGroup.setType(goodsType);
-                musicGroupSubjectGoodsGroup.setGoodsIdList(orderDetail.getGoodsIdList());
-                musicGroupSubjectGoodsGroup.setPrice(orderDetail.getPrice());
-                musicGroupSubjectGoodsGroup.setKitGroupPurchaseType(orderDetail.getKitGroupPurchaseType());
-                goodsGroups.add(musicGroupSubjectGoodsGroup);
-
-                orderAmount = orderAmount.add(orderDetail.getPrice());
-            }
-        } else if (StringUtils.isNoneBlank(registerPayDto.getGoodsGroupIds())) {
-            goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(registerPayDto.getGoodsGroupIds());
-            for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
-                    goodsGroup.setPrice(musicOneSubjectClassPlan.getDepositFee());
-                }
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.FREE)) {
-                    goodsGroup.setPrice(new BigDecimal(0));
-                }
-                orderAmount = orderAmount.add(goodsGroup.getPrice());
-
-                //团购乐器减免课程费用
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && goodsGroup.getRemissionCourseFee() != null && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.GROUP)) {//团购
-                    orderAmount = orderAmount.subtract(goodsGroup.getRemissionCourseFee());
-                    courseFee = courseFee.subtract(goodsGroup.getRemissionCourseFee());
-                }
-            }
-        } else if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
+        if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
             String goodsGroupIds = registerPayDto.getGoodsGroups().keySet().stream().map(Object::toString).collect(Collectors.joining(","));
             goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(goodsGroupIds);
-            for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
-                Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
-                });
-                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
-                    String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
-                    if (!groupType.containsKey(kitGroupPurchaseType)) {
-                        throw new BizException("乐器提供方式不存在,请核查");
-                    }
-                    if (!kitGroupPurchaseType.equals("GROUP")) {
-                        goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
-                    } else {
-                        remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
-                    }
-                    goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
-                    remitFee = groupType.get(kitGroupPurchaseType);
-                }
-                orderAmount = orderAmount.add(goodsGroup.getPrice());
-                goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
-            }
-            orderAmount = orderAmount.subtract(remitFee).subtract(courseRemitFee);
-        }
-
-        //单独辅件
-        List<Goods> goodsList = null;
-        if (registerPayDto.getGoodsIds() != null && !registerPayDto.getGoodsIds().equals("")) {
-            goodsList = goodsService.findGoodsByIds(registerPayDto.getGoodsIds());
-            for (Goods goods : goodsList) {
-                orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
-            }
         }
+        for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
+            Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
+            });
 
-        //单独教谱
-        List<Goods> otherGoodsList = null;
-        if (registerPayDto.getOtherGoodsIds() != null && !registerPayDto.getOtherGoodsIds().equals("")) {
-            otherGoodsList = goodsService.findGoodsByIds(registerPayDto.getOtherGoodsIds());
-            for (Goods goods : otherGoodsList) {
-                orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
-            }
-        }
-        //可选课程
-        List<CourseFormDto> courseForms = new ArrayList<>();
-        if (registerPayDto.getCourseKeys() != null && registerPayDto.getCourseKeys().size() > 0) {
-            MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
-            if (musicGroup.getCourseForm() == null) {
-                throw new BizException("可选课程不存在");
-            }
-            JSONObject courseForm = JSON.parseObject(musicGroup.getCourseForm());
-            for (String courseKey : registerPayDto.getCourseKeys()) {
-                if (courseForm.get(courseKey) == null) {
-                    throw new BizException("可选课程不存在");
+            if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
+                String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
+                if (!groupType.containsKey(kitGroupPurchaseType)) {
+                    throw new BizException("乐器提供方式不存在,请核查");
                 }
-                CourseFormDto courseFormDto = new CourseFormDto();
-                JSONObject jsonObject = JSON.parseObject(courseForm.getString(courseKey));
-                orderAmount = orderAmount.add(jsonObject.getBigDecimal("value"));
-                courseFormDto.setType(courseKey);
-                courseFormDto.setPrice(jsonObject.getBigDecimal("value"));
-                courseForms.add(courseFormDto);
+                if (!kitGroupPurchaseType.equals("GROUP")) {
+                    goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
+                } else {
+                    remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
+                }
+                goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
+                remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
             }
+            orderAmount = orderAmount.add(goodsGroup.getPrice());
+            goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
         }
 
         //新课程形态
@@ -988,6 +845,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             }
         }
 
+        if(registerPayDto.getBuyMaintenance()){
+            BigDecimal maintenancePrice = new BigDecimal(sysConfigDao.findConfigValue("maintenance_price"));
+            orderAmount = orderAmount.add(maintenancePrice);
+        }
+
         if (amount.compareTo(orderAmount) != 0) {
             throw new BizException("商品价格不符");
         }
@@ -1000,7 +862,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String channelType = "";
 
-        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder, courseForms, remitFee, courseRemitFee, newCourses);
+        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, studentRegistration.getMusicGroupId(), ApplyOrder, remitFee, courseRemitFee, newCourses,registerPayDto.getBuyMaintenance());
         studentPaymentOrder.setVersion(0);
         Date date = new Date();
 
@@ -1624,13 +1486,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("乐团找不到");
         }
 
-        if (musicGroup.getStatus() != MusicGroupStatusEnum.PAY) {
+        if (!(musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS)) {
             throw new BizException("乐团当前状态是[{}],不能延长缴费", musicGroup.getStatus().getMsg());
         }
 
         Date date = new Date();
 
-        if (expireDate.before(date)) {
+        if (DateUtil.getLastTimeWithDay(expireDate).before(date)) {
             throw new BizException("日期设置错误");
         }
 
@@ -1668,13 +1532,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("乐团找不到");
         }
 
-        if (!(musicGroup.getStatus() == MusicGroupStatusEnum.APPLY || musicGroup.getStatus() == MusicGroupStatusEnum.PAY)) {
+        if (!(musicGroup.getStatus() == MusicGroupStatusEnum.APPLY ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS)) {
             throw new BizException("乐团当前状态是[{}],不能延长报名", musicGroup.getStatus().getMsg());
         }
 
         Date date = new Date();
 
-        if (date.after(expireDate)) {
+        if (date.after(DateUtil.getLastTimeWithDay(expireDate))) {
             throw new BizException("日期设置错误");
         }
 
@@ -1702,7 +1569,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         Date date = new Date();
 
-        if (date.after(expireDate)) {
+        if (date.after(DateUtil.getLastTimeWithDay(expireDate))) {
             throw new BizException("日期设置错误");
         }
 
@@ -2525,6 +2392,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         List<MusicGroupPurchaseList> musicGroupPurchaseListCount = musicGroupPurchaseListDao.getCount(musicGroupIds);
         Map<String, Integer> purchaseListMap = musicGroupPurchaseListCount.stream().collect(Collectors.toMap(MusicGroupPurchaseList::getMusicGroupId, MusicGroupPurchaseList::getPurchaseNum));
 
+        Map<String, Boolean> viewRegButtonMap = studentRegistrationService.checkMusicGroupsRegOrPayStatus(new ArrayList<>(musicGroupIds));
         //获取分部名称map
         musicGroupList.forEach(e -> {
 //            e.setSchoolName(schoolNameMap.get(e.getSchoolId()));
@@ -2535,6 +2403,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             e.setPayNum(payNumMap.get(e.getId()) == null ? 0 : payNumMap.get(e.getId()));
             e.setChargeTypeName(chargeTypeNameMap.get(e.getChargeTypeId()));
             e.setHasVerifyMusicalList(purchaseListMap.get(e.getId()) != null);
+            if(e.getStatus().equals(MusicGroupStatusEnum.PREPARE) || e.getStatus().equals(MusicGroupStatusEnum.PROGRESS)){
+                if(viewRegButtonMap.containsKey(e.getId())){
+                    e.setIsRemedy(true);
+                }
+            }
         });
         return musicGroupPageInfo;
     }

+ 112 - 69
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -1,11 +1,17 @@
 package com.ym.mec.biz.service.impl;
 
 
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.biz.dal.dao.GoodsDao;
 import com.ym.mec.biz.dal.dao.StudentGoodsSellDao;
+import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
+import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
+import com.ym.mec.biz.dal.entity.StudentInstrument;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.service.StudentGoodsSellService;
 import com.ym.mec.common.dal.BaseDAO;
@@ -25,78 +31,115 @@ import java.util.Map;
 
 @Service
 public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, StudentGoodsSell> implements StudentGoodsSellService {
-	
-	@Autowired
-	private StudentGoodsSellDao studentGoodsSellDao;
-	@Autowired
-	private SysConfigDao sysConfigDao;
 
-	@Override
-	public BaseDAO<Integer, StudentGoodsSell> getDAO() {
-		return studentGoodsSellDao;
-	}
+    @Autowired
+    private StudentGoodsSellDao studentGoodsSellDao;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+    @Autowired
+    private GoodsDao goodsDao;
+    @Autowired
+    private StudentInstrumentDao studentInstrumentDao;
 
-	@Override
-	public PageInfo<StudentGoodsSellDto> queryStudentGoodsOrders(GoodsSellQueryInfo queryInfo) {
-		//根据订单状态和教务老师获取订单列表
-		PageInfo<StudentGoodsSellDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
-		Map<String, Object> params = new HashMap<>();
-		MapUtil.populateMap(params, queryInfo);
-		List<StudentGoodsSellDto> dataList = null;
-		int count = studentGoodsSellDao.countStudentGoodsOrders(params);
-		if (count > 0) {
-			pageInfo.setTotal(count);
-			params.put("offset", pageInfo.getOffset());
-			dataList = studentGoodsSellDao.queryStudentGoodsOrders(params);
-			Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
-			dataList.forEach(e->{
-				e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
-			});
-		}
-		if (count == 0) {
-			dataList = new ArrayList<>();
-		}
-		pageInfo.setRows(dataList);
-		return pageInfo;
-	}
+    @Override
+    public BaseDAO<Integer, StudentGoodsSell> getDAO() {
+        return studentGoodsSellDao;
+    }
 
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void affirmReceive(String orderNo) {
-		String str = "MANUAL_RECEIVE";
-		//如果订单编号为空,那么自动确认
-		if(StringUtils.isEmpty(orderNo)){
-			String autoAffirmReceiveTime = sysConfigDao.findConfigValue("auto_affirm_receive_time");
-			//获取到期的订单编号
-			orderNo = studentGoodsSellDao.queryNoAffirmOrderNo(autoAffirmReceiveTime);
-			str = "AUTO_RECEIVE";
-		}
-		if(StringUtils.isNotEmpty(orderNo)){
-			studentGoodsSellDao.autoAffirmReceive(orderNo,str);
-		}
-	}
+    @Override
+    public PageInfo<StudentGoodsSellDto> queryStudentGoodsOrders(GoodsSellQueryInfo queryInfo) {
+        //根据订单状态和教务老师获取订单列表
+        PageInfo<StudentGoodsSellDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        List<StudentGoodsSellDto> dataList = null;
+        int count = studentGoodsSellDao.countStudentGoodsOrders(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = studentGoodsSellDao.queryStudentGoodsOrders(params);
+            Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
+            dataList.forEach(e -> {
+                e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
+            });
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void affirmReceive(String orderNo) {
+        String str = "MANUAL_RECEIVE";
+        //如果订单编号为空,那么自动确认
+        if (StringUtils.isEmpty(orderNo)) {
+            String autoAffirmReceiveTime = sysConfigDao.findConfigValue("auto_affirm_receive_time");
+            //获取到期的订单编号
+            orderNo = studentGoodsSellDao.queryNoAffirmOrderNo(autoAffirmReceiveTime);
+            str = "AUTO_RECEIVE";
+        }
+        if (StringUtils.isNotEmpty(orderNo)) {
+            studentGoodsSellDao.autoAffirmReceive(orderNo, str);
+        }
+    }
+
+    @Override
+    public PageInfo<StudentPaymentOrderDto> queryStudentPaymentOrders(GoodsSellQueryInfo queryInfo) {
+        PageInfo<StudentPaymentOrderDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        List<StudentPaymentOrderDto> dataList = null;
+        int count = studentGoodsSellDao.countStudentPaymentOrders(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = studentGoodsSellDao.queryStudentPaymentOrders(params);
+            Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
+            dataList.forEach(e -> {
+                e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
+            });
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
+
+    @Override
+    public List<StudentInstrument> saveStudentInstrument(String orderNo) {
+        StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(orderNo);
+        List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(studentGoodsSell.getGoodsJson(), GoodsSellDto.class);
+        List<Integer> goodsIds = new ArrayList<>();
+        for (GoodsSellDto goodsSellDto : goodsSellDtos) {
+            if (!goodsSellDto.getGoodsType().equals("INSTRUMENT")) continue;
+            goodsIds.add(goodsSellDto.getGoodsId());
+        }
+        if (goodsIds.size() <= 0) {
+            return null;
+        }
+        List<Goods> goodies = goodsDao.getGoodiesAndCate(goodsIds);
+        List<StudentInstrument> studentInstruments = new ArrayList<>();
+        for (Goods goods : goodies) {
+            StudentInstrument studentInstrument = new StudentInstrument();
+            studentInstrument.setStudentId(studentGoodsSell.getUserId());
+            studentInstrument.setOrganId(studentGoodsSell.getOrganId());
+            studentInstrument.setGoodsId(goods.getId());
+            studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
+            studentInstrument.setGoodsCategoryName(goods.getGoodsCategoryName());
+            studentInstrument.setGoodsName(goods.getName());
+            studentInstrument.setGoodsBrand(goods.getBrand());
+            studentInstrument.setSpecification(goods.getSpecification());
+            studentInstrument.setGoodsImg(goods.getImage());
+            studentInstrument.setStatus(0);
+            studentInstruments.add(studentInstrument);
+        }
+        studentInstrumentDao.batchAdd(studentInstruments);
+        return studentInstruments;
+    }
 
-	@Override
-	public PageInfo<StudentPaymentOrderDto> queryStudentPaymentOrders(GoodsSellQueryInfo queryInfo) {
-		PageInfo<StudentPaymentOrderDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
-		Map<String, Object> params = new HashMap<>();
-		MapUtil.populateMap(params, queryInfo);
-		List<StudentPaymentOrderDto> dataList = null;
-		int count = studentGoodsSellDao.countStudentPaymentOrders(params);
-		if (count > 0) {
-			pageInfo.setTotal(count);
-			params.put("offset", pageInfo.getOffset());
-			dataList = studentGoodsSellDao.queryStudentPaymentOrders(params);
-			Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
-			dataList.forEach(e->{
-				e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
-			});
-		}
-		if (count == 0) {
-			dataList = new ArrayList<>();
-		}
-		pageInfo.setRows(dataList);
-		return pageInfo;
-	}
 
 }

+ 331 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java

@@ -0,0 +1,331 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dto.MaintenancePayDto;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.IdGeneratorService;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.util.date.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentInstrument> implements StudentInstrumentService {
+
+    @Autowired
+    private StudentInstrumentDao studentInstrumentDao;
+    @Autowired
+    private IdGeneratorService idGeneratorService;
+    @Autowired
+    private SysUserCashAccountService sysUserCashAccountService;
+    @Autowired
+    private PayService payService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+    @Autowired
+    private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired
+    private ContractService contractService;
+    @Autowired
+    private SysUserCashAccountDetailService sysUserCashAccountDetailService;
+    @Autowired
+    private SysMessageService sysMessageService;
+    @Autowired
+    private GoodsService goodsService;
+    @Autowired
+    private GoodsCategoryService goodsCategoryService;
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Override
+    public BaseDAO<Long, StudentInstrument> getDAO() {
+        return studentInstrumentDao;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Map pay(MaintenancePayDto maintenancePayDto) throws Exception {
+        StudentInstrument studentInstrument = studentInstrumentDao.get(maintenancePayDto.getId());
+        if (studentInstrument == null) {
+            throw new BizException("所选乐器不存在,请核查");
+        }
+        Integer userId = studentInstrument.getStudentId();
+        BigDecimal orderAmount = new BigDecimal(sysConfigDao.findConfigValue("maintenance_price"));
+        BigDecimal amount = maintenancePayDto.getAmount(); //扣除余额之前的金额
+        if (amount.compareTo(orderAmount) != 0) {
+            throw new BizException("商品价格不符");
+        }
+
+        String channelType = "";
+        Date date = new Date();
+
+        BigDecimal balance = BigDecimal.ZERO;
+        if (maintenancePayDto.getUseBalance() && amount.compareTo(BigDecimal.ZERO) > 0) {
+            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
+            if (userCashAccount == null) {
+                throw new BizException("用户账户找不到");
+            }
+            if (userCashAccount.getBalance() != null && userCashAccount.getBalance().compareTo(BigDecimal.ZERO) > 0) {
+                balance = amount.compareTo(userCashAccount.getBalance()) >= 0 ? userCashAccount.getBalance() : amount;
+                amount = amount.subtract(balance);
+                sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐保购买");
+            }
+        }
+
+        String orderNo = idGeneratorService.generatorId("payment") + "";
+        StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+
+        studentPaymentOrder.setPaymentChannel("BALANCE");
+        studentPaymentOrder.setUserId(userId);
+        studentPaymentOrder.setGroupType(GroupType.MAINTENANCE);
+        studentPaymentOrder.setOrderNo(orderNo);
+        studentPaymentOrder.setType(OrderTypeEnum.MAINTENANCE);
+        studentPaymentOrder.setExpectAmount(orderAmount);
+        studentPaymentOrder.setActualAmount(amount);
+        studentPaymentOrder.setBalancePaymentAmount(balance);
+        studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        studentPaymentOrder.setMusicGroupId(studentInstrument.getId().toString());
+        studentPaymentOrder.setRemitFee(BigDecimal.ZERO);
+        studentPaymentOrder.setCourseRemitFee(BigDecimal.ZERO);
+        studentPaymentOrder.setOrganId(studentInstrument.getOrganId());
+        studentPaymentOrder.setRoutingOrganId(studentInstrument.getOrganId());
+        studentPaymentOrder.setCreateTime(date);
+        studentPaymentOrder.setUpdateTime(date);
+        studentPaymentOrderService.insert(studentPaymentOrder);
+
+        StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
+        maintenanceOrderDetail.setType(OrderDetailTypeEnum.MAINTENANCE);
+        maintenanceOrderDetail.setPrice(orderAmount);
+        maintenanceOrderDetail.setRemitFee(BigDecimal.ZERO);
+        maintenanceOrderDetail.setCreateTime(date);
+        maintenanceOrderDetail.setUpdateTime(date);
+        maintenanceOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+        maintenanceOrderDetail.setStudentInstrumentId(maintenancePayDto.getId());
+        studentPaymentOrderDetailDao.insert(maintenanceOrderDetail);
+
+        studentPaymentOrder.setVersion(0);
+
+        if (amount.compareTo(BigDecimal.ZERO) == 0) {
+            studentPaymentRouteOrderService.addRouteOrder(orderNo, studentInstrument.getOrganId(), balance);
+            Map<String, String> notifyMap = new HashMap<>();
+            notifyMap.put("tradeState", "1");
+            notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
+            notifyMap.put("channelType", channelType);
+            notifyMap.put("orderNo", "");
+            studentPaymentOrderService.updateOrder(notifyMap);
+            return notifyMap;
+        }
+
+        String orderSubject = "乐保服务";
+        String receiver = "maintenance";
+
+        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+
+        Map payMap = payService.getPayMap(
+                amount,
+                balance,
+                orderNo,
+                baseApiUrl + "/api-student/studentOrder/notify",
+                baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
+                orderSubject,
+                orderSubject,
+                studentInstrument.getOrganId(),
+                receiver
+        );
+
+        studentPaymentOrder.setOrganId(studentInstrument.getOrganId());
+        studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
+        studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
+        studentPaymentOrder.setUpdateTime(date);
+        studentPaymentOrderService.update(studentPaymentOrder);
+        return payMap;
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean orderCallback(StudentPaymentOrder studentPaymentOrder) {
+        Date nowDate = new Date();
+        //更新订单信息
+        studentPaymentOrder.setUpdateTime(nowDate);
+        int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
+        if (updateCount <= 0) {
+            throw new BizException("订单更新失败");
+        }
+        //更新维修单信息
+        StudentInstrument studentInstrument = get(Long.parseLong(studentPaymentOrder.getMusicGroupId()));
+        if (studentInstrument == null) {
+            throw new BizException("乐保信息不存在");
+        }
+
+        Integer userId = studentPaymentOrder.getUserId();
+
+        Map<Integer, String> map = new HashMap<>();
+        map.put(userId, userId.toString());
+
+        //支付成功
+        if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
+            try {
+                contractService.transferProduceContract(userId, null);
+            } catch (Exception e) {
+                logger.error("产品协议生成失败", e);
+            }
+            Date startTime = nowDate;
+            Date endTime = DateUtil.addYears(nowDate, 1);
+            if (studentInstrument.getEndTime() != null &&
+                    studentInstrument.getEndTime().compareTo(nowDate) >= 0) {
+                startTime = studentInstrument.getStartTime();
+                endTime = DateUtil.addYears(studentInstrument.getEndTime(), 1);
+            }
+            studentInstrument.setStartTime(startTime);
+            studentInstrument.setEndTime(endTime);
+            studentInstrument.setStatus(1);
+            if (this.update(studentInstrument) <= 0) {
+                throw new BizException("乐保信息更新失败");
+            }
+
+            //插入交易明细
+            BigDecimal amount = studentPaymentOrder.getActualAmount();
+            if (amount.compareTo(BigDecimal.ZERO) > 0) {
+                SysUserCashAccount cashAccount = sysUserCashAccountService.get(userId);
+                //充值
+                SysUserCashAccountDetail rechargeDetail = new SysUserCashAccountDetail();
+                rechargeDetail.setAmount(amount);
+                rechargeDetail.setBalance(cashAccount.getBalance().add(amount));
+                rechargeDetail.setComment("缴费前充值");
+                rechargeDetail.setCreateTime(nowDate);
+                rechargeDetail.setStatus(DealStatusEnum.SUCCESS);
+                rechargeDetail.setTransNo(studentPaymentOrder.getTransNo());
+                rechargeDetail.setType(PlatformCashAccountDetailTypeEnum.RECHARGE);
+                rechargeDetail.setUpdateTime(nowDate);
+                rechargeDetail.setUserId(userId);
+                rechargeDetail.setChannel(studentPaymentOrder.getPaymentChannel());
+                rechargeDetail.setComAmount(studentPaymentOrder.getComAmount());
+                rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount());
+                sysUserCashAccountDetailService.insert(rechargeDetail);
+
+                //缴费
+                SysUserCashAccountDetail paymentDetail = new SysUserCashAccountDetail();
+                paymentDetail.setAmount(amount.negate());
+                paymentDetail.setBalance(cashAccount.getBalance());
+                paymentDetail.setComment("乐保购买");
+                paymentDetail.setCreateTime(nowDate);
+                paymentDetail.setStatus(DealStatusEnum.SUCCESS);
+                paymentDetail.setTransNo(studentPaymentOrder.getTransNo());
+                paymentDetail.setType(PlatformCashAccountDetailTypeEnum.PAY_FEE);
+                paymentDetail.setUpdateTime(nowDate);
+                paymentDetail.setUserId(userId);
+                rechargeDetail.setChannel(studentPaymentOrder.getPaymentChannel());
+                sysUserCashAccountDetailService.insert(paymentDetail);
+            }
+
+            return true;
+        }
+
+        if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
+
+            if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
+                sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "乐保购买支付失败");
+            }
+
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, "", "STUDENT",
+                    studentPaymentOrder.getActualAmount(), "乐保购买");
+            return false;
+        }
+        return false;
+    }
+
+    @Override
+    public StudentInstrument addStudentInstrument(StudentInstrument studentInstrument) {
+        Goods goods = goodsService.get(studentInstrument.getGoodsId());
+        GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
+        studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
+        studentInstrument.setGoodsCategoryName(goodsCategory.getName());
+        studentInstrument.setGoodsName(goods.getName());
+        studentInstrument.setGoodsBrand(goods.getBrand());
+        studentInstrument.setSpecification(goods.getSpecification());
+        studentInstrument.setGoodsImg(goods.getImage());
+        studentInstrumentDao.insert(studentInstrument);
+        return studentInstrument;
+    }
+
+    @Override
+    public Boolean addOrderDetail2Instrument(StudentPaymentOrder order) {
+        List<OrderDetailTypeEnum> orderDetailTypes = new ArrayList<>();
+        orderDetailTypes.add(OrderDetailTypeEnum.MAINTENANCE);
+        orderDetailTypes.add(OrderDetailTypeEnum.MUSICAL);
+        List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.getOrderDetailByType(order.getId(), orderDetailTypes);
+        List<StudentPaymentOrderDetail> orderDetails4Instruments = orderDetails.stream()
+                .filter(e -> e.getType().equals(OrderDetailTypeEnum.MUSICAL))
+                .filter(e -> KitGroupPurchaseTypeEnum.GROUP.equals(e.getKitGroupPurchaseType())).collect(Collectors.toList());
+        if (orderDetails4Instruments.size() <= 0) {
+            return false;
+        }
+        List<StudentPaymentOrderDetail> orderDetails4Maintenance = orderDetails.stream()
+                .filter(e -> e.getType().equals(OrderDetailTypeEnum.MAINTENANCE)).collect(Collectors.toList());
+
+        StudentPaymentOrderDetail maintenanceDetail = null;
+        int maintenanceStatus = 0;
+        Date startTime = null;
+        Date endTime = null;
+        if (orderDetails4Maintenance.size() > 0) {
+            maintenanceDetail = orderDetails4Maintenance.get(0);
+            maintenanceStatus = 1;
+            startTime = new Date();
+            endTime = DateUtil.addYears(startTime, 1);
+        }
+
+        Integer goodsId = Integer.valueOf(orderDetails4Instruments.get(0).getGoodsIdList());
+        StudentInstrument studentInstrument = new StudentInstrument();
+        studentInstrument.setStudentId(order.getUserId());
+        studentInstrument.setOrganId(order.getOrganId());
+        studentInstrument.setGoodsId(goodsId);
+        studentInstrument.setStatus(maintenanceStatus);
+        studentInstrument.setStartTime(startTime);
+        studentInstrument.setEndTime(endTime);
+        addStudentInstrument(studentInstrument);
+        if (maintenanceDetail != null) {
+            maintenanceDetail.setStudentInstrumentId(studentInstrument.getId());
+            studentPaymentOrderDetailDao.update(maintenanceDetail);
+        }
+        return true;
+    }
+
+    @Override
+    public Boolean pushNotice() {
+        Date endTime = DateUtil.addDays(DateUtil.getLastTimeWithDay(new Date()), -6);
+        Date startTime = DateUtil.trunc(endTime);
+        List<StudentInstrument> studentInstruments = studentInstrumentDao.getListByEndTime(startTime, endTime);
+        if (studentInstruments.size() <= 0) {
+            return false;
+        }
+        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+        String pushUrl = baseApiUrl + "#/leBao";
+        for (StudentInstrument studentInstrument : studentInstruments) {
+            Map<Integer, String> userMap = new HashMap<>();
+            userMap.put(studentInstrument.getStudentId(), studentInstrument.getStudentId().toString());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MAINTENANCE_NOTICE_PUSH,
+                    userMap, null, 0, "5?" + pushUrl, "STUDENT", studentInstrument.getGoodsName());
+        }
+        return true;
+    }
+}

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

@@ -17,6 +17,7 @@ import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.service.SysConfigService;
 
 import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.im.WebFeignService;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -109,6 +110,10 @@ public class StudentManageServiceImpl implements StudentManageService {
     private CourseScheduleDao courseScheduleDao;
     @Autowired
     private SysUserContractsDao sysUserContractsDao;
+    @Autowired
+    private WebFeignService webFeignService;
+    @Autowired
+    private StudentCourseHomeworkDao studentCourseHomeworkDao;
 
     @Override
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
@@ -662,6 +667,7 @@ public class StudentManageServiceImpl implements StudentManageService {
             LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
             studentExtracurricularExercisesSituationDao.deleteByStudent(student.getId(), monDayDate.toString());
         }
+        webFeignService.updateNickName(userId,student.getUsername(),"STUDENT");
         return userId;
     }
 
@@ -709,6 +715,7 @@ public class StudentManageServiceImpl implements StudentManageService {
             sum.put("truantNum", 0);
         }
         sum.put("homeworkNum", studentManageDao.countHomeworkNum(courseScheduleId));
+        sum.put("homeworkStudentNum", studentCourseHomeworkDao.countHomeworkStudentNumWithCourse(courseScheduleId.longValue()));
         sum.put("repliedNum", studentManageDao.countRepliedNum(courseScheduleId));
         return sum;
     }

+ 5 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -13,6 +13,7 @@ import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.service.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
@@ -35,16 +36,6 @@ import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
 import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
-import com.ym.mec.biz.service.DegreeRegistrationService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.PracticeGroupService;
-import com.ym.mec.biz.service.SporadicChargeInfoService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRegistrationService;
-import com.ym.mec.biz.service.StudentRepairService;
-import com.ym.mec.biz.service.SubjectChangeService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
-import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -95,6 +86,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     private SysConfigDao sysConfigDao;
     @Autowired
     private GoodsDao goodsDao;
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
 
     @Override
     public BaseDAO<Long, StudentPaymentOrder> getDAO() {
@@ -372,6 +365,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             subjectChangeService.orderCallback(order);
         } else if (order.getType().equals(OrderTypeEnum.DEGREE_REGISTRATION)) {
             degreeRegistrationService.updateStatus(order);
+        }else if (order.getType().equals(OrderTypeEnum.MAINTENANCE)) {
+            studentInstrumentService.orderCallback(order);
         }
     }
 

+ 35 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPreRegistrationServiceImpl.java

@@ -2,17 +2,21 @@ package com.ym.mec.biz.service.impl;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.ym.mec.biz.dal.dao.StudentPreRegistrationDao;
+import com.ym.mec.biz.dal.dto.PreRegisterSubjectDto;
 import com.ym.mec.biz.dal.dto.StudentPreRegistrationDto;
 import com.ym.mec.biz.dal.entity.StudentPreRegistration;
 import com.ym.mec.biz.service.StudentPreRegistrationService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.entity.Mapper;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
@@ -48,5 +52,36 @@ public class StudentPreRegistrationServiceImpl extends BaseServiceImpl<Long, Stu
 		pageInfo.setRows(dataList);
 		return pageInfo;
 	}
+
+	@Override
+	public List<PreRegisterSubjectDto> querySubjectNum(String musicGroupId) {
+		Set<String> subjectNames = new HashSet<String>();
+		Map<String, Integer> firstMap = new HashMap<String, Integer>();
+		Map<String, Integer> secondMap = new HashMap<String, Integer>();
+
+		List<Mapper> firstMapperList = studentPreRegistrationDao.queryFirstSubjectNum(musicGroupId);
+		for (Mapper mapper : firstMapperList) {
+			firstMap.put(String.valueOf(mapper.getKey()), Integer.parseInt(mapper.getValue().toString()));
+			subjectNames.add(String.valueOf(mapper.getKey()));
+		}
+
+		List<Mapper> secondMapperList = studentPreRegistrationDao.querySecondSubjectNum(musicGroupId);
+		for (Mapper mapper : secondMapperList) {
+			secondMap.put(String.valueOf(mapper.getKey()), Integer.parseInt(mapper.getValue().toString()));
+			subjectNames.add(String.valueOf(mapper.getKey()));
+		}
+
+		List<PreRegisterSubjectDto> list = new ArrayList<PreRegisterSubjectDto>();
+		for (String subjectName : subjectNames) {
+			PreRegisterSubjectDto dto = new PreRegisterSubjectDto();
+			dto.setSubjectName(subjectName);
+			dto.setFirstSubjectNum(firstMap.get(subjectName) == null ? 0 : firstMap.get(subjectName));
+			dto.setSecondSubjectNum(secondMap.get(subjectName) == null ? 0 : secondMap.get(subjectName));
+
+			list.add(dto);
+		}
+
+		return list;
+	}
 	
 }

+ 168 - 183
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -20,8 +20,13 @@ import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.event.source.GroupEventSource;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.im.WebFeignService;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -38,48 +43,13 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.GoodsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.StudentCourseFeeDetailDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.SubjectChangeDao;
-import com.ym.mec.biz.dal.dao.SubjectDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentCourseFeeDetail;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SubjectChange;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.dal.dto.CourseFormDto;
+import com.ym.mec.biz.dal.dto.StudentAddDto;
+import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
+import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
+import com.ym.mec.biz.dal.dto.StudentInfo;
+import com.ym.mec.biz.dal.dto.StudentMusicDetailDto;
+import com.ym.mec.biz.dal.dto.StudentMusicGroupDto;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
@@ -94,23 +64,6 @@ import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.ClassGroupStudentMapperService;
-import com.ym.mec.biz.service.ContractService;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
-import com.ym.mec.biz.service.ImGroupMemberService;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.SellOrderService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRegistrationService;
-import com.ym.mec.biz.service.SubjectService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
@@ -198,9 +151,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
     @Autowired
     private CourseScheduleDao courseScheduleDao;
-
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
     @Autowired
     private GroupEventSource groupEventSource;
+    @Autowired
+    private WebFeignService webFeignService;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -213,14 +169,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
 
-        List<StudentApplyDetailDto> dataList = null;
+        List<StudentApplyDetailDto> dataList =  new ArrayList<>();
         int count = studentRegistrationDao.queryStudentDetailCount(params);
         if (queryInfo.getIsExport() && count > 50000) {
             throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
         }
-        if (count > 0) {
-            pageInfo.setTotal(count);
-            params.put("offset", pageInfo.getOffset());
+        pageInfo.setTotal(count);
+        params.put("offset", pageInfo.getOffset());
+        if (queryInfo.getPage() <= pageInfo.getTotalPage()) {
             dataList = studentRegistrationDao.queryStudentDetailPage(params);
             Set<Integer> subjectIds = dataList.stream().map(e -> e.getActualSubjectId()).collect(Collectors.toSet());
             Map<Integer, String> subjectMap = MapUtil.convertIntegerMap(musicGroupSubjectPlanDao.findSubjectMap(subjectIds, queryInfo.getMusicGroupId()));
@@ -235,9 +191,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 }
             });
         }
-        if (count == 0) {
-            dataList = new ArrayList<>();
-        }
         pageInfo.setRows(dataList);
         return pageInfo;
     }
@@ -383,14 +336,15 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistration.setUpdateTime(date);
         studentRegistration.setUserId(sysUser.getId());
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
-        if(hasReg != null){
-            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+        if (hasReg != null) {
+            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
             studentRegistration.setId(hasReg.getId());
             studentRegistrationDao.update(studentRegistration);
-        }else {
+        } else {
             studentRegistrationDao.insert(studentRegistration);
         }
 
+        webFeignService.updateNickName(sysUser.getId(),studentRegistration.getName(),"STUDENT");
         // 增加报名学生数
         musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
         // 报名成功后,发送短信
@@ -414,7 +368,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, List<CourseFormDto> courseForms, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses) throws Exception {
+    public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel,
+                                        BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses, Boolean buyMaintenance) throws Exception {
         Date date = new Date();
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
         studentPaymentOrder.setUserId(studentRegistration.getUserId());
@@ -438,6 +393,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
         studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         //乐器及打包辅件
+        String maintenanceGoodsId = "";
         if (goodsGroups != null && goodsGroups.size() > 0) {
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
@@ -460,54 +416,17 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setPaymentOrderId(studentPaymentOrder.getId());
                 studentPaymentOrderDetail4goodsGroup.setKitGroupPurchaseType(goodsGroup.getKitGroupPurchaseType());
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goodsGroup);
+                if (OrderDetailTypeEnum.MUSICAL.equals(type) && KitGroupPurchaseTypeEnum.GROUP.equals(goodsGroup.getKitGroupPurchaseType())) {
+                    maintenanceGoodsId = goodsGroup.getGoodsIdList();
+                }
             }
         }
 
-        //单独辅件
-        if (goodsList != null && goodsList.size() > 0) {
-            for (Goods goods : goodsList) {
-                StudentPaymentOrderDetail studentPaymentOrderDetail4goods = new StudentPaymentOrderDetail();
-                OrderDetailTypeEnum orderDetailType = goods.getType().equals(GoodsType.INSTRUMENT) ? OrderDetailTypeEnum.MUSICAL : OrderDetailTypeEnum.ACCESSORIES;
-                studentPaymentOrderDetail4goods.setType(orderDetailType);
-                studentPaymentOrderDetail4goods.setPrice(goods.getGroupPurchasePrice());
-                studentPaymentOrderDetail4goods.setGoodsIdList(goods.getId().toString());
-                studentPaymentOrderDetail4goods.setCreateTime(date);
-                studentPaymentOrderDetail4goods.setUpdateTime(date);
-                studentPaymentOrderDetail4goods.setPaymentOrderId(studentPaymentOrder.getId());
-                studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goods);
-            }
-        }
-        //单独教谱
-        if (otherGoodsList != null && otherGoodsList.size() > 0) {
-            for (Goods goods : otherGoodsList) {
-                StudentPaymentOrderDetail studentPaymentOrderDetail4otherGoods = new StudentPaymentOrderDetail();
-                studentPaymentOrderDetail4otherGoods.setType(OrderDetailTypeEnum.TEACHING);
-                studentPaymentOrderDetail4otherGoods.setPrice(goods.getGroupPurchasePrice());
-                studentPaymentOrderDetail4otherGoods.setGoodsIdList(goods.getId().toString());
-                studentPaymentOrderDetail4otherGoods.setCreateTime(date);
-                studentPaymentOrderDetail4otherGoods.setUpdateTime(date);
-                studentPaymentOrderDetail4otherGoods.setPaymentOrderId(studentPaymentOrder.getId());
-                studentPaymentOrderDetailList.add(studentPaymentOrderDetail4otherGoods);
-            }
-        }
-        //可选课程
-        if (courseForms != null && courseForms.size() > 0) {
-            for (CourseFormDto courseForm : courseForms) {
-                StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
-                studentPaymentOrderDetailCourse.setType(OrderDetailTypeEnum.HIGH_ONLINE_COURSE);
-                studentPaymentOrderDetailCourse.setPrice(courseForm.getPrice());
-                studentPaymentOrderDetailCourse.setCreateTime(date);
-                studentPaymentOrderDetailCourse.setUpdateTime(date);
-                studentPaymentOrderDetailCourse.setPaymentOrderId(studentPaymentOrder.getId());
-                studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
-            }
-        }
         //新的课程形态
         if (newCourses != null && newCourses.size() > 0) {
             for (MusicGroupPaymentCalenderCourseSettings newCourse : newCourses) {
                 StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
                 studentPaymentOrderDetailCourse.setType(OrderDetailTypeEnum.valueOf(newCourse.getCourseType().getCode()));
-                studentPaymentOrderDetailCourse.setPrice(newCourse.getCourseCurrentPrice());
                 if (courseRemitFee.compareTo(BigDecimal.ZERO) > 0 && !newCourse.getIsStudentOptional()) {
                     studentPaymentOrderDetailCourse.setPrice(BigDecimal.ZERO);
                     studentPaymentOrderDetailCourse.setRemitFee(newCourse.getCourseCurrentPrice());
@@ -521,6 +440,20 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
             }
         }
+        if (buyMaintenance) {
+            if ("".equals(maintenanceGoodsId)) {
+                throw new BizException("团购乐器才能购买乐保,请核查");
+            }
+            BigDecimal maintenancePrice = new BigDecimal(sysConfigDao.findConfigValue("maintenance_price"));
+            StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
+            maintenanceOrderDetail.setType(OrderDetailTypeEnum.MAINTENANCE);
+            maintenanceOrderDetail.setPrice(maintenancePrice);
+            maintenanceOrderDetail.setRemitFee(BigDecimal.ZERO);
+            maintenanceOrderDetail.setCreateTime(date);
+            maintenanceOrderDetail.setUpdateTime(date);
+            maintenanceOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+            studentPaymentOrderDetailList.add(maintenanceOrderDetail);
+        }
         studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
 
         //增加缴费学生数
@@ -551,7 +484,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public StudentPaymentOrder reAddOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId, StudentPaymentOrder oldOrder, List<CourseFormDto> courseForms, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses) {
+    public StudentPaymentOrder reAddOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
+                                          List<MusicGroupSubjectGoodsGroup> goodsGroups, String musicGroupId, StudentPaymentOrder oldOrder,
+                                          BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses,
+                                          Boolean buyMaintenance
+    ) {
         //关闭老订单
         oldOrder.setStatus(DealStatusEnum.CLOSE);
         studentPaymentOrderService.update(oldOrder);
@@ -581,6 +518,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
         studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         //乐器及打包辅件
+        String maintenanceGoodsId = "";
         if (goodsGroups != null && goodsGroups.size() > 0) {
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
@@ -603,49 +541,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setPaymentOrderId(studentPaymentOrder.getId());
                 studentPaymentOrderDetail4goodsGroup.setKitGroupPurchaseType(goodsGroup.getKitGroupPurchaseType());
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goodsGroup);
+                if (OrderDetailTypeEnum.MUSICAL.equals(type) && KitGroupPurchaseTypeEnum.GROUP.equals(goodsGroup.getKitGroupPurchaseType())) {
+                    maintenanceGoodsId = goodsGroup.getGoodsIdList();
+                }
             }
         }
 
-        //单独辅件
-        if (goodsList != null && goodsList.size() > 0) {
-            for (Goods goods : goodsList) {
-                StudentPaymentOrderDetail studentPaymentOrderDetail4goods = new StudentPaymentOrderDetail();
-                OrderDetailTypeEnum orderDetailType = goods.getType().equals(GoodsType.INSTRUMENT) ? OrderDetailTypeEnum.MUSICAL : OrderDetailTypeEnum.ACCESSORIES;
-                studentPaymentOrderDetail4goods.setType(orderDetailType);
-                studentPaymentOrderDetail4goods.setPrice(goods.getGroupPurchasePrice());
-                studentPaymentOrderDetail4goods.setGoodsIdList(goods.getId().toString());
-                studentPaymentOrderDetail4goods.setCreateTime(date);
-                studentPaymentOrderDetail4goods.setUpdateTime(date);
-                studentPaymentOrderDetail4goods.setPaymentOrderId(studentPaymentOrder.getId());
-                studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goods);
-
-            }
-        }
-        //单独教谱
-        if (otherGoodsList != null && otherGoodsList.size() > 0) {
-            for (Goods goods : otherGoodsList) {
-                StudentPaymentOrderDetail studentPaymentOrderDetail4otherGoods = new StudentPaymentOrderDetail();
-                studentPaymentOrderDetail4otherGoods.setType(OrderDetailTypeEnum.TEACHING);
-                studentPaymentOrderDetail4otherGoods.setPrice(goods.getGroupPurchasePrice());
-                studentPaymentOrderDetail4otherGoods.setGoodsIdList(goods.getId().toString());
-                studentPaymentOrderDetail4otherGoods.setCreateTime(date);
-                studentPaymentOrderDetail4otherGoods.setUpdateTime(date);
-                studentPaymentOrderDetail4otherGoods.setPaymentOrderId(studentPaymentOrder.getId());
-                studentPaymentOrderDetailList.add(studentPaymentOrderDetail4otherGoods);
-            }
-        }
-        //可选课程
-        if (courseForms != null && courseForms.size() > 0) {
-            for (CourseFormDto courseForm : courseForms) {
-                StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
-                studentPaymentOrderDetailCourse.setType(OrderDetailTypeEnum.HIGH_ONLINE_COURSE);
-                studentPaymentOrderDetailCourse.setPrice(courseForm.getPrice());
-                studentPaymentOrderDetailCourse.setCreateTime(date);
-                studentPaymentOrderDetailCourse.setUpdateTime(date);
-                studentPaymentOrderDetailCourse.setPaymentOrderId(studentPaymentOrder.getId());
-                studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
-            }
-        }
         //新的课程形态
         if (newCourses != null && newCourses.size() > 0) {
             for (MusicGroupPaymentCalenderCourseSettings newCourse : newCourses) {
@@ -664,6 +565,20 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
             }
         }
+        if (buyMaintenance) {
+            if ("".equals(maintenanceGoodsId)) {
+                throw new BizException("团购乐器才能购买乐保,请核查");
+            }
+            BigDecimal maintenancePrice = new BigDecimal(sysConfigDao.findConfigValue("maintenance_price"));
+            StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
+            maintenanceOrderDetail.setType(OrderDetailTypeEnum.MAINTENANCE);
+            maintenanceOrderDetail.setPrice(maintenancePrice);
+            maintenanceOrderDetail.setRemitFee(BigDecimal.ZERO);
+            maintenanceOrderDetail.setCreateTime(date);
+            maintenanceOrderDetail.setUpdateTime(date);
+            maintenanceOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+            studentPaymentOrderDetailList.add(maintenanceOrderDetail);
+        }
         studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
 
         return studentPaymentOrder;
@@ -677,7 +592,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             return null;
         }
         SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
-        registration.setBalance(account==null?BigDecimal.ZERO : account.getBalance());
+        registration.setBalance(account == null ? BigDecimal.ZERO : account.getBalance());
         registration.setTransferStudent(0);
         return registration;
     }
@@ -726,12 +641,17 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
                 //添加用户现金账户
                 sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
-                //添加用户电子签章账户
-//                contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
                 ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), null));
                 sysUser.setImToken(register.getToken());
                 teacherDao.updateUser(sysUser);
             } else {
+                StudentRegistration oldReg = studentRegistrationDao.getByUserIdAndMusicGroupId(musicGroupId, sysUser.getId());
+                if (oldReg != null && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.APPLY) {
+                    throw new BizException("该学员已存在,原手机号为"+oldReg.getParentsPhone());
+                }
+                if(oldReg != null){
+                    phoneAndMusicGroupId = oldReg;
+                }
                 if (StringUtils.isNotEmpty(sysUser.getUsername())) {
                     if (!sysUser.getUsername().equals(studentRegistration.getName())) {
                         throw new BizException("操作失败:账户已被注册");
@@ -765,6 +685,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                         studentDao.update(student);
                     }
                 }
+                webFeignService.updateNickName(userId,sysUser.getUsername(),"STUDENT");
             }
             MusicGroupStudentFee studentFeeDaoByUser = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
             if (studentFeeDaoByUser != null) {
@@ -841,30 +762,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public void insertStudent(String studentIds,String oldMusicGroupId,String newMusicGroupId,Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect){
+    public void insertStudent(String studentIds, String oldMusicGroupId, String newMusicGroupId, Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect) {
         SysUser sysUser1 = sysUserFeignService.queryUserInfo();
         //获取旧乐团学员注册信息
-        List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds,oldMusicGroupId);
+        List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds, oldMusicGroupId);
         List<StudentCourseFeeDetail> studentCourseFeeDetails = new ArrayList<>();
         BigDecimal amount = BigDecimal.ZERO;
         for (StudentRegistration studentRegistration : studentRegistrations) {
             List<MusicGroupPaymentCalenderStudentDetail> details = collect.get(studentRegistration.getUserId());
-            BigDecimal masterTotalPrice = details.stream().map(e->e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
-            if(masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()){
+            BigDecimal masterTotalPrice = details.stream().map(e -> e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            if (masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()) {
                 throw new BizException("用户信息发生变动,请重新提交");
             }
-            if(oldMusicGroupId == newMusicGroupId){
+            if (oldMusicGroupId == newMusicGroupId) {
                 continue;
             }
-            courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId),null, GroupType.MUSIC);
+            courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId), null, GroupType.MUSIC);
             //记录课程余额消费日志
-            if(studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d){
+            if (studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d) {
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
-                if(studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()){
+                if (studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()) {
                     amount = masterTotalPrice;
                     studentCourseFeeDetail.setAmount(masterTotalPrice.negate());
                     studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().subtract(masterTotalPrice));
-                }else {
+                } else {
                     amount = studentRegistration.getSurplusCourseFee();
                     studentCourseFeeDetail.setAmount(studentRegistration.getSurplusCourseFee().negate());
                     studentCourseFeeDetail.setSurplusCourseFee(BigDecimal.ZERO);
@@ -881,7 +802,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //用户是否在主乐团
             StudentRegistration registration = studentRegistrationDao.getByPhoneAndMusicGroupId(newMusicGroupId, studentRegistration.getParentsPhone());
             if (registration != null) {
-                if(registration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL){
+                if (registration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL) {
                     orderFlag = false;
                 }
                 //修改剩余课程余额
@@ -891,7 +812,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 registration.setUpdateTime(date);
                 registration.setSurplusCourseFee(registration.getSurplusCourseFee().add(amount));
                 studentRegistrationDao.update(registration);
-            }else {
+            } else {
                 //生成学员乐团注册表
                 studentRegistration.setOrganId(musicGroupDao.get(newMusicGroupId).getOrganId());
                 studentRegistration.setSurplusCourseFee(amount);
@@ -902,11 +823,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 //增加报名学生数
                 musicGroupSubjectPlanService.addApplyStudentNum(newMusicGroupId, studentRegistration.getActualSubjectId(), 1);
                 //新增Fee表
-                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(),newMusicGroupId);
-                if(musicGroupStudentFee == null){
+                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), newMusicGroupId);
+                if (musicGroupStudentFee == null) {
                     musicGroupStudentFee = new MusicGroupStudentFee(newMusicGroupId,
-                            studentRegistration.getUserId(), studentRegistration.getSubjectId(),BigDecimal.ZERO,
-                            null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus()==YES?PAID_COMPLETED:NON_PAYMENT);
+                            studentRegistration.getUserId(), studentRegistration.getSubjectId(), BigDecimal.ZERO,
+                            null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus() == YES ? PAID_COMPLETED : NON_PAYMENT);
                     musicGroupStudentFeeDao.insert(musicGroupStudentFee);
                 }
             }
@@ -916,7 +837,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 waitPayOrder.setStatus(DealStatusEnum.CLOSE);
                 studentPaymentOrderService.update(waitPayOrder);
             }
-            if(orderFlag){
+            if (orderFlag) {
                 //生成订单
                 StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
                 studentPaymentOrder.setUserId(registration.getUserId());
@@ -933,7 +854,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderService.insert(studentPaymentOrder);
             }
             //主班新增余额日志
-            if(amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d){
+            if (amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d) {
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
                 studentCourseFeeDetail.setAmount(amount);
                 studentCourseFeeDetail.setSurplusCourseFee(registration.getSurplusCourseFee());
@@ -943,7 +864,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentCourseFeeDetails.add(studentCourseFeeDetail);
             }
         }
-        if(studentCourseFeeDetails.size() > 0){
+        if (studentCourseFeeDetails.size() > 0) {
             studentCourseFeeDetailDao.batchInsert(studentCourseFeeDetails);
         }
     }
@@ -1160,8 +1081,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder, musicGroup);
             }
 
+            //课程处理
             addCalenderDetail(studentPaymentOrder, studentRegistration);
 
+            //学生乐器与月保处理
+            studentInstrumentService.addOrderDetail2Instrument(studentPaymentOrder);
+
+            //合并学员处理
             if (studentRegistration.getIsMerge().equals(1) && studentPaymentOrder.getExpectAmount().compareTo(BigDecimal.ZERO) <= 0) {
                 return studentPaymentOrder;
             }
@@ -1435,7 +1361,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Override
     @Transactional
     public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
-        if(StringUtils.isBlank(studentRegistration.getCertificateType())){
+        if (StringUtils.isBlank(studentRegistration.getCertificateType())) {
             studentRegistration.setCertificateType(CertificateTypeEnum.IDENTITY.getCode());
         }
         StudentRegistration student = get(studentRegistration.getId());
@@ -1447,9 +1373,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         student.setIdCardNo(studentRegistration.getIdCardNo());
         student.setGender(studentRegistration.getGender());
         update(studentRegistration);
-        studentRegistrationDao.updateUser(student.getUserId(),student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(),studentRegistration.getCertificateType());
+        studentRegistrationDao.updateUser(student.getUserId(), student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(), studentRegistration.getCertificateType());
         // 添加用户电子签章账户
-        if(CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())){
+        if (CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())) {
             contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());
         }
         return student;
@@ -1637,10 +1563,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         return amount;
     }
 
-	@Override
-	public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
-		return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
-	}
+    @Override
+    public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
+        return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
+    }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -1661,8 +1587,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public Boolean batchDelRegs(String musicGroupId, List<Integer> userIds) {
         List<StudentRegistration> registrations = studentRegistrationDao.findStudentListByUserIdList(musicGroupId, userIds);
         for (StudentRegistration registration : registrations) {
-            if(registration.getPaymentStatus().equals(PaymentStatusEnum.OPEN)||registration.getPaymentStatus().equals(PaymentStatusEnum.YES)){
-                throw new BizException(registration.getName()+"("+registration.getPaymentStatus().getDesc()+"),不能删除");
+            if (registration.getPaymentStatus().equals(PaymentStatusEnum.OPEN) || registration.getPaymentStatus().equals(PaymentStatusEnum.YES)) {
+                throw new BizException(registration.getName() + "(" + registration.getPaymentStatus().getDesc() + "),不能删除");
             }
         }
         if (registrations.size() <= 0) {
@@ -1690,6 +1616,65 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Override
     public List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId) {
         courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), null, GroupType.MUSIC);
-        return this.findMusicGroupStudent(musicGroupId,null);
+        return this.findMusicGroupStudent(musicGroupId, null);
+    }
+
+    @Override
+    public String checkRegOrPayStatus(String musicGroupId) {
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS) {
+            Date now = new Date();
+            MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroup.getId());
+            if (regCalender != null && regCalender.getDeadlinePaymentDate() != null) {
+                musicGroup.setPaymentExpireDate(regCalender.getDeadlinePaymentDate());
+            }
+
+            if (musicGroup.getPaymentExpireDate() != null && now.compareTo(DateUtil.getLastTimeWithDay(musicGroup.getPaymentExpireDate())) > 0) {
+                return "乐团缴费时间已截止";
+            }
+        }
+        //储备中、进行中,乐团没有报名缴费项、有多批次缴费项不能缴费、有已上的课程不能缴费
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
+                musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS) {
+            MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroup.getId());
+            if (regCalender == null) {
+                return "乐团没有报名缴费项";
+            }
+            List<MusicGroupPaymentCalender> musicGroupCalenderBatchNoTimes = musicGroupPaymentCalenderDao.getMusicGroupCalenderBatchNoTimes(musicGroup.getId());
+            if (musicGroupCalenderBatchNoTimes.size() > 1) {
+                return "乐团已进入续费阶段";
+            }
+
+//            Integer hasStartCourseNum = courseScheduleDao.getMusicGroupHasStartCourseNum(musicGroup.getId());
+//            if (hasStartCourseNum != null && hasStartCourseNum > 0) {
+//                return "乐团已开课";
+//            }
+        }
+        return null;
+    }
+
+    @Override
+    public Map<String, Boolean> checkMusicGroupsRegOrPayStatus(List<String> ids) {
+        Map<String, Boolean> viewMap = new HashMap<>();
+        List<MusicGroupPaymentCalender> regCalenders = musicGroupPaymentCalenderDao.getMusicGroupRegCalenderByIds(ids);
+        for (MusicGroupPaymentCalender regCalender : regCalenders) {
+            viewMap.put(regCalender.getMusicGroupId(), true);
+        }
+
+        Map<String, List<MusicGroupPaymentCalender>> musicGroupBatchNoTimes = musicGroupPaymentCalenderDao.getMusicGroupCalenderBatchNoByIds(ids).stream().collect(Collectors.groupingBy(MusicGroupPaymentCalender::getMusicGroupId));
+        musicGroupBatchNoTimes.forEach((musicGroupId, calenders) -> {
+            if (viewMap.containsKey(musicGroupId) && calenders.size() > 1) {
+                viewMap.remove(musicGroupId);
+            }
+        });
+//        List<CourseSchedule> musicGroupsHasStartCourseNums = courseScheduleDao.getMusicGroupsHasStartCourseNum(ids);
+//        for (CourseSchedule musicGroupsHasStartCourseNum : musicGroupsHasStartCourseNums) {
+//            if(viewMap.containsKey(musicGroupsHasStartCourseNum.getMusicGroupId())){
+//                viewMap.remove(musicGroupsHasStartCourseNum.getMusicGroupId());
+//            }
+//        }
+        return viewMap;
     }
 }

+ 34 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -73,6 +73,10 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     private ContractService contractService;
     @Autowired
     private GoodsService goodsService;
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
+    @Autowired
+    private StudentGoodsSellService studentGoodsSellService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -383,10 +387,23 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         ) {
             throw new BizException("邮寄信息必填");
         }
+        Date date = new Date();
+        StudentInstrument studentInstrument = null;
+        if (repairInfo.getStudentInstrumentId() != null) {
+            studentInstrument = studentInstrumentService.get(repairInfo.getStudentInstrumentId());
+        }
+
+        if (repairInfo.getExemptionAmount().compareTo(BigDecimal.ZERO) > 0) {
+            if (studentInstrument == null || studentInstrument.getEndTime() == null || studentInstrument.getEndTime().compareTo(date) <= 0) {
+                throw new BizException("乐保不存在,不能使用特权减免,请核查");
+            }
+        }
+        if (studentInstrument != null && studentInstrument.getEndTime() != null && studentInstrument.getEndTime().compareTo(date) > 0) {
+            repairInfo.setMaintenanceStatus(1);
+        }
         SysUser student = sysUserFeignService.queryUserById(repairInfo.getStudentId());
         repairInfo.setOrganId(student.getOrganId());
 
-        Date date = new Date();
         BigDecimal amount = repairInfo.getAmount();
         String orderNo = idGeneratorService.generatorId("payment") + "";
         repairInfo.setTransNo(orderNo);
@@ -404,12 +421,6 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             });
             repairInfo.setGoodsJson(JSONObject.toJSONString(repairGoodsDtos));
         }
-        studentRepairDao.insert(repairInfo);
-        if (repairInfo.getType() == 1) {
-            Map<String, Object> repairInfoMap = new HashMap<>();
-            MapUtil.populateMap(repairInfoMap, repairInfo);
-            return repairInfoMap;
-        }
 
         if (StringUtils.isNoneBlank(repairInfo.getGoodsJson())) {
             JSONArray goods = JSON.parseArray(repairInfo.getGoodsJson());
@@ -421,6 +432,17 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 }
             }
         }
+        amount = amount.subtract(repairInfo.getExemptionAmount());
+        if (amount.compareTo(BigDecimal.ZERO) < 0) {
+            throw new BizException("特权减免金额不能大于总金额");
+        }
+
+        studentRepairDao.insert(repairInfo);
+        if (repairInfo.getType() == 1) {
+            Map<String, Object> repairInfoMap = new HashMap<>();
+            MapUtil.populateMap(repairInfoMap, repairInfo);
+            return repairInfoMap;
+        }
 
         repairInfo.setPayStatus(1);
         String channelType = "";
@@ -473,12 +495,6 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
 
-        Map<String, BigDecimal> classFee = new HashMap<>();
-        classFee.put("course", BigDecimal.ZERO);
-        classFee.put("instrument", BigDecimal.ZERO);
-        classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", amount);
-
         Map payMap = payService.getPayMap(
                 amount,
                 balance,
@@ -571,6 +587,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             BigDecimal reduce = repairGoodsDtos.stream().map(e -> e.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
             amount = amount.add(reduce);
         }
+        amount = amount.subtract(studentRepair.getExemptionAmount());
+
         String orderNo = idGeneratorService.generatorId("payment") + "";
         studentRepair.setIsUseBalancePayment(repairInfo.getIsUseBalancePayment());
         studentRepair.setTransNo(orderNo);
@@ -717,6 +735,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             paymentDetail.setType(PlatformCashAccountDetailTypeEnum.GOODS_SELL);
             paymentDetail.setUserId(userId);
             sysUserCashAccountDetailService.insert(paymentDetail);
+            //将购买的乐器加入学生乐器列表
+            studentGoodsSellService.saveStudentInstrument(studentPaymentOrder.getOrderNo());
+            //购买的商品加入销售列表
             saveSellOrder(studentPaymentOrder.getOrderNo());
         } else if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -15,6 +15,7 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -298,12 +299,30 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 //						}
 //					}
 					courseHomework.setExpectNum(studentCourseHomeworks.size());
+
+					Teacher teacher = teacherDao.get(courseSchedule.getActualTeacherId());
+					String dateStr = DateUtil.dateToString(DateUtil.addDays(date, 3), "MM月dd日");
+
 					if(!CollectionUtils.isEmpty(studentCourseHomeworks)){
 						courseHomeworkService.update(courseHomework);
 
 						studentCourseHomeworkDao.batchInsertStudentCourseHomeworkRecord(studentCourseHomeworks);
 						List<Integer> studentIds = studentCourseHomeworks.stream().map(StudentCourseHomework::getUserId).collect(Collectors.toList());
 						studentServeService.updateExercisesSituation(courseSchedule.getClassDate(), studentIds, teacherAttendance.getTeacherId());
+
+						for (StudentCourseHomework studentCourseHomework : studentCourseHomeworks) {
+							Map<Integer, String> userMap = new HashMap<>();
+							userMap.put(studentCourseHomework.getUserId(), studentCourseHomework.getUserId().toString());
+							String notifyUrl = "?courseScheduleID=" + courseSchedule.getId() + "&studentCourseHomeworkId=" + studentCourseHomework.getId() + "&extra=0";
+							String extra = "dayaedu" + notifyUrl + "&userId=" + studentCourseHomework.getUserId();
+
+							sysMessageService.batchSendImMessage(MessageTypeEnum.IM_HOMEWORK_REMIND, courseSchedule.getActualTeacherId().toString(), extra,
+									new String[]{studentCourseHomework.getUserId().toString()},
+									null, courseSchedule.getName(), dateStr, courseHomework.getContent());
+
+							sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.HOMEWORK_REMIND,
+									userMap, null, 0, 3 + notifyUrl, "STUDENT", teacher.getRealName(), courseSchedule.getName(), dateStr);
+						}
 					}
 				}else{
 					courseHomework.setContent(teacherSignOutDto.getCourseHomeworkInfo().getContent());

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

@@ -21,6 +21,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
+import com.ym.mec.im.WebFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.idcard.IdcardValidator;
@@ -69,6 +70,8 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 	@Autowired
 	private ImFeignService imFeignService;
 	@Autowired
+	private WebFeignService webFeignService;
+	@Autowired
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
 	@Autowired
 	private StudentDao studentDao;
@@ -110,6 +113,11 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 			}
 			return id;
 		}
+		if(Objects.nonNull(teacher.getEntryDate())&&Objects.nonNull(teacher.getFormalStaffDate())){
+			if(teacher.getEntryDate().compareTo(teacher.getFormalStaffDate())>0){
+				throw new BizException("入职日期不可晚于转正日期");
+			}
+		}
 		teacher.setUserType("TEACHER");
 		teacher.setUsername(teacher.getRealName());
 		teacherDao.addSysUser(teacher);
@@ -139,12 +147,18 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 				throw new BizException("手机号已存在");
 			}
 		}
+		if(Objects.nonNull(teacher.getEntryDate())&&Objects.nonNull(teacher.getFormalStaffDate())){
+			if(teacher.getEntryDate().compareTo(teacher.getFormalStaffDate())>0){
+				throw new BizException("入职日期不可晚于转正日期");
+			}
+		}
 		teacher.setUpdateTime(new Date());
 		teacher.setTeacherOrganId(teacher.getOrganId());
 		teacherDao.update(teacher);
 		teacher.setOrganId(null);
 		teacherDao.updateUser(teacher);
-		imFeignService.update(new ImUserModel(teacher.getId().toString(),teacher.getRealName(),teacher.getAvatar()));
+		webFeignService.updateNickName(teacher.getId(),teacher.getRealName(),"TEACHER");
+//		imFeignService.update(new ImUserModel(teacher.getId().toString(),teacher.getRealName(),teacher.getAvatar()));
 	}
 
 	@Override
@@ -654,7 +668,6 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 		teacher.setIdcardHandImg(idcardHandImg);
 		teacher.setUpdateTime(date);
 		teacherDao.update(teacher);
-
 		return true;
 	}
 

+ 25 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -48,6 +48,7 @@ import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Service
 public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> implements VipGroupService {
@@ -259,6 +260,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
+		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getAttribute3())&&StringUtils.isNotBlank(vipGroupActivity.getAttribute3())){
+			Integer maxCourseNum = Integer.parseInt(vipGroupActivity.getAttribute3());
+			Integer requestCourseNum = vipGroupApplyBaseInfoDto.getOnlineClassesNum() + vipGroupApplyBaseInfoDto.getOfflineClassesNum();
+			if(requestCourseNum.compareTo(maxCourseNum)!=0){
+				throw new BizException("该活动课时数为{}节", maxCourseNum);
+			}
+		}
+
 		int repeatVipGroups = vipGroupDao.countUserRepeatVipGroupInCourseStartEndTime(vipGroupApplyBaseInfoDto.getUserId(), firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
 		if(repeatVipGroups>0){
 			throw new BizException("请勿重复提交");
@@ -796,6 +805,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Map<String, Object> params = new HashMap<String, Object>();
 		MapUtil.populateMap(params, queryInfo);
 
+		List<String> organIds = new ArrayList<>();
+		if(StringUtils.isNotBlank(queryInfo.getOrganId())){
+			organIds = Arrays.stream(queryInfo.getOrganId().split(",")).collect(Collectors.toList());
+		}
+		params.put("organIds", organIds);
+
 		List<VipGroupStudentDto> dataList = null;
 		int count = vipGroupDao.countHaveCourseBalanceStudentNum(params);
 		if (count > 0) {
@@ -3188,15 +3203,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if (vipGroupList != null && vipGroupList.size() > 0) {
 			Date date = new Date();
 			for (VipGroup vipGroup : vipGroupList) {
+				if(Objects.nonNull(vipGroup.getCoursesExpireDate())&&(vipGroup.getCoursesExpireDate().compareTo(date)>0||DateUtil.isSameDay(vipGroup.getCoursesExpireDate(), date))){
+					continue;
+				}
 				vipGroup.setStatus(VipGroupStatusEnum.FINISHED);
 				vipGroup.setUpdateTime(date);
 			}
 			vipGroupDao.batchUpdate(vipGroupList);
-			Set<Long> collect = vipGroupList.stream().map(e -> e.getId()).collect(Collectors.toSet());
-			Set<Integer> classGroupIds = classGroupDao.queryClassGroupIds(collect);
-			//解散群
-			for (Integer classGroupId : classGroupIds) {
-				imGroupService.cancel(classGroupId.longValue());
+			Set<Long> collect = vipGroupList.stream().filter(v->VipGroupStatusEnum.FINISHED.equals(v.getStatus())).map(e -> e.getId()).collect(Collectors.toSet());
+			if(!CollectionUtils.isEmpty(collect)){
+				Set<Integer> classGroupIds = classGroupDao.queryClassGroupIds(collect);
+				//解散群
+				for (Integer classGroupId : classGroupIds) {
+					imGroupService.cancel(classGroupId.longValue());
+				}
 			}
 		}
 		List<VipGroup> normalVipGroupList = vipGroupDao.queryNormalStatusList();

+ 46 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -2954,10 +2954,38 @@
         FROM course_schedule cs
         WHERE cs.group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
           AND cs.music_group_id_ = #{groupId}
+            AND cs.del_flag_ = 0
         ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_)
         LIMIT 1
     </select>
 
+    <select id="findLastCourseWithGroup" resultMap="CourseSchedule">
+        SELECT cs.id_,
+               cs.group_type_,
+               cs.music_group_id_,
+               cs.class_group_id_,
+               cs.status_,
+               cs.subsidy_,
+               cs.class_date_,
+               CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
+               CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
+               cs.teacher_id_,
+               cs.actual_teacher_id_,
+               cs.create_time_,
+               cs.update_time_,
+               cs.teach_mode_,
+               cs.type_,
+               cs.name_,
+               cs.student_num_,
+               cs.leave_student_num_,
+               cs.schoole_id_
+        FROM course_schedule cs
+        WHERE cs.group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND cs.music_group_id_ = #{groupId}
+        ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) DESC
+        LIMIT 1
+    </select>
+
     <select id="findClassGroupLastTeacher" resultMap="CourseSchedule">
         SELECT *
         FROM course_schedule
@@ -3651,5 +3679,23 @@
         </foreach>
     </select>
 
+    <select id="getMusicGroupHasStartCourseNum" resultType="integer">
+        SELECT COUNT(*) FROM course_schedule
+        WHERE music_group_id_ = #{musicGroupId}
+        AND group_type_='MUSIC'
+        AND status_ IN ('UNDERWAY','OVER')
+    </select>
+
+    <select id="getMusicGroupsHasStartCourseNum" resultMap="CourseSchedule">
+        SELECT music_group_id_, COUNT(*) student_num_ FROM course_schedule
+        WHERE music_group_id_ IN
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+        AND group_type_='MUSIC'
+        AND status_ IN ('UNDERWAY','OVER')
+        GROUP BY music_group_id_
+    </select>
+
 
 </mapper>

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

@@ -270,7 +270,7 @@
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-		DELETE FROM goods WHERE id_ = #{id} 
+		DELETE FROM goods WHERE id_ = #{id}
 	</delete>
 
     <!-- 分页查询 -->
@@ -413,4 +413,19 @@
     <select id="findByIdAndStatus" resultType="java.lang.Boolean">
         SELECT COUNT(0) FROM goods WHERE status_ = #{status} AND id_ = #{goodsId}
     </select>
+
+    <select id="getGoodsInfo" resultMap="Goods">
+        SELECT g.*,gc.name_ goods_category_name_ FROM goods g
+        LEFT JOIN goods_category gc on g.goods_category_id_ = gc.id_
+        WHERE g.id_=#{id}
+    </select>
+
+    <select id="getGoodiesAndCate" resultMap="Goods">
+        SELECT g.*,gc.name_ goods_category_name_ FROM goods g
+        LEFT JOIN goods_category gc on g.goods_category_id_ = gc.id_
+        WHERE g.id_ IN
+        <foreach collection="goodsIds" item="goodsId" open="(" close=")" separator=",">
+            #{goodsId}
+        </foreach>
+    </select>
 </mapper>

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

@@ -92,8 +92,12 @@
 		</if>
 		</set> WHERE id_ = #{id} 
 	</update>
-	
-	<!-- 根据主键删除一条记录 -->
+    <update id="updateNickname">
+		UPDATE im_group_member SET nickname_ = #{nickName} WHERE user_id_ = #{userId};
+		UPDATE im_user_friend SET friend_nickname_ = #{nickName} WHERE friend_id_ = #{userId};
+	</update>
+
+    <!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
 		DELETE FROM im_group WHERE id_ = #{id} 
 	</delete>

+ 26 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -576,4 +576,30 @@
             #{calenderId}
         </foreach>
     </select>
+
+    <select id="getMusicGroupCalenderBatchNoTimes" resultMap="MusicGroupPaymentCalender">
+        SELECT batch_no_, COUNT(*) expect_num_ FROM music_group_payment_calender
+        WHERE music_group_id_ = #{musicGroupId}
+        AND status_ IN ('AUDITING','NO', 'OPEN', 'OVER', 'PAID')
+        GROUP BY batch_no_
+    </select>
+
+    <select id="getMusicGroupRegCalenderByIds" resultMap="MusicGroupPaymentCalender">
+        SELECT * FROM music_group_payment_calender WHERE music_group_id_ IN
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+        AND payment_type_='MUSIC_APPLY' AND batch_no_ IS NOT NULL
+    </select>
+
+    <select id="getMusicGroupCalenderBatchNoByIds" resultMap="MusicGroupPaymentCalender">
+        SELECT music_group_id_,batch_no_, COUNT(*) expect_num_ FROM music_group_payment_calender
+        WHERE music_group_id_ IN
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+        AND status_ IN ('AUDITING','NO', 'OPEN', 'OVER', 'PAID')
+        AND batch_no_ IS NOT NULL
+        GROUP BY music_group_id_,batch_no_
+    </select>
 </mapper>

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

@@ -15,6 +15,7 @@
         <result column="user_id_" property="userId"/>
         <result column="username_" property="username"/>
         <result column="avatar_" property="avatar"/>
+        <result column="teacher_avatar_" property="teacherAvatar"/>
         <result column="subject_name_" property="subjectName"/>
         <result column="phone_" property="phone"/>
         <result column="teacher_id_" property="teacherId"/>
@@ -494,7 +495,7 @@
     <select id="findStudentAttendance" resultMap="StudentAttendance">
         SELECT cssp.id_,cssp.course_schedule_id_,cssp.user_id_,cssp.group_type_,cssp.music_group_id_,sa.sign_in_time_,sa.sign_out_time_,
                CASE WHEN sa.status_ IS NULL THEN 'TRUANT' ELSE sa.status_ END status_,
-        su.username_,su.phone_,su.avatar_,cs.teach_mode_,cs.type_ course_type_,o.name_ organ_name_,tu.real_name_ teacher_name_,tu.avatar_,
+        su.username_,su.phone_,su.avatar_,cs.teach_mode_,cs.type_ course_type_,o.name_ organ_name_,tu.real_name_ teacher_name_,tu.avatar_ teacher_avatar_,
         cs.name_ course_schedule_name_,cs.status_ course_status_,
         cs.actual_teacher_id_ teacher_id_,cs.class_date_ ,cs.start_class_time_,cs.end_class_time_ ,cs.new_course_id_,
         CASE WHEN sa.visit_flag_ IS NULL THEN 0 ELSE sa.visit_flag_ END visitFlag
@@ -510,7 +511,7 @@
     </select>
     <sql id="findStudentAttendanceSql">
         <where>
-            cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
+            cs.del_flag_ = 0
             <if test="visitFlag != null">
                 <if test="visitFlag == 1">
                     AND sa.visit_flag_ = 1

+ 8 - 7
mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml

@@ -76,7 +76,7 @@
     </insert>
 
     <insert id="batchInsertStudentCourseHomeworkRecord" parameterType="java.util.List" useGeneratedKeys="true"
-            keyColumn="id_">
+            keyColumn="id" keyProperty="id">
         INSERT INTO student_course_homework
         (user_id_,course_schedule_id_,course_homework_id_,attachments_,score_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_)
         VALUE
@@ -289,7 +289,7 @@
     </select>
     <select id="countStudentCourseHomeworks" resultType="java.lang.Integer">
         SELECT COUNT(id_)
-        FROM course_schedule_student_payment
+        FROM student_course_homework
         WHERE course_schedule_id_ = #{search}
     </select>
     <resultMap id="StudentCourseHomeworkDtoMap" type="com.ym.mec.biz.dal.dto.StudentCourseHomeworkDto">
@@ -302,17 +302,18 @@
         <result column="is_replied_" property="isReplied"/>
         <result column="is_view_" property="isView"/>
         <result column="update_time_" property="createTime"/>
+        <result column="submit_time_" property="submitTime"/>
     </resultMap>
     <select id="findStudentCourseHomeworks" resultMap="StudentCourseHomeworkDtoMap">
         SELECT sch.id_ student_course_homework_id_,sch.attachments_,sch.is_replied_,sch.is_view_,
-        sch.update_time_,cssp.user_id_,su.username_,su.phone_,s.name_ subject_name_
-        FROM course_schedule_student_payment cssp
-        LEFT JOIN student_course_homework sch ON sch.course_schedule_id_ = cssp.course_schedule_id_ AND cssp.user_id_ =
-        sch.user_id_ AND sch.status_ = 1
+        sch.update_time_,cssp.user_id_,su.username_,su.phone_,sch.submit_time_,s.name_ subject_name_
+        FROM student_course_homework sch
+        LEFT JOIN course_schedule_student_payment cssp ON sch.course_schedule_id_ = cssp.course_schedule_id_ AND cssp.user_id_ =
+        sch.user_id_
         LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
         LEFT JOIN student_registration sr ON cssp.music_group_id_ = sr.music_group_id_ AND cssp.user_id_ = sr.user_id_
         LEFT JOIN `subject` s ON s.id_ = sr.actual_subject_id_
-        WHERE cssp.course_schedule_id_ = #{search}
+        WHERE sch.course_schedule_id_ = #{search}
         ORDER BY sch.id_ DESC
         <include refid="global.limit"/>
     </select>

+ 165 - 0
mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml

@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ym.mec.biz.dal.dao.StudentInstrumentDao">
+    <resultMap id="StudentInstrument" type="com.ym.mec.biz.dal.entity.StudentInstrument">
+        <!--@mbg.generated-->
+        <!--@Table student_instrument-->
+        <id column="id_" property="id"/>
+        <result column="student_id_" property="studentId"/>
+        <result column="organ_id_" property="organId"/>
+        <result column="goods_id_" property="goodsId"/>
+        <result column="goods_category_id_" property="goodsCategoryId"/>
+        <result column="goods_category_name_" property="goodsCategoryName"/>
+        <result column="status_" property="status"/>
+        <result column="start_time_" property="startTime"/>
+        <result column="end_time_" property="endTime"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="goods_name_" property="goodsName"/>
+        <result column="specification_" property="specification"/>
+        <result column="goods_brand_" property="goodsBrand"/>
+        <result column="goods_img_" property="goodsImg"/>
+    </resultMap>
+
+    <select id="get" parameterType="java.lang.Long" resultMap="StudentInstrument">
+        <!--@mbg.generated-->
+        SELECT * FROM student_instrument
+        where id_ = #{id}
+    </select>
+    <delete id="delete" parameterType="java.lang.Long">
+        <!--@mbg.generated-->
+        delete from student_instrument
+        where id_ = #{id}
+    </delete>
+
+    <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument"
+            useGeneratedKeys="true">
+        <!--@mbg.generated-->
+        insert into student_instrument
+        (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
+        status_, start_time_, end_time_, create_time_, update_time
+        )
+        values
+        (#{studentId},#{organId},#{goodsId},#{goodsCategoryId},#{goodsCategoryName},#{goodsName},#{goodsBrand},#{specification},#{goodsImg},
+        #{status}, #{startTime}, #{endTime}, NOW(), NOW()
+        )
+    </insert>
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument">
+        <!--@mbg.generated-->
+        update student_instrument
+        <set>
+            <if test="studentId != null">
+                student_id_ = #{studentId},
+            </if>
+            <if test="organId != null">
+                organ_id_ = #{organId},
+            </if>
+            <if test="goodsId != null">
+                goods_id_ = #{goodsId},
+            </if>
+            <if test="goodsName != null">
+                goods_name_ = #{goodsName},
+            </if>
+            <if test="goodsBrand != null">
+                goods_brand_ = #{goodsBrand},
+            </if>
+            <if test="specification != null">
+                specification_ = #{specification},
+            </if>
+            <if test="goodsImg != null">
+                goods_img_ = #{goodsImg},
+            </if>
+            <if test="status != null">
+                status_ = #{status},
+            </if>
+            <if test="startTime != null">
+                start_time_ = #{startTime},
+            </if>
+            <if test="endTime != null">
+                end_time_ = #{endTime},
+            </if>
+            <if test="createTime != null">
+                create_time_ = #{createTime},
+            </if>
+            <if test="updateTime != null">
+                update_time = #{updateTime},
+            </if>
+        </set>
+        where id_ = #{id}
+    </update>
+
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="StudentInstrument">
+        SELECT *
+        FROM student
+    </select>
+
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="StudentInstrument" parameterType="map">
+        SELECT si.*,su.username_ studentName,su.phone_ phone,o.name_ organName FROM student_instrument si
+        LEFT JOIN sys_user su ON su.id_ = si.student_id_
+        LEFT JOIN organization o ON o.id_ = si.organ_id_
+        <include refid="queryPageSql"/>
+        <include refid="global.limit"/>
+    </select>
+
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*)
+        FROM student_instrument si
+        LEFT JOIN sys_user su ON su.id_ = si.student_id_
+        <include refid="queryPageSql"/>
+    </select>
+
+    <sql id="queryPageSql">
+        <where>
+            <if test="studentId != null">
+                AND si.student_id_ = #{studentId}
+            </if>
+            <if test="organId != null">
+                AND FIND_IN_SET(si.organ_id_,#{organId})
+            </if>
+            <if test="goodsId != null">
+                AND si.goods_id_ = #{goodsId}
+            </if>
+            <if test="goodsCategoryId != null">
+                AND si.goods_category_id_ = #{goodsCategoryId}
+            </if>
+            <if test="goodsBrand != null">
+                AND si.goods_brand_ LIKE CONCAT('%',#{goodsBrand},'%')
+            </if>
+            <if test="specification != null">
+                AND si.specification_ LIKE CONCAT('%',#{specification},'%')
+            </if>
+            <if test="search != null">
+                AND (si.student_id_ = #{search} OR su.phone_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%'))
+            </if>
+        </where>
+    </sql>
+
+    <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+        insert into student_instrument
+        (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
+        status_, start_time_, end_time_, create_time_, update_time)
+        VALUE
+        <foreach collection="studentInstruments" item="item" separator=",">
+            (#{item.studentId},#{item.organId},#{item.goodsId},#{item.goodsCategoryId},#{item.goodsCategoryName},#{item.goodsName},#{item.goodsBrand},#{item.specification},#{item.goodsImg},
+            #{item.status}, #{item.startTime},
+            #{item.endTime}, NOW(), NOW())
+        </foreach>
+    </insert>
+
+    <update id="batchUpdate">
+   <![CDATA[
+        UPDATE student_instrument
+        SET status_ = 0
+        WHERE end_time_ <= NOW()
+        ]]>
+    </update>
+    <select id="getListByEndTime" resultMap="StudentInstrument">
+        <![CDATA[
+        SELECT * FROM student_instrument WHERE end_time_ >= #{startTime} AND end_time_ <= #{endTime}
+     ]]>
+    </select>
+
+</mapper>

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

@@ -78,6 +78,9 @@
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
+            <if test="studentInstrumentId != null">
+                student_instrument_id_ = #{studentInstrumentId},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>

+ 19 - 0
mec-biz/src/main/resources/config/mybatis/StudentPreRegistrationMapper.xml

@@ -29,6 +29,11 @@
 		<result column="is_registered_" property="isRegistered" />
 	</resultMap>
 	
+	<resultMap type="com.ym.mec.common.entity.Mapper" id="Mapper">
+		<result column="key_" property="key" />
+		<result column="value_" property="value" />
+	</resultMap>
+	
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="StudentPreRegistration" >
 		SELECT * FROM student_pre_registration WHERE id_ = #{id} 
@@ -147,6 +152,20 @@
 		</where>
 	</select>
 	
+	<select id="queryFirstSubjectNum" resultMap="Mapper">
+		SELECT ifnull(s.name_,'听从老师安排') key_,COUNT(spr.id_) value_ FROM student_pre_registration spr 
+		left join subject s on s.id_ = spr.subject_first_
+		where spr.music_group_id_ = #{musicGroupId}
+		group by spr.subject_first_
+	</select>
+	
+	<select id="querySecondSubjectNum" resultMap="Mapper">
+		SELECT ifnull(s.name_,'听从老师安排') key_,COUNT(spr.id_) value_ FROM student_pre_registration spr  
+		left join subject s on s.id_ = spr.subject_second_
+		where spr.music_group_id_ = #{musicGroupId}
+		group by spr.subject_second_
+	</select>
+	
 	<select id="queryByMusicGroupIdAndUserId" resultMap="StudentPreRegistration" parameterType="map">
 		SELECT * FROM student_pre_registration WHERE user_id_ = #{userId} and music_group_id_ = #{musicGroupId}
 	</select>

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -832,4 +832,9 @@
             #{id}
         </foreach>
     </delete>
+
+    <!-- 根据乐团编号和手机号查询注册乐团注册信息-->
+    <select id="getByUserIdAndMusicGroupId" resultMap="StudentRegistration">
+        SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND user_id_ = #{userId}
+    </select>
 </mapper>

+ 20 - 9
mec-biz/src/main/resources/config/mybatis/StudentRepairMapper.xml

@@ -4,6 +4,11 @@
     <resultMap id="StudentRepair" type="com.ym.mec.biz.dal.entity.StudentRepair">
         <result column="id_" jdbcType="INTEGER" property="id"/>
         <result column="music_group_id_" jdbcType="VARCHAR" property="musicGroupId"/>
+        <result column="student_instrument_id_" property="studentInstrumentId"/>
+        <result column="maintenance_status_" property="maintenanceStatus"/>
+        <result column="repair_name_" property="repairName"/>
+        <result column="repair_img_" property="repairImg"/>
+        <result column="exemption_amount_" property="exemptionAmount"/>
         <result column="trans_no_" jdbcType="VARCHAR" property="transNo"/>
         <result column="trans_no_" jdbcType="VARCHAR" property="transNo"/>
         <result column="organ_id_" jdbcType="INTEGER" property="organId"/>
@@ -44,15 +49,12 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentRepair" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         <!--@mbg.generated-->
-        insert into student_repair (id_,music_group_id_, trans_no_, organ_id_,
-        student_id_, student_name_, student_school_,
-        employee_id_, employee_name_, subject_id_,
-        subject_name_, type_, instrument_no_,fee_list_,
-        description_, amount_, finish_time_,
-        send_type_, contact_name_, contact_mobile_,
-        address_, pay_status_, create_time_,
-        update_time_,repair_status_,goods_json_)
-        values (#{id,jdbcType=INTEGER},#{musicGroupId}, #{transNo,jdbcType=VARCHAR}, #{organId,jdbcType=INTEGER},
+        insert into student_repair (id_,music_group_id_, trans_no_,student_instrument_id_,maintenance_status_,repair_name_,
+        repair_img_,exemption_amount_,organ_id_,student_id_, student_name_,student_school_,employee_id_, employee_name_,
+        subject_id_,subject_name_, type_, instrument_no_,fee_list_,description_, amount_, finish_time_,send_type_,
+        contact_name_, contact_mobile_,address_,pay_status_, create_time_,update_time_,repair_status_,goods_json_)
+        values (#{id,jdbcType=INTEGER},#{musicGroupId}, #{transNo,jdbcType=VARCHAR}, #{studentInstrumentId},
+        #{maintenanceStatus},#{repairName},#{repairImg},#{exemptionAmount},#{organId,jdbcType=INTEGER},
         #{studentId,jdbcType=INTEGER}, #{studentName,jdbcType=VARCHAR}, #{studentSchool,jdbcType=VARCHAR},
         #{employeeId,jdbcType=INTEGER}, #{employeeName,jdbcType=VARCHAR}, #{subjectId,jdbcType=INTEGER},
         #{subjectName,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{instrumentNo,jdbcType=VARCHAR},
@@ -204,6 +206,15 @@
             <if test="endTime != null">
                 AND sr.create_time_ &lt;= #{endTime}
             </if>
+            <if test="studentInstrumentId != null">
+                AND sr.student_instrument_id_ = #{studentInstrumentId}
+            </if>
+            <if test="hasExemptionAmount != null and hasExemptionAmount ==1">
+                AND sr.exemption_amount_ > #{exemptionAmount}
+            </if>
+            <if test="hasExemptionAmount != null and hasExemptionAmount ==0">
+                AND sr.exemption_amount_ = 0
+            </if>
         </where>
     </sql>
     <select id="queryCount" resultType="int">

+ 3 - 8
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -217,6 +217,7 @@
         <result column="start_class_time_" property="startClassTime"/>
         <result column="class_date_" property="classDate"/>
         <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="course_status_" property="courseStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="name_" property="name"/>
         <result column="sign_in_status_" property="signInStatus"/>
         <result column="sign_out_status_" property="signOutStatus"/>
@@ -280,7 +281,7 @@
     </sql>
     <sql id="queryTeacherAttendancesCondition">
         <where>
-            cs.del_flag_ = 0 AND cs.status_ = 'OVER' AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
+            cs.del_flag_ = 0
             <if test="search != null and search != ''">
                 AND (su.id_ = #{search} OR su.real_name_ LIKE CONCAT('%',#{search},'%') OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%'))
             </if>
@@ -317,18 +318,12 @@
             <if test="jobNature != null">
                 AND t.job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
-            <if test="attendanceStatus == 'ERR_ATTENDANCE'">
-                AND (ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0) AND (ta.sign_in_time_ IS NOT NULL OR ta.sign_out_time_ IS NOT NULL) AND ta.dispose_content_ IS NULL
-            </if>
-            <if test="attendanceStatus == 'NO_ATTENDANCE'">
-                AND ta.sign_out_time_ IS NULL AND ta.sign_in_time_ IS NULL AND ta.dispose_content_ IS NULL
-            </if>
         </where>
     </sql>
 
     <select id="getTeacherPersonalAttendances" parameterType="map" resultMap="teacherPersonalAttendance">
         SELECT
-            cs.class_date_,cs.start_class_time_,cs.name_,cs.type_,
+            cs.class_date_,cs.start_class_time_,cs.name_,cs.type_,cs.status_ course_status_,
             IF(ta.sign_in_status_ IS NULL,3,ta.sign_in_status_) sign_in_status_,
             IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
             ta.remark_,cs.id_,cs.end_class_time_

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

@@ -572,6 +572,12 @@
         <if test="search!=null and search!=''">
             AND (su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
         </if>
+        <if test="organIds!=null and organIds.size()>0">
+            AND su.organ_id_ IN
+            <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+                #{organId}
+            </foreach>
+        </if>
         ORDER BY suca.course_balance_ DESC
         <include refid="global.limit"/>
     </select>
@@ -588,6 +594,12 @@
         <if test="search!=null and search!=''">
             AND (su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
         </if>
+        <if test="organIds!=null and organIds.size()>0">
+            AND su.organ_id_ IN
+            <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+                #{organId}
+            </foreach>
+        </if>
     </select>
 
     <select id="countVipGroupStudents" resultType="int">

+ 3 - 0
mec-client-api/src/main/java/com/ym/mec/im/WebFeignService.java

@@ -18,4 +18,7 @@ public interface WebFeignService {
 	
 	@RequestMapping(value = "api/isPurchasedPracticeCourse")
 	Boolean isPurchasedPracticeCourse(@RequestParam("userId") Integer userId);
+
+	@RequestMapping(value = "api/updateNickName")
+	int updateNickName(@RequestParam("userId") Integer userId,@RequestParam("nickName") String nickName,@RequestParam("userType") String userType);
 }

+ 6 - 0
mec-client-api/src/main/java/com/ym/mec/im/fallback/WebFeignServiceFallback.java

@@ -3,6 +3,7 @@ package com.ym.mec.im.fallback;
 import org.springframework.stereotype.Component;
 
 import com.ym.mec.im.WebFeignService;
+import org.springframework.web.bind.annotation.RequestParam;
 
 @Component
 public class WebFeignServiceFallback implements WebFeignService {
@@ -21,4 +22,9 @@ public class WebFeignServiceFallback implements WebFeignService {
 	public Boolean isPurchasedPracticeCourse(Integer userId) {
 		return false;
 	}
+
+	@Override
+	public int updateNickName(Integer userId, String nickName,String userType) {
+		return 0;
+	}
 }

+ 4 - 0
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -159,4 +159,8 @@ public interface TaskRemoteService {
 	 */
 	@GetMapping("task/closeStudentServiceTag")
     void closeStudentServiceTag();
+
+	//乐保到期提醒
+	@GetMapping("task/maintenanceNotice")
+	void maintenanceNotice();
 }

+ 5 - 0
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -200,4 +200,9 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 	public void closeStudentServiceTag() {
 		logger.info("学员服务指标关闭失败");
 	}
+
+    @Override
+    public void maintenanceNotice() {
+		logger.info("乐保到期提醒推送失败");
+    }
 }

+ 0 - 2
mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java

@@ -71,8 +71,6 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
 			String substring = servletPath.substring(servletPath.lastIndexOf("/") + 1).toLowerCase();
 			if(ignoreLogUrl == null){
 				ignoreLogUrl = new ArrayList<>();
-				ignoreLogUrl.add("add");
-				ignoreLogUrl.add("insert");
 				ignoreLogUrl.add("query");
 				ignoreLogUrl.add("get");
 				ignoreLogUrl.add("find");

+ 24 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/entity/Mapper.java

@@ -0,0 +1,24 @@
+package com.ym.mec.common.entity;
+
+public class Mapper {
+
+	private Object key;
+
+	private Object value;
+
+	public Object getKey() {
+		return key;
+	}
+
+	public void setKey(Object key) {
+		this.key = key;
+	}
+
+	public Object getValue() {
+		return value;
+	}
+
+	public void setValue(Object value) {
+		this.value = value;
+	}
+}

+ 5 - 3
mec-im/src/main/java/com/ym/controller/RoomController.java

@@ -55,6 +55,7 @@ public class RoomController{
 
     @RequestMapping(value = "/sendImPlayMidiMessage", method = RequestMethod.POST)
     public Object sendImPlayMidiMessage(@RequestBody PlayMidiMessageData playMidiMessageData) throws Exception {
+        log.info("sendImPlayMidiMessage: {}",JSONObject.toJSON(playMidiMessageData));
         roomService.sendImPlayMidiMessage(playMidiMessageData);
         return new BaseResponse<>();
     }
@@ -172,16 +173,17 @@ public class RoomController{
         return new BaseResponse<>(roomService.controlDevice(data));
     }
 
-    @ApiOperation(value = "学员麦克风、摄像头等开关批量控制")
     @RequestMapping(value = "/device/batchControl", method = RequestMethod.POST)
     public Object batchControlDevice(@RequestBody ReqDeviceControlData data)throws Exception {
-        log.info("batchControl: {}",JSONObject.toJSON(data));
-        return new BaseResponse<>(roomService.batchControlDevice(data));
+        log.info("batchControlDevice: {}",JSONObject.toJSON(data));
+        boolean result = roomService.batchControlDevice(data);
+        return new BaseResponse<>(result);
     }
 
     @ApiOperation(value = "学员伴奏下载状态回调")
     @RequestMapping(value = "adjustExamSong", method = RequestMethod.POST)
     public Object adjustExamSong(@RequestBody ExamSongData examSongData) throws Exception {
+        log.info("adjustExamSong: {}",JSONObject.toJSON(examSongData));
         roomService.adjustExamSong(examSongData.getRoomId(),examSongData.getStatus(),examSongData.getExamSongId());
         return new BaseResponse<>();
     }

+ 4 - 15
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -311,20 +311,14 @@ public class RoomServiceImpl implements RoomService {
             roomMember = saveRoomMember(roomId,userId);
         }
         String joinSuccessKey = "joinRoomSuccess"+ roomId + userId;
-        if(redisTemplate.hasKey(joinSuccessKey)){
-            //兼容旧版本,防止重复调用
-            redisTemplate.delete(joinSuccessKey);
+        Boolean aBoolean = redisTemplate.opsForValue().setIfAbsent(joinSuccessKey, roomId, 2l, TimeUnit.SECONDS);
+        if(!aBoolean){
             RoleEnum roleEnum = RoleEnum.getEnumByValue(roomMember.getRole());
             if(roleEnum == RoleTeacher && StringUtils.isNotEmpty(deviceNum)){
                 signInSuccess(roomMember,deviceNum);
             }
             return;
         }
-        String leaveSuccessKey = "leaveRoomSuccess"+ roomId + userId;
-        if(redisTemplate.hasKey(leaveSuccessKey)){
-            redisTemplate.delete(leaveSuccessKey);
-        }
-        redisTemplate.opsForValue().setIfAbsent(joinSuccessKey,roomId,2l,TimeUnit.SECONDS);
 
         RoleEnum roleEnum = RoleEnum.getEnumByValue(roomMember.getRole());
         CourseSchedule schedule = courseScheduleDao.getLock(Long.parseLong(roomId.substring(1)));
@@ -458,8 +452,8 @@ public class RoomServiceImpl implements RoomService {
         }
 
         String leaveSuccessKey = "leaveRoomSuccess"+ roomId + userId;
-        if(redisTemplate.hasKey(leaveSuccessKey)){
-            redisTemplate.delete(leaveSuccessKey);
+        Boolean aBoolean = redisTemplate.opsForValue().setIfAbsent(leaveSuccessKey, roomId, 2, TimeUnit.SECONDS);
+        if(!aBoolean){
             if (StringUtils.isNotEmpty(deviceNum)){
                 //如果设备号不为空,更新设备号
                 if(roleEnum == RoleTeacher){
@@ -468,11 +462,6 @@ public class RoomServiceImpl implements RoomService {
             }
             return;
         }
-        String joinSuccessKey = "joinRoomSuccess"+ roomId + userId;
-        if(redisTemplate.hasKey(joinSuccessKey)){
-            redisTemplate.delete(joinSuccessKey);
-        }
-        redisTemplate.opsForValue().setIfAbsent(leaveSuccessKey,roomId,2,TimeUnit.SECONDS);
 
         String username;
         SysUser sysUser = sysUserFeignService.queryUserById(parseInt);

+ 14 - 1
mec-student/src/main/java/com/ym/mec/student/controller/ImGroupController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.biz.dal.dto.ImUserFriendDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -76,7 +77,19 @@ public class ImGroupController extends BaseController {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
 
-		return succeed(imUserFriendService.queryFriendDetail(sysUser.getId(), userId));
+		ImUserFriendDto dto = imUserFriendService.queryFriendDetail(sysUser.getId(), userId);
+		if (dto == null) {
+			dto = new ImUserFriendDto();
+			SysUser user = sysUserFeignService.queryUserById(userId);
+			dto.setFriend(user);
+			if (user.getUserType().contains("STUDENT")) {
+				dto.setFriendNickname(user.getUsername());
+			} else {
+				dto.setFriendNickname(user.getRealName());
+			}
+			dto.setFriendId(userId);
+		}
+		return succeed(dto);
 	}
 
 	@ApiOperation("查询好友列表")

+ 43 - 35
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -69,26 +70,28 @@ public class MusicGroupController extends BaseController {
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
     @Autowired
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-    
+
     @Autowired
     private StudentPreRegistrationDao studentPreRegistrationDao;
-    
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
+
     @ApiOperation("预报名")
     @PostMapping(value = "/preRegister")
-	public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
-		return musicGroupService.preRegister(studentPreRegistration) ? succeed() : failed();
-	}
-    
+    public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
+        return musicGroupService.preRegister(studentPreRegistration) ? succeed() : failed();
+    }
+
     @ApiOperation("预报名信息查询")
     @GetMapping(value = "/queryPreRegister")
-	public Object queryPreRegister(String musicGroupId) {
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		if (sysUser == null) {
-			return failed(HttpStatus.FORBIDDEN, "请登录");
-		}
+    public Object queryPreRegister(String musicGroupId) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
 
-		return succeed(studentPreRegistrationDao.queryByMusicGroupIdAndUserId(sysUser.getId(), musicGroupId));
-	}
+        return succeed(studentPreRegistrationDao.queryByMusicGroupIdAndUserId(sysUser.getId(), musicGroupId));
+    }
 
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryUserMusicGroups")
@@ -99,7 +102,7 @@ public class MusicGroupController extends BaseController {
         }
         return succeed(musicGroupService.queryUserMusicGroups(sysUser.getId()));
     }
-    
+
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryStudentMusicGroupInfo")
     public Object queryStudentMusicGroupInfo() {
@@ -168,31 +171,26 @@ public class MusicGroupController extends BaseController {
             return failed(HttpStatus.CONTINUE, "乐团报名信息不存在");
         }
         if (studentRegistration.getPaymentStatus() != null && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES) {
-            return failed(HttpStatus.PROCESSING,"您已缴费,请等待乐团开启");
+            return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
         }
 
         if (studentRegistration.getPaymentStatus() != PaymentStatusEnum.OPEN) {
             return failed("乐团还未开启缴费,请等待通知");
         }
-        if (studentRegistration.getTemporaryCourseFee() == null) {
-            if (musicGroup.getStatus() != MusicGroupStatusEnum.APPLY && musicGroup.getStatus() != MusicGroupStatusEnum.PAY) {
-                return failed("乐团在" + musicGroup.getStatus().getMsg() + ",不能缴费");
-            }
-
-            if (musicGroup.getStatus() == MusicGroupStatusEnum.PAY) {
-                Date now = new Date();
-                MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
-                if (regCalender != null && regCalender.getDeadlinePaymentDate() != null) {
-                    musicGroup.setPaymentExpireDate(regCalender.getDeadlinePaymentDate());
-                }
-                if (musicGroup.getPaymentExpireDate() != null && DateUtil.daysBetween(musicGroup.getPaymentExpireDate(), now) > 1) {
-                    return failed("乐团缴费时间已截止");
-                }
-            }
+        if (musicGroup.getStatus() != MusicGroupStatusEnum.APPLY &&
+                musicGroup.getStatus() != MusicGroupStatusEnum.PAY &&
+                musicGroup.getStatus() != MusicGroupStatusEnum.PREPARE &&
+                musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS
+        ) {
+            return failed("乐团在" + musicGroup.getStatus().getMsg() + ",不能缴费");
+        }
+        String err = studentRegistrationService.checkRegOrPayStatus(musicGroupId);
+        if(err != null){
+            return failed(err+"不能缴费");
         }
         studentRegistration.setOwnershipType(musicGroup.getOwnershipType());
         studentRegistration.setChargeTypeId(musicGroup.getChargeTypeId());
-        if(sysUser != null){
+        if (sysUser != null) {
             studentRegistration.setGender(sysUser.getGender());
         }
 
@@ -246,7 +244,7 @@ public class MusicGroupController extends BaseController {
     @ApiOperation(value = "申请退团")
     @PostMapping("/quitMusicGroup")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String"),
-    	@ApiImplicitParam(name = "reason", value = "原因", required = true, dataType = "String")})
+            @ApiImplicitParam(name = "reason", value = "原因", required = true, dataType = "String")})
     public HttpResponseResult quitMusicGroup(String musicGroupId, String reason) throws Exception {
         return succeed(musicGroupService.applyQuitMusicGroup(musicGroupId, reason));
     }
@@ -254,11 +252,11 @@ public class MusicGroupController extends BaseController {
     @ApiOperation(value = "取消退团申请")
     @PostMapping("/cancelQuitMusicGroup")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String"),
-    	@ApiImplicitParam(name = "reason", value = "取消原因", required = true, dataType = "String")})
+            @ApiImplicitParam(name = "reason", value = "取消原因", required = true, dataType = "String")})
     public HttpResponseResult cancelQuitMusicGroup(String musicGroupId, String reason) throws Exception {
-    	SysUser sysUser = sysUserFeignService.queryUserInfo();
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
         Integer userId = sysUser.getId();
-        
+
         return succeed(musicGroupService.cancelQuitMusicGroup(userId, musicGroupId, reason));
     }
 
@@ -288,6 +286,11 @@ public class MusicGroupController extends BaseController {
             return failed("报名信息有误,请核查");
         }
 
+        String err = studentRegistrationService.checkRegOrPayStatus(studentRegistration.getMusicGroupId());
+        if(err !=null){
+            return failed(err+"不可缴费,请联系教务老师");
+        }
+
         Integer userId = studentRegistration.getUserId();
 
         StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
@@ -315,6 +318,11 @@ public class MusicGroupController extends BaseController {
         if (studentRegistration == null) {
             return failed("报名信息有误,请核查");
         }
+
+        String err = studentRegistrationService.checkRegOrPayStatus(studentRegistration.getMusicGroupId());
+        if(err !=null){
+            return failed(err+"不可缴费,请联系教务老师");
+        }
         Integer userId = studentRegistration.getUserId();
         StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
         StudentPaymentOrder waitPay = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);

+ 24 - 3
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -2,7 +2,11 @@ package com.ym.mec.student.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
@@ -26,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.util.Date;
+import java.util.List;
 
 @RequestMapping("register")
 @Api(tags = "乐团注册")
@@ -40,6 +45,12 @@ public class MusicGroupRegisterController extends BaseController {
     private MusicGroupService musicGroupService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
 
 
     @ApiOperation(value = "新增学生报名信息")
@@ -57,7 +68,7 @@ public class MusicGroupRegisterController extends BaseController {
             return failed("乐团信息不存在");
         }
 
-        if (DateUtil.daysBetween(musicGroup.getApplyExpireDate(), date) > 1 && studentRegistration.getId() == null) {
+        if (date.compareTo(DateUtil.getLastTimeWithDay(musicGroup.getApplyExpireDate())) > 0 && studentRegistration.getId() == null) {
             return failed("乐团已截止报名");
         }
 
@@ -65,12 +76,22 @@ public class MusicGroupRegisterController extends BaseController {
             return succeed(studentRegistrationService.updateStudent(studentRegistration));
         }
 
-        StudentRegistration hasReg = studentRegistrationService.getByPhoneAndMusicGroupId(studentRegistration.getMusicGroupId(), studentRegistration.getParentsPhone());
+        StudentRegistration hasReg = studentRegistrationDao.getByUserIdAndMusicGroupId(studentRegistration.getMusicGroupId(),sysUser.getId());
         if (hasReg != null && hasReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT) {
             return succeed(hasReg);
         }
+        if (hasReg != null && hasReg.getMusicGroupStatus() == StudentMusicGroupStatusEnum.QUIT) {
+            return failed( "无法重复报名,请联系教务老师");
+        }
+        String err = studentRegistrationService.checkRegOrPayStatus(musicGroup.getId());
+        if (err != null) {
+            return failed(err + "不可报名,请联系教务老师");
+        }
 
-        if (musicGroup.getStatus().equals(MusicGroupStatusEnum.PAY)) {
+        if (musicGroup.getStatus().equals(MusicGroupStatusEnum.PAY) ||
+                musicGroup.getStatus().equals(MusicGroupStatusEnum.PREPARE) ||
+                musicGroup.getStatus().equals(MusicGroupStatusEnum.PROGRESS)
+        ) {
             studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
         } else {
             studentRegistration.setPaymentStatus(PaymentStatusEnum.NO);

+ 56 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentInstrumentController.java

@@ -0,0 +1,56 @@
+package com.ym.mec.student.controller;
+
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
+import com.ym.mec.biz.dal.dto.MaintenancePayDto;
+import com.ym.mec.biz.dal.dto.RegisterPayDto;
+import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.biz.dal.page.DegreeQueryInfo;
+import com.ym.mec.biz.dal.page.StudentInstrumentQueryInfo;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.biz.service.StudentInstrumentService;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+
+@RequestMapping("studentInstrument")
+@Api(tags = "乐器与乐保服务")
+@RestController
+public class StudentInstrumentController extends BaseController {
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private StudentInstrumentDao studentInstrumentDao;
+
+    @ApiOperation(value = "获取乐器与乐保列表")
+    @GetMapping("/getList")
+    public HttpResponseResult<PageInfo<StudentInstrument>> getList(StudentInstrumentQueryInfo queryInfo) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || user.getId() == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        queryInfo.setStudentId(user.getId());
+        studentInstrumentDao.batchUpdate();
+        return succeed(studentInstrumentService.queryPage(queryInfo));
+    }
+
+    @ApiOperation(value = "乐保支付")
+    @PostMapping("/pay")
+    @ApiImplicitParams({@ApiImplicitParam(name = "maintenancePayDto", value = "支付参数", required = true, dataType = "MaintenancePayDto")})
+    public HttpResponseResult pay(MaintenancePayDto maintenancePayDto) throws Exception {
+        return succeed(studentInstrumentService.pay(maintenancePayDto));
+    }
+}

+ 19 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/MaintenanceNoticeTask.java

@@ -0,0 +1,19 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class MaintenanceNoticeTask extends BaseTask {
+
+	@Autowired
+	private TaskRemoteService taskRemoteService;
+
+	@Override
+	public void execute() throws TaskException {
+		taskRemoteService.maintenanceNotice();
+	}
+}

+ 3 - 3
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ImGroupController.java

@@ -90,10 +90,10 @@ public class ImGroupController extends BaseController {
 			dto = new ImUserFriendDto();
 			SysUser user = sysUserFeignService.queryUserById(userId);
 			dto.setFriend(user);
-			if (user.getUserType().contains("TEACHER")) {
-				dto.setFriendNickname(user.getRealName());
-			} else {
+			if (user.getUserType().contains("STUDENT")) {
 				dto.setFriendNickname(user.getUsername());
+			} else {
+				dto.setFriendNickname(user.getRealName());
 			}
 			dto.setFriendId(userId);
 		}

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/APIController.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.service.ImGroupService;
 import com.ym.mec.biz.service.PracticeGroupService;
 import com.ym.mec.biz.service.PracticeLessonApplyService;
 import com.ym.mec.common.controller.BaseController;
@@ -31,6 +32,8 @@ public class APIController extends BaseController {
 	
 	@Autowired
 	private PracticeGroupService practiceGroupService;
+	@Autowired
+	private ImGroupService imGroupService;
 
 	@GetMapping("/createCashAccount")
 	public Boolean createCashAccount(Integer userId) {
@@ -53,9 +56,15 @@ public class APIController extends BaseController {
 	public Object practiceSum() {
 		return succeed(practiceLessonApplyService.practiceSum());
 	}
+
 	@GetMapping("/isPurchasedPracticeCourse")
 	public Boolean isPurchasedPracticeCourse(Integer userId) {
 		return practiceGroupService.isPurchasedPracticeCourse(userId);
 	}
 
+	@GetMapping("/updateNickName")
+	public int updateNickName(Integer userId,String nickName,String userType) {
+		return imGroupService.updateNickName(userId,nickName,userType);
+	}
+
 }

+ 199 - 199
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -143,25 +143,25 @@ public class ExportController extends BaseController {
         Employee employee = employeeDao.get(sysUser.getId());
         if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
             queryInfo.setOrganIdList(employee.getOrganIdList());
-        }else if(org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())){
+        } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
             throw new BizException("用户所在分部异常");
-        }else {
+        } else {
             List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-            if(!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))){
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
                 throw new BizException("非法请求");
             }
         }
         List<ClassGroupTeachersDto> rows = classGroupService.queryClassGroupPage(queryInfo).getRows();
         for (ClassGroupTeachersDto row : rows) {
             List<ClassGroupTeacherMapper> classGroupTeacherMapperList = row.getClassGroupTeacherMapperList();
-            if(classGroupTeacherMapperList.size() > 0){
+            if (classGroupTeacherMapperList.size() > 0) {
                 List<ClassGroupTeacherMapper> teachingTeachers = classGroupTeacherMapperList.stream().filter(e -> e.getTeacherRole() == TeachTypeEnum.TEACHING).collect(Collectors.toList());
-                if(teachingTeachers.size() > 0){
-                    row.setTeachingTeacherName(StringUtils.join(teachingTeachers.stream().map(e->e.getUserName()).collect(Collectors.toList()), ","));
+                if (teachingTeachers.size() > 0) {
+                    row.setTeachingTeacherName(StringUtils.join(teachingTeachers.stream().map(e -> e.getUserName()).collect(Collectors.toList()), ","));
                 }
                 List<ClassGroupTeacherMapper> bishopTeachers = classGroupTeacherMapperList.stream().filter(e -> e.getTeacherRole() == TeachTypeEnum.BISHOP).collect(Collectors.toList());
-                if(bishopTeachers.size() > 0){
-                    row.setBishopTeacherName(StringUtils.join(bishopTeachers.stream().map(e->e.getUserName()).collect(Collectors.toList()),","));
+                if (bishopTeachers.size() > 0) {
+                    row.setBishopTeacherName(StringUtils.join(bishopTeachers.stream().map(e -> e.getUserName()).collect(Collectors.toList()), ","));
                 }
             }
         }
@@ -288,17 +288,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<ExportStudentAttendanceDto> rows = studentAttendanceService.exportStudentAttendancesQueryPage(queryInfo).getRows();
         OutputStream outputStream = response.getOutputStream();
         try {
@@ -367,17 +367,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         queryInfo.setPage(1);
         queryInfo.setRows(49999);
         List<MusicGroupPaymentCalenderAuditDto> rows = musicGroupPaymentCalenderService.auditList(queryInfo).getRows();
@@ -416,17 +416,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List rows = teacherAttendanceService.queryTeacherAttendances(queryInfo).getRows();
         OutputStream outputStream = response.getOutputStream();
         try {
@@ -496,17 +496,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<StudentBuyPracticeDto> rows = practiceGroupService.studentBuys(queryInfo).getRows();
         OutputStream outputStream = response.getOutputStream();
         try {
@@ -621,17 +621,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         Date endTime = queryInfo.getEndTime();
         if (endTime != null) {
             queryInfo.setEndTime(DateUtil.addDays(endTime, 1));
@@ -672,17 +672,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         queryInfo.setIsExport(true);
         List<StudentManageListDto> rows = studentManageService.findStudentsByOrganId(queryInfo).getRows();
         OutputStream outputStream = response.getOutputStream();
@@ -724,17 +724,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<PracticeGroupDto> rows = practiceGroupService.findPracticeGroups(queryInfo).getRows();
         OutputStream outputStream = response.getOutputStream();
         if (rows != null && rows.size() > 0) {
@@ -787,17 +787,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<VipGroup> rows = vipGroupService.findVipGroups(queryInfo).getRows();
         OutputStream outputStream = response.getOutputStream();
         if (rows != null && rows.size() > 0) {
@@ -841,17 +841,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
-                queryInfo.setOrganIdList(employee.getOrganIdList());
-            } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+            queryInfo.setOrganIdList(employee.getOrganIdList());
+        } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<CourseScheduleEndDto> rows = scheduleService.endFindCourseSchedules(queryInfo).getRows();
         for (CourseScheduleEndDto row : rows) {
             row.setIsComplaints(StringUtils.equals(row.getIsComplaints(), "1") ? "有" : "无");
@@ -860,9 +860,9 @@ public class ExportController extends BaseController {
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部名称", "课程编号", "开始时间", "结束时间",
                     "班级名称", "班级声部", "课程名称", "课程类型", "教学模式",
-                    "教学点", "课程状态", "指导老师", "学员编号", "是否点名", "是否有考勤申诉","预计上课人数"}, new String[]{
+                    "教学点", "课程状态", "指导老师", "学员编号", "是否点名", "是否有考勤申诉", "预计上课人数"}, new String[]{
                     "organName", "id", "startClassTime", "endClassTime", "classGroupName", "subjectName", "name",
-                    "groupType.desc", "teachMode.msg", "schoolName", "status.msg", "teacherName", "studentId", "isCallNames.msg", "isComplaints","studentNum"}, rows);
+                    "groupType.desc", "teachMode.msg", "schoolName", "status.msg", "teacherName", "studentId", "isCallNames.msg", "isComplaints", "studentNum"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             ouputStream = response.getOutputStream();
@@ -893,17 +893,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<SporadicChargeInfo> rows = sporadicChargeInfoService.queryDetailPage(queryInfo).getRows();
         for (SporadicChargeInfo row : rows) {
             row.setOpenFlagStr(row.getOpenFlag().equals(0) ? "开启" : "关闭");
@@ -1078,12 +1078,12 @@ public class ExportController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('export/orderList')")
     public void orderList(StudentPaymentOrderQueryInfo queryInfo, HttpServletResponse response) throws IOException {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getRoutingOrganId()) && "3".equals(queryInfo.getOrderType())) {
-                queryInfo.setRoutingOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getRoutingOrganId()) && "3".equals(queryInfo.getOrderType())) {
+            queryInfo.setRoutingOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }
         if (StringUtils.isNotBlank(queryInfo.getSearch())) {
             List<BasicUserDto> users = studentPaymentOrderDao.getUsers(queryInfo.getSearch());
             List<Integer> userIds = users.stream().map(BasicUserDto::getUserId).collect(Collectors.toList());
@@ -1335,9 +1335,9 @@ public class ExportController extends BaseController {
                 }
             }
             String[] header = {"学员编号", "学员姓名", "性别", "联系电话", "年级", "班级", "专业", "学员状态", "新增学员", "缴费金额",
-                        "下次缴费日期", "是否报名缴费", "是否激活", "是否有剩余VIP", "是否有剩余网管课", "欠费总额"};
+                    "下次缴费日期", "是否报名缴费", "是否激活", "是否有剩余VIP", "是否有剩余网管课", "欠费总额"};
             String[] body = {"userId", "realName", "gender", "phone", "currentGrade", "currentClass", "subjectName", "studentStatus", "isNewStudentStr",
-                    "courseFee", "nextPaymentDateStr", "paymentStatus.desc", "activeName", "hasVip ? '是' : '否'", "hasPractice ? '是' : '否'","noPaymentAmount"};
+                    "courseFee", "nextPaymentDateStr", "paymentStatus.desc", "activeName", "hasVip ? '是' : '否'", "hasPractice ? '是' : '否'", "noPaymentAmount"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, musicGroupStudentsDtoPageInfo.getRows());
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
@@ -1604,17 +1604,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
-                queryInfo.setOrganIdList(employee.getOrganIdList());
-            } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+            queryInfo.setOrganIdList(employee.getOrganIdList());
+        } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<ExtraExerciseStudentsDto> rows = extracurricularExercisesReplyService.findExtraExercises(queryInfo).getRows();
         if (CollectionUtils.isEmpty(rows)) {
             response.setStatus(500);
@@ -1663,17 +1663,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
-                queryInfo.setOrganIdList(employee.getOrganIdList());
-            } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+            queryInfo.setOrganIdList(employee.getOrganIdList());
+        } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<StudentExercisesSituationDto> rows = studentExtracurricularExercisesSituationService.findStudentExtracurricularExercisesSituations(queryInfo).getRows();
         if (CollectionUtils.isEmpty(rows)) {
             response.setStatus(500);
@@ -1716,17 +1716,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
-                queryInfo.setOrganIdList(employee.getOrganIdList());
-            } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+            queryInfo.setOrganIdList(employee.getOrganIdList());
+        } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         List<TeacherCourseSalaryDetail4WebDto> rows = courseScheduleTeacherSalaryService.findIsSettlementCourseSalarys(queryInfo).getRows();
         if (CollectionUtils.isEmpty(rows)) {
             response.setStatus(500);
@@ -1799,17 +1799,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         PageInfo<Student4operating> PageOperatingStudents = studentManageService.getOperatingStudents(queryInfo);
 
         if (PageOperatingStudents.getTotal() <= 0) {
@@ -1872,8 +1872,8 @@ public class ExportController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('export/vipCourseReviews')")
     public void vipCourseReviews(CourseReviewQueryInfo queryInfo, HttpServletResponse response) throws IOException {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-            Employee employee = employeeDao.get(sysUser.getId());
-            queryInfo.setOrganId(employee.getOrganIdList());
+        Employee employee = employeeDao.get(sysUser.getId());
+        queryInfo.setOrganId(employee.getOrganIdList());
         queryInfo.setIsExport(1);
         queryInfo.setPage(1);
         queryInfo.setRows(49999);
@@ -2014,17 +2014,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new IOException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new IOException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
-                    throw new IOException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new IOException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                throw new IOException("非法请求");
             }
+        }
         queryInfo.setRows(65000);
         PageInfo<CooperationOrgan> pageList = cooperationOrganService.queryPage(queryInfo);
         if (pageList.getTotal() <= 0) {
@@ -2038,7 +2038,7 @@ public class ExportController extends BaseController {
         try {
 
             String[] header = {"分部", "单位编号", "单位名称", "联系人", "职位", "手机号", "是否启用"};
-            String[] body = {"organization.name", "id", "name", "linkman", "job", "mobileNo","isEnable == true ? '是':'否'"};
+            String[] body = {"organization.name", "id", "name", "linkman", "job", "mobileNo", "isEnable == true ? '是':'否'"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, pageList.getRows());
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=cooperationOrgan-" + DateUtil.getDate(new Date()) + ".xls");
@@ -2064,10 +2064,10 @@ public class ExportController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('export/musicGroupRegister')")
     public void musicGroupRegister(String organIds, HttpServletResponse response) throws IOException {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isBlank(organIds)) {
-                organIds = employee.getOrganIdList();
-            }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isBlank(organIds)) {
+            organIds = employee.getOrganIdList();
+        }
         List<MusicGroupStatusEnum> musicGroupStatusList = new ArrayList<>();
         musicGroupStatusList.add(MusicGroupStatusEnum.APPLY);
         musicGroupStatusList.add(MusicGroupStatusEnum.PAY);
@@ -2189,12 +2189,12 @@ public class ExportController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('export/routeOrderList')")
     public void routeOrderList(StudentPaymentOrderQueryInfo queryInfo, HttpServletResponse response) throws IOException {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getRoutingOrganId()) && queryInfo.getOrderType().equals("3")) {
-                queryInfo.setRoutingOrganId(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(employee.getOrganIdList());
-            }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getRoutingOrganId()) && queryInfo.getOrderType().equals("3")) {
+            queryInfo.setRoutingOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }
         if (StringUtils.isNotBlank(queryInfo.getSearch())) {
             List<BasicUserDto> users = studentPaymentOrderDao.getUsers(queryInfo.getSearch());
             List<Integer> userIds = users.stream().map(BasicUserDto::getUserId).collect(Collectors.toList());
@@ -2467,10 +2467,10 @@ public class ExportController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('export/musicGroupNormalStudentNum')")
     public void musicGroupNormalStudentNum(String organIds, HttpServletResponse response) throws IOException {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isBlank(organIds)) {
-                organIds = employee.getOrganIdList();
-            }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isBlank(organIds)) {
+            organIds = employee.getOrganIdList();
+        }
 
         List<MusicGroupStatusEnum> musicGroupStatusList = new ArrayList<>();
         musicGroupStatusList.add(MusicGroupStatusEnum.PAY);
@@ -2561,10 +2561,10 @@ public class ExportController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('export/studentOrder')")
     public void studentOrder(String organIds, Date date, HttpServletResponse response) throws IOException {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isBlank(organIds)) {
-                organIds = employee.getOrganIdList();
-            }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isBlank(organIds)) {
+            organIds = employee.getOrganIdList();
+        }
         Date startTime = DateUtil.getFirstDayOfMonth(date);
         Date EndTime = DateUtil.getLastSecondWithDay(DateUtil.getLastDayOfMonth(date));
 
@@ -2657,17 +2657,17 @@ public class ExportController extends BaseController {
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganIdList())) {
-                queryInfo.setOrganIdList(employee.getOrganIdList());
-            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-                throw new BizException("用户所在分部异常");
-            } else {
-                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-                if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
-                    throw new BizException("非法请求");
-                }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+            queryInfo.setOrganIdList(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            throw new BizException("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
+                throw new BizException("非法请求");
             }
+        }
         if (queryInfo.getEndTime() != null) {
             queryInfo.setEndTime(DateUtil.getLastTimeWithDay(queryInfo.getEndTime()));
         }

+ 11 - 4
mec-web/src/main/java/com/ym/mec/web/controller/ImGroupController.java

@@ -77,6 +77,12 @@ public class ImGroupController extends BaseController {
 		return succeed(imGroupService.update(imGroup));
 	}
 
+	@ApiOperation("修改群成员信息")
+	@PostMapping(value = "/updateNickName")
+	public Object updateNickName(Integer userId,String nickName,String userType) {
+		return succeed(imGroupService.updateNickName(userId,nickName,userType));
+	}
+
 	@ApiOperation("查询群成员列表")
 	@GetMapping(value = "/queryGroupMemberList")
 	public Object queryGroupMemberList(Long imGroupId) {
@@ -104,16 +110,17 @@ public class ImGroupController extends BaseController {
 		if (Objects.isNull(sysUser)) {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
-
 		ImUserFriendDto dto = imUserFriendService.queryFriendDetail(sysUser.getId(), userId);
 		if (dto == null) {
 			dto = new ImUserFriendDto();
 			SysUser user = sysUserFeignService.queryUserById(userId);
 			dto.setFriend(user);
-			if (user.getUserType().contains("TEACHER")) {
-				dto.setFriendNickname(user.getRealName());
-			} else {
+			//这里由原来的优先取老师的realName改成了优先取学员的username,
+			// 因为管理员在修改通讯录备注的时候,如果是多角色,优先改的是学员的username
+			if (user.getUserType().contains("STUDENT")) {
 				dto.setFriendNickname(user.getUsername());
+			} else {
+				dto.setFriendNickname(user.getRealName());
 			}
 			dto.setFriendId(userId);
 		}

+ 10 - 10
mec-web/src/main/java/com/ym/mec/web/controller/SporadicChargeInfoController.java

@@ -43,17 +43,17 @@ public class SporadicChargeInfoController extends BaseController {
 		if (sysUser == null) {
 			return failed("用户信息获取失败");
 		}
-			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("非法请求");
-				}
+		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("非法请求");
 			}
+		}
 		queryInfo.setSort("id_");
 		return succeed(sporadicChargeInfoService.queryDetailPage(queryInfo));
 	}

+ 87 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentInstrumentController.java

@@ -0,0 +1,87 @@
+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.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.biz.dal.page.StudentInstrumentQueryInfo;
+import com.ym.mec.biz.service.StudentInstrumentService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+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.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
+
+@RequestMapping("studentInstrument")
+@Api(tags = "乐器与乐保服务")
+@RestController
+public class StudentInstrumentController extends BaseController {
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
+    @Autowired
+    private StudentInstrumentDao studentInstrumentDao;
+
+
+    @ApiOperation(value = "乐器保养列表")
+    @GetMapping("/getList")
+    @PreAuthorize("@pcs.hasPermissions('studentInstrument/getList')")
+    public HttpResponseResult<PageInfo<StudentInstrument>> getList(StudentInstrumentQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        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("非法请求");
+            }
+        }
+        studentInstrumentDao.batchUpdate();
+        return succeed(studentInstrumentService.queryPage(queryInfo));
+    }
+
+    @ApiOperation(value = "新增乐器")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('studentInstrument/add')")
+    public HttpResponseResult<StudentInstrument> add(StudentInstrument studentInstrument) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if (studentInstrument.getStudentId() == null) {
+            return failed("学生id不能为空");
+        }
+        SysUser student = sysUserFeignService.queryUserById(studentInstrument.getStudentId());
+        studentInstrument.setOrganId(student.getOrganId());
+        return succeed(studentInstrumentService.addStudentInstrument(studentInstrument));
+    }
+
+}

+ 19 - 9
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,22 +1,17 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dto.StudentPreRegistrationDto;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.util.date.DateUtil;
-import com.ym.mec.util.excel.POIUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 
-import java.io.EOFException;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Date;
 import java.util.List;
 
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,11 +22,18 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dto.DelRegisterDto;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
+import com.ym.mec.biz.dal.dto.StudentPreRegistrationDto;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentPreRegistrationQueryInfo;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
@@ -40,8 +42,9 @@ import com.ym.mec.biz.service.StudentPreRegistrationService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
-
-import javax.servlet.http.HttpServletResponse;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.excel.POIUtil;
 
 @RequestMapping("studentRegistration")
 @Api(tags = "学生报名信息服务")
@@ -68,6 +71,13 @@ public class StudentRegistrationController extends BaseController {
         return succeed(studentPreRegistrationService.queryListForPage(queryInfo));
     }
 
+    @ApiOperation(value = "乐团预报名声部列表查询")
+    @GetMapping("/queryPreApplySubjectList")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/queryPreApplySubjectList')")
+    public Object queryPreApplySubjectList(String musicGroupId) {
+        return succeed(studentPreRegistrationService.querySubjectNum(musicGroupId));
+    }
+
     @ApiOperation(value = "乐团添加学员")
     @PostMapping("/insertStudent")
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/insertStudent')")

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -94,6 +94,8 @@ public class TaskController extends BaseController {
 	@Autowired
 	private InspectionItemPlanService inspectionItemPlanService;
 
+	@Autowired
+	private StudentInstrumentService studentInstrumentService;
 	@GetMapping(value = "/autoAffirmReceiveTask")
 	// 自动确认收货
 	public void affirmReceive(){
@@ -340,4 +342,10 @@ public class TaskController extends BaseController {
 	public void inspectionPlan(){
 		inspectionItemPlanService.pushNotice();
 	}
+
+	//乐保到期提醒
+	@GetMapping("/maintenanceNotice")
+	public void maintenanceNotice(){
+		studentInstrumentService.pushNotice();
+	}
 }

+ 64 - 12
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -2,17 +2,13 @@ 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.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
 import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.StudentApplyRefunds.StudentApplyRefundsStatus;
-import com.ym.mec.biz.dal.enums.AuditStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.VipGroupAttendanceQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupSalaryQueryInfo;
@@ -21,6 +17,7 @@ import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.util.date.DateUtil;
 import com.yonge.log.model.AuditLogAnnotation;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -56,6 +53,12 @@ public class VipGroupManageController extends BaseController {
     private EmployeeDao employeeDao;
     @Autowired
     private ClassGroupDao classGroupDao;
+    @Autowired
+    private ImGroupMemberService imGroupMemberService;
+    @Autowired
+    private ImUserFriendService imUserFriendService;
+    @Autowired
+    private ImGroupService imGroupService;
 
     @Autowired
     private StudentApplyRefundsService studentApplyRefundsService;
@@ -64,6 +67,12 @@ public class VipGroupManageController extends BaseController {
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
     private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
+    @Autowired
+    private ClassGroupStudentMapperDao classGroupStudentMapperDao;
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
+    @Autowired
+    private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
 
     @GetMapping("/teacherSalarySettlement")
     public Object teacherSalarySettlement(){
@@ -80,22 +89,50 @@ public class VipGroupManageController extends BaseController {
             if(Objects.isNull(oldVipGroup)){
                 throw new BizException("此课程组不存在");
             }
-            if(!VipGroupStatusEnum.PROGRESS.equals(oldVipGroup.getStatus())&&!VipGroupStatusEnum.PAUSE.equals(oldVipGroup.getStatus())){
+            if(!VipGroupStatusEnum.PROGRESS.equals(oldVipGroup.getStatus())&&!VipGroupStatusEnum.FINISHED.equals(oldVipGroup.getStatus())&&!VipGroupStatusEnum.PAUSE.equals(oldVipGroup.getStatus())){
                 throw new BizException("此课程组状态暂不支持修改");
             }
         }
+        ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(oldVipGroup.getId().toString(), ClassGroupTypeEnum.VIP.getCode());
+        if(Objects.isNull(classGroup)){
+            throw new BizException("课程信息错误");
+        }
         if(Objects.isNull(oldVipGroup.getVipGroupActivityId())){
-            if(VipGroupStatusEnum.PROGRESS.equals(vipGroup.getStatus())&&oldVipGroup.getStatus().getCode()>VipGroupStatusEnum.PROGRESS.getCode()){
+            if(VipGroupStatusEnum.PROGRESS.equals(vipGroup.getStatus())&&!VipGroupStatusEnum.FINISHED.equals(oldVipGroup.getStatus())&&oldVipGroup.getStatus().getCode()>VipGroupStatusEnum.PROGRESS.getCode()){
                 throw new BizException("此课程组状态暂不支持修改");
             }
-            ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(oldVipGroup.getId().toString(), ClassGroupTypeEnum.VIP.getCode());
-            if(Objects.isNull(classGroup)){
-                throw new BizException("课程信息错误");
-            }
             if(classGroup.getStudentNum()<3){
                 throw new BizException("班级人数未达到3人");
             }
         }
+        Date now = new Date();
+        if(VipGroupStatusEnum.FINISHED.equals(oldVipGroup.getStatus())&&(vipGroup.getCoursesExpireDate().compareTo(now)>=0|| DateUtil.isSameDay(vipGroup.getCoursesExpireDate(), now))){
+            vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
+
+            Map<Integer,String> userRoleMap = new HashMap<>();
+            if(Objects.nonNull(vipGroup.getEducationalTeacherId())){
+                userRoleMap.put(vipGroup.getEducationalTeacherId(),"乐团主管");
+            }
+
+            CourseSchedule lastCourse = courseScheduleDao.findLastCourseWithGroup(vipGroup.getId().toString(), GroupType.VIP);
+            if(Objects.isNull(lastCourse)){
+                userRoleMap.put(vipGroup.getUserId(),"指导老师");
+            }else{
+                userRoleMap.put(lastCourse.getActualTeacherId(),"指导老师");
+            }
+
+            List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
+            if(!CollectionUtils.isEmpty(classGroupStudents)){
+                //生成学生单课缴费信息
+                for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
+                    userRoleMap.put(classGroupStudent.getUserId(),null);
+                }
+            }
+
+            imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), vipGroup.getName(), null, null, GroupType.VIP.getCode());
+            imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
+            imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(),classGroup.getGroupType());
+        }
         vipGroupService.update(vipGroup);
         return succeed();
     }
@@ -179,6 +216,21 @@ public class VipGroupManageController extends BaseController {
     @GetMapping(value = "/findHaveCourseBalanceStudents")
     @PreAuthorize("@pcs.hasPermissions('vipGroupManage/findHaveCourseBalanceStudents')")
     public Object findHaveCourseBalanceStudents(VipGroupQueryInfo queryInfo){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        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(vipGroupService.findHaveCourseBalanceStudents(queryInfo));
     }
 

+ 13 - 4
mec-web/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

@@ -4,15 +4,13 @@ package com.ym.mec.web.controller.education;
 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.dao.StudentInstrumentDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
-import com.ym.mec.biz.dal.page.GoodsQueryInfo;
-import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
-import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
+import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -52,6 +50,10 @@ public class EduRepairController extends BaseController {
     private GoodsCategoryService goodsCategoryService;
     @Autowired
     private StudentGoodsSellService studentGoodsSellService;
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
+    @Autowired
+    private StudentInstrumentDao studentInstrumentDao;
 
     @ApiOperation("获取学生列表")
     @GetMapping(value = "/getStudents")
@@ -205,4 +207,11 @@ public class EduRepairController extends BaseController {
         queryInfo.setTeacherId(sysUser.getId());
         return succeed(studentGoodsSellService.queryStudentGoodsOrders(queryInfo));
     }
+
+    @ApiOperation(value = "获取乐器与乐保列表")
+    @GetMapping("/getInstrumentList")
+    public HttpResponseResult<PageInfo<StudentInstrument>> getInstrumentList(StudentInstrumentQueryInfo queryInfo) {
+        studentInstrumentDao.batchUpdate();
+        return succeed(studentInstrumentService.queryPage(queryInfo));
+    }
 }