Преглед изворни кода

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

yanite пре 3 година
родитељ
комит
799c48fb9c
34 измењених фајлова са 904 додато и 452 уклоњено
  1. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderActivityDao.java
  2. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderMemberDao.java
  3. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderRepairDao.java
  4. 0 76
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderMemberDto.java
  5. 7 10
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentBaseCalender.java
  6. 0 41
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicRepairDto.java
  7. 15 89
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderActivity.java
  8. 93 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderBase.java
  9. 39 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java
  10. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderRepair.java
  11. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantInfo.java
  12. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderBaseService.java
  13. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java
  14. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderMemberService.java
  15. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderRepairService.java
  16. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantOrderRecordService.java
  17. 16 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java
  18. 44 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java
  19. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java
  20. 28 28
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  21. 43 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderMemberServiceImpl.java
  22. 29 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderRepairServiceImpl.java
  23. 86 85
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  24. 49 49
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  25. 74 24
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java
  26. 83 12
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml
  27. 89 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMemberMapper.xml
  28. 75 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderRepairMapper.xml
  29. 5 4
      mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml
  30. 6 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  31. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  32. 24 0
      mec-task/src/main/java/com/ym/mec/task/jobs/CheckTenantOrder.java
  33. 1 1
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java
  34. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

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

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

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

+ 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/TenantOrderRecordService.java

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

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

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

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

@@ -1,46 +1,39 @@
 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.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.stream.Collectors;
-
 import com.ym.mec.biz.dal.dao.*;
+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.*;
-import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
-import com.ym.mec.biz.dal.enums.PeriodEnum;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
+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.*;
 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.page.QueryInfo;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
-import com.ym.mec.util.date.DateUtil;
-
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.util.collection.MapUtil;
 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.dto.FeeStudentDto;
-import com.ym.mec.biz.dal.dto.SimpleUserDto;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-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.thirdparty.message.MessageSenderPluginContext;
-import com.ym.mec.util.collection.MapUtil;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
+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;
 
 @Service
 public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderDetail>  implements MusicGroupPaymentCalenderDetailService {
@@ -602,7 +595,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);
 	}
@@ -665,4 +658,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);

+ 49 - 49
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未缴费
@@ -141,7 +143,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             checkTsign(dto.getTsignCode());
             //修改产品
             if (Objects.nonNull(dto.getProductInfo())) {
-                setIdByApply(tenantId, dto.getProductInfo(), dto.getProductInfo()::setTenantId,
+                setIdByApply(tenantInfo.getId(), dto.getProductInfo(), dto.getProductInfo()::setTenantId,
                         tenantProductInfoService::updateTenantProduct);
             }
         }
@@ -154,7 +156,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 
         //修改机构配置
         if (Objects.nonNull(dto.getConfig())) {
-            setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::updateConfig);
+            setIdByApply(tenantInfo.getId(), dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::updateConfig);
         }
     }
 
@@ -199,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.nonNull(tenantInfo.getUserId())) {
+                    //初次开通
+                    checkFirstOpen(tenantInfo);
                 }
-                baseMapper.updateById(tenantInfo);
-                return;
             }
+            baseMapper.updateById(tenantInfo);
+            return;
         }
         throw new BizException("传入机构状态参数异常!");
     }
@@ -235,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)) {
@@ -280,6 +282,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         assetsInfo.setFrozenAmount(BigDecimal.ZERO);
         assetsInfo.setCreatedTime(new Date());
         assetsInfoService.save(assetsInfo);
+        //释放锁
+        bucket.delete();
     }
 
     //拆分菜单获取菜单ID
@@ -314,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);
@@ -465,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)) {
@@ -479,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;
     }
 
     /**
@@ -493,15 +500,8 @@ 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(clazz)
-                .filter(c -> Objects.nonNull(setOption))
-                .filter(c -> Objects.nonNull(action))
-                .filter(c -> Objects.nonNull(tenantId))
-                .map(c -> {
-                    setOption.accept(tenantId);
-                    return c;
-                })
-                .ifPresent(action);
+        setOption.accept(tenantId);
+        action.accept(clazz);
     }
 
     /**

+ 74 - 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 {
@@ -90,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) {
@@ -152,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 - 12
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml

@@ -1,27 +1,98 @@
 <?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" />
   </resultMap>
   <sql id="Base_Column_List">
-    id_, activity_id_, calender_id_, optional_flag_,actual_amount_ ,original_amount_, create_time_, update_time_
+    id_,activity_id_,activity_name_,num_,category_name_,calender_id_,optional_flag_,actual_amount_,original_amount_,create_time_,update_time_
   </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_)
+    VALUES(#{activityId},#{activityName},#{num},#{categoryName},#{calenderId},#{optionalFlag},
+          #{actualAmount},#{originalAmount},NOW(),NOW())
+  </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_)
+    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_)
     values
     <foreach collection="calenderActivityList" item="entity" separator=",">
-      (#{entity.activityId}, #{entity.calenderId}, #{entity.optionalFlag}, #{entity.actualAmount},
-      #{entity.originalAmount}, NOW(), NOW())
+      (#{entity.activityId},#{entity.activityName},#{entity.num},#{entity.categoryName},#{entity.calenderId},#{entity.optionalFlag},
+      #{entity.actualAmount},#{entity.originalAmount},NOW(),NOW())
     </foreach>
   </insert>
   <delete id="delByCalenderId">

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

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

+ 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 = "修改学员预计缴费金额")

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