瀏覽代碼

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

yonge 3 年之前
父節點
當前提交
6130d5c69c
共有 84 個文件被更改,包括 3610 次插入1248 次删除
  1. 1 0
      .gitignore
  2. 6 0
      cms/pom.xml
  3. 13 2
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRole.java
  4. 7 0
      mec-biz/pom.xml
  5. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/EmployeeDao.java
  6. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganizationDao.java
  7. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PlatformProductDao.java
  8. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java
  9. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysManualDao.java
  10. 0 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantInfoDao.java
  11. 26 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantOrderRecordDao.java
  12. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ActivityQueryDto.java
  13. 75 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderMemberDto.java
  14. 0 26
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MemberFeeDto.java
  15. 21 10
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDto.java
  16. 25 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TenantConfigDto.java
  17. 57 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TenantInfoDto.java
  18. 149 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TenantOrderRecordDto.java
  19. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Organization.java
  20. 134 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysManual.java
  21. 26 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantConfig.java
  22. 32 19
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantInfo.java
  23. 186 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantOrderRecord.java
  24. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/VipGroupActivity.java
  25. 32 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/TenantOrderRecordEnum.java
  26. 34 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysManualQueryInfo.java
  27. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/VipGroupActivityQueryInfo.java
  28. 174 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/vo/TenantOrderRecordVo.java
  29. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CalenderMemberService.java
  30. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ContractService.java
  31. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/service/EmployeeService.java
  32. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java
  33. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationService.java
  34. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/PlatformProductService.java
  35. 4 1
      mec-biz/src/main/java/com/ym/mec/biz/service/PlatformServeDetailService.java
  36. 3 1
      mec-biz/src/main/java/com/ym/mec/biz/service/PlatformServeService.java
  37. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java
  38. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysManualService.java
  39. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantInfoService.java
  40. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantOrderRecordService.java
  41. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  42. 1027 1049
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  43. 17 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  44. 37 18
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java
  45. 375 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  46. 8 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSchoolTermCourseDetailServiceImpl.java
  47. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  48. 51 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java
  49. 13 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PlatformProductServiceImpl.java
  50. 20 20
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  51. 15 8
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java
  52. 11 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  53. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysManualServiceImpl.java
  54. 11 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  55. 280 16
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  56. 38 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java
  57. 1 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  58. 18 0
      mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml
  59. 3 3
      mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml
  60. 1 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupSchoolTermCourseDetailMapper.xml
  61. 13 3
      mec-biz/src/main/resources/config/mybatis/OrganizationMapper.xml
  62. 13 0
      mec-biz/src/main/resources/config/mybatis/PlatformProductMapper.xml
  63. 2 2
      mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml
  64. 7 4
      mec-biz/src/main/resources/config/mybatis/TenantConfigMapper.xml
  65. 4 7
      mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml
  66. 84 0
      mec-biz/src/main/resources/config/mybatis/TenantOrderRecordMapper.xml
  67. 14 3
      mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml
  68. 4 0
      mec-common/common-core/src/main/java/com/ym/mec/common/controller/BaseController.java
  69. 8 0
      mec-common/common-core/src/main/java/com/ym/mec/common/entity/Mapper.java
  70. 1 1
      mec-common/common-core/src/main/java/com/ym/mec/common/page/PageUtil.java
  71. 92 0
      mec-common/common-core/src/main/java/com/ym/mec/common/page/QueryWrapperUtil.java
  72. 2 0
      mec-im/src/main/java/com/ym/common/ApiException.java
  73. 1 0
      mec-im/src/main/java/com/ym/common/ErrorEnum.java
  74. 2 1
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  75. 0 7
      mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java
  76. 2 2
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java
  77. 72 0
      mec-util/src/main/java/com/ym/mec/util/validator/ValidationKit.java
  78. 4 1
      mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java
  79. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/OrganizationController.java
  80. 62 0
      mec-web/src/main/java/com/ym/mec/web/controller/SysManualController.java
  81. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/SysTenantConfigController.java
  82. 4 4
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java
  83. 18 5
      mec-web/src/main/java/com/ym/mec/web/controller/TenantInfoController.java
  84. 40 0
      mec-web/src/main/java/com/ym/mec/web/controller/TenantOrderRecordController.java

+ 1 - 0
.gitignore

@@ -10,3 +10,4 @@ bin
 .gitignore
 .gitignore
 .idea
 .idea
 *.iml
 *.iml
+/lib/

+ 6 - 0
cms/pom.xml

@@ -56,6 +56,12 @@
 		<dependency>
 		<dependency>
 			<groupId>com.ym</groupId>
 			<groupId>com.ym</groupId>
 			<artifactId>mec-auth-api</artifactId>
 			<artifactId>mec-auth-api</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.redisson</groupId>
+                    <artifactId>redisson-spring-boot-starter</artifactId>
+                </exclusion>
+            </exclusions>
 		</dependency>
 		</dependency>
 
 
 		<dependency>
 		<dependency>

+ 13 - 2
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRole.java

@@ -35,9 +35,12 @@ public class SysRole {
 	/** 删除标识(0-正常,1-删除) */
 	/** 删除标识(0-正常,1-删除) */
 	@ApiModelProperty(value = "删除标识(0-正常,1-删除)",required = false)
 	@ApiModelProperty(value = "删除标识(0-正常,1-删除)",required = false)
 	private String delFlag;
 	private String delFlag;
-	
+
 	private Integer organId;
 	private Integer organId;
 
 
+	@ApiModelProperty(value = "机构id")
+	private Integer tenantId;
+
 	@ApiModelProperty(value = "菜单列表",required = false)
 	@ApiModelProperty(value = "菜单列表",required = false)
 	private List<Integer> menuIds;
 	private List<Integer> menuIds;
 
 
@@ -113,7 +116,15 @@ public class SysRole {
 		this.organId = organId;
 		this.organId = organId;
 	}
 	}
 
 
-	@Override
+    public Integer getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(Integer tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    @Override
 	public String toString() {
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 		return ToStringBuilder.reflectionToString(this);
 	}
 	}

+ 7 - 0
mec-biz/pom.xml

@@ -13,6 +13,7 @@
 	<url>http://maven.apache.org</url>
 	<url>http://maven.apache.org</url>
 	<properties>
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <redisson.version>3.16.4</redisson.version>
 	</properties>
 	</properties>
 
 
 	<dependencies>
 	<dependencies>
@@ -39,5 +40,11 @@
 			<groupId>com.ym</groupId>
 			<groupId>com.ym</groupId>
 			<artifactId>snakerflowy</artifactId>
 			<artifactId>snakerflowy</artifactId>
 		</dependency>
 		</dependency>
+
+        <dependency>
+            <groupId>org.redisson</groupId>
+            <artifactId>redisson-spring-boot-starter</artifactId>
+            <version>${redisson.version}</version>
+        </dependency>
     </dependencies>
     </dependencies>
 </project>
 </project>

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/EmployeeDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 package com.ym.mec.biz.dal.dao;
 
 
+import com.ym.mec.auth.api.entity.SysRole;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.EmployeeDto;
 import com.ym.mec.biz.dal.dto.EmployeeDto;
 import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
 import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
@@ -201,4 +202,19 @@ public interface EmployeeDao extends BaseDAO<Integer, Employee> {
      * @return
      * @return
      */
      */
     List<SysUser> getUsers(@Param("userIds") List<Integer> userIds);
     List<SysUser> getUsers(@Param("userIds") List<Integer> userIds);
+
+    /**
+     * 批量添加角色和菜单关系
+     * @param roleId 角色id
+     * @param menuIds 菜单集合
+     */
+    int batchInsertRoleMenu(@Param("roleId") Integer roleId,@Param("menuIds")  List<Integer> menuIds);
+
+    /**
+     * 添加角色信息
+     * @param sysRole
+     * @return
+     */
+    int insertSysRole(SysRole sysRole);
+
 }
 }

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

@@ -9,6 +9,8 @@ import java.util.Set;
 
 
 public interface OrganizationDao extends BaseDAO<Integer, Organization> {
 public interface OrganizationDao extends BaseDAO<Integer, Organization> {
 
 
+    Organization getByName(@Param("name") String name,@Param("tenantId") Integer tenantId);
+
     /**
     /**
      * 根据父级id查询子级列表
      * 根据父级id查询子级列表
      * @param parentId
      * @param parentId

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PlatformProductDao.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ym.mec.biz.dal.entity.PlatformProduct;
 import com.ym.mec.biz.dal.entity.PlatformProduct;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.List;
+
 public interface PlatformProductDao extends BaseMapper<PlatformProduct> {
 public interface PlatformProductDao extends BaseMapper<PlatformProduct> {
     int deleteByPrimaryKey(Integer id);
     int deleteByPrimaryKey(Integer id);
 
 
@@ -17,4 +19,6 @@ public interface PlatformProductDao extends BaseMapper<PlatformProduct> {
     int updateByPrimaryKeySelective(PlatformProduct record);
     int updateByPrimaryKeySelective(PlatformProduct record);
 
 
     <T> IPage<T> queryPage(Page<T> page, @Param("search") String search);
     <T> IPage<T> queryPage(Page<T> page, @Param("search") String search);
+
+    List<String> queryMenuIdList(Integer serveId);
 }
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java

@@ -57,7 +57,7 @@ public interface StudentGoodsSellDao extends BaseDAO<Integer, StudentGoodsSell>
      * @param autoAffirmReceiveTime:
      * @param autoAffirmReceiveTime:
      * @return java.util.List<java.lang.String>
      * @return java.util.List<java.lang.String>
      */
      */
-    String queryNoAffirmOrderNo(String autoAffirmReceiveTime);
+    String queryNoAffirmOrderNo(@Param("autoAffirmReceiveTime") String autoAffirmReceiveTime);
 
 
     /**
     /**
      * @describe 自动确认收货
      * @describe 自动确认收货

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

@@ -0,0 +1,20 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ym.mec.biz.dal.entity.SysManual;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * (SysManual)表数据库访问层
+ *
+ * @author makejava
+ * @since 2021-12-20 17:22:42
+ */
+public interface SysManualDao extends BaseMapper<SysManual> {
+
+    int insertBatch(@Param("entities") List<SysManual> entities);
+
+}
+

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

@@ -10,7 +10,5 @@ import java.util.Map;
 
 
 public interface TenantInfoDao extends BaseMapper<TenantInfo> {
 public interface TenantInfoDao extends BaseMapper<TenantInfo> {
 
 
-    int opsTenantState(@Param("id") Integer id, @Param("state") Integer state);
-
     <T> IPage<T> queryPage(Page<T> page, @Param("param") Map<String, Object> param);
     <T> IPage<T> queryPage(Page<T> page, @Param("param") Map<String, Object> param);
 }
 }

+ 26 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantOrderRecordDao.java

@@ -0,0 +1,26 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
+import com.ym.mec.biz.dal.entity.TenantOrderRecord;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 机构付款记录表(TenantOrderRecord)表数据库访问层
+ *
+ * @author hgw
+ * @since 2021-12-20 10:08:27
+ */
+public interface TenantOrderRecordDao extends BaseMapper<TenantOrderRecord> {
+
+    int insertBatch(@Param("entities") List<TenantOrderRecord> entities);
+
+    <T> IPage<T> queryPage(Page<T> page, @Param("param") TenantOrderRecordDto dto);
+
+}
+

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ActivityQueryDto.java

@@ -34,6 +34,16 @@ public class ActivityQueryDto{
 
 
     private Boolean enable;
     private Boolean enable;
 
 
+    private Integer activityChannel;
+
+    public Integer getActivityChannel() {
+        return activityChannel;
+    }
+
+    public void setActivityChannel(Integer activityChannel) {
+        this.activityChannel = activityChannel;
+    }
+
     public Boolean getEnable() {
     public Boolean getEnable() {
         return enable;
         return enable;
     }
     }

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

@@ -0,0 +1,75 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.PeriodEnum;
+
+import java.math.BigDecimal;
+
+import static com.ym.mec.biz.dal.enums.PeriodEnum.MONTH;
+
+public class CalenderMemberDto {
+    //会员周期
+    private PeriodEnum periodEnum = MONTH;
+
+    //会员数量
+    private Integer memberNum = 1 ;
+
+    //会员现价
+    private BigDecimal actualAmount = BigDecimal.ZERO;
+
+    //会员原价
+    private BigDecimal originalAmount = BigDecimal.ZERO;
+
+    //会员等级编号
+    private Integer memberRankSettingId = 1;
+
+    //是否可选
+    private Boolean optionalFlag = false;
+
+    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 BigDecimal getOriginalAmount() {
+        return originalAmount;
+    }
+
+    public void setOriginalAmount(BigDecimal originalAmount) {
+        this.originalAmount = originalAmount;
+    }
+
+    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;
+    }
+}

+ 0 - 26
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MemberFeeDto.java

@@ -1,26 +0,0 @@
-package com.ym.mec.biz.dal.dto;
-
-import java.math.BigDecimal;
-
-public class MemberFeeDto {
-
-    private BigDecimal currentAmount;
-
-    private BigDecimal originalAmount;
-
-    public BigDecimal getCurrentAmount() {
-        return currentAmount;
-    }
-
-    public void setCurrentAmount(BigDecimal currentAmount) {
-        this.currentAmount = currentAmount;
-    }
-
-    public BigDecimal getOriginalAmount() {
-        return originalAmount;
-    }
-
-    public void setOriginalAmount(BigDecimal originalAmount) {
-        this.originalAmount = originalAmount;
-    }
-}

+ 21 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDto.java

@@ -43,6 +43,17 @@ public class MusicGroupPaymentCalenderDto {
 
 
 	private BigDecimal masterTotalPrice = BigDecimal.ZERO;
 	private BigDecimal masterTotalPrice = BigDecimal.ZERO;
 
 
+	//会员缴费相关信息
+	private CalenderMemberDto calenderMember;
+
+	public CalenderMemberDto getCalenderMember() {
+		return calenderMember;
+	}
+
+	public void setCalenderMember(CalenderMemberDto calenderMember) {
+		this.calenderMember = calenderMember;
+	}
+
 	//会员有效期(月)
 	//会员有效期(月)
 	private Integer memberValidDate;
 	private Integer memberValidDate;
 
 
@@ -52,16 +63,6 @@ public class MusicGroupPaymentCalenderDto {
 	//会员等级编号
 	//会员等级编号
 	private Integer memberRankSettingId;
 	private Integer memberRankSettingId;
 
 
-	private Boolean autoCreate = false;
-
-	public Boolean getAutoCreate() {
-		return autoCreate;
-	}
-
-	public void setAutoCreate(Boolean autoCreate) {
-		this.autoCreate = autoCreate;
-	}
-
 	public Integer getMemberValidDate() {
 	public Integer getMemberValidDate() {
 		return memberValidDate;
 		return memberValidDate;
 	}
 	}
@@ -86,6 +87,16 @@ public class MusicGroupPaymentCalenderDto {
 		this.memberRankSettingId = memberRankSettingId;
 		this.memberRankSettingId = memberRankSettingId;
 	}
 	}
 
 
+	private Boolean autoCreate = false;
+
+	public Boolean getAutoCreate() {
+		return autoCreate;
+	}
+
+	public void setAutoCreate(Boolean autoCreate) {
+		this.autoCreate = autoCreate;
+	}
+
 	@ApiModelProperty(value = "跨团合并时缴费项目中学员的缴费明细")
 	@ApiModelProperty(value = "跨团合并时缴费项目中学员的缴费明细")
 	private List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails;
 	private List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails;
 
 

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TenantConfigDto.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.dto;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
@@ -28,6 +29,14 @@ public class TenantConfigDto implements Serializable {
     @ApiModelProperty(value = "可用教材id,多个用逗号分割")
     @ApiModelProperty(value = "可用教材id,多个用逗号分割")
     private String teachingMaterialId;
     private String teachingMaterialId;
 
 
+    @NotBlank(message = "主题不能为空")
+    @ApiModelProperty(value = "主题")
+    private String theme;
+
+    @NotBlank(message = "主题色不能为空")
+    @ApiModelProperty(value = "主题色")
+    private String themeColor;
+
     @ApiModelProperty(value = "机构动态配置,以json格式储存")
     @ApiModelProperty(value = "机构动态配置,以json格式储存")
     private String config;
     private String config;
 
 
@@ -66,6 +75,22 @@ public class TenantConfigDto implements Serializable {
         this.teachingMaterialId = teachingMaterialId;
         this.teachingMaterialId = teachingMaterialId;
     }
     }
 
 
+    public String getTheme() {
+        return theme;
+    }
+
+    public void setTheme(String theme) {
+        this.theme = theme;
+    }
+
+    public String getThemeColor() {
+        return themeColor;
+    }
+
+    public void setThemeColor(String themeColor) {
+        this.themeColor = themeColor;
+    }
+
     public String getConfig() {
     public String getConfig() {
         return config;
         return config;
     }
     }

+ 57 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TenantInfoDto.java

@@ -69,6 +69,9 @@ public class TenantInfoDto implements Serializable {
     @ApiModelProperty(value = "机构logo")
     @ApiModelProperty(value = "机构logo")
     private String logo;
     private String logo;
 
 
+    @ApiModelProperty(value = "城市id-sys_area")
+    private Integer areaId;
+
     /**
     /**
      * 客服电话
      * 客服电话
      */
      */
@@ -90,6 +93,14 @@ public class TenantInfoDto implements Serializable {
     @ApiModelProperty(value = "状态0 草稿 1启动 2停用")
     @ApiModelProperty(value = "状态0 草稿 1启动 2停用")
     private Integer state;
     private Integer state;
 
 
+    @NotBlank(message = "营业执照编号不能为空")
+    @ApiModelProperty(value = "营业执照编号")
+    private String tsignCode;
+
+    @NotBlank(message = "公司名称名称不能为空")
+    @ApiModelProperty(value = "公司名称")
+    private String tsignName;
+
     @NotNull(message = "请选择机构的产品信息!")
     @NotNull(message = "请选择机构的产品信息!")
     @ApiModelProperty(value = "机构关联的产品信息")
     @ApiModelProperty(value = "机构关联的产品信息")
     private TenantProductInfoDto productInfo;
     private TenantProductInfoDto productInfo;
@@ -98,6 +109,12 @@ public class TenantInfoDto implements Serializable {
     @ApiModelProperty(value = "机构配置参数")
     @ApiModelProperty(value = "机构配置参数")
     private TenantConfigDto config;
     private TenantConfigDto config;
 
 
+    @ApiModelProperty(value = "购买的服务名称")
+    private String platformServeName;
+
+    @ApiModelProperty(value = "人数上线")
+    private Integer studentUpLimit;
+
     public Integer getId() {
     public Integer getId() {
         return id;
         return id;
     }
     }
@@ -154,6 +171,14 @@ public class TenantInfoDto implements Serializable {
         this.logo = logo;
         this.logo = logo;
     }
     }
 
 
+    public Integer getAreaId() {
+        return areaId;
+    }
+
+    public void setAreaId(Integer areaId) {
+        this.areaId = areaId;
+    }
+
     public String getCustomerServicePhone() {
     public String getCustomerServicePhone() {
         return customerServicePhone;
         return customerServicePhone;
     }
     }
@@ -201,4 +226,36 @@ public class TenantInfoDto implements Serializable {
     public void setConfig(TenantConfigDto config) {
     public void setConfig(TenantConfigDto config) {
         this.config = config;
         this.config = config;
     }
     }
+
+    public String getTsignCode() {
+        return tsignCode;
+    }
+
+    public void setTsignCode(String tsignCode) {
+        this.tsignCode = tsignCode;
+    }
+
+    public String getTsignName() {
+        return tsignName;
+    }
+
+    public void setTsignName(String tsignName) {
+        this.tsignName = tsignName;
+    }
+
+    public String getPlatformServeName() {
+        return platformServeName;
+    }
+
+    public void setPlatformServeName(String platformServeName) {
+        this.platformServeName = platformServeName;
+    }
+
+    public Integer getStudentUpLimit() {
+        return studentUpLimit;
+    }
+
+    public void setStudentUpLimit(Integer studentUpLimit) {
+        this.studentUpLimit = studentUpLimit;
+    }
 }
 }

+ 149 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TenantOrderRecordDto.java

@@ -0,0 +1,149 @@
+package com.ym.mec.biz.dal.dto;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 机构付款记录表(TenantOrderRecord)表实体类
+ *
+ * @author hgw
+ * @since 2021-12-20 10:08:28
+ */
+@ApiModel(value = "机构付款记录表")
+public class TenantOrderRecordDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "机构产品设置表id,多个id用逗号分割")
+    private String tenantId;
+
+    @TableField("order_no_")
+    @ApiModelProperty(value = "订单流水")
+    private String orderNo;
+
+    @TableField("trans_no_")
+    @ApiModelProperty(value = "支付编号")
+    private String transNo;
+
+    /**
+     * TenantOrderRecordEnum.class
+     */
+    @TableField("order_type_")
+    @ApiModelProperty(value = "订单类型/机构开通缴费、续费、充值、激活团练宝")
+    private String orderType;
+
+    @TableField("order_state_")
+    @ApiModelProperty(value = "订单状态/0待支付、1已支付")
+    private Integer orderState;
+
+    @ApiModelProperty(value = "开始时间")
+    private String startDate;
+
+    @ApiModelProperty(value = "结束时间")
+    private String endDate;
+
+    @ApiModelProperty(value = "页数")
+    private Integer page;
+
+    @ApiModelProperty(value = "每页数量")
+    private Integer rows;
+
+    @ApiModelProperty(value = "关键字")
+    private String search;
+
+    private List<String> tenantIdList;
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getTransNo() {
+        return transNo;
+    }
+
+    public void setTransNo(String transNo) {
+        this.transNo = transNo;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public Integer getOrderState() {
+        return orderState;
+    }
+
+    public void setOrderState(Integer orderState) {
+        this.orderState = orderState;
+    }
+
+    public String getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getRows() {
+        return rows;
+    }
+
+    public void setRows(Integer rows) {
+        this.rows = rows;
+    }
+
+    public String getSearch() {
+        return search;
+    }
+
+    public void setSearch(String search) {
+        this.search = search;
+    }
+
+    public List<String> getTenantIdList() {
+        return tenantIdList;
+    }
+
+    public void setTenantIdList(List<String> tenantIdList) {
+        this.tenantIdList = tenantIdList;
+    }
+}
+

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Organization.java

@@ -67,6 +67,9 @@ public class Organization {
 	@ApiModelProperty(value = "维修技师",required = false)
 	@ApiModelProperty(value = "维修技师",required = false)
 	private String repairId;
 	private String repairId;
 
 
+	@ApiModelProperty(value = "衔接老师",required = false)
+	private String joinTeacherId;
+
 	@ApiModelProperty(value = "分部经理",required = false)
 	@ApiModelProperty(value = "分部经理",required = false)
 	private String organManagerName;
 	private String organManagerName;
 
 
@@ -76,6 +79,28 @@ public class Organization {
 	@ApiModelProperty(value = "维修技师",required = false)
 	@ApiModelProperty(value = "维修技师",required = false)
 	private String repairName;
 	private String repairName;
 
 
+	@ApiModelProperty(value = "衔接老师",required = false)
+	private String joinTeacherName;
+
+	@ApiModelProperty(value = "机构id",required = false)
+    private Integer tenantId;
+
+	public String getJoinTeacherId() {
+		return joinTeacherId;
+	}
+
+	public void setJoinTeacherId(String joinTeacherId) {
+		this.joinTeacherId = joinTeacherId;
+	}
+
+	public String getJoinTeacherName() {
+		return joinTeacherName;
+	}
+
+	public void setJoinTeacherName(String joinTeacherName) {
+		this.joinTeacherName = joinTeacherName;
+	}
+
 	public String getOrganManagerName() {
 	public String getOrganManagerName() {
 		return organManagerName;
 		return organManagerName;
 	}
 	}
@@ -232,4 +257,12 @@ public class Organization {
 	public void setGradeType(GradeTypeEnum gradeType) {
 	public void setGradeType(GradeTypeEnum gradeType) {
 		this.gradeType = gradeType;
 		this.gradeType = gradeType;
 	}
 	}
+
+    public Integer getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(Integer tenantId) {
+        this.tenantId = tenantId;
+    }
 }
 }

+ 134 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysManual.java

@@ -0,0 +1,134 @@
+package com.ym.mec.biz.dal.entity;
+
+
+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;
+
+/**
+ * (SysManual)表实体类
+ *
+ * @author makejava
+ * @since 2021-12-20 13:46:08
+ */
+@ApiModel(value = "sys_manual-${tableInfo.comment}")
+public class SysManual implements Serializable {
+    @TableId(value = "id_", type = IdType.AUTO)
+    @ApiModelProperty(value = "${column.comment}")
+    private Integer id;
+
+    @TableField("menu_id_")
+    @ApiModelProperty(value = "菜单Id")
+    private Integer menuId;
+
+    @TableField("name_")
+    @ApiModelProperty(value = "手册名称")
+    private String name;
+
+    @TableField("op_flow_")
+    @ApiModelProperty(value = "操作流程")
+    private String opFlow;
+
+    @TableField("fun_rule_")
+    @ApiModelProperty(value = "功能规则")
+    private String funRule;
+
+    @TableField("video_url_")
+    @ApiModelProperty(value = "操作视频")
+    private String videoUrl;
+
+    @TableField("create_time_")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @TableField("update_time_")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    @TableField("operator_id_")
+    @ApiModelProperty(value = "操作人")
+    private Integer operatorId;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getMenuId() {
+        return menuId;
+    }
+
+    public void setMenuId(Integer menuId) {
+        this.menuId = menuId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getOpFlow() {
+        return opFlow;
+    }
+
+    public void setOpFlow(String opFlow) {
+        this.opFlow = opFlow;
+    }
+
+    public String getFunRule() {
+        return funRule;
+    }
+
+    public void setFunRule(String funRule) {
+        this.funRule = funRule;
+    }
+
+    public String getVideoUrl() {
+        return videoUrl;
+    }
+
+    public void setVideoUrl(String videoUrl) {
+        this.videoUrl = videoUrl;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOperatorId() {
+        return operatorId;
+    }
+
+    public void setOperatorId(Integer operatorId) {
+        this.operatorId = operatorId;
+    }
+
+
+}
+

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

@@ -16,7 +16,7 @@ import java.util.Date;
  * @author hgw
  * @author hgw
  * @since 2021-12-09 13:37:18
  * @since 2021-12-09 13:37:18
  */
  */
-@ApiModel(value = "机构配置表")
+@ApiModel(value = "tenant_config-机构配置表")
 public class TenantConfig implements Serializable {
 public class TenantConfig implements Serializable {
     @TableId(value = "id_", type = IdType.AUTO)
     @TableId(value = "id_", type = IdType.AUTO)
     @ApiModelProperty(value = "主键")
     @ApiModelProperty(value = "主键")
@@ -34,6 +34,14 @@ public class TenantConfig implements Serializable {
     @ApiModelProperty(value = "可用教材id,多个用逗号分割")
     @ApiModelProperty(value = "可用教材id,多个用逗号分割")
     private String teachingMaterialId;
     private String teachingMaterialId;
 
 
+    @TableField("theme_")
+    @ApiModelProperty(value = "主题")
+    private String theme;
+
+    @TableField("theme_color_")
+    @ApiModelProperty(value = "主题色")
+    private String themeColor;
+
     @TableField("config_")
     @TableField("config_")
     @ApiModelProperty(value = "机构动态配置,以json格式储存")
     @ApiModelProperty(value = "机构动态配置,以json格式储存")
     private String config;
     private String config;
@@ -80,6 +88,22 @@ public class TenantConfig implements Serializable {
         this.teachingMaterialId = teachingMaterialId;
         this.teachingMaterialId = teachingMaterialId;
     }
     }
 
 
+    public String getTheme() {
+        return theme;
+    }
+
+    public void setTheme(String theme) {
+        this.theme = theme;
+    }
+
+    public String getThemeColor() {
+        return themeColor;
+    }
+
+    public void setThemeColor(String themeColor) {
+        this.themeColor = themeColor;
+    }
+
     public String getConfig() {
     public String getConfig() {
         return config;
         return config;
     }
     }
@@ -103,4 +127,5 @@ public class TenantConfig implements Serializable {
     public void setUpdatedTime(Date updatedTime) {
     public void setUpdatedTime(Date updatedTime) {
         this.updatedTime = updatedTime;
         this.updatedTime = updatedTime;
     }
     }
+
 }
 }

+ 32 - 19
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantInfo.java

@@ -11,10 +11,11 @@ import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
- * 机构信息表
- * 对应数据库表(tenant_info):
+ * 机构表(TenantInfo)表实体类
+ *
+ * @author hgw
  */
  */
-@ApiModel(value = "TenantInfo机构表")
+@ApiModel(value = "tenant_info-机构表")
 public class TenantInfo implements Serializable {
 public class TenantInfo implements Serializable {
     @TableId(value = "id_", type = IdType.AUTO)
     @TableId(value = "id_", type = IdType.AUTO)
     @ApiModelProperty(value = "机构id")
     @ApiModelProperty(value = "机构id")
@@ -60,6 +61,10 @@ public class TenantInfo implements Serializable {
     @ApiModelProperty(value = "营业执照对应公司名称")
     @ApiModelProperty(value = "营业执照对应公司名称")
     private String tsignName;
     private String tsignName;
 
 
+    @TableField("area_id_")
+    @ApiModelProperty(value = "城市id")
+    private Integer areaId;
+
     @TableField("domain_name_")
     @TableField("domain_name_")
     @ApiModelProperty(value = "域名")
     @ApiModelProperty(value = "域名")
     private String domainName;
     private String domainName;
@@ -166,6 +171,30 @@ public class TenantInfo implements Serializable {
         this.remark = remark;
         this.remark = remark;
     }
     }
 
 
+    public String getTsignCode() {
+        return tsignCode;
+    }
+
+    public void setTsignCode(String tsignCode) {
+        this.tsignCode = tsignCode;
+    }
+
+    public String getTsignName() {
+        return tsignName;
+    }
+
+    public void setTsignName(String tsignName) {
+        this.tsignName = tsignName;
+    }
+
+    public Integer getAreaId() {
+        return areaId;
+    }
+
+    public void setAreaId(Integer areaId) {
+        this.areaId = areaId;
+    }
+
     public String getDomainName() {
     public String getDomainName() {
         return domainName;
         return domainName;
     }
     }
@@ -230,22 +259,6 @@ public class TenantInfo implements Serializable {
         this.updatedTime = updatedTime;
         this.updatedTime = updatedTime;
     }
     }
 
 
-    public String getTsignCode() {
-        return tsignCode;
-    }
-
-    public void setTsignCode(String tsignCode) {
-        this.tsignCode = tsignCode;
-    }
-
-    public String getTsignName() {
-        return tsignName;
-    }
-
-    public void setTsignName(String tsignName) {
-        this.tsignName = tsignName;
-    }
-
     @Override
     @Override
     public String toString() {
     public String toString() {
         return ToStringBuilder.reflectionToString(this);
         return ToStringBuilder.reflectionToString(this);

+ 186 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantOrderRecord.java

@@ -0,0 +1,186 @@
+package com.ym.mec.biz.dal.entity;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 机构付款记录表(TenantOrderRecord)表实体类
+ *
+ * @author hgw
+ * @since 2021-12-20 10:08:28
+ */
+@ApiModel(value = "tenant_order_record-机构付款记录表")
+public class TenantOrderRecord implements Serializable {
+    @TableId(value = "id_", type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
+    private Integer id;
+
+    @TableField("tenant_id_")
+    @ApiModelProperty(value = "机构产品设置表id")
+    private Integer tenantId;
+
+    @TableField("order_no_")
+    @ApiModelProperty(value = "订单编号(付款前生成订单时生成的编号)")
+    private String orderNo;
+
+    @TableField("trans_no_")
+    @ApiModelProperty(value = "支付编号(付款后第三方支付给予的)")
+    private String transNo;
+
+    @TableField("order_type_")
+    @ApiModelProperty(value = "订单类型/机构开通缴费、续费、充值、激活团练宝")
+    private String orderType;
+
+    @TableField("payment_channel_")
+    @ApiModelProperty(value = "付款渠道/惠支付、双乾")
+    private String paymentChannel;
+
+    @TableField("pay_channel_")
+    @ApiModelProperty(value = "付款渠道/微信、支付宝、等")
+    private String payChannel;
+
+    @TableField("expect_amount")
+    @ApiModelProperty(value = "应付金额")
+    private BigDecimal expectAmount;
+
+    @TableField("actual_amount")
+    @ApiModelProperty(value = "实付金额")
+    private BigDecimal actualAmount;
+
+    @TableField("order_state_")
+    @ApiModelProperty(value = "订单状态/0待支付、1已支付、2支付失败")
+    private Integer orderState;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @TableField("pay_date_")
+    @ApiModelProperty(value = "支付日期")
+    private Date payDate;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("pay_time_")
+    @ApiModelProperty(value = "支付时间")
+    private Date payTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("created_time_")
+    @ApiModelProperty(value = "订单创建时间")
+    private Date createdTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(Integer tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getTransNo() {
+        return transNo;
+    }
+
+    public void setTransNo(String transNo) {
+        this.transNo = transNo;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getPaymentChannel() {
+        return paymentChannel;
+    }
+
+    public void setPaymentChannel(String paymentChannel) {
+        this.paymentChannel = paymentChannel;
+    }
+
+    public String getPayChannel() {
+        return payChannel;
+    }
+
+    public void setPayChannel(String payChannel) {
+        this.payChannel = payChannel;
+    }
+
+    public BigDecimal getExpectAmount() {
+        return expectAmount;
+    }
+
+    public void setExpectAmount(BigDecimal expectAmount) {
+        this.expectAmount = expectAmount;
+    }
+
+    public BigDecimal getActualAmount() {
+        return actualAmount;
+    }
+
+    public void setActualAmount(BigDecimal actualAmount) {
+        this.actualAmount = actualAmount;
+    }
+
+    public Integer getOrderState() {
+        return orderState;
+    }
+
+    public void setOrderState(Integer orderState) {
+        this.orderState = orderState;
+    }
+
+    public Date getPayDate() {
+        return payDate;
+    }
+
+    public void setPayDate(Date payDate) {
+        this.payDate = payDate;
+    }
+
+    public Date getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(Date payTime) {
+        this.payTime = payTime;
+    }
+
+    public Date getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Date createdTime) {
+        this.createdTime = createdTime;
+    }
+
+
+}
+

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/VipGroupActivity.java

@@ -154,9 +154,31 @@ public class VipGroupActivity {
 	@ApiModelProperty(value = "活动价格")
 	@ApiModelProperty(value = "活动价格")
 	private BigDecimal marketPrice = BigDecimal.ZERO;
 	private BigDecimal marketPrice = BigDecimal.ZERO;
 
 
+	@ApiModelProperty(value = "活动原价")
+	private BigDecimal originalPrice = BigDecimal.ZERO;
+
 	//用于标记活动类型,购买的活动类型1、1v1 20节,2、1v1 40节,3、1v2 20节,4、1v2 40节,5、乐理课
 	//用于标记活动类型,购买的活动类型1、1v1 20节,2、1v1 40节,3、1v2 20节,4、1v2 40节,5、乐理课
 	private Integer code;
 	private Integer code;
 
 
+	@ApiModelProperty(value = "活动渠道,1乐团渠道,2常规活动")
+	private Integer activityChannel;
+
+	public BigDecimal getOriginalPrice() {
+		return originalPrice;
+	}
+
+	public void setOriginalPrice(BigDecimal originalPrice) {
+		this.originalPrice = originalPrice;
+	}
+
+	public Integer getActivityChannel() {
+		return activityChannel;
+	}
+
+	public void setActivityChannel(Integer activityChannel) {
+		this.activityChannel = activityChannel;
+	}
+
 	public Integer getCode() {
 	public Integer getCode() {
 		return code;
 		return code;
 	}
 	}

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/TenantOrderRecordEnum.java

@@ -0,0 +1,32 @@
+package com.ym.mec.biz.dal.enums;
+
+public enum TenantOrderRecordEnum {
+    TENANT_OPEN("TENANT_OPEN","机构开通缴费"),
+    TENANT_RENEW("TENANT_RENEW","机构续费"),
+    CLOUD_TEACHER("CLOUD_TEACHER","激活团练宝");
+
+    private String code;
+
+    private String msg;
+
+    TenantOrderRecordEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysManualQueryInfo.java

@@ -0,0 +1,34 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Description
+ *
+ * @author: feng-ji
+ * @date: 2021-12-20
+ */
+public class SysManualQueryInfo  extends QueryInfo {
+
+    private Integer id;
+
+    @ApiModelProperty(value = "按菜单查询")
+    private Integer menuId;
+
+    public Integer getMenuId() {
+        return menuId;
+    }
+
+    public void setMenuId(Integer menuId) {
+        this.menuId = menuId;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/VipGroupActivityQueryInfo.java

@@ -33,6 +33,16 @@ public class VipGroupActivityQueryInfo extends QueryInfo {
 
 
     private Integer newStudent;
     private Integer newStudent;
 
 
+    private Integer activityChannel;
+
+    public Integer getActivityChannel() {
+        return activityChannel;
+    }
+
+    public void setActivityChannel(Integer activityChannel) {
+        this.activityChannel = activityChannel;
+    }
+
     public Integer getMemberFlag() {
     public Integer getMemberFlag() {
         return memberFlag;
         return memberFlag;
     }
     }

+ 174 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/vo/TenantOrderRecordVo.java

@@ -0,0 +1,174 @@
+package com.ym.mec.biz.dal.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author hgw
+ * Created by 2021-12-21
+ */
+public class TenantOrderRecordVo implements Serializable {
+
+    @ApiModelProperty(value = "机构名称")
+    private String tenantName;
+
+    @TableField("tenant_id_")
+    @ApiModelProperty(value = "机构产品设置表id")
+    private Integer tenantId;
+
+    @TableField("order_no_")
+    @ApiModelProperty(value = "订单编号(付款前生成订单时生成的编号)")
+    private String orderNo;
+
+    @TableField("trans_no_")
+    @ApiModelProperty(value = "支付编号(付款后第三方支付给予的)")
+    private String transNo;
+
+    @TableField("order_type_")
+    @ApiModelProperty(value = "订单类型/机构开通缴费、续费、充值、激活团练宝")
+    private String orderType;
+
+    @TableField("payment_channel_")
+    @ApiModelProperty(value = "付款渠道/惠支付、双乾")
+    private String paymentChannel;
+
+    @TableField("pay_channel_")
+    @ApiModelProperty(value = "付款渠道/微信、支付宝、等")
+    private String payChannel;
+
+    @TableField("expect_amount")
+    @ApiModelProperty(value = "应付金额")
+    private BigDecimal expectAmount;
+
+    @TableField("actual_amount")
+    @ApiModelProperty(value = "实付金额")
+    private BigDecimal actualAmount;
+
+    @TableField("order_state_")
+    @ApiModelProperty(value = "订单状态/0待支付、1已支付、2支付失败")
+    private Integer orderState;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @TableField("pay_date_")
+    @ApiModelProperty(value = "支付日期")
+    private Date payDate;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("pay_time_")
+    @ApiModelProperty(value = "支付时间")
+    private Date payTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("created_time_")
+    @ApiModelProperty(value = "订单创建时间")
+    private Date createdTime;
+
+    public String getTenantName() {
+        return tenantName;
+    }
+
+    public void setTenantName(String tenantName) {
+        this.tenantName = tenantName;
+    }
+
+    public Integer getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(Integer tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getTransNo() {
+        return transNo;
+    }
+
+    public void setTransNo(String transNo) {
+        this.transNo = transNo;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getPaymentChannel() {
+        return paymentChannel;
+    }
+
+    public void setPaymentChannel(String paymentChannel) {
+        this.paymentChannel = paymentChannel;
+    }
+
+    public String getPayChannel() {
+        return payChannel;
+    }
+
+    public void setPayChannel(String payChannel) {
+        this.payChannel = payChannel;
+    }
+
+    public BigDecimal getExpectAmount() {
+        return expectAmount;
+    }
+
+    public void setExpectAmount(BigDecimal expectAmount) {
+        this.expectAmount = expectAmount;
+    }
+
+    public BigDecimal getActualAmount() {
+        return actualAmount;
+    }
+
+    public void setActualAmount(BigDecimal actualAmount) {
+        this.actualAmount = actualAmount;
+    }
+
+    public Integer getOrderState() {
+        return orderState;
+    }
+
+    public void setOrderState(Integer orderState) {
+        this.orderState = orderState;
+    }
+
+    public Date getPayDate() {
+        return payDate;
+    }
+
+    public void setPayDate(Date payDate) {
+        this.payDate = payDate;
+    }
+
+    public Date getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(Date payTime) {
+        this.payTime = payTime;
+    }
+
+    public Date getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Date createdTime) {
+        this.createdTime = createdTime;
+    }
+}

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

@@ -0,0 +1,4 @@
+package com.ym.mec.biz.service;
+
+public interface CalenderMemberService {
+}

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

@@ -24,6 +24,8 @@ public interface ContractService {
 	 */
 	 */
 	SysUserTsign register(Integer userId, String realName, String idCardNo, String mobileNo);
 	SysUserTsign register(Integer userId, String realName, String idCardNo, String mobileNo);
 
 
+    void addTsign(String organCode, String orgName);
+
 	/**
 	/**
 	 * 传递注册协议至第三方公证平台
 	 * 传递注册协议至第三方公证平台
 	 * @param userId
 	 * @param userId

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

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service;
 package com.ym.mec.biz.service;
 
 
+import com.ym.mec.auth.api.entity.SysRole;
 import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
 import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.Employee;
@@ -96,4 +97,10 @@ public interface EmployeeService extends BaseService<Integer, Employee> {
     List<SimpleUserDto> findAllByRole(String roleIds,String organIds);
     List<SimpleUserDto> findAllByRole(String roleIds,String organIds);
 
 
     List<Integer> queryUserRole(Integer sysUserId);
     List<Integer> queryUserRole(Integer sysUserId);
+
+    int batchInsertRoleMenu( Integer roleId, List<Integer> menuIds);
+
+    int insertSysRole(SysRole sysRole);
+
+
 }
 }

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

@@ -19,6 +19,13 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @return
 	 * @return
 	 */
 	 */
 	String create(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto);
 	String create(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto);
+
+	/**
+	 * 创建缴费信息
+	 * @param musicGroupPaymentCalenderDto
+	 * @return
+	 */
+	String create1(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto);
 	
 	
 	/**
 	/**
 	 * 获取明细
 	 * 获取明细

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

@@ -1,7 +1,9 @@
 package com.ym.mec.biz.service;
 package com.ym.mec.biz.service;
 
 
+import com.ym.mec.biz.dal.dto.MapDto;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
 import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
+import com.ym.mec.common.entity.Mapper;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.common.service.BaseService;
 
 
@@ -45,4 +47,6 @@ public interface OrganizationService extends BaseService<Integer, Organization>
     int updateOrgan(Organization organization);
     int updateOrgan(Organization organization);
 
 
     Long add(Organization organization);
     Long add(Organization organization);
+
+    Map<String,List<Mapper>> getOrganRole(Integer id);
 }
 }

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

@@ -4,6 +4,8 @@ import com.ym.mec.biz.dal.dto.PlatformProductDto;
 import com.ym.mec.biz.dal.entity.PlatformProduct;
 import com.ym.mec.biz.dal.entity.PlatformProduct;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
 
 
+import java.util.List;
+
 public interface PlatformProductService {
 public interface PlatformProductService {
 
 
     void addProduct(PlatformProductDto obj);
     void addProduct(PlatformProductDto obj);
@@ -12,6 +14,8 @@ public interface PlatformProductService {
 
 
     PageInfo<PlatformProduct> queryPage(String search, Integer page, Integer rows);
     PageInfo<PlatformProduct> queryPage(String search, Integer page, Integer rows);
 
 
+    List<String> queryMenuIdList(Integer serveId);
+
     void deleteProduct(Integer id);
     void deleteProduct(Integer id);
 
 
 }
 }

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/PlatformServeDetailService.java

@@ -1,4 +1,7 @@
 package com.ym.mec.biz.service;
 package com.ym.mec.biz.service;
 
 
-public interface PlatformServeDetailService {
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.entity.PlatformServeDetail;
+
+public interface PlatformServeDetailService extends IService<PlatformServeDetail> {
 }
 }

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/PlatformServeService.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.service;
 package com.ym.mec.biz.service;
 
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.biz.dal.dto.PlatformServeDto;
 import com.ym.mec.biz.dal.dto.PlatformServeDto;
+import com.ym.mec.biz.dal.entity.PlatformServe;
 import com.ym.mec.biz.dal.vo.PlatformServeInfoVo;
 import com.ym.mec.biz.dal.vo.PlatformServeInfoVo;
 import com.ym.mec.biz.dal.vo.PlatformServeModeVo;
 import com.ym.mec.biz.dal.vo.PlatformServeModeVo;
 import com.ym.mec.biz.dal.vo.PlatformServePageVo;
 import com.ym.mec.biz.dal.vo.PlatformServePageVo;
@@ -8,7 +10,7 @@ import com.ym.mec.common.page.PageInfo;
 
 
 import java.util.List;
 import java.util.List;
 
 
-public interface PlatformServeService {
+public interface PlatformServeService extends IService<PlatformServe> {
 
 
     void addServe(PlatformServeDto obj);
     void addServe(PlatformServeDto obj);
 
 

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

@@ -153,9 +153,9 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     //陪练课可预约声部列表
     //陪练课可预约声部列表
     String PRACTICE_SUBJECT_ID_LIST = "practice_subject_id_list";
     String PRACTICE_SUBJECT_ID_LIST = "practice_subject_id_list";
     //陪练课预约开始时间
     //陪练课预约开始时间
-    String PRACTICE_APPLY_START_TIME = "practice_apply_start_time";
+//    String PRACTICE_APPLY_START_TIME = "practice_apply_start_time";
     //陪练课预约结束时间
     //陪练课预约结束时间
-    String PRACTICE_APPLY_END_TIME = "practice_apply_end_time";
+//    String PRACTICE_APPLY_END_TIME = "practice_apply_end_time";
 
 
     //特殊规则默认值--》商品规则设置
     //特殊规则默认值--》商品规则设置
     //内部库存预警值
     //内部库存预警值

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysManualService.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.entity.SysManual;
+
+/**
+ * (SysManual)表服务接口
+ *
+ * @author makejava
+ * @since 2021-12-20 13:46:08
+ */
+public interface SysManualService extends IService<SysManual> {
+}
+

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

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dto.TenantInfoDto;
 import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo;
 import com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.thirdparty.yqpay.Msg;
 
 
 import java.util.Map;
 import java.util.Map;
 
 
@@ -21,4 +22,9 @@ public interface TenantInfoService extends IService<TenantInfo> {
     PageInfo<TenantInfoInfoPageVo> queryPage(Map<String, Object> param);
     PageInfo<TenantInfoInfoPageVo> queryPage(Map<String, Object> param);
 
 
     TenantInfo get(Integer tenantId);
     TenantInfo get(Integer tenantId);
+
+    Map<String, Object> pay(Integer tenantId) throws Exception;
+
+    Msg orderNotify(Msg msg);
+
 }
 }

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

@@ -0,0 +1,19 @@
+package com.ym.mec.biz.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
+import com.ym.mec.biz.dal.entity.TenantOrderRecord;
+import com.ym.mec.common.page.PageInfo;
+
+/**
+ * 机构付款记录表(TenantOrderRecord)表服务接口
+ *
+ * @author hgw
+ * @since 2021-12-20 10:08:28
+ */
+public interface TenantOrderRecordService extends IService<TenantOrderRecord> {
+
+    PageInfo<TenantOrderRecord> queryPage(TenantOrderRecordDto dto);
+
+}
+

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

@@ -2802,7 +2802,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if(StringUtils.isEmpty(configValue)){
         if(StringUtils.isEmpty(configValue)){
             throw new BizException("请配置会员团每学期赠送课程分钟数");
             throw new BizException("请配置会员团每学期赠送课程分钟数");
         }
         }
-        Integer giveCourseTime = Integer.parseInt(configValue);
+        Integer giveCourseTime = Integer.parseInt(configValue)>>1;
 
 
         Boolean confirmGenerate = false;
         Boolean confirmGenerate = false;
         if (Objects.nonNull(classGroup4MixDtos.get(0).getConfirmGenerate())) {
         if (Objects.nonNull(classGroup4MixDtos.get(0).getConfirmGenerate())) {

+ 1027 - 1049
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -1,69 +1,18 @@
 package com.ym.mec.biz.service.impl;
 package com.ym.mec.biz.service.impl;
 
 
-import java.io.File;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.CirculationUser;
-import com.ym.mec.biz.dal.dto.OAFinancialDto;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.http.HttpStatus;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.CirculationUser;
+import com.ym.mec.biz.dal.dto.OAFinancialDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SysUserContracts;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.SysUserContracts.ContractType;
 import com.ym.mec.biz.dal.entity.SysUserContracts.ContractType;
-import com.ym.mec.biz.dal.entity.SysUserTsign;
-import com.ym.mec.biz.dal.entity.VipGroup;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.service.ContractService;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRegistrationService;
-import com.ym.mec.biz.service.SubjectService;
-import com.ym.mec.biz.service.SysUserContractsService;
-import com.ym.mec.biz.service.SysUserTsignService;
-import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
@@ -76,422 +25,451 @@ import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.freemarker.FreemarkerTemplateEngine;
 import com.ym.mec.util.freemarker.FreemarkerTemplateEngine;
 import com.ym.mec.util.money.MoneyUtil;
 import com.ym.mec.util.money.MoneyUtil;
 import com.ym.mec.util.pdf.PDFUtil;
 import com.ym.mec.util.pdf.PDFUtil;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
 
 
 @Service
 @Service
 public class ContractServiceImpl implements ContractService, InitializingBean {
 public class ContractServiceImpl implements ContractService, InitializingBean {
 
 
-	@Autowired
-	private SysUserTsignService sysUserTsignService;
-
-	@Autowired
-	private SysUserFeignService sysUserFeignService;
-
-	@Autowired
-	private SysUserContractsService sysUserContractsService;
-
-	@Autowired
-	private SysUserContractsDao sysUserContractsDao;
+    @Autowired
+    private SysUserTsignService sysUserTsignService;
 
 
-	@Autowired
-	private StudentRegistrationService studentRegistrationService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
 
-	@Autowired
-	private StudentRegistrationDao studentRegistrationDao;
+    @Autowired
+    private SysUserContractsService sysUserContractsService;
 
 
-	@Autowired
-	private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired
+    private SysUserContractsDao sysUserContractsDao;
 
 
-	@Autowired
-	private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
+    @Autowired
+    private StudentRegistrationService studentRegistrationService;
 
 
-	@Autowired
-	private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
 
 
-	@Autowired
-	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
 
 
-	@Autowired
-	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
 
 
-	@Autowired
-	private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+    @Autowired
+    private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
 
 
-	@Autowired
-	@Lazy
-	private VipGroupService vipGroupService;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 
 
-	@Autowired
-	private SubjectService subjectService;
+    @Autowired
+    private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 
 
-	@Autowired
-	private ESealPlugin eSealPlugin;
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
 
 
-	@Autowired
-	private StoragePluginContext storagePluginContext;
+    @Autowired
+    @Lazy
+    private VipGroupService vipGroupService;
 
 
-	@Autowired
-	private GoodsService goodsService;
+    @Autowired
+    private SubjectService subjectService;
 
 
-	@Autowired
-	private MusicGroupService musicGroupService;
+    @Autowired
+    private ESealPlugin eSealPlugin;
 
 
-	@Autowired
-	private StudentDao studentDao;
+    @Autowired
+    private StoragePluginContext storagePluginContext;
 
 
-	@Autowired
-	private EmployeeDao employeeDao;
+    @Autowired
+    private GoodsService goodsService;
 
 
-	@Value("${contract.baseDir:/var/pdf}")
-	private String contractBaseDir;
+    @Autowired
+    private MusicGroupService musicGroupService;
 
 
-	@Value("${message.debugMode}")
-	private boolean debugMode;
+    @Autowired
+    private StudentDao studentDao;
 
 
-	@Autowired
-	private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;
+    @Autowired
+    private EmployeeDao employeeDao;
 
 
-	private DateFormat dateFormatOss = new SimpleDateFormat("yyyy/MM/dd");
+    @Value("${contract.baseDir:/var/pdf}")
+    private String contractBaseDir;
 
 
-	private DateFormat dateFormat1 = new SimpleDateFormat("yyMMddHHmmSS");
+    @Value("${message.debugMode}")
+    private boolean debugMode;
 
 
-	private final Logger logger = LoggerFactory.getLogger(ContractService.class);
+    @Autowired
+    private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;
 
 
-	@Override
-	public void afterPropertiesSet() throws Exception {
-		// 注册企业账户
-		Map<String, String> organList = new HashMap<String, String>();
-		organList.put("91420106333619290A", "武汉长乐长风乐器销售有限公司");
-		organList.put("91440300326364429H", "深圳大雅乐盟网络教育股份有限公司");
+    private DateFormat dateFormatOss = new SimpleDateFormat("yyyy/MM/dd");
 
 
-		for (Entry<String, String> organ : organList.entrySet()) {
+    private DateFormat dateFormat1 = new SimpleDateFormat("yyMMddHHmmSS");
 
 
-			String organCode = organ.getKey();
-			String orgName = organ.getValue();
+    private final Logger logger = LoggerFactory.getLogger(ContractService.class);
 
 
-			SysUserTsign sysUserTsign = sysUserTsignService.queryByCardNo(organCode);
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        // 注册企业账户
+        Map<String, String> organList = new HashMap<String, String>();
+        organList.put("91420106333619290A", "武汉长乐长风乐器销售有限公司");
+        organList.put("91440300326364429H", "深圳大雅乐盟网络教育股份有限公司");
 
 
-			if (sysUserTsign == null) {
-				String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
+        organList.forEach((code, name) -> {
+            SysUserTsign sysUserTsign = sysUserTsignService.queryByCardNo(code);
+            if (Objects.isNull(sysUserTsign)) {
+                addTsign(code, name);
+            }
+        });
+    }
 
 
-				if (StringUtils.isBlank(accountId)) {
-					throw new BizException("创建企业电子存证账户失败");
-				}
+    /**
+     * 校验企业营业信息,不存在则添加一个
+     */
+    @Override
+    public void addTsign(String organCode, String orgName) {
+        Optional.ofNullable(organCode).orElseThrow(() -> new BizException("营业执照编号不能为空!"));
+        Optional.ofNullable(orgName).orElseThrow(() -> new BizException("营业名称不能为空"));
 
 
-				String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
+        String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
+        if (StringUtils.isBlank(accountId)) {
+            throw new BizException("创建企业电子存证账户失败");
+        }
 
 
-				if (StringUtils.isBlank(sealData)) {
-					throw new BizException("创建电子存证印章失败");
-				}
+        String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
+        if (StringUtils.isBlank(sealData)) {
+            throw new BizException("创建电子存证印章失败");
+        }
 
 
-				sysUserTsign = new SysUserTsign(-1, accountId, sealData, orgName, organCode);
+        SysUserTsign sysUserTsign = new SysUserTsign(-1, accountId, sealData, orgName, organCode);
+        sysUserTsignService.insert(sysUserTsign);
+    }
 
 
-				sysUserTsignService.insert(sysUserTsign);
-			}
-		}
-	}
+    @Override
+    public SysUserTsign register(Integer userId, String realName, String idCardNo, String mobileNo) {
 
 
-	@Override
-	public SysUserTsign register(Integer userId, String realName, String idCardNo, String mobileNo) {
+        if (StringUtils.isBlank(realName) || StringUtils.isBlank(idCardNo) || StringUtils.isBlank(mobileNo)) {
+            return null;
+        }
 
 
-		if (StringUtils.isBlank(realName) || StringUtils.isBlank(idCardNo) || StringUtils.isBlank(mobileNo)) {
-			return null;
-		}
+        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
+        if (sysUserTsign == null) {
 
 
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
-		if (sysUserTsign == null) {
+            String accountId = "";
+            String sealData = "";
 
 
-			String accountId = "";
-			String sealData = "";
+            SysUser user = studentDao.getUser(userId);
+            if (user == null) {
+                throw new BizException("用户信息查询失败");
+            }
 
 
-			SysUser user = studentDao.getUser(userId);
-			if (user == null) {
-				throw new BizException("用户信息查询失败");
-			}
+            if (CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
+                if (!debugMode) {
+                    realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idCardNo);
+                }
 
 
-			if(CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())){
-				if(!debugMode){
-					realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idCardNo);
-				}
+                accountId = eSealPlugin.createUserAccount(realName, idCardNo, mobileNo);
 
 
-				accountId = eSealPlugin.createUserAccount(realName, idCardNo, mobileNo);
+                if (StringUtils.isBlank(accountId)) {
+                    throw new BizException("创建电子存证账户失败");
+                }
 
 
-				if (StringUtils.isBlank(accountId)) {
-					throw new BizException("创建电子存证账户失败");
-				}
+                sealData = eSealPlugin.createUserSeal(accountId);
 
 
-				sealData = eSealPlugin.createUserSeal(accountId);
+                if (StringUtils.isBlank(sealData)) {
+                    throw new BizException("创建电子存证印章失败");
+                }
+            }
 
 
-				if (StringUtils.isBlank(sealData)) {
-					throw new BizException("创建电子存证印章失败");
-				}
-			}
+            sysUserTsign = new SysUserTsign(userId, accountId, sealData, realName, idCardNo);
 
 
-			sysUserTsign = new SysUserTsign(userId, accountId, sealData, realName, idCardNo);
+            sysUserTsignService.insert(sysUserTsign);
 
 
-			sysUserTsignService.insert(sysUserTsign);
+            return sysUserTsign;
+        }
 
 
-			return sysUserTsign;
-		}
+        return null;
+    }
 
 
-		return null;
-	}
+    @Override
+    public boolean transferRegisterContract(Integer userId) {
 
 
-	@Override
-	public boolean transferRegisterContract(Integer userId) {
+        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
 
 
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
+        if (sysUserTsign == null) {
+            SysUser user = sysUserFeignService.queryUserById(userId);
+            if (user == null) {
+                throw new BizException("用户信息查询失败");
+            }
+            sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+        }
 
 
-		if (sysUserTsign == null) {
-			SysUser user = sysUserFeignService.queryUserById(userId);
-			if (user == null) {
-				throw new BizException("用户信息查询失败");
-			}
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-		}
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/register/" + userId + ".pdf";
 
 
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/register/" + userId + ".pdf";
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
 
 
-		File srcFile = new File(srcPdfPath);
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
 
 
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
+        Map<String, Object> params = new HashMap<String, Object>();
 
 
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+        templateEngine.render(params, "register.ftl", srcFile);
 
 
-		Map<String, Object> params = new HashMap<String, Object>();
+        // 生成借款协议PDF
+        try {
+            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
+        } catch (IOException e) {
+            throw new BizException("生成pdf协议失败", e);
+        }
 
 
-		templateEngine.render(params, "register.ftl", srcFile);
+        if (sysUserTsign != null) {
+            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
+        }
 
 
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			throw new BizException("生成pdf协议失败", e);
-		}
+        Date date = new Date();
+        // 上传到oss
+        String dateStrOss = dateFormatOss.format(date);
+        dateStrOss = "users/" + dateStrOss + "/" + DateUtil.getHour(date);
+        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
 
 
-		if (sysUserTsign != null) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
+        SysUserContracts sysUserContracts = new SysUserContracts();
+        sysUserContracts.setCreateTime(date);
+        sysUserContracts.setType(ContractType.REGISTER);
+        sysUserContracts.setUrl(pdfFilePath);
+        sysUserContracts.setUserId(userId);
 
 
-		Date date = new Date();
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "users/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
+        sysUserContractsService.insert(sysUserContracts);
 
 
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.REGISTER);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
+        FileUtils.deleteQuietly(srcFile);
 
 
-		sysUserContractsService.insert(sysUserContracts);
+        return true;
+    }
 
 
-		FileUtils.deleteQuietly(srcFile);
+    @Override
+    public String queryRegisterContract(Integer userId) {
 
 
-		return true;
-	}
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/register/" + userId + ".pdf";
 
 
-	@Override
-	public String queryRegisterContract(Integer userId) {
+        File srcFile = new File(srcPdfPath);
 
 
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/register/" + userId + ".pdf";
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
 
 
-		File srcFile = new File(srcPdfPath);
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
 
 
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
+        Map<String, Object> params = new HashMap<String, Object>();
 
 
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+        templateEngine.render(params, "register.ftl", srcFile);
 
 
-		Map<String, Object> params = new HashMap<String, Object>();
+        String result = "";
+        try {
+            result = FileUtils.readFileToString(srcFile);
+        } catch (IOException e) {
+            throw new BizException("读取注册协议出错", e);
+        } finally {
+            FileUtils.deleteQuietly(srcFile);
+        }
 
 
-		templateEngine.render(params, "register.ftl", srcFile);
-
-		String result = "";
-		try {
-			result = FileUtils.readFileToString(srcFile);
-		} catch (IOException e) {
-			throw new BizException("读取注册协议出错", e);
-		} finally {
-			FileUtils.deleteQuietly(srcFile);
-		}
-
-		return result;
-	}
-
-	@Override
-	public boolean transferMusicGroupCoursesContract(Integer userId, String musicGroupId) {
-		if(true){
-			transferProduceContract(userId, musicGroupId, null);
-			return true;
-		}
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
-
-		if (sysUserTsign == null) {
-			SysUser user = sysUserFeignService.queryUserById(userId);
-			if (user == null) {
-				throw new BizException("用户信息查询失败");
-			}
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-		}
-		Date date = new Date();
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/courses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		// 查询参数信息
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-		params.put("studentInfo", studentInfo);
-
-		// 课程类型
-		params.put("classesType", "乐团团课");
-
-		// 课程费用
-		StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-		if (studentRegistration == null) {
-			throw new BizException("用户 报名信息不存在");
-		}
-		MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
-		if (musicGroupStudentFee == null) {
-			MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId,
-					studentRegistration.getActualSubjectId());
-			if (musicGroupSubjectPlan == null) {
-				throw new BizException("声部课程费用设置找不到");
-			}
-			params.put("courseFee", musicGroupSubjectPlan.getFee().doubleValue());
-		} else {
-			params.put("courseFee", musicGroupStudentFee.getTemporaryCourseFee().doubleValue() > 0 ? musicGroupStudentFee.getTemporaryCourseFee().doubleValue()
-					: musicGroupStudentFee.getCourseFee().doubleValue());
-		}
+        return result;
+    }
 
 
-		// 收费形式
-		List<MusicGroupPaymentCalender> calenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
+    @Override
+    public boolean transferMusicGroupCoursesContract(Integer userId, String musicGroupId) {
+        if (true) {
+            transferProduceContract(userId, musicGroupId, null);
+            return true;
+        }
+        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
+
+        if (sysUserTsign == null) {
+            SysUser user = sysUserFeignService.queryUserById(userId);
+            if (user == null) {
+                throw new BizException("用户信息查询失败");
+            }
+            sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+        }
+        Date date = new Date();
+
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/courses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
+
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
+
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+
+        Map<String, Object> params = new HashMap<String, Object>();
+
+        // 查询参数信息
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        params.put("studentInfo", studentInfo);
+
+        // 课程类型
+        params.put("classesType", "乐团团课");
+
+        // 课程费用
+        StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+        if (studentRegistration == null) {
+            throw new BizException("用户 报名信息不存在");
+        }
+        MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
+        if (musicGroupStudentFee == null) {
+            MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId,
+                    studentRegistration.getActualSubjectId());
+            if (musicGroupSubjectPlan == null) {
+                throw new BizException("声部课程费用设置找不到");
+            }
+            params.put("courseFee", musicGroupSubjectPlan.getFee().doubleValue());
+        } else {
+            params.put("courseFee", musicGroupStudentFee.getTemporaryCourseFee().doubleValue() > 0 ? musicGroupStudentFee.getTemporaryCourseFee().doubleValue()
+                    : musicGroupStudentFee.getCourseFee().doubleValue());
+        }
+
+        // 收费形式
+        List<MusicGroupPaymentCalender> calenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
 
 
 		/*if (calenders == null || calenders.size() == 0) {
 		/*if (calenders == null || calenders.size() == 0) {
 			
 			
 		} else {
 		} else {
 			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining("月,")) + "月");
 			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining("月,")) + "月");
 		}*/
 		}*/
-		params.put("paymentcalender", "一次性");
-
-		params.put("isShowVisualSeal", false);
-
-		MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-		if (musicGroup == null) {
-			throw new BizException("乐团信息没找到");
-		}
-
-		params.put("ownershipType", musicGroup.getOwnershipType().name());
-
-		templateEngine.render(params, "courses.ftl", srcFile);
-
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			throw new BizException("生成pdf协议失败", e);
-		}
-		String organCode = "";
-		if (musicGroup.getOwnershipType() == OwnershipType.OWN) {
-			organCode = "91440300326364429H";
-		} else {
-			organCode = "91420106333619290A";
-		}
-		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
-		if (organTsign == null) {
-			throw new BizException("甲方未创建签章");
-		}
-
-		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
-		if (sysUserTsign != null) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
-
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "musicCourses/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
-
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.COURSES);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
-
-		sysUserContractsService.insert(sysUserContracts);
-
-		FileUtils.deleteQuietly(srcFile);
-
-		return true;
-	}
-
-	@Override
-	public String queryMusicGroupCoursesContract(Integer userId, String musicGroupId) {
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/courses/" + userId + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-		params.put("studentInfo", studentInfo);
-
-		// 课程类型
-		params.put("classesType", "乐团团课");
-
-		// 课程费用
-		StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-		if (studentRegistration == null) {
-			throw new BizException("用户报名信息不存在");
-		}
-		MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
-		if (musicGroupStudentFee == null) {
-			MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId,
-					studentRegistration.getActualSubjectId());
-			if (musicGroupSubjectPlan == null) {
-				throw new BizException("声部课程费用设置找不到");
-			}
-			params.put("courseFee", musicGroupSubjectPlan.getFee().doubleValue());
-		} else {
-			params.put(
-					"courseFee",
-					(musicGroupStudentFee.getTemporaryCourseFee() != null && musicGroupStudentFee.getTemporaryCourseFee().doubleValue() > 0) ? musicGroupStudentFee
-							.getTemporaryCourseFee().doubleValue() : musicGroupStudentFee.getCourseFee().doubleValue());
-		}
-
-		// 收费形式
-		List<MusicGroupPaymentCalender> calenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
+        params.put("paymentcalender", "一次性");
+
+        params.put("isShowVisualSeal", false);
+
+        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+        if (musicGroup == null) {
+            throw new BizException("乐团信息没找到");
+        }
+
+        params.put("ownershipType", musicGroup.getOwnershipType().name());
+
+        templateEngine.render(params, "courses.ftl", srcFile);
+
+        // 生成借款协议PDF
+        try {
+            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
+        } catch (IOException e) {
+            throw new BizException("生成pdf协议失败", e);
+        }
+        String organCode = "";
+        if (musicGroup.getOwnershipType() == OwnershipType.OWN) {
+            organCode = "91440300326364429H";
+        } else {
+            organCode = "91420106333619290A";
+        }
+        SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
+        if (organTsign == null) {
+            throw new BizException("甲方未创建签章");
+        }
+
+        eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
+        if (sysUserTsign != null) {
+            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
+        }
+
+        // 上传到oss
+        String dateStrOss = dateFormatOss.format(date);
+        dateStrOss = "musicCourses/" + dateStrOss + "/" + DateUtil.getHour(date);
+        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
+
+        SysUserContracts sysUserContracts = new SysUserContracts();
+        sysUserContracts.setCreateTime(date);
+        sysUserContracts.setType(ContractType.COURSES);
+        sysUserContracts.setUrl(pdfFilePath);
+        sysUserContracts.setUserId(userId);
+
+        sysUserContractsService.insert(sysUserContracts);
+
+        FileUtils.deleteQuietly(srcFile);
+
+        return true;
+    }
+
+    @Override
+    public String queryMusicGroupCoursesContract(Integer userId, String musicGroupId) {
+
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/courses/" + userId + ".pdf";
+
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
+
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+
+        Map<String, Object> params = new HashMap<String, Object>();
+
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        params.put("studentInfo", studentInfo);
+
+        // 课程类型
+        params.put("classesType", "乐团团课");
+
+        // 课程费用
+        StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+        if (studentRegistration == null) {
+            throw new BizException("用户报名信息不存在");
+        }
+        MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
+        if (musicGroupStudentFee == null) {
+            MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId,
+                    studentRegistration.getActualSubjectId());
+            if (musicGroupSubjectPlan == null) {
+                throw new BizException("声部课程费用设置找不到");
+            }
+            params.put("courseFee", musicGroupSubjectPlan.getFee().doubleValue());
+        } else {
+            params.put(
+                    "courseFee",
+                    (musicGroupStudentFee.getTemporaryCourseFee() != null && musicGroupStudentFee.getTemporaryCourseFee().doubleValue() > 0) ? musicGroupStudentFee
+                            .getTemporaryCourseFee().doubleValue() : musicGroupStudentFee.getCourseFee().doubleValue());
+        }
+
+        // 收费形式
+        List<MusicGroupPaymentCalender> calenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
 
 
 		/*if (calenders == null || calenders.size() == 0) {
 		/*if (calenders == null || calenders.size() == 0) {
 			params.put("paymentcalender", "一次性");
 			params.put("paymentcalender", "一次性");
@@ -499,736 +477,736 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining("月,")) + "月");
 			params.put("paymentcalender", calenders.stream().map(cal -> cal.getPaymentMonth().toString()).collect(Collectors.joining("月,")) + "月");
 		}*/
 		}*/
 
 
-		params.put("paymentcalender", "一次性");
+        params.put("paymentcalender", "一次性");
 
 
-		params.put("isShowVisualSeal", true);
+        params.put("isShowVisualSeal", true);
 
 
-		MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-		if (musicGroup == null) {
-			throw new BizException("乐团信息没找到");
-		}
+        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+        if (musicGroup == null) {
+            throw new BizException("乐团信息没找到");
+        }
 
 
-		params.put("ownershipType", musicGroup.getOwnershipType().name());
+        params.put("ownershipType", musicGroup.getOwnershipType().name());
 
 
-		templateEngine.render(params, "courses.ftl", srcFile);
+        templateEngine.render(params, "courses.ftl", srcFile);
 
 
-		String result = "";
-		try {
-			result = FileUtils.readFileToString(srcFile);
-		} catch (IOException e) {
-			throw new BizException("读取课程协议出错", e);
-		} finally {
-			FileUtils.deleteQuietly(srcFile);
-		}
+        String result = "";
+        try {
+            result = FileUtils.readFileToString(srcFile);
+        } catch (IOException e) {
+            throw new BizException("读取课程协议出错", e);
+        } finally {
+            FileUtils.deleteQuietly(srcFile);
+        }
 
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@Override
-	public boolean transferVipGroupCoursesContract(Integer userId, Long vipGroupId) {
-		if(true){
-			transferProduceContract(userId, null, null);
-			return true;
-		}
+    @Override
+    public boolean transferVipGroupCoursesContract(Integer userId, Long vipGroupId) {
+        if (true) {
+            transferProduceContract(userId, null, null);
+            return true;
+        }
 
 
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
+        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
 
 
-		if (sysUserTsign == null) {
-			SysUser user = sysUserFeignService.queryUserById(userId);
-			if (user == null) {
-				throw new BizException("用户信息查询失败");
-			}
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-		}
-		Date date = new Date();
+        if (sysUserTsign == null) {
+            SysUser user = sysUserFeignService.queryUserById(userId);
+            if (user == null) {
+                throw new BizException("用户信息查询失败");
+            }
+            sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+        }
+        Date date = new Date();
 
 
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/vipCourses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/vipCourses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
 
 
-		File srcFile = new File(srcPdfPath);
+        File srcFile = new File(srcPdfPath);
 
 
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
 
 
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
 
 
-		Map<String, Object> params = new HashMap<String, Object>();
+        Map<String, Object> params = new HashMap<String, Object>();
 
 
-		// 查询参数信息
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-		params.put("studentInfo", studentInfo);
+        // 查询参数信息
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        params.put("studentInfo", studentInfo);
 
 
-		// 课程类型
-		params.put("classesType", "VIP课");
+        // 课程类型
+        params.put("classesType", "VIP课");
 
 
-		// 课程费用
-		VipGroup vipGroup = vipGroupService.get(vipGroupId);
-		if (vipGroup == null) {
-			throw new BizException("VIP课找不到");
-		}
-		params.put("courseFee", vipGroup.getTotalPrice().doubleValue());
+        // 课程费用
+        VipGroup vipGroup = vipGroupService.get(vipGroupId);
+        if (vipGroup == null) {
+            throw new BizException("VIP课找不到");
+        }
+        params.put("courseFee", vipGroup.getTotalPrice().doubleValue());
 
 
-		// 收费形式
-		params.put("paymentcalender", "一次性");
+        // 收费形式
+        params.put("paymentcalender", "一次性");
 
 
-		params.put("isShowVisualSeal", false);
+        params.put("isShowVisualSeal", false);
 
 
-		params.put("ownershipType", "OWN");
+        params.put("ownershipType", "OWN");
 
 
-		templateEngine.render(params, "courses.ftl", srcFile);
+        templateEngine.render(params, "courses.ftl", srcFile);
 
 
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			throw new BizException("生成pdf协议失败", e);
-		}
-		String organCode = "91440300326364429H";
-		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
-		if (organTsign == null) {
-			throw new BizException("甲方未创建签章");
-		}
+        // 生成借款协议PDF
+        try {
+            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
+        } catch (IOException e) {
+            throw new BizException("生成pdf协议失败", e);
+        }
+        String organCode = "91440300326364429H";
+        SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
+        if (organTsign == null) {
+            throw new BizException("甲方未创建签章");
+        }
 
 
-		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
+        eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
 
 
-		if (sysUserTsign != null) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
+        if (sysUserTsign != null) {
+            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
+        }
 
 
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "vipCourses/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
+        // 上传到oss
+        String dateStrOss = dateFormatOss.format(date);
+        dateStrOss = "vipCourses/" + dateStrOss + "/" + DateUtil.getHour(date);
+        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
 
 
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.VIP_COURSES);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
+        SysUserContracts sysUserContracts = new SysUserContracts();
+        sysUserContracts.setCreateTime(date);
+        sysUserContracts.setType(ContractType.VIP_COURSES);
+        sysUserContracts.setUrl(pdfFilePath);
+        sysUserContracts.setUserId(userId);
 
 
-		sysUserContractsService.insert(sysUserContracts);
+        sysUserContractsService.insert(sysUserContracts);
 
 
-		FileUtils.deleteQuietly(srcFile);
+        FileUtils.deleteQuietly(srcFile);
 
 
-		return true;
-	}
+        return true;
+    }
 
 
-	@Override
-	public String queryVipGroupCoursesContract(Integer userId, Long vipGroupId) {
+    @Override
+    public String queryVipGroupCoursesContract(Integer userId, Long vipGroupId) {
 
 
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/courses/" + userId + ".pdf";
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/courses/" + userId + ".pdf";
 
 
-		File srcFile = new File(srcPdfPath);
+        File srcFile = new File(srcPdfPath);
 
 
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
 
 
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
 
 
-		Map<String, Object> params = new HashMap<String, Object>();
+        Map<String, Object> params = new HashMap<String, Object>();
 
 
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-		params.put("studentInfo", studentInfo);
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        params.put("studentInfo", studentInfo);
 
 
-		// 课程类型
-		params.put("classesType", "VIP课");
+        // 课程类型
+        params.put("classesType", "VIP课");
 
 
-		// 课程费用
-		VipGroup vipGroup = vipGroupService.get(vipGroupId);
-		if (vipGroup == null) {
-			throw new BizException("VIP课找不到");
-		}
-		params.put("courseFee", vipGroup.getTotalPrice().doubleValue());
+        // 课程费用
+        VipGroup vipGroup = vipGroupService.get(vipGroupId);
+        if (vipGroup == null) {
+            throw new BizException("VIP课找不到");
+        }
+        params.put("courseFee", vipGroup.getTotalPrice().doubleValue());
 
 
-		// 收费形式
-		params.put("paymentcalender", "一次性");
+        // 收费形式
+        params.put("paymentcalender", "一次性");
 
 
-		params.put("isShowVisualSeal", true);
+        params.put("isShowVisualSeal", true);
 
 
-		params.put("ownershipType", "OWN");
+        params.put("ownershipType", "OWN");
 
 
-		templateEngine.render(params, "courses.ftl", srcFile);
+        templateEngine.render(params, "courses.ftl", srcFile);
 
 
-		String result = "";
-		try {
-			result = FileUtils.readFileToString(srcFile);
-		} catch (IOException e) {
-			throw new BizException("读取课程协议出错", e);
-		} finally {
-			FileUtils.deleteQuietly(srcFile);
-		}
+        String result = "";
+        try {
+            result = FileUtils.readFileToString(srcFile);
+        } catch (IOException e) {
+            throw new BizException("读取课程协议出错", e);
+        } finally {
+            FileUtils.deleteQuietly(srcFile);
+        }
 
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@Override
-	public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
+    @Override
+    public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
 
 
-		transferProduceContract(userId, musicGroupId,null);
-		return true;
-	}
+        transferProduceContract(userId, musicGroupId, null);
+        return true;
+    }
 
 
-	@Override
-	public String queryGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
+    @Override
+    public String queryGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
 
 
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/goods/" + userId + ".pdf";
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/goods/" + userId + ".pdf";
 
 
-		File srcFile = new File(srcPdfPath);
+        File srcFile = new File(srcPdfPath);
 
 
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
 
 
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
 
 
-		Map<String, Object> params = new HashMap<String, Object>();
+        Map<String, Object> params = new HashMap<String, Object>();
 
 
-		// 查询参数信息
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        // 查询参数信息
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
 
 
-		int subjectId = studentInfo.getSubject().getId();
+        int subjectId = studentInfo.getSubject().getId();
 
 
-		Subject subject = subjectService.get(subjectId);
-		studentInfo.setSubject(subject);
+        Subject subject = subjectService.get(subjectId);
+        studentInfo.setSubject(subject);
 
 
-		params.put("studentInfo", studentInfo);
+        params.put("studentInfo", studentInfo);
 
 
-		List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
-		params.put("goodsList", goodsList);
+        List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
+        params.put("goodsList", goodsList);
 
 
-		double depositFee = 0d;
-		if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
-			MusicGroupSubjectGoodsGroup musicGroupSubjectPlan = musicGroupSubjectGoodsGroupService.query(musicGroupId, subjectId, goodsIds);
-			if (musicGroupSubjectPlan != null) {
-				depositFee = musicGroupSubjectPlan.getDepositFee().doubleValue();
-			}
-		}
-		params.put("depositFee", depositFee);
-		params.put("depositFeeFmt", MoneyUtil.toChinese(depositFee + ""));
+        double depositFee = 0d;
+        if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
+            MusicGroupSubjectGoodsGroup musicGroupSubjectPlan = musicGroupSubjectGoodsGroupService.query(musicGroupId, subjectId, goodsIds);
+            if (musicGroupSubjectPlan != null) {
+                depositFee = musicGroupSubjectPlan.getDepositFee().doubleValue();
+            }
+        }
+        params.put("depositFee", depositFee);
+        params.put("depositFeeFmt", MoneyUtil.toChinese(depositFee + ""));
 
 
-		params.put("isShowVisualSeal", true);
+        params.put("isShowVisualSeal", true);
 
 
-		MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-		if (musicGroup == null) {
-			throw new BizException("乐团信息没找到");
-		}
+        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+        if (musicGroup == null) {
+            throw new BizException("乐团信息没找到");
+        }
 
 
-		params.put("ownershipType", musicGroup.getOwnershipType().name());
+        params.put("ownershipType", musicGroup.getOwnershipType().name());
 
 
-		templateEngine.render(params, "goods.ftl", srcFile);
+        templateEngine.render(params, "goods.ftl", srcFile);
 
 
-		String result = "";
-		try {
-			result = FileUtils.readFileToString(srcFile);
-		} catch (IOException e) {
-			throw new BizException("读取商品协议出错", e);
-		} finally {
-			FileUtils.deleteQuietly(srcFile);
-		}
+        String result = "";
+        try {
+            result = FileUtils.readFileToString(srcFile);
+        } catch (IOException e) {
+            throw new BizException("读取商品协议出错", e);
+        } finally {
+            FileUtils.deleteQuietly(srcFile);
+        }
 
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@Override
-	public String queryPracticeCoursesContract(Integer userId, int courseSectionNum, Date startDate, Date endDate, BigDecimal fee) {
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/practice/" + userId + ".pdf";
+    @Override
+    public String queryPracticeCoursesContract(Integer userId, int courseSectionNum, Date startDate, Date endDate, BigDecimal fee) {
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/practice/" + userId + ".pdf";
 
 
-		File srcFile = new File(srcPdfPath);
+        File srcFile = new File(srcPdfPath);
 
 
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
 
 
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
 
 
-		Map<String, Object> params = new HashMap<String, Object>();
-		params.put("courseSectionNum", courseSectionNum);
-		params.put("startDate", startDate);
-		params.put("endDate", endDate);
-		params.put("fee", fee);
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("courseSectionNum", courseSectionNum);
+        params.put("startDate", startDate);
+        params.put("endDate", endDate);
+        params.put("fee", fee);
 
 
-		params.put("isShowVisualSeal", false);
+        params.put("isShowVisualSeal", false);
 
 
-		params.put("ownershipType", "OWN");
+        params.put("ownershipType", "OWN");
 
 
-		templateEngine.render(params, "practice.ftl", srcFile);
+        templateEngine.render(params, "practice.ftl", srcFile);
 
 
-		String result = "";
-		try {
-			result = FileUtils.readFileToString(srcFile);
-		} catch (IOException e) {
-			throw new BizException("读取网管课购买协议出错", e);
-		} finally {
-			FileUtils.deleteQuietly(srcFile);
-		}
+        String result = "";
+        try {
+            result = FileUtils.readFileToString(srcFile);
+        } catch (IOException e) {
+            throw new BizException("读取网管课购买协议出错", e);
+        } finally {
+            FileUtils.deleteQuietly(srcFile);
+        }
 
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@Override
-	@Async
-	public boolean transferPracticeCoursesContract(Integer userId, int courseSectionNum, Date startDate, Date endDate, BigDecimal fee) {
-		if(true){
-			 transferProduceContract(userId, null, null);
-			 return true;
-		}
-
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
-
-		if (sysUserTsign == null) {
-			SysUser user = sysUserFeignService.queryUserById(userId);
-			if (user == null) {
-				throw new BizException("用户信息查询失败");
-			}
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-		}
-
-		Date date = new Date();
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/practice/" + userId + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-		params.put("courseSectionNum", courseSectionNum);
-		params.put("startDate", startDate);
-		params.put("endDate", endDate);
-		params.put("fee", fee);
-
-		params.put("isShowVisualSeal", false);
-
-		params.put("ownershipType", "OWN");
-
-		templateEngine.render(params, "practice.ftl", srcFile);
-
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			throw new BizException("生成pdf协议失败", e);
-		}
-		String organCode = "91440300326364429H";
-		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
-		if (organTsign == null) {
-			throw new BizException("甲方未创建签章");
-		}
-
-		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
-
-		if (sysUserTsign != null) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
-
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "practice/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
-
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.PRACTICE);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
-
-		sysUserContractsService.insert(sysUserContracts);
-
-		FileUtils.deleteQuietly(srcFile);
-
-		return true;
-	}
-
-	@Override
-	@Async
-	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
-	public void transferProduceContract(Integer userId,String musicGroupId, CourseViewTypeEnum courseViewType) {
-		SysUser user = studentDao.lockUserReturnInfo(userId);
-
-		if (user == null) {
-			logger.error("用户不存在({})", userId);
-			return;
-		}
-
-		if(StringUtils.isBlank(user.getRealName())||StringUtils.isBlank(user.getIdCardNo())){
-			logger.error("身份信息缺失({})", userId);
-			return;
-		}
-
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
-		if (sysUserTsign == null) {
-			try {
-				sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-			} catch (Exception e) {
-				logger.error("用户电子签章注册失败", e);
-				return;
-			}
-		}
-		Date date = new Date();
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/product/" + dateFormat1.format(date) + "/" + userId + "_" + LocalDateTime.now().getSecond() + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		// 查询参数信息
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-		params.put("studentInfo", studentInfo);
-
-		params.put("isShowVisualSeal", false);
-
-		CourseViewTypeEnum ownershipType = CourseViewTypeEnum.COURSE_FEE;
-
-		if(StringUtils.isBlank(musicGroupId)){
-			params.put("ownershipType", "OWN");
-			MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
-			if(Objects.nonNull(userLastNormalMusicGroup)){
-				ownershipType = userLastNormalMusicGroup.getCourseViewType();
-			}
-		}else{
-			MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-			if (musicGroup == null) {
-				logger.error("乐团信息没找到({})", musicGroupId);
-				return;
-			}
-			params.put("ownershipType", musicGroup.getOwnershipType().name());
-			ownershipType = musicGroup.getCourseViewType();
-		}
-
-		if(Objects.nonNull(courseViewType)){
-			ownershipType = courseViewType;
-		}
-
-		List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, ownershipType.getContractVersion());
-		if(!CollectionUtils.isEmpty(userContracts)){
-			return;
-		}
-
-		templateEngine.render(params, "product"+ownershipType.getContractVersion()+".ftl", srcFile);
-
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			logger.error("生成产品协议失败", e);
-			return;
-		}
-
-
-		String organCode = "";
-		if (OwnershipType.OWN.name().equals(params.get("ownershipType"))){
-			organCode = "91440300326364429H";
-		} else {
-			organCode = "91420106333619290A";
-		}
-		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
-		if (organTsign == null) {
-			logger.error("甲方未创建签章");
-			return;
-		}
-
-		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
-		if (sysUserTsign != null && CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
-
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "product/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
-
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.PRODUCT);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
-		sysUserContracts.setVersion(ownershipType.getContractVersion());
-
-		sysUserContractsService.insert(sysUserContracts);
-
-		FileUtils.deleteQuietly(srcFile);
-	}
-
-	@Override
-	@Transactional(isolation = Isolation.READ_COMMITTED)
-	public Map<String, Object> queryProductContract(Integer userId,String musicGroupId, CourseViewTypeEnum courseViewType) {
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/product/" + userId + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-		if(Objects.isNull(studentInfo)){
-			studentInfo = new StudentInfo();
-		}
-		if(StringUtils.isEmpty(studentInfo.getCertificateType())){
-			studentInfo.setCertificateType(CertificateTypeEnum.IDENTITY.getCode());
-		}
-		params.put("studentInfo", studentInfo);
-		params.put("isShowVisualSeal", true);
-
-		Map<String, Object> result = new HashMap<>();
-		result.put("courseViewType", CourseViewTypeEnum.COURSE_FEE);
-		CourseViewTypeEnum ownershipType = CourseViewTypeEnum.COURSE_FEE;
-
-		if(StringUtils.isBlank(musicGroupId)){
-			params.put("ownershipType", "OWN");
-			MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
-			if(Objects.nonNull(userLastNormalMusicGroup)){
-				result.put("courseViewType", userLastNormalMusicGroup.getCourseViewType());
-				ownershipType = userLastNormalMusicGroup.getCourseViewType();
-			}
-		}else{
-			MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-			if (musicGroup == null) {
-				throw new BizException("乐团信息没找到");
-			}
-			params.put("ownershipType", musicGroup.getOwnershipType().name());
-			result.put("courseViewType", musicGroup.getCourseViewType());
-			ownershipType = musicGroup.getCourseViewType();
-		}
-
-		if(Objects.nonNull(courseViewType)){
-			ownershipType = courseViewType;
-		}
-
-		templateEngine.render(params, "product"+ownershipType.getContractVersion()+".ftl", srcFile);
-
-		String html = "";
-		try {
-			html = FileUtils.readFileToString(srcFile);
-		} catch (IOException e) {
-			throw new BizException("读取产品协议出错", e);
-		} finally {
-			FileUtils.deleteQuietly(srcFile);
-		}
-
-		List<SysUserContracts> userContractWithType = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, ownershipType.getContractVersion());
-
-		result.put("exists", !CollectionUtils.isEmpty(userContractWithType));
-		result.put("productContract", html);
-		return result;
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public HttpResponseResult transferProduceContractOnlyWithCourseList(Integer userId) {
-		SysUser user = studentDao.lockUserReturnInfo(userId);
-		if (user == null) {
-			logger.error("用户不存在({})", userId);
-			return BaseController.failed("用户不存在");
-		}
-
-		int validContactNum = sysUserContractsDao.countUserValidContact(userId);
-		if(validContactNum>0){
-			return BaseController.succeed();
-		}
-
-		if(StringUtils.isBlank(user.getRealName())||StringUtils.isBlank(user.getIdCardNo())){
-			return BaseController.failed(HttpStatus.PARTIAL_CONTENT, user, "");
-		}
-
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
-		if (sysUserTsign == null) {
-			try {
-				sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-			} catch (Exception e) {
-				logger.error("用户电子签章注册失败", e);
-				return BaseController.failed("用户电子签章注册失败");
-			}
-		}
-		Date date = new Date();
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/product/" + dateFormat1.format(date) + "/" + userId + "_" + LocalDateTime.now().getSecond() + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		// 查询参数信息
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-		params.put("studentInfo", studentInfo);
-
-		params.put("isShowVisualSeal", false);
-
-		CourseViewTypeEnum courseViewType = CourseViewTypeEnum.COURSE_FEE;
-		params.put("ownershipType", "OWN");
-
-		List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, 2);
-		if(!CollectionUtils.isEmpty(userContracts)){
-			return BaseController.succeed();
-		}
-
-		templateEngine.render(params, "product2.ftl", srcFile);
-
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			logger.error("生成产品协议失败", e);
-			return BaseController.failed("生成产品协议失败");
-		}
-
-		String organCode = "91440300326364429H";
-
-		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
-		if (organTsign == null) {
-			logger.error("甲方未创建签章");
-			return BaseController.failed("甲方未创建签章");
-		}
-
-		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
-		if (sysUserTsign != null && CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
-
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "product/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
-
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.PRODUCT);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
-		sysUserContracts.setVersion(2);
-
-		sysUserContractsService.insert(sysUserContracts);
-
-		FileUtils.deleteQuietly(srcFile);
-		return BaseController.succeed();
-	}
-
-	@Override
-	public String transferOaFinancial(OAFinancialDto financialDto) {
-		List<Integer> circulationUserIds = financialDto.getCirculationUsers().stream().map(CirculationUser::getUserId).collect(Collectors.toList());
-		List<Integer> executorIds = financialDto.getExecutors().stream().map(CirculationUser::getUserId).collect(Collectors.toList());
-		circulationUserIds.addAll(executorIds);
-		List<SysUser> users = employeeDao.getUsers(circulationUserIds);
-
-		Integer workOrderId = null;
-		List<SysUserTsign> sysUserTsigns = new ArrayList<>();
-		for (SysUser user : users) {
-			for (CirculationUser circulationUser : financialDto.getCirculationUsers()) {
-				if (workOrderId == null) {
-					workOrderId = circulationUser.getWorkOrder();
-				}
-				if (!circulationUser.getUserId().equals(user.getId())) continue;
-				circulationUser.setRealName(user.getRealName());
-			}
-			for (CirculationUser executor : financialDto.getExecutors()) {
-				if (!executor.getUserId().equals(user.getId())) continue;
-				executor.setRealName(user.getRealName());
-			}
-			SysUserTsign sysUserTsign = sysUserTsignService.get(user.getId());
-			if (sysUserTsign == null) {
-				try {
-					sysUserTsign = register(user.getId(), user.getRealName(), user.getIdCardNo(), user.getPhone());
-				} catch (Exception e) {
-					logger.error("用户电子签章注册失败", e);
-					continue;
-				}
-			}
-			sysUserTsigns.add(sysUserTsign);
-		}
-
-		Date date = new Date();
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/oa/" + dateFormat1.format(date) + "/" + workOrderId + "_" + LocalDateTime.now().getSecond() + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		// 查询参数信息
-		params.put("organName", financialDto.getOrganName());
-		params.put("realName", financialDto.getRealName());
-		params.put("feeType", financialDto.getFeeType());
-		params.put("totalMoney", financialDto.getTotalMoney().setScale(2, RoundingMode.HALF_UP));
-		params.put("hasLoan", financialDto.getHasLoan());
-		params.put("memo", financialDto.getMemo());
-		params.put("circulationUsers", financialDto.getCirculationUsers());
-		params.put("executors", financialDto.getExecutors());
-
-		templateEngine.render(params, "financial.ftl", srcFile);
-
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			logger.error("生成签章协议失败", e);
-		}
-
-		for (SysUserTsign sysUserTsign : sysUserTsigns) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), sysUserTsign.getUserId().toString(), srcPdfPath, srcPdfPath);
-		}
-
-		//上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "oa/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
-
-		FileUtils.deleteQuietly(srcFile);
-
-		return pdfFilePath;
-	}
+    @Override
+    @Async
+    public boolean transferPracticeCoursesContract(Integer userId, int courseSectionNum, Date startDate, Date endDate, BigDecimal fee) {
+        if (true) {
+            transferProduceContract(userId, null, null);
+            return true;
+        }
+
+        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
+
+        if (sysUserTsign == null) {
+            SysUser user = sysUserFeignService.queryUserById(userId);
+            if (user == null) {
+                throw new BizException("用户信息查询失败");
+            }
+            sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+        }
+
+        Date date = new Date();
+
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/practice/" + userId + ".pdf";
+
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
+
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("courseSectionNum", courseSectionNum);
+        params.put("startDate", startDate);
+        params.put("endDate", endDate);
+        params.put("fee", fee);
+
+        params.put("isShowVisualSeal", false);
+
+        params.put("ownershipType", "OWN");
+
+        templateEngine.render(params, "practice.ftl", srcFile);
+
+        // 生成借款协议PDF
+        try {
+            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
+        } catch (IOException e) {
+            throw new BizException("生成pdf协议失败", e);
+        }
+        String organCode = "91440300326364429H";
+        SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
+        if (organTsign == null) {
+            throw new BizException("甲方未创建签章");
+        }
+
+        eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
+
+        if (sysUserTsign != null) {
+            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
+        }
+
+        // 上传到oss
+        String dateStrOss = dateFormatOss.format(date);
+        dateStrOss = "practice/" + dateStrOss + "/" + DateUtil.getHour(date);
+        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
+
+        SysUserContracts sysUserContracts = new SysUserContracts();
+        sysUserContracts.setCreateTime(date);
+        sysUserContracts.setType(ContractType.PRACTICE);
+        sysUserContracts.setUrl(pdfFilePath);
+        sysUserContracts.setUserId(userId);
+
+        sysUserContractsService.insert(sysUserContracts);
+
+        FileUtils.deleteQuietly(srcFile);
+
+        return true;
+    }
+
+    @Override
+    @Async
+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
+    public void transferProduceContract(Integer userId, String musicGroupId, CourseViewTypeEnum courseViewType) {
+        SysUser user = studentDao.lockUserReturnInfo(userId);
+
+        if (user == null) {
+            logger.error("用户不存在({})", userId);
+            return;
+        }
+
+        if (StringUtils.isBlank(user.getRealName()) || StringUtils.isBlank(user.getIdCardNo())) {
+            logger.error("身份信息缺失({})", userId);
+            return;
+        }
+
+        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
+        if (sysUserTsign == null) {
+            try {
+                sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+            } catch (Exception e) {
+                logger.error("用户电子签章注册失败", e);
+                return;
+            }
+        }
+        Date date = new Date();
+
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/product/" + dateFormat1.format(date) + "/" + userId + "_" + LocalDateTime.now().getSecond() + ".pdf";
+
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
+
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+
+        Map<String, Object> params = new HashMap<String, Object>();
+
+        // 查询参数信息
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        params.put("studentInfo", studentInfo);
+
+        params.put("isShowVisualSeal", false);
+
+        CourseViewTypeEnum ownershipType = CourseViewTypeEnum.COURSE_FEE;
+
+        if (StringUtils.isBlank(musicGroupId)) {
+            params.put("ownershipType", "OWN");
+            MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
+            if (Objects.nonNull(userLastNormalMusicGroup)) {
+                ownershipType = userLastNormalMusicGroup.getCourseViewType();
+            }
+        } else {
+            MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+            if (musicGroup == null) {
+                logger.error("乐团信息没找到({})", musicGroupId);
+                return;
+            }
+            params.put("ownershipType", musicGroup.getOwnershipType().name());
+            ownershipType = musicGroup.getCourseViewType();
+        }
+
+        if (Objects.nonNull(courseViewType)) {
+            ownershipType = courseViewType;
+        }
+
+        List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, ownershipType.getContractVersion());
+        if (!CollectionUtils.isEmpty(userContracts)) {
+            return;
+        }
+
+        templateEngine.render(params, "product" + ownershipType.getContractVersion() + ".ftl", srcFile);
+
+        // 生成借款协议PDF
+        try {
+            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
+        } catch (IOException e) {
+            logger.error("生成产品协议失败", e);
+            return;
+        }
+
+
+        String organCode = "";
+        if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
+            organCode = "91440300326364429H";
+        } else {
+            organCode = "91420106333619290A";
+        }
+        SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
+        if (organTsign == null) {
+            logger.error("甲方未创建签章");
+            return;
+        }
+
+        eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
+        if (sysUserTsign != null && CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
+            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
+        }
+
+        // 上传到oss
+        String dateStrOss = dateFormatOss.format(date);
+        dateStrOss = "product/" + dateStrOss + "/" + DateUtil.getHour(date);
+        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
+
+        SysUserContracts sysUserContracts = new SysUserContracts();
+        sysUserContracts.setCreateTime(date);
+        sysUserContracts.setType(ContractType.PRODUCT);
+        sysUserContracts.setUrl(pdfFilePath);
+        sysUserContracts.setUserId(userId);
+        sysUserContracts.setVersion(ownershipType.getContractVersion());
+
+        sysUserContractsService.insert(sysUserContracts);
+
+        FileUtils.deleteQuietly(srcFile);
+    }
+
+    @Override
+    @Transactional(isolation = Isolation.READ_COMMITTED)
+    public Map<String, Object> queryProductContract(Integer userId, String musicGroupId, CourseViewTypeEnum courseViewType) {
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/product/" + userId + ".pdf";
+
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
+
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+
+        Map<String, Object> params = new HashMap<String, Object>();
+
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        if (Objects.isNull(studentInfo)) {
+            studentInfo = new StudentInfo();
+        }
+        if (StringUtils.isEmpty(studentInfo.getCertificateType())) {
+            studentInfo.setCertificateType(CertificateTypeEnum.IDENTITY.getCode());
+        }
+        params.put("studentInfo", studentInfo);
+        params.put("isShowVisualSeal", true);
+
+        Map<String, Object> result = new HashMap<>();
+        result.put("courseViewType", CourseViewTypeEnum.COURSE_FEE);
+        CourseViewTypeEnum ownershipType = CourseViewTypeEnum.COURSE_FEE;
+
+        if (StringUtils.isBlank(musicGroupId)) {
+            params.put("ownershipType", "OWN");
+            MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
+            if (Objects.nonNull(userLastNormalMusicGroup)) {
+                result.put("courseViewType", userLastNormalMusicGroup.getCourseViewType());
+                ownershipType = userLastNormalMusicGroup.getCourseViewType();
+            }
+        } else {
+            MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+            if (musicGroup == null) {
+                throw new BizException("乐团信息没找到");
+            }
+            params.put("ownershipType", musicGroup.getOwnershipType().name());
+            result.put("courseViewType", musicGroup.getCourseViewType());
+            ownershipType = musicGroup.getCourseViewType();
+        }
+
+        if (Objects.nonNull(courseViewType)) {
+            ownershipType = courseViewType;
+        }
+
+        templateEngine.render(params, "product" + ownershipType.getContractVersion() + ".ftl", srcFile);
+
+        String html = "";
+        try {
+            html = FileUtils.readFileToString(srcFile);
+        } catch (IOException e) {
+            throw new BizException("读取产品协议出错", e);
+        } finally {
+            FileUtils.deleteQuietly(srcFile);
+        }
+
+        List<SysUserContracts> userContractWithType = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, ownershipType.getContractVersion());
+
+        result.put("exists", !CollectionUtils.isEmpty(userContractWithType));
+        result.put("productContract", html);
+        return result;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public HttpResponseResult transferProduceContractOnlyWithCourseList(Integer userId) {
+        SysUser user = studentDao.lockUserReturnInfo(userId);
+        if (user == null) {
+            logger.error("用户不存在({})", userId);
+            return BaseController.failed("用户不存在");
+        }
+
+        int validContactNum = sysUserContractsDao.countUserValidContact(userId);
+        if (validContactNum > 0) {
+            return BaseController.succeed();
+        }
+
+        if (StringUtils.isBlank(user.getRealName()) || StringUtils.isBlank(user.getIdCardNo())) {
+            return BaseController.failed(HttpStatus.PARTIAL_CONTENT, user, "");
+        }
+
+        SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
+        if (sysUserTsign == null) {
+            try {
+                sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+            } catch (Exception e) {
+                logger.error("用户电子签章注册失败", e);
+                return BaseController.failed("用户电子签章注册失败");
+            }
+        }
+        Date date = new Date();
+
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/product/" + dateFormat1.format(date) + "/" + userId + "_" + LocalDateTime.now().getSecond() + ".pdf";
+
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
+
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+
+        Map<String, Object> params = new HashMap<String, Object>();
+
+        // 查询参数信息
+        StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
+        params.put("studentInfo", studentInfo);
+
+        params.put("isShowVisualSeal", false);
+
+        CourseViewTypeEnum courseViewType = CourseViewTypeEnum.COURSE_FEE;
+        params.put("ownershipType", "OWN");
+
+        List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, 2);
+        if (!CollectionUtils.isEmpty(userContracts)) {
+            return BaseController.succeed();
+        }
+
+        templateEngine.render(params, "product2.ftl", srcFile);
+
+        // 生成借款协议PDF
+        try {
+            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
+        } catch (IOException e) {
+            logger.error("生成产品协议失败", e);
+            return BaseController.failed("生成产品协议失败");
+        }
+
+        String organCode = "91440300326364429H";
+
+        SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
+        if (organTsign == null) {
+            logger.error("甲方未创建签章");
+            return BaseController.failed("甲方未创建签章");
+        }
+
+        eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
+        if (sysUserTsign != null && CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
+            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
+        }
+
+        // 上传到oss
+        String dateStrOss = dateFormatOss.format(date);
+        dateStrOss = "product/" + dateStrOss + "/" + DateUtil.getHour(date);
+        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
+
+        SysUserContracts sysUserContracts = new SysUserContracts();
+        sysUserContracts.setCreateTime(date);
+        sysUserContracts.setType(ContractType.PRODUCT);
+        sysUserContracts.setUrl(pdfFilePath);
+        sysUserContracts.setUserId(userId);
+        sysUserContracts.setVersion(2);
+
+        sysUserContractsService.insert(sysUserContracts);
+
+        FileUtils.deleteQuietly(srcFile);
+        return BaseController.succeed();
+    }
+
+    @Override
+    public String transferOaFinancial(OAFinancialDto financialDto) {
+        List<Integer> circulationUserIds = financialDto.getCirculationUsers().stream().map(CirculationUser::getUserId).collect(Collectors.toList());
+        List<Integer> executorIds = financialDto.getExecutors().stream().map(CirculationUser::getUserId).collect(Collectors.toList());
+        circulationUserIds.addAll(executorIds);
+        List<SysUser> users = employeeDao.getUsers(circulationUserIds);
+
+        Integer workOrderId = null;
+        List<SysUserTsign> sysUserTsigns = new ArrayList<>();
+        for (SysUser user : users) {
+            for (CirculationUser circulationUser : financialDto.getCirculationUsers()) {
+                if (workOrderId == null) {
+                    workOrderId = circulationUser.getWorkOrder();
+                }
+                if (!circulationUser.getUserId().equals(user.getId())) continue;
+                circulationUser.setRealName(user.getRealName());
+            }
+            for (CirculationUser executor : financialDto.getExecutors()) {
+                if (!executor.getUserId().equals(user.getId())) continue;
+                executor.setRealName(user.getRealName());
+            }
+            SysUserTsign sysUserTsign = sysUserTsignService.get(user.getId());
+            if (sysUserTsign == null) {
+                try {
+                    sysUserTsign = register(user.getId(), user.getRealName(), user.getIdCardNo(), user.getPhone());
+                } catch (Exception e) {
+                    logger.error("用户电子签章注册失败", e);
+                    continue;
+                }
+            }
+            sysUserTsigns.add(sysUserTsign);
+        }
+
+        Date date = new Date();
+
+        // 合成freemarker
+        String srcPdfPath = contractBaseDir + "/oa/" + dateFormat1.format(date) + "/" + workOrderId + "_" + LocalDateTime.now().getSecond() + ".pdf";
+
+        File srcFile = new File(srcPdfPath);
+
+        File debtFile = new File(srcFile.getParent());
+        if (!debtFile.exists()) {
+            debtFile.mkdirs();
+        }
+
+        FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
+        templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
+
+        Map<String, Object> params = new HashMap<String, Object>();
+
+        // 查询参数信息
+        params.put("organName", financialDto.getOrganName());
+        params.put("realName", financialDto.getRealName());
+        params.put("feeType", financialDto.getFeeType());
+        params.put("totalMoney", financialDto.getTotalMoney().setScale(2, RoundingMode.HALF_UP));
+        params.put("hasLoan", financialDto.getHasLoan());
+        params.put("memo", financialDto.getMemo());
+        params.put("circulationUsers", financialDto.getCirculationUsers());
+        params.put("executors", financialDto.getExecutors());
+
+        templateEngine.render(params, "financial.ftl", srcFile);
+
+        // 生成借款协议PDF
+        try {
+            PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
+        } catch (IOException e) {
+            logger.error("生成签章协议失败", e);
+        }
+
+        for (SysUserTsign sysUserTsign : sysUserTsigns) {
+            eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), sysUserTsign.getUserId().toString(), srcPdfPath, srcPdfPath);
+        }
+
+        //上传到oss
+        String dateStrOss = dateFormatOss.format(date);
+        dateStrOss = "oa/" + dateStrOss + "/" + DateUtil.getHour(date);
+        String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
+
+        FileUtils.deleteQuietly(srcFile);
+
+        return pdfFilePath;
+    }
 }
 }

+ 17 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -23,6 +23,7 @@ import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.codehaus.jackson.map.util.BeanUtil;
 import org.codehaus.jackson.map.util.BeanUtil;
@@ -241,7 +242,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			attendanceRange = Integer.parseInt(gpsRange);
 			attendanceRange = Integer.parseInt(gpsRange);
 		}
 		}
 		currentCourseDetail.setAttendanceRange(attendanceRange);
 		currentCourseDetail.setAttendanceRange(attendanceRange);
-        currentCourseDetail.setAdvanceSignOutMinutes(Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_OUT_MINUTES)));
+		String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ADVANCE_SIGN_OUT_MINUTES, user.getTenantId());
+		if(StringUtils.isEmpty(configValue)){
+			configValue = "360";
+		}
+		currentCourseDetail.setAdvanceSignOutMinutes(Integer.parseInt(configValue));
 		CourseSchedule courseSchedule = courseScheduleDao.get(courseID);
 		CourseSchedule courseSchedule = courseScheduleDao.get(courseID);
 		//获取课程规划
 		//获取课程规划
 		MusicGroupTrainPlanSaveDto schoolTerm = musicGroupTrainPlanService.getSchoolTerm(courseSchedule);
 		MusicGroupTrainPlanSaveDto schoolTerm = musicGroupTrainPlanService.getSchoolTerm(courseSchedule);
@@ -4940,18 +4945,17 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         PageInfo<CourseScheduleEndDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         PageInfo<CourseScheduleEndDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         Map<String, Object> params = new HashMap<>(16);
         Map<String, Object> params = new HashMap<>(16);
         MapUtil.populateMap(params, queryInfo);
         MapUtil.populateMap(params, queryInfo);
+		Integer tenantId = TenantContextHolder.getTenantId();
+		if("COURSE_TIME_ERROR".equals(queryInfo.getSearchType())){
+			String courseStartTimeError = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_START_TIME_ERROR, tenantId);
+			String courseEndTimeError = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_END_TIME_ERROR, tenantId);
+			if(StringUtils.isEmpty(courseStartTimeError) || StringUtils.isEmpty(courseEndTimeError)){
+				return pageInfo;
+			}
+			params.put("courseStartTimeError",courseStartTimeError);
+			params.put("courseEndTimeError",courseEndTimeError);
+		}
 
 
-//        List<CourseScheduleEndDto> results;
-//		SysUser sysUser = sysUserFeignService.queryUserInfo();
-//		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
-		//如果当前用户只有教务老师角色,那么只能看到他所管理的课程组的信息
-//		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
-//			List<Long> classGroupIds = classGroupDao.queryGroupClassGroupIds(sysUser.getId());
-//			if(classGroupIds.size() == 0){
-//				return pageInfo;
-//			}
-//			params.put("classGroupIds",classGroupIds);
-//		}
         int count = courseScheduleDao.endCountCourseSchedules(params);
         int count = courseScheduleDao.endCountCourseSchedules(params);
         if(queryInfo.getIsExport() && count > 50000){
         if(queryInfo.getIsExport() && count > 50000){
             throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
             throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
@@ -4964,7 +4968,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             List<Integer> teacherIds=results.stream().filter(t->Objects.nonNull(t.getActualTeacherId())).map(CourseSchedule::getActualTeacherId).collect(Collectors.toList());
             List<Integer> teacherIds=results.stream().filter(t->Objects.nonNull(t.getActualTeacherId())).map(CourseSchedule::getActualTeacherId).collect(Collectors.toList());
 
 
             List<Map<Integer, String>> nameIdMaps = teacherDao.queryNameByIdList(teacherIds);
             List<Map<Integer, String>> nameIdMaps = teacherDao.queryNameByIdList(teacherIds);
-            Map<Integer, String> nameIdMap=MapUtil.convertIntegerMap(nameIdMaps);
+            Map<Integer, String> nameIdMap = MapUtil.convertIntegerMap(nameIdMaps);
 
 
 			List<Map<Long, Long>> courseMergeCourseNum = courseScheduleDao.countCourseMergeCourseNum(courseScheduleIds);
 			List<Map<Long, Long>> courseMergeCourseNum = courseScheduleDao.countCourseMergeCourseNum(courseScheduleIds);
 			Map<Long, Long> courseMergeCourseNumMap = new HashMap<>();
 			Map<Long, Long> courseMergeCourseNumMap = new HashMap<>();

+ 37 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -1,36 +1,24 @@
 package com.ym.mec.biz.service.impl;
 package com.ym.mec.biz.service.impl;
 
 
-import java.util.*;
-import java.util.stream.Collectors;
-
-import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.service.ImUserFriendService;
-import com.ym.mec.biz.service.OaUserService;
-import com.ym.mec.im.entity.GroupMember;
-import com.ym.mec.im.entity.GroupModel;
-import com.ym.mec.oa.entity.OAUser;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysRole;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.YesOrNoEnum;
 import com.ym.mec.auth.api.enums.YesOrNoEnum;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.EmployeeDto;
 import com.ym.mec.biz.dal.dto.EmployeeDto;
 import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
 import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.Employee;
 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.SysUserCashAccount;
 import com.ym.mec.biz.dal.enums.EmployeeOperateEnum;
 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.enums.ParamEnum;
 import com.ym.mec.biz.dal.page.EmployeeQueryInfo;
 import com.ym.mec.biz.dal.page.EmployeeQueryInfo;
 import com.ym.mec.biz.service.EmployeeService;
 import com.ym.mec.biz.service.EmployeeService;
 import com.ym.mec.biz.service.ImGroupMemberService;
 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.common.dal.BaseDAO;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImResult;
@@ -39,9 +27,19 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.im.ImFeignService;
+import com.ym.mec.im.entity.GroupMember;
+import com.ym.mec.im.entity.GroupModel;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.collection.MapUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
 
 
+import java.util.*;
+import java.util.stream.Collectors;
+
 @Service
 @Service
 public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  implements EmployeeService {
 public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  implements EmployeeService {
 
 
@@ -405,4 +403,25 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 	public List<Integer> queryUserRole(Integer sysUserId) {
 	public List<Integer> queryUserRole(Integer sysUserId) {
 		return employeeDao.queryUserRole(sysUserId);
 		return employeeDao.queryUserRole(sysUserId);
 	}
 	}
+
+    /**
+     * 批量添加角色和菜单关系
+     *
+     * @param roleId  角色id
+     * @param menuIds 菜单集合
+     */
+    @Override
+    public int batchInsertRoleMenu(Integer roleId, List<Integer> menuIds) {
+        return employeeDao.batchInsertRoleMenu(roleId, menuIds);
+    }
+
+    /**
+     * 添加角色信息
+     *
+     * @param sysRole
+     */
+    @Override
+    public int insertSysRole(SysRole sysRole) {
+        return employeeDao.insertSysRole(sysRole);
+    }
 }
 }

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

@@ -539,6 +539,381 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	}
 	}
 
 
 	@Override
 	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public String create1(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
+
+		String musicGroupId = musicGroupPaymentCalenderDto.getMusicGroupId();
+
+		PaymentType paymentType = musicGroupPaymentCalenderDto.getPaymentType();
+
+		PayUserType payUserType = musicGroupPaymentCalenderDto.getPayUserType();
+
+		List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
+		if(musicGroupPaymentDateRangeList.size() > 1){
+			throw new BizException("暂不支持多周期缴费");
+		}
+		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
+		if (musicGroup == null) {
+			throw new BizException("乐团查询失败,请检查参数");
+		}
+		if (paymentType == PaymentType.ADD_STUDENT) {
+			//获取缴费状态在审核中或者已拒绝的缴费项目的学员
+			Integer userId = Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds());
+			if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+				//该学员是否在其他的会员团
+				boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroupId,userId);
+				if(hasMemberGroup){
+					throw new BizException("操作失败:学员已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
+				}
+			}
+
+			String studentIds = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroupId,null);
+			if(StringUtils.isNotEmpty(studentIds)){
+				if(studentIds.contains(userId.toString())){
+					throw new BizException("创建缴费失败:所选学员有待审核或已拒绝的缴费项目");
+				}
+			}
+			List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
+			if(musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0){
+				throw new BizException("创建缴费失败:已存在缴费项目");
+			}
+		}
+
+		if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
+			throw new BizException("创建缴费失败:已存在缴费项目");
+		}
+
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			throw new BizException("请登录");
+		}
+		if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE && musicGroupPaymentDateRangeList.size() > 1) {
+			throw new BizException("创建缴费失败:会员收费乐团不支持多周期缴费");
+		}
+		//是否自动创建
+		if(!musicGroupPaymentCalenderDto.getAutoCreate()){
+			// 所有缴费项目已完成排课才能创建下一个缴费项目
+			String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null,musicGroupPaymentCalenderDto.getIgnoreBatchNoList());
+			if (StringUtils.isNoneBlank(orignBatchNo)) {
+				if(StringUtils.isEmpty(musicGroupPaymentCalenderDto.getBatchNo()) || !musicGroupPaymentCalenderDto.getBatchNo().equals(orignBatchNo)){
+					throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
+				}
+			}
+		}
+
+		// 不是进行中,只能创建一次缴费
+		if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
+			List<MusicGroupPaymentCalender> list = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
+			if (list.size() > 0) {
+				throw new BizException("创建失败,已经存在缴费信息");
+			}
+		}
+
+		PaymentCalenderStatusEnum status = PaymentCalenderStatusEnum.NO;
+
+		Date date = new Date();
+		String batchNo = idGeneratorService.generatorId() + "";
+
+		// 获取设置的课程收费标准
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderDto
+				.getMusicGroupPaymentCalenderCourseSettingsList();
+
+		//会员原价
+		BigDecimal memberPaymentAmount = BigDecimal.ZERO;
+		BigDecimal originalMemberPaymentAmount = BigDecimal.ZERO;
+		if (payUserType == SCHOOL) {
+			status = AUDITING;
+		} else {
+			if(musicGroupPaymentCalenderCourseSettingsList != null){
+				if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
+					// 当前缴费的课程费用
+					Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
+							Collectors
+									.toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
+
+					// 查询默认课程费用
+					Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
+					Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
+							.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
+							.stream()
+							.collect(
+									Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
+											MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
+
+					// 相同类型的课程如果修改了课程费用,需要走审批
+					for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
+						if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
+							status = AUDITING;
+							break;
+						}
+					}
+				} else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
+					PaymentCalenderStatusEnum dtoStatus = musicGroupPaymentCalenderDto.getStatus();
+					if(dtoStatus != null && dtoStatus == AUDITING){
+						status = AUDITING;
+					}else {
+						// 如果是课程收费,判断是否审核
+						for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
+							OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
+									musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
+							if (defaultUnitPrice == null) {
+								throw new BizException("请先设置分部课程类型单价");
+							}
+							if (courseSettings.getCourseTotalMinuties() != 0) {
+
+								if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
+										.compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
+
+									status = AUDITING;
+									break;
+								}
+							} else {
+								status = AUDITING;
+								break;
+							}
+						}
+					}
+				}else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
+					status = musicGroupPaymentCalenderDto.getStatus();
+				}
+			}
+			if(musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
+				//会员价格是否变动
+				MemberFeeSetting memberFee = memberFeeSettingDao.findByRankIdAndOrganId(musicGroup.getOrganId(), musicGroupPaymentCalenderDto.getMemberRankSettingId());
+				if(memberFee == null){
+					throw new BizException("操作失败:请配置当前分部会员收费标准");
+				}
+				switch (musicGroupPaymentCalenderDto.getMemberValidDate()){
+					case 1 :
+						memberPaymentAmount = memberFee.getGroupPurchaseMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
+						originalMemberPaymentAmount = memberFee.getOriginalMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
+						break;
+					case 6 :
+						memberPaymentAmount = memberFee.getGroupPurchaseHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
+						originalMemberPaymentAmount = memberFee.getOriginalHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
+						break;
+					case 12 :
+						memberPaymentAmount = memberFee.getGroupPurchaseYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
+						originalMemberPaymentAmount = memberFee.getOriginalYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
+						break;
+					default:
+						throw new BizException("请选择正确的会员有效期");
+				}
+				if(memberPaymentAmount.compareTo(musicGroupPaymentCalenderDto.getMemberPaymentAmount()) != 0){
+					status = AUDITING;
+				}
+			}
+		}
+
+		int times = musicGroupPaymentDateRangeList.size();
+
+		// 排序
+		Collections.sort(musicGroupPaymentDateRangeList, new Comparator<MusicGroupPaymentDateRange>() {
+
+			@Override
+			public int compare(MusicGroupPaymentDateRange o1, MusicGroupPaymentDateRange o2) {
+				return o1.getPaymentValidStartDate().compareTo(o2.getPaymentValidStartDate());
+			}
+		});
+
+		for (int i = 0; i < musicGroupPaymentDateRangeList.size(); i++) {
+
+			MusicGroupPaymentDateRange musicGroupPaymentDateRange = musicGroupPaymentDateRangeList.get(i);
+
+			MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
+			musicGroupPaymentCalender.setAttribute1(musicGroupPaymentCalenderDto.getAttribute1());
+			musicGroupPaymentCalender.setOriginalMemberPaymentAmount(originalMemberPaymentAmount);
+			musicGroupPaymentCalender.setAttribute2(musicGroupPaymentCalenderDto.getAttribute2());
+			musicGroupPaymentCalender.setDeadlinePaymentDate(musicGroupPaymentDateRange.getDeadlinePaymentDate());
+			musicGroupPaymentCalender.setIsGiveMusicNetwork(musicGroupPaymentCalenderDto.getIsGiveMusicNetwork());
+			musicGroupPaymentCalender.setMemo(musicGroupPaymentCalenderDto.getMemo());
+			musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
+			musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId());
+
+			BigDecimal totalPaymentAmount = musicGroupPaymentCalenderDto.getMasterTotalPrice();
+			if(musicGroupPaymentCalenderCourseSettingsList != null){
+				List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
+						musicGroupPaymentCalenderCourseSettingsList.size());
+				for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
+
+					MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
+					try {
+						BeanUtils.copyProperties(tempPccs, pccs);
+					} catch (Exception e) {
+						throw new BizException("克隆对象出错", e);
+					}
+					if (i == 0) {
+						if (pccs.getIsStudentOptional()) {
+							tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice());
+							tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice());
+							tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties());
+						} else {
+							tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
+									pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
+											.setScale(0, BigDecimal.ROUND_DOWN)));
+							tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
+									pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
+											.setScale(0, BigDecimal.ROUND_DOWN)));
+							tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
+						}
+					} else {
+						if (!pccs.getIsStudentOptional()) {
+							tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
+							tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
+							tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
+						} else {
+							continue;
+						}
+					}
+					totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
+					newCSList.add(tempPccs);
+				}
+				musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
+			}
+			musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
+			musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
+			musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
+			musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
+
+			if (paymentType == PaymentType.MUSIC_APPLY) {
+				if (i == 0) {
+					musicGroupPaymentCalender.setPaymentType(paymentType);
+				} else {
+					musicGroupPaymentCalender.setPaymentType(PaymentType.MUSIC_RENEW);
+				}
+			} else {
+				musicGroupPaymentCalender.setPaymentType(paymentType);
+			}
+			musicGroupPaymentCalender.setPayUserType(musicGroupPaymentCalenderDto.getPayUserType());
+			musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentDateRange.getStartPaymentDate());
+			musicGroupPaymentCalender.setStudentIds(musicGroupPaymentCalenderDto.getStudentIds());
+			musicGroupPaymentCalender.setOperator(sysUser.getId());
+			musicGroupPaymentCalender.setCreateTime(date);
+			musicGroupPaymentCalender.setUpdateTime(date);
+			musicGroupPaymentCalender.setStatus(status);
+
+			//缴费截止日期默认三天后
+			if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
+				musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
+			}
+			//校验缴费有效期冲突
+			if (paymentType != ADD_STUDENT && paymentType != ADD_COURSE && paymentType != SPAN_GROUP_CLASS_ADJUST) {
+				if(musicGroupPaymentCalender.getPaymentValidStartDate() != null){
+					int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPayUserType(),
+							musicGroupPaymentCalender.getPaymentValidStartDate(), musicGroupPaymentCalender.getPaymentValidEndDate(), null);
+					if (count > 0) {
+						throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
+					}
+				}
+			}
+
+			if (paymentType == PaymentType.ADD_STUDENT) {
+				musicGroupPaymentCalender.setPayUserType(STUDENT);
+				musicGroupPaymentCalender.setIsGiveMusicNetwork(false);
+				if (musicGroupPaymentCalender.getStatus() != AUDITING) {
+					musicGroupPaymentCalender.setExpectNum(1);
+				}
+			}
+			if (musicGroupPaymentCalender.getStatus() != AUDITING) {
+				if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
+					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
+				} else if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
+					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
+				} else {
+					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
+				}
+			}
+
+			// 设置批次号
+			musicGroupPaymentCalender.setBatchNo(batchNo);
+			//设置会员缴费金额、级别以及有效期
+			musicGroupPaymentCalender.setMemberPaymentAmount(musicGroupPaymentCalenderDto.getMemberPaymentAmount());
+			musicGroupPaymentCalender.setMemberRankSettingId(musicGroupPaymentCalenderDto.getMemberRankSettingId());
+			musicGroupPaymentCalender.setMemberValidDate(musicGroupPaymentCalenderDto.getMemberValidDate());
+			musicGroupPaymentCalenderDto.setBatchNo(batchNo);
+			musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
+
+			//课程费用列表
+			List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
+					.getMusicGroupPaymentCalenderCourseSettingsList();
+
+			if (currentMusicGroupPaymentCalenderCourseSettings != null && currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
+				MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsDao.get(musicGroupPaymentCalender
+						.getMusicGroupOrganizationCourseSettingId());
+				for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : currentMusicGroupPaymentCalenderCourseSettings) {
+					musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+					if (courseSettings != null) {
+						musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
+					}
+				}
+				musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
+			}
+
+			//如果是跨团班级合并,保存用户缴费详情
+			List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = null;
+			if (musicGroupPaymentCalender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
+				musicGroupPaymentCalenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
+				//记录学员缴费详情
+				musicGroupPaymentCalenderStudentDetailDao.batchInsert(musicGroupPaymentCalenderStudentDetails,musicGroupPaymentCalender.getBatchNo());
+			}
+
+			if (musicGroupPaymentCalender.getStatus() != AUDITING) {
+				// 如果是进行中加学生
+				if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
+					addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings,musicGroup);
+				}else if(musicGroupPaymentCalender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
+					//如果是跨团班级合并,添加学员
+					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender,musicGroupPaymentCalenderStudentDetails);
+				}else if(musicGroupPaymentCalenderDto.getMergeClassFlag()){
+					//缴费项目添加学员
+					int[] ints = Arrays.stream(musicGroupPaymentCalenderDto.getStudentIds().split(",")).mapToInt(Integer::parseInt).toArray();
+					Set<Integer> list2 = Arrays.stream(ints).boxed().collect(Collectors.toSet());
+					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender.getId(),list2,musicGroup,false);
+				}
+				//将0元未缴费学员缴费状态更新为已缴费
+				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
+				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
+				musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+			}
+		}
+
+		// 如果是报名,需要修改乐团状态
+		if (paymentType == MUSIC_APPLY) {
+			if (status != AUDITING) {
+				musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
+				// 记录操作日志
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费 -> 报名中)", sysUser.getId(), ""));
+			} else {
+				musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
+				// 记录操作日志
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费 -> 费用审核中)", sysUser.getId(), ""));
+			}
+			musicGroup.setUpdateTime(date);
+			musicGroupDao.update(musicGroup);
+		} else if (paymentType == ADD_STUDENT) {
+			if (status != AUDITING) {
+				// 学生加到班级
+				String classGroupIdStr = musicGroupPaymentCalenderDto.getAttribute1();
+				classGroupService.addStudentToClassGroupAndCourseArranging(Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds()), classGroupIdStr,
+						batchNo, musicGroupPaymentCalenderCourseSettingsList,musicGroup);
+			}
+		}
+
+		if (status == AUDITING) {
+			// 如果是审核中
+			Set<Integer> roleIds = new HashSet<>(1);
+			roleIds.add(SysUserRole.SECTION_MANAGER);
+			Organization organization = organizationDao.get(musicGroup.getOrganId());
+			sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()),
+					MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, "", organization.getName(), musicGroup.getName());
+		}else {
+			imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
+		}
+
+		return batchNo;
+	}
+
+	@Override
 	public Object getDetail(Long id) {
 	public Object getDetail(Long id) {
 		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
 		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
 		Map<Long, Long> expectNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countExpectNum(id));
 		Map<Long, Long> expectNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countExpectNum(id));

+ 8 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSchoolTermCourseDetailServiceImpl.java

@@ -12,6 +12,7 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -332,7 +333,13 @@ public class MusicGroupSchoolTermCourseDetailServiceImpl extends BaseServiceImpl
 		int week = DateUtil.date2Week1(startCourseDate);
 		int week = DateUtil.date2Week1(startCourseDate);
 		int weekSize = DateUtil.getWeekDays(startCourseDate, courseDetail.getEndSchoolTerm(), week).size();
 		int weekSize = DateUtil.getWeekDays(startCourseDate, courseDetail.getEndSchoolTerm(), week).size();
 		int i = weekSize * 4 * 45;
 		int i = weekSize * 4 * 45;
-		courseDetail.setTotalCourseTime(i > 3960?3960:i);
+		Integer tenantId = TenantContextHolder.getTenantId();
+		String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.MEMBER_GROUP_TERM_GIVE_COURSE_TIME,tenantId);
+		if(StringUtils.isEmpty(configValue)){
+			throw new BizException("请配置会员团每学期赠送课程分钟数");
+		}
+		Integer giveCourseTime = Integer.parseInt(configValue);
+		courseDetail.setTotalCourseTime(i > giveCourseTime?giveCourseTime:i);
 		courseDetail.setStartCourseDate(startCourseDate);
 		courseDetail.setStartCourseDate(startCourseDate);
 		return courseDetail;
 		return courseDetail;
 	}
 	}

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

@@ -120,6 +120,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         if(StringUtils.isEmpty(configValue)){
         if(StringUtils.isEmpty(configValue)){
             throw new BizException("请配置会员团每学期赠送课程分钟数");
             throw new BizException("请配置会员团每学期赠送课程分钟数");
         }
         }
+        Integer giveCourseTime = Integer.parseInt(configValue)>>1;
 
 
         //课程形态
         //课程形态
         Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
         Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
@@ -182,12 +183,12 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 			OrganizationCourseUnitPriceSettings singleUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.SINGLE, musicGroup.getChargeTypeId());
 			OrganizationCourseUnitPriceSettings singleUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.SINGLE, musicGroup.getChargeTypeId());
 			if (singleUnitPriceSettings != null) {
 			if (singleUnitPriceSettings != null) {
 				memberCoursePrice.put(CourseScheduleType.SINGLE.name(),
 				memberCoursePrice.put(CourseScheduleType.SINGLE.name(),
-						singleUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(configValue)).setScale(0, BigDecimal.ROUND_HALF_UP));
+						singleUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(giveCourseTime)).setScale(0, BigDecimal.ROUND_HALF_UP));
 			}
 			}
 			OrganizationCourseUnitPriceSettings mixUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.MIX, musicGroup.getChargeTypeId());
 			OrganizationCourseUnitPriceSettings mixUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.MIX, musicGroup.getChargeTypeId());
 			if (mixUnitPriceSettings != null) {
 			if (mixUnitPriceSettings != null) {
 				memberCoursePrice.put(CourseScheduleType.MIX.name(),
 				memberCoursePrice.put(CourseScheduleType.MIX.name(),
-						mixUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(configValue)).setScale(0, BigDecimal.ROUND_HALF_UP));
+						mixUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(giveCourseTime)).setScale(0, BigDecimal.ROUND_HALF_UP));
 			}
 			}
 			
 			
 			musicGroupSubjectGoodsAndInfo.setMemberCoursePrice(memberCoursePrice);
 			musicGroupSubjectGoodsAndInfo.setMemberCoursePrice(memberCoursePrice);

+ 51 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java

@@ -3,13 +3,18 @@ package com.ym.mec.biz.service.impl;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
+import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dto.MapDto;
 import com.ym.mec.biz.dal.enums.FivePlusGradeEnum;
 import com.ym.mec.biz.dal.enums.FivePlusGradeEnum;
 import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import com.ym.mec.biz.dal.enums.SixPlusGradeEnum;
 import com.ym.mec.biz.dal.enums.SixPlusGradeEnum;
+import com.ym.mec.common.entity.Mapper;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.util.collection.MapUtil;
+import com.ym.mec.util.json.JsonUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -121,6 +126,52 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 		return organizationDao.insert(initOrganization(organization));
 		return organizationDao.insert(initOrganization(organization));
 	}
 	}
 
 
+	@Override
+	public Map<String,List<Mapper>> getOrganRole(Integer id) {
+		Organization organization = organizationDao.get(id);
+		if(organization == null){
+			throw new BizException("分部信息不存在");
+		}
+		String organManager = organization.getOrganManager();
+		String repairId = organization.getRepairId();
+		String educationId = organization.getEducationId();
+		String joinTeacherId = organization.getJoinTeacherId();
+		String organManagerUserIds = concatOrganManager(organManager, repairId, educationId, joinTeacherId);
+		Map<String,List<Mapper>> resultMap = new HashMap<>(4);
+		if(StringUtils.isNotEmpty(organManagerUserIds) && organManagerUserIds.length() > 0){
+			Map<Integer, String> educationalTeacherNameMap = MapUtil.convertMybatisMap(teacherDao.queryNameByIds(organManagerUserIds));
+			resultMap.put("organManager",getOrganManagerName(educationalTeacherNameMap,organManager));
+			resultMap.put("repairId",getOrganManagerName(educationalTeacherNameMap,repairId));
+			resultMap.put("educationId",getOrganManagerName(educationalTeacherNameMap,educationId));
+			resultMap.put("joinTeacherId",getOrganManagerName(educationalTeacherNameMap,joinTeacherId));
+		}
+		return resultMap;
+	}
+
+	private List<Mapper> getOrganManagerName(Map<Integer, String> nameMap, String organManager){
+		List<Mapper> mapperList = new ArrayList<>();
+		if(StringUtils.isNotEmpty(organManager)){
+			List<Integer> organIds = Arrays.stream(organManager.split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
+			for (Integer organId : organIds) {
+				mapperList.add(new Mapper(organId,nameMap.get(organId)));
+			}
+		}
+		return mapperList;
+	}
+
+	private String concatOrganManager(String... userIds){
+		StringBuffer sb = new StringBuffer();
+		for (String userId : userIds) {
+			if(StringUtils.isNotEmpty(userId)){
+				sb.append(userId).append(",");
+			}
+		}
+		if(sb.length() > 0){
+			return sb.substring(0,sb.length() - 1);
+		}
+		return null;
+	}
+
 	private Organization initOrganization(Organization organization){
 	private Organization initOrganization(Organization organization){
 		if(StringUtils.isNotEmpty(organization.getOrganManager())){
 		if(StringUtils.isNotEmpty(organization.getOrganManager())){
 			organization.setOrganManagerName(teacherDao.queryTeacherNameByTeacherIds(organization.getOrganManager()));
 			organization.setOrganManagerName(teacherDao.queryTeacherNameByTeacherIds(organization.getOrganManager()));

+ 13 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PlatformProductServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 import java.util.Optional;
 import java.util.Optional;
 
 
 /**
 /**
@@ -51,7 +52,7 @@ public class PlatformProductServiceImpl extends ServiceImpl<PlatformProductDao,
      */
      */
     @Override
     @Override
     public void updateProduct(PlatformProductDto obj) {
     public void updateProduct(PlatformProductDto obj) {
-        Optional.ofNullable(obj.getId()).orElseThrow(()-> new BizException("产品Id不能为空"));
+        Optional.ofNullable(obj.getId()).orElseThrow(() -> new BizException("产品Id不能为空"));
         Integer userId = Optional.ofNullable(sysUserFeignService.queryUserInfo())
         Integer userId = Optional.ofNullable(sysUserFeignService.queryUserInfo())
                 .map(SysUser::getId)
                 .map(SysUser::getId)
                 .orElseThrow(() -> new BizException("用户信息获取失败"));
                 .orElseThrow(() -> new BizException("用户信息获取失败"));
@@ -67,11 +68,12 @@ public class PlatformProductServiceImpl extends ServiceImpl<PlatformProductDao,
 
 
     /**
     /**
      * 删除
      * 删除
+     *
      * @param id 产品id
      * @param id 产品id
      */
      */
     @Override
     @Override
     public void deleteProduct(Integer id) {
     public void deleteProduct(Integer id) {
-        Optional.ofNullable(id).orElseThrow(()-> new BizException("产品Id不能为空"));
+        Optional.ofNullable(id).orElseThrow(() -> new BizException("产品Id不能为空"));
         Integer userId = Optional.ofNullable(sysUserFeignService.queryUserInfo())
         Integer userId = Optional.ofNullable(sysUserFeignService.queryUserInfo())
                 .map(SysUser::getId)
                 .map(SysUser::getId)
                 .orElseThrow(() -> new BizException("用户信息获取失败"));
                 .orElseThrow(() -> new BizException("用户信息获取失败"));
@@ -98,5 +100,14 @@ public class PlatformProductServiceImpl extends ServiceImpl<PlatformProductDao,
         return PageUtil.pageInfo(productIPage);
         return PageUtil.pageInfo(productIPage);
     }
     }
 
 
+    /**
+     * 根据serveId查询对应的菜单id集合
+     *
+     * @param serveId
+     */
+    @Override
+    public List<String> queryMenuIdList(Integer serveId) {
+        return baseMapper.queryMenuIdList(serveId);
+    }
 
 
 }
 }

+ 20 - 20
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -786,8 +786,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
         if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
             throw new BizException("请配置陪练课可预约声部");
             throw new BizException("请配置陪练课可预约声部");
         }
         }
-        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practiceFreeApplyExpireDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
         SysConfig practiceFreeApplyExpireDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
@@ -802,8 +802,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
         }
 
 
         result.put("subjects", subjects);
         result.put("subjects", subjects);
-        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
-        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
+//        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
+//        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
@@ -1661,15 +1661,15 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         calendar.add(Calendar.DATE, -1);
         calendar.add(Calendar.DATE, -1);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         while (!calendar.getTime().after(endDay)) {
         while (!calendar.getTime().after(endDay)) {
             calendar.add(Calendar.DATE, 1);
             calendar.add(Calendar.DATE, 1);
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
             Date enableApplyDayStartTime = calendar.getTime();
             Date enableApplyDayStartTime = calendar.getTime();
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
             Calendar applyStartCalendar = Calendar.getInstance();
             Calendar applyStartCalendar = Calendar.getInstance();
             applyStartCalendar.setTime(enableApplyDayStartTime);
             applyStartCalendar.setTime(enableApplyDayStartTime);
             for (String applyDayTime : applyDayTimes) {
             for (String applyDayTime : applyDayTimes) {
@@ -1689,8 +1689,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         calendar.add(Calendar.DATE, -1);
         calendar.add(Calendar.DATE, -1);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         Integer practiceApplyIntervalMinutes = practiceApplyIntervalTimeConfig.getParanValue(Integer.class);
         Integer practiceApplyIntervalMinutes = practiceApplyIntervalTimeConfig.getParanValue(Integer.class);
         LocalTime dayStartTime = LocalTime.parse("00:00:00", DateUtil.timeFormatter);
         LocalTime dayStartTime = LocalTime.parse("00:00:00", DateUtil.timeFormatter);
@@ -1706,11 +1706,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
 
         while (!calendar.getTime().after(endDay)) {
         while (!calendar.getTime().after(endDay)) {
             calendar.add(Calendar.DATE, 1);
             calendar.add(Calendar.DATE, 1);
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
             Date enableApplyDayStartTime = calendar.getTime();
             Date enableApplyDayStartTime = calendar.getTime();
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
             Calendar applyStartCalendar = Calendar.getInstance();
             Calendar applyStartCalendar = Calendar.getInstance();
             applyStartCalendar.setTime(enableApplyDayStartTime);
             applyStartCalendar.setTime(enableApplyDayStartTime);
             for (String applyDayTime : dayApplyTimes) {
             for (String applyDayTime : dayApplyTimes) {
@@ -2318,8 +2318,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
         if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
             throw new BizException("请配置陪练课可预约声部");
             throw new BizException("请配置陪练课可预约声部");
         }
         }
-        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practicePayMaxMonthConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_PAY_MAX_MONTH);
         SysConfig practicePayMaxMonthConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_PAY_MAX_MONTH);
@@ -2339,8 +2339,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         Collections.swap(subjects, 6, 7);
         Collections.swap(subjects, 6, 7);
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(organId);
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(organId);
         result.put("subjects", subjects);
         result.put("subjects", subjects);
-        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
-        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
+//        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
+//        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));

+ 15 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -16,6 +16,7 @@ import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,10 +61,13 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             pageInfo.setTotal(count);
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             params.put("offset", pageInfo.getOffset());
             dataList = studentGoodsSellDao.queryStudentGoodsOrders(params);
             dataList = studentGoodsSellDao.queryStudentGoodsOrders(params);
-            Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
-            dataList.forEach(e -> {
-                e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
-            });
+            Integer tenantId = TenantContextHolder.getTenantId();
+            String autoAffirmReceiveTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.AUTO_AFFIRM_RECEIVE_TIME,tenantId);
+            if(StringUtils.isNotEmpty(autoAffirmReceiveTime)){
+                dataList.forEach(e -> {
+                    e.setAutoAffirmReceiveTime(Integer.parseInt(autoAffirmReceiveTime));
+                });
+            }
         }
         }
         if (count == 0) {
         if (count == 0) {
             dataList = new ArrayList<>();
             dataList = new ArrayList<>();
@@ -111,10 +115,13 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             pageInfo.setTotal(count);
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             params.put("offset", pageInfo.getOffset());
             dataList = studentGoodsSellDao.queryStudentPaymentOrders(params);
             dataList = studentGoodsSellDao.queryStudentPaymentOrders(params);
-            Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
-            dataList.forEach(e -> {
-                e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
-            });
+            Integer tenantId = TenantContextHolder.getTenantId();
+            String autoAffirmReceiveTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.AUTO_AFFIRM_RECEIVE_TIME,tenantId);
+            if(StringUtils.isNotEmpty(autoAffirmReceiveTime)){
+                dataList.forEach(e -> {
+                    e.setAutoAffirmReceiveTime(Integer.parseInt(autoAffirmReceiveTime));
+                });
+            }
         }
         }
         if (count == 0) {
         if (count == 0) {
             dataList = new ArrayList<>();
             dataList = new ArrayList<>();

+ 11 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -11,15 +11,13 @@ import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.dal.page.*;
-import com.ym.mec.biz.service.CloudTeacherOrderService;
-import com.ym.mec.biz.service.StudentManageService;
-import com.ym.mec.biz.service.StudentService;
-import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -104,6 +102,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     private OrganizationDegreeCourseFeeDao organizationDegreeCourseFeeDao;
     private OrganizationDegreeCourseFeeDao organizationDegreeCourseFeeDao;
     @Autowired
     @Autowired
     private ActivityUserMapperDao activityUserMapperDao;
     private ActivityUserMapperDao activityUserMapperDao;
+    @Autowired
+    private SysTenantConfigService sysTenantConfigService;
 
 
     @Override
     @Override
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
@@ -912,6 +912,12 @@ public class StudentManageServiceImpl implements StudentManageService {
         //学员请假异常提醒(获取前两个月的)
         //学员请假异常提醒(获取前两个月的)
         Date date = new Date();
         Date date = new Date();
         PageInfo<StudentErrorLeaveDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         PageInfo<StudentErrorLeaveDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+
+        Integer tenantId = TenantContextHolder.getTenantId();
+        String studentErrorLeaveNum = sysTenantConfigService.getTenantConfigValue(SysConfigService.STUDENT_ERROR_LEAVE_NUM, tenantId);
+        if(StringUtils.isEmpty(studentErrorLeaveNum)){
+            return pageInfo;
+        }
         Map<String, Object> params = new HashMap<>();
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
         MapUtil.populateMap(params, queryInfo);
         params.put("offset", pageInfo.getOffset());
         params.put("offset", pageInfo.getOffset());
@@ -927,6 +933,7 @@ public class StudentManageServiceImpl implements StudentManageService {
             List<Long> classGroupIds = classGroupDao.queryGroupClassGroupIds(sysUser.getId());
             List<Long> classGroupIds = classGroupDao.queryGroupClassGroupIds(sysUser.getId());
             params.put("classGroupIds", classGroupIds);
             params.put("classGroupIds", classGroupIds);
         }
         }
+        params.put("studentErrorLeaveNum",studentErrorLeaveNum);
         int count = indexBaseMonthDataDao.countStudentErrorLeave1(params);
         int count = indexBaseMonthDataDao.countStudentErrorLeave1(params);
         List<StudentErrorLeaveDto> dataList = new ArrayList<>();
         List<StudentErrorLeaveDto> dataList = new ArrayList<>();
         if (count > 0) {
         if (count > 0) {

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysManualServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.biz.dal.dao.SysManualDao;
+import com.ym.mec.biz.dal.entity.SysManual;
+import com.ym.mec.biz.service.SysManualService;
+import org.springframework.stereotype.Service;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * (SysManual)表服务实现类
+ *
+ * @author makejava
+ * @since 2021-12-20 17:19:38
+ */
+@Service("sysManualService")
+public class SysManualServiceImpl extends ServiceImpl<SysManualDao, SysManual> implements SysManualService {
+
+    private final static Logger logger = LoggerFactory.getLogger(SysManualServiceImpl.class);
+}
+

+ 11 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -125,8 +125,11 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			advanceSignMinutes = Integer.parseInt(tenantConfigValue);
 			advanceSignMinutes = Integer.parseInt(tenantConfigValue);
 		}
 		}
 
 
-		int advanceSignOutMinutes = Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_OUT_MINUTES));
-		int offlineSignInEarlyForwardTime = Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.OFFLINE_SIGN_IN_EARLY_FORWARD_TIME));
+//		int advanceSignOutMinutes = Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_OUT_MINUTES));
+		String offlineSignInEarlyForwardTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_SIGN_IN_EARLY_FORWARD_TIME, user.getTenantId());
+		if(StringUtils.isEmpty(offlineSignInEarlyForwardTime)){
+			offlineSignInEarlyForwardTime = "60";
+		}
 
 
 		CourseSchedule courseSchedule = courseScheduleDao.get(teacherAttendance.getCourseScheduleId());
 		CourseSchedule courseSchedule = courseScheduleDao.get(teacherAttendance.getCourseScheduleId());
 		teacherAttendance.setGroupType(courseSchedule.getGroupType());
 		teacherAttendance.setGroupType(courseSchedule.getGroupType());
@@ -148,8 +151,12 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		//上课时间
 		//上课时间
 		Date classStartDateTime = DateUtil.stringToDate(classDate + " " + startClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 		Date classStartDateTime = DateUtil.stringToDate(classDate + " " + startClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 		Date classEndDateTime = DateUtil.stringToDate(classDate + " " + endClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 		Date classEndDateTime = DateUtil.stringToDate(classDate + " " + endClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
-		Date classEndDateAdd60Minutes = DateUtil.addMinutes(classEndDateTime, advanceSignOutMinutes);
-		Date add60Minutes = DateUtil.addMinutes(classStartDateTime, offlineSignInEarlyForwardTime * -1);
+		String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ADVANCE_SIGN_OUT_MINUTES, user.getTenantId());
+		if(StringUtils.isEmpty(configValue)){
+			configValue = "360";
+		}
+		Date classEndDateAdd60Minutes = DateUtil.addMinutes(classEndDateTime, Integer.parseInt(configValue));
+		Date add60Minutes = DateUtil.addMinutes(classStartDateTime, Integer.parseInt(offlineSignInEarlyForwardTime) * -1);
 		Date add20Minutes = DateUtil.addMinutes(classStartDateTime, advanceSignMinutes * -1);
 		Date add20Minutes = DateUtil.addMinutes(classStartDateTime, advanceSignMinutes * -1);
 		if(teacherAttendance.getSignInTime() == null && teacherSignOutDto.getTeacherAttendanceInfo().getStatus().equals(SignStatusEnum.SIGN_IN.getCode())){
 		if(teacherAttendance.getSignInTime() == null && teacherSignOutDto.getTeacherAttendanceInfo().getStatus().equals(SignStatusEnum.SIGN_IN.getCode())){
 
 

+ 280 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -1,41 +1,78 @@
 package com.ym.mec.biz.service.impl;
 package com.ym.mec.biz.service.impl;
 
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysRole;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.TenantInfoDao;
 import com.ym.mec.biz.dal.dao.TenantInfoDao;
 import com.ym.mec.biz.dal.dto.TenantConfigDto;
 import com.ym.mec.biz.dal.dto.TenantConfigDto;
 import com.ym.mec.biz.dal.dto.TenantInfoDto;
 import com.ym.mec.biz.dal.dto.TenantInfoDto;
 import com.ym.mec.biz.dal.dto.TenantProductInfoDto;
 import com.ym.mec.biz.dal.dto.TenantProductInfoDto;
-import com.ym.mec.biz.dal.entity.TenantConfig;
-import com.ym.mec.biz.dal.entity.TenantInfo;
-import com.ym.mec.biz.dal.entity.TenantProductInfo;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo;
 import com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo;
-import com.ym.mec.biz.service.TenantConfigService;
-import com.ym.mec.biz.service.TenantInfoService;
-import com.ym.mec.biz.service.TenantProductInfoService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageUtil;
 import com.ym.mec.common.page.PageUtil;
+import com.ym.mec.common.service.IdGeneratorService;
+import com.ym.mec.thirdparty.yqpay.Msg;
+import org.apache.commons.collections.CollectionUtils;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.redisson.api.RBucket;
+import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
 import java.util.function.Consumer;
+import java.util.stream.Collectors;
 
 
 @Service
 @Service
 public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo> implements TenantInfoService {
 public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo> implements TenantInfoService {
+    private static final Logger log = LoggerFactory.getLogger(TenantInfoServiceImpl.class);
 
 
     @Autowired
     @Autowired
     private SysUserFeignService sysUserFeignService;
     private SysUserFeignService sysUserFeignService;
     @Autowired
     @Autowired
+    private EmployeeService employeeService;
+    @Autowired
     private TenantProductInfoService tenantProductInfoService;
     private TenantProductInfoService tenantProductInfoService;
     @Autowired
     @Autowired
+    private PlatformProductService platformProductService;
+    @Autowired
+    private PlatformServeService platformServeService;
+    @Autowired
+    private PlatformServeDetailService platformServeDetailService;
+    @Autowired
     private TenantConfigService tenantConfigService;
     private TenantConfigService tenantConfigService;
+    @Autowired
+    private RedissonClient redissonClient;
+    @Autowired
+    private SysUserTsignService sysUserTsignService;
+    @Autowired
+    private OrganizationDao organizationDao;
+    @Autowired
+    private PayService payService;
+    @Autowired
+    private IdGeneratorService idGenerator;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+    @Autowired
+    private TenantOrderRecordService tenantOrderRecordService;
 
 
     /**
     /**
      * 新增机构
      * 新增机构
@@ -45,11 +82,11 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     public void addTenantInfo(TenantInfoDto dto) {
     public void addTenantInfo(TenantInfoDto dto) {
         //校验手机号是否唯一
         //校验手机号是否唯一
         checkPhone(dto);
         checkPhone(dto);
+        //校验营业执照信息
+        checkTsign(dto.getTsignCode());
 
 
         //添加机构基本信息
         //添加机构基本信息
-        Integer userId = Optional.ofNullable(sysUserFeignService.queryUserInfo())
-                .map(SysUser::getId)
-                .orElseThrow(() -> new BizException("用户信息获取失败"));
+        Integer userId = getUserId();
         TenantInfo tenantInfo = new TenantInfo();
         TenantInfo tenantInfo = new TenantInfo();
         BeanUtils.copyProperties(dto, tenantInfo);
         BeanUtils.copyProperties(dto, tenantInfo);
         tenantInfo.setPayState(0);
         tenantInfo.setPayState(0);
@@ -65,6 +102,20 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
                 tenantProductInfoService::addTenantProduct);
                 tenantProductInfoService::addTenantProduct);
         //添加机构配置
         //添加机构配置
         setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::addConfig);
         setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::addConfig);
+        //创建一个和机构同名称的“分部”
+        createOrg(tenantInfo,dto.getAreaId());
+    }
+
+    //创建一个和机构同名称的“分部”
+    private void createOrg(TenantInfo tenantInfo,Integer areaId) {
+        Organization organization = new Organization();
+        organization.setName(tenantInfo.getName());
+        organization.setDelFlag(YesOrNoEnum.NO);
+        organization.setGradeType(GradeTypeEnum.SIX_PLUS);
+        organization.setCreateTime(new Date());
+        organization.setTenantId(tenantInfo.getId());
+        organization.setAreaId(areaId);
+        organizationDao.insert(organization);
     }
     }
 
 
     /**
     /**
@@ -96,18 +147,16 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 
 
         //机构状态 0未缴费
         //机构状态 0未缴费
         if (0 == tenantInfo.getPayState()) {
         if (0 == tenantInfo.getPayState()) {
+            //校验营业执照信息
+            checkTsign(dto.getTsignCode());
             //修改产品
             //修改产品
             setIdByApply(tenantId, dto.getProductInfo(), dto.getProductInfo()::setTenantId,
             setIdByApply(tenantId, dto.getProductInfo(), dto.getProductInfo()::setTenantId,
                     tenantProductInfoService::updateTenantProduct);
                     tenantProductInfoService::updateTenantProduct);
         }
         }
 
 
-        //修改机构基础信息
-        Integer userId = Optional.ofNullable(sysUserFeignService.queryUserInfo())
-                .map(SysUser::getId)
-                .orElseThrow(() -> new BizException("用户信息获取失败"));
         Date now = new Date();
         Date now = new Date();
         BeanUtils.copyProperties(dto, tenantInfo);
         BeanUtils.copyProperties(dto, tenantInfo);
-        tenantInfo.setUpdatedBy(userId);
+        tenantInfo.setUpdatedBy(getUserId());
         tenantInfo.setUpdatedTime(now);
         tenantInfo.setUpdatedTime(now);
         this.updateById(tenantInfo);
         this.updateById(tenantInfo);
 
 
@@ -136,11 +185,24 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         TenantConfig tenantConfig = tenantConfigService.getOne(new QueryWrapper<TenantConfig>()
         TenantConfig tenantConfig = tenantConfigService.getOne(new QueryWrapper<TenantConfig>()
                 .eq("tenant_id_", tenantId));
                 .eq("tenant_id_", tenantId));
         setTenantInfo(tenantConfig, new TenantConfigDto(), tenantInfoDto::setConfig);
         setTenantInfo(tenantConfig, new TenantConfigDto(), tenantInfoDto::setConfig);
+        //获取服务信息
+        PlatformServe platformServe = platformServeService.getOne(new QueryWrapper<PlatformServe>()
+                .eq("id_", productInfo.getServeId()));
+        Optional.ofNullable(platformServe)
+                .map(PlatformServe::getName)
+                .ifPresent(tenantInfoDto::setPlatformServeName);
+        //获取服务详情
+        PlatformServeDetail serveDetail = platformServeDetailService.getOne(new QueryWrapper<PlatformServeDetail>()
+                .eq("id_", productInfo.getServeDetailId()));
+        Optional.ofNullable(serveDetail)
+                .map(PlatformServeDetail::getStudentUpLimit)
+                .ifPresent(tenantInfoDto::setStudentUpLimit);
         return tenantInfoDto;
         return tenantInfoDto;
     }
     }
 
 
     /**
     /**
      * 启用/停用
      * 启用/停用
+     * 第一个启用默认激活账号等信息
      *
      *
      * @param id    机构id
      * @param id    机构id
      * @param state 机构状态 0草稿 1启动 2停用
      * @param state 机构状态 0草稿 1启动 2停用
@@ -150,11 +212,104 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     public void opsTenantState(Integer id, Integer state) {
     public void opsTenantState(Integer id, Integer state) {
         if (Objects.nonNull(state)) {
         if (Objects.nonNull(state)) {
             if (state == 1 || state == 2) {
             if (state == 1 || state == 2) {
-                baseMapper.opsTenantState(id, state);
+                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() == 1) {
+                        //判断是否初次启用
+                        firstOpen(tenantInfo);
+                    } else {
+                        throw new BizException("机构未缴费无法开通!");
+                    }
+                }
+                baseMapper.updateById(tenantInfo);
                 return;
                 return;
             }
             }
         }
         }
-        throw new BizException("机构状态参数异常!");
+        throw new BizException("传入机构状态参数异常!");
+    }
+
+    /**
+     * 第一次开通服务
+     *
+     * @param tenantInfo 机构信息
+     */
+    private void firstOpen(TenantInfo tenantInfo) {
+        Integer tenantId = tenantInfo.getId();
+        SysUser user = sysUserFeignService.queryUserByMobile(tenantInfo.getPhone());
+        if (Objects.nonNull(user)) {
+            return;
+        }
+        //防止重复点击 加锁
+        String key = "Tenant_First_Open:" + tenantId;
+        RBucket<Object> bucket = redissonClient.getBucket(key);
+        //原子操作 抢锁成功为true
+        if (!bucket.trySet(tenantId, 3L, TimeUnit.MINUTES)) {
+            throw new BizException("该机构数正在开通中请勿频繁操作");
+        }
+        //获取产品信息得到服务id
+        TenantProductInfo productInfo = tenantProductInfoService.getOne(new QueryWrapper<TenantProductInfo>()
+                .eq("tenant_id_", tenantId));
+        if (Objects.isNull(productInfo)) {
+            throw new BizException("开通账号信息异常!未查询到购买的产品信息!");
+        }
+        //根据服务id查询对应的菜单值(该值是多个id用逗号分割的)
+        List<String> menuIdList = platformProductService.queryMenuIdList(productInfo.getServeId());
+        if (CollectionUtils.isEmpty(menuIdList)) {
+            throw new BizException("开通账号信息异常!未查询到购买的产品信息!!");
+        }
+        //拆分菜单获取菜单ID
+        List<Integer> collectMenuId = getMenuId(menuIdList);
+        //建立角色
+        Integer roleId = createRole(tenantId);
+        //建立角色和菜单关系数据
+        employeeService.batchInsertRoleMenu(roleId, collectMenuId);
+        // 创建账号、用户信息、用户和角色关系
+        createUser(tenantInfo, Lists.newArrayList(roleId));
+    }
+
+    //拆分菜单获取菜单ID
+    private List<Integer> getMenuId(List<String> menuIdList) {
+        return menuIdList.stream()
+                .map(ids -> ids.split(","))
+                .flatMap(Arrays::stream)
+                .distinct()
+                .map(Integer::parseInt)
+                .collect(Collectors.toList());
+    }
+
+    //创建角色
+    private Integer createRole(Integer tenantId) {
+        SysRole sysRole = new SysRole();
+        sysRole.setRoleName("管理员");
+        sysRole.setRoleDesc("管理员");
+        sysRole.setCreateTime(new Date());
+        sysRole.setDelFlag("0");
+        sysRole.setTenantId(tenantId);
+        employeeService.insertSysRole(sysRole);
+        return sysRole.getId();
+    }
+
+    //创建账号、用户信息、用户和角色关系
+    private void createUser(TenantInfo tenantInfo, List<Integer> roles) {
+        Employee e = new Employee();
+        e.setPhone(tenantInfo.getPhone());
+        e.setRealName(tenantInfo.getContacts());
+        e.setJobNature(JobNatureEnum.FULL_TIME);
+        e.setEntryDate(LocalDate.now().toDate());
+        e.setRoles(roles);
+        try {
+            employeeService.add(e);
+        } catch (Exception ex) {
+            throw new BizException("开通账号信息异常!");
+        }
     }
     }
 
 
     /**
     /**
@@ -176,6 +331,100 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     }
     }
 
 
     /**
     /**
+     * 机构缴费
+     */
+    public Map<String, Object> pay(Integer tenantId) throws Exception {
+        TenantInfo tenantInfo = Optional.ofNullable(tenantId)
+                .map(baseMapper::selectById)
+                .orElseThrow(() -> new BizException("未查询到机构信息!"));
+        //机构产品信息
+        TenantProductInfo productInfo = tenantProductInfoService.getOne(new QueryWrapper<TenantProductInfo>()
+                .eq("tenant_id_", tenantId));
+        //生成订单编号
+        String orderNo = idGenerator.generatorId("payment") + "";
+        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+        TenantOrderRecordEnum tenantEnum = TenantOrderRecordEnum.TENANT_OPEN;
+        //获取分部信息
+        Organization organization = organizationDao.getByName(tenantInfo.getName(), tenantId);
+        if (Objects.isNull(organization)) {
+            throw new BizException("未查询到机构分部信息!");
+        }
+        Map<String, Object> payMap = new HashMap<>();
+        int orderState = 0;
+        //消费大于0元则拉起支付
+        if (productInfo.getPayAmount().compareTo(BigDecimal.ZERO) > 0) {
+            payMap = payService.getPayMap(
+                    productInfo.getPayAmount(),
+                    BigDecimal.ZERO,
+                    orderNo,
+                    baseApiUrl + "/WEB-SERVER/tenantInfo/notify",
+                    baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
+                    tenantEnum.getMsg(),
+                    tenantEnum.getMsg(),
+                    1,//临时写死
+                    tenantEnum.getCode()
+            );
+        } else {
+            //已支付
+            orderState = 1;
+        }
+        createOrderRecord(tenantId, productInfo.getPayAmount(), orderNo, tenantEnum, orderState);
+        log.info("tenant pay >>>>> " + JSON.toJSONString(payMap));
+        return payMap;
+    }
+
+    //生成订单
+    private void createOrderRecord(Integer tenantId, BigDecimal payAmount, String orderNo, TenantOrderRecordEnum tenantEnum, Integer orderState) {
+        LocalDateTime now = LocalDateTime.now();
+        TenantOrderRecord record = new TenantOrderRecord();
+        record.setTenantId(tenantId);
+        record.setOrderNo(orderNo);
+        record.setOrderType(tenantEnum.getCode());
+        record.setPaymentChannel(PaymentChannelEnum.ADAPAY.getCode());
+        record.setExpectAmount(payAmount);
+        record.setActualAmount(payAmount);
+        record.setOrderState(orderState);
+        record.setPayDate(now.toLocalDate().toDate());
+        record.setPayTime(now.toDate());
+        record.setCreatedTime(now.toDate());
+        tenantOrderRecordService.save(record);
+    }
+
+    /**
+     * 支付消息回调
+     *
+     * @param msg
+     * @return
+     */
+    @Override
+    public Msg orderNotify(Msg msg) {
+        log.info("tenant orderNotify >>>>> " + msg.toString());
+        msg.setMsg("fail");
+        Map<String, String> notifyMap = JSON.parseObject(msg.getResponseParameters(), Map.class);
+        TenantOrderRecord record = new TenantOrderRecord();
+        record.setOrderNo(notifyMap.get("merMerOrderNo"));
+        record.setTransNo(notifyMap.get("orderNo"));
+        String channelType = notifyMap.get("channelType").equals("1") ? "WXPay" : (notifyMap.get("channelType").equals("2") ? "Alipay" : "quickPay");
+        record.setPayChannel(channelType);
+        //支付中订单存在,更新状态
+        if (msg.getResponseType().equals("1") && notifyMap.size() > 0 && msg.getCode().equals("88")) {
+            //tradeState 88就是正确的 其他错误的
+//            DealStatusEnum
+//            notifyMap.put("totalMoney", notifyMap.get("payAmount"));
+            record.setOrderState(1);
+            msg.setCode("000000");
+            msg.setMsg("success");
+        } else {
+            //支付失败
+            record.setOrderState(2);
+        }
+        tenantOrderRecordService.update(record, new QueryWrapper<TenantOrderRecord>()
+                .eq("order_no_", record.getOrderNo()));
+        log.info("tenant orderNotify return>>>>> " + msg.toString());
+        return msg;
+    }
+
+    /**
      * 校验手机号
      * 校验手机号
      */
      */
     private void checkPhone(TenantInfoDto dto) {
     private void checkPhone(TenantInfoDto dto) {
@@ -216,4 +465,19 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         }
         }
     }
     }
 
 
+    private Integer getUserId() {
+        //修改机构基础信息
+        return Optional.ofNullable(sysUserFeignService.queryUserInfo())
+                .map(SysUser::getId)
+                .orElseThrow(() -> new BizException("用户信息获取失败,请刷新页面或者重新登录!"));
+    }
+
+    private void checkTsign(String code) {
+        //校验营业信息
+        SysUserTsign sysUserTsign = sysUserTsignService.queryByCardNo(code);
+        if (Objects.nonNull(sysUserTsign)) {
+            throw new BizException("营业执照编号已被注册!");
+        }
+    }
+
 }
 }

+ 38 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -0,0 +1,38 @@
+package com.ym.mec.biz.service.impl;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.biz.dal.dao.TenantOrderRecordDao;
+import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
+import com.ym.mec.biz.dal.entity.TenantOrderRecord;
+import com.ym.mec.biz.service.TenantOrderRecordService;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.PageUtil;
+import com.ym.mec.common.page.QueryWrapperUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+/**
+ * 机构付款记录表(TenantOrderRecord)表服务实现类
+ *
+ * @author hgw
+ * @since 2021-12-20 10:08:28
+ */
+@Service("tenantOrderRecordService")
+public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordDao, TenantOrderRecord> implements TenantOrderRecordService {
+
+    @Override
+    public PageInfo<TenantOrderRecord> queryPage(TenantOrderRecordDto dto) {
+        Page<TenantOrderRecord> pageInfo = PageUtil.getPage(dto.getPage(), dto.getRows());
+        pageInfo.setDesc("a.created_time_ ");
+        Optional.ofNullable(dto.getTenantId())
+                .map(QueryWrapperUtil::toList)
+                .filter(CollectionUtils::isNotEmpty)
+                .ifPresent(dto::setTenantIdList);
+        return PageUtil.pageInfo(baseMapper.queryPage(pageInfo, dto));
+    }
+
+}
+

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

@@ -2730,7 +2730,7 @@
             AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
             AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
         </if>
         </if>
         <if test="searchType == 'COURSE_TIME_ERROR'">
         <if test="searchType == 'COURSE_TIME_ERROR'">
-            AND cs.status_ = 'NOT_START' AND cs.is_lock_ = 0 AND (cs.start_class_time_ &lt; '06:00:00' OR cs.end_class_time_ > '21:00:00')
+            AND cs.status_ = 'NOT_START' AND cs.is_lock_ = 0 AND (cs.start_class_time_ &lt; #{courseStartTimeError} OR cs.end_class_time_ > #{courseEndTimeError})
             AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
             AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
         </if>
         </if>
         <if test="classGroupIds != null and classGroupIds.size() > 0">
         <if test="classGroupIds != null and classGroupIds.size() > 0">

+ 18 - 0
mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -80,6 +80,7 @@
         VALUES(#{userId},#{organIdList},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},
         VALUES(#{userId},#{organIdList},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},
         #{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},now(),now(),#{introduction},#{demissionDate},#{contactAddress},#{postalCode},#{deptId},#{deptIds},#{postIds},#{postDeptIds})
         #{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},now(),now(),#{introduction},#{demissionDate},#{contactAddress},#{postalCode},#{deptId},#{deptIds},#{postIds},#{postDeptIds})
     </insert>
     </insert>
+
     <insert id="batchAddEmployeeRole">
     <insert id="batchAddEmployeeRole">
         INSERT INTO sys_user_role(user_id_,role_id_) values
         INSERT INTO sys_user_role(user_id_,role_id_) values
         <foreach collection="roleIds" item="item" index="index" separator=",">
         <foreach collection="roleIds" item="item" index="index" separator=",">
@@ -87,6 +88,21 @@
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
+    <insert id="batchInsertRoleMenu">
+        INSERT INTO sys_role_menu (role_id_,menu_id_) VALUES
+        <foreach collection="menuIds" item="item" index="index" separator=",">
+            (#{roleId}, #{item})
+        </foreach>
+    </insert>
+
+    <insert id="insertSysRole" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.auth.api.entity.SysRole"
+            useGeneratedKeys="true">
+        INSERT INTO `sys_role` (`role_name_`, `role_code_`, `role_desc_`, `create_time_`,
+                                `update_time_`, `del_flag_`, `organ_id_`, `tenant_id_`)
+        VALUES (#{RoleName}, #{RoleCode}, #{RoleDesc}, #{CreateTime},
+                #{UpdateTime}, #{DelFlag}, #{OrganId}, #{TenantId});
+    </insert>
+
     <select id="queryByPhone" resultMap="SysUser">
     <select id="queryByPhone" resultMap="SysUser">
 		select * from sys_user where phone_ = #{phone} OR username_ = #{phone}
 		select * from sys_user where phone_ = #{phone} OR username_ = #{phone}
 	</select>
 	</select>
@@ -224,6 +240,7 @@
             LEFT JOIN sys_user_role sur ON sur.user_id_ = e.user_id_
             LEFT JOIN sys_user_role sur ON sur.user_id_ = e.user_id_
         </if>
         </if>
         <where>
         <where>
+                su.lock_flag_ = 0 AND su.del_flag_ = 0
             <if test="demissionflag != null and demissionflag == 1">
             <if test="demissionflag != null and demissionflag == 1">
                 AND e.demission_date_ IS NOT NULL
                 AND e.demission_date_ IS NOT NULL
             </if>
             </if>
@@ -256,6 +273,7 @@
             LEFT JOIN sys_user_role sur ON sur.user_id_ = e.user_id_
             LEFT JOIN sys_user_role sur ON sur.user_id_ = e.user_id_
         </if>
         </if>
         <where>
         <where>
+            su.lock_flag_ = 0 AND su.del_flag_ = 0
             <if test="organId != null">
             <if test="organId != null">
                 AND INTE_ARRAY(e.organ_id_list_,#{organId})
                 AND INTE_ARRAY(e.organ_id_list_,#{organId})
             </if>
             </if>

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

@@ -1588,7 +1588,7 @@
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
 		</if>
 		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m')
 		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m')
-		HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_)) c
+		HAVING COUNT(sa.id_) >= #{studentErrorLeaveNum} AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_)) c
 	</select>
 	</select>
 	<resultMap id="StudentErrorLeaveDto" type="com.ym.mec.biz.dal.dto.StudentErrorLeaveDto">
 	<resultMap id="StudentErrorLeaveDto" type="com.ym.mec.biz.dal.dto.StudentErrorLeaveDto">
 		<result property="currentNum" column="current_num_"/>
 		<result property="currentNum" column="current_num_"/>
@@ -1620,7 +1620,7 @@
 		<if test="search != null and search != ''">
 		<if test="search != null and search != ''">
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
 		</if>
-		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
+		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) >= #{studentErrorLeaveNum} AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
 		GROUP BY c.user_id_
 		GROUP BY c.user_id_
 		<include refid="global.limit"/>
 		<include refid="global.limit"/>
 	</select>
 	</select>
@@ -1688,7 +1688,7 @@
 		<if test="search != null and search != ''">
 		<if test="search != null and search != ''">
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
 		</if>
-		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
+		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) >= #{studentErrorLeaveNum} AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
 		GROUP BY c.user_id_
 		GROUP BY c.user_id_
 	</select>
 	</select>
 
 

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

@@ -94,6 +94,6 @@
 	</select>
 	</select>
     <select id="queryPushCourseTermMusicIds" resultType="java.lang.String">
     <select id="queryPushCourseTermMusicIds" resultType="java.lang.String">
 		SELECT music_group_id_ FROM music_group_school_term_course_detail
 		SELECT music_group_id_ FROM music_group_school_term_course_detail
-		GROUP BY music_group_id_ HAVING DATEDIFF(NOW(),MAX(end_school_term_)) = #{remindCourseTime}
+		GROUP BY music_group_id_ HAVING DATEDIFF(MAX(end_school_term_),NOW()) = #{remindCourseTime}
 	</select>
 	</select>
 </mapper>
 </mapper>

+ 13 - 3
mec-biz/src/main/resources/config/mybatis/OrganizationMapper.xml

@@ -20,10 +20,13 @@
         <result column="address_" property="address"/>
         <result column="address_" property="address"/>
         <result column="organ_manager_" property="organManager"/>
         <result column="organ_manager_" property="organManager"/>
         <result column="education_id_" property="educationId"/>
         <result column="education_id_" property="educationId"/>
+        <result column="join_teacher_id_" property="joinTeacherId"/>
+        <result column="join_teacher_name_" property="joinTeacherName"/>
         <result column="repair_id_" property="repairId"/>
         <result column="repair_id_" property="repairId"/>
         <result column="organ_manager_name_" property="organManagerName"/>
         <result column="organ_manager_name_" property="organManagerName"/>
         <result column="education_name_" property="educationName"/>
         <result column="education_name_" property="educationName"/>
         <result column="repair_name_" property="repairName"/>
         <result column="repair_name_" property="repairName"/>
+        <result column="tenant_id_" property="tenantId"/>
         <result column="grade_type_" property="gradeType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="grade_type_" property="gradeType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
     </resultMap>
 
 
@@ -32,6 +35,10 @@
 		SELECT * FROM organization WHERE id_ = #{id} 
 		SELECT * FROM organization WHERE id_ = #{id} 
 	</select>
 	</select>
 
 
+    <select id="getByName" parameterType="object" resultMap="Organization">
+        SELECT * FROM organization WHERE name_ = #{name} and tenant_id_ = #{tenantId}
+    </select>
+
     <!-- 全查询 -->
     <!-- 全查询 -->
     <select id="findAll" resultMap="Organization">
     <select id="findAll" resultMap="Organization">
 		SELECT * FROM organization ORDER BY id_
 		SELECT * FROM organization ORDER BY id_
@@ -41,11 +48,12 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Organization" useGeneratedKeys="true" keyColumn="id"
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Organization" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
             keyProperty="id">
         INSERT INTO organization (id_,name_,area_id_,create_time_,update_time_,
         INSERT INTO organization (id_,name_,area_id_,create_time_,update_time_,
-                                  register_date_,linkman_,mobile_,address_,grade_type_,organ_manager_,education_id_,repair_id_,
-                                  organ_manager_name_,education_name_,repair_name_)
+                                  register_date_,linkman_,mobile_,address_,grade_type_,organ_manager_,education_id_,repair_id_,join_teacher_id_,
+                                  organ_manager_name_,education_name_,repair_name_,join_teacher_name_,tenant_id_)
         VALUES(#{id},#{name},#{areaId},now(),now(),#{registerDate},#{linkman},#{mobile},#{address},
         VALUES(#{id},#{name},#{areaId},now(),now(),#{registerDate},#{linkman},#{mobile},#{address},
                #{gradeType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
                #{gradeType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-               ,#{organManager},#{educationId},#{repairId},#{organManagerName},#{educationName},#{repairName})
+               ,#{organManager},#{educationId},#{repairId},#{joinTeacherId},#{organManagerName},
+               #{educationName},#{repairName},#{joinTeacherName},#{tenantId})
     </insert>
     </insert>
 
 
     <!-- 根据主键查询一条记录 -->
     <!-- 根据主键查询一条记录 -->
@@ -58,9 +66,11 @@
                 organ_manager_ = #{organManager},
                 organ_manager_ = #{organManager},
                 education_id_ = #{educationId},
                 education_id_ = #{educationId},
                 repair_id_ = #{repairId},
                 repair_id_ = #{repairId},
+                join_teacher_id_ = #{joinTeacherId},
                 organ_manager_name_ = #{organManagerName},
                 organ_manager_name_ = #{organManagerName},
                 education_name_ = #{educationName},
                 education_name_ = #{educationName},
                 repair_name_ = #{repairName},
                 repair_name_ = #{repairName},
+                join_teacher_name_ = #{joinTeacherName},
             <if test="areaId != null">
             <if test="areaId != null">
                 area_id_ = #{areaId},
                 area_id_ = #{areaId},
             </if>
             </if>

+ 13 - 0
mec-biz/src/main/resources/config/mybatis/PlatformProductMapper.xml

@@ -137,4 +137,17 @@
             </if>
             </if>
         </where>
         </where>
     </select>
     </select>
+    
+    <select id="queryMenuIdList" parameterType="integer" resultType="string">
+        SELECT
+            b.`menu_id_`
+        FROM
+            `platform_serve` AS a
+                JOIN `platform_product` AS b
+                     ON FIND_IN_SET(b.`id_`, a.`product_id_`)
+        WHERE
+            a.deleted_ = 0 AND b.deleted_ = 0
+          AND a.`id_` = #{serveId}
+    </select>
+    
 </mapper>
 </mapper>

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

@@ -153,9 +153,9 @@
     <select id="queryNoAffirmOrderNo" resultType="java.lang.String">
     <select id="queryNoAffirmOrderNo" resultType="java.lang.String">
 		SELECT GROUP_CONCAT(DISTINCT so.order_no_) FROM sell_order so
 		SELECT GROUP_CONCAT(DISTINCT so.order_no_) FROM sell_order so
 		LEFT JOIN student_payment_order spo ON spo.order_no_ = so.order_no_
 		LEFT JOIN student_payment_order spo ON spo.order_no_ = so.order_no_
-		WHERE spo.status_ = 'SUCCESS'
+		WHERE spo.status_ = 'SUCCESS' AND spo.receive_status_ = 'NO_RECEIVE'
 		<if test="autoAffirmReceiveTime != null and autoAffirmReceiveTime != ''">
 		<if test="autoAffirmReceiveTime != null and autoAffirmReceiveTime != ''">
-			AND TIMESTAMPDIFF(HOUR,spo.pay_time_,NOW()) >= #{autoAffirmReceiveTime}
+			AND TIMESTAMPDIFF(DAY,spo.pay_time_,NOW()) >= #{autoAffirmReceiveTime}
 		</if>
 		</if>
 	</select>
 	</select>
 	<resultMap type="com.ym.mec.biz.dal.dto.StudentPaymentOrderDto" id="StudentPaymentOrderDto" extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">
 	<resultMap type="com.ym.mec.biz.dal.dto.StudentPaymentOrderDto" id="StudentPaymentOrderDto" extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">

+ 7 - 4
mec-biz/src/main/resources/config/mybatis/TenantConfigMapper.xml

@@ -6,6 +6,8 @@
         <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
         <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
         <result column="charge_rate_" jdbcType="VARCHAR" property="chargeRate"/>
         <result column="charge_rate_" jdbcType="VARCHAR" property="chargeRate"/>
         <result column="teaching_material_id_" jdbcType="VARCHAR" property="teachingMaterialId"/>
         <result column="teaching_material_id_" jdbcType="VARCHAR" property="teachingMaterialId"/>
+        <result column="theme_" jdbcType="VARCHAR" property="theme"/>
+        <result column="theme_color_" jdbcType="VARCHAR" property="themeColor"/>
         <result column="config_" jdbcType="VARCHAR" property="config"/>
         <result column="config_" jdbcType="VARCHAR" property="config"/>
         <result column="updated_by_" jdbcType="INTEGER" property="updatedBy"/>
         <result column="updated_by_" jdbcType="INTEGER" property="updatedBy"/>
         <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
         <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
@@ -13,16 +15,17 @@
 
 
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
         id_
         id_
-        , tenant_id_, charge_rate_, teaching_material_id_, config_, updated_by_, updated_time_
+        , tenant_id_, charge_rate_, teaching_material_id_, theme_, theme_color_, config_, updated_by_, updated_time_
     </sql>
     </sql>
 
 
     <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
     <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
             parameterType="com.ym.mec.biz.dal.entity.TenantConfig">
             parameterType="com.ym.mec.biz.dal.entity.TenantConfig">
-        insert into tenant_config(tenant_id_, charge_rate_, teaching_material_id_, config_, updated_by_, updated_time_)
+        insert into tenant_config(tenant_id_, charge_rate_, teaching_material_id_, theme_, theme_color_, config_,
+        updated_by_, updated_time_)
         values
         values
         <foreach collection="entities" item="entity" separator=",">
         <foreach collection="entities" item="entity" separator=",">
-            (#{entity.tenantId}, #{entity.chargeRate}, #{entity.teachingMaterialId}, #{entity.config},
-            #{entity.updatedBy}, #{entity.updatedTime})
+            (#{entity.tenantId}, #{entity.chargeRate}, #{entity.teachingMaterialId}, #{entity.theme},
+            #{entity.themeColor}, #{entity.config}, #{entity.updatedBy}, #{entity.updatedTime})
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 

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

@@ -22,19 +22,16 @@
         <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
         <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
         <result column="tsign_code_" jdbcType="VARCHAR" property="tsignCode"/>
         <result column="tsign_code_" jdbcType="VARCHAR" property="tsignCode"/>
         <result column="tsign_name_" jdbcType="VARCHAR" property="tsignName"/>
         <result column="tsign_name_" jdbcType="VARCHAR" property="tsignName"/>
+        <result column="area_id_" jdbcType="INTEGER" property="areaId"/>
     </resultMap>
     </resultMap>
 
 
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
         id_
         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_
+        , 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_
     </sql>
     </sql>
 
 
-    <update id="opsTenantState" parameterType="object">
-        update tenant_info
-        set state_ = #{state}
-        where id_ = #{id}
-    </update>
-
     <resultMap id="TenantInfoInfoResult" type="com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo">
     <resultMap id="TenantInfoInfoResult" type="com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo">
         <!--  机构基础信息-->
         <!--  机构基础信息-->
         <id column="id_" jdbcType="INTEGER" property="id"/>
         <id column="id_" jdbcType="INTEGER" property="id"/>

+ 84 - 0
mec-biz/src/main/resources/config/mybatis/TenantOrderRecordMapper.xml

@@ -0,0 +1,84 @@
+<?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.TenantOrderRecordDao">
+    <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantOrderRecord">
+        <id column="id_" jdbcType="INTEGER" property="id"/>
+        <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
+        <result column="order_no_" jdbcType="VARCHAR" property="orderNo"/>
+        <result column="trans_no_" jdbcType="VARCHAR" property="transNo"/>
+        <result column="order_type_" jdbcType="VARCHAR" property="orderType"/>
+        <result column="payment_channel_" jdbcType="VARCHAR" property="paymentChannel"/>
+        <result column="pay_channel_" jdbcType="VARCHAR" property="payChannel"/>
+        <result column="expect_amount" jdbcType="VARCHAR" property="expectAmount"/>
+        <result column="actual_amount" jdbcType="VARCHAR" property="actualAmount"/>
+        <result column="order_state_" jdbcType="INTEGER" property="orderState"/>
+        <result column="pay_date_" jdbcType="TIMESTAMP" property="payDate"/>
+        <result column="pay_time_" jdbcType="TIMESTAMP" property="payTime"/>
+        <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id_
+        , tenant_id_, order_no_, trans_no_, order_type_, payment_channel_, pay_channel_, expect_amount, actual_amount, order_state_, pay_date_, pay_time_, created_time_
+    </sql>
+
+    <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
+            parameterType="com.ym.mec.biz.dal.entity.TenantOrderRecord">
+        insert into tenant_order_record(tenant_id_, order_no_, trans_no_, order_type_, payment_channel_, pay_channel_,
+        expect_amount, actual_amount, order_state_, pay_date_, pay_time_, created_time_)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.tenantId}, #{entity.orderNo}, #{entity.transNo}, #{entity.orderType}, #{entity.paymentChannel},
+            #{entity.payChannel}, #{entity.expectAmount}, #{entity.actualAmount}, #{entity.orderState},
+            #{entity.payDate}, #{entity.payTime}, #{entity.createdTime})
+        </foreach>
+    </insert>
+
+    <select id="queryPage" parameterType="com.ym.mec.biz.dal.dto.TenantOrderRecordDto" resultType="com.ym.mec.biz.dal.vo.TenantOrderRecordVo">
+        SELECT
+            b.name_ as tenantName,
+            a.tenant_id_ as tenantId,
+            a.order_no_ as orderNo,
+            a.trans_no_ as transNo,
+            a.order_type_ as orderType,
+            a.payment_channel_ as paymentChannel,
+            a.pay_channel_ AS payChannel,
+            a.expect_amount as expectAmount,
+            a.actual_amount as actualAmount,
+            a.order_state_ as orderState,
+            a.pay_date_ as payDate,
+            a.pay_time_ as payTime,
+            a.created_time_ as createdTime
+        FROM
+            tenant_order_record AS a
+                LEFT JOIN tenant_info AS b
+                          ON a.tenant_id_ = b.id_
+    <where>
+        <if test="param.orderNo != null ">
+            AND a.`order_no_` = #{param.orderNo}
+        </if>
+        <if test="param.transNo != null ">
+            AND a.`trans_no_` = #{param.transNo}
+        </if>
+        <if test="param.orderType != null ">
+            AND a.`order_type_` = #{param.orderType}
+        </if>
+        <if test="param.orderState != null ">
+            AND a.`order_state_` = #{param.orderState}
+        </if>
+        <if test="param.tenantIdList != null ">
+            AND a.`tenant_id_`  IN
+            <foreach collection="param.tenantIdList" item="id" open="(" close=")" separator=",">
+                #{id}
+            </foreach>
+        </if>
+        <if test="param.startDate != null">
+            AND a.`created_time_` <![CDATA[ >= ]]>  #{param.startDate}
+        </if>
+        <if test="param.endDate != null ">
+            AND a.`created_time_` <![CDATA[ <= ]]>  #{param.endDate}
+        </if>
+    </where>
+    </select>
+    
+</mapper>

+ 14 - 3
mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml

@@ -52,6 +52,8 @@
 		<result property="marketPrice" column="market_price_"/>
 		<result property="marketPrice" column="market_price_"/>
 		<result property="enable" column="enable_"/>
 		<result property="enable" column="enable_"/>
 		<result property="code" column="code_"/>
 		<result property="code" column="code_"/>
+		<result property="activityChannel" column="activity_channel_"/>
+		<result property="originalPrice" column="original_price_"/>
 	</resultMap>
 	</resultMap>
 	
 	
 	<!-- 根据主键查询一条记录 -->
 	<!-- 根据主键查询一条记录 -->
@@ -73,13 +75,14 @@
 										single_course_time_,discount_,full_minus_course_times_,give_course_type_,give_category_id_,give_course_num_
 										single_course_time_,discount_,full_minus_course_times_,give_course_type_,give_category_id_,give_course_num_
 										,member_rank_id_,member_time_,give_member_rank_id_,give_member_time_,course_type_,
 										,member_rank_id_,member_time_,give_member_rank_id_,give_member_time_,course_type_,
 		                                activity_type_,give_sign_course_time_,is_pay_to_balance_,teach_mode_,give_teach_mode_,
 		                                activity_type_,give_sign_course_time_,is_pay_to_balance_,teach_mode_,give_teach_mode_,
-		                                period_,give_period_,status_,market_price_,give_allow_online_to_offline_,give_prize_num_)
+		                                period_,give_period_,status_,market_price_,give_allow_online_to_offline_,give_prize_num_,activity_channel_,original_price_)
 		VALUES(#{name},#{description},#{vipGroupCategoryIdList},#{startTime},#{endTime},#{organId},#{coursesStartTime},#{coursesEndTime},
 		VALUES(#{name},#{description},#{vipGroupCategoryIdList},#{startTime},#{endTime},#{organId},#{coursesStartTime},#{coursesEndTime},
 		       now(),now(),#{salarySettlementJson},#{delFlag},#{onlineClassJoinGradientRewards},
 		       now(),now(),#{salarySettlementJson},#{delFlag},#{onlineClassJoinGradientRewards},
 		       #{offlineClassJoinGradientRewards},#{minCourseNum},#{maxCourseNum},#{studentMaxUsedTimes},#{applyToStudentType},#{allowOnlineToOffline},
 		       #{offlineClassJoinGradientRewards},#{minCourseNum},#{maxCourseNum},#{studentMaxUsedTimes},#{applyToStudentType},#{allowOnlineToOffline},
 			   #{singleCourseTime},#{discount},#{fullMinusCourseTimes},#{giveCourseType},#{giveCategoryId},#{giveCourseNum}
 			   #{singleCourseTime},#{discount},#{fullMinusCourseTimes},#{giveCourseType},#{giveCategoryId},#{giveCourseNum}
 				  ,#{memberRankId},#{memberTime},#{giveMemberRankId},#{giveMemberTime},#{courseType},#{activityType},#{giveSingleCourseTime},
 				  ,#{memberRankId},#{memberTime},#{giveMemberRankId},#{giveMemberTime},#{courseType},#{activityType},#{giveSingleCourseTime},
-		       #{isPayToBalance},#{teachMode},#{giveTeachMode},#{periodEnum},#{givePeriodEnum},#{status},#{marketPrice},#{giveAllowOnlineToOffline},#{givePrizeNum})
+		       #{isPayToBalance},#{teachMode},#{giveTeachMode},#{periodEnum},#{givePeriodEnum},#{status},
+		       #{marketPrice},#{giveAllowOnlineToOffline},#{givePrizeNum},#{activityChannel},#{originalPrice})
 	</insert>
 	</insert>
 	
 	
 	<!-- 根据主键查询一条记录 -->
 	<!-- 根据主键查询一条记录 -->
@@ -98,7 +101,9 @@
 		online_class_join_gradient_rewards_=#{onlineClassJoinGradientRewards},
 		online_class_join_gradient_rewards_=#{onlineClassJoinGradientRewards},
 		offline_class_join_gradient_rewards_=#{offlineClassJoinGradientRewards},min_course_num_=#{minCourseNum},
 		offline_class_join_gradient_rewards_=#{offlineClassJoinGradientRewards},min_course_num_=#{minCourseNum},
 		max_course_num_=#{maxCourseNum},student_max_used_times_=#{studentMaxUsedTimes},apply_to_student_type_=#{applyToStudentType},
 		max_course_num_=#{maxCourseNum},student_max_used_times_=#{studentMaxUsedTimes},apply_to_student_type_=#{applyToStudentType},
-		allow_online_to_offline_=#{allowOnlineToOffline},end_time_ = #{endTime},market_price_ = #{marketPrice},update_time_ = NOW(),give_allow_online_to_offline_ = #{giveAllowOnlineToOffline},give_prize_num_ = #{givePrizeNum} WHERE id_ = #{id}
+		allow_online_to_offline_=#{allowOnlineToOffline},end_time_ = #{endTime},market_price_ = #{marketPrice},update_time_ = NOW(),
+		give_allow_online_to_offline_ = #{giveAllowOnlineToOffline},
+		give_prize_num_ = #{givePrizeNum},activity_channel_ = #{activityChannel},original_price_ = #{originalPrice} WHERE id_ = #{id}
 	</update>
 	</update>
 
 
 	<!-- 根据主键删除一条记录 -->
 	<!-- 根据主键删除一条记录 -->
@@ -109,6 +114,9 @@
 	<sql id="queryCondition">
 	<sql id="queryCondition">
 		<where>
 		<where>
 			vga.del_flag_ = 0
 			vga.del_flag_ = 0
+			<if test="activityChannel != null">
+				AND vga.activity_channel_ = #{activityChannel}
+			</if>
 			<if test="courseType != null and courseType != ''">
 			<if test="courseType != null and courseType != ''">
 				AND vga.course_type_ = #{courseType}
 				AND vga.course_type_ = #{courseType}
 			</if>
 			</if>
@@ -207,6 +215,9 @@
 		<if test="activityQueryDto.memberNum == null">
 		<if test="activityQueryDto.memberNum == null">
 			AND ast.member_flag_ = -1
 			AND ast.member_flag_ = -1
 		</if>
 		</if>
+		<if test="activityQueryDto.activityChannel != null">
+			AND vga.activity_channel_ = #{activityQueryDto.activityChannel}
+		</if>
 		ORDER BY vga.create_time_ DESC
 		ORDER BY vga.create_time_ DESC
 	</select>
 	</select>
     <select id="queryNamesById" resultType="java.util.Map">
     <select id="queryNamesById" resultType="java.util.Map">

+ 4 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/controller/BaseController.java

@@ -7,6 +7,7 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.exception.ThirdpartyException;
 import com.ym.mec.thirdparty.exception.ThirdpartyException;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.mec.util.http.HttpUtil;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
@@ -120,6 +121,9 @@ public class BaseController {
 		}catch (Exception exception){
 		}catch (Exception exception){
 			logger.error("System Error", exception);
 			logger.error("System Error", exception);
 		}
 		}
+        if (StringUtils.isNotBlank(ex.getMessage())) {
+            return failed(ex.getMessage());
+        }
 		return failed("系统繁忙");
 		return failed("系统繁忙");
 	}
 	}
 
 

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

@@ -6,6 +6,14 @@ public class Mapper {
 
 
 	private Object value;
 	private Object value;
 
 
+	public Mapper() {
+	}
+
+	public Mapper(Object key, Object value) {
+		this.key = key;
+		this.value = value;
+	}
+
 	public Object getKey() {
 	public Object getKey() {
 		return key;
 		return key;
 	}
 	}

+ 1 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageUtil.java

@@ -22,7 +22,7 @@ public class PageUtil {
     public static <T> Page<T> getPage(Integer page, Integer rows) {
     public static <T> Page<T> getPage(Integer page, Integer rows) {
         Integer pageIndex = Optional.ofNullable(page).orElse(1);
         Integer pageIndex = Optional.ofNullable(page).orElse(1);
         Integer pageSize = Optional.ofNullable(rows).orElse(20);
         Integer pageSize = Optional.ofNullable(rows).orElse(20);
-        return new Page<T>(pageIndex, pageSize);
+        return new Page<>(pageIndex, pageSize);
     }
     }
 
 
     /**
     /**

+ 92 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/page/QueryWrapperUtil.java

@@ -0,0 +1,92 @@
+package com.ym.mec.common.page;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+/**
+ * @author hgw
+ * Created by 2021-12-20
+ */
+public class QueryWrapperUtil<T> {
+
+    private final QueryWrapper<T> queryWrapper;
+
+    private final Predicate<? super Object> predicate = (Predicate<Object>) Objects::nonNull;
+
+    public QueryWrapperUtil() {
+        this.queryWrapper = new QueryWrapper<>();
+    }
+
+    /**
+     * 值如果不为空则添加到查询条件中
+     * 仅支持简单的类型
+     *
+     * @param column 列名称
+     * @param val    值
+     */
+    public QueryWrapperUtil<T> hasEq(String column, String val) {
+        Predicate<? super Object> predicate = (Predicate<Object>) o -> StringUtils.isNotBlank((String) o);
+        queryWrapper.eq(predicate.test(val), column, val);
+        return this;
+    }
+
+    public QueryWrapperUtil<T> hasEq(String column, Object val) {
+        queryWrapper.eq(predicate.test(val), column, val);
+        return this;
+    }
+
+    /**
+     * in 查询
+     *
+     * @param column 列名称
+     * @param val    逗号分开的值
+     */
+    public QueryWrapperUtil<T> hasSplitIn(String column, String val) {
+        if (StringUtils.isNotBlank(val)) {
+            List<String> strings = QueryWrapperUtil.toList(val);
+            if (CollectionUtils.isNotEmpty(strings)) {
+                queryWrapper.in(column, strings);
+            }
+        }
+        return this;
+    }
+
+    /**
+     * 可以当作结束语句
+     * 或者获取QueryWrapper类还可以继续拼接其他条件SQL
+     */
+    public QueryWrapper<T> queryWrapper() {
+        return queryWrapper;
+    }
+
+
+    public static List<String> toList(String key) {
+        return toList(key, ",");
+    }
+
+    public static List<String> toList(String key, String symbol) {
+        return toListOptional(key, symbol)
+                .orElse(null);
+    }
+
+    private static Optional<List<String>> toListOptional(String key, String symbol) {
+        return Optional.ofNullable(key)
+                .filter(StringUtils::isNotBlank)
+                .map(b -> b.split(symbol))
+                .map(QueryWrapperUtil::collectToList)
+                .filter(CollectionUtils::isNotEmpty);
+    }
+
+    private static List<String> collectToList(String[] b) {
+        return Arrays.stream(b).filter(StringUtils::isNotBlank).collect(Collectors.toList());
+    }
+
+}

+ 2 - 0
mec-im/src/main/java/com/ym/common/ApiException.java

@@ -1,5 +1,7 @@
 package com.ym.common;
 package com.ym.common;
 
 
+import com.ym.mec.util.string.MessageFormatter;
+
 /**
 /**
  * Created by weiqinxiao on 2019/2/26.
  * Created by weiqinxiao on 2019/2/26.
  */
  */

+ 1 - 0
mec-im/src/main/java/com/ym/common/ErrorEnum.java

@@ -18,6 +18,7 @@ public enum ErrorEnum {
     ERR_CREATE_ROOM_ERROR(11, "Create room error"),
     ERR_CREATE_ROOM_ERROR(11, "Create room error"),
     ERR_JOIN_ROOM_ERROR(12, "Join room error"),
     ERR_JOIN_ROOM_ERROR(12, "Join room error"),
     JOIN_ROOM_ERROR(35, "加入房间失败,请前往线下教室"),
     JOIN_ROOM_ERROR(35, "加入房间失败,请前往线下教室"),
+    ROOM_NOT_START(36, "网络教室暂未开启,请稍后重试"),
     ERR_MESSAGE_ERROR(13, "IM Message send error"),
     ERR_MESSAGE_ERROR(13, "IM Message send error"),
 
 
 
 

+ 2 - 1
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -153,7 +153,8 @@ public class RoomServiceImpl implements RoomService {
         }
         }
         Date addMinutes = DateUtil.addMinutes(curTime, Integer.parseInt(courseBeforeBufferTime));
         Date addMinutes = DateUtil.addMinutes(curTime, Integer.parseInt(courseBeforeBufferTime));
         if(courseSchedule.getStartClassTime().compareTo(addMinutes) > 0 ){
         if(courseSchedule.getStartClassTime().compareTo(addMinutes) > 0 ){
-            throw new BizException("网络教室暂未开启,请在{}分钟后进入教室",DateUtil.minutesBetween(addMinutes,courseSchedule.getStartClassTime()));
+            throw new ApiException(ErrorEnum.ROOM_NOT_START);
+//            throw new BizException("网络教室暂未开启,请在{}分钟后进入教室",DateUtil.minutesBetween(addMinutes,courseSchedule.getStartClassTime()));
         }
         }
 
 
         //是否是连堂课
         //是否是连堂课

+ 0 - 7
mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java

@@ -14,7 +14,6 @@ import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.PracticeGroupType;
 import com.ym.mec.biz.dal.enums.PracticeGroupType;
 import com.ym.mec.biz.service.PracticeGroupService;
 import com.ym.mec.biz.service.PracticeGroupService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -23,10 +22,8 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.mec.util.http.HttpUtil;
 import com.yonge.log.model.AuditLogAnnotation;
 import com.yonge.log.model.AuditLogAnnotation;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.HttpStatus;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
@@ -62,10 +59,6 @@ public class PracticeGroupController extends BaseController {
     private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
     private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
     @Autowired
     @Autowired
     private StudentDao studentDao;
     private StudentDao studentDao;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
-
-//    private static final Set<Integer> ENABLE_APPLY_ORGANIDS = new HashSet<>(Arrays.asList(new Integer[]{28,34,37}));
 
 
     @ApiOperation("获取学生的陪练课")
     @ApiOperation("获取学生的陪练课")
     @GetMapping(value = "/findUserPracticeCourses")
     @GetMapping(value = "/findUserPracticeCourses")

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

@@ -89,7 +89,7 @@ public class TeacherCourseScheduleController extends BaseController {
             return failed("用户机构信息异常,请联系管理员");
             return failed("用户机构信息异常,请联系管理员");
         }
         }
         SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
         SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
-        SysConfig offlineSignInEarlyForwardTime = sysConfigService.findByParamName(SysConfigService.OFFLINE_SIGN_IN_EARLY_FORWARD_TIME);
+        String offlineSignInEarlyForwardTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_SIGN_IN_EARLY_FORWARD_TIME, user.getTenantId());
         String configValue1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP, user.getTenantId());
         String configValue1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP, user.getTenantId());
         String courseBeforeBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_BEFORE_BUFFER_TIME, user.getTenantId());
         String courseBeforeBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_BEFORE_BUFFER_TIME, user.getTenantId());
         String courseAfterBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_AFTER_BUFFER_TIME, user.getTenantId());
         String courseAfterBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_AFTER_BUFFER_TIME, user.getTenantId());
@@ -98,7 +98,7 @@ public class TeacherCourseScheduleController extends BaseController {
         Map<String,Object> result = new HashMap<>();
         Map<String,Object> result = new HashMap<>();
         result.put("rows",teacherCourseSchedulesWithDate);
         result.put("rows",teacherCourseSchedulesWithDate);
         result.put("appealHoursRange",4);
         result.put("appealHoursRange",4);
-        result.put("offlineSignInEarlyForwardTime", offlineSignInEarlyForwardTime.getParanValue(Integer.class));
+        result.put("offlineSignInEarlyForwardTime", StringUtils.isEmpty(offlineSignInEarlyForwardTime)?60:Integer.parseInt(offlineSignInEarlyForwardTime));
         result.put("enableStudentAttendanceTimeRange",sysConfig.getParanValue(Integer.class));
         result.put("enableStudentAttendanceTimeRange",sysConfig.getParanValue(Integer.class));
         result.put("enableStudentAttendanceTimeRangeVip",StringUtils.isEmpty(configValue1)?0:Integer.parseInt(configValue1));
         result.put("enableStudentAttendanceTimeRangeVip",StringUtils.isEmpty(configValue1)?0:Integer.parseInt(configValue1));
         result.put("joinRoomBeforeTime",StringUtils.isEmpty(configValue)?0:Integer.parseInt(configValue));
         result.put("joinRoomBeforeTime",StringUtils.isEmpty(configValue)?0:Integer.parseInt(configValue));

+ 72 - 0
mec-util/src/main/java/com/ym/mec/util/validator/ValidationKit.java

@@ -0,0 +1,72 @@
+package com.ym.mec.util.validator;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.FieldError;
+
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 个别功能在传参时只需要部分成员变量赋值,但是接收类加入了@Valid的验证,
+ * 从而不得已要在传参时把接收类所有的成员变量都赋值。
+ * 该功能可以让加入了@Valid的验证的接收类中分成员变量没有赋值的时不报出异
+ * 常,只针对你需要的值进行验证再报出异常。
+ *
+ * @author hgw
+ * Created by 2021-12-20
+ */
+public class ValidationKit {
+
+    /**
+     * 校验
+     *
+     * @param result BindingResult
+     * @param fields 只校验的字段
+     */
+    public static void validFields(BindingResult result, String... fields) {
+        if (!result.hasFieldErrors()) {
+            return;
+        }
+        Stream<String> stringStream = result.getFieldErrors().stream()
+                .map(FieldError::getField)
+                .filter(field -> ArrayUtils.contains(fields, field));
+
+        String errorCollect = concat(result, stringStream);
+        if (StringUtils.isNotBlank(errorCollect)) {
+            throw new RuntimeException(errorCollect);
+        }
+    }
+
+    /**
+     * 忽略校验部分字段
+     *
+     * @param result       BindingResult
+     * @param ignoreFields 忽略验证的字段
+     */
+    public static void ignoreFields(BindingResult result, String... ignoreFields) {
+        if (!result.hasFieldErrors()) {
+            return;
+        }
+        Stream<String> stringStream = result.getFieldErrors().stream()
+                .map(FieldError::getField)
+                .filter(field -> !ArrayUtils.contains(ignoreFields, field));
+
+        String errorCollect = concat(result, stringStream);
+        if (StringUtils.isNotBlank(errorCollect)) {
+            throw new RuntimeException(errorCollect);
+        }
+    }
+
+    private static String concat(BindingResult result, Stream<String> stringStream) {
+        return stringStream.filter(f -> Objects.nonNull(result.getFieldError(f)))
+                .map(result::getFieldError)
+                .filter(Objects::nonNull)
+                .map(FieldError::getDefaultMessage)
+                .filter(StringUtils::isNotBlank)
+                .collect(Collectors.joining());
+    }
+
+}

+ 4 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -38,7 +38,10 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                         "/replacementInstrumentActivity/queryReplacementsStat", "/eduStudentRegistration/queryPreApplyList",
                         "/replacementInstrumentActivity/queryReplacementsStat", "/eduStudentRegistration/queryPreApplyList",
                         "/eduSubject/findSubSubjects", "/eduFinancialExpenditure/batchAdd", "/eduSendNotice/*",
                         "/eduSubject/findSubSubjects", "/eduFinancialExpenditure/batchAdd", "/eduSendNotice/*",
                         "/oaContracts/*", "/eduStudent/organStudentOverView", "/activity/countCloudTeacherActive",
                         "/oaContracts/*", "/eduStudent/organStudentOverView", "/activity/countCloudTeacherActive",
-                        "/activity/organDoubleEleven2021Statis", "/activity/doubleEleven2021Statis", "/questionnaireTopic/getDetail", "/questionnaireUserResult/add").permitAll().anyRequest().authenticated().and().httpBasic();
+                        "/activity/organDoubleEleven2021Statis", "/activity/doubleEleven2021Statis", "/questionnaireTopic/getDetail", "/questionnaireUserResult/add",
+                        "/tenantInfo/info/*","/tenantInfo/pay/*","/tenantInfo/notify"
+                )
+                .permitAll().anyRequest().authenticated().and().httpBasic();
     }
     }
 
 
     @Override
     @Override

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

@@ -88,6 +88,14 @@ public class OrganizationController extends BaseController {
         return succeed(organizationService.get(id));
         return succeed(organizationService.get(id));
     }
     }
 
 
+    @ApiOperation(value = "根据分部角色列表map")
+    @GetMapping("/getOrganRole")
+    @PreAuthorize("@pcs.hasPermissions('organization/getOrganRole')")
+    @ApiParam(value = "分部编号", required = true)
+    public Object getOrganRole(Integer id){
+        return succeed(organizationService.getOrganRole(id));
+    }
+
     @ApiOperation(value = "获取用户所在分部的年级列表)")
     @ApiOperation(value = "获取用户所在分部的年级列表)")
     @GetMapping("/getGradeList")
     @GetMapping("/getGradeList")
     @PreAuthorize("@pcs.hasPermissions('organization/getGradeList')")
     @PreAuthorize("@pcs.hasPermissions('organization/getGradeList')")

+ 62 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysManualController.java

@@ -0,0 +1,62 @@
+package com.ym.mec.web.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ym.mec.biz.dal.entity.SysManual;
+import com.ym.mec.biz.dal.page.SysManualQueryInfo;
+import com.ym.mec.biz.service.SysManualService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.ym.mec.common.controller.BaseController;
+
+/**
+ * (SysManual)表控制层
+ *
+ * @author makejava
+ * @since 2021-12-20 14:23:36
+ */
+@RestController
+@Api(tags = "帮助手册")
+@RequestMapping("/sysManual")
+public class SysManualController extends BaseController {
+    /**
+     * 服务对象
+     */
+    @Autowired
+    private SysManualService sysManualService;
+
+
+    @ApiOperation(value = "查询操作手册")
+    @GetMapping("/list")
+    public Object list(SysManualQueryInfo queryInfo) {
+        if (queryInfo.getMenuId() != 0) {
+            return succeed(sysManualService.list(new QueryWrapper<SysManual>().eq("menu_id_", queryInfo.getMenuId())));
+        } else {
+            return succeed(sysManualService.list(new QueryWrapper<SysManual>()));
+        }
+    }
+
+    @ApiOperation(value = "新增帮助手册")
+    @PostMapping("/add")
+    public Object add(@RequestBody SysManual sysManual) throws Exception{
+        sysManualService.save(sysManual);
+        return succeed();
+    }
+
+    @ApiOperation(value = "修改帮助手册")
+    @PostMapping("/update")
+    public Object update(@RequestBody SysManual sysManual) throws Exception{
+        sysManualService.updateById(sysManual);
+        return succeed();
+    }
+
+    @ApiOperation(value = "删除帮助手册")
+    @PostMapping("/remove")
+    public Object remove(@RequestBody SysManual sysManual) throws Exception{
+        sysManualService.removeById(sysManual.getId());
+        return succeed();
+    }
+
+}

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

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.yonge.log.model.AuditLogAnnotation;
 import com.yonge.log.model.AuditLogAnnotation;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -48,4 +49,11 @@ public class SysTenantConfigController extends BaseController {
 		sysTenantConfigService.batchUpSet(sysConfigs,sysUser.getTenantId());
 		sysTenantConfigService.batchUpSet(sysConfigs,sysUser.getTenantId());
 		return succeed();
 		return succeed();
 	}
 	}
+
+	@ApiOperation(value = "获取单个配置")
+	@PostMapping(value = "findByName")
+    @PreAuthorize("@pcs.hasPermissions('sysTenantConfig/findByName')")
+	public Object findByName(String configName) {
+		return succeed(sysTenantConfigService.getTenantConfigValue(configName,TenantContextHolder.getTenantId()));
+	}
 }
 }

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

@@ -477,10 +477,10 @@ public class TaskController extends BaseController {
 	@ApiOperation("每天10点推送排课、续费提醒")
 	@ApiOperation("每天10点推送排课、续费提醒")
 	@GetMapping(value = "/musicSchoolTermPush")
 	@GetMapping(value = "/musicSchoolTermPush")
 	public void musicSchoolTermPush() {
 	public void musicSchoolTermPush() {
-		Object o = redisCache.get("musicSchoolTermPush");
-		if(o != null){
-			return;
-		}
+//		Object o = redisCache.get("musicSchoolTermPush");
+//		if(o != null){
+//			return;
+//		}
 		List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
 		List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
 		if(tenantInfos != null && tenantInfos.size() > 0){
 		if(tenantInfos != null && tenantInfos.size() > 0){
 			for (TenantInfo tenantInfo : tenantInfos) {
 			for (TenantInfo tenantInfo : tenantInfos) {

+ 18 - 5
mec-web/src/main/java/com/ym/mec/web/controller/TenantInfoController.java

@@ -3,9 +3,12 @@ package com.ym.mec.web.controller;
 import com.ym.mec.biz.dal.dto.TenantInfoDto;
 import com.ym.mec.biz.dal.dto.TenantInfoDto;
 import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.thirdparty.yqpay.Msg;
+import com.ym.mec.util.validator.ValidationKit;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.validation.Valid;
 import javax.validation.Valid;
@@ -25,7 +28,7 @@ public class TenantInfoController extends BaseController {
 
 
     @ApiOperation("添加机构信息")
     @ApiOperation("添加机构信息")
     @PostMapping(value = "/add")
     @PostMapping(value = "/add")
-//    @PreAuthorize("@pcs.hasPermissions('tenantInfo/add')")
+    @PreAuthorize("@pcs.hasPermissions('tenantInfo/add')")
     public Object addTenantInfo(@Valid @RequestBody TenantInfoDto dto) {
     public Object addTenantInfo(@Valid @RequestBody TenantInfoDto dto) {
         tenantInfoService.addTenantInfo(dto);
         tenantInfoService.addTenantInfo(dto);
         return succeed();
         return succeed();
@@ -34,14 +37,15 @@ public class TenantInfoController extends BaseController {
     @ApiOperation("修改机构信息")
     @ApiOperation("修改机构信息")
     @PostMapping(value = "/update")
     @PostMapping(value = "/update")
     @PreAuthorize("@pcs.hasPermissions('tenantInfo/update')")
     @PreAuthorize("@pcs.hasPermissions('tenantInfo/update')")
-    public Object updateTenantInfo(@Valid @RequestBody TenantInfoDto dto) {
+    public Object updateTenantInfo(@Valid @RequestBody TenantInfoDto dto, BindingResult bindingResult) {
+        ValidationKit.ignoreFields(bindingResult, "productInfo", "config");
         tenantInfoService.updateTenantInfo(dto);
         tenantInfoService.updateTenantInfo(dto);
         return succeed();
         return succeed();
     }
     }
 
 
     @ApiOperation("修改机构启用停用状态")
     @ApiOperation("修改机构启用停用状态")
     @GetMapping(value = "/opsState/{id}")
     @GetMapping(value = "/opsState/{id}")
-    @PreAuthorize("@pcs.hasPermissions('tenantInfo/opsState')")
+//    @PreAuthorize("@pcs.hasPermissions('tenantInfo/opsState')")
     public Object opsState(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id, Integer state) {
     public Object opsState(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id, Integer state) {
         tenantInfoService.opsTenantState(id, state);
         tenantInfoService.opsTenantState(id, state);
         return succeed();
         return succeed();
@@ -49,12 +53,10 @@ public class TenantInfoController extends BaseController {
 
 
     @ApiOperation("查询单个机构详情")
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/info/{id}")
     @GetMapping(value = "/info/{id}")
-    @PreAuthorize("@pcs.hasPermissions('tenantInfo/info')")
     public Object queryTenantInfo(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {
     public Object queryTenantInfo(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {
         return succeed(tenantInfoService.queryTenantInfo(id));
         return succeed(tenantInfoService.queryTenantInfo(id));
     }
     }
 
 
-
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "search", dataType = "String", value = "关键字"),
             @ApiImplicitParam(name = "search", dataType = "String", value = "关键字"),
             @ApiImplicitParam(name = "createdName", dataType = "String", value = "创建人"),
             @ApiImplicitParam(name = "createdName", dataType = "String", value = "创建人"),
@@ -72,4 +74,15 @@ public class TenantInfoController extends BaseController {
         return succeed(tenantInfoService.queryPage(param));
         return succeed(tenantInfoService.queryPage(param));
     }
     }
 
 
+    @ApiOperation("机构支付")
+    @GetMapping(value = "/pay/{id}")
+    public Object pay(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) throws Exception {
+        return succeed(tenantInfoService.pay(id));
+    }
+
+    @PostMapping("/notify")
+    public Msg notify(@ModelAttribute Msg msg) throws Exception {
+        return tenantInfoService.orderNotify(msg);
+    }
+
 }
 }

+ 40 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TenantOrderRecordController.java

@@ -0,0 +1,40 @@
+package com.ym.mec.web.controller;
+
+
+import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
+import com.ym.mec.biz.dal.entity.TenantOrderRecord;
+import com.ym.mec.biz.service.TenantOrderRecordService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 机构付款记录表(TenantOrderRecord)表控制层
+ *
+ * @author hgw
+ * @since 2021-12-20 10:08:27
+ */
+@RestController
+@Api(tags = "机构付款记录")
+@RequestMapping("/tenantOrderRecord")
+public class TenantOrderRecordController extends BaseController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private TenantOrderRecordService tenantOrderRecordService;
+
+    @ApiOperation("分页查询")
+    @PostMapping(value = "/queryPage")
+    public Object queryPage(@RequestBody TenantOrderRecordDto dto) {
+        return tenantOrderRecordService.queryPage(dto);
+    }
+
+}
+