Bladeren bron

Merge remote-tracking branch 'origin/teacher_vip_salary' into teacher_vip_salary

Joburgess 4 jaren geleden
bovenliggende
commit
764c0f1e4f
74 gewijzigde bestanden met toevoegingen van 2422 en 800 verwijderingen
  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. 17 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java
  4. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ImGroupDao.java
  5. 34 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentInstrumentDao.java
  6. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPreRegistrationDao.java
  7. 13 7
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  8. 40 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MaintenancePayDto.java
  9. 34 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PreRegisterSubjectDto.java
  10. 14 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RegisterPayDto.java
  11. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RepairGoodsDto.java
  12. 238 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java
  13. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java
  14. 117 46
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRepair.java
  15. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/GroupType.java
  16. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
  17. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderDetailTypeEnum.java
  18. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java
  19. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ProbationPeriodEnum.java
  20. 36 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/RepairStudentQueryInfo.java
  21. 101 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentInstrumentQueryInfo.java
  22. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ImGroupService.java
  23. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java
  24. 48 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentInstrumentService.java
  25. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPreRegistrationService.java
  26. 10 6
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  27. 9 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  28. 87 41
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  29. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java
  30. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupServiceImpl.java
  31. 16 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  32. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  33. 47 185
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  34. 112 69
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java
  35. 331 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java
  36. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  37. 5 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  38. 35 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPreRegistrationServiceImpl.java
  39. 93 146
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  40. 34 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  41. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  42. 15 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java
  43. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  44. 16 1
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml
  45. 6 2
      mec-biz/src/main/resources/config/mybatis/ImGroupMapper.xml
  46. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml
  47. 165 0
      mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml
  48. 3 0
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml
  49. 19 0
      mec-biz/src/main/resources/config/mybatis/StudentPreRegistrationMapper.xml
  50. 5 0
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  51. 20 9
      mec-biz/src/main/resources/config/mybatis/StudentRepairMapper.xml
  52. 12 0
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  53. 3 0
      mec-client-api/src/main/java/com/ym/mec/im/WebFeignService.java
  54. 6 0
      mec-client-api/src/main/java/com/ym/mec/im/fallback/WebFeignServiceFallback.java
  55. 4 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  56. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  57. 0 2
      mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java
  58. 24 0
      mec-common/common-core/src/main/java/com/ym/mec/common/entity/Mapper.java
  59. 4 15
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  60. 14 1
      mec-student/src/main/java/com/ym/mec/student/controller/ImGroupController.java
  61. 7 1
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java
  62. 56 0
      mec-student/src/main/java/com/ym/mec/student/controller/StudentInstrumentController.java
  63. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/MaintenanceNoticeTask.java
  64. 3 3
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ImGroupController.java
  65. 1 1
      mec-teacher/src/main/resources/bootstrap-test.properties
  66. 9 0
      mec-web/src/main/java/com/ym/mec/web/controller/APIController.java
  67. 199 199
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  68. 11 4
      mec-web/src/main/java/com/ym/mec/web/controller/ImGroupController.java
  69. 10 10
      mec-web/src/main/java/com/ym/mec/web/controller/SporadicChargeInfoController.java
  70. 87 0
      mec-web/src/main/java/com/ym/mec/web/controller/StudentInstrumentController.java
  71. 19 9
      mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java
  72. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java
  73. 15 0
      mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java
  74. 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>
 
     <!-- 根据主键查询一条记录 -->

+ 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);
 }

+ 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;
+    }
 }

+ 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);
 }

+ 10 - 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;
 
     /**
      * 查询用户指定乐团的报名信息

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

@@ -168,6 +168,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
     @Autowired
     private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
+    @Autowired
+    private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -3454,9 +3456,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if (CollectionUtils.isEmpty(studentIds)) {
             throw new BizException("学员列表不可为空");
         }
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
 
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
+        //获取欠费学员列表
+        List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroup.getId(), new ArrayList<>(studentIds));
+        if(noPaymentUserIds.size() > 0){
+            throw new BizException("操作失败:有欠费的学员不允许创建缴费");
+        }
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+
         //生成缴费记录,同一个批次
         MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
         List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();

+ 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;
+	}
+
 }

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

@@ -425,7 +425,22 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	public void batchAdd(String batchNo, Set<Integer> userIdList) {
 		
 		List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.findByBatchNo(batchNo);
-		
+		if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0){
+			throw new BizException("操作失败:缴费项目不存在");
+		}
+		String musicGroupId = musicGroupPaymentCalenderList.get(0).getMusicGroupId();
+		// 所有缴费项目已完成排课才能创建下一个缴费项目
+		List<String> batchNoList = new ArrayList<>();
+		batchNoList.add(batchNo);
+		String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null,batchNoList);
+		if (StringUtils.isNoneBlank(orignBatchNo)) {
+			throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
+		}
+		//获取欠费学员列表
+		List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroupId, new ArrayList<>(userIdList));
+		if(noPaymentUserIds.size() > 0){
+			throw new BizException("操作失败:有欠费的学员不允许创建缴费");
+		}
 		List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<MusicGroupPaymentStudentCourseDetail>();
 		
 		Long musicGroupPaymentCalenderId = null;

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -599,6 +599,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
 				//获取默认的学员缴费详情
 				List<Integer> studentIds = JSON.parseArray(adjust.getStudentIds(), Integer.class);
+				//获取欠费学员列表
+				List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroup.getId(), new ArrayList<>(studentIds));
+				if(noPaymentUserIds.size() > 0){
+					throw new BizException("操作失败:有欠费的学员不允许创建缴费");
+				}
+
 				List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = classGroupService.queryStudentPaymentCalenders(adjust.getMasterClassGroupId(),
 						adjust.getClassGroupStudents(),studentIds);
 				List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();

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

@@ -639,9 +639,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;
@@ -650,102 +647,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<>();
@@ -759,6 +685,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("商品价格不符");
@@ -771,7 +702,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();
@@ -859,9 +790,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;
@@ -871,100 +799,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("乐器提供方式不存在,请核查");
+                }
+                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()));
         }
 
         //新课程形态
@@ -980,6 +837,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("商品价格不符");
         }
@@ -992,7 +854,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();
 

+ 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;
+    }
+}

+ 4 - 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;
@@ -110,6 +111,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     @Autowired
     private SysUserContractsDao sysUserContractsDao;
     @Autowired
+    private WebFeignService webFeignService;
+    @Autowired
     private StudentCourseHomeworkDao studentCourseHomeworkDao;
 
     @Override
@@ -664,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;
     }
 

+ 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;
+	}
 	
 }

+ 93 - 146
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -20,9 +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;
@@ -39,66 +43,27 @@ 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;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GoodsType;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+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;
@@ -186,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() {
@@ -260,7 +228,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId) {
         StudentFeeDetailDto studentFeeDetailDto = new StudentFeeDetailDto();
         List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId, studentId);
-        if (musicalList.size() <= 0) {
+        if(musicalList.size() <=0){
             return studentFeeDetailDto;
         }
         MusicalListDetailDto detailDto = musicalList.get(0);
@@ -369,13 +337,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistration.setUserId(sysUser.getId());
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
         if (hasReg != null) {
-            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
             studentRegistration.setId(hasReg.getId());
             studentRegistrationDao.update(studentRegistration);
         } else {
             studentRegistrationDao.insert(studentRegistration);
         }
 
+        webFeignService.updateNickName(sysUser.getId(),studentRegistration.getName(),"STUDENT");
         // 增加报名学生数
         musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
         // 报名成功后,发送短信
@@ -399,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());
@@ -423,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();
@@ -445,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());
@@ -506,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);
 
         //增加缴费学生数
@@ -536,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);
@@ -566,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();
@@ -588,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) {
@@ -649,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;
@@ -711,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("操作失败:账户已被注册");
@@ -750,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) {
@@ -827,6 +763,12 @@ 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) {
+        //获取欠费学员列表
+        List<Integer> studentIdList = Arrays.asList(studentIds.split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
+        List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(newMusicGroupId,studentIdList);
+        if(noPaymentUserIds.size() > 0){
+            throw new BizException("操作失败:有欠费的学员不允许创建缴费");
+        }
         SysUser sysUser1 = sysUserFeignService.queryUserInfo();
         //获取旧乐团学员注册信息
         List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds, oldMusicGroupId);
@@ -1145,8 +1087,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;
             }

+ 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;
 	}
 

+ 15 - 0
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) {

+ 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>

+ 1 - 1
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

+ 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">

+ 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;
+	}
+}

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

@@ -301,20 +301,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)));
@@ -447,8 +441,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){
@@ -457,11 +451,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("查询好友列表")

+ 7 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -4,6 +4,7 @@ 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;
@@ -48,6 +49,8 @@ public class MusicGroupRegisterController extends BaseController {
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
     @Autowired
     private CourseScheduleDao courseScheduleDao;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
 
 
     @ApiOperation(value = "新增学生报名信息")
@@ -73,10 +76,13 @@ 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 + "不可报名,请联系教务老师");

+ 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);
 		}

+ 1 - 1
mec-teacher/src/main/resources/bootstrap-test.properties

@@ -3,7 +3,7 @@
 #\u670d\u52a1\u5668\u5730\u5740
 spring.cloud.nacos.config.server-addr=47.114.1.200:8848
 #\u9ed8\u8ba4\u4e3aPublic\u547d\u540d\u7a7a\u95f4,\u53ef\u4ee5\u7701\u7565\u4e0d\u5199
-spring.cloud.nacos.config.namespace=f9d46b0a-9847-48ae-8e4b-216c7a3eb466
+spring.cloud.nacos.config.namespace=f753d9d9-4bb2-4df6-a483-da9e169617c4
 #\u6307\u5b9a\u914d\u7f6e\u7fa4\u7ec4 --\u5982\u679c\u662fPublic\u547d\u540d\u7a7a\u95f4 \u5219\u53ef\u4ee5\u7701\u7565\u7fa4\u7ec4\u914d\u7f6e
 spring.cloud.nacos.config.group=DEFAULT_GROUP
 #\u6587\u4ef6\u540d -- \u5982\u679c\u6ca1\u6709\u914d\u7f6e\u5219\u9ed8\u8ba4\u4e3a ${spring.appliction.name}

+ 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();
+	}
 }

+ 15 - 0
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -216,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));
+    }
 }