Browse Source

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

# Conflicts:
#	mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
yonge 3 năm trước cách đây
mục cha
commit
a32d89dc9f
45 tập tin đã thay đổi với 1563 bổ sung360 xóa
  1. 1 0
      .gitignore
  2. 17 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java
  3. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderActivityDao.java
  4. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderMemberDto.java
  5. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentBaseCalender.java
  6. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicRepairDto.java
  7. 179 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherStudent.java
  8. 44 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java
  9. 123 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderActivity.java
  10. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantProductInfo.java
  11. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/DeductReasonEnum.java
  12. 24 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherOrderQueryInfo.java
  13. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/EmployeeQueryInfo.java
  14. 25 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java
  15. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderActivityService.java
  16. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderBaseService.java
  17. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderCourseSettingsService.java
  18. 6 12
      mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java
  19. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantOrderRecordService.java
  20. 243 25
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
  21. 5 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  22. 35 23
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  23. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberPaymentCalenderServiceImpl.java
  24. 45 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java
  25. 43 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java
  26. 63 163
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  27. 11 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicRepairPaymentCalenderServiceImpl.java
  28. 28 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java
  29. 29 24
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  30. 51 19
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  31. 80 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java
  32. 108 0
      mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml
  33. 6 8
      mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml
  34. 27 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml
  35. 24 4
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  36. 27 17
      mec-common/common-core/src/main/java/com/ym/mec/common/page/WrapperUtil.java
  37. 5 13
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  38. 18 12
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  39. 47 0
      mec-student/src/main/java/com/ym/mec/student/controller/SysTenantConfigController.java
  40. 48 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/SysTenantConfigController.java
  41. 1 5
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherAttendanceController.java
  42. 5 4
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java
  43. 73 0
      mec-web/src/main/java/com/ym/mec/web/controller/CloudTeacherOrderController.java
  44. 12 1
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java
  45. 8 4
      mec-web/src/main/java/com/ym/mec/web/controller/SysManualController.java

+ 1 - 0
.gitignore

@@ -11,3 +11,4 @@ bin
 .idea
 *.iml
 /lib/
+/mec-web/src/main/resources/rebel.xml

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

@@ -7,7 +7,9 @@ import java.util.Map;
 import java.util.Set;
 
 import com.ym.mec.biz.dal.dto.CloudTeacherActiveTargetDetailDto;
+import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
 import com.ym.mec.biz.dal.page.CloudTeacherActiveQueryInfo;
+import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
@@ -84,8 +86,23 @@ public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
 
     /**
      * 获取学员云教练活动金额
+     * @MapKey
      * @param studentIds
      * @return
      */
     List<Map<Long, BigDecimal>> queryActiveAmountMap(@Param("studentIds") List<Integer> studentIds);
+
+    int findInactiveCount(Map<String, Object> params);
+
+    List<CloudTeacherStudent> queryInactive(Map<String, Object> params);
+
+    int updateOrderStatusOK(@Param("orderId") Integer orderId);
+
+    int updateOrderId(@Param("cloudTeacherOrderId")Integer cloudTeacherOrderId,
+                      @Param("amount") BigDecimal amount,
+                      @Param("orderId")Integer orderId);
+
+    int findRecordCount(Map<String, Object> params);
+
+    List<CloudTeacherStudent> queryRecord(Map<String, Object> params);
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderActivityDao.java

@@ -0,0 +1,12 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface MusicGroupPaymentCalenderActivityDao extends BaseMapper<MusicGroupPaymentCalenderActivity> {
+
+    void insertBatch(@Param("calenderActivityList") List<MusicGroupPaymentCalenderActivity> musicGroupPaymentCalenderActivities);
+}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderMemberDto.java

@@ -20,7 +20,7 @@ public class CalenderMemberDto {
     @ApiModelProperty(value = "会员等级编号", required = false)
     private Integer memberRankSettingId = 1;
 
-    @ApiModelProperty(value = "是否选", required = false)
+    @ApiModelProperty(value = "是否选", required = false)
     private Boolean optionalFlag = false;
 
     public PeriodEnum getPeriodEnum() {

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentBaseCalender.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.dto;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -43,9 +44,20 @@ public class MusicGroupPaymentBaseCalender {
 	@ApiModelProperty(value = "乐保信息", required = false)
 	private MusicRepairDto musicRepair;
 
+	@ApiModelProperty(value = "乐团活动相关信息(vip、网管课)", required = false)
+	private List<MusicGroupPaymentCalenderActivity> calenderActivityList;
+
 	@ApiModelProperty(value = "乐团课程信息", required = false)
 	private List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList;
 
+	public List<MusicGroupPaymentCalenderActivity> getCalenderActivityList() {
+		return calenderActivityList;
+	}
+
+	public void setCalenderActivityList(List<MusicGroupPaymentCalenderActivity> calenderActivityList) {
+		this.calenderActivityList = calenderActivityList;
+	}
+
 	public MusicRepairDto getMusicRepair() {
 		return musicRepair;
 	}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicRepairDto.java

@@ -12,6 +12,17 @@ public class MusicRepairDto {
     @ApiModelProperty(value = "团购价", required = false)
     private BigDecimal actualAmount;
 
+    @ApiModelProperty(value = "是否必选", required = false)
+    private Boolean optionalFlag = false;
+
+    public Boolean getOptionalFlag() {
+        return optionalFlag;
+    }
+
+    public void setOptionalFlag(Boolean optionalFlag) {
+        this.optionalFlag = optionalFlag;
+    }
+
     public BigDecimal getNum() {
         return num;
     }

+ 179 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherStudent.java

@@ -0,0 +1,179 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+/**
+ * Description
+ * 团练宝查询学生
+ * @author: feng-ji
+ * @date: 2021-12-21
+ */
+public class CloudTeacherStudent {
+
+    @ApiModelProperty(value = "学生Id")
+    private Integer studentId;
+
+    @ApiModelProperty(value = "机构编号")
+    private Integer tenantId;
+
+    @ApiModelProperty(value = "团练宝订单Id")
+    private Integer cloudTeacherOrderId;
+
+    @ApiModelProperty(value = "姓名")
+    private String name;
+
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+
+    @ApiModelProperty(value = "声部Id")
+    private Integer subject;
+
+    @ApiModelProperty(value = "声部")
+    private String subjectName;
+
+    @ApiModelProperty(value = "所属分部")
+    private String organName;
+
+    @ApiModelProperty(value = "乐团编号")
+    private String musicGroupId;
+
+    @ApiModelProperty(value = "乐团名称")
+    private String musicGroupName;
+
+    @ApiModelProperty(value = "合作单位")
+    private String cooperationOrganName;
+
+    @ApiModelProperty(value = "团练宝类型")
+    private Integer type;
+
+    @ApiModelProperty(value = "团练宝类型")
+    private String typeName;
+
+    public String getTypeName() {
+        return typeName;
+    }
+
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    @ApiModelProperty(value = "数量")
+    private Integer time;
+
+    @ApiModelProperty(value = "金额")
+    private BigDecimal amount;
+
+    public Integer getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(Integer tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public Integer getCloudTeacherOrderId() {
+        return cloudTeacherOrderId;
+    }
+
+    public void setCloudTeacherOrderId(Integer cloudTeacherOrderId) {
+        this.cloudTeacherOrderId = cloudTeacherOrderId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getTime() {
+        return time;
+    }
+
+    public void setTime(Integer time) {
+        this.time = time;
+    }
+
+    public Integer getSubject() {
+        return subject;
+    }
+
+    public void setSubject(Integer subject) {
+        this.subject = subject;
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public String getMusicGroupName() {
+        return musicGroupName;
+    }
+
+    public void setMusicGroupName(String musicGroupName) {
+        this.musicGroupName = musicGroupName;
+    }
+
+    public String getCooperationOrganName() {
+        return cooperationOrganName;
+    }
+
+    public void setCooperationOrganName(String cooperationOrganName) {
+        this.cooperationOrganName = cooperationOrganName;
+    }
+}

+ 44 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -188,6 +188,50 @@ public class MusicGroupPaymentCalender extends BaseEntity {
 	//会员等级名称
 	private String memberRankSettingName;
 
+	//会员是否必选
+	private Boolean memberOptionalFlag = false;
+
+	//乐保年限
+	private BigDecimal musicRepairNum = BigDecimal.ZERO;
+
+	//乐保购买价格
+	private BigDecimal musicRepairActualPrice = BigDecimal.ZERO;
+
+	//乐保是否必选
+	private Boolean musicRepairOptionalFlag = false;
+
+	public Boolean getMemberOptionalFlag() {
+		return memberOptionalFlag;
+	}
+
+	public void setMemberOptionalFlag(Boolean memberOptionalFlag) {
+		this.memberOptionalFlag = memberOptionalFlag;
+	}
+
+	public BigDecimal getMusicRepairNum() {
+		return musicRepairNum;
+	}
+
+	public void setMusicRepairNum(BigDecimal musicRepairNum) {
+		this.musicRepairNum = musicRepairNum;
+	}
+
+	public BigDecimal getMusicRepairActualPrice() {
+		return musicRepairActualPrice;
+	}
+
+	public void setMusicRepairActualPrice(BigDecimal musicRepairActualPrice) {
+		this.musicRepairActualPrice = musicRepairActualPrice;
+	}
+
+	public Boolean getMusicRepairOptionalFlag() {
+		return musicRepairOptionalFlag;
+	}
+
+	public void setMusicRepairOptionalFlag(Boolean musicRepairOptionalFlag) {
+		this.musicRepairOptionalFlag = musicRepairOptionalFlag;
+	}
+
 	public PeriodEnum getMemberPeriod() {
 		return memberPeriod;
 	}

+ 123 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderActivity.java

@@ -0,0 +1,123 @@
+package com.ym.mec.biz.dal.entity;
+
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+
+/**
+ * 缴费项目关联活动(MusicGroupPaymentCalenderActivity)表实体类
+ *
+ * @author zx
+ * @since 2021-12-22 15:54:47
+ */
+@ApiModel(value = "music_group_payment_calender_activity-缴费项目关联活动")
+public class MusicGroupPaymentCalenderActivity implements Serializable {
+    @TableId(value = "id_", type = IdType.AUTO)
+    @ApiModelProperty(value = "${column.comment}")
+    private Long id;
+
+    @TableField("activity_id_")
+    @ApiModelProperty(value = "活动编号")
+    private Integer activityId;
+
+    @TableField("calender_id_")
+    @ApiModelProperty(value = "缴费项目编号")
+    private Long calenderId;
+
+    @TableField("optional_flag_")
+    @ApiModelProperty(value = "是否必选")
+    private Integer optionalFlag;
+
+    @TableField("actual_amount_")
+    @ApiModelProperty(value = "现价")
+    private BigDecimal actualAmount;
+
+    @TableField("original_amount_")
+    @ApiModelProperty(value = "原价")
+    private BigDecimal originalAmount;
+
+    @TableField("create_time_")
+    @ApiModelProperty(value = "${column.comment}")
+    private Date createTime;
+
+    @TableField("update_time_")
+    @ApiModelProperty(value = "${column.comment}")
+    private Date updateTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Integer getActivityId() {
+        return activityId;
+    }
+
+    public void setActivityId(Integer activityId) {
+        this.activityId = activityId;
+    }
+
+    public Long getCalenderId() {
+        return calenderId;
+    }
+
+    public void setCalenderId(Long calenderId) {
+        this.calenderId = calenderId;
+    }
+
+    public Integer getOptionalFlag() {
+        return optionalFlag;
+    }
+
+    public void setOptionalFlag(Integer optionalFlag) {
+        this.optionalFlag = optionalFlag;
+    }
+
+    public BigDecimal getActualAmount() {
+        return actualAmount;
+    }
+
+    public void setActualAmount(BigDecimal actualAmount) {
+        this.actualAmount = actualAmount;
+    }
+
+    public BigDecimal getOriginalAmount() {
+        return originalAmount;
+    }
+
+    public void setOriginalAmount(BigDecimal originalAmount) {
+        this.originalAmount = originalAmount;
+    }
+
+    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;
+    }
+
+
+}
+

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantProductInfo.java

@@ -47,7 +47,7 @@ public class TenantProductInfo implements Serializable {
     private BigDecimal payAmount;
 
     @TableField("pay_date_")
-    @ApiModelProperty(value = "付费/开通 时间")
+    @ApiModelProperty(value = "付费时间")
     private Date payDate;
 
     @TableField("expiry_count_")

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

@@ -9,8 +9,8 @@ import com.ym.mec.common.enums.BaseEnum;
 public enum DeductReasonEnum implements BaseEnum<String,DeductReasonEnum> {
     SIGN_IN_TIME_ERR("SIGN_IN_TIME_ERR", "签到时间异常", ""),
     SIGN_OUT_TIME_ERR("SIGN_OUT_TIME_ERR", "签退时间异常", ""),
-    GPS_ERR_IN("GPS_ERR", "位置异常", ""),
-    GPS_ERR_OUT("GPS_ERR", "位置异常", ""),
+    GPS_ERR_IN("GPS_ERR", "签到位置异常", ""),
+    GPS_ERR_OUT("GPS_ERR", "签退位置异常", ""),
     NOT_SETTLEMENT("NOT_SETTLEMENT", "不结算课酬", "特殊老师不结算课酬"),
     TRAIL("TRAIL", "试用期扣减", "试用期老师课酬按系统配置的折扣计算"),
 

+ 24 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherOrderQueryInfo.java

@@ -6,12 +6,18 @@ import com.ym.mec.common.page.QueryInfo;
 
 public class CloudTeacherOrderQueryInfo extends QueryInfo {
 
-	@ApiModelProperty(value = "交易状态(0-待生效 1-生效中 2-已生效 3-已退)", required = false)
+	@ApiModelProperty(value = "交易状态(0-待生效 1-生效中 2-已生效 3-已退)")
 	private Integer status;
 
-	@ApiModelProperty(value = "学生编号", required = false)
+	@ApiModelProperty(value = "学生编号")
 	private Integer studentId;
 
+	@ApiModelProperty(value = "学员姓名/编号/电话")
+	private String queryCondition;
+
+	@ApiModelProperty(value = "声部Id")
+	private Integer subjectId;
+
 	public Integer getStatus() {
 		return status;
 	}
@@ -27,4 +33,20 @@ public class CloudTeacherOrderQueryInfo extends QueryInfo {
 	public void setStudentId(Integer studentId) {
 		this.studentId = studentId;
 	}
+
+	public String getQueryCondition() {
+		return queryCondition;
+	}
+
+	public void setQueryCondition(String queryCondition) {
+		this.queryCondition = queryCondition;
+	}
+
+	public Integer getSubjectId() {
+		return subjectId;
+	}
+
+	public void setSubjectId(Integer subjectId) {
+		this.subjectId = subjectId;
+	}
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/EmployeeQueryInfo.java

@@ -25,6 +25,18 @@ public class EmployeeQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "是否离职",required = false)
     private Boolean demissionflag;
 
+    /** 是否冻结 */
+    @ApiModelProperty(value = "是否冻结",required = false)
+    private Boolean lockFlag;
+
+    public Boolean getLockFlag() {
+        return lockFlag;
+    }
+
+    public void setLockFlag(Boolean lockFlag) {
+        this.lockFlag = lockFlag;
+    }
+
     public Boolean getDemissionflag() {
         return demissionflag;
     }

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java

@@ -3,8 +3,12 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
 import com.ym.mec.biz.dal.entity.CloudTeacher;
 import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
+import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+import com.ym.mec.thirdparty.yqpay.Msg;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -14,6 +18,14 @@ import java.util.Set;
 
 public interface CloudTeacherOrderService extends BaseService<Long, CloudTeacherOrder> {
 
+    /**
+     * 查询未激活用户
+     */
+    PageInfo<CloudTeacherStudent> queryInactive(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception;
+
+    /**
+     * 机构付款指定学生并激活
+     */
 
     /**
      * 将订单详情云教练加入云教练购买列表
@@ -89,4 +101,17 @@ public interface CloudTeacherOrderService extends BaseService<Long, CloudTeacher
      * @return
      */
     String queryActiveOrderPage(Integer userId, Integer activeRemark, String remark);
+
+    /**
+     * 支付未激活用户
+     * @param cloudTeacherStudents 选择中用户清单
+     * @return 是否成功
+     */
+    Map<String, Object> pay(List<CloudTeacherStudent> cloudTeacherStudents) throws Exception;
+
+    Msg payNotify(Msg msg);
+
+    Boolean payCheck(String orderNo);
+
+    PageInfo<CloudTeacherStudent> queryActiveRecord(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo);
 }

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderActivityService.java

@@ -0,0 +1,15 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
+
+public interface MusicGroupPaymentCalenderActivityService {
+    /**
+    * @description: 新增活动缴费项目
+     * @param musicGroupPaymentBaseCalender
+     * @param calenderId
+    * @return void
+    * @author zx
+    * @date 2021/12/22 15:31
+    */
+    void batchInsert(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender, Long calenderId);
+}

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

@@ -3,6 +3,8 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 
+import java.math.BigDecimal;
+
 public interface MusicGroupPaymentCalenderBaseService {
 
     /**
@@ -22,4 +24,13 @@ public interface MusicGroupPaymentCalenderBaseService {
     * @date 2021/12/21 11:37
     */
     MusicGroupPaymentCalender.PaymentCalenderStatusEnum checkComponentAmount(MusicGroupPaymentBaseCalender baseCalender);
+
+    /**
+    * @description: 获取实际金额
+     * @param baseCalender
+    * @return java.math.BigDecimal
+    * @author zx
+    * @date 2021/12/21 23:35
+    */
+    BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderCourseSettingsService.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import com.ym.mec.common.service.BaseService;
 import java.util.List;
@@ -16,4 +17,12 @@ public interface MusicGroupPaymentCalenderCourseSettingsService extends BaseServ
      * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings>
      */
     Map<String, Integer> getMusicCourseSettingsWithStudents(String musicGroupId, List<Integer> studentIds);
+
+    void batchInsert(MusicGroupPaymentCalender musicGroupPaymentCalender);
+
+    void deleteByMusicGroupPaymentCalenderId(List<Long> calenderIds);
+
+    List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettings(Long calenderId);
+
+    List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettingsByBatchNo(String batchNo);
 }

+ 6 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -107,18 +107,12 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String OFFLINE_SIGN_OUT_GPS_ERROR_CUT_SALARY_UNIT = "offline_sign_out_gps_error_cut_salary_unit";
     //试用期老师课酬发放百分比
     String PROBATION_TEACHER_SALARY = "probation_teacher_salary";
-    //兼职老师考勤申诉时间限制
-    String PARP_TEACHER_SALARY = "probation_teacher_salary";
-    //兼职老师考勤申诉时间限制方式(1、固定时间、2、固定日期)
-    String PARP_TEACHER_SALARY_TYPE = "parp_teacher_salary_type";
-    //全职老师考勤申诉时间限制
-    String FULL_TEACHER_SALARY = "full_teacher_salary";
-    //全职老师考勤申诉时间限制方式(1、固定时间、2、固定日期)
-    String FULL_TEACHER_SALARY_TYPE = "full_teacher_salary_type";
-    //劳务考勤申诉时间限制
-    String LABOUR_TEACHER_SALARY = "labour_teacher_salary";
-    //劳务考勤申诉时间限制方式(1、固定时间、2、固定日期)
-    String LABOUR_TEACHER_SALARY_TYPE = "labour_teacher_salary_type";
+
+    //老师端可申诉考勤时间限制(天)
+    String TEACHER_APP_SALARY_COMPLAINTS_TIME = "teacher_app_salary_complaints_time";
+    //后台老师考勤申诉时间限制
+    String WEB_TEACHER_COMPLAINTS_SALARY = "web_teacher_complaints_salary";
+
     //线下连堂课间隔时间
     String OFFLINE_CONTINUE_COURSE_MINUTES = "offline_continue_course_minutes";
     //学生允许请假的时间,为开课前{}小时

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

@@ -5,6 +5,8 @@ import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
 import com.ym.mec.biz.dal.entity.TenantOrderRecord;
 import com.ym.mec.common.page.PageInfo;
 
+import java.util.Map;
+
 /**
  * 机构付款记录表(TenantOrderRecord)表服务接口
  *
@@ -15,5 +17,7 @@ public interface TenantOrderRecordService extends IService<TenantOrderRecord> {
 
     PageInfo<TenantOrderRecord> queryPage(TenantOrderRecordDto dto);
 
+    Map<String, Object> checkTenantOrder(String orderNo);
+
 }
 

+ 243 - 25
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java

@@ -1,27 +1,32 @@
 package com.ym.mec.biz.service.impl;
 
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
+import com.ym.mec.biz.dal.enums.TenantOrderRecordEnum;
+import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.IdGeneratorService;
+import com.ym.mec.thirdparty.yqpay.Msg;
+import com.ym.mec.util.collection.MapUtil;
+import org.joda.time.LocalDateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.ym.mec.biz.dal.dao.CloudTeacherDao;
-import com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
-import com.ym.mec.biz.dal.entity.CloudTeacher;
-import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.PeriodEnum;
-import com.ym.mec.biz.service.CloudTeacherOrderService;
-import com.ym.mec.biz.service.StudentService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
@@ -29,24 +34,223 @@ import com.ym.mec.util.date.DateUtil;
 
 @Service
 public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTeacherOrder> implements CloudTeacherOrderService {
-
+    private static final Logger log = LoggerFactory.getLogger(TenantInfoServiceImpl.class);
     @Autowired
     private CloudTeacherOrderDao cloudTeacherOrderDao;
     @Autowired
     private CourseScheduleDao courseScheduleDao;
     @Autowired
     private CloudTeacherDao cloudTeacherDao;
-    
     @Autowired
     private StudentService studentService;
-
-
+    @Autowired
+    private SysConfigDao sysConfigDao;
+    @Autowired
+    private TenantConfigService tenantConfigService;
+    @Autowired
+    private PayService payService;
+    @Autowired
+    private IdGeneratorService idGenerator;
+    @Autowired
+    private TenantOrderRecordService tenantOrderRecordService;
     @Override
     public BaseDAO<Long, CloudTeacherOrder> getDAO() {
         return cloudTeacherOrderDao;
     }
 
     @Override
+    public PageInfo<CloudTeacherStudent> queryActiveRecord(CloudTeacherOrderQueryInfo queryInfo) {
+        PageInfo<CloudTeacherStudent> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        List<CloudTeacherStudent> dataList = null;
+        int count = cloudTeacherOrderDao.findRecordCount(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = cloudTeacherOrderDao.queryRecord(params);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+
+        return pageInfo;
+    }
+
+    @Override
+    public PageInfo<CloudTeacherStudent> queryInactive(CloudTeacherOrderQueryInfo queryInfo) throws Exception {
+        PageInfo<CloudTeacherStudent> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        List<CloudTeacherStudent> dataList = null;
+        int count = cloudTeacherOrderDao.findInactiveCount(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = cloudTeacherOrderDao.queryInactive(params);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+
+        if (count == 0) {
+            return pageInfo;
+        }
+        for (CloudTeacherStudent cst: dataList) {
+            TenantConfig tenantConfig = tenantConfigService.getOne(new QueryWrapper<TenantConfig>().eq("tenant_id_", cst.getTenantId()));
+            if (tenantConfig == null) {
+                throw new Exception("未找到组织Id " + cst.getTenantId().toString() + "在 TenantConfig 表");
+            }
+            JSONObject cfg = JSON.parseObject(tenantConfig.getConfig());
+            JSONObject memberConfig = (JSONObject) cfg.get("member_config");
+            Double divide;
+            switch (cst.getType()) {
+                case 1:
+                    divide = memberConfig.getDouble("day_divide");
+                    break;
+                case 2:
+                    divide = memberConfig.getDouble("month_divide");
+                    break;
+                case 3:
+                    divide = memberConfig.getDouble("quarter_divide");
+                    break;
+                case 4:
+                    divide = memberConfig.getDouble("half_year_divide");
+                    break;
+                case 5:
+                    divide = memberConfig.getDouble("year_divide");
+                    break;
+                default:
+                    divide = null;
+            }
+            if (divide == null) {
+                cst.setAmount(null);
+            } else {
+                cst.setAmount(new BigDecimal(divide * cst.getTime()));
+            }
+        }
+        return pageInfo;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Map<String, Object> pay(List<CloudTeacherStudent> cloudTeacherStudents) throws Exception {
+
+        if (cloudTeacherStudents.size() == 0) {
+            throw new Exception("至少选择一条记录");
+        }
+        Integer tenantId = null;
+        for (CloudTeacherStudent cts: cloudTeacherStudents) {
+            if (cts.getAmount() == null) {
+                throw new Exception("金额错误在, 学生编号: " + cts.getStudentId().toString());
+            }
+            if (tenantId == null) {
+                tenantId = cts.getTenantId();
+            }
+        }
+        BigDecimal sumAmount = new BigDecimal(0);
+        for (CloudTeacherStudent cts: cloudTeacherStudents) {
+            sumAmount = sumAmount.add(cts.getAmount());
+        }
+        return this.payExec(sumAmount, tenantId, cloudTeacherStudents);
+    }
+
+    /**
+     * 团练宝支付
+     * @param payAmount 金额
+     * @param tenantId 分部
+     * @return
+     */
+    private Map<String, Object> payExec(BigDecimal payAmount, Integer tenantId, List<CloudTeacherStudent> cloudTeacherStudents) throws Exception {
+        //生成订单编号
+        String orderNo = idGenerator.generatorId("payment") + "";
+        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+        TenantOrderRecordEnum tenantEnum = TenantOrderRecordEnum.CLOUD_TEACHER;
+
+        Map<String, Object> payMap = new HashMap<>();
+        int orderState = 0;
+        //消费大于0元则拉起支付
+        if (payAmount.compareTo(BigDecimal.ZERO) > 0) {
+            payMap = payService.getPayMap(
+                    payAmount,
+                    BigDecimal.ZERO,
+                    orderNo,
+                    baseApiUrl + "/api-web/cloudTeacherOrder/payNotify",
+                    baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
+                    tenantEnum.getMsg(),
+                    tenantEnum.getMsg(),
+                    1,//临时写死
+                    tenantEnum.getCode()
+            );
+        } else { // 消费大于 0 元 已支付 直接激活
+            orderState = 1;
+        }
+        createOrderRecord(tenantId, payAmount, orderNo, tenantEnum, orderState, cloudTeacherStudents);
+        log.info("tenant pay >>>>> " + JSON.toJSONString(payMap));
+        return payMap;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public Msg payNotify(Msg msg) {
+        log.info("tenant orderNotify >>>>> " + msg.toString());
+        msg.setMsg("fail");
+        Map<String, String> notifyMap = JSON.parseObject(msg.getResponseParameters(), Map.class);
+        TenantOrderRecord record = tenantOrderRecordService.getOne(
+                new QueryWrapper<TenantOrderRecord>().eq("order_no_", notifyMap.get("orderNo")));
+        record.setOrderNo(notifyMap.get("merMerOrderNo"));
+        record.setTransNo(notifyMap.get("orderNo"));
+        String channelType = notifyMap.get("channelType").equals("1") ? "WXPay" : (notifyMap.get("channelType").equals("2") ? "Alipay" : "quickPay");
+        record.setPayChannel(channelType);
+
+        //支付中订单存在,更新状态
+        if (msg.getResponseType().equals("1") && notifyMap.size() > 0 && msg.getCode().equals("88")) {
+            //tradeState 88就是正确的 其他错误的
+            //            DealStatusEnum
+            //            notifyMap.put("totalMoney", notifyMap.get("payAmount"));
+            log.info("tenant orderNotify update order status start" + record.getId().toString());
+            cloudTeacherOrderDao.updateOrderStatusOK(record.getId());
+            log.info("tenant orderNotify update order status end");
+            record.setOrderState(1);
+            msg.setCode("000000");
+            msg.setMsg("success");
+        } else {
+            log.info("tenant orderNotify fail");
+            //支付失败
+            record.setOrderState(2);
+        }
+        tenantOrderRecordService.update(record, new QueryWrapper<TenantOrderRecord>()
+                .eq("order_no_", record.getOrderNo()));
+        log.info("tenant orderNotify return>>>>> " + msg.toString());
+        return msg;
+    }
+
+    public Boolean payCheck(String orderNo) {
+        TenantOrderRecord record = tenantOrderRecordService.getOne(new QueryWrapper<TenantOrderRecord>().eq("order_no_", orderNo));
+        return record.getOrderState() == 1;
+    }
+
+    private void createOrderRecord(Integer tenantId, BigDecimal payAmount, String orderNo, TenantOrderRecordEnum tenantEnum, Integer orderState, List<CloudTeacherStudent> cloudTeacherStudents) {
+        LocalDateTime now = LocalDateTime.now();
+        TenantOrderRecord record = new TenantOrderRecord();
+        record.setTenantId(tenantId);
+        record.setOrderNo(orderNo);
+        record.setOrderType(tenantEnum.getCode());
+        record.setPaymentChannel(PaymentChannelEnum.ADAPAY.getCode());
+        record.setExpectAmount(payAmount);
+        record.setActualAmount(payAmount);
+        record.setOrderState(orderState);
+        record.setPayDate(now.toLocalDate().toDate());
+        record.setPayTime(now.toDate());
+        record.setCreatedTime(now.toDate());
+        tenantOrderRecordService.save(record);
+        for (CloudTeacherStudent cts : cloudTeacherStudents) {
+            cloudTeacherOrderDao.updateOrderId(cts.getCloudTeacherOrderId(), cts.getAmount(), record.getId());
+        }
+    }
+
+    @Override
     @Transactional(rollbackFor = Exception.class)
 	public Boolean addOrderDetail2CloudTeacher(StudentPaymentOrder order,BigDecimal cloudTeacherFee) {
 		CloudTeacherOrder cloudTeacherOrder = cloudTeacherOrderDao.queryByOrderId(order.getId());
@@ -83,8 +287,14 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
 			periodEnum = PeriodEnum.MONTH;
 			break;
 		case 3:
-			periodEnum = PeriodEnum.YEAR;
+			periodEnum = PeriodEnum.QUARTERLY;
 			break;
+        case 4:
+            periodEnum = PeriodEnum.YEAR_HALF;
+            break;
+        case 5:
+            periodEnum = PeriodEnum.YEAR;
+            break;
 
 		default:
 			break;
@@ -96,14 +306,18 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
             cloudTeacher = new CloudTeacher();
             startTime = DateUtil.trunc(nowDate);
             endBaseTime = startTime;
-            if (cloudTeacherOrder.getType().equals(1)) {
+            if (cloudTeacherOrder.getType().equals(1)) { // 日
                 endTime = DateUtil.addDays(startTime, cloudTeacherOrder.getTime());
-            } else if (cloudTeacherOrder.getType().equals(2)) {
+            } else if (cloudTeacherOrder.getType().equals(2)) { // 月
                 endTime = DateUtil.addMonths(startTime, cloudTeacherOrder.getTime());
-            } else if (cloudTeacherOrder.getType().equals(3)) {
+            } else if (cloudTeacherOrder.getType().equals(3)) { // 季
+                endTime = DateUtil.addMonths(startTime, cloudTeacherOrder.getTime() * 3);
+            } else if (cloudTeacherOrder.getType().equals(4)) { // 半年
+                endTime = DateUtil.addMonths(startTime, cloudTeacherOrder.getTime() * 6);
+            } else if (cloudTeacherOrder.getType().equals(5)) { // 年
                 endTime = DateUtil.addYears(startTime, cloudTeacherOrder.getTime());
             }
-            cloudTeacher.setStudentId(cloudTeacherOrder.getStudentId());
+        cloudTeacher.setStudentId(cloudTeacherOrder.getStudentId());
             cloudTeacher.setLevel(cloudTeacherOrder.getLevel());
             cloudTeacher.setStartTime(startTime);
             cloudTeacher.setEndTime(endTime);
@@ -115,11 +329,15 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
                 startTime = DateUtil.trunc(nowDate);
                 endBaseTime = startTime;
             }
-            if (cloudTeacherOrder.getType().equals(1)) {
+            if (cloudTeacherOrder.getType().equals(1)) { // 日
                 endTime = DateUtil.addDays(endBaseTime, cloudTeacherOrder.getTime());
-            } else if (cloudTeacherOrder.getType().equals(2)) {
+            } else if (cloudTeacherOrder.getType().equals(2)) { // 月
                 endTime = DateUtil.addMonths(endBaseTime, cloudTeacherOrder.getTime());
-            } else if (cloudTeacherOrder.getType().equals(3)) {
+            } else if (cloudTeacherOrder.getType().equals(3)) { // 季
+                endTime = DateUtil.addMonths(endBaseTime, cloudTeacherOrder.getTime() * 3);
+            } else if (cloudTeacherOrder.getType().equals(4)) { // 半年
+                endTime = DateUtil.addMonths(endBaseTime, cloudTeacherOrder.getTime() * 6);
+            } else if (cloudTeacherOrder.getType().equals(5)) { // 年
                 endTime = DateUtil.addYears(endBaseTime, cloudTeacherOrder.getTime());
             }
             cloudTeacher.setStartTime(startTime);

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

@@ -217,10 +217,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}
 
 		currentCourseDetail.setCurrentClassTimes(courseScheduleDao.countClassGroupOverCourseNum(currentCourseDetail.getClassId()));
-        SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
+//        SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
         String sysConfigVip = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP,user.getTenantId());
-        currentCourseDetail.setEnableStudentAttendanceTimeRange(sysConfig.getParanValue(Integer.class));
-        currentCourseDetail.setEnableStudentAttendanceTimeRangeVip(StringUtils.isEmpty(sysConfigVip)?0:Integer.parseInt(sysConfigVip));
+//        currentCourseDetail.setEnableStudentAttendanceTimeRange(sysConfig.getParanValue(Integer.class));
+        currentCourseDetail.setEnableStudentAttendanceTimeRangeVip(StringUtils.isEmpty(sysConfigVip)?20:Integer.parseInt(sysConfigVip));
         int studentNum = studentAttendanceDao.countByCourseSchedule(courseID);
         if (Objects.nonNull(studentNum)) {
             currentCourseDetail.setStudentAttendanceIsFirstTime(studentNum > 0 ? 0 : 1);
@@ -1055,7 +1055,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             throw new BizException("用户机构信息异常");
         }
         Date now = new Date();
-		String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP, user.getTenantId());
+//		String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP, user.getTenantId());
 		String courseBeforeBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_BEFORE_BUFFER_TIME, user.getTenantId());
 		String courseAfterBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_AFTER_BUFFER_TIME, user.getTenantId());
         Map<String, Object> result = new HashMap<>(7);
@@ -1067,6 +1067,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}
 		result.put("advanceLeaveHours", advanceLeaveHours);
         result.put("earliestTimeForLeave", Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.EARLIEST_TIME_FOR_LEAVE)));
+		//网络教室可以提前进入时间:对内和对外开课时间 (对内:joinRoomBeforeTime 对外:courseBeforeBufferTime)
         result.put("joinRoomBeforeTime",StringUtils.isEmpty(courseBeforeBufferTime)?10:Integer.parseInt(courseBeforeBufferTime));
 		result.put("courseBeforeBufferTime", StringUtils.isEmpty(courseBeforeBufferTime)?10:Integer.parseInt(courseBeforeBufferTime));
 		result.put("courseAfterBufferTime", StringUtils.isEmpty(courseAfterBufferTime)?10:Integer.parseInt(courseAfterBufferTime));

+ 35 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -279,7 +279,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             //判断课程是否在试用期内
             if(isTrail(teacher,courseScheduleTeacherSalary.getCourseSchedule().getClassDate())){
-                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100));
+                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100)).setScale(0,BigDecimal.ROUND_HALF_UP);
                 deductReasons.add("未转正");
             }
 
@@ -395,7 +395,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             //判断课程是否在试用期内
             //如果上课日期在试用期内按80%结算
             if(isTrail(teacher,courseScheduleTeacherSalary.getCourseSchedule().getClassDate())){
-                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100));
+                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100)).setScale(0,BigDecimal.ROUND_HALF_UP);
                 deductReasons.add("未转正");
             }
             //扣除费用
@@ -538,7 +538,12 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             }
             //是否异常签到
             if(signCourseTimeBetween >= 0 && signCourseTimeBetween < i){
-                return SalarySettlementSignEnum.ERR_IN;
+                if(teachModeEnum == TeachModeEnum.ONLINE){
+                    //线上课,没有异常签到
+                    return SalarySettlementSignEnum.LATE;
+                }else {
+                    return SalarySettlementSignEnum.ERR_IN;
+                }
             }
         }
         //迟到规则
@@ -769,7 +774,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             //如果上课日期在试用期内按80%结算
             if(isTrail(teacher,courseSchedule.getClassDate())){
-                teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary/100));
+                teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary/100)).setScale(0,BigDecimal.ROUND_HALF_UP);
                 deductReasons.add("未转正");
             }
 
@@ -1659,21 +1664,21 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
         //试用期课酬规则
         String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
-        Integer probationTeacherSalary = 100;
+        double probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
-            probationTeacherSalary = Integer.parseInt(configValue2);
+            probationTeacherSalary = Double.parseDouble(configValue2);
         }
         //如果上课日期在试用期内按80%结算
         BigDecimal expectTeacherSalary = teacherSalary;
         if(isTrail(teacher,courseSchedule.getClassDate())){
-            teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary / 100));
+            teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary / 100)).setScale(0,BigDecimal.ROUND_HALF_UP);
             deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.TRAIL, expectTeacherSalary.subtract(teacherSalary)));
         }
 
         //扣除费用
         BigDecimal deductCost = BigDecimal.ZERO;
         //获取签到状态
-        TeachModeEnum teachMode = courseScheduleTeacherSalary.getCourseSchedule().getTeachMode();
+        TeachModeEnum teachMode = courseSchedule.getTeachMode();
         TeacherAttendance teacherAttendance = null;
         if(teacherAttendances != null && teacherAttendances.size() > 0){
             teacherAttendance = teacherAttendances.get(0);
@@ -1686,7 +1691,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             BigDecimal signInDeductCost = getSignInDeduce(teacherSalary, signInStatus, teachMode,tenantId);
             if(signInDeductCost.compareTo(BigDecimal.ZERO) > 0){
                 deductCost = deductCost.add(signInDeductCost);
-                deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_IN_TIME_ERR, teacherSalary.subtract(signInDeductCost)));
+                deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_IN_TIME_ERR, signInDeductCost));
             }
         }
         if(teacherAttendance.getSignOutStatus() == null || teacherAttendance.getSignOutStatus() == YesOrNoEnum.NO){
@@ -1694,7 +1699,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             BigDecimal signOutDeductCost = getSignInDeduce(teacherSalary, signOutStatus, teachMode,tenantId);
             if(signOutDeductCost.compareTo(BigDecimal.ZERO) > 0){
                 deductCost = deductCost.add(signOutDeductCost);
-                deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_OUT_TIME_ERR, teacherSalary.subtract(signOutDeductCost)));
+                deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_OUT_TIME_ERR, signOutDeductCost));
             }
         }
 
@@ -1714,7 +1719,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     String c1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_SIGN_IN_GPS_ERROR_CUT_SALARY_UNIT, tenantId);
                     BigDecimal signInGpsCutAmount = getCutAmount(c, c1, teacherSalary);
                     if(signInGpsCutAmount.compareTo(BigDecimal.ZERO) > 0){
-                        deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_IN, teacherSalary.subtract(signInGpsCutAmount)));
+                        deductCost = deductCost.add(signInGpsCutAmount);
+                        deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_IN, signInGpsCutAmount));
                     }
                 }
                 if(!signOutRange){
@@ -1722,7 +1728,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     String c1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_SIGN_OUT_GPS_ERROR_CUT_SALARY_UNIT, tenantId);
                     BigDecimal signOutGpsCutAmount = getCutAmount(c, c1, teacherSalary);
                     if(signOutGpsCutAmount.compareTo(BigDecimal.ZERO) > 0){
-                        deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_OUT, teacherSalary.subtract(signOutGpsCutAmount)));
+                        deductCost = deductCost.add(signOutGpsCutAmount);
+                        deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_OUT, signOutGpsCutAmount));
                     }
                 }
             }
@@ -1763,14 +1770,14 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
         //试用期课酬规则
         String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
-        Integer probationTeacherSalary = 100;
+        double probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
-            probationTeacherSalary = Integer.parseInt(configValue2);
+            probationTeacherSalary = Double.parseDouble(configValue2);
         }
         //如果上课日期在试用期内按80%结算
         BigDecimal expectTeacherSalary = expectSalary;
         if(isTrail(teacher,courseSchedule.getClassDate())){
-            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100));
+            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100)).setScale(0,BigDecimal.ROUND_HALF_UP);
             deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.TRAIL, expectTeacherSalary.subtract(expectSalary)));
         }
         //扣除费用
@@ -1782,7 +1789,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 String c1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_SIGN_IN_GPS_ERROR_CUT_SALARY_UNIT, tenantId);
                 BigDecimal signInGpsCutAmount = getCutAmount(c, c1, expectSalary);
                 if(signInGpsCutAmount.compareTo(BigDecimal.ZERO) > 0){
-                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_IN, expectSalary.subtract(signInGpsCutAmount)));
+                    deductCost = deductCost.add(signInGpsCutAmount);
+                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_IN, signInGpsCutAmount));
                 }
             }
             if(true){
@@ -1790,7 +1798,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 String c1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_SIGN_OUT_GPS_ERROR_CUT_SALARY_UNIT, tenantId);
                 BigDecimal signOutGpsCutAmount = getCutAmount(c, c1, expectSalary);
                 if(signOutGpsCutAmount.compareTo(BigDecimal.ZERO) > 0){
-                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_OUT, expectSalary.subtract(signOutGpsCutAmount)));
+                    deductCost = deductCost.add(signOutGpsCutAmount);
+                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.GPS_ERR_OUT, signOutGpsCutAmount));
                 }
             }
         }else {
@@ -1806,7 +1815,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 BigDecimal signInDeductCost = getSignInDeduce(expectSalary, signInStatus, teachMode,tenantId);
                 if(signInDeductCost.compareTo(BigDecimal.ZERO) > 0){
                     deductCost = deductCost.add(signInDeductCost);
-                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_IN_TIME_ERR, expectSalary.subtract(signInDeductCost)));
+                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_IN_TIME_ERR, signInDeductCost));
                 }
             }
             if(teacherAttendance.getSignOutStatus() == null || teacherAttendance.getSignOutStatus() == YesOrNoEnum.NO){
@@ -1814,7 +1823,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 BigDecimal signOutDeductCost = getSignInDeduce(expectSalary, signOutStatus, teachMode,tenantId);
                 if(signOutDeductCost.compareTo(BigDecimal.ZERO) > 0){
                     deductCost = deductCost.add(signOutDeductCost);
-                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_OUT_TIME_ERR, expectSalary.subtract(signOutDeductCost)));
+                    deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.SIGN_OUT_TIME_ERR, signOutDeductCost));
                 }
             }
         }
@@ -1854,13 +1863,13 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         //如果上课日期在试用期内按80%结算
         //试用期课酬规则
         String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
-        Integer probationTeacherSalary = 100;
+        double probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
-            probationTeacherSalary = Integer.parseInt(configValue2);
+            probationTeacherSalary = Double.parseDouble(configValue2);
         }
         BigDecimal expectTeacherSalary = expectSalary;
         if(isTrail(teacher,courseSchedule.getClassDate())){
-            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100));
+            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100)).setScale(0,BigDecimal.ROUND_HALF_UP);
             deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.TRAIL, expectTeacherSalary.subtract(expectSalary)));
         }
 
@@ -1921,7 +1930,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         if(BigDecimal.ZERO.compareTo(teacherSalaryOverview.getThisMonthExpectIncome())>0){
             teacherSalaryOverview.setThisMonthExpectIncome(BigDecimal.ZERO);
         }
-
+        String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.TEACHER_APP_SALARY_COMPLAINTS_TIME, tenantId);
+        if(StringUtils.isNotEmpty(configValue)){
+            teacherSalaryOverview.setComplaintsDaysRange(Integer.parseInt(configValue));
+        }
         List<CourseSchedule> teacherCourses = courseScheduleDao.getTeacherCourseWithClassDate(queryInfo.getTeacherId(), queryInfo.getStartDay(), queryInfo.getEndDay(), CourseStatusEnum.OVER, queryInfo.getTeachIncomeType());
         if(CollectionUtils.isEmpty(teacherCourses)){
             return teacherSalaryOverview;

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberPaymentCalenderServiceImpl.java

@@ -10,12 +10,15 @@ import com.ym.mec.biz.dal.enums.PeriodEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
 import com.ym.mec.common.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
 
 import java.math.BigDecimal;
 
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 
+@Service(value = "memberCalenderService")
 public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalenderBaseService {
 
     @Autowired
@@ -45,6 +48,15 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
         return NO;
     }
 
+    @Override
+    public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
+        CalenderMemberDto calenderMember = baseCalender.getCalenderMember();
+        if(calenderMember != null){
+            return calenderMember.getActualAmount();
+        }
+        return BigDecimal.ZERO;
+    }
+
     private BigDecimal getGroupPurchaseFee(PeriodEnum periodEnum,MemberFeeSetting memberFee){
         switch (periodEnum){
             case MONTH :

+ 45 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java

@@ -0,0 +1,45 @@
+package com.ym.mec.biz.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderActivityDao;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderActivityService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
+import org.springframework.stereotype.Service;
+import java.math.BigDecimal;
+import java.util.List;
+
+@Service
+public class MusicGroupPaymentCalenderActivityServiceImpl extends ServiceImpl<MusicGroupPaymentCalenderActivityDao, MusicGroupPaymentCalenderActivity>
+        implements MusicGroupPaymentCalenderActivityService, MusicGroupPaymentCalenderBaseService {
+
+    @Override
+    public void createComponent(MusicGroupPaymentBaseCalender baseCalender) {
+
+    }
+
+    @Override
+    public MusicGroupPaymentCalender.PaymentCalenderStatusEnum checkComponentAmount(MusicGroupPaymentBaseCalender baseCalender) {
+        return null;
+    }
+
+    @Override
+    public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
+        List<MusicGroupPaymentCalenderActivity> calenderActivityList = baseCalender.getCalenderActivityList();
+        if(calenderActivityList != null && calenderActivityList.size() > 0){
+            return calenderActivityList.stream().map(e->e.getActualAmount()).reduce(BigDecimal.ZERO,BigDecimal::add);
+        }
+        return BigDecimal.ZERO;
+    }
+
+    @Override
+    public void batchInsert(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender, Long calenderId) {
+        List<MusicGroupPaymentCalenderActivity> calenderActivityList = musicGroupPaymentBaseCalender.getCalenderActivityList();
+        if(calenderActivityList != null && calenderActivityList.size() > 0){
+            calenderActivityList.stream().forEach(e->e.setCalenderId(calenderId));
+            baseMapper.insertBatch(calenderActivityList);
+        }
+    }
+}

+ 43 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
 import com.ym.mec.biz.dal.dao.OrganizationCourseUnitPriceSettingsDao;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.service.MusicGroupOrganizationCourseSettingsService;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
 import com.ym.mec.common.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +36,8 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 	private MusicGroupOrganizationCourseSettingsDetailDao musicGroupOrganizationCourseSettingsDetailDao;
 	@Autowired
 	private OrganizationCourseUnitPriceSettingsDao organizationCourseUnitPriceSettingsDao;
+	@Autowired
+	private MusicGroupOrganizationCourseSettingsService musicGroupOrganizationCourseSettingsService;
 
 	@Override
 	public BaseDAO<Integer, MusicGroupPaymentCalenderCourseSettings> getDAO() {
@@ -63,6 +66,37 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 		return result;
 	}
 
+    @Override
+    public void batchInsert(MusicGroupPaymentCalender musicGroupPaymentCalender) {
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingss = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList();
+		if (musicGroupPaymentCalenderCourseSettingss != null && musicGroupPaymentCalenderCourseSettingss.size() > 0) {
+			MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsService.get(musicGroupPaymentCalender
+					.getMusicGroupOrganizationCourseSettingId());
+			for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingss) {
+				musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+				if (courseSettings != null) {
+					musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
+				}
+			}
+			musicGroupPaymentCalenderCourseSettingsDao.batchInsert(musicGroupPaymentCalenderCourseSettingss);
+		}
+    }
+
+	@Override
+	public void deleteByMusicGroupPaymentCalenderId(List<Long> calenderIds) {
+		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
+	}
+
+	@Override
+	public List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettings(Long calenderId) {
+		return musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderId);
+	}
+
+	@Override
+	public List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettingsByBatchNo(String batchNo) {
+		return musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo);
+	}
+
 	@Override
 	public void createComponent(MusicGroupPaymentBaseCalender baseCalender) {
 
@@ -115,4 +149,13 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 		}
 		return MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 	}
+
+	@Override
+	public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = baseCalender.getMusicGroupPaymentCalenderCourseSettingsList();
+		if(musicGroupPaymentCalenderCourseSettingsList != null && musicGroupPaymentCalenderCourseSettingsList.size() > 0){
+			return musicGroupPaymentCalenderCourseSettingsList.stream().map(e -> e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+		}
+		return BigDecimal.ZERO;
+	}
 }

+ 63 - 163
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -26,6 +26,7 @@ import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
@@ -49,6 +50,9 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import org.springframework.util.Assert;
+
+import javax.annotation.Resource;
 
 @Service
 public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalender> implements MusicGroupPaymentCalenderService {
@@ -59,46 +63,32 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 	@Autowired
 	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
-	
 	@Autowired
-	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
-	
+	private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
 	@Autowired
 	private MusicGroupOrganizationCourseSettingsDetailDao musicGroupOrganizationCourseSettingsDetailDao;
-
 	@Autowired
 	private MusicGroupOrganizationCourseSettingsService musicGroupOrganizationCourseSettingsService;
-	
 	@Autowired
 	private OrganizationCourseUnitPriceSettingsDao organizationCourseUnitPriceSettingsDao;
-	
 	@Autowired
 	private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
-
 	@Autowired
 	private MusicGroupSchoolTermCourseDetailDao musicGroupSchoolTermCourseDetailDao;
-
 	@Autowired
 	private MusicGroupSchoolTermStudentCourseDetailDao musicGroupSchoolTermStudentCourseDetailDao;
-	
 	@Autowired
 	private IdGeneratorService idGeneratorService;
-	
 	@Autowired
 	private ClassGroupService classGroupService;
-	
 	@Autowired
 	private MusicGroupDao musicGroupDao;
-
 	@Autowired
 	private ClassGroupDao classGroupDao;
-
 	@Autowired
 	private CourseScheduleDao courseScheduleDao;
-
 	@Autowired
 	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
-
 	@Autowired
 	private TeacherAttendanceDao teacherAttendanceDao;
 	@Autowired
@@ -127,7 +117,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private StudentRegistrationDao studentRegistrationDao;
 	@Autowired
 	private GroupEventSource groupEventSource;
-
 	@Autowired
 	private StudentPaymentOrderDao studentPaymentOrderDao;
 	@Autowired
@@ -139,7 +128,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Autowired
 	private CloudTeacherOrderDao cloudTeacherOrderDao;
 	@Autowired
-	private MusicGroupPaymentCalenderBaseService musicGroupPaymentCalenderBaseService;
+	private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
+	@Resource(name = "musicRepairService")
+	private MusicGroupPaymentCalenderBaseService musicRepairService;
+	@Resource(name = "memberCalenderService")
+	private MusicGroupPaymentCalenderBaseService memberCalenderService;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -462,20 +455,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
 
 			//课程费用列表
-			List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
-					.getMusicGroupPaymentCalenderCourseSettingsList();
-
-			if (currentMusicGroupPaymentCalenderCourseSettings != null && currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
-				MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsService.get(musicGroupPaymentCalender
-						.getMusicGroupOrganizationCourseSettingId());
-				for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : currentMusicGroupPaymentCalenderCourseSettings) {
-					musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-					if (courseSettings != null) {
-						musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
-					}
-				}
-				musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
-			}
+			musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
 
 			//如果是跨团班级合并,保存用户缴费详情
 			List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = null;
@@ -488,7 +468,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			if (musicGroupPaymentCalender.getStatus() != AUDITING) {
 				// 如果是进行中加学生
 				if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
-					addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings,musicGroup);
+					addStudent(musicGroupPaymentCalender, musicGroupPaymentCalender
+							.getMusicGroupPaymentCalenderCourseSettingsList(),musicGroup);
 				}else if(musicGroupPaymentCalender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
 					//如果是跨团班级合并,添加学员
 					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender,musicGroupPaymentCalenderStudentDetails);
@@ -544,13 +525,17 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public String create1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
+		if(musicGroupPaymentBaseCalender == null){
+			throw new BizException("参数校验异常");
+		}
+		if(musicGroupPaymentBaseCalender.getCalenderActivityList() == null
+				&& musicGroupPaymentBaseCalender.getCalenderMember() == null
+				&& musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList() == null
+				&& musicGroupPaymentBaseCalender.getMusicRepair() == null){
+			throw new BizException("请选择一个缴费项目");
+		}
 
 		String musicGroupId = musicGroupPaymentBaseCalender.getMusicGroupId();
-
-		PaymentType paymentType = musicGroupPaymentBaseCalender.getPaymentType();
-
-		PayUserType payUserType = musicGroupPaymentBaseCalender.getPayUserType();
-
 		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
 		if (musicGroup == null) {
 			throw new BizException("乐团查询失败,请检查参数");
@@ -584,95 +569,17 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		Date date = new Date();
 		String batchNo = idGeneratorService.generatorId() + "";
 
-		// 获取设置的课程收费标准
-//		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList();
-
-		//会员原价
-//		BigDecimal memberPaymentAmount = BigDecimal.ZERO;
 		BigDecimal originalMemberPaymentAmount = BigDecimal.ZERO;
-		if (payUserType == SCHOOL) {
+		if (musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
 			status = AUDITING;
 		} else {
-			status = musicGroupPaymentCalenderBaseService.checkComponentAmount(musicGroupPaymentBaseCalender);
-//			if(musicGroupPaymentCalenderCourseSettingsList != null){
-//				if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
-//					// 当前缴费的课程费用
-//					Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
-//							Collectors
-//									.toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
-//
-//					// 查询默认课程费用
-//					Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
-//					Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
-//							.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
-//							.stream()
-//							.collect(
-//									Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
-//											MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
-//
-//					// 相同类型的课程如果修改了课程费用,需要走审批
-//					for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
-//						if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
-//							status = AUDITING;
-//							break;
-//						}
-//					}
-//				} else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
-//					PaymentCalenderStatusEnum dtoStatus = musicGroupPaymentCalenderDto.getStatus();
-//					if(dtoStatus != null && dtoStatus == AUDITING){
-//						status = AUDITING;
-//					}else {
-//						// 如果是课程收费,判断是否审核
-//						for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
-//							OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
-//									musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
-//							if (defaultUnitPrice == null) {
-//								throw new BizException("请先设置分部课程类型单价");
-//							}
-//							if (courseSettings.getCourseTotalMinuties() != 0) {
-//
-//								if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
-//										.compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
-//
-//									status = AUDITING;
-//									break;
-//								}
-//							} else {
-//								status = AUDITING;
-//								break;
-//							}
-//						}
-//					}
-//				}else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
-//					status = musicGroupPaymentCalenderDto.getStatus();
-//				}
-//			}
-//			if(musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
-//				//会员价格是否变动
-//				MemberFeeSetting memberFee = memberFeeSettingDao.findByRankIdAndOrganId(musicGroup.getOrganId(), musicGroupPaymentCalenderDto.getMemberRankSettingId());
-//				if(memberFee == null){
-//					throw new BizException("操作失败:请配置当前分部会员收费标准");
-//				}
-//				switch (musicGroupPaymentCalenderDto.getMemberValidDate()){
-//					case 1 :
-//						memberPaymentAmount = memberFee.getGroupPurchaseMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						originalMemberPaymentAmount = memberFee.getOriginalMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						break;
-//					case 6 :
-//						memberPaymentAmount = memberFee.getGroupPurchaseHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						originalMemberPaymentAmount = memberFee.getOriginalHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						break;
-//					case 12 :
-//						memberPaymentAmount = memberFee.getGroupPurchaseYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						originalMemberPaymentAmount = memberFee.getOriginalYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						break;
-//					default:
-//						throw new BizException("请选择正确的会员有效期");
-//				}
-//				if(memberPaymentAmount.compareTo(musicGroupPaymentCalenderDto.getMemberPaymentAmount()) != 0){
-//					status = AUDITING;
-//				}
-//			}
+			status = memberCalenderService.checkComponentAmount(musicGroupPaymentBaseCalender);
+			if(status != AUDITING){
+				status = ((MusicGroupPaymentCalenderCourseSettingsServiceImpl)musicGroupPaymentCalenderCourseSettingsService).checkComponentAmount(musicGroupPaymentBaseCalender);
+			}
+			if(status != AUDITING){
+				status = musicRepairService.checkComponentAmount(musicGroupPaymentBaseCalender);
+			}
 		}
 
 		MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
@@ -681,29 +588,38 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalender.setMemo(musicGroupPaymentBaseCalender.getMemo());
 		musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
 		musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentBaseCalender.getMusicGroupOrganizationCourseSettingId());
-		BigDecimal totalPaymentAmount = BigDecimal.ZERO;
 		musicGroupPaymentCalender.setPayUserType(musicGroupPaymentBaseCalender.getPayUserType());
 		musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentBaseCalender.getStartPaymentDate());
 		musicGroupPaymentCalender.setOperator(sysUser.getId());
 		musicGroupPaymentCalender.setCreateTime(date);
 		musicGroupPaymentCalender.setUpdateTime(date);
 		musicGroupPaymentCalender.setStatus(status);
+		musicGroupPaymentCalender.setPaymentType(musicGroupPaymentBaseCalender.getPaymentType());
+
+		BigDecimal totalPaymentAmount = BigDecimal.ZERO;
+		totalPaymentAmount = totalPaymentAmount.add(memberCalenderService.getActualAmount(musicGroupPaymentBaseCalender));
+		totalPaymentAmount = totalPaymentAmount.add(((MusicGroupPaymentCalenderCourseSettingsServiceImpl)musicGroupPaymentCalenderCourseSettingsService).getActualAmount(musicGroupPaymentBaseCalender));
+		totalPaymentAmount = totalPaymentAmount.add(musicRepairService.getActualAmount(musicGroupPaymentBaseCalender));
+		totalPaymentAmount = totalPaymentAmount.add(((MusicGroupPaymentCalenderActivityServiceImpl)musicGroupPaymentCalenderActivityService).getActualAmount(musicGroupPaymentBaseCalender));
+		musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
+
+		//会员缴费信息
 		CalenderMemberDto calenderMember = musicGroupPaymentBaseCalender.getCalenderMember();
 		if(calenderMember != null){
 			//设置会员缴费金额、级别以及有效期
-			totalPaymentAmount.add(calenderMember.getActualAmount());
 			musicGroupPaymentCalender.setMemberPaymentAmount(calenderMember.getActualAmount());
 			musicGroupPaymentCalender.setMemberRankSettingId(calenderMember.getMemberRankSettingId());
 			musicGroupPaymentCalender.setMemberValidDate(calenderMember.getMemberNum());
 			musicGroupPaymentCalender.setMemberPeriod(calenderMember.getPeriodEnum());
+			musicGroupPaymentCalender.setMemberOptionalFlag(calenderMember.getOptionalFlag());
 		}
-		//课程费用列表
-		List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
-				.getMusicGroupPaymentCalenderCourseSettingsList();
-		if (currentMusicGroupPaymentCalenderCourseSettings != null && currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
-			totalPaymentAmount.add(currentMusicGroupPaymentCalenderCourseSettings.stream().map(e -> e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO, BigDecimal::add));
+		//乐保缴费信息
+		MusicRepairDto musicRepair = musicGroupPaymentBaseCalender.getMusicRepair();
+		if(musicRepair != null){
+			musicGroupPaymentCalender.setMusicRepairNum(musicRepair.getNum());
+			musicGroupPaymentCalender.setMusicRepairActualPrice(musicRepair.getActualAmount());
+			musicGroupPaymentCalender.setMusicRepairOptionalFlag(musicRepair.getOptionalFlag());
 		}
-		musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
 
 //		BigDecimal totalPaymentAmount = musicGroupPaymentCalenderDto.getMasterTotalPrice();
 //		if(musicGroupPaymentCalenderCourseSettingsList != null){
@@ -732,9 +648,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 //		}
 
 		//缴费截止日期默认三天后
-		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
-			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
-		}
+//		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
+//			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
+//		}
 
 		if (musicGroupPaymentCalender.getStatus() != AUDITING) {
 			if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
@@ -750,20 +666,13 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalender.setBatchNo(batchNo);
 		musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
 
-		if (currentMusicGroupPaymentCalenderCourseSettings != null && currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
-			MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsService.get(musicGroupPaymentCalender
-					.getMusicGroupOrganizationCourseSettingId());
-			for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : currentMusicGroupPaymentCalenderCourseSettings) {
-				musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-				if (courseSettings != null) {
-					musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
-				}
-			}
-			musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
-		}
+		//课程费用列表
+		musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
+		//活动费用列表
+		musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender,musicGroupPaymentCalender.getId());
 
 		// 如果是报名,需要修改乐团状态
-		if (paymentType == MUSIC_APPLY) {
+		if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY) {
 			if (status != AUDITING) {
 				musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
 				// 记录操作日志
@@ -797,7 +706,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		BigDecimal sumActualAmount = musicGroupPaymentCalenderDetailDao.sumActualAmount(id);
 		//收费标准名称
 		String name = musicGroupPaymentCalenderDao.getCalenderSettingsName(id);
-		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(id);
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(id);
 		Map<String, Object> result = new HashMap<>(4);
 		result.put("musicGroupPaymentCalenderCourseSettings", musicGroupPaymentCalenderCourseSettings);
 		if(calender.getMemberRankSettingId() != null){
@@ -859,7 +768,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		List<Long> calenderIds = musicGroupPaymentCalenderList.stream().map(MusicGroupPaymentCalender :: getId).collect(Collectors.toList());
 		//删除原来数据
 		musicGroupPaymentCalenderDao.delByIds(calenderIds);
-		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
+		musicGroupPaymentCalenderCourseSettingsService.deleteByMusicGroupPaymentCalenderId(calenderIds);
 
 		status = PaymentCalenderStatusEnum.NO;
 
@@ -1131,17 +1040,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
 			}
 
-			if (currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
-				MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsService.get(musicGroupPaymentCalender
-						.getMusicGroupOrganizationCourseSettingId());
-				for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : currentMusicGroupPaymentCalenderCourseSettings) {
-					musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-					if (courseSettings != null) {
-						musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
-					}
-				}
-				musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
-			}
+			//课程费用列表
+			musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
 		}
 
 		// 如果是报名,需要修改乐团状态
@@ -1457,7 +1357,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 		}
 		//获取收费标准
-		calenderAuditDetailDto.setMusicGroupPaymentCalenderCourseSettings(musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo));
+		calenderAuditDetailDto.setMusicGroupPaymentCalenderCourseSettings(musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettingsByBatchNo(batchNo));
 		//获取跨团合班学员缴费详情
 		calenderAuditDetailDto.setMusicGroupPaymentCalenderStudentDetails(musicGroupPaymentCalenderStudentDetailDao.findByBatchNo(batchNo));
 		return calenderAuditDetailDto;
@@ -1561,7 +1461,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 				if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
 					musicGroupPaymentCalender.setExpectNum(1);
-					List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
+					List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
 					addStudent(musicGroupPaymentCalender,musicGroupPaymentCalenderCourseSettings,musicGroup);
 				}
 			}
@@ -1609,7 +1509,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				String classGroupIdStr = calender.getAttribute1();
 				if (StringUtils.isNotBlank(classGroupIdStr)) {
 					classGroupService.addStudentToClassGroupAndCourseArranging(Integer.parseInt(calender.getStudentIds()), classGroupIdStr, batchNo,
-							musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo),musicGroup);
+							musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettingsByBatchNo(batchNo),musicGroup);
 				}
 				MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
 				if(musicGroupStudentClassAdjust != null){
@@ -1835,7 +1735,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		
 		List<Long> calenderIds = new ArrayList<Long>();
 		calenderIds.add(id);
-		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
+		musicGroupPaymentCalenderCourseSettingsService.deleteByMusicGroupPaymentCalenderId(calenderIds);
 		
 		//如果乐团是“费用审核”,则需要修改状态
 		MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId());

+ 11 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicRepairPaymentCalenderServiceImpl.java

@@ -1,10 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dto.CalenderMemberDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.dto.MusicRepairDto;
-import com.ym.mec.biz.dal.entity.MemberFeeSetting;
-import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
 import com.ym.mec.biz.service.SysConfigService;
@@ -13,12 +10,14 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 
+@Service(value = "musicRepairService")
 public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentCalenderBaseService {
 
     @Autowired
@@ -46,4 +45,13 @@ public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentC
         }
         return NO;
     }
+
+    @Override
+    public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
+        MusicRepairDto musicRepair = baseCalender.getMusicRepair();
+        if(musicRepair != null){
+            return musicRepair.getActualAmount().multiply(musicRepair.getNum());
+        }
+        return BigDecimal.ZERO;
+    }
 }

+ 28 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -414,14 +414,17 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
                 student.setMembershipEndTime(DateUtil.addDays(nowDate, cloudTeacherOrder.getTime()));
     			break;
     		case MONTH:
+                student.setMembershipEndTime(DateUtil.addMonths(nowDate, cloudTeacherOrder.getTime()));
+                break;
     		case QUARTERLY:
+                student.setMembershipEndTime(DateUtil.addMonths(nowDate, cloudTeacherOrder.getTime() * 3));
+                break;
     		case YEAR_HALF:
-                student.setMembershipEndTime(DateUtil.addMonths(nowDate, cloudTeacherOrder.getTime()));
+                student.setMembershipEndTime(DateUtil.addMonths(nowDate, cloudTeacherOrder.getTime() * 6));
     			break;
     		case YEAR:
                 student.setMembershipEndTime(DateUtil.addYears(nowDate, cloudTeacherOrder.getTime()));
     			break;
-
     		default:
     			break;
     		}
@@ -432,8 +435,13 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
             	student.setMembershipEndTime(DateUtil.addDays(student.getMembershipEndTime(), cloudTeacherOrder.getTime()));
     			break;
     		case MONTH:
+                student.setMembershipEndTime(DateUtil.addMonths(student.getMembershipEndTime(), cloudTeacherOrder.getTime()));
+                break;
+            case QUARTERLY:
+                student.setMembershipEndTime(DateUtil.addMonths(student.getMembershipEndTime(), cloudTeacherOrder.getTime() * 3 ));
+                break;
     		case YEAR_HALF:
-            	student.setMembershipEndTime(DateUtil.addMonths(student.getMembershipEndTime(), cloudTeacherOrder.getTime()));
+            	student.setMembershipEndTime(DateUtil.addMonths(student.getMembershipEndTime(), cloudTeacherOrder.getTime() * 6 ));
     			break;
     		case YEAR:
             	student.setMembershipEndTime(DateUtil.addYears(student.getMembershipEndTime(), cloudTeacherOrder.getTime()));
@@ -451,9 +459,14 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
                             registration.setMembershipEndTime(DateUtil.addDays(nowDate, cloudTeacherOrder.getTime()));
                             break;
                         case MONTH:
-                        case YEAR_HALF:
                             registration.setMembershipEndTime(DateUtil.addMonths(nowDate, cloudTeacherOrder.getTime()));
                             break;
+                        case QUARTERLY:
+                            registration.setMembershipEndTime(DateUtil.addMonths(nowDate, cloudTeacherOrder.getTime() * 3));
+                            break;
+                        case YEAR_HALF:
+                            registration.setMembershipEndTime(DateUtil.addMonths(nowDate, cloudTeacherOrder.getTime() * 6));
+                            break;
                         case YEAR:
                             registration.setMembershipEndTime(DateUtil.addYears(nowDate, cloudTeacherOrder.getTime()));
                             break;
@@ -466,9 +479,14 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
                             registration.setMembershipEndTime(DateUtil.addDays(registration.getMembershipEndTime(), cloudTeacherOrder.getTime()));
                             break;
                         case MONTH:
-                        case YEAR_HALF:
                             registration.setMembershipEndTime(DateUtil.addMonths(registration.getMembershipEndTime(), cloudTeacherOrder.getTime()));
                             break;
+                        case QUARTERLY:
+                            registration.setMembershipEndTime(DateUtil.addMonths(registration.getMembershipEndTime(), cloudTeacherOrder.getTime() * 3));
+                            break;
+                        case YEAR_HALF:
+                            registration.setMembershipEndTime(DateUtil.addMonths(registration.getMembershipEndTime(), cloudTeacherOrder.getTime() * 6 ));
+                            break;
                         case YEAR:
                             registration.setMembershipEndTime(DateUtil.addYears(registration.getMembershipEndTime(), cloudTeacherOrder.getTime()));
                             break;
@@ -508,14 +526,17 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
             student.setMembershipEndTime(DateUtil.addDays(nowDate, times));
 			break;
 		case MONTH:
+            student.setMembershipEndTime(DateUtil.addMonths(nowDate, times));
+            break;
 		case QUARTERLY:
+            student.setMembershipEndTime(DateUtil.addMonths(nowDate, times * 3));
+            break;
 		case YEAR_HALF:
-            student.setMembershipEndTime(DateUtil.addMonths(nowDate, times));
+            student.setMembershipEndTime(DateUtil.addMonths(nowDate, times * 6));
 			break;
 		case YEAR:
             student.setMembershipEndTime(DateUtil.addYears(nowDate, times));
 			break;
-
 		default:
 			break;
 		}

+ 29 - 24
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -791,36 +791,32 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 	}
 
 	//校验考勤申诉
-	void checkComplaints(JobNatureEnum jobNatureEnum,Integer tenantId,Date classDate){
-		String salary = null;
-		String type = null;
-		if(jobNatureEnum == PART_TIME){
-			salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.PARP_TEACHER_SALARY,tenantId);
-			type = sysTenantConfigService.getTenantConfigValue(SysConfigService.PARP_TEACHER_SALARY_TYPE,tenantId);
-		}else if (jobNatureEnum == FULL_TIME){
-			salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.FULL_TEACHER_SALARY,tenantId);
-			type = sysTenantConfigService.getTenantConfigValue(SysConfigService.FULL_TEACHER_SALARY_TYPE,tenantId);
-		}else if (jobNatureEnum == LABOUR){
-			salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.LABOUR_TEACHER_SALARY,tenantId);
-			type = sysTenantConfigService.getTenantConfigValue(SysConfigService.LABOUR_TEACHER_SALARY_TYPE,tenantId);
-		}
-		if(StringUtils.isNotEmpty(salary) && StringUtils.isNotEmpty(type)){
-			Integer day = Integer.parseInt(salary);
-			if(day <= 0){
-				return;
-			}
-			Date date = new Date();
-			if(type.equals("2")){
+	void checkComplaints(Integer tenantId,Date classDate,Boolean isWeb){
+		Date date = new Date();
+		if(isWeb){
+			String salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.WEB_TEACHER_COMPLAINTS_SALARY,tenantId);
+			if(StringUtils.isNotEmpty(salary)){
+				Integer day = Integer.parseInt(salary);
+				if(day <= 0){
+					return;
+				}
 				//获取上课时间下个月5号
 				date = DateUtil.addDays(DateUtil.getFirstDayOfMonth(DateUtil.addMonths(classDate, 1)), day);
 				int i = DateUtil.daysBetween(date,new Date());
 				if(i > 0){
 					throw new BizException("超出可申述时间");
 				}
-			}else {
+			}
+		}else {
+			String salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.TEACHER_APP_SALARY_COMPLAINTS_TIME,tenantId);
+			if(StringUtils.isNotEmpty(salary)) {
+				Integer day = Integer.parseInt(salary);
+				if (day <= 0) {
+					return;
+				}
 				//如果课程时间在两天前
-				int i = DateUtil.daysBetween(classDate, DateUtil.stringToDate(DateUtil.format(date,DateUtil.DEFAULT_PATTERN),DateUtil.DEFAULT_PATTERN));
-				if(i > --day){
+				int i = DateUtil.daysBetween(classDate, DateUtil.stringToDate(DateUtil.format(date, DateUtil.DEFAULT_PATTERN), DateUtil.DEFAULT_PATTERN));
+				if (i > day) {
 					throw new BizException("超出可申述时间");
 				}
 			}
@@ -830,6 +826,15 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void addComplaints(Long courseScheduleId, String content,String url,Integer userId, UpdateAttendanceEnum complaintsType) {
+		Boolean isWeb = true;
+		if(userId == null){
+			isWeb = false;
+			SysUser user = sysUserFeignService.queryUserInfo();
+			if(Objects.isNull(user)){
+				throw new BizException("请登录");
+			}
+			userId = user.getId();
+		}
 		TeacherAttendance teacherAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(userId.longValue(), courseScheduleId);
 		CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
 		if(courseSchedule == null){
@@ -853,7 +858,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		if(teacher.getTenantId() == null){
 			throw new BizException("用户机构信息异常");
 		}
-		checkComplaints(teacher.getJobNature(),teacher.getTenantId(),courseSchedule.getClassDate());
+		checkComplaints(teacher.getTenantId(),courseSchedule.getClassDate(),isWeb);
 		if(complaintsType == null){
 			complaintsType = UpdateAttendanceEnum.ALL;
 		}

+ 51 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -21,6 +21,7 @@ import com.ym.mec.biz.service.*;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageUtil;
+import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.thirdparty.yqpay.Msg;
 import org.apache.commons.collections.CollectionUtils;
@@ -103,11 +104,11 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         //添加机构配置
         setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::addConfig);
         //创建一个和机构同名称的“分部”
-        createOrg(tenantInfo,dto.getAreaId());
+        createOrg(tenantInfo, dto.getAreaId());
     }
 
     //创建一个和机构同名称的“分部”
-    private void createOrg(TenantInfo tenantInfo,Integer areaId) {
+    private void createOrg(TenantInfo tenantInfo, Integer areaId) {
         Organization organization = new Organization();
         organization.setName(tenantInfo.getName());
         organization.setDelFlag(YesOrNoEnum.NO);
@@ -252,11 +253,11 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         RBucket<Object> bucket = redissonClient.getBucket(key);
         //原子操作 抢锁成功为true
         if (!bucket.trySet(tenantId, 3L, TimeUnit.MINUTES)) {
-            throw new BizException("机构正在开通中请勿频繁操作");
+            throw new BizException("机构正在开通中请勿频繁操作");
         }
         //获取产品信息得到服务id
-        TenantProductInfo productInfo = tenantProductInfoService.getOne(new QueryWrapper<TenantProductInfo>()
-                .eq("tenant_id_", tenantId));
+        TenantProductInfo productInfo = tenantProductInfoService.getOne(new WrapperUtil<TenantProductInfo>()
+                .hasEq("tenant_id_", tenantId).queryWrapper());
         if (Objects.isNull(productInfo)) {
             throw new BizException("开通账号信息异常!未查询到购买的产品信息!");
         }
@@ -268,7 +269,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         //拆分菜单获取菜单ID
         List<Integer> collectMenuId = getMenuId(menuIdList);
         //建立角色
-        Integer roleId = createRole(tenantId);
+        Integer roleId = createRole(tenantInfo);
         //建立角色和菜单关系数据
         employeeService.batchInsertRoleMenu(roleId, collectMenuId);
         // 创建账号、用户信息、用户和角色关系
@@ -286,13 +287,15 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     }
 
     //创建角色
-    private Integer createRole(Integer tenantId) {
+    private Integer createRole(TenantInfo tenantInfo) {
         SysRole sysRole = new SysRole();
         sysRole.setRoleName("管理员");
         sysRole.setRoleDesc("管理员");
         sysRole.setCreateTime(new Date());
         sysRole.setDelFlag("0");
-        sysRole.setTenantId(tenantId);
+        sysRole.setTenantId(tenantInfo.getId());
+        Organization organization = organizationDao.getByName(tenantInfo.getName(), tenantInfo.getId());
+        sysRole.setOrganId(organization.getId());
         employeeService.insertSysRole(sysRole);
         return sysRole.getId();
     }
@@ -305,6 +308,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         e.setJobNature(JobNatureEnum.FULL_TIME);
         e.setEntryDate(LocalDate.now().toDate());
         e.setRoles(roles);
+        e.setRoleIds(roles);
         try {
             employeeService.add(e);
         } catch (Exception ex) {
@@ -337,6 +341,15 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         TenantInfo tenantInfo = Optional.ofNullable(tenantId)
                 .map(baseMapper::selectById)
                 .orElseThrow(() -> new BizException("未查询到机构信息!"));
+        String key = "Tenant_Pay:" + tenantId;
+        RBucket<Object> bucket = redissonClient.getBucket(key);
+        //原子操作 抢锁成功为true
+        if (!bucket.trySet(tenantId, 10, TimeUnit.SECONDS)) {
+            if(tenantInfo.getPayState() == 1){
+                throw new BizException("已缴费请勿重复缴费!");
+            }
+            throw new BizException("该机构数正在缴费中请勿频繁操作");
+        }
         //机构产品信息
         TenantProductInfo productInfo = tenantProductInfoService.getOne(new QueryWrapper<TenantProductInfo>()
                 .eq("tenant_id_", tenantId));
@@ -349,15 +362,15 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         if (Objects.isNull(organization)) {
             throw new BizException("未查询到机构分部信息!");
         }
-        Map<String, Object> payMap = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
         int orderState = 0;
         //消费大于0元则拉起支付
         if (productInfo.getPayAmount().compareTo(BigDecimal.ZERO) > 0) {
-            payMap = payService.getPayMap(
+            result = payService.getPayMap(
                     productInfo.getPayAmount(),
                     BigDecimal.ZERO,
                     orderNo,
-                    baseApiUrl + "/WEB-SERVER/tenantInfo/notify",
+                    baseApiUrl + "/api-web/tenantInfo/notify",
                     baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
                     tenantEnum.getMsg(),
                     tenantEnum.getMsg(),
@@ -367,10 +380,14 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         } else {
             //已支付
             orderState = 1;
+            tenantOpen(tenantId);
+            Map<String, Object> payMap = new HashMap<>();
+            payMap.put("orderNo", orderNo);
+            result.put("payMap", payMap);
         }
         createOrderRecord(tenantId, productInfo.getPayAmount(), orderNo, tenantEnum, orderState);
-        log.info("tenant pay >>>>> " + JSON.toJSONString(payMap));
-        return payMap;
+        log.info("tenant pay >>>>> " + JSON.toJSONString(result));
+        return result;
     }
 
     //生成订单
@@ -401,19 +418,21 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         log.info("tenant orderNotify >>>>> " + msg.toString());
         msg.setMsg("fail");
         Map<String, String> notifyMap = JSON.parseObject(msg.getResponseParameters(), Map.class);
-        TenantOrderRecord record = new TenantOrderRecord();
-        record.setOrderNo(notifyMap.get("merMerOrderNo"));
+        String orderNo = notifyMap.get("merMerOrderNo");
+        TenantOrderRecord record = tenantOrderRecordService.getOne(new WrapperUtil<TenantOrderRecord>()
+                .hasEq("order_no_", orderNo).queryWrapper());
         record.setTransNo(notifyMap.get("orderNo"));
         String channelType = notifyMap.get("channelType").equals("1") ? "WXPay" : (notifyMap.get("channelType").equals("2") ? "Alipay" : "quickPay");
         record.setPayChannel(channelType);
-        //支付中订单存在,更新状态
+        //支付中订单存在,更新状态 tradeState 88就是正确的 其他错误的
         if (msg.getResponseType().equals("1") && notifyMap.size() > 0 && msg.getCode().equals("88")) {
-            //tradeState 88就是正确的 其他错误的
-//            DealStatusEnum
-//            notifyMap.put("totalMoney", notifyMap.get("payAmount"));
+            // notifyMap.put("totalMoney", notifyMap.get("payAmount"));
             record.setOrderState(1);
             msg.setCode("000000");
             msg.setMsg("success");
+            if (TenantOrderRecordEnum.TENANT_OPEN.getCode().equals(record.getOrderType())) {
+                tenantOpen(record.getTenantId());
+            }
         } else {
             //支付失败
             record.setOrderState(2);
@@ -480,4 +499,17 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         }
     }
 
+    //修机构相关的改付款时间
+    private void tenantOpen(Integer tenantId) {
+        TenantInfo tenantInfo = new TenantInfo();
+        tenantInfo.setId(tenantId);
+        tenantInfo.setPayState(1);
+        baseMapper.updateById(tenantInfo);
+
+        TenantProductInfo productInfo = new TenantProductInfo();
+        productInfo.setPayDate(new Date());
+        productInfo.setTenantId(tenantId);
+        tenantProductInfoService.updateById(productInfo);
+    }
+
 }

+ 80 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -4,15 +4,26 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.biz.dal.dao.TenantOrderRecordDao;
 import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
+import com.ym.mec.biz.dal.entity.PlatformServe;
+import com.ym.mec.biz.dal.entity.PlatformServeDetail;
 import com.ym.mec.biz.dal.entity.TenantOrderRecord;
+import com.ym.mec.biz.dal.entity.TenantProductInfo;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.TenantOrderRecordEnum;
+import com.ym.mec.biz.service.PlatformServeDetailService;
+import com.ym.mec.biz.service.PlatformServeService;
 import com.ym.mec.biz.service.TenantOrderRecordService;
+import com.ym.mec.biz.service.TenantProductInfoService;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageUtil;
-import com.ym.mec.common.page.QueryWrapperUtil;
-import org.apache.commons.collections.CollectionUtils;
+import com.ym.mec.common.page.WrapperUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Optional;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 机构付款记录表(TenantOrderRecord)表服务实现类
@@ -22,17 +33,80 @@ import java.util.Optional;
  */
 @Service("tenantOrderRecordService")
 public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordDao, TenantOrderRecord> implements TenantOrderRecordService {
+    private static final Logger log = LoggerFactory.getLogger(TenantOrderRecordServiceImpl.class);
+
+    @Autowired
+    private TenantProductInfoService tenantProductInfoService;
+    @Autowired
+    private PlatformServeService platformServeService;
+    @Autowired
+    private PlatformServeDetailService platformServeDetailService;
 
     @Override
     public PageInfo<TenantOrderRecord> queryPage(TenantOrderRecordDto dto) {
         Page<TenantOrderRecord> pageInfo = PageUtil.getPage(dto.getPage(), dto.getRows());
         pageInfo.setDesc("a.created_time_ ");
-        Optional.ofNullable(dto.getTenantId())
-                .map(QueryWrapperUtil::toList)
-                .filter(CollectionUtils::isNotEmpty)
+        WrapperUtil.toListOptional(dto.getTenantId())
                 .ifPresent(dto::setTenantIdList);
         return PageUtil.pageInfo(baseMapper.queryPage(pageInfo, dto));
     }
 
+    @Override
+    public Map<String, Object> checkTenantOrder(String orderNo) {
+        TenantOrderRecord orderRecord = this.getOne(new WrapperUtil<TenantOrderRecord>()
+                .hasEq("order_no_", orderNo).queryWrapper());
+        //返回
+        Map<String, Object> result = new HashMap<>();
+        result.put("groupType", orderRecord.getOrderType());
+        //订单信息
+        Map<String, Object> order = new HashMap<>();
+        result.put("order", order);
+        order.put("orderNo", orderRecord.getOrderNo());
+        order.put("expectAmount", orderRecord.getExpectAmount());
+        order.put("type", orderRecord.getOrderType());
+        //购买的信息
+        Map<String, Object> detail = new HashMap<>();
+        result.put("detail", detail);
+
+        getOrderState(orderRecord, result);
+        return result;
+    }
+
+    private void getOrderState(TenantOrderRecord orderRecord, Map<String, Object> result) {
+        Map<String, Object> detail = (Map<String, Object>) result.get("detail");
+        Map<String, Object> order = (Map<String, Object>) result.get("order");
+        String code;
+        //订单状态/0待支付、1已支付、2支付失败
+        switch (orderRecord.getOrderState()) {
+            case 1:
+                if (TenantOrderRecordEnum.TENANT_OPEN.getCode().equals(orderRecord.getOrderType())) {
+                    tenantOrderSuccess(orderRecord, detail);
+                }
+                code = DealStatusEnum.SUCCESS.getCode();
+                break;
+            case 2:
+                code = DealStatusEnum.FAILED.getCode();
+                break;
+            default:
+                code = DealStatusEnum.ING.getCode();
+        }
+        order.put("status", code);
+    }
+
+    private void tenantOrderSuccess(TenantOrderRecord orderRecord, Map<String, Object> detail) {
+        //机构产品信息
+        TenantProductInfo productInfo = tenantProductInfoService.getOne(new WrapperUtil<TenantProductInfo>()
+                .hasEq("tenant_id_", orderRecord.getTenantId()).queryWrapper());
+        //获取服务信息
+        PlatformServe platformServe = platformServeService.getOne(new WrapperUtil<PlatformServe>()
+                .hasEq("id_", productInfo.getServeId()).queryWrapper());
+        //获取服务详情
+        PlatformServeDetail serveDetail = platformServeDetailService.getOne(new WrapperUtil<PlatformServeDetail>()
+                .hasEq("id_", productInfo.getServeDetailId()).queryWrapper());
+        detail.put("platformServeName", platformServe.getName());
+        detail.put("mode", serveDetail.getMode());
+        detail.put("num",productInfo.getExpiryCount());
+    }
+
 }
 

+ 108 - 0
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -116,6 +116,15 @@
         where id_ = #{id} AND version_ = #{version} and tenant_id_ = #{tenantId}
     </update>
 
+    <update id="updateOrderStatusOK">
+        update cloud_teacher_order set status_ = 2 where order_id_ = (#{orderId})
+    </update>
+    <update id="updateOrderId">
+        update cloud_teacher_order
+        set order_id_ = #{orderId} , pay_amount_ = #{amount}
+        where id_ = #{cloudTeacherOrderId}
+    </update>
+
     <!-- 全查询 -->
     <select id="findAll" resultMap="CloudTeacherOrder">
         SELECT *
@@ -282,6 +291,105 @@
         </if>
         GROUP BY student_id_
     </select>
+
+    <select id="queryInactive" resultType="com.ym.mec.biz.dal.entity.CloudTeacherStudent">
+        select
+               cto.id_ as cloudTeacherOrderId,
+               cto.student_id_ as studentId,
+               cto.type_ as type,
+               case cto.type_
+                   when 1 then '天'
+                   when 2 then '月'
+                   when 3 then '季'
+                   when 4 then '半年'
+                   when 5 then '年'
+                   else ''
+               end as typeName,
+               cto.time_ as time,
+               sj.id_ as subject,
+               sj.name_ as subjectLabel,
+               u.tenant_id_ as tenantId,
+               u.username_ as name,
+               u.phone_ as phone,
+               org.name_ as organName,
+               mg.id_ as musicGroupId,
+               mg.name_ as musicGroupName,
+               coo.name_ as cooperationOrganName
+        from cloud_teacher_order cto
+        left join student s on cto.student_id_ = s.user_id_
+        left join sys_user u on cto.student_id_ = u.id_
+        left join subject sj on s.subject_id_list_ = sj.id_
+        left join student_registration sr on cto.student_id_ = sr.user_id_
+        left join music_group mg on sr.music_group_id_ = mg.id_
+        left join cooperation_organ coo on mg.cooperation_organ_id_ = coo.id_
+        left join organization org on mg.organ_id_ = org.id_
+        <where>
+            cto.status_ = #{status} AND sr.music_group_status_ = 'NORMAL' AND mg.status_ = 'PROGRESS'
+            <if test="queryCondition != nul and queryCondition != ''">
+                AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
+            </if>
+            <if test="subjectId">
+                AND (s.subject_id_list_ = #{subjectId})
+            </if>
+        </where>
+        <include refid="global.limit"/>
+    </select>
+
+    <select id="findInactiveCount" resultType="java.lang.Integer">
+        select count(1) from cloud_teacher_order cto
+        left join student s on cto.student_id_ = s.user_id_
+        left join sys_user u on cto.student_id_ = u.id_
+        left join subject sj on s.subject_id_list_ = sj.id_
+        left join student_registration sr on s.user_id_ = sr.user_id_
+        left join music_group mg on sr.music_group_id_ = mg.id_
+        left join cooperation_organ coo on mg.cooperation_organ_id_ = coo.id_
+        left join organization org on mg.organ_id_ = org.id_
+        <where>
+            cto.status_ = #{status} AND sr.music_group_status_ = 'NORMAL' AND mg.status_ = 'PROGRESS'
+            <if test="queryCondition != nul and queryCondition != ''">
+                AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
+            </if>
+            <if test="subjectId">
+                AND (s.subject_id_list_ = #{subjectId})
+            </if>
+        </where>
+    </select>
+    <select id="findRecordCount" resultType="java.lang.Integer">
+
+    </select>
+    <select id="queryRecord" resultType="com.ym.mec.biz.dal.entity.CloudTeacherStudent">
+        SELECT
+            tor.order_no_ as orderNo,
+            cto.id_ AS cloudTeacherOrderId,
+            cto.student_id_ AS studentId,
+            cto.type_ AS type,
+            CASE cto.type_ WHEN 1 THEN '天'
+                WHEN 2 THEN '月'
+                WHEN 3 THEN '季'
+                WHEN 4 THEN '半年'
+                WHEN 5 THEN '年' ELSE ''
+                END AS typeName,
+            cto.time_ AS time,
+            sj.id_ AS SUBJECT,
+            sj.name_ AS subjectName,
+            u.tenant_id_ AS tenantId,
+            u.username_ AS NAME,
+            u.phone_ AS phone
+        FROM
+            cloud_teacher_order cto
+                LEFT JOIN tenant_order_record tor ON tor.id_ = cto.order_id_
+                LEFT JOIN student s ON cto.student_id_ = s.user_id_
+                LEFT JOIN sys_user u ON cto.student_id_ = u.id_
+                LEFT JOIN SUBJECT sj ON s.subject_id_list_ = sj.id_
+                LEFT JOIN student_registration sr ON cto.student_id_ = sr.user_id_
+                LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
+        <where>
+            cto.status_ = 2 AND sr.music_group_status_ = 'NORMAL' AND mg.status_ = 'PROGRESS' and tor.order_no_ is not null
+            AND cto.type_ > 1
+        </where>
+        <include refid="global.limit"/>
+    </select>
+
     <sql id="queryCloudTeacherActiveDetailSql">
         <where>
             cto.status_ != 0 AND cto.active_remark_ = '202109'

+ 6 - 8
mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -69,11 +69,6 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Employee" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-        <!--
-        <selectKey resultClass="int" keyProperty="id" >
-        SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
-        </selectKey>
-        -->
         INSERT INTO employee
         (user_id_,organ_id_list_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,
         entry_date_,certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_,contact_address_,postal_code_,dept_id_,dept_ids_,post_ids_,post_dept_ids_)
@@ -99,8 +94,8 @@
             useGeneratedKeys="true">
         INSERT INTO `sys_role` (`role_name_`, `role_code_`, `role_desc_`, `create_time_`,
                                 `update_time_`, `del_flag_`, `organ_id_`, `tenant_id_`)
-        VALUES (#{RoleName}, #{RoleCode}, #{RoleDesc}, #{CreateTime},
-                #{UpdateTime}, #{DelFlag}, #{OrganId}, #{TenantId});
+        VALUES (#{roleName}, #{roleCode}, #{roleDesc}, #{createTime},
+                #{updateTime}, #{delFlag}, #{organId}, #{tenantId});
     </insert>
 
     <select id="queryByPhone" resultMap="SysUser">
@@ -240,7 +235,10 @@
             LEFT JOIN sys_user_role sur ON sur.user_id_ = e.user_id_
         </if>
         <where>
-                su.lock_flag_ = 0 AND su.del_flag_ = 0
+                su.del_flag_ = 0
+            <if test="lockFlag != null">
+                AND su.lock_flag_ = #{lockFlag}
+            </if>
             <if test="demissionflag != null and demissionflag == 1">
                 AND e.demission_date_ IS NOT NULL
             </if>

+ 27 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml

@@ -0,0 +1,27 @@
+<?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.MusicGroupPaymentCalenderActivityDao">
+  <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity">
+    <id column="id_" jdbcType="BIGINT" property="id" />
+    <result column="activity_id_" jdbcType="INTEGER" property="activityId" />
+    <result column="calender_id_" property="calenderId" />
+    <result column="optional_flag_" jdbcType="TINYINT" property="optionalFlag" />
+    <result column="actual_amount_" jdbcType="TINYINT" property="actualAmount" />
+    <result column="original_amount_" jdbcType="TINYINT" property="originalAmount" />
+    <result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id_, activity_id_, calender_id_, optional_flag_,actual_amount_ ,original_amount_, create_time_, update_time_
+  </sql>
+
+  <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
+          parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity">
+    insert into music_group_payment_calender_activity(activity_id_, calender_id_, optional_flag_, actual_amount_ ,original_amount_, create_time_, update_time_)
+    values
+    <foreach collection="calenderActivityList" item="entity" separator=",">
+      (#{entity.activityId}, #{entity.calenderId}, #{entity.optionalFlag}, #{entity.actualAmount},
+      #{entity.originalAmount}, NOW(), NOW())
+    </foreach>
+  </insert>
+</mapper>

+ 24 - 4
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -36,6 +36,10 @@
         <result column="member_rank_setting_id_" property="memberRankSettingId"/>
         <result column="member_valid_date_" property="memberValidDate"/>
         <result column="member_period_" property="memberPeriod" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="member_optional_flag_" property="memberOptionalFlag"/>
+        <result column="music_repair_num_" property="musicRepairNum"/>
+        <result column="music_repair_actual_price_" property="musicRepairActualPrice"/>
+        <result column="music_repair_optional_flag_" property="musicRepairOptionalFlag"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -55,13 +59,15 @@
         (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
         actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,
         payment_pattern_,payment_type_,payment_amount_,batch_no_,audit_memo_,operator_,attribute1_,
-         attribute2_,student_ids_,member_payment_amount_,member_rank_setting_id_,member_valid_date_,original_member_payment_amount_,member_period_)
+         attribute2_,student_ids_,member_payment_amount_,member_rank_setting_id_,member_valid_date_
+         ,original_member_payment_amount_,member_period_,member_optional_flag_,music_repair_num_,music_repair_actual_price_,music_repair_optional_flag_)
         VALUES(#{musicGroupId},#{musicGroupOrganizationCourseSettingId},#{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{rejectReason},#{startPaymentDate},#{deadlinePaymentDate},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},now(),now(),
         #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{paymentAmount},#{batchNo},#{auditMemo},#{operator},#{attribute1},#{attribute2},#{studentIds},
-               #{memberPaymentAmount},#{memberRankSettingId},#{memberValidDate},#{originalMemberPaymentAmount},#{memberPeriod})
+               #{memberPaymentAmount},#{memberRankSettingId},#{memberValidDate},#{originalMemberPaymentAmount},#{memberPeriod},
+               #{memberOptionalFlag},#{musicRepairNum},#{musicRepairActualPrice},#{musicRepairOptionalFlag})
     </insert>
 
     <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" useGeneratedKeys="true"
@@ -70,14 +76,16 @@
         (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
         actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_amount_,
         payment_type_,batch_no_,audit_memo_,operator_,attribute1_,attribute2_,student_ids_,
-         member_payment_amount_,member_rank_setting_id_,member_valid_date_,original_member_payment_amount_,member_period_)
+         member_payment_amount_,member_rank_setting_id_,member_valid_date_,original_member_payment_amount_,member_period_
+        ,member_optional_flag_,music_repair_num_,music_repair_actual_price_,music_repair_optional_flag_)
         VALUES
         <foreach collection="list" item="item" index="index" separator=",">
         (#{item.musicGroupId},#{item.musicGroupOrganizationCourseSettingId},#{item.payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.rejectReason},#{item.startPaymentDate},#{item.deadlinePaymentDate},#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{item.expectNum},#{item.actualNum},#{item.memo},#{item.isGiveMusicNetwork},now(),now(),
         #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentAmount},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{item.batchNo},#{item.auditMemo},#{item.operator},#{item.attribute1},#{item.attribute2},
-         #{item.studentIds},#{item.memberPaymentAmount},#{item.memberRankSettingId},#{item.memberValidDate},#{item.originalMemberPaymentAmount},#{item.memberPeriod})
+         #{item.studentIds},#{item.memberPaymentAmount},#{item.memberRankSettingId},#{item.memberValidDate},#{item.originalMemberPaymentAmount},#{item.memberPeriod},
+            #{item.memberOptionalFlag},#{item.musicRepairNum},#{item.musicRepairActualPrice},#{item.musicRepairOptionalFlag})
         </foreach>
     </insert>
 
@@ -85,6 +93,18 @@
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender">
         UPDATE music_group_payment_calender
         <set>
+            <if test="memberOptionalFlag != null">
+                member_optional_flag_ = #{memberOptionalFlag},
+            </if>
+            <if test="musicRepairNum != null">
+                music_repair_num_ = #{musicRepairNum},
+            </if>
+            <if test="musicRepairActualPrice != null">
+                music_repair_actual_price_ = #{musicRepairActualPrice},
+            </if>
+            <if test="musicRepairOptionalFlag != null">
+                music_repair_optional_flag_ = #{musicRepairOptionalFlag},
+            </if>
             <if test="memberPeriod != null">
                 member_period_ = #{memberPeriod},
             </if>

+ 27 - 17
mec-common/common-core/src/main/java/com/ym/mec/common/page/QueryWrapperUtil.java → mec-common/common-core/src/main/java/com/ym/mec/common/page/WrapperUtil.java

@@ -15,13 +15,15 @@ import java.util.stream.Collectors;
  * @author hgw
  * Created by 2021-12-20
  */
-public class QueryWrapperUtil<T> {
+public class WrapperUtil<T> {
 
     private final QueryWrapper<T> queryWrapper;
 
-    private final Predicate<? super Object> predicate = (Predicate<Object>) Objects::nonNull;
+    private final Predicate<? super Object> ObjPredicate = (Predicate<Object>) Objects::nonNull;
 
-    public QueryWrapperUtil() {
+    private final Predicate<? super Object> StrPredicate = (Predicate<Object>) o -> StringUtils.isNotBlank((String) o);
+
+    public WrapperUtil() {
         this.queryWrapper = new QueryWrapper<>();
     }
 
@@ -32,14 +34,13 @@ public class QueryWrapperUtil<T> {
      * @param column 列名称
      * @param val    值
      */
-    public QueryWrapperUtil<T> hasEq(String column, String val) {
-        Predicate<? super Object> predicate = (Predicate<Object>) o -> StringUtils.isNotBlank((String) o);
-        queryWrapper.eq(predicate.test(val), column, val);
+    public WrapperUtil<T> hasEq(String column, String val) {
+        queryWrapper.eq(StrPredicate.test(val), column, val);
         return this;
     }
 
-    public QueryWrapperUtil<T> hasEq(String column, Object val) {
-        queryWrapper.eq(predicate.test(val), column, val);
+    public WrapperUtil<T> hasEq(String column, Object val) {
+        queryWrapper.eq(ObjPredicate.test(val), column, val);
         return this;
     }
 
@@ -49,9 +50,9 @@ public class QueryWrapperUtil<T> {
      * @param column 列名称
      * @param val    逗号分开的值
      */
-    public QueryWrapperUtil<T> hasSplitIn(String column, String val) {
-        if (StringUtils.isNotBlank(val)) {
-            List<String> strings = QueryWrapperUtil.toList(val);
+    public WrapperUtil<T> hasSplitIn(String column, String val) {
+        if (StrPredicate.test(val)) {
+            List<String> strings = WrapperUtil.toList(val);
             if (CollectionUtils.isNotEmpty(strings)) {
                 queryWrapper.in(column, strings);
             }
@@ -60,14 +61,13 @@ public class QueryWrapperUtil<T> {
     }
 
     /**
-     * 可以当作结束语句
-     * 或者获取QueryWrapper类还可以继续拼接其他条件SQL
+     * 返回QueryWrapper
+     * @return QueryWrapper
      */
     public QueryWrapper<T> queryWrapper() {
         return queryWrapper;
     }
 
-
     public static List<String> toList(String key) {
         return toList(key, ",");
     }
@@ -77,15 +77,25 @@ public class QueryWrapperUtil<T> {
                 .orElse(null);
     }
 
-    private static Optional<List<String>> toListOptional(String key, String symbol) {
+    /**
+     * 将用逗号分割的字符串转换为List
+     *
+     * @param key 用逗号分割的字符
+     * @return Optional
+     */
+    public static Optional<List<String>> toListOptional(String key) {
+        return toListOptional(key, ",");
+    }
+
+    public static Optional<List<String>> toListOptional(String key, String symbol) {
         return Optional.ofNullable(key)
                 .filter(StringUtils::isNotBlank)
                 .map(b -> b.split(symbol))
-                .map(QueryWrapperUtil::collectToList)
+                .map(WrapperUtil::collectToList)
                 .filter(CollectionUtils::isNotEmpty);
     }
 
-    private static List<String> collectToList(String[] b) {
+    public static List<String> collectToList(String[] b) {
         return Arrays.stream(b).filter(StringUtils::isNotBlank).collect(Collectors.toList());
     }
 

+ 5 - 13
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -4,17 +4,18 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.ym.common.ApiException;
-import com.ym.common.BaseResponse;
 import com.ym.common.DisplayEnum;
 import com.ym.common.ErrorEnum;
 import com.ym.config.IMProperties;
 import com.ym.config.RoomProperties;
-import com.ym.dao.*;
+import com.ym.dao.RoomDao;
+import com.ym.dao.RoomMemberDao;
+import com.ym.dao.UserDao;
+import com.ym.dao.WhiteboardDao;
 import com.ym.job.ScheduleManager;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentMusicScoreDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.RongyunBasicUserDto;
 import com.ym.mec.biz.dal.entity.*;
@@ -91,8 +92,6 @@ public class RoomServiceImpl implements RoomService {
     @Autowired
     private SysExamSongDao sysExamSongDao;
     @Autowired
-    private SysConfigDao sysConfigDao;
-    @Autowired
     private CourseScheduleStudentMusicScoreDao courseScheduleStudentMusicScoreDao;
     @Autowired
     private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
@@ -124,13 +123,6 @@ public class RoomServiceImpl implements RoomService {
         return Integer.parseInt(roomId);
     }
 
-    public static void main(String[] args) {
-        Date date = DateUtil.stringToDate("2021-12-14 11:34:00", DateUtil.EXPANDED_DATE_TIME_FORMAT);
-        Date classDate = DateUtil.stringToDate("2021-12-14 11:40:00", DateUtil.EXPANDED_DATE_TIME_FORMAT);
-        int i = classDate.compareTo(DateUtil.addMinutes(date, 5));
-        int i1 = DateUtil.minutesBetween(classDate, date);
-    }
-
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     @Override
     public RoomResult joinRoom(String roomId) throws Exception {
@@ -163,7 +155,7 @@ public class RoomServiceImpl implements RoomService {
             continueCourseTime = "5";
         }
 
-        String autoCloseNetworkRoomTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_BEFORE_BUFFER_TIME,courseSchedule.getTenantId());
+        String autoCloseNetworkRoomTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_AFTER_BUFFER_TIME,courseSchedule.getTenantId());
         if(StringUtils.isEmpty(autoCloseNetworkRoomTime)){
             autoCloseNetworkRoomTime = "15";
         }

+ 18 - 12
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -24,14 +24,14 @@ import java.util.stream.Collectors;
 
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpStatus;
 import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.util.CollectionUtils;
 import org.springframework.util.DigestUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.ModelAttribute;
@@ -92,6 +92,7 @@ import com.ym.mec.biz.service.SporadicChargeInfoService;
 import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.TenantOrderRecordService;
 import com.ym.mec.biz.service.TenantPaymentOrderService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
@@ -156,7 +157,8 @@ public class StudentOrderController extends BaseController {
     private VipGroupActivityDao vipGroupActivityDao;
     @Autowired
     private SellOrderService sellOrderService;
-
+    @Autowired
+    private TenantOrderRecordService tenantOrderRecordService;
 
     @Value("${spring.profiles.active:dev}")
     private String profiles;
@@ -212,6 +214,10 @@ public class StudentOrderController extends BaseController {
         }
         StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
         if (Objects.isNull(orderByOrderNo)) {
+            Map<String, Object> tenantOrder = tenantOrderRecordService.checkTenantOrder(orderNo);
+            if (Objects.nonNull(tenantOrder)) {
+                return succeed(tenantOrder);
+            }
             return failed("未找到指定订单");
         }
         HashMap<String, Object> orderDetail = new HashMap<>();
@@ -251,7 +257,7 @@ public class StudentOrderController extends BaseController {
                 orderDetail.put("member", cloudTeacherOrderService.queryOrderInfoByOrderId(orderByOrderNo.getId()));
             }
         } else if (orderByOrderNo.getGroupType().equals(GroupType.VIP)) {
-            if(StringUtils.isNotEmpty(orderByOrderNo.getMusicGroupId())){
+            if (StringUtils.isNotEmpty(orderByOrderNo.getMusicGroupId())) {
                 VipBuyResultDto vipBuyResultInfo = vipGroupService.findVipBuyResultInfo(Integer.valueOf(orderByOrderNo.getMusicGroupId()));
                 orderDetail.put("detail", vipBuyResultInfo);
             }
@@ -281,11 +287,11 @@ public class StudentOrderController extends BaseController {
             orderDetail.put("detail", vipGroupActivityDao.queryByIds(orderByOrderNo.getActivityId()));
         } else if (orderByOrderNo.getGroupType().equals(GroupType.MEMBER)) {
             CloudTeacherOrderDto orderDto = cloudTeacherOrderService.queryOrderInfoByOrderId(orderByOrderNo.getId());
-            orderDetail.put("detail",orderDto);
-            if(orderDto != null){
-                Map<String,Object> map = new HashMap<>(1);
-                map.put("paymentOrderId",orderDto.getCloudTeacherOrder().getOrderId());
-                orderDetail.put("couponList",sysCouponCodeDao.querySysCouponUseList(map));
+            orderDetail.put("detail", orderDto);
+            if (orderDto != null) {
+                Map<String, Object> map = new HashMap<>(1);
+                map.put("paymentOrderId", orderDto.getCloudTeacherOrder().getOrderId());
+                orderDetail.put("couponList", sysCouponCodeDao.querySysCouponUseList(map));
             }
         }
         return succeed(orderDetail);
@@ -922,9 +928,9 @@ public class StudentOrderController extends BaseController {
         if (orderDetails.size() > 0) {
             MusicGroup musicGroup = musicGroupService.get(order.getMusicGroupId());
             BigDecimal couponRemitFee = order.getCouponRemitFee();
-            if(couponRemitFee.compareTo(BigDecimal.ZERO) > 0){
+            if (couponRemitFee.compareTo(BigDecimal.ZERO) > 0) {
                 BigDecimal musicFee = orderDetails.stream().filter(o -> o.getType().getCode().equals("MUSICAL")
-                        || o.getType().getCode().equals("ACCESSORIES") || o.getType().getCode().equals("TEACHING"))
+                                || o.getType().getCode().equals("ACCESSORIES") || o.getType().getCode().equals("TEACHING"))
                         .map(o -> o.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
                 BigDecimal expectAmount = order.getExpectAmount();
                 //获取比例
@@ -932,7 +938,7 @@ public class StudentOrderController extends BaseController {
                 //获取分配的减免金额
                 couponRemitFee = couponRemitFee.multiply(ratioAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
             }
-            sellOrders = sellOrderService.addOrderDetail2SellOrder(orderDetails, order, musicGroup,couponRemitFee);
+            sellOrders = sellOrderService.addOrderDetail2SellOrder(orderDetails, order, musicGroup, couponRemitFee);
         }
         return succeed(sellOrders);
 

+ 47 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SysTenantConfigController.java

@@ -0,0 +1,47 @@
+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.service.SysTenantConfigService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.tenant.TenantContextHolder;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+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.util.HashMap;
+import java.util.Map;
+
+/** 
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysTenantConfig")
+public class SysTenantConfigController extends BaseController {
+
+	@Autowired
+	private SysTenantConfigService sysTenantConfigService;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "queryAll")
+	public Object queryAll(String group) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		Map<String,Object> params = new HashMap<String, Object>(2);
+		params.put("group", group);
+		params.put("tenantId", sysUser.getTenantId());
+		return succeed(sysTenantConfigService.queryAll(params));
+	}
+
+	@ApiOperation(value = "获取单个配置")
+	@PostMapping(value = "findByName")
+	public Object findByName(String configName) {
+		return succeed(sysTenantConfigService.getTenantConfigValue(configName,TenantContextHolder.getTenantId()));
+	}
+}

+ 48 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SysTenantConfigController.java

@@ -0,0 +1,48 @@
+package com.ym.mec.teacher.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.service.SysTenantConfigService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.tenant.TenantContextHolder;
+import com.yonge.log.model.AuditLogAnnotation;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/** 
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysTenantConfig")
+public class SysTenantConfigController extends BaseController {
+
+	@Autowired
+	private SysTenantConfigService sysTenantConfigService;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "queryAll")
+	public Object queryAll(String group) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		Map<String,Object> params = new HashMap<String, Object>(2);
+		params.put("group", group);
+		params.put("tenantId", sysUser.getTenantId());
+		return succeed(sysTenantConfigService.queryAll(params));
+	}
+
+	@ApiOperation(value = "获取单个配置")
+	@PostMapping(value = "findByName")
+	public Object findByName(String configName) {
+		return succeed(sysTenantConfigService.getTenantConfigValue(configName,TenantContextHolder.getTenantId()));
+	}
+}

+ 1 - 5
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherAttendanceController.java

@@ -151,11 +151,7 @@ public class TeacherAttendanceController extends BaseController {
     @ApiOperation(value = "提交考勤申述")
     @PostMapping("/addComplaints")
     public Object addComplaints(Long courseScheduleId, String content, String url, UpdateAttendanceEnum complaintsType){
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if(Objects.isNull(user)){
-            throw new BizException("请登录");
-        }
-        teacherAttendanceService.addComplaints(courseScheduleId,content,url,user.getId(),complaintsType);
+        teacherAttendanceService.addComplaints(courseScheduleId,content,url,null,complaintsType);
         return succeed();
     }
 

+ 5 - 4
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -88,18 +88,19 @@ public class TeacherCourseScheduleController extends BaseController {
         if(null == user.getTenantId()){
             return failed("用户机构信息异常,请联系管理员");
         }
-        SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
+//        SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
         String offlineSignInEarlyForwardTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_SIGN_IN_EARLY_FORWARD_TIME, user.getTenantId());
         String configValue1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP, user.getTenantId());
         String courseBeforeBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_BEFORE_BUFFER_TIME, user.getTenantId());
         String courseAfterBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_AFTER_BUFFER_TIME, user.getTenantId());
         List<CourseScheduleDto> teacherCourseSchedulesWithDate = scheduleService.getTeacherCourseSchedulesWithDate(user.getId(),date,type,user.getTenantId());
-        Map<String,Object> result = new HashMap<>();
+        Map<String,Object> result = new HashMap<>(7);
         result.put("rows",teacherCourseSchedulesWithDate);
         result.put("appealHoursRange",4);
         result.put("offlineSignInEarlyForwardTime", StringUtils.isEmpty(offlineSignInEarlyForwardTime)?60:Integer.parseInt(offlineSignInEarlyForwardTime));
-        result.put("enableStudentAttendanceTimeRange",sysConfig.getParanValue(Integer.class));
-        result.put("enableStudentAttendanceTimeRangeVip",StringUtils.isEmpty(configValue1)?0:Integer.parseInt(configValue1));
+//        result.put("enableStudentAttendanceTimeRange",sysConfig.getParanValue(Integer.class));
+        result.put("enableStudentAttendanceTimeRangeVip",StringUtils.isEmpty(configValue1)?20:Integer.parseInt(configValue1));
+        //网络教室可以提前进入时间:对内和对外开课时间 (对内:joinRoomBeforeTime 对外:courseBeforeBufferTime)
         result.put("joinRoomBeforeTime",StringUtils.isEmpty(courseBeforeBufferTime)?10:Integer.parseInt(courseBeforeBufferTime));
         result.put("courseBeforeBufferTime", StringUtils.isEmpty(courseBeforeBufferTime)?10:Integer.parseInt(courseBeforeBufferTime));
         result.put("courseAfterBufferTime", StringUtils.isEmpty(courseAfterBufferTime)?10:Integer.parseInt(courseAfterBufferTime));

+ 73 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CloudTeacherOrderController.java

@@ -0,0 +1,73 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
+import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
+import com.ym.mec.biz.service.CloudTeacherOrderService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.thirdparty.yqpay.Msg;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author: feng-ji
+ * @date: 2021-12-21
+ */
+@RequestMapping("cloudTeacherOrder")
+@Api(tags = "团练宝注册用户查询")
+@RestController
+public class CloudTeacherOrderController extends BaseController {
+
+    @Autowired
+    private CloudTeacherOrderService cloudTeacherOrderService;
+
+
+    @ApiOperation(value ="查询未激活团练宝用户")
+    @PostMapping("/queryInactive")
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryUnActive')")
+    public Object queryInactive(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
+        cloudTeacherOrderQueryInfo.setStatus(1);
+        return succeed(cloudTeacherOrderService.queryInactive(cloudTeacherOrderQueryInfo));
+    }
+
+    @ApiOperation(value ="查询已激活团练宝用户")
+    @PostMapping("/queryActive")
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryActive')")
+    public Object queryActive(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
+        cloudTeacherOrderQueryInfo.setStatus(2);
+        return succeed(cloudTeacherOrderService.queryInactive(cloudTeacherOrderQueryInfo));
+    }
+
+    @ApiOperation(value ="激活记录")
+    @PostMapping("/queryActiveRecord")
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryActive')")
+    public Object queryActiveRecord(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
+        return succeed(cloudTeacherOrderService.queryActiveRecord(cloudTeacherOrderQueryInfo));
+    }
+
+    @ApiOperation(value ="激活团练宝用户")
+    @PostMapping("/pay")
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/pay')")
+    public Object pay(@RequestBody List<CloudTeacherStudent> cloudTeacherStudents) throws Exception {
+        return succeed(cloudTeacherOrderService.pay(cloudTeacherStudents));
+    }
+
+    @ApiOperation(value ="支付回调")
+    @PostMapping("/payNotify")
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payNotify')")
+    public Msg payNotify(@ModelAttribute Msg msg) {
+        return cloudTeacherOrderService.payNotify(msg);
+    }
+
+    @ApiOperation(value ="轮询查询订单状态")
+    @GetMapping("/payCheck")
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payNotify')")
+    public Boolean payCheck(@RequestParam String orderNo ) {
+        return cloudTeacherOrderService.payCheck(orderNo);
+    }
+}

+ 12 - 1
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.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.ClassGroupStudentMapperDao;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
@@ -62,7 +63,17 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
     public Object add(@RequestBody MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
     	String batchNo = musicGroupPaymentCalenderService.create(musicGroupPaymentCalenderDto);
-        ModelMap map = new ModelMap();
+        ModelMap map = new ModelMap(1);
+        map.put("musicGroupPaymentCalenderBatchNo", batchNo);
+        return succeed(map);
+    }
+
+    @ApiOperation(value = "新增乐团缴费日历")
+    @PostMapping(value = "/createCalender", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/createCalender')")
+    public Object createCalender(@RequestBody MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
+    	String batchNo = musicGroupPaymentCalenderService.create1(musicGroupPaymentBaseCalender);
+        ModelMap map = new ModelMap(1);
         map.put("musicGroupPaymentCalenderBatchNo", batchNo);
         return succeed(map);
     }

+ 8 - 4
mec-web/src/main/java/com/ym/mec/web/controller/SysManualController.java

@@ -1,6 +1,5 @@
 package com.ym.mec.web.controller;
 
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.biz.dal.entity.SysManual;
 import com.ym.mec.biz.dal.page.SysManualQueryInfo;
@@ -11,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.ym.mec.common.controller.BaseController;
 
+import java.util.List;
+
 /**
  * (SysManual)表控制层
  *
@@ -31,11 +32,14 @@ public class SysManualController extends BaseController {
     @ApiOperation(value = "查询操作手册")
     @GetMapping("/list")
     public Object list(SysManualQueryInfo queryInfo) {
-        if (queryInfo.getMenuId() != 0) {
-            return succeed(sysManualService.list(new QueryWrapper<SysManual>().eq("menu_id_", queryInfo.getMenuId())));
+        QueryWrapper<SysManual> queryWrapper = null;
+        if (queryInfo.getMenuId() != null) {
+            queryWrapper = new QueryWrapper<SysManual>().eq("menu_id_", queryInfo.getMenuId());
         } else {
-            return succeed(sysManualService.list(new QueryWrapper<SysManual>()));
+            queryWrapper = new QueryWrapper<>();
         }
+        List<SysManual> result = sysManualService.list(queryWrapper);
+        return succeed(result);
     }
 
     @ApiOperation(value = "新增帮助手册")