ソースを参照

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

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberPrivilegesItemServiceImpl.java
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
#	mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml
yonge 3 年 前
コミット
2ea94938e2
54 ファイル変更1288 行追加596 行削除
  1. 1 1
      .gitignore
  2. 6 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java
  3. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderActivityDao.java
  4. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderMemberDao.java
  5. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderRepairDao.java
  6. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  7. 0 76
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderMemberDto.java
  8. 7 10
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentBaseCalender.java
  9. 0 41
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicRepairDto.java
  10. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherOrder.java
  11. 49 45
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherStudent.java
  12. 15 89
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderActivity.java
  13. 93 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderBase.java
  14. 39 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java
  15. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderRepair.java
  16. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantInfo.java
  17. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherAddQueryInfo.java
  18. 48 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherOrderQueryInfo.java
  19. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java
  20. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderBaseService.java
  21. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java
  22. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderMemberService.java
  23. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderRepairService.java
  24. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java
  25. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantOrderRecordService.java
  26. 51 23
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
  27. 16 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java
  28. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberPrivilegesItemServiceImpl.java
  29. 44 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java
  30. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java
  31. 51 19
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  32. 43 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderMemberServiceImpl.java
  33. 29 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderRepairServiceImpl.java
  34. 86 85
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  35. 6 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java
  36. 55 45
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  37. 78 24
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java
  38. 83 42
      mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml
  39. 82 15
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml
  40. 89 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMemberMapper.xml
  41. 75 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderRepairMapper.xml
  42. 3 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  43. 2 2
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  44. 5 4
      mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml
  45. 6 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  46. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  47. 24 0
      mec-task/src/main/java/com/ym/mec/task/jobs/CheckTenantOrder.java
  48. 19 16
      mec-web/src/main/java/com/ym/mec/web/controller/CloudTeacherOrderController.java
  49. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  50. 5 2
      mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java
  51. 1 1
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java
  52. 43 12
      mec-web/src/main/java/com/ym/mec/web/controller/SysManualController.java
  53. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java
  54. 2 1
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduRegisterController.java

+ 1 - 1
.gitignore

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

+ 6 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java

@@ -91,13 +91,17 @@ public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
 
     List<CloudTeacherStudent> queryInactive(Map<String, Object> params);
 
-    int updateOrderStatusOK(@Param("orderId") Integer orderId);
+    int updateOrderStatusOK(@Param("platformOrderId") Integer platformOrderId);
 
     int updateOrderId(@Param("cloudTeacherOrderId")Integer cloudTeacherOrderId,
                       @Param("amount") BigDecimal amount,
-                      @Param("orderId")Integer orderId);
+                      @Param("platformOrderId")Integer platformOrderId);
 
     int findRecordCount(Map<String, Object> params);
 
     List<CloudTeacherStudent> queryRecord(Map<String, Object> params);
+
+    List<CloudTeacherOrder> findByPlatformOrderId(Integer id);
+
+    int checkOrdered(@Param("cloudTeacherStudentIds")String join);
 }

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

@@ -1,12 +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 com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
-public interface MusicGroupPaymentCalenderActivityDao extends BaseMapper<MusicGroupPaymentCalenderActivity> {
+public interface MusicGroupPaymentCalenderActivityDao extends BaseDAO<Long, MusicGroupPaymentCalenderActivity> {
 
     void insertBatch(@Param("calenderActivityList") List<MusicGroupPaymentCalenderActivity> musicGroupPaymentCalenderActivities);
 

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderMemberDao.java

@@ -0,0 +1,11 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember;
+import org.apache.ibatis.annotations.Param;
+
+public interface MusicGroupPaymentCalenderMemberDao extends BaseDAO<Long, MusicGroupPaymentCalenderMember> {
+
+
+    void deleteByCalenderId(@Param("calenderId") Long calenderId);
+}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderRepairDao.java

@@ -0,0 +1,11 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderRepair;
+import org.apache.ibatis.annotations.Param;
+
+public interface MusicGroupPaymentCalenderRepairDao extends BaseDAO<Long, MusicGroupPaymentCalenderRepair> {
+
+
+    void deleteByCalenderId(@Param("calenderId") Long calenderId);
+}

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

@@ -420,4 +420,6 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
     List<Student> queryStudent(Map<String, Object> params);
 
     List<Map<Integer, String>> getStudentTeacherMap(List<Integer> studentIds);
+
+    int updateMembershipEndTime(@Param("studentId")Integer studentId, @Param("endTime")Date endTime);
 }

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

@@ -1,76 +0,0 @@
-package com.ym.mec.biz.dal.dto;
-
-import com.ym.mec.biz.dal.enums.PeriodEnum;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.math.BigDecimal;
-
-import static com.ym.mec.biz.dal.enums.PeriodEnum.MONTH;
-
-public class CalenderMemberDto {
-    @ApiModelProperty(value = "会员周期", required = false)
-    private PeriodEnum periodEnum = MONTH;
-
-    @ApiModelProperty(value = "会员数量", required = false)
-    private Integer memberNum = 1 ;
-
-    @ApiModelProperty(value = "会员现价", required = false)
-    private BigDecimal actualAmount = BigDecimal.ZERO;
-
-    @ApiModelProperty(value = "会员原价", required = false)
-    private BigDecimal originalAmount = BigDecimal.ZERO;
-
-    @ApiModelProperty(value = "会员等级编号", required = false)
-    private Integer memberRankSettingId = 1;
-
-    @ApiModelProperty(value = "是否必选", required = false)
-    private Boolean optionalFlag = false;
-
-    public BigDecimal getOriginalAmount() {
-        return originalAmount;
-    }
-
-    public void setOriginalAmount(BigDecimal originalAmount) {
-        this.originalAmount = originalAmount;
-    }
-
-    public PeriodEnum getPeriodEnum() {
-        return periodEnum;
-    }
-
-    public void setPeriodEnum(PeriodEnum periodEnum) {
-        this.periodEnum = periodEnum;
-    }
-
-    public Integer getMemberNum() {
-        return memberNum;
-    }
-
-    public void setMemberNum(Integer memberNum) {
-        this.memberNum = memberNum;
-    }
-
-    public BigDecimal getActualAmount() {
-        return actualAmount;
-    }
-
-    public void setActualAmount(BigDecimal actualAmount) {
-        this.actualAmount = actualAmount;
-    }
-
-    public Integer getMemberRankSettingId() {
-        return memberRankSettingId;
-    }
-
-    public void setMemberRankSettingId(Integer memberRankSettingId) {
-        this.memberRankSettingId = memberRankSettingId;
-    }
-
-    public Boolean getOptionalFlag() {
-        return optionalFlag;
-    }
-
-    public void setOptionalFlag(Boolean optionalFlag) {
-        this.optionalFlag = optionalFlag;
-    }
-}

+ 7 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentBaseCalender.java

@@ -1,13 +1,10 @@
 package com.ym.mec.biz.dal.dto;
 
-import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.*;
 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;
 
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -39,10 +36,10 @@ public class MusicGroupPaymentBaseCalender {
 	private String batchNo;
 
 	@ApiModelProperty(value = "会员相关缴费信息", required = false)
-	private CalenderMemberDto calenderMember;
+	private MusicGroupPaymentCalenderMember calenderMember;
 
 	@ApiModelProperty(value = "乐保信息", required = false)
-	private MusicRepairDto musicRepair;
+	private MusicGroupPaymentCalenderRepair musicRepair;
 
 	@ApiModelProperty(value = "乐团活动相关信息(vip、网管课)", required = false)
 	private List<MusicGroupPaymentCalenderActivity> calenderActivityList;
@@ -58,11 +55,11 @@ public class MusicGroupPaymentBaseCalender {
 		this.calenderActivityList = calenderActivityList;
 	}
 
-	public MusicRepairDto getMusicRepair() {
+	public MusicGroupPaymentCalenderRepair getMusicRepair() {
 		return musicRepair;
 	}
 
-	public void setMusicRepair(MusicRepairDto musicRepair) {
+	public void setMusicRepair(MusicGroupPaymentCalenderRepair musicRepair) {
 		this.musicRepair = musicRepair;
 	}
 
@@ -90,11 +87,11 @@ public class MusicGroupPaymentBaseCalender {
 		this.deadlinePaymentDate = deadlinePaymentDate;
 	}
 
-	public CalenderMemberDto getCalenderMember() {
+	public MusicGroupPaymentCalenderMember getCalenderMember() {
 		return calenderMember;
 	}
 
-	public void setCalenderMember(CalenderMemberDto calenderMember) {
+	public void setCalenderMember(MusicGroupPaymentCalenderMember calenderMember) {
 		this.calenderMember = calenderMember;
 	}
 

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

@@ -1,41 +0,0 @@
-package com.ym.mec.biz.dal.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-
-import java.math.BigDecimal;
-
-public class MusicRepairDto {
-
-    @ApiModelProperty(value = "年限", required = false)
-    private BigDecimal num;
-
-    @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;
-    }
-
-    public void setNum(BigDecimal num) {
-        this.num = num;
-    }
-
-    public BigDecimal getActualAmount() {
-        return actualAmount;
-    }
-
-    public void setActualAmount(BigDecimal actualAmount) {
-        this.actualAmount = actualAmount;
-    }
-}

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherOrder.java

@@ -81,6 +81,12 @@ public class CloudTeacherOrder extends BaseEntity {
     private Long orderId;
 
     /**
+     * 平台订单id
+     */
+    @ApiModelProperty(value = "订单id")
+    private Long platformOrderId;
+
+    /**
      * 备注
      */
     @ApiModelProperty(value = "备注")
@@ -248,6 +254,7 @@ public class CloudTeacherOrder extends BaseEntity {
         sb.append(", refundAmount=").append(refundAmount);
         sb.append(", status=").append(status);
         sb.append(", orderId=").append(orderId);
+        sb.append(", platformOrderId=").append(platformOrderId);
         sb.append(", remark=").append(remark);
         sb.append(", createTime=").append(createTime);
         sb.append(", updateTime=").append(updateTime);
@@ -278,4 +285,20 @@ public class CloudTeacherOrder extends BaseEntity {
 	public void setStudentPaymentOrder(StudentPaymentOrder studentPaymentOrder) {
 		this.studentPaymentOrder = studentPaymentOrder;
 	}
+
+    public Long getPlatformOrderId() {
+        return platformOrderId;
+    }
+
+    public void setPlatformOrderId(Long platformOrderId) {
+        this.platformOrderId = platformOrderId;
+    }
+
+    public Integer getVersion() {
+        return version;
+    }
+
+    public void setVersion(Integer version) {
+        this.version = version;
+    }
 }

+ 49 - 45
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherStudent.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.enums.PeriodEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.math.BigDecimal;
@@ -36,20 +37,52 @@ public class CloudTeacherStudent {
     @ApiModelProperty(value = "所属分部")
     private String organName;
 
-    @ApiModelProperty(value = "乐团编号")
-    private String musicGroupId;
+    @ApiModelProperty(value = "团练宝类型")
+    private PeriodEnum type;
 
-    @ApiModelProperty(value = "团名称")
-    private String musicGroupName;
+    @ApiModelProperty(value = "团练宝类型名称")
+    private String typeName;
 
-    @ApiModelProperty(value = "合作单位")
-    private String cooperationOrganName;
+    @ApiModelProperty(value = "流水号")
+    private String transNo;
 
-    @ApiModelProperty(value = "团练宝类型")
-    private Integer type;
+    @ApiModelProperty(value = "订单号")
+    private String orderNo;
 
-    @ApiModelProperty(value = "团练宝类型")
-    private String typeName;
+    @ApiModelProperty(value = "订单时间")
+    private String orderTime;
+
+    @ApiModelProperty(value = "金额")
+    private BigDecimal amount;
+
+    @ApiModelProperty(value = "数量")
+    private Integer time;
+
+    // ------------------------------------------------------------------------------------------
+
+    public String getTransNo() {
+        return transNo;
+    }
+
+    public void setTransNo(String transNo) {
+        this.transNo = transNo;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getOrderTime() {
+        return orderTime;
+    }
+
+    public void setOrderTime(String orderTime) {
+        this.orderTime = orderTime;
+    }
 
     public String getTypeName() {
         return typeName;
@@ -59,11 +92,6 @@ public class CloudTeacherStudent {
         this.typeName = typeName;
     }
 
-    @ApiModelProperty(value = "数量")
-    private Integer time;
-
-    @ApiModelProperty(value = "金额")
-    private BigDecimal amount;
 
     public Integer getTenantId() {
         return tenantId;
@@ -105,19 +133,11 @@ public class CloudTeacherStudent {
         this.phone = phone;
     }
 
-    public BigDecimal getAmount() {
-        return amount;
-    }
-
-    public void setAmount(BigDecimal amount) {
-        this.amount = amount;
-    }
-
-    public Integer getType() {
+    public PeriodEnum getType() {
         return type;
     }
 
-    public void setType(Integer type) {
+    public void setType(PeriodEnum type) {
         this.type = type;
     }
 
@@ -153,27 +173,11 @@ public class CloudTeacherStudent {
         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 BigDecimal getAmount() {
+        return amount;
     }
 
-    public void setCooperationOrganName(String cooperationOrganName) {
-        this.cooperationOrganName = cooperationOrganName;
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
     }
 }

+ 15 - 89
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderActivity.java

@@ -1,14 +1,7 @@
 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;
 
@@ -18,48 +11,31 @@ import java.io.Serializable;
  * @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;
+public class MusicGroupPaymentCalenderActivity extends MusicGroupPaymentCalenderBase implements Serializable {
 
-    @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;
+    @ApiModelProperty(value = "活动名称")
+    private String activityName;
 
-    @TableField("create_time_")
-    @ApiModelProperty(value = "${column.comment}")
-    private Date createTime;
+    @ApiModelProperty(value = "课程类型名称")
+    private String categoryName;
 
-    @TableField("update_time_")
-    @ApiModelProperty(value = "${column.comment}")
-    private Date updateTime;
+    public String getActivityName() {
+        return activityName;
+    }
 
-    private static final long serialVersionUID = 1L;
+    public void setActivityName(String activityName) {
+        this.activityName = activityName;
+    }
 
-    public Long getId() {
-        return id;
+    public String getCategoryName() {
+        return categoryName;
     }
 
-    public void setId(Long id) {
-        this.id = id;
+    public void setCategoryName(String categoryName) {
+        this.categoryName = categoryName;
     }
 
     public Integer getActivityId() {
@@ -69,55 +45,5 @@ public class MusicGroupPaymentCalenderActivity implements Serializable {
     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;
-    }
-
-
 }
 

+ 93 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderBase.java

@@ -0,0 +1,93 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class MusicGroupPaymentCalenderBase {
+    private long id;
+
+    @ApiModelProperty(value = "数量", required = false)
+    private BigDecimal num;
+
+    @ApiModelProperty(value = "申请价格", required = false)
+    private BigDecimal actualAmount;
+
+    @ApiModelProperty(value = "原价", required = false)
+    private BigDecimal originalAmount;
+
+    @ApiModelProperty(value = "是否必选", required = false)
+    private Boolean optionalFlag = false;
+
+    @ApiModelProperty(value = "缴费项目编号", required = false)
+    private Long calenderId;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public BigDecimal getOriginalAmount() {
+        return originalAmount;
+    }
+
+    public void setOriginalAmount(BigDecimal originalAmount) {
+        this.originalAmount = originalAmount;
+    }
+
+    public Long getCalenderId() {
+        return calenderId;
+    }
+
+    public void setCalenderId(Long calenderId) {
+        this.calenderId = calenderId;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Boolean getOptionalFlag() {
+        return optionalFlag;
+    }
+
+    public void setOptionalFlag(Boolean optionalFlag) {
+        this.optionalFlag = optionalFlag;
+    }
+
+    public BigDecimal getNum() {
+        return num;
+    }
+
+    public void setNum(BigDecimal num) {
+        this.num = num;
+    }
+
+    public BigDecimal getActualAmount() {
+        return actualAmount;
+    }
+
+    public void setActualAmount(BigDecimal actualAmount) {
+        this.actualAmount = actualAmount;
+    }
+}

+ 39 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java

@@ -0,0 +1,39 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.enums.PeriodEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+public class MusicGroupPaymentCalenderMember extends MusicGroupPaymentCalenderBase{
+    @ApiModelProperty(value = "会员名称", required = false)
+    private String name;
+
+    @ApiModelProperty(value = "会员周期", required = false)
+    private PeriodEnum period;
+
+    @ApiModelProperty(value = "会员等级编号", required = false)
+    private Integer memberRankSettingId = 1;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public PeriodEnum getPeriod() {
+        return period;
+    }
+
+    public void setPeriod(PeriodEnum period) {
+        this.period = period;
+    }
+
+    public Integer getMemberRankSettingId() {
+        return memberRankSettingId;
+    }
+
+    public void setMemberRankSettingId(Integer memberRankSettingId) {
+        this.memberRankSettingId = memberRankSettingId;
+    }
+}

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderRepair.java

@@ -0,0 +1,4 @@
+package com.ym.mec.biz.dal.entity;
+
+public class MusicGroupPaymentCalenderRepair extends MusicGroupPaymentCalenderBase{
+}

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

@@ -81,6 +81,10 @@ public class TenantInfo implements Serializable {
     @ApiModelProperty(value = "状态0 草稿 1启动 2停用")
     private Integer state;
 
+    @TableField("user_id_")
+    @ApiModelProperty(value = "管理员账号id")
+    private Integer userId;
+
     @TableField("created_by_")
     @ApiModelProperty(value = "创建人")
     private Integer createdBy;
@@ -227,6 +231,14 @@ public class TenantInfo implements Serializable {
         this.state = state;
     }
 
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
     public Integer getCreatedBy() {
         return createdBy;
     }

+ 0 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherAddQueryInfo.java

@@ -8,7 +8,6 @@ import java.util.List;
 
 public class CloudTeacherAddQueryInfo extends QueryInfo {
 
-
 	@ApiModelProperty(value = "学生编号数组")
 	private List<Integer> studentIds;
 

+ 48 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherOrderQueryInfo.java

@@ -3,9 +3,15 @@ package com.ym.mec.biz.dal.page;
 import io.swagger.annotations.ApiModelProperty;
 
 import com.ym.mec.common.page.QueryInfo;
+import org.joda.time.DateTime;
+
+import java.util.Date;
 
 public class CloudTeacherOrderQueryInfo extends QueryInfo {
 
+	@ApiModelProperty(value = "乐团Id")
+	private String musicGroupId;
+
 	@ApiModelProperty(value = "交易状态(0-待生效 1-生效中 2-已生效 3-已退)")
 	private Integer status;
 
@@ -15,9 +21,35 @@ public class CloudTeacherOrderQueryInfo extends QueryInfo {
 	@ApiModelProperty(value = "学员姓名/编号/电话")
 	private String queryCondition;
 
+
+	@ApiModelProperty(value = "订单号")
+	private String orderNo;
+
 	@ApiModelProperty(value = "声部Id")
 	private Integer subjectId;
 
+	@ApiModelProperty(value = "开始时间")
+	private Date startTime;
+
+	public Date getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+
+	@ApiModelProperty(value = "结束时间")
+	private Date endTime;
+
 	public Integer getStatus() {
 		return status;
 	}
@@ -49,4 +81,20 @@ public class CloudTeacherOrderQueryInfo extends QueryInfo {
 	public void setSubjectId(Integer subjectId) {
 		this.subjectId = subjectId;
 	}
+
+	public String getOrderNo() {
+		return orderNo;
+	}
+
+	public void setOrderNo(String orderNo) {
+		this.orderNo = orderNo;
+	}
+
+	public String getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(String musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
 }

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

@@ -110,11 +110,11 @@ public interface CloudTeacherOrderService extends BaseService<Long, CloudTeacher
      */
     Map<String, Object> pay(List<CloudTeacherStudent> cloudTeacherStudents) throws Exception;
 
-    Msg payNotify(Msg msg);
+    Msg payNotify(Msg msg) throws Exception;
 
     Boolean payCheck(String orderNo);
 
-    PageInfo<CloudTeacherStudent> queryActiveRecord(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo);
+    PageInfo<CloudTeacherStudent> queryRecord(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo);
 
     boolean addStudents(CloudTeacherAddQueryInfo cloudTeacherAddQueryInfo);
 }

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

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderBase;
 import com.ym.mec.biz.dal.enums.CalenderBaseServiceEnum;
 
 import java.math.BigDecimal;
@@ -47,4 +48,13 @@ public interface MusicGroupPaymentCalenderBaseService {
     * @date 2021/12/21 23:35
     */
     BigDecimal getOriginalAmount(MusicGroupPaymentBaseCalender baseCalender);
+
+    /**
+    * @description: 缴费项目关联初始化
+     * @param bean
+    * @return T
+    * @author zx
+    * @date 2021/12/24 14:31
+    */
+    <T> T initBean(T bean);
 }

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

@@ -13,6 +13,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
 import com.ym.mec.biz.dal.page.ArrearageStudentsQueryInfo;
+import com.ym.mec.biz.dal.page.MusicCalenderDetailQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
@@ -109,4 +110,13 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
      * @return
      */
     void pushWaitRenewMessage(Long calenderId, String studentIds);
+
+    /**
+    * @description: 获取乐团学员缴费详情列表
+     * @param queryInfo
+    * @return java.lang.Object
+    * @author zx
+    * @date 2021/12/24 10:56
+    */
+    Object queryDetailPage(MusicCalenderDetailQueryInfo queryInfo);
 }

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

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember;
+import com.ym.mec.common.service.BaseService;
+
+public interface MusicGroupPaymentCalenderMemberService extends BaseService<Long, MusicGroupPaymentCalenderMember> {
+
+    void deleteByCalenderId(Long calenderId);
+}

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

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderRepair;
+import com.ym.mec.common.service.BaseService;
+
+public interface MusicGroupPaymentCalenderRepairService extends BaseService<Long, MusicGroupPaymentCalenderRepair> {
+
+    void deleteByCalenderId(Long calenderId);
+}

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -162,4 +162,6 @@ public interface StudentService extends BaseService<Integer, Student> {
      * @return
      */
     PageInfo<CloudTeacherActiveTargetDetailDto> countCloudTeacherActiveDetail(CloudTeacherActiveQueryInfo queryInfo);
+
+    int updateMembershipEndTime(Integer studentId, Date endTime);
 }

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

@@ -19,5 +19,7 @@ public interface TenantOrderRecordService extends IService<TenantOrderRecord> {
 
     Map<String, Object> checkTenantOrder(String orderNo);
 
+    void checkTenantOrder();
+
 }
 

+ 51 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java

@@ -22,6 +22,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.yqpay.Msg;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import jodd.util.StringUtil;
 import org.joda.time.LocalDateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,6 +32,9 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.ym.mec.biz.dal.enums.PeriodEnum.*;
 
 @Service
 public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTeacherOrder> implements CloudTeacherOrderService {
@@ -63,14 +67,16 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
             cloudTeacherOrder.setStudentId(stId);
             cloudTeacherOrder.setTime(cloudTeacherAddQueryInfo.getTimes());
             cloudTeacherOrder.setType(cloudTeacherAddQueryInfo.getAddType());
+            cloudTeacherOrder.setLevel(1);
+            cloudTeacherOrder.setTenantId(cloudTeacherAddQueryInfo.getTenantId());
             cloudTeacherOrderDao.insert(cloudTeacherOrder);
             this.addStudentCloudTeacher(cloudTeacherOrder);
         }
-        return false;
+        return true;
     }
 
     @Override
-    public PageInfo<CloudTeacherStudent> queryActiveRecord(CloudTeacherOrderQueryInfo queryInfo) {
+    public PageInfo<CloudTeacherStudent> queryRecord(CloudTeacherOrderQueryInfo queryInfo) {
         PageInfo<CloudTeacherStudent> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
@@ -118,19 +124,19 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
             JSONObject memberConfig = (JSONObject) cfg.get("member_config");
             Double divide;
             switch (cst.getType()) {
-                case 1:
+                case DAY:
                     divide = memberConfig.getDouble("day_divide");
                     break;
-                case 2:
+                case MONTH:
                     divide = memberConfig.getDouble("month_divide");
                     break;
-                case 3:
+                case QUARTERLY:
                     divide = memberConfig.getDouble("quarter_divide");
                     break;
-                case 4:
+                case YEAR_HALF:
                     divide = memberConfig.getDouble("half_year_divide");
                     break;
-                case 5:
+                case YEAR:
                     divide = memberConfig.getDouble("year_divide");
                     break;
                 default:
@@ -152,6 +158,11 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         if (cloudTeacherStudents.size() == 0) {
             throw new Exception("至少选择一条记录");
         }
+        List<Integer> ids = cloudTeacherStudents.stream().map(CloudTeacherStudent::getCloudTeacherOrderId).collect(
+                Collectors.toList());
+        if (cloudTeacherOrderDao.checkOrdered(StringUtil.join(ids, ",")) >= 0) {
+            throw new Exception("学生已经支付");
+        }
         Integer tenantId = null;
         for (CloudTeacherStudent cts: cloudTeacherStudents) {
             if (cts.getAmount() == null) {
@@ -198,13 +209,16 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         } else { // 消费大于 0 元 已支付 直接激活
             orderState = 1;
         }
-        createOrderRecord(tenantId, payAmount, orderNo, tenantEnum, orderState, cloudTeacherStudents);
+        TenantOrderRecord record = createOrderRecord(tenantId, payAmount, orderNo, tenantEnum, orderState, cloudTeacherStudents);
+        if (orderState == 1) { // 成功手直接成功
+            this.paySuccess(record);
+        }
         log.info("tenant pay >>>>> " + JSON.toJSONString(payMap));
         return payMap;
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public Msg payNotify(Msg msg) {
+    public Msg payNotify(Msg msg) throws Exception {
         log.info("tenant orderNotify >>>>> " + msg.toString());
         msg.setMsg("fail");
         Map<String, String> notifyMap = JSON.parseObject(msg.getResponseParameters(), Map.class);
@@ -220,10 +234,7 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
             //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");
+            this.paySuccess(record);
             record.setOrderState(1);
             msg.setCode("000000");
             msg.setMsg("success");
@@ -238,12 +249,21 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         return msg;
     }
 
-    public Boolean payCheck(String orderNo) {
-        TenantOrderRecord record = tenantOrderRecordService.getOne(new QueryWrapper<TenantOrderRecord>().eq("order_no_", orderNo));
-        return record.getOrderState() == 1;
+    private void paySuccess(TenantOrderRecord record) throws Exception {
+        log.info("tenant orderNotify update order status start" + record.getId().toString());
+
+        if (cloudTeacherOrderDao.updateOrderStatusOK(record.getId()) <= 0) {
+            throw new Exception("更新订单状态失败");
+        }
+        List<CloudTeacherOrder> cloudTeacherOrders = cloudTeacherOrderDao.findByPlatformOrderId(record.getId());
+        for (CloudTeacherOrder cto : cloudTeacherOrders) {
+            studentService.updateMembershipEndTime(cto.getStudentId(), cto.getEndTime());
+        }
+
+        log.info("tenant orderNotify update order status end");
     }
 
-    private void createOrderRecord(Integer tenantId, BigDecimal payAmount, String orderNo, TenantOrderRecordEnum tenantEnum, Integer orderState, List<CloudTeacherStudent> cloudTeacherStudents) {
+    private TenantOrderRecord createOrderRecord(Integer tenantId, BigDecimal payAmount, String orderNo, TenantOrderRecordEnum tenantEnum, Integer orderState, List<CloudTeacherStudent> cloudTeacherStudents) throws Exception {
         LocalDateTime now = LocalDateTime.now();
         TenantOrderRecord record = new TenantOrderRecord();
         record.setTenantId(tenantId);
@@ -258,8 +278,16 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         record.setCreatedTime(now.toDate());
         tenantOrderRecordService.save(record);
         for (CloudTeacherStudent cts : cloudTeacherStudents) {
-            cloudTeacherOrderDao.updateOrderId(cts.getCloudTeacherOrderId(), cts.getAmount(), record.getId());
+            if (cloudTeacherOrderDao.updateOrderId(cts.getCloudTeacherOrderId(), cts.getAmount(), record.getId()) <= 0) {
+                throw new Exception("更新订单失败");
+            }
         }
+        return record;
+    }
+
+    public Boolean payCheck(String orderNo) {
+        TenantOrderRecord record = tenantOrderRecordService.getOne(new QueryWrapper<TenantOrderRecord>().eq("order_no_", orderNo));
+        return record.getOrderState() == 1;
     }
 
     @Override
@@ -328,15 +356,15 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
     }
 
     private Date calcCloudTeacherOrderTime(CloudTeacherOrder cloudTeacherOrder, Date startTime, Date endTime) {
-        if (cloudTeacherOrder.getType().equals(1)) { // 日
+        if (cloudTeacherOrder.getType() == DAY) { // 日
             endTime = DateUtil.addDays(startTime, cloudTeacherOrder.getTime());
-        } else if (cloudTeacherOrder.getType().equals(2)) { // 月
+        } else if (cloudTeacherOrder.getType() == MONTH) { // 月
             endTime = DateUtil.addMonths(startTime, cloudTeacherOrder.getTime());
-        } else if (cloudTeacherOrder.getType().equals(3)) { // 季
+        } else if (cloudTeacherOrder.getType() == QUARTERLY) { // 季
             endTime = DateUtil.addMonths(startTime, cloudTeacherOrder.getTime() * 3);
-        } else if (cloudTeacherOrder.getType().equals(4)) { // 半年
+        } else if (cloudTeacherOrder.getType() == YEAR_HALF) { // 半年
             endTime = DateUtil.addMonths(startTime, cloudTeacherOrder.getTime() * 6);
-        } else if (cloudTeacherOrder.getType().equals(5)) { // 年
+        } else if (cloudTeacherOrder.getType() == YEAR) { // 年
             endTime = DateUtil.addYears(startTime, cloudTeacherOrder.getTime());
         }
         return endTime;

+ 16 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -11,20 +11,19 @@ import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.enums.EmployeeOperateEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.ParamEnum;
 import com.ym.mec.biz.dal.page.EmployeeQueryInfo;
-import com.ym.mec.biz.service.EmployeeService;
-import com.ym.mec.biz.service.ImGroupMemberService;
-import com.ym.mec.biz.service.ImUserFriendService;
-import com.ym.mec.biz.service.OaUserService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.im.entity.GroupMember;
@@ -68,6 +67,8 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 	private CooperationOrganDao cooperationOrganDao;
 	@Autowired
 	private OaUserService oaUserService;
+    @Autowired
+    private TenantInfoService tenantInfoService;
 
 	@Override
 	public BaseDAO<Integer, Employee> getDAO() {
@@ -112,8 +113,8 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 			employee.setAvatar(user.getAvatar());
 		}
 
-		//todo 添加到OA 临时注释
-//		oaUserService.addOaUser(employee);
+		//添加到OA
+		oaUserService.addOaUser(employee);
 	}
 
 	@Override
@@ -144,6 +145,15 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 		imFeignService.update(new ImUserModel(employee.getUserId().toString(),employee.getRealName(),sysUser.getAvatar()));
 
 		employee.setAvatar(sysUser.getAvatar());
+        //更新机构信息
+        TenantInfo tenantInfo = tenantInfoService.getOne(new WrapperUtil<TenantInfo>()
+                .hasEq("user_id_",employee.getId()).queryWrapper());
+        if(Objects.nonNull(tenantInfo) && !Objects.equals(tenantInfo.getPhone(),employee.getPhone())){
+            tenantInfo.setPhone(employee.getPhone());
+            tenantInfo.setUpdatedTime(new Date());
+            tenantInfo.setUpdatedBy(sysUser.getId());
+            tenantInfoService.updateById(tenantInfo);
+        }
 
 		//更新OA信息
 		oaUserService.updateOaUser(employee);

+ 3 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberPrivilegesItemServiceImpl.java

@@ -7,10 +7,9 @@ import com.ym.mec.biz.dal.page.MemberPrivilegesItemQueryInfo;
 import com.ym.mec.biz.service.MemberPrivilegesItemService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.filters.TenantIdThreadLocal;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.common.tenant.TenantContextHolder;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -26,6 +25,8 @@ public class MemberPrivilegesItemServiceImpl extends BaseServiceImpl<Integer, Me
 	@Autowired
 	private MemberRankPrivilegesDao memberRankPrivilegesDao;
 
+
+
 	@Override
 	public BaseDAO<Integer, MemberPrivilegesItem> getDAO() {
 		return memberPrivilegesItemDao;

+ 44 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java

@@ -1,30 +1,46 @@
 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.dao.VipGroupActivityDao;
+import com.ym.mec.biz.dal.dao.VipGroupCategoryDao;
+import com.ym.mec.biz.dal.dto.ConditionDto;
 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.dal.entity.MusicGroupPaymentCalenderBase;
 import com.ym.mec.biz.dal.entity.VipGroupActivity;
 import com.ym.mec.biz.dal.enums.CalenderBaseServiceEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderActivityService;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
-import com.ym.mec.biz.service.VipGroupActivityService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
-public class MusicGroupPaymentCalenderActivityServiceImpl extends ServiceImpl<MusicGroupPaymentCalenderActivityDao, MusicGroupPaymentCalenderActivity>
+public class MusicGroupPaymentCalenderActivityServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderActivity>
         implements MusicGroupPaymentCalenderActivityService, MusicGroupPaymentCalenderBaseService {
 
     @Autowired
+    private MusicGroupPaymentCalenderActivityDao musicGroupPaymentCalenderActivityDao;
+
+    @Override
+    public BaseDAO<Long, MusicGroupPaymentCalenderActivity> getDAO() {
+        return musicGroupPaymentCalenderActivityDao;
+    }
+
+    @Autowired
     private VipGroupActivityDao vipGroupActivityDao;
+    @Autowired
+    private VipGroupCategoryDao vipGroupCategoryDao;
 
     public MusicGroupPaymentCalenderActivityServiceImpl() {
         MusicGroupPaymentCalenderBaseService.calenderBaseServiceMap.put(CalenderBaseServiceEnum.ACTIVITY,this);
@@ -61,21 +77,43 @@ public class MusicGroupPaymentCalenderActivityServiceImpl extends ServiceImpl<Mu
     }
 
     @Override
+    public <T> T initBean(T bean) {
+        if(bean != null){
+            List<MusicGroupPaymentCalenderActivity> calenderActivities = (List<MusicGroupPaymentCalenderActivity>) bean;
+            List<Integer> collect = calenderActivities.stream().map(e -> e.getActivityId()).collect(Collectors.toList());
+            List<VipGroupActivity> vipGroupActivities = vipGroupActivityDao.queryByIds(StringUtils.join(collect, ","));
+            List<ConditionDto> conditionCategorys = vipGroupCategoryDao.findConditionCategorys();
+            Map<Long, String> categoryNameMap = conditionCategorys.stream().collect(Collectors.toMap(ConditionDto::getId, ConditionDto::getName));
+            Map<Integer, VipGroupActivity> vipGroupActivityMap = vipGroupActivities.stream().collect(Collectors.toMap(VipGroupActivity::getId, s->s));
+            calenderActivities.forEach(e -> {
+                VipGroupActivity activity1 = vipGroupActivityMap.get(e.getActivityId());
+                if(activity1 != null){
+                    e.setOriginalAmount(activity1.getMarketPrice());
+                    e.setActivityName(activity1.getName());
+                    e.setNum(new BigDecimal(activity1.getMaxCourseNum()));
+                    e.setCategoryName(categoryNameMap.get(Long.parseLong(activity1.getVipGroupCategoryIdList())));
+                }
+            });
+        }
+        return bean;
+    }
+
+    @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);
+            musicGroupPaymentCalenderActivityDao.insertBatch(calenderActivityList);
         }
     }
 
     @Override
     public void delByCalenderId(Long calenderId) {
-        baseMapper.delByCalenderId(calenderId);
+        musicGroupPaymentCalenderActivityDao.delByCalenderId(calenderId);
     }
 
     @Override
     public List<MusicGroupPaymentCalenderActivity> findByCalenderId(Long calenderId) {
-        return baseMapper.findByCalenderId(calenderId);
+        return musicGroupPaymentCalenderActivityDao.findByCalenderId(calenderId);
     }
 }

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

@@ -193,4 +193,9 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 		}
         return BigDecimal.ZERO;
     }
+
+	@Override
+	public <T> T initBean(T bean) {
+		return null;
+	}
 }

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

@@ -1,43 +1,68 @@
 package com.ym.mec.biz.service.impl;
 
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.*;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.MusicArrearageStudentDto;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
-import com.ym.mec.biz.dal.enums.PeriodEnum;
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
-import com.ym.mec.biz.dal.page.ArrearageStudentsQueryInfo;
-import com.ym.mec.biz.event.source.GroupEventSource;
-import com.ym.mec.biz.service.*;
-import com.ym.mec.common.constant.CommonConstants;
-import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
-import com.ym.mec.util.date.DateUtil;
-
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
 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.CloudTeacherOrderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderStudentDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
+import com.ym.mec.biz.dal.dto.MusicArrearageStudentDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
+import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
+import com.ym.mec.biz.dal.page.ArrearageStudentsQueryInfo;
+import com.ym.mec.biz.dal.page.MusicCalenderDetailQueryInfo;
+import com.ym.mec.biz.event.source.GroupEventSource;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderActivityService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
@@ -603,7 +628,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		musicGroupPaymentCalender.setExpectNum(currentNum < 0 ? 0 : currentNum);
 		musicGroupPaymentCalender.setUpdateTime(new Date());
 		musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
-		
+
 		musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderDetailIds);
 		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdList);
 	}
@@ -666,4 +691,11 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.STUDENT_SMS_WAIT_RENEW_MESSAGE, studentMaps,
 				null, 0, memo, null, musicGroup.getName());
 	}
+
+    @Override
+    public Object queryDetailPage(MusicCalenderDetailQueryInfo queryInfo) {
+		PageInfo<MusicGroupPaymentCalenderDetail> calenderDetailPageInfo = queryPage(queryInfo);
+
+		return null;
+    }
 }

+ 43 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberPaymentCalenderServiceImpl.java → mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderMemberServiceImpl.java

@@ -1,18 +1,19 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.MemberFeeSettingDao;
-import com.ym.mec.biz.dal.dto.CalenderMemberDto;
+import com.ym.mec.biz.dal.dao.MemberRankSettingDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderMemberDao;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
-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.dal.enums.CalenderBaseServiceEnum;
 import com.ym.mec.biz.dal.enums.PeriodEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderMemberService;
+import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.Assert;
 
 import java.math.BigDecimal;
 
@@ -20,12 +21,23 @@ import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalende
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 
 @Service
-public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalenderBaseService {
+public class MusicGroupPaymentCalenderMemberServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderMember>
+        implements MusicGroupPaymentCalenderBaseService, MusicGroupPaymentCalenderMemberService {
+
+    @Autowired
+    private MusicGroupPaymentCalenderMemberDao musicGroupPaymentCalenderMemberDao;
+
+    @Override
+    public BaseDAO<Long, MusicGroupPaymentCalenderMember> getDAO() {
+        return musicGroupPaymentCalenderMemberDao;
+    }
 
     @Autowired
     private MemberFeeSettingDao memberFeeSettingDao;
+    @Autowired
+    private MemberRankSettingDao memberRankSettingDao;
 
-    public MemberPaymentCalenderServiceImpl() {
+    public MusicGroupPaymentCalenderMemberServiceImpl() {
         MusicGroupPaymentCalenderBaseService.calenderBaseServiceMap.put(CalenderBaseServiceEnum.MEMBER,this);
     }
 
@@ -36,7 +48,7 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
 
     @Override
     public MusicGroupPaymentCalender.PaymentCalenderStatusEnum checkComponentAmount(MusicGroupPaymentBaseCalender baseCalender) {
-        CalenderMemberDto calenderMember = baseCalender.getCalenderMember();
+        MusicGroupPaymentCalenderMember calenderMember = baseCalender.getCalenderMember();
         if(calenderMember != null){
             MusicGroup musicGroup = baseCalender.getMusicGroup();
             //会员价格是否变动
@@ -45,7 +57,7 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
                 throw new BizException("操作失败:请配置当前分部会员收费标准");
             }
             //获取会员总价
-            BigDecimal memberPaymentAmount = getGroupPurchaseFee(calenderMember.getPeriodEnum(),memberFee).multiply(new BigDecimal(calenderMember.getMemberNum())).setScale(0, BigDecimal.ROUND_HALF_UP);
+            BigDecimal memberPaymentAmount = getGroupPurchaseFee(calenderMember.getPeriod(),memberFee).multiply(calenderMember.getNum()).setScale(0, BigDecimal.ROUND_HALF_UP);
             if(memberPaymentAmount.compareTo(calenderMember.getActualAmount()) != 0){
                 return AUDITING;
             }
@@ -55,7 +67,7 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
 
     @Override
     public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
-        CalenderMemberDto calenderMember = baseCalender.getCalenderMember();
+        MusicGroupPaymentCalenderMember calenderMember = baseCalender.getCalenderMember();
         if(calenderMember != null){
             return calenderMember.getActualAmount();
         }
@@ -64,7 +76,7 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
 
     @Override
     public BigDecimal getOriginalAmount(MusicGroupPaymentBaseCalender baseCalender) {
-        CalenderMemberDto calenderMember = baseCalender.getCalenderMember();
+        MusicGroupPaymentCalenderMember calenderMember = baseCalender.getCalenderMember();
         if(calenderMember != null){
             MusicGroup musicGroup = baseCalender.getMusicGroup();
             //会员价格是否变动
@@ -73,12 +85,25 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
                 throw new BizException("操作失败:请配置当前分部会员收费标准");
             }
             //获取会员总价
-            return getGroupPurchaseFee(calenderMember.getPeriodEnum(),memberFee).
-                    multiply(new BigDecimal(calenderMember.getMemberNum())).setScale(0, BigDecimal.ROUND_HALF_UP);
+            return getGroupPurchaseFee(calenderMember.getPeriod(),memberFee).
+                    multiply(calenderMember.getNum()).setScale(0, BigDecimal.ROUND_HALF_UP);
         }
         return BigDecimal.ZERO;
     }
 
+    @Override
+    public <T> T initBean(T bean) {
+        if(bean != null){
+            MusicGroupPaymentCalenderMember calenderMember = (MusicGroupPaymentCalenderMember)bean;
+            MemberRankSetting memberRankSetting = memberRankSettingDao.get(calenderMember.getMemberRankSettingId());
+            if(memberRankSetting == null){
+                throw new BizException("会员信息不存在");
+            }
+            calenderMember.setName(memberRankSetting.getName());
+        }
+        return bean;
+    }
+
     private BigDecimal getGroupPurchaseFee(PeriodEnum periodEnum,MemberFeeSetting memberFee){
         switch (periodEnum){
             case DAY :
@@ -95,4 +120,9 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
                 throw new BizException("请选择正确的会员有效期");
         }
     }
+
+    @Override
+    public void deleteByCalenderId(Long calenderId) {
+        musicGroupPaymentCalenderMemberDao.deleteByCalenderId(calenderId);
+    }
 }

+ 29 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicRepairPaymentCalenderServiceImpl.java → mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderRepairServiceImpl.java

@@ -1,13 +1,18 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderRepairDao;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
-import com.ym.mec.biz.dal.dto.MusicRepairDto;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderBase;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderRepair;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.enums.CalenderBaseServiceEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderRepairService;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysTenantConfigService;
+import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,12 +24,20 @@ import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalende
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 
 @Service
-public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentCalenderBaseService {
+public class MusicGroupPaymentCalenderRepairServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderRepair> implements MusicGroupPaymentCalenderBaseService, MusicGroupPaymentCalenderRepairService {
+
+    @Autowired
+    private MusicGroupPaymentCalenderRepairDao musicGroupPaymentCalenderRepairDao;
+
+    @Override
+    public BaseDAO<Long, MusicGroupPaymentCalenderRepair> getDAO() {
+        return musicGroupPaymentCalenderRepairDao;
+    }
 
     @Autowired
     private SysTenantConfigService sysTenantConfigService;
 
-    public MusicRepairPaymentCalenderServiceImpl() {
+    public MusicGroupPaymentCalenderRepairServiceImpl() {
         MusicGroupPaymentCalenderBaseService.calenderBaseServiceMap.put(CalenderBaseServiceEnum.MUSIC_REPAIR,this);
     }
 
@@ -35,7 +48,7 @@ public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentC
 
     @Override
     public MusicGroupPaymentCalender.PaymentCalenderStatusEnum checkComponentAmount(MusicGroupPaymentBaseCalender baseCalender) {
-        MusicRepairDto musicRepair = baseCalender.getMusicRepair();
+        MusicGroupPaymentCalenderRepair musicRepair = baseCalender.getMusicRepair();
         if(musicRepair != null){
             Integer tenantId = TenantContextHolder.getTenantId();
             String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONE_YEAR_MUSICAL_REPAIR_AMOUNT, tenantId);
@@ -53,7 +66,7 @@ public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentC
 
     @Override
     public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
-        MusicRepairDto musicRepair = baseCalender.getMusicRepair();
+        MusicGroupPaymentCalenderRepair musicRepair = baseCalender.getMusicRepair();
         if(musicRepair != null){
             return musicRepair.getActualAmount();
         }
@@ -62,7 +75,7 @@ public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentC
 
     @Override
     public BigDecimal getOriginalAmount(MusicGroupPaymentBaseCalender baseCalender) {
-        MusicRepairDto musicRepair = baseCalender.getMusicRepair();
+        MusicGroupPaymentCalenderRepair musicRepair = baseCalender.getMusicRepair();
         if(musicRepair != null){
             Integer tenantId = TenantContextHolder.getTenantId();
             String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONE_YEAR_MUSICAL_REPAIR_AMOUNT, tenantId);
@@ -74,4 +87,14 @@ public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentC
         }
         return BigDecimal.ZERO;
     }
+
+    @Override
+    public <T> T initBean(T bean) {
+        return null;
+    }
+
+    @Override
+    public void deleteByCalenderId(Long calenderId) {
+        musicGroupPaymentCalenderRepairDao.deleteByCalenderId(calenderId);
+    }
 }

+ 86 - 85
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -1,48 +1,22 @@
 package com.ym.mec.biz.service.impl;
 
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.*;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_COURSE;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_STUDENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_RENEW;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.SPAN_GROUP_CLASS_ADJUST;
-import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
-
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
-import com.alibaba.fastjson.JSONObject;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.*;
-import com.ym.mec.biz.event.source.GroupEventSource;
-import com.ym.mec.biz.service.*;
-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;
-
 import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto.MusicGroupPaymentDateRange;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
+import com.ym.mec.biz.event.source.GroupEventSource;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -51,9 +25,25 @@ 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 org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
-import javax.annotation.Resource;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.*;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*;
+import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 
 @Service
 public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalender> implements MusicGroupPaymentCalenderService {
@@ -65,7 +55,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Autowired
 	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 	@Autowired
-	private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
+	private MusicGroupPaymentCalenderCourseSettingsServiceImpl musicGroupPaymentCalenderCourseSettingsService;
 	@Autowired
 	private MusicGroupOrganizationCourseSettingsDetailDao musicGroupOrganizationCourseSettingsDetailDao;
 	@Autowired
@@ -125,7 +115,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Autowired
 	private CloudTeacherOrderDao cloudTeacherOrderDao;
 	@Autowired
-	private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
+	private MusicGroupPaymentCalenderActivityServiceImpl musicGroupPaymentCalenderActivityService;
+	@Autowired
+	private MusicGroupPaymentCalenderMemberServiceImpl musicGroupPaymentCalenderMemberService;
+	@Autowired
+	private MusicGroupPaymentCalenderRepairServiceImpl musicGroupPaymentCalenderRepairService;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -570,35 +564,33 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentBaseCalender.setMusicGroup(musicGroup);
 
 		//检测缴费项目是否有费用变更
-		Map<CalenderBaseServiceEnum, MusicGroupPaymentCalenderBaseService> calenderBaseServiceMap = MusicGroupPaymentCalenderBaseService.calenderBaseServiceMap;
+//		Map<CalenderBaseServiceEnum, MusicGroupPaymentCalenderBaseService> calenderBaseServiceMap = MusicGroupPaymentCalenderBaseService.calenderBaseServiceMap;
 
 		//计算缴费项目总金额
-		BigDecimal courseActualAmount = ((MusicGroupPaymentCalenderCourseSettingsServiceImpl) musicGroupPaymentCalenderCourseSettingsService).getActualAmount(musicGroupPaymentBaseCalender);
-		BigDecimal currentTotalAmount = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MEMBER).getActualAmount(musicGroupPaymentBaseCalender);
-		currentTotalAmount = currentTotalAmount.add(courseActualAmount);
-		currentTotalAmount = currentTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.MUSIC_REPAIR).getActualAmount(musicGroupPaymentBaseCalender));
-		currentTotalAmount = currentTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.ACTIVITY).getActualAmount(musicGroupPaymentBaseCalender));
+		BigDecimal courseActualAmount = musicGroupPaymentCalenderCourseSettingsService.getActualAmount(musicGroupPaymentBaseCalender);
+		BigDecimal memberActualAmount = musicGroupPaymentCalenderMemberService.getActualAmount(musicGroupPaymentBaseCalender);
+		BigDecimal repairActualAmount = musicGroupPaymentCalenderRepairService.getActualAmount(musicGroupPaymentBaseCalender);
+		BigDecimal activityActualAmount = musicGroupPaymentCalenderActivityService.getActualAmount(musicGroupPaymentBaseCalender);
+
+		BigDecimal currentTotalAmount = courseActualAmount.add(memberActualAmount)
+				.add(repairActualAmount)
+				.add(activityActualAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
 
 		//计算缴费项目原价
-		BigDecimal memberOriginalAmount = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MEMBER).getOriginalAmount(musicGroupPaymentBaseCalender);
-		BigDecimal originalTotalAmount = memberOriginalAmount;
-		originalTotalAmount = originalTotalAmount.add(((MusicGroupPaymentCalenderCourseSettingsServiceImpl)musicGroupPaymentCalenderCourseSettingsService).getOriginalAmount(musicGroupPaymentBaseCalender));
-		originalTotalAmount = originalTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.MUSIC_REPAIR).getOriginalAmount(musicGroupPaymentBaseCalender));
-		originalTotalAmount = originalTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.ACTIVITY).getOriginalAmount(musicGroupPaymentBaseCalender));
+		BigDecimal courseOriginalAmount = musicGroupPaymentCalenderCourseSettingsService.getOriginalAmount(musicGroupPaymentBaseCalender);
+		BigDecimal memberOriginalAmount = musicGroupPaymentCalenderMemberService.getOriginalAmount(musicGroupPaymentBaseCalender);
+		BigDecimal activityOriginalAmount = musicGroupPaymentCalenderRepairService.getOriginalAmount(musicGroupPaymentBaseCalender);
+		BigDecimal repairOriginalAmount = musicGroupPaymentCalenderActivityService.getOriginalAmount(musicGroupPaymentBaseCalender);
+
+		BigDecimal originalTotalAmount = courseOriginalAmount.add(memberOriginalAmount)
+				.add(activityOriginalAmount)
+				.add(repairOriginalAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
 
 		PaymentCalenderStatusEnum status;
 		if (musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
 			status = AUDITING;
 		} else {
-			int compare = currentTotalAmount.setScale(0, BigDecimal.ROUND_HALF_UP).compareTo(originalTotalAmount.setScale(0, BigDecimal.ROUND_HALF_UP));
-			status = compare == 0?NO:AUDITING;
-//			status = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MEMBER).checkComponentAmount(musicGroupPaymentBaseCalender);
-//			if(status != AUDITING){
-//				status = calenderBaseServiceMap.get(CalenderBaseServiceEnum.COURSE).checkComponentAmount(musicGroupPaymentBaseCalender);
-//			}
-//			if(status != AUDITING){
-//				status = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MUSIC_REPAIR).checkComponentAmount(musicGroupPaymentBaseCalender);
-//			}
+			status = currentTotalAmount.compareTo(originalTotalAmount) == 0 ? NO:AUDITING;
 		}
 
 		Date date = new Date();
@@ -617,25 +609,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalender.setPaymentAmount(courseActualAmount);
 		musicGroupPaymentCalender.setCurrentTotalAmount(currentTotalAmount);
 		musicGroupPaymentCalender.setOriginalTotalAmount(originalTotalAmount);
-
-		//会员缴费信息
-		CalenderMemberDto calenderMember = musicGroupPaymentBaseCalender.getCalenderMember();
-		if(calenderMember != null){
-			//设置会员缴费金额、级别以及有效期
-			musicGroupPaymentCalender.setMemberPaymentAmount(calenderMember.getActualAmount());
-			musicGroupPaymentCalender.setMemberRankSettingId(calenderMember.getMemberRankSettingId());
-			musicGroupPaymentCalender.setMemberValidDate(calenderMember.getMemberNum());
-			musicGroupPaymentCalender.setMemberPeriod(calenderMember.getPeriodEnum());
-			musicGroupPaymentCalender.setMemberOptionalFlag(calenderMember.getOptionalFlag());
-			musicGroupPaymentCalender.setOriginalMemberPaymentAmount(memberOriginalAmount);
-		}
-		//乐保缴费信息
-		MusicRepairDto musicRepair = musicGroupPaymentBaseCalender.getMusicRepair();
-		if(musicRepair != null){
-			musicGroupPaymentCalender.setMusicRepairNum(musicRepair.getNum());
-			musicGroupPaymentCalender.setMusicRepairActualPrice(musicRepair.getActualAmount());
-			musicGroupPaymentCalender.setMusicRepairOptionalFlag(musicRepair.getOptionalFlag());
-		}
 		musicGroupPaymentCalender.setStatus(status);
 
 		if (musicGroupPaymentCalender.getStatus() != AUDITING) {
@@ -652,12 +625,31 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		String batchNo = idGeneratorService.generatorId() + "";
 		musicGroupPaymentCalender.setBatchNo(batchNo);
 		musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
-
-		//课程费用列表
+		Long calenderId = musicGroupPaymentCalender.getId();
+		//保存会员缴费信息
+		MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentBaseCalender.getCalenderMember();
+		if(calenderMember != null){
+			calenderMember = musicGroupPaymentCalenderMemberService.initBean(musicGroupPaymentBaseCalender.getCalenderMember());
+			calenderMember.setOriginalAmount(memberOriginalAmount);
+			calenderMember.setCalenderId(calenderId);
+			musicGroupPaymentCalenderMemberService.insert(calenderMember);
+		}
+		//保存乐保缴费信息
+		MusicGroupPaymentCalenderRepair musicRepair = musicGroupPaymentBaseCalender.getMusicRepair();
+		if(musicRepair != null){
+			musicRepair.setOriginalAmount(repairOriginalAmount);
+			musicRepair.setCalenderId(calenderId);
+			musicGroupPaymentCalenderRepairService.insert(musicRepair);
+		}
+		//保存活动缴费信息
+		List<MusicGroupPaymentCalenderActivity> calenderActivityList = musicGroupPaymentBaseCalender.getCalenderActivityList();
+		if(calenderActivityList != null && calenderActivityList.size() > 0){
+			musicGroupPaymentCalenderActivityService.initBean(calenderActivityList);
+			musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender,calenderId);
+		}
+		//保存课程费用列表
 		musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList());
 		musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
-		//活动费用列表
-		musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender,musicGroupPaymentCalender.getId());
 
 		// 如果是报名,需要修改乐团状态
 		if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY) {
@@ -686,24 +678,31 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Override
 	public Object getDetail(Long id) {
+		Map<String, Object> result = new HashMap<>(4);
+		//获取缴费项目详情
 		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
+		//统计预计缴费人数
 		Map<Long, Long> expectNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countExpectNum(id));
+		//统计实际缴费人数
 		Map<Long, Long> actualNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countActualNum(id));
 		calender.setActualNum(actualNumMap.get(id) == null ? 0 : actualNumMap.get(id).intValue());
 		calender.setExpectNum(expectNumMap.get(id) == null ? 0 : expectNumMap.get(id).intValue());
+		//汇总收款金额
 		BigDecimal sumActualAmount = musicGroupPaymentCalenderDetailDao.sumActualAmount(id);
+		result.put("sumActualAmount", sumActualAmount);
 		//收费标准名称
-		String name = musicGroupPaymentCalenderDao.getCalenderSettingsName(id);
-		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(id);
-		Map<String, Object> result = new HashMap<>(4);
-		result.put("musicGroupPaymentCalenderCourseSettings", musicGroupPaymentCalenderCourseSettings);
+//		String name = musicGroupPaymentCalenderDao.getCalenderSettingsName(id);
+//		result.put("calenderSettingsName", name);
+		//收费标准
+		result.put("musicGroupPaymentCalenderCourseSettings", musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(id));
+		//会员信息
 		if(calender.getMemberRankSettingId() != null){
 			MemberRankSetting memberRankSetting = memberRankSettingDao.get(calender.getMemberRankSettingId());
 			calender.setMemberRankSettingName(memberRankSetting.getName());
 		}
+		//活动相关信息
+		result.put("activity",musicGroupPaymentCalenderActivityService.findByCalenderId(id));
 		result.put("calender", calender);
-		result.put("calenderSettingsName", name);
-		result.put("sumActualAmount", sumActualAmount);
 		return result;
 	}
 
@@ -1715,6 +1714,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
 		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderId(id);
 		musicGroupPaymentCalenderActivityService.delByCalenderId(id);
+		musicGroupPaymentCalenderMemberService.deleteByCalenderId(id);
+		musicGroupPaymentCalenderRepairService.deleteByCalenderId(id);
 		List<Long> calenderIds = new ArrayList<Long>();
 		calenderIds.add(id);
 		musicGroupPaymentCalenderCourseSettingsService.deleteByMusicGroupPaymentCalenderId(calenderIds);

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -1208,7 +1208,7 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
     @Override
     public PageInfo<CloudTeacherActiveTargetDetailDto> countCloudTeacherActiveDetail(CloudTeacherActiveQueryInfo queryInfo) {
         PageInfo<CloudTeacherActiveTargetDetailDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
-        Map<String, Object> params = new HashMap<String, Object>();
+        Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
 
         List<CloudTeacherActiveTargetDetailDto> dataList = null;
@@ -1224,4 +1224,9 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         pageInfo.setRows(dataList);
         return pageInfo;
     }
+
+    @Override
+    public int updateMembershipEndTime(Integer studentId, Date endTime) {
+        return studentDao.updateMembershipEndTime(studentId, endTime);
+    }
 }

+ 55 - 45
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -85,7 +85,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     @Override
     public void addTenantInfo(TenantInfoDto dto) {
         //校验手机号是否唯一
-        checkPhone(dto);
+        RBucket<Object> bucket = checkPhone(dto);
         //校验营业执照信息
         checkTsign(dto.getTsignCode());
 
@@ -106,6 +106,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
                 tenantProductInfoService::addTenantProduct);
         //添加机构配置
         setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::addConfig);
+        //释放
+        bucket.delete();
     }
 
     /**
@@ -114,25 +116,25 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void updateTenantInfo(TenantInfoDto dto) {
-        //机构id
-        Integer tenantId = Optional.ofNullable(dto)
-                .map(TenantInfoDto::getId)
-                .orElseThrow(() -> new BizException("机构信息不能为空!"));
-
         //查询机构信息
-        TenantInfo tenantInfo = this.getById(tenantId);
-        if (Objects.isNull(tenantInfo)) {
-            throw new BizException("未找到该机构信息!");
-        }
+        TenantInfo tenantInfo = Optional.ofNullable(dto)
+                .map(TenantInfoDto::getId)
+                .map(this::getById)
+                .orElseThrow(() -> new BizException("未找到该机构信息,机构信息不能为空!"));
 
         //机构状态 1已缴费,并且 机构注册的手机号与本次修改后的手机号不同,就证明本次修改了手机号 则需要修改机构的账号信息
         if (1 == tenantInfo.getPayState() && !Objects.equals(tenantInfo.getPhone(), dto.getPhone())) {
             //校验修改后的手机号是否是唯一
-            checkPhone(dto);
-            //修改机构用户手机号(登录账号)信息
-            SysUser tenantUser = sysUserFeignService.queryUserByMobile(tenantInfo.getPhone());
-            tenantUser.setPhone(dto.getPhone());
-            sysUserFeignService.updateSysUser(tenantUser);
+            RBucket<Object> bucket = checkPhone(dto);
+            //
+            if (Objects.nonNull(tenantInfo.getUserId())) {
+                //
+                SysUser tenantUser = sysUserFeignService.queryUserById(tenantInfo.getUserId());
+                tenantUser.setPhone(dto.getPhone());
+                sysUserFeignService.updateSysUser(tenantUser);
+            }
+            //释放锁
+            bucket.delete();
         }
 
         //机构状态 0未缴费
@@ -140,8 +142,10 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             //校验营业执照信息
             checkTsign(dto.getTsignCode());
             //修改产品
-            setIdByApply(tenantId, dto.getProductInfo(), dto.getProductInfo()::setTenantId,
-                    tenantProductInfoService::updateTenantProduct);
+            if (Objects.nonNull(dto.getProductInfo())) {
+                setIdByApply(tenantInfo.getId(), dto.getProductInfo(), dto.getProductInfo()::setTenantId,
+                        tenantProductInfoService::updateTenantProduct);
+            }
         }
 
         Date now = new Date();
@@ -151,7 +155,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         this.updateById(tenantInfo);
 
         //修改机构配置
-        setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::updateConfig);
+        if (Objects.nonNull(dto.getConfig())) {
+            setIdByApply(tenantInfo.getId(), dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::updateConfig);
+        }
     }
 
     /**
@@ -195,33 +201,33 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      * 第一个启用默认激活账号等信息
      *
      * @param id    机构id
-     * @param state 机构状态 0草稿 1启动 2停用
+     * @param state 机构状态1启动 2停用
      */
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void opsTenantState(Integer id, Integer state) {
-        if (Objects.nonNull(state)) {
-            if (state == 1 || state == 2) {
-                TenantInfo tenantInfo = baseMapper.selectById(id);
-                if (Objects.isNull(tenantInfo)) {
-                    throw new BizException("该机构数据异常! ID : [" + id + "]");
+        if (Objects.nonNull(state) && state == 1 || state == 2) {
+            TenantInfo tenantInfo = baseMapper.selectById(id);
+            if (Objects.isNull(tenantInfo)) {
+                throw new BizException("该机构数据异常! ID : [" + id + "]");
+            }
+            Integer userId = getUserId();
+            tenantInfo.setUpdatedBy(userId);
+            tenantInfo.setUpdatedTime(new Date());
+            tenantInfo.setState(state);
+            //状态= 开通
+            if (state == 1) {
+                if (tenantInfo.getPayState() == 0) {
+                    throw new BizException("机构未缴费无法开通!");
                 }
-                Integer userId = getUserId();
-                tenantInfo.setUpdatedBy(userId);
-                tenantInfo.setUpdatedTime(new Date());
-                tenantInfo.setState(state);
-                //状态= 开通并且已支付完成
-                if (state == 1) {
-                    if (tenantInfo.getPayState() == 1) {
-                        //判断是否初次启用
-                        firstOpen(tenantInfo);
-                    } else {
-                        throw new BizException("机构未缴费无法开通!");
-                    }
+                //已支付完成 并且 没有创建用户信息
+                if (tenantInfo.getPayState() == 1 && Objects.isNull(tenantInfo.getUserId())) {
+                    //初次开通
+                    checkFirstOpen(tenantInfo);
                 }
-                baseMapper.updateById(tenantInfo);
-                return;
             }
+            baseMapper.updateById(tenantInfo);
+            return;
         }
         throw new BizException("传入机构状态参数异常!");
     }
@@ -231,7 +237,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      *
      * @param tenantInfo 机构信息
      */
-    private void firstOpen(TenantInfo tenantInfo) {
+    private void checkFirstOpen(TenantInfo tenantInfo) {
         Integer tenantId = tenantInfo.getId();
         SysUser user = sysUserFeignService.queryUserByMobile(tenantInfo.getPhone());
         if (Objects.nonNull(user)) {
@@ -267,8 +273,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         // 创建账号、用户信息、用户和角色关系
         createUser(tenantInfo, orgId, Lists.newArrayList(roleId));
         //建立角色和菜单关系数据
-         Lists.partition(collectMenuId, 50)
-                         .forEach(idList -> employeeService.batchInsertRoleMenu(roleId, idList, tenantId));
+        Lists.partition(collectMenuId, 50)
+                .forEach(idList -> employeeService.batchInsertRoleMenu(roleId, idList, tenantId));
         //创建资产信息
         TenantAssetsInfo assetsInfo = new TenantAssetsInfo();
         assetsInfo.setTenantId(tenantId);
@@ -276,6 +282,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         assetsInfo.setFrozenAmount(BigDecimal.ZERO);
         assetsInfo.setCreatedTime(new Date());
         assetsInfoService.save(assetsInfo);
+        //释放锁
+        bucket.delete();
     }
 
     //拆分菜单获取菜单ID
@@ -310,6 +318,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         e.setEntryDate(LocalDate.now().toDate());
         e.setRoles(roles);
         e.setRoleIds(roles);
+        e.setUserType(SysUserType.SYSTEM.getCode());
         e.setOrganIdList(String.valueOf(orgId));
         try {
             log.info("createUser >>>> {}", e);
@@ -461,9 +470,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     /**
      * 校验手机号
      */
-    private void checkPhone(TenantInfoDto dto) {
+    private RBucket<Object> checkPhone(TenantInfoDto dto) {
         //防止重复点击 加锁
-        String key = "Tenant_First_Add:" + dto.getPhone();
+        String key = "Tenant_Check_Phone:" + dto.getPhone();
         RBucket<Object> bucket = redissonClient.getBucket(key);
         //原子操作 抢锁成功为true
         if (!bucket.trySet(dto.getPhone(), 1L, TimeUnit.MINUTES)) {
@@ -475,9 +484,11 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
                 .orElse(null);
         if (Objects.nonNull(sysUser)) {
             if (sysUser.getUserType().contains(SysUserType.SYSTEM.getCode())) {
+                bucket.delete();
                 throw new BizException("该手机号已被注册!");
             }
         }
+        return bucket;
     }
 
     /**
@@ -489,8 +500,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      * @param action    需要执行的操作
      */
     private <T> void setIdByApply(Integer tenantId, T clazz, Consumer<Integer> setOption, Consumer<T> action) {
-        Optional.ofNullable(tenantId)
-                .ifPresent(setOption);
+        setOption.accept(tenantId);
         action.accept(clazz);
     }
 

+ 78 - 24
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -14,6 +14,7 @@ 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.thirdparty.adapay.Payment;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.joda.time.LocalDateTime;
 import org.slf4j.Logger;
@@ -21,10 +22,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * 机构付款记录表(TenantOrderRecord)表服务实现类
@@ -45,6 +43,9 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
     @Autowired
     private TenantInfoService tenantInfoService;
 
+    //订单不存在
+    public static final String PAYMENT_ID_NOT_EXISTS = "payment_id_not_exists";
+
     @Override
     public PageInfo<TenantOrderRecord> queryPage(TenantOrderRecordDto dto) {
         Page<TenantOrderRecord> pageInfo = PageUtil.getPage(dto.getPage(), dto.getRows());
@@ -54,12 +55,75 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
         return PageUtil.pageInfo(baseMapper.queryPage(pageInfo, dto));
     }
 
-    public static final String PAYMENT_ID_NOT_EXISTS = "payment_id_not_exists";
-
+    /**
+     * 校验订单状态
+     *
+     * @param orderNo 我方订单编号
+     */
     @Override
     public Map<String, Object> checkTenantOrder(String orderNo) {
         TenantOrderRecord orderRecord = this.getOne(new WrapperUtil<TenantOrderRecord>()
                 .hasEq("order_no_", orderNo).queryWrapper());
+
+        //主动去第三方查询订单状态
+        checkTransOrderState(orderRecord);
+
+        //返回
+        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);
+
+        log.info("checkTenantOrder  getOrderState>>>>> {}", JSON.toJSONString(orderRecord));
+        getOrderState(orderRecord, result);
+        log.info("checkTenantOrder  result >>>>> {}", result);
+        return result;
+    }
+
+    @Override
+    public void checkTenantOrder() {
+        List<TenantOrderRecord> list = this.list(new WrapperUtil<TenantOrderRecord>().queryWrapper()
+                .isNotNull("trans_no_")
+                .eq("order_state_", 0));
+        if (CollectionUtils.isNotEmpty(list)) {
+            list.forEach(record -> {
+                checkTransOrderState(record);
+                if (record.getOrderState() == 1) {
+                    //开通缴费
+                    if (TenantOrderRecordEnum.TENANT_OPEN.getCode().equals(record.getOrderType())) {
+                        //机构产品信息
+                        TenantProductInfo productInfo = tenantProductInfoService.getOne(new WrapperUtil<TenantProductInfo>()
+                                .hasEq("tenant_id_", record.getTenantId()).queryWrapper());
+                        //修改机构信息
+                        TenantInfo tenantInfo = new TenantInfo();
+                        tenantInfo.setId(record.getTenantId());
+                        tenantInfo.setPayState(1);
+                        tenantInfoService.updateById(tenantInfo);
+                        //修改机构产品信息
+                        productInfo.setPayDate(new Date());
+                        productInfo.setTenantId(record.getTenantId());
+                        tenantProductInfoService.updateById(productInfo);
+                    }
+                    //修改流水
+                    LocalDateTime now = LocalDateTime.now();
+                    record.setPayDate(now.toLocalDate().toDate());
+                    record.setPayTime(now.toDate());
+                    baseMapper.updateById(record);
+                }
+            });
+        }
+
+    }
+
+    //主动去第三方查询订单状态
+    private void checkTransOrderState(TenantOrderRecord orderRecord) {
         if (StringUtils.equals(orderRecord.getPaymentChannel(), PaymentChannelEnum.ADAPAY.getCode())) {
             Map<String, Object> payment;
             try {
@@ -71,7 +135,11 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
                         //确保订单已经创建
                         flag = true;
                     }
+                } else {
+                    //没有异常
+                    flag = true;
                 }
+                log.info("checkTenantOrder  payment >>>>> {} flag {}", payment, flag);
                 //确保订单已经创建 再 判断状态是成功还是失败
                 if (flag && Objects.nonNull(payment.get("status"))) {
                     String status = (String) payment.get("status");
@@ -86,24 +154,6 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
                 log.error("checkTenantOrder  payment error>>>>> {}", JSON.toJSONString(orderRecord));
             }
         }
-
-        //返回
-        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);
-
-        log.info("checkTenantOrder  getOrderState>>>>> {}", JSON.toJSONString(orderRecord));
-        getOrderState(orderRecord, result);
-        log.info("checkTenantOrder  result >>>>> {}", result);
-        return result;
     }
 
     private void getOrderState(TenantOrderRecord orderRecord, Map<String, Object> result) {
@@ -148,6 +198,10 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
         detail.put("mode", serveDetail.getMode());
         detail.put("num", productInfo.getExpiryCount());
 
+        orderSuccessOps(orderRecord, productInfo);
+    }
+
+    private void orderSuccessOps(TenantOrderRecord orderRecord, TenantProductInfo productInfo) {
         TenantInfo tenantInfo = new TenantInfo();
         tenantInfo.setId(orderRecord.getTenantId());
         tenantInfo.setPayState(1);

+ 83 - 42
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -16,6 +16,7 @@
         <result column="start_time_" property="startTime"/>
         <result column="end_time_" property="endTime"/>
         <result column="order_id_" property="orderId"/>
+        <result column="platform_order_id_" property="platformOrderId"/>
         <result column="remark_" property="remark"/>
         <result column="active_remark_" property="activeRemark"/>
         <result column="version_" property="version"/>
@@ -38,6 +39,7 @@
         <result column="start_time_" property="cloudTeacherOrder.startTime"/>
         <result column="end_time_" property="cloudTeacherOrder.endTime"/>
         <result column="order_id_" property="cloudTeacherOrder.orderId"/>
+        <result column="platform_order_id_" property="cloudTeacherOrder.platformOrderId"/>
         <result column="trans_status_" property="studentPaymentOrder.status"/>
         <result column="expect_amount_" property="studentPaymentOrder.expectAmount"/>
         <result column="pay_time_" property="studentPaymentOrder.payTime"/>
@@ -60,9 +62,9 @@
             useGeneratedKeys="true">
         <!--@mbg.generated-->
         insert into cloud_teacher_order (organ_id_,student_id_, type_, level_, time_, amount_, refund_amount_, status_,
-        order_id_,start_time_,end_time_,remark_, create_time_, update_time_,music_group_id_,active_remark_,tenant_id_)
+        order_id_,platform_order_id_,start_time_,end_time_,remark_, create_time_, update_time_,music_group_id_,active_remark_,tenant_id_)
         values (#{organId},#{studentId}, #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{level}, #{time}, #{amount}, #{refundAmount},
-        #{status},#{orderId},#{startTime},#{endTime}, #{remark}, NOW(), NOW(),#{musicGroupId},#{activeRemark},#{tenantId})
+        #{status},#{orderId},#{platformOrderId},#{startTime},#{endTime}, #{remark}, NOW(), NOW(),#{musicGroupId},#{activeRemark},#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherOrder">
         <!--@mbg.generated-->
@@ -107,6 +109,9 @@
             <if test="orderId != null">
                 order_id_ = #{orderId},
             </if>
+            <if test="platformOrderId != null">
+                platform_order_id_ = #{platformOrderId},
+            </if>
             <if test="remark != null">
                 remark_ = #{remark},
             </if>
@@ -116,12 +121,25 @@
         where id_ = #{id} AND version_ = #{version} and tenant_id_ = #{tenantId}
     </update>
 
+    <select id="findByPlatformOrderId"  resultMap="CloudTeacherOrderDto" parameterType="map">
+        select * from cloud_teacher_order where platform_order_id_ = #{platformOrderId}
+    </select>
+
     <update id="updateOrderStatusOK">
-        update cloud_teacher_order set status_ = 2 where order_id_ = (#{orderId})
+        update cloud_teacher_order set status_ = 2,
+       `start_time_` = CURRENT_DATE(),
+       `end_time_` = case
+         when type_ = 1 then date_add(CURRENT_DATE(), interval `time_` day)
+         when type_ = 2 then date_add(CURRENT_DATE(), interval `time_` month)
+         when type_ = 3 then date_add(CURRENT_DATE(), interval `time_` * 3 month)
+         when type_ = 4 then date_add(CURRENT_DATE(), interval `time_` * 6 month)
+         when type_ = 5 then date_add(CURRENT_DATE(), interval `time_` * 12 month)
+        end
+        where platform_order_id_ = #{platformOrderId}
     </update>
     <update id="updateOrderId">
         update cloud_teacher_order
-        set order_id_ = #{orderId} , pay_amount_ = #{amount}
+        set platform_order_id_ = #{platformOrderId} , pay_amount_ = #{amount}
         where id_ = #{cloudTeacherOrderId}
     </update>
 
@@ -292,7 +310,12 @@
         GROUP BY student_id_
     </select>
 
-    <select id="queryInactive" resultType="com.ym.mec.biz.dal.entity.CloudTeacherStudent">
+    <resultMap id="cloudTeacherStudent" type="com.ym.mec.biz.dal.entity.CloudTeacherStudent">
+        <result property="type" column="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
+    </resultMap>
+
+    <!-- 查询激活或未激活记录 -->
+    <select id="queryInactive" resultMap="cloudTeacherStudent">
         select
                cto.id_ as cloudTeacherOrderId,
                cto.student_id_ as studentId,
@@ -307,25 +330,18 @@
                end as typeName,
                cto.time_ as time,
                sj.id_ as subject,
-               sj.name_ as subjectLabel,
+               sj.name_ as subjectName,
                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
+               u.phone_ as phone
         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_
+        left join student_registration sr ON cto.student_id_ = sr.user_id_
         <where>
-            cto.status_ = #{status} AND sr.music_group_status_ = 'NORMAL' AND mg.status_ = 'PROGRESS'
-            <if test="queryCondition != nul and queryCondition != ''">
+            cto.status_ = #{status} AND sr.music_group_id_ = #{musicGroupId} AND cto.tenant_id_ = #{tenantId}
+            <if test="queryCondition != null and queryCondition != ''">
                 AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
             </if>
             <if test="subjectId">
@@ -340,13 +356,10 @@
         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_
+        left join student_registration sr ON cto.student_id_ = sr.user_id_
         <where>
-            cto.status_ = #{status} AND sr.music_group_status_ = 'NORMAL' AND mg.status_ = 'PROGRESS'
-            <if test="queryCondition != nul and queryCondition != ''">
+            cto.status_ = #{status} AND sr.music_group_id_ = #{musicGroupId} AND cto.tenant_id_ = #{tenantId}
+            <if test="queryCondition != null and queryCondition != ''">
                 AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
             </if>
             <if test="subjectId">
@@ -354,22 +367,34 @@
             </if>
         </where>
     </select>
+
+    <!-- 查询订单记录 -->
     <select id="findRecordCount" resultType="java.lang.Integer">
         SELECT count(1) FROM cloud_teacher_order cto
-        LEFT JOIN tenant_order_record tor ON tor.id_ = cto.order_id_
+        LEFT JOIN tenant_order_record tor ON tor.id_ = cto.platform_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
+            cto.status_ = 2 AND tor.order_no_ is not null AND tor.order_type_ = 'CLOUD_TEACHER'
+            AND sr.music_group_id_ = #{musicGroupId}
+            <if test="queryCondition != null and queryCondition != ''">
+                AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                AND tor.order_no_ LIKE CONCAT('%', #{orderNo}, '%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                <![CDATA[ AND tor.created_time_ >= #{startTime} ]]>
+            </if>
+            <if test="endTime != null and startTime != ''">
+                <![CDATA[ AND tor.created_time_ <= #{endTime} ]]>
+            </if>
         </where>
     </select>
-    <select id="queryRecord" resultType="com.ym.mec.biz.dal.entity.CloudTeacherStudent">
+    <select id="queryRecord"  resultMap="cloudTeacherStudent">
         SELECT
-            tor.order_no_ as orderNo,
             cto.id_ AS cloudTeacherOrderId,
             cto.student_id_ AS studentId,
             cto.type_ AS type,
@@ -380,25 +405,41 @@
                 WHEN 5 THEN '年' ELSE ''
                 END AS typeName,
             cto.time_ AS time,
-            sj.id_ AS SUBJECT,
+            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_
+            u.username_ AS name,
+            u.phone_ AS phone,
+            tor.order_no_ as orderNo,
+            tor.trans_no_ as transNo,
+            tor.created_time_ as orderTime
+        FROM cloud_teacher_order cto
+        LEFT JOIN tenant_order_record tor ON tor.id_ = cto.platform_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_
         <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
+            cto.status_ = 2 AND tor.order_no_ is not null AND tor.order_type_ = 'CLOUD_TEACHER'
+            AND sr.music_group_id_ = #{musicGroupId}
+            <if test="queryCondition != null and queryCondition != ''">
+                AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                AND tor.order_no_ LIKE CONCAT('%', #{orderNo}, '%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                <![CDATA[ AND tor.created_time_ >= #{startTime} ]]>
+            </if>
+            <if test="endTime != null and startTime != ''">
+                <![CDATA[ AND tor.created_time_ <= #{endTime} ]]>
+            </if>
         </where>
         <include refid="global.limit"/>
     </select>
+    <select id="checkOrdered" resultType="java.lang.Integer">
+        select count(1) from cloud_teacher_order where id_ in (${cloudTeacherStudentIds}) and status_ = 2 and platform_order_id_ is not null
+    </select>
 
     <sql id="queryCloudTeacherActiveDetailSql">
         <where>

+ 82 - 15
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml

@@ -1,29 +1,96 @@
 <?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" />
+  <resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity" id="MusicGroupPaymentCalenderActivity">
+    <result column="id_" property="id" />
+    <result column="activity_id_" property="activityId" />
+    <result column="activity_name_" property="activityName" />
+    <result column="num_" property="num" />
+    <result column="category_name_" property="categoryName" />
     <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" />
+    <result column="optional_flag_" property="optionalFlag" />
+    <result column="actual_amount_" property="actualAmount" />
+    <result column="original_amount_" property="originalAmount" />
+    <result column="create_time_" property="createTime" />
+    <result column="update_time_" property="updateTime" />
         <result column="tenant_id_" property="tenantId"/>
   </resultMap>
   <sql id="Base_Column_List">
-    id_, activity_id_, calender_id_, optional_flag_,actual_amount_ ,original_amount_, create_time_, update_time_,tenant_id_
-  </sql>
+    id_, activity_id_, calender_id_, optional_flag_,actual_amount_ ,original_amount_, create_time_, update_time_,tenant_id_  </sql>
+
+  <!-- 根据主键查询一条记录 -->
+  <select id="get" resultMap="MusicGroupPaymentCalenderActivity" >
+    SELECT * FROM music_group_payment_calender_activity WHERE id_ = #{id}
+  </select>
+
+  <!-- 全查询 -->
+  <select id="findAll" resultMap="MusicGroupPaymentCalenderActivity">
+    SELECT * FROM music_group_payment_calender_activity ORDER BY id_
+  </select>
+
+  <!-- 向数据库增加一条记录 -->
+  <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+    INSERT INTO music_group_payment_calender_activity (activity_id_,activity_name_,num_,
+    category_name_,calender_id_,optional_flag_,actual_amount_,original_amount_,create_time_,update_time_,tenant_id_)
+    VALUES(#{activityId},#{activityName},#{num},#{categoryName},#{calenderId},#{optionalFlag},
+          #{actualAmount},#{originalAmount},NOW(),NOW(),#{tenantId})
+  </insert>
+
+  <!-- 根据主键查询一条记录 -->
+  <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity">
+    UPDATE music_group_payment_calender_activity <set>
+    <if test="updateTime != null">
+      update_time_ = #{updateTime},
+    </if>
+    <if test="num != null">
+      num_ = #{num},
+    </if>
+    <if test="activityName != null">
+      activity_name_ = #{activityName},
+    </if>
+    <if test="calenderId != null">
+      calender_id_ = #{calenderId},
+    </if>
+    <if test="optionalFlag != null">
+      optional_flag_ = #{optionalFlag},
+    </if>
+    <if test="actualAmount != null">
+      actual_amount_ = #{actualAmount},
+    </if>
+    <if test="activityId != null">
+      activity_id_ = #{activityId},
+    </if>
+    <if test="originalAmount != null">
+      original_amount_ = #{originalAmount},
+    </if>
+    <if test="categoryName != null">
+      category_name_ = #{categoryName},
+    </if>
+    update_time_ = NOW()
+  </set> WHERE id_ = #{id}
+  </update>
+
+  <!-- 根据主键删除一条记录 -->
+  <delete id="delete" >
+    DELETE FROM music_group_payment_calender_activity WHERE id_ = #{id}
+  </delete>
+
+  <!-- 分页查询 -->
+  <select id="queryPage" resultMap="MusicGroupPaymentCalenderActivity" parameterType="map">
+    SELECT * FROM music_group_payment_calender_activity ORDER BY id_ <include refid="global.limit"/>
+  </select>
+
+  <!-- 查询当前表的总记录数 -->
+  <select id="queryCount" resultType="int">
+    SELECT COUNT(*) FROM music_group_payment_calender_activity
+  </select>
 
   <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_,tenant_id_)
-    values
+    insert into music_group_payment_calender_activity(activity_id_, calender_id_, optional_flag_, actual_amount_ ,original_amount_, create_time_, update_time_, tenant_id_)    values
     <foreach collection="calenderActivityList" item="entity" separator=",">
-      (#{entity.activityId}, #{entity.calenderId}, #{entity.optionalFlag}, #{entity.actualAmount},
-      #{entity.originalAmount}, NOW(), NOW(),#{entity.tenantId})
-    </foreach>
+#{entity.activityId}, #{entity.calenderId}, #{entity.optionalFlag}, #{entity.actualAmount},
+      #{entity.originalAmount}, NOW(), NOW(),#{entity.tenantId})    </foreach>
   </insert>
   <delete id="delByCalenderId">
     DELETE FROM music_group_payment_calender_activity WHERE calender_id_ = #{calenderId}

+ 89 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMemberMapper.xml

@@ -0,0 +1,89 @@
+<?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.MusicGroupPaymentCalenderMemberDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember" id="MusicGroupPaymentCalenderMember">
+		<result column="id_" property="id" />
+		<result column="calender_id_" property="calenderId" />
+		<result column="name_" property="name" />
+		<result column="num_" property="num" />
+		<result column="period_" property="period" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+		<result column="member_rank_setting_id_" property="memberRankSettingId" />
+		<result column="optional_flag_" property="optionalFlag" />
+		<result column="actual_amount_" property="actualAmount" />
+		<result column="original_amount_" property="originalAmount" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="MusicGroupPaymentCalenderMember" >
+		SELECT * FROM music_group_payment_calender_member WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MusicGroupPaymentCalenderMember">
+		SELECT * FROM music_group_payment_calender_member ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO music_group_payment_calender_member (calender_id_,name_,num_,period_,
+		member_rank_setting_id_,optional_flag_,actual_amount_,original_amount_,create_time_,update_time_)
+		VALUES(#{calenderId},#{name},#{num},#{period,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memberRankSettingId},#{optionalFlag},#{actualAmount},
+		       #{originalAmount},NOW(),NOW())
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember">
+		UPDATE music_group_payment_calender_member <set>
+		<if test="period != null">
+		period_ = #{period,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+		</if>
+		<if test="memberRankSettingId != null">
+		member_rank_setting_id_ = #{memberRankSettingId},
+		</if>
+		<if test="num != null">
+		num_ = #{num},
+		</if>
+		<if test="calenderId != null">
+		calender_id_ = #{calenderId},
+		</if>
+		<if test="optionalFlag != null">
+		optional_flag_ = #{optionalFlag},
+		</if>
+		<if test="actualAmount != null">
+		actual_amount_ = #{actualAmount},
+		</if>
+		<if test="originalAmount != null">
+		original_amount_ = #{originalAmount},
+		</if>
+		<if test="name != null">
+		name_ = #{name},
+		</if>
+		update_time_ = NOW()
+	</set> WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM music_group_payment_calender_member WHERE id_ = #{id} 
+	</delete>
+	<delete id="deleteByCalenderId">
+		DELETE FROM music_group_payment_calender_member WHERE calender_id_ = #{calenderId}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MusicGroupPaymentCalenderMember" parameterType="map">
+		SELECT * FROM music_group_payment_calender_member ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM music_group_payment_calender_member
+	</select>
+</mapper>

+ 75 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderRepairMapper.xml

@@ -0,0 +1,75 @@
+<?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.MusicGroupPaymentCalenderRepairDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderRepair" id="MusicGroupPaymentCalenderRepair">
+		<result column="id_" property="id" />
+		<result column="calender_id_" property="calenderId" />
+		<result column="num_" property="num" />
+		<result column="optional_flag_" property="optionalFlag" />
+		<result column="actual_amount_" property="actualAmount" />
+		<result column="original_amount_" property="originalAmount" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="MusicGroupPaymentCalenderRepair" >
+		SELECT * FROM music_group_payment_calender_repair WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MusicGroupPaymentCalenderRepair">
+		SELECT * FROM music_group_payment_calender_repair ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderRepair" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO music_group_payment_calender_repair (calender_id_,num_,optional_flag_,actual_amount_,original_amount_,create_time_,update_time_)
+		VALUES(#{calenderId},#{num},#{optionalFlag},#{actualAmount},#{originalAmount},NOW(),NOW())
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderRepair">
+		UPDATE music_group_payment_calender_repair <set>
+		<if test="num != null">
+		num_ = #{num},
+		</if>
+		<if test="calenderId != null">
+		calender_id_ = #{calenderId},
+		</if>
+		<if test="optionalFlag != null">
+		optional_flag_ = #{optionalFlag},
+		</if>
+		<if test="actualAmount != null">
+		actual_amount_ = #{actualAmount},
+		</if>
+		<if test="originalAmount != null">
+		original_amount_ = #{originalAmount},
+		</if>
+		update_time_ = NOW()
+	</set> WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM music_group_payment_calender_repair WHERE id_ = #{id} 
+	</delete>
+	<delete id="deleteByCalenderId">
+		DELETE FROM music_group_payment_calender_repair WHERE calender_id_ = #{calenderId}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MusicGroupPaymentCalenderRepair" parameterType="map">
+		SELECT * FROM music_group_payment_calender_repair ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM music_group_payment_calender_repair
+	</select>
+</mapper>

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

@@ -1382,6 +1382,9 @@
         AND sr.music_group_status_ = 'NORMAL' AND mg.course_view_type_ != 2 AND mg.`status_` = 'PROGRESS'
         GROUP BY sr.user_id_)t)
     </update>
+    <update id="updateMembershipEndTime">
+        update student set membership_end_time_ = #{endTime} where user_id_ = #{studentId}
+    </update>
 
     <select id="queryStudent" resultMap="Student">
         SELECT s.*,su.username_,su.phone_,o.name_ organ_name_,sb.name_ subject_name_ FROM student s

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

@@ -148,8 +148,8 @@
     <insert id="addSysUser" parameterType="com.ym.mec.auth.api.entity.SysUser" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO sys_user
-        (im_token_,id_,username_,salt_,phone_,avatar_,organ_id_,create_time_,update_time_,wx_openid_,qq_openid_,user_type_,gender_,nation_,birthdate_,email_,id_card_no_,wechat_id_,real_name_,password_)
-        VALUES(#{imToken},#{id},#{username},#{salt},#{phone},#{avatar},#{organId},now(),now(),#{wxOpenid},#{qqOpenid},#{userType},
+        (tenant_id_,im_token_,id_,username_,salt_,phone_,avatar_,organ_id_,create_time_,update_time_,wx_openid_,qq_openid_,user_type_,gender_,nation_,birthdate_,email_,id_card_no_,wechat_id_,real_name_,password_)
+        VALUES(#{tenantId},#{imToken},#{id},#{username},#{salt},#{phone},#{avatar},#{organId},now(),now(),#{wxOpenid},#{qqOpenid},#{userType},
         #{gender},#{nation},#{birthdate},#{email},#{idCardNo},#{wechatId},#{realName},#{password})
     </insert>
 

+ 5 - 4
mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml

@@ -12,24 +12,25 @@
         <result column="logo_" jdbcType="VARCHAR" property="logo"/>
         <result column="customer_service_phone_" jdbcType="VARCHAR" property="customerServicePhone"/>
         <result column="remark_" jdbcType="VARCHAR" property="remark"/>
+        <result column="tsign_code_" jdbcType="VARCHAR" property="tsignCode"/>
+        <result column="tsign_name_" jdbcType="VARCHAR" property="tsignName"/>
+        <result column="area_id_" jdbcType="INTEGER" property="areaId"/>
         <result column="domain_name_" jdbcType="VARCHAR" property="domainName"/>
         <result column="data_source_" jdbcType="VARCHAR" property="dataSource"/>
         <result column="pay_state_" jdbcType="INTEGER" property="payState"/>
         <result column="state_" jdbcType="INTEGER" property="state"/>
+        <result column="user_id_" jdbcType="INTEGER" property="userId"/>
         <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
         <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
         <result column="updated_by_" jdbcType="INTEGER" property="updatedBy"/>
         <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
-        <result column="tsign_code_" jdbcType="VARCHAR" property="tsignCode"/>
-        <result column="tsign_name_" jdbcType="VARCHAR" property="tsignName"/>
-        <result column="area_id_" jdbcType="INTEGER" property="areaId"/>
     </resultMap>
 
     <sql id="Base_Column_List">
         id_
         , name_, contacts_, phone_, address_, email_, logo_, customer_service_phone_, remark_, domain_name_,
         data_source_, pay_state_, state_, created_by_, created_time_, updated_by_, updated_time_, tsign_code_, tsign_name_,
-        area_id_
+        area_id_,user_id_
     </sql>
 
     <resultMap id="TenantInfoInfoResult" type="com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo">

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

@@ -223,4 +223,10 @@ public interface TaskRemoteService {
 	 */
 	@GetMapping("task/remarkCountFlag")
     void remarkCountFlag();
+
+    /**
+     * 定时校验-机构订单状态
+     */
+	@GetMapping("task/checkTenantOrder")
+    void checkTenantOrder();
 }

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

@@ -277,4 +277,9 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
     public void remarkCountFlag() {
         logger.error("标记进行中乐团在读学员+VIP、网管有课学员总数 失败");
     }
+
+    @Override
+    public void checkTenantOrder() {
+        logger.error("校验机构付款记录支付状态失败");
+    }
 }

+ 24 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/CheckTenantOrder.java

@@ -0,0 +1,24 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author hgw
+ * Created by 2021-12-24
+ */
+@Service
+public class CheckTenantOrder extends BaseTask {
+
+    @Autowired
+    private TaskRemoteService taskRemoteService;
+
+    @Override
+    public void execute() throws TaskException {
+        taskRemoteService.checkTenantOrder();
+    }
+
+}

+ 19 - 16
mec-web/src/main/java/com/ym/mec/web/controller/CloudTeacherOrderController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
 import com.ym.mec.biz.dal.page.CloudTeacherAddQueryInfo;
 import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
@@ -31,41 +32,43 @@ public class CloudTeacherOrderController extends BaseController {
     @ApiOperation(value ="手动添加会员")
     @PostMapping("/addStudents")
     // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/addStudents')")
-    public Object addStudents(@RequestBody CloudTeacherAddQueryInfo cloudTeacherAddQueryInfo) throws Exception {
+    public Object addStudents(@RequestBody CloudTeacherAddQueryInfo cloudTeacherAddQueryInfo) {
         return succeed(cloudTeacherOrderService.addStudents(cloudTeacherAddQueryInfo));
     }
 
     @ApiOperation(value ="查询未激活团练宝用户")
     @PostMapping("/queryInactive")
     // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryUnActive')")
-    public Object queryInactive(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
+    public Object queryInactive(@RequestBody CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
         cloudTeacherOrderQueryInfo.setStatus(1);
+        if (cloudTeacherOrderQueryInfo.getMusicGroupId() == null) {
+            throw new Exception("乐团Id必须填写");
+        }
         return succeed(cloudTeacherOrderService.queryInactive(cloudTeacherOrderQueryInfo));
     }
 
     @ApiOperation(value ="查询已激活团练宝用户")
     @PostMapping("/queryActive")
     // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryActive')")
-    public Object queryActive(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
+    public Object queryActive(@RequestBody CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
+        if (cloudTeacherOrderQueryInfo.getMusicGroupId() == null) {
+            throw new Exception("乐团Id必须填写");
+        }
         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));
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryActiveRecord')")
+    public Object queryActiveRecord(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) {
+        return succeed(cloudTeacherOrderService.queryRecord(cloudTeacherOrderQueryInfo));
     }
 
-    @ApiOperation(value ="激活记录")
+    @ApiOperation(value ="测试支付通知")
     @PostMapping("/testPayNotify")
     // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryActive')")
-    public Object testPayNotify(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
-        Msg msg = new Msg();
-        msg.setResponseParameters("{\"order_no_\":21122217101500001, \"merMerOrderNo\": 9888888, \"channelType\": 1}");
-        msg.setResponseType("1");
-        msg.setCode("88");
+    public Object testPayNotify(@RequestBody Msg msg) throws Exception {
         return succeed(cloudTeacherOrderService.payNotify(msg));
     }
 
@@ -80,14 +83,14 @@ public class CloudTeacherOrderController extends BaseController {
     @ApiOperation(value ="支付回调")
     @PostMapping("/payNotify")
     // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payNotify')")
-    public Msg payNotify(@ModelAttribute Msg msg) {
+    public Msg payNotify(@ModelAttribute Msg msg) throws Exception {
         return cloudTeacherOrderService.payNotify(msg);
     }
 
     @ApiOperation(value ="轮询查询订单状态")
     @GetMapping("/payCheck")
-    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payNotify')")
-    public Boolean payCheck(@RequestParam String orderNo ) {
-        return cloudTeacherOrderService.payCheck(orderNo);
+    // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payCheck')")
+    public Object payCheck(@RequestParam String orderNo ) {
+        return succeed(cloudTeacherOrderService.payCheck(orderNo));
     }
 }

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

@@ -2321,7 +2321,7 @@ public class ExportController extends BaseController {
         musicGroupStatusList.add(MusicGroupStatusEnum.APPLY);
         musicGroupStatusList.add(MusicGroupStatusEnum.PAY);
 
-        List<MusicGroupRegisterDto> musicGroupRegisters = musicGroupDao.getMusicGroupRegister(musicGroupStatusList, organIds);
+        List<MusicGroupRegisterDto> musicGroupRegisters = musicGroupDao.getMusicGroupRegister(musicGroupStatusList, organIds, TenantContextHolder.getTenantId());
 
         if (musicGroupRegisters.size() <= 0) {
             response.setStatus(200);
@@ -2559,7 +2559,7 @@ public class ExportController extends BaseController {
         musicGroupStatusList.add(MusicGroupStatusEnum.PREPARE);
         musicGroupStatusList.add(MusicGroupStatusEnum.PROGRESS);
         musicGroupStatusList.add(MusicGroupStatusEnum.PAUSE);
-        List<MusicGroupRegisterDto> musicGroupRegisters = musicGroupDao.getMusicGroupRegister(musicGroupStatusList, organIds);
+        List<MusicGroupRegisterDto> musicGroupRegisters = musicGroupDao.getMusicGroupRegister(musicGroupStatusList, organIds, TenantContextHolder.getTenantId());
 
         if (musicGroupRegisters.size() <= 0) {
             response.setStatus(200);

+ 5 - 2
mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java

@@ -14,8 +14,11 @@ import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.tenant.TenantContextHolder;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -84,7 +87,7 @@ public class IndexController extends BaseController {
 			return failed(HttpStatus.INTERNAL_SERVER_ERROR, "分部信息错误");
 		}
 
-		Map<String, Integer> musicDatas = musicGroupDao.queryOrganMusicGroupNum(organId);
+		Map<String, Integer> musicDatas = musicGroupDao.queryOrganMusicGroupNum(organId, TenantContextHolder.getTenantId());
 		
 		Map<String, Integer> teacherDatas = teacherDao.queryOrganTeacherNum(organId);
 		
@@ -94,7 +97,7 @@ public class IndexController extends BaseController {
 
 		Map<String, Integer> demoDatas = demoGroupDao.queryDemoGroupNum(organId);
 		
-		Integer musicGroupNum = musicGroupDao.queryCurrentMonthCoursesNum(organId);
+		Integer musicGroupNum = musicGroupDao.queryCurrentMonthCoursesNum(organId, TenantContextHolder.getTenantId());
 		
 		Integer vipGroupNum = vipGroupDao.queryCurrentMonthCoursesNum(organId);
 		

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

@@ -49,7 +49,7 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/queryPage')")
     public Object queryPage(MusicCalenderDetailQueryInfo queryInfo) {
-        return succeed(musicGroupPaymentCalenderDetailService.queryPage(queryInfo));
+        return succeed(musicGroupPaymentCalenderDetailService.queryDetailPage(queryInfo));
     }
 
     @ApiOperation(value = "修改学员预计缴费金额")

+ 43 - 12
mec-web/src/main/java/com/ym/mec/web/controller/SysManualController.java

@@ -1,9 +1,14 @@
 package com.ym.mec.web.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ym.mec.biz.dal.entity.SysManual;
+import com.ym.mec.biz.dal.entity.TenantOrderRecord;
 import com.ym.mec.biz.dal.page.SysManualQueryInfo;
 import com.ym.mec.biz.service.SysManualService;
+import com.ym.mec.common.page.PageUtil;
+import com.ym.mec.common.page.WrapperUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,35 +35,61 @@ public class SysManualController extends BaseController {
 
 
     @ApiOperation(value = "查询操作手册")
-    @GetMapping("/list")
+    @RequestMapping("/list")
     public Object list(SysManualQueryInfo queryInfo) {
-        QueryWrapper<SysManual> queryWrapper = null;
-        if (queryInfo.getMenuId() != null) {
-            queryWrapper = new QueryWrapper<SysManual>().eq("menu_id_", queryInfo.getMenuId());
-        } else {
-            queryWrapper = new QueryWrapper<>();
-        }
-        List<SysManual> result = sysManualService.list(queryWrapper);
-        return succeed(result);
+
+        QueryWrapper<SysManual> queryWrapper = new WrapperUtil<SysManual>().hasEq("menu_id_", queryInfo.getMenuId()).queryWrapper();
+        Page<SysManual> pageInfo = PageUtil.getPage(queryInfo.getPage(), queryInfo.getRows());
+
+        return PageUtil.pageInfo(sysManualService.page(pageInfo, queryWrapper));
     }
 
     @ApiOperation(value = "新增帮助手册")
     @PostMapping("/add")
-    public Object add(@RequestBody SysManual sysManual) throws Exception{
+    public Object add(@RequestBody SysManual sysManual) throws Exception {
+        this.check(sysManual);
         sysManualService.save(sysManual);
         return succeed();
     }
 
     @ApiOperation(value = "修改帮助手册")
     @PostMapping("/update")
-    public Object update(@RequestBody SysManual sysManual) throws Exception{
+    public Object update(@RequestBody SysManual sysManual) throws Exception {
+        this.check(sysManual);
+        if (sysManual.getId() == null) {
+            throw new Exception("更新必须有id");
+        }
         sysManualService.updateById(sysManual);
         return succeed();
     }
 
+    private void check(SysManual sysManual) throws Exception {
+        if (sysManual.getMenuId() == null) {
+            throw new Exception("菜单Id是必须");
+        }
+        if (sysManual.getName() == null) {
+            throw new Exception("菜单名是必填");
+        }
+        if (sysManual.getName().length() > 256) {
+            throw new Exception("菜单名不能超过256");
+        }
+        if (sysManual.getOpFlow() == null) {
+            throw new Exception("操作流程必填");
+        }
+        if (sysManual.getOpFlow().length() > 8000) {
+            throw new Exception("操作流程不能超过8000字节");
+        }
+        if (sysManual.getFunRule() == null) {
+            throw new Exception("功能规则必填");
+        }
+        if (sysManual.getFunRule().length() > 8000) {
+            throw new Exception("功能规则不能超过8000字节");
+        }
+    }
+
     @ApiOperation(value = "删除帮助手册")
     @PostMapping("/remove")
-    public Object remove(@RequestBody SysManual sysManual) throws Exception{
+    public Object remove(@RequestBody SysManual sysManual) throws Exception {
         sysManualService.removeById(sysManual.getId());
         return succeed();
     }

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

@@ -106,6 +106,8 @@ public class TaskController extends BaseController {
 	private SysMusicCompareRecordService sysMusicCompareRecordService;
 	@Autowired
 	private TenantInfoService tenantInfoService;
+    @Autowired
+    private TenantOrderRecordService tenantOrderRecordService;
 
 	@GetMapping(value = "/syncImHistoryMessageTask")
 	// 同步即时通讯聊天记录
@@ -509,4 +511,10 @@ public class TaskController extends BaseController {
 	public void remarkCountFlag(){
 //		studentService.remarkCountFlag();
 	}
+
+    @ApiOperation("定时校验-机构订单状态")
+    @GetMapping(value = "/checkTenantOrder")
+    public void checkTenantOrder(){
+        tenantOrderRecordService.checkTenantOrder();
+    }
 }

+ 2 - 1
mec-web/src/main/java/com/ym/mec/web/controller/education/EduRegisterController.java

@@ -31,6 +31,7 @@ import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.tenant.TenantContextHolder;
 
 @RequestMapping("eduRegister")
 @Api(tags = "乐团报名回款统计(教务端)")
@@ -88,7 +89,7 @@ public class EduRegisterController extends BaseController {
             }
         }
 
-        List<MusicGroupRegAndMoneyDto> musicGroups = musicGroupDao.getMusicGroupByStatus(organIds, cooperationOrganIds, musicGroupName);
+        List<MusicGroupRegAndMoneyDto> musicGroups = musicGroupDao.getMusicGroupByStatus(organIds, cooperationOrganIds, musicGroupName, TenantContextHolder.getTenantId());
         if (musicGroups.size() <= 0) {
             return succeed();
         }