diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 4a473df..042973b 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -15,6 +15,33 @@
web服务入口
+
+ 1.8
+ UTF-8
+ UTF-8
+
+ 1.0-SNAPSHOT
+ 1.0-SNAPSHOT
+ 1.0-SNAPSHOT
+ 1.0-SNAPSHOT
+ 2.1.10.RELEASE
+ 3.3.0
+ 8.0.16
+ 1.18.10
+ 3.9
+ 2.6
+ 1.0.11.RELEASE
+ 3.2.2
+ 30.1.1-jre
+ 2.9.10
+ 1.19
+ 2.2.6
+ 4.5.2
+ 4.6.0
+ 2.5.0
+ 1.4.7
+
+
@@ -37,7 +64,7 @@
1.6.2
-
+
mysql
mysql-connector-java
@@ -98,6 +125,46 @@
dysmsapi20170525
true
+
+
+ joda-time
+ joda-time
+
+
+
+ com.alibaba
+ easyexcel
+
+
+ com.alibaba
+ fastjson
+
+
+ ${easyexcel.version}
+
+
+
+ com.github.ben-manes.caffeine
+ caffeine
+
+
+
+ com.github.binarywang
+ weixin-java-cp
+ ${weixin-java-binarywang.version}
+
+
+
+ com.github.binarywang
+ weixin-java-miniapp
+ 4.6.0
+
+
+
+ com.belerweb
+ pinyin4j
+ ${pinyin4j.version}
+
@@ -117,15 +184,15 @@
-
- org.apache.maven.plugins
- maven-war-plugin
- 3.1.0
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.1.0
false
${project.artifactId}
-
-
+
+
${project.artifactId}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/BusinessServerApplication.java b/ruoyi-admin/src/main/java/cn/xluobo/BusinessServerApplication.java
new file mode 100644
index 0000000..b32104f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/BusinessServerApplication.java
@@ -0,0 +1,25 @@
+package cn.xluobo;
+
+import cn.xluobo.config.properties.AddressProperties;
+import cn.xluobo.config.properties.UploadConfigProperties;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+import java.net.UnknownHostException;
+
+@SpringBootApplication
+@EnableConfigurationProperties({UploadConfigProperties.class, AddressProperties.class})
+@EnableScheduling
+@EnableAsync
+public class BusinessServerApplication {
+
+ public static void main(String[] args) throws UnknownHostException {
+ SpringApplication.run(BusinessServerApplication.class, args);
+ }
+
+}
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/OauthServerApplication.java b/ruoyi-admin/src/main/java/cn/xluobo/OauthServerApplication.java
new file mode 100644
index 0000000..d5b8b27
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/OauthServerApplication.java
@@ -0,0 +1,21 @@
+package cn.xluobo;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import java.net.UnknownHostException;
+
+@SpringBootApplication(scanBasePackages = {"cn.xluobo","cn.jljiayu"})
+@EnableTransactionManagement
+@MapperScan(value = {"cn.xluobo.*.*.*.repo.mapper"})
+public class OauthServerApplication {
+
+ public static void main(String[] args) throws UnknownHostException {
+ SpringApplication.run(OauthServerApplication.class, args);
+ }
+
+}
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/domain/req/ReqSearchAdIntentionOrder.java b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/domain/req/ReqSearchAdIntentionOrder.java
new file mode 100644
index 0000000..eec58a7
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/domain/req/ReqSearchAdIntentionOrder.java
@@ -0,0 +1,19 @@
+package cn.xluobo.business.ad.intention.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchAdIntentionOrder extends ReqPageBase implements Serializable {
+ private String orgName;
+ private String contact;
+ private String contactPhone;
+ private String accountOpen;
+ private String hadDeal;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/enums/DealResultTypeEnum.java b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/enums/DealResultTypeEnum.java
new file mode 100644
index 0000000..0ccde9d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/enums/DealResultTypeEnum.java
@@ -0,0 +1,29 @@
+package cn.xluobo.business.ad.intention.enums;
+
+/**
+ * 试用申请处理结果类型
+ * 2022/3/21 12:23 下午
+ *
+ * @author zhangby
+ **/
+public enum DealResultTypeEnum {
+
+ OPEN_ACCOUNT("01", "开通试用账号"),
+ WAIT("02", "犹豫"),
+ NOT_TRIAL("03", "产品不适用"),
+ OTHER("99", "其他"),
+ ;
+
+ private String value;
+
+ private String text;
+
+ DealResultTypeEnum(String value, String text) {
+ this.value = value;
+ this.text = text;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/mapper/AdIntentionOrderMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/mapper/AdIntentionOrderMapper.java
new file mode 100644
index 0000000..9cfe0c0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/mapper/AdIntentionOrderMapper.java
@@ -0,0 +1,15 @@
+package cn.xluobo.business.ad.intention.repo.mapper;
+
+import cn.xluobo.business.ad.intention.repo.model.AdIntentionOrder;
+
+/**
+ *
+ * 申请试用表 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2022-03-13 09:43:27
+ */
+public interface AdIntentionOrderMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/mapping/AdIntentionOrderMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/mapping/AdIntentionOrderMapper.xml
new file mode 100644
index 0000000..e8e1d41
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/mapping/AdIntentionOrderMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/model/AdIntentionOrder.java b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/model/AdIntentionOrder.java
new file mode 100644
index 0000000..140048e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/repo/model/AdIntentionOrder.java
@@ -0,0 +1,109 @@
+package cn.xluobo.business.ad.intention.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 申请试用表
+ *
+ *
+ * @author zhangby
+ * @since 2022-03-13 09:43:27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("ad_intention_order")
+public class AdIntentionOrder implements Serializable {
+
+
+ @TableId(value = "order_id", type = IdType.ASSIGN_ID)
+ private String orderId;
+
+ /**
+ * 机构名称
+ */
+ @TableField("org_name")
+ private String orgName;
+
+ /**
+ * 联系人
+ */
+ @TableField("contact")
+ private String contact;
+
+ /**
+ * 联系电话
+ */
+ @TableField("contact_phone")
+ private String contactPhone;
+
+ /**
+ * 申请时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 申请试用说明
+ */
+ @TableField("intention_memo")
+ private String intentionMemo;
+
+ /**
+ * 是否开通账号1开通 0未开通
+ */
+ @TableField("account_open")
+ private Integer accountOpen;
+
+ /**
+ * 是否已处理完毕 1已处理 0未处理
+ */
+ @TableField("had_deal")
+ private Integer hadDeal;
+
+ /**
+ * 处理结果类型
+ */
+ @TableField("deal_result_type")
+ private String dealResultType;
+
+ /**
+ * 处理结果
+ */
+ @TableField("deal_result")
+ private String dealResult;
+
+ /**
+ * 处理时间
+ */
+ @TableField("deal_time")
+ private Date dealTime;
+
+ /**
+ * 账号信息
+ */
+ @TableField("user_id")
+ private String userId;
+
+ /**
+ * 账号信息
+ */
+ @TableField("user_name")
+ private String userName;
+
+ /**
+ * 账号开通时间
+ */
+ @TableField("account_open_date")
+ private Date accountOpenDate;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/service/IAdIntentionOrderService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/service/IAdIntentionOrderService.java
new file mode 100644
index 0000000..6e04894
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/service/IAdIntentionOrderService.java
@@ -0,0 +1,15 @@
+package cn.xluobo.business.ad.intention.service;
+
+import cn.xluobo.business.ad.intention.repo.model.AdIntentionOrder;
+
+/**
+ *
+ * 申请试用表 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2022-03-13 09:43:27
+ */
+public interface IAdIntentionOrderService extends com.baomidou.mybatisplus.extension.service.IService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/service/impl/AdIntentionOrderServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/service/impl/AdIntentionOrderServiceImpl.java
new file mode 100644
index 0000000..2937a4e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/ad/intention/service/impl/AdIntentionOrderServiceImpl.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.ad.intention.service.impl;
+
+import cn.xluobo.business.ad.intention.repo.mapper.AdIntentionOrderMapper;
+import cn.xluobo.business.ad.intention.repo.model.AdIntentionOrder;
+import cn.xluobo.business.ad.intention.service.IAdIntentionOrderService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 申请试用表 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2022-03-13 09:43:27
+ */
+@Service
+public class AdIntentionOrderServiceImpl extends ServiceImpl implements IAdIntentionOrderService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/enums/BusinessTableEnums.java b/ruoyi-admin/src/main/java/cn/xluobo/business/enums/BusinessTableEnums.java
new file mode 100644
index 0000000..352eef5
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/enums/BusinessTableEnums.java
@@ -0,0 +1,71 @@
+package cn.xluobo.business.enums;
+
+/**
+ * 表枚举
+ */
+public enum BusinessTableEnums {
+
+ SYS_USER("sys_user","系统用户"),
+ SYS_STAFF("sys_staff","员工表",true),
+ SYS_DEPT("sys_dept","部门",true),
+
+ SYS_TAG("sys_tag","标签",true),
+
+ SYS_RECEIPT_ACCOUNT("sys_receipt_account","机构收费账户",true),
+
+ SC_SCHOOL("sc_school","学校",true),
+ SC_ROOM("sc_room","教室",true),
+ SC_TEACHER("sc_teacher","教师",true),
+ SC_COURSE("sc_course","课程",true),
+ SC_COURSE_CLA("sc_course_cla","课程班级",true),
+ SC_STUDENT("sc_student","学生",true),
+ SC_COURSE_TYPE("sc_course_type","课程类型",true),
+ SC_ORDER("sc_order","订单",true),
+ SC_STUDENT_ACCOUNT("sc_student_account","学生余额账户",true),
+ SC_STUDENT_COURSE("sc_student_course","学生报读课程",true),
+ SC_STUDENT_COURSE_LOG("sc_student_course_log","学生日志",true),
+
+ STOCK_GOODS("stock_goods","商品信息",true),
+ STOCK_INFO("stock_info","库存信息",true),
+
+ WECHAT_CP_ACCOUNT("wechat_cp_account","企业应用信息",true),
+ WECHAT_CP_CONTACT("wechat_cp_contact","企业外部联系人",true),
+ WECHAT_CP_CONTACT_WAY("wechat_cp_contact_way","企业客户联系我",true),
+ WECHAT_CP_GROUP("wechat_cp_group","企业标签组",true),
+ WECHAT_CP_GROUP_TAG("wechat_cp_group_tag","企业标签",true),
+ WECHAT_CP_USER("wechat_cp_user","企业通讯录",true),
+
+ ;
+
+ private String table;
+
+ private String tableName;
+
+ /**
+ * 是否为多租户 table
+ */
+ private boolean isTenant = false;
+
+ BusinessTableEnums(String table, String tableName) {
+ this.table = table;
+ this.tableName = tableName;
+ }
+
+ BusinessTableEnums(String table, String tableName, boolean isTenant) {
+ this.table = table;
+ this.tableName = tableName;
+ this.isTenant = isTenant;
+ }
+
+ public String getTable() {
+ return table;
+ }
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public boolean isTenant() {
+ return isTenant;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountCourseMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountCourseMapper.java
new file mode 100644
index 0000000..5ed8bd9
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountCourseMapper.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.repo.mapper;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountCourse;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 活动课程 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface MkDiscountCourseMapper extends BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountDeptMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountDeptMapper.java
new file mode 100644
index 0000000..dd4121d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountDeptMapper.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.repo.mapper;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountDept;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 活动校区 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface MkDiscountDeptMapper extends BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountDetailMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountDetailMapper.java
new file mode 100644
index 0000000..1196ba5
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountDetailMapper.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.repo.mapper;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 优惠配置明细 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface MkDiscountDetailMapper extends BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountMapper.java
new file mode 100644
index 0000000..23ace69
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapper/MkDiscountMapper.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.repo.mapper;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 优惠配置 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface MkDiscountMapper extends BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountCourseMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountCourseMapper.xml
new file mode 100644
index 0000000..2aaf39f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountCourseMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountDeptMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountDeptMapper.xml
new file mode 100644
index 0000000..1f7fef4
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountDeptMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountDetailMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountDetailMapper.xml
new file mode 100644
index 0000000..0d3173b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountDetailMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountMapper.xml
new file mode 100644
index 0000000..60cdfb4
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/mapping/MkDiscountMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscount.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscount.java
new file mode 100644
index 0000000..51bb95b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscount.java
@@ -0,0 +1,103 @@
+package cn.xluobo.business.mk.discount.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 优惠配置
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("mk_discount")
+public class MkDiscount implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 优惠编号
+ */
+ @TableId(value = "discount_id", type = IdType.ASSIGN_ID)
+ private Long discountId;
+
+ /**
+ * 所属租户
+ */
+ @TableField("tenant_id")
+ private String tenantId;
+
+ /**
+ * 活动名称
+ */
+ @TableField("activity_name")
+ private String activityName;
+
+ /**
+ * 折扣类型 1满减 2满折 3满赠
+ */
+ @TableField("discount_type")
+ private String discountType;
+
+ /**
+ * 折扣开始时间
+ */
+ @TableField("begin_date")
+ private Date beginDate;
+
+ /**
+ * 结束时间
+ */
+ @TableField("end_date")
+ private Date endDate;
+
+ /**
+ * 是否生效
+ */
+ @TableField("enable")
+ private Integer enable;
+
+ /**
+ * 版本号
+ */
+ @TableField("version")
+ private Integer version;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private String createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private String lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountCourse.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountCourse.java
new file mode 100644
index 0000000..dd6aab1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountCourse.java
@@ -0,0 +1,40 @@
+package cn.xluobo.business.mk.discount.repo.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ *
+ * 活动课程
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("mk_discount_course")
+public class MkDiscountCourse implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 折扣编号
+ */
+ @TableField("discount_id")
+ private Long discountId;
+
+ /**
+ * 课程 -1为全部课程
+ */
+ @TableField("course_id")
+ private Long courseId;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountDept.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountDept.java
new file mode 100644
index 0000000..3a7e7c1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountDept.java
@@ -0,0 +1,40 @@
+package cn.xluobo.business.mk.discount.repo.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ *
+ * 活动校区
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("mk_discount_dept")
+public class MkDiscountDept implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 折扣编号
+ */
+ @TableField("discount_id")
+ private Long discountId;
+
+ /**
+ * 校区 -1为全部校区
+ */
+ @TableField("dept_id")
+ private Long deptId;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountDetail.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountDetail.java
new file mode 100644
index 0000000..a59a617
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/repo/model/MkDiscountDetail.java
@@ -0,0 +1,55 @@
+package cn.xluobo.business.mk.discount.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *
+ * 优惠配置明细
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("mk_discount_detail")
+public class MkDiscountDetail implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 明细编号
+ */
+ @TableId(value = "discount_detail_id", type = IdType.ASSIGN_ID)
+ private Long discountDetailId;
+
+ /**
+ * 折扣编号
+ */
+ @TableField("discount_id")
+ private Long discountId;
+
+ /**
+ * 满足条件 金额/课时
+ */
+ @TableField("meet_condition")
+ private BigDecimal meetCondition;
+
+ /**
+ * 赠送 金额/折扣/课时
+ */
+ @TableField("gift")
+ private BigDecimal gift;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountCourseService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountCourseService.java
new file mode 100644
index 0000000..2fe4c0a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountCourseService.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.service;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountCourse;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 活动课程 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface IMkDiscountCourseService extends IService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountDeptService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountDeptService.java
new file mode 100644
index 0000000..c2ed19d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountDeptService.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.service;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountDept;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 活动校区 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface IMkDiscountDeptService extends IService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountDetailService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountDetailService.java
new file mode 100644
index 0000000..27eeb23
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountDetailService.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.service;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 优惠配置明细 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface IMkDiscountDetailService extends IService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountService.java
new file mode 100644
index 0000000..6900af5
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/IMkDiscountService.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.mk.discount.service;
+
+import cn.xluobo.business.mk.discount.repo.model.MkDiscount;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 优惠配置 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface IMkDiscountService extends IService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountCourseServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountCourseServiceImpl.java
new file mode 100644
index 0000000..83ed856
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountCourseServiceImpl.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.mk.discount.service.impl;
+
+import cn.xluobo.business.mk.discount.repo.mapper.MkDiscountCourseMapper;
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountCourse;
+import cn.xluobo.business.mk.discount.service.IMkDiscountCourseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 活动课程 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Service
+public class MkDiscountCourseServiceImpl extends ServiceImpl implements IMkDiscountCourseService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountDeptServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountDeptServiceImpl.java
new file mode 100644
index 0000000..ec61b63
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountDeptServiceImpl.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.mk.discount.service.impl;
+
+import cn.xluobo.business.mk.discount.repo.mapper.MkDiscountDeptMapper;
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountDept;
+import cn.xluobo.business.mk.discount.service.IMkDiscountDeptService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 活动校区 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Service
+public class MkDiscountDeptServiceImpl extends ServiceImpl implements IMkDiscountDeptService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountDetailServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountDetailServiceImpl.java
new file mode 100644
index 0000000..3a1d67c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountDetailServiceImpl.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.mk.discount.service.impl;
+
+import cn.xluobo.business.mk.discount.repo.mapper.MkDiscountDetailMapper;
+import cn.xluobo.business.mk.discount.repo.model.MkDiscountDetail;
+import cn.xluobo.business.mk.discount.service.IMkDiscountDetailService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 优惠配置明细 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Service
+public class MkDiscountDetailServiceImpl extends ServiceImpl implements IMkDiscountDetailService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountServiceImpl.java
new file mode 100644
index 0000000..fa7ae2a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/mk/discount/service/impl/MkDiscountServiceImpl.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.mk.discount.service.impl;
+
+import cn.xluobo.business.mk.discount.repo.mapper.MkDiscountMapper;
+import cn.xluobo.business.mk.discount.repo.model.MkDiscount;
+import cn.xluobo.business.mk.discount.service.IMkDiscountService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 优惠配置 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Service
+public class MkDiscountServiceImpl extends ServiceImpl implements IMkDiscountService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/controller/AnalysisReportController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/controller/AnalysisReportController.java
new file mode 100644
index 0000000..8bf8196
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/controller/AnalysisReportController.java
@@ -0,0 +1,35 @@
+package cn.xluobo.business.report.analysis.controller;
+
+import cn.xluobo.business.report.analysis.domain.resp.RespMonthCourseOrderFee;
+import cn.xluobo.business.report.analysis.service.AnalysisReportService;
+import cn.xluobo.business.sc.order.domain.req.ReqReportMonthCourseIncome;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/24 19:12
+ */
+@RestController
+@RequestMapping("/api/report/analysis")
+public class AnalysisReportController {
+
+ @Autowired
+ private AnalysisReportService analysisReportService;
+
+ /**
+ * 月份课程 营业收入报表
+ * @return
+ */
+ @GetMapping("/monthCourseOrderFeeReport")
+ public APIResponse monthCourseOrderFeeReport(ReqReportMonthCourseIncome reqReportMonthCourseIncome) {
+ List courseOrderFeeList = analysisReportService.monthCourseOrderFeeReport(reqReportMonthCourseIncome);
+ return APIResponse.toAPIResponse(courseOrderFeeList);
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/domain/resp/RespMonthCourseOrderFee.java b/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/domain/resp/RespMonthCourseOrderFee.java
new file mode 100644
index 0000000..c3fcbdd
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/domain/resp/RespMonthCourseOrderFee.java
@@ -0,0 +1,29 @@
+package cn.xluobo.business.report.analysis.domain.resp;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 月份课程 营业收入
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/24 19:27
+ */
+@Data
+public class RespMonthCourseOrderFee {
+
+ private Integer id;
+
+ private String month;
+
+ private Long courseId;
+
+ private String courseName;
+
+ private BigDecimal income;
+
+ private List children;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/service/AnalysisReportService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/service/AnalysisReportService.java
new file mode 100644
index 0000000..38608b7
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/report/analysis/service/AnalysisReportService.java
@@ -0,0 +1,99 @@
+package cn.xluobo.business.report.analysis.service;
+
+import cn.xluobo.business.report.analysis.domain.resp.RespMonthCourseOrderFee;
+import cn.xluobo.business.sc.order.domain.req.ReqReportMonthCourseIncome;
+import cn.xluobo.business.sc.order.domain.resp.RespReportMonthCourseIncome;
+import cn.xluobo.business.sc.order.repo.mapper.OrderReportMapper;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/24 19:12
+ */
+@Service
+public class AnalysisReportService {
+
+ @Autowired
+ private OrderReportMapper orderReportMapper;
+
+
+ /**
+ * 月份课程 营业收入报表
+ *
+ * @return
+ */
+ public List monthCourseOrderFeeReport(ReqReportMonthCourseIncome reqReportMonthCourseIncome) {
+ // 查询db 按月、课程 收入情况
+ List monthCourseIncomeList = orderReportMapper.selectMonthCourseIncomeList(reqReportMonthCourseIncome);
+
+ // 月份对应数据
+ Map> monthMap = Maps.newHashMap();
+ for (RespReportMonthCourseIncome respReportMonthCourseIncome : monthCourseIncomeList) {
+ String month = respReportMonthCourseIncome.getMonth();
+ if (monthMap.containsKey(month)) {
+ monthMap.get(month).add(respReportMonthCourseIncome);
+ } else {
+ ArrayList incomeArrayList = Lists.newArrayList(respReportMonthCourseIncome);
+ monthMap.put(month, incomeArrayList);
+ }
+ }
+
+ // 返回结果 月份下 包含各课程收入
+ List courseOrderFeeList = Lists.newArrayList();
+
+ monthMap.forEach((month, value) -> {
+
+ // 一个月份 各课程收入
+ List childrenList = Lists.newArrayList();
+
+ BigDecimal totalFee = BigDecimal.ZERO;
+
+ for (int i = 0; i < value.size(); i++) {
+ RespReportMonthCourseIncome respReportMonthCourseIncome = value.get(i);
+ totalFee = totalFee.add(respReportMonthCourseIncome.getFee());
+
+ RespMonthCourseOrderFee item = new RespMonthCourseOrderFee();
+ item.setId(Integer.parseInt(month + (i + 1)));
+ item.setCourseId(respReportMonthCourseIncome.getCourseId());
+ item.setCourseName(respReportMonthCourseIncome.getCourseName());
+ item.setIncome(respReportMonthCourseIncome.getFee());
+
+ childrenList.add(item);
+ }
+
+ childrenList.sort((o1, o2) -> {
+ BigDecimal incomeBefore = o1.getIncome();
+ BigDecimal incomeAfter = o2.getIncome();
+ return incomeBefore.compareTo(incomeAfter);
+ });
+
+
+ // 月份 总收入
+ RespMonthCourseOrderFee orderFee = new RespMonthCourseOrderFee();
+ orderFee.setId(Integer.parseInt(month));
+ orderFee.setMonth(month);
+ orderFee.setIncome(totalFee);
+ orderFee.setChildren(childrenList);
+
+ // 单条记录
+ courseOrderFeeList.add(orderFee);
+ });
+
+ courseOrderFeeList.sort((o1, o2) -> {
+ int before = Integer.parseInt(o1.getMonth());
+ int after = Integer.parseInt(o2.getMonth());
+ return before- after;
+ });
+
+ return courseOrderFeeList;
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/controller/DashboardController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/controller/DashboardController.java
new file mode 100644
index 0000000..77d44fe
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/controller/DashboardController.java
@@ -0,0 +1,32 @@
+package cn.xluobo.business.report.dashboard.controller;
+
+import cn.xluobo.business.report.dashboard.domain.resp.DashboardData;
+import cn.xluobo.business.report.dashboard.service.DashboardService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/18 15:31
+ */
+@RestController
+@RequestMapping("/api/report/dashboard")
+public class DashboardController {
+
+ @Autowired
+ private DashboardService dashboardService;
+
+ /**
+ * 首页各数据项
+ * @return
+ */
+ @GetMapping("/data")
+ public APIResponse dashboardData() {
+ DashboardData dashboardData = dashboardService.dashboardData();
+ return APIResponse.toAPIResponse(dashboardData);
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/domain/resp/DashboardData.java b/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/domain/resp/DashboardData.java
new file mode 100644
index 0000000..efc8081
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/domain/resp/DashboardData.java
@@ -0,0 +1,58 @@
+package cn.xluobo.business.report.dashboard.domain.resp;
+
+import lombok.Builder;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/18 15:35
+ */
+@Data
+@Builder
+public class DashboardData {
+
+ // 今日排课数量
+ private Integer todayClaTimeCnt;
+
+ // 今日已上课数量
+ private Integer completeTodayClaTimeCnt;
+
+ // 今日报名
+ private Integer todayOrderCnt;
+
+ // 本月报名
+ private Integer thisMonthOrderCnt;
+
+ // 今日上课实到课人次
+ private Integer todayRealAttendCnt;
+
+ // 今日上课应到人次
+ private Integer todayNeedAttendCnt;
+
+ // 今日应消课时
+ private BigDecimal todayNeedCostHour;
+
+ // 今日实消课时
+ private BigDecimal todayRealCostHour;
+
+ // 学员数量
+ private Integer studentCnt;
+
+ // 班级数量
+ private Integer claCnt;
+
+ // 课程数量
+ private Integer courseCnt;
+
+ // 欠费学员数量
+ private Integer arrearsStudentCnt;
+
+ // 按期缴费 即将过期人数
+ private Integer dateWillExpireCnt;
+
+ // 按课时缴费 即将过期 数量
+ private Integer hourWillExpireCnt;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/service/DashboardService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/service/DashboardService.java
new file mode 100644
index 0000000..b4641d4
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/report/dashboard/service/DashboardService.java
@@ -0,0 +1,91 @@
+package cn.xluobo.business.report.dashboard.service;
+
+import cn.xluobo.business.report.dashboard.domain.resp.DashboardData;
+import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
+import cn.xluobo.business.sc.course.repo.enums.ClaTimeAttendStatusEnums;
+import cn.xluobo.business.sc.course.service.IScClaTimeAttendService;
+import cn.xluobo.business.sc.course.service.IScClaTimeService;
+import cn.xluobo.business.sc.course.service.IScCourseClaService;
+import cn.xluobo.business.sc.course.service.IScCourseService;
+import cn.xluobo.business.sc.order.enums.OrderTypeEnum;
+import cn.xluobo.business.sc.order.service.IScOrderService;
+import cn.xluobo.business.sc.student.service.IScStudentCourseService;
+import cn.xluobo.business.sc.student.service.IScStudentService;
+import org.joda.time.DateTime;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/18 15:34
+ */
+@Service
+@Transactional
+public class DashboardService {
+
+ @Autowired
+ private IScCourseClaService claService;
+ @Autowired
+ private IScCourseService courseService;
+ @Autowired
+ private IScStudentService studentService;
+ @Autowired
+ private IScClaTimeAttendService attendService;
+ @Autowired
+ private IScOrderService orderService;
+ @Autowired
+ private IScClaTimeService claTimeService;
+ @Autowired
+ private IScStudentCourseService studentCourseService;
+
+ /**
+ * 首页各项数据
+ *
+ * @return
+ */
+ public DashboardData dashboardData() {
+ String todayDate = DateTime.now().toString("yyyy-MM-dd");
+ String thisMonthBegin = DateTime.now().withDayOfMonth(1).toString("yyyy-MM-dd");
+ String thisMonthEnd = DateTime.now().plusMonths(1).withDayOfMonth(1).minusDays(1).toString("yyyy-MM-dd");
+ int claCnt = claService.count();
+ int courseCnt = courseService.count();
+ int studentCnt = studentService.count();
+
+ ReqClaTimeCount reqClaTimeCount = ReqClaTimeCount.builder().beginDate(todayDate).endDate(todayDate).hadBegin(null).build();
+ Integer todayClaTimeCnt = claTimeService.claTimeCount(reqClaTimeCount);
+
+ reqClaTimeCount.setHadBegin(true);
+ Integer completeTodayClaTimeCnt = claTimeService.claTimeCount(reqClaTimeCount);
+
+ Integer todayOrderCnt = orderService.orderCount(todayDate, todayDate, OrderTypeEnum.SIGN_UP.getOrderType());
+ Integer thisMonthOrderCnt = orderService.orderCount(thisMonthBegin, thisMonthEnd, OrderTypeEnum.SIGN_UP.getOrderType());
+ Integer todayNeedAttendCnt = attendService.getNeedAttendCount(todayDate, todayDate);
+ Integer todayRealAttendCnt = attendService.getAttendCount(todayDate, todayDate,
+ new String[]{ClaTimeAttendStatusEnums.AT_CLASS.getAttendStatus()});
+ BigDecimal todayNeedCostHour = attendService.getAttendCostHour(todayDate, todayDate, true);
+ BigDecimal todayRealCostHour = attendService.getAttendCostHour(todayDate, todayDate, false);
+ Integer arrearsStudentCnt = orderService.arrearsStudentCount();
+ Integer dateWillExpireCnt = studentCourseService.getWillExpireDateCount(10);
+ Integer hourWillExpireCnt = studentCourseService.getWillExpireHourCount(5);
+ return DashboardData.builder()
+ .todayClaTimeCnt(todayClaTimeCnt)
+ .completeTodayClaTimeCnt(completeTodayClaTimeCnt)
+ .todayOrderCnt(todayOrderCnt)
+ .thisMonthOrderCnt(thisMonthOrderCnt)
+ .todayRealAttendCnt(todayRealAttendCnt)
+ .todayNeedAttendCnt(todayNeedAttendCnt)
+ .todayNeedCostHour(todayNeedCostHour)
+ .todayRealCostHour(todayRealCostHour)
+ .studentCnt(studentCnt)
+ .claCnt(claCnt)
+ .courseCnt(courseCnt)
+ .arrearsStudentCnt(arrearsStudentCnt)
+ .dateWillExpireCnt(dateWillExpireCnt)
+ .hourWillExpireCnt(hourWillExpireCnt)
+ .build();
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/controller/ScRoomController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/controller/ScRoomController.java
new file mode 100644
index 0000000..3f3c5d9
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/controller/ScRoomController.java
@@ -0,0 +1,89 @@
+package cn.xluobo.business.sc.base.controller;
+
+import cn.xluobo.business.sc.base.domain.req.ReqRoomSelect;
+import cn.xluobo.business.sc.base.domain.req.ReqSearchScRoom;
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+import cn.xluobo.business.sc.base.service.BusinessScRoomService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 教室 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-23 07:36:54
+ */
+@RestController
+@RequestMapping("/api/sc/room")
+public class ScRoomController {
+ @Autowired
+ private BusinessScRoomService scRoomService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScRoom
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScRoom reqSearchScRoom) {
+ return scRoomService.searchList(reqSearchScRoom);
+ }
+
+ /**
+ * 前端select
+ *
+ * @return
+ */
+ @GetMapping("/list/select")
+ public APIResponse select(ReqRoomSelect roomSelect) {
+ return scRoomService.select(roomSelect);
+ }
+
+ /**
+ * 详情
+ *
+ * @param roomId
+ * @return
+ */
+ @GetMapping("/info/detailById/{roomId}")
+ public APIResponse detailById(@PathVariable("roomId") Long roomId) {
+ return scRoomService.detailById(roomId);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scRoom
+ * @return
+ */
+ @PostMapping("/add/addScRoom")
+ public APIResponse addScRoom(@RequestBody ScRoom scRoom) {
+ return scRoomService.addScRoom(scRoom);
+ }
+
+ /**
+ * 修改
+ *
+ * @param scRoom
+ * @return
+ */
+ @PutMapping("/update/updateScRoom")
+ public APIResponse updateScRoom(@RequestBody ScRoom scRoom) {
+ return scRoomService.updateScRoom(scRoom);
+ }
+
+ /**
+ * 删除
+ *
+ * @param roomIds
+ * @return
+ */
+ @DeleteMapping("/delete/deleteById/{roomIds}")
+ public APIResponse deleteById(@PathVariable("roomIds") Long[] roomIds) {
+ return scRoomService.deleteById(roomIds);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/controller/ScSchoolController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/controller/ScSchoolController.java
new file mode 100644
index 0000000..14dbc97
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/controller/ScSchoolController.java
@@ -0,0 +1,89 @@
+package cn.xluobo.business.sc.base.controller;
+
+import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
+import cn.xluobo.business.sc.base.domain.req.ReqSearchScSchool;
+import cn.xluobo.business.sc.base.repo.model.ScSchool;
+import cn.xluobo.business.sc.base.service.BusinessScSchoolService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 学校信息 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-04-27 07:13:36
+ */
+@RestController
+@RequestMapping("/api/sc/school")
+public class ScSchoolController {
+ @Autowired
+ private BusinessScSchoolService scSchoolService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScSchool
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScSchool reqSearchScSchool) {
+ return scSchoolService.searchList(reqSearchScSchool);
+ }
+
+ /**
+ * 前端select
+ *
+ * @return
+ */
+ @GetMapping("/list/select")
+ public APIResponse select(ReqSchoolSelect schoolSelect) {
+ return scSchoolService.select(schoolSelect);
+ }
+
+ /**
+ * 详情
+ *
+ * @param schoolId
+ * @return
+ */
+ @GetMapping("/info/detailById/{schoolId}")
+ public APIResponse detailById(@PathVariable("schoolId") Long schoolId) {
+ return scSchoolService.detailById(schoolId);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scSchool
+ * @return
+ */
+ @PostMapping("/add/addScSchool")
+ public APIResponse addScSchool(@RequestBody ScSchool scSchool) {
+ return scSchoolService.addScSchool(scSchool);
+ }
+
+ /**
+ * 修改
+ *
+ * @param scSchool
+ * @return
+ */
+ @PutMapping("/update/updateScSchool")
+ public APIResponse updateScSchool(@RequestBody ScSchool scSchool) {
+ return scSchoolService.updateScSchool(scSchool);
+ }
+
+ /**
+ * 删除
+ *
+ * @param schoolIds
+ * @return
+ */
+ @DeleteMapping("/delete/deleteById/{schoolIds}")
+ public APIResponse deleteById(@PathVariable("schoolIds") Long[] schoolIds) {
+ return scSchoolService.deleteById(schoolIds);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqRoomSelect.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqRoomSelect.java
new file mode 100644
index 0000000..9d6a7b1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqRoomSelect.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.sc.base.domain.req;
+
+import lombok.Data;
+
+/**
+ * 教室 select
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-27 19:41
+ */
+@Data
+public class ReqRoomSelect {
+
+ private String deptId;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSchoolSelect.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSchoolSelect.java
new file mode 100644
index 0000000..4f6e68b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSchoolSelect.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.sc.base.domain.req;
+
+import lombok.Data;
+
+/**
+ * 学校 select
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-27 19:41
+ */
+@Data
+public class ReqSchoolSelect {
+
+ private String search;
+
+ private Integer maxRecord = 50;
+
+ private String schoolId;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSearchScRoom.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSearchScRoom.java
new file mode 100644
index 0000000..72d30cb
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSearchScRoom.java
@@ -0,0 +1,17 @@
+package cn.xluobo.business.sc.base.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScRoom extends ReqPageBase implements Serializable {
+ private Long deptId;
+ private String roomName;
+ private String memo;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSearchScSchool.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSearchScSchool.java
new file mode 100644
index 0000000..031e274
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/req/ReqSearchScSchool.java
@@ -0,0 +1,17 @@
+package cn.xluobo.business.sc.base.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScSchool extends ReqPageBase implements Serializable {
+ private String provinceCode;
+ private String cityCode;
+ private String schoolName;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespRoomInfo.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespRoomInfo.java
new file mode 100644
index 0000000..ef62477
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespRoomInfo.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.sc.base.domain.resp;
+
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+import lombok.Data;
+
+/**
+ * 教室信息
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/24 09:27
+ */
+@Data
+public class RespRoomInfo extends ScRoom {
+
+ private String deptName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespRoomSelect.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespRoomSelect.java
new file mode 100644
index 0000000..60052a9
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespRoomSelect.java
@@ -0,0 +1,15 @@
+package cn.xluobo.business.sc.base.domain.resp;
+
+import lombok.Data;
+
+/**
+ * 前端 教室 select
+ */
+@Data
+public class RespRoomSelect {
+
+ private Long roomId;
+
+ private String roomName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespSchoolSelect.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespSchoolSelect.java
new file mode 100644
index 0000000..75d84ca
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/domain/resp/RespSchoolSelect.java
@@ -0,0 +1,25 @@
+package cn.xluobo.business.sc.base.domain.resp;
+
+import lombok.Data;
+
+/**
+ * 前端 学校 select
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-27 19:30
+ */
+@Data
+public class RespSchoolSelect {
+
+ private Long schoolId;
+
+ private String schoolName;
+
+ private String provinceCode;
+
+ private String cityCode;
+
+ private String provinceName;
+
+ private String cityName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapper/ScRoomMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapper/ScRoomMapper.java
new file mode 100644
index 0000000..c037533
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapper/ScRoomMapper.java
@@ -0,0 +1,40 @@
+package cn.xluobo.business.sc.base.repo.mapper;
+
+import cn.xluobo.business.sc.base.domain.req.ReqRoomSelect;
+import cn.xluobo.business.sc.base.domain.req.ReqSearchScRoom;
+import cn.xluobo.business.sc.base.domain.resp.RespRoomInfo;
+import cn.xluobo.business.sc.base.domain.resp.RespRoomSelect;
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *
+ * 教室 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-23 07:36:54
+ */
+public interface ScRoomMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper {
+
+
+ /**
+ * 根据条件 获取教室
+ * @param reqSearchScRoom
+ * @param page
+ * @return
+ */
+ List selectList(@Param("reqSearchScRoom")ReqSearchScRoom reqSearchScRoom, @Param("page")Page page);
+
+ /**
+ * 查询
+ *
+ * @param roomSelect
+ * @return
+ */
+ List selectForSelect(ReqRoomSelect roomSelect);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapper/ScSchoolMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapper/ScSchoolMapper.java
new file mode 100644
index 0000000..e813945
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapper/ScSchoolMapper.java
@@ -0,0 +1,27 @@
+package cn.xluobo.business.sc.base.repo.mapper;
+
+import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
+import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
+import cn.xluobo.business.sc.base.repo.model.ScSchool;
+
+import java.util.List;
+
+/**
+ *
+ * 学校信息 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-04-27 07:13:36
+ */
+public interface ScSchoolMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper {
+
+ /**
+ * 查询
+ *
+ * @param schoolSelect
+ * @return
+ */
+ List selectForSelect(ReqSchoolSelect schoolSelect);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapping/ScRoomMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapping/ScRoomMapper.xml
new file mode 100644
index 0000000..f7f3449
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapping/ScRoomMapper.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapping/ScSchoolMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapping/ScSchoolMapper.xml
new file mode 100644
index 0000000..b7ac084
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/mapping/ScSchoolMapper.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/model/ScRoom.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/model/ScRoom.java
new file mode 100644
index 0000000..d6212e7
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/model/ScRoom.java
@@ -0,0 +1,82 @@
+package cn.xluobo.business.sc.base.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 教室
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-23 07:36:54
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_room")
+public class ScRoom implements Serializable {
+
+
+ /**
+ * 教室
+ */
+ @TableId(value = "room_id", type = IdType.ASSIGN_ID)
+ private Long roomId;
+
+ /**
+ * 所属租户
+ */
+ @TableField("tenant_id")
+ private String tenantId;
+
+ /**
+ * 所属校区
+ */
+ @TableField("dept_id")
+ private Long deptId;
+
+ /**
+ * 教室名
+ */
+ @TableField("room_name")
+ private String roomName;
+
+ /**
+ * 备注
+ */
+ @TableField("memo")
+ private String memo;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/model/ScSchool.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/model/ScSchool.java
new file mode 100644
index 0000000..6dd84a1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/repo/model/ScSchool.java
@@ -0,0 +1,79 @@
+package cn.xluobo.business.sc.base.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 学校信息
+ *
+ *
+ * @author zhangby
+ * @since 2020-04-27 07:13:36
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_school")
+public class ScSchool implements Serializable {
+
+
+ /**
+ * 学校id
+ */
+ @TableId(value = "school_id", type = IdType.AUTO)
+ private Long schoolId;
+
+ /**
+ * 所属租户
+ */
+ @TableField("tenant_id")
+ private String tenantId;
+
+ /**
+ * 省份编码
+ */
+ @TableField("province_code")
+ private String provinceCode;
+
+ /**
+ * 区号 如0431
+ */
+ @TableField("city_code")
+ private String cityCode;
+
+ @TableField("school_name")
+ private String schoolName;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/BusinessScRoomService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/BusinessScRoomService.java
new file mode 100644
index 0000000..4519477
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/BusinessScRoomService.java
@@ -0,0 +1,142 @@
+package cn.xluobo.business.sc.base.service;
+
+import cn.xluobo.business.sc.base.domain.req.ReqRoomSelect;
+import cn.xluobo.business.sc.base.domain.req.ReqSearchScRoom;
+import cn.xluobo.business.sc.base.domain.resp.RespRoomInfo;
+import cn.xluobo.business.sc.base.domain.resp.RespRoomSelect;
+import cn.xluobo.business.sc.base.repo.mapper.ScRoomMapper;
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.service.IScClaTimeService;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:24
+ */
+@Service
+@Transactional
+public class BusinessScRoomService {
+
+ @Autowired
+ private IScRoomService scRoomService;
+ @Autowired
+ private ScRoomMapper roomMapper;
+ @Autowired
+ private IScClaTimeService claTimeService;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScRoom
+ * @return
+ */
+ public APIResponse searchList(ReqSearchScRoom reqSearchScRoom) {
+ RespPage page = new RespPage<>(reqSearchScRoom.getPageNum(), reqSearchScRoom.getPageSize());
+ List roomSelectList = roomMapper.selectList(reqSearchScRoom, page);
+ page.setRows(roomSelectList);
+ return APIResponse.toAPIResponse(page);
+ }
+
+ /**
+ * 前端select
+ *
+ * @return
+ */
+ public APIResponse select(ReqRoomSelect roomSelect) {
+ List list = scRoomService.selectRoomSelect(roomSelect);
+ return APIResponse.toAPIResponse(list);
+ }
+
+ /**
+ * 详情
+ *
+ * @param roomId
+ * @return
+ */
+ public APIResponse detailById(Long roomId) {
+ if (null == roomId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ ScRoom detailInfo = scRoomService.getById(roomId);
+ return APIResponse.toAPIResponse(detailInfo);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scRoom
+ * @return
+ */
+ public APIResponse addScRoom(ScRoom scRoom) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ scRoom.setCreateUser(loginUser.getUserId());
+ boolean addScRoom = scRoomService.save(scRoom);
+ if (addScRoom) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 更新
+ *
+ * @param scRoom
+ * @return
+ */
+ public APIResponse updateScRoom(ScRoom scRoom) {
+ if (null == scRoom.getRoomId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ scRoom.setLastUpdateUser(loginUser.getUserId());
+ scRoom.setLastUpdateTime(new Date());
+ boolean updateScRoom = scRoomService.updateById(scRoom);
+ if (updateScRoom) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 删除
+ *
+ * @param roomIds
+ * @return
+ */
+ public APIResponse deleteById(Long[] roomIds) {
+ if (null == roomIds || roomIds.length == 0) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+
+ // 教室有 排课未上课 不允许删除
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.in("room_id", roomIds);
+ qw.eq("status", "1");
+ int unBeginClaTimeCount = claTimeService.count(qw);
+ if (unBeginClaTimeCount != 0) {
+ return APIResponse.toExceptionResponse("该教室有'"+unBeginClaTimeCount+"'待上课的排课,无法删除教室");
+ }
+
+ boolean deleteScRoom = scRoomService.removeByIds(Arrays.asList(roomIds));
+ if (deleteScRoom) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/BusinessScSchoolService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/BusinessScSchoolService.java
new file mode 100644
index 0000000..cf19a3b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/BusinessScSchoolService.java
@@ -0,0 +1,134 @@
+package cn.xluobo.business.sc.base.service;
+
+import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
+import cn.xluobo.business.sc.base.domain.req.ReqSearchScSchool;
+import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
+import cn.xluobo.business.sc.base.repo.model.ScSchool;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:24
+ */
+@Service
+@Transactional
+public class BusinessScSchoolService {
+
+ @Autowired
+ private IScSchoolService scSchoolService;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScSchool
+ * @return
+ */
+ public APIResponse searchList(ReqSearchScSchool reqSearchScSchool) {
+ QueryWrapper qw = new QueryWrapper();
+ if(StringUtils.isNotEmpty(reqSearchScSchool.getProvinceCode())){
+ qw.eq("province_code",reqSearchScSchool.getProvinceCode());
+ }
+ if(StringUtils.isNotEmpty(reqSearchScSchool.getCityCode())){
+ qw.eq("city_code",reqSearchScSchool.getCityCode());
+ }
+ if(StringUtils.isNotEmpty(reqSearchScSchool.getSchoolName())){
+ qw.like("school_name",reqSearchScSchool.getSchoolName());
+ }
+ RespPage page = new RespPage(reqSearchScSchool.getPageNum(), reqSearchScSchool.getPageSize());
+ RespPage listPage = scSchoolService.page(page, qw);
+ return APIResponse.toAPIResponse(listPage);
+ }
+
+ /**
+ * 前端select
+ *
+ * @return
+ */
+ public APIResponse select(ReqSchoolSelect schoolSelect) {
+ List list = scSchoolService.selectSchoolSelect(schoolSelect);
+ return APIResponse.toAPIResponse(list);
+ }
+
+ /**
+ * 详情
+ *
+ * @param schoolId
+ * @return
+ */
+ public APIResponse detailById(Long schoolId) {
+ if (null == schoolId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ ScSchool detailInfo = scSchoolService.getById(schoolId);
+ return APIResponse.toAPIResponse(detailInfo);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scSchool
+ * @return
+ */
+ public APIResponse addScSchool(ScSchool scSchool) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ scSchool.setCreateUser(loginUser.getUserId());
+ boolean addScSchool = scSchoolService.save(scSchool);
+ if (addScSchool) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 更新
+ *
+ * @param scSchool
+ * @return
+ */
+ public APIResponse updateScSchool(ScSchool scSchool) {
+ if (null == scSchool.getSchoolId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ scSchool.setLastUpdateUser(loginUser.getUserId());
+ scSchool.setLastUpdateTime(new Date());
+ boolean updateScSchool = scSchoolService.updateById(scSchool);
+ if (updateScSchool) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 删除
+ *
+ * @param schoolIds
+ * @return
+ */
+ public APIResponse deleteById(Long[] schoolIds) {
+ if (null == schoolIds || schoolIds.length == 0) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ boolean deleteScSchool = scSchoolService.removeByIds(Arrays.asList(schoolIds));
+ if (deleteScSchool) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/IScRoomService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/IScRoomService.java
new file mode 100644
index 0000000..8caf638
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/IScRoomService.java
@@ -0,0 +1,25 @@
+package cn.xluobo.business.sc.base.service;
+
+import cn.xluobo.business.sc.base.domain.req.ReqRoomSelect;
+import cn.xluobo.business.sc.base.domain.resp.RespRoomSelect;
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+
+import java.util.List;
+
+/**
+ *
+ * 教室 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-23 07:36:54
+ */
+public interface IScRoomService extends com.baomidou.mybatisplus.extension.service.IService {
+
+ /**
+ * 教室 select
+ * @param roomSelect
+ * @return
+ */
+ List selectRoomSelect(ReqRoomSelect roomSelect);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/IScSchoolService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/IScSchoolService.java
new file mode 100644
index 0000000..594c0f6
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/IScSchoolService.java
@@ -0,0 +1,34 @@
+package cn.xluobo.business.sc.base.service;
+
+import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
+import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
+import cn.xluobo.business.sc.base.repo.model.ScSchool;
+
+import java.util.List;
+
+/**
+ *
+ * 学校信息 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-04-27 07:13:36
+ */
+public interface IScSchoolService extends com.baomidou.mybatisplus.extension.service.IService {
+
+ /**
+ * 学校select
+ *
+ * @param schoolSelect
+ * @return
+ */
+ List selectSchoolSelect(ReqSchoolSelect schoolSelect);
+
+ /**
+ * 根据名称获取学校,如果不存在自动保存
+ *
+ * @param schoolName
+ * @return
+ */
+ Long getSchoolId(String schoolName);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/impl/ScRoomServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/impl/ScRoomServiceImpl.java
new file mode 100644
index 0000000..aa4a0bd
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/impl/ScRoomServiceImpl.java
@@ -0,0 +1,28 @@
+package cn.xluobo.business.sc.base.service.impl;
+
+import cn.xluobo.business.sc.base.domain.req.ReqRoomSelect;
+import cn.xluobo.business.sc.base.domain.resp.RespRoomSelect;
+import cn.xluobo.business.sc.base.repo.mapper.ScRoomMapper;
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+import cn.xluobo.business.sc.base.service.IScRoomService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *
+ * 教室 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-23 07:36:54
+ */
+@Service
+public class ScRoomServiceImpl extends ServiceImpl implements IScRoomService {
+
+ @Override
+ public List selectRoomSelect(ReqRoomSelect roomSelect) {
+ return baseMapper.selectForSelect(roomSelect);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/impl/ScSchoolServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/impl/ScSchoolServiceImpl.java
new file mode 100644
index 0000000..5316e3f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/base/service/impl/ScSchoolServiceImpl.java
@@ -0,0 +1,48 @@
+package cn.xluobo.business.sc.base.service.impl;
+
+import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
+import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
+import cn.xluobo.business.sc.base.repo.mapper.ScSchoolMapper;
+import cn.xluobo.business.sc.base.repo.model.ScSchool;
+import cn.xluobo.business.sc.base.service.IScSchoolService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *
+ * 学校信息 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-04-27 07:13:36
+ */
+@Service
+public class ScSchoolServiceImpl extends ServiceImpl implements IScSchoolService {
+
+ @Override
+ public List selectSchoolSelect(ReqSchoolSelect schoolSelect) {
+ return baseMapper.selectForSelect(schoolSelect);
+ }
+
+ @Override
+ public Long getSchoolId(String schoolName) {
+ if(StringUtils.isNotEmpty(schoolName)) {
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.eq("school_name", schoolName);
+ List list = this.list(qw);
+ if(null != list && list.size() >0 ){
+ return list.get(0).getSchoolId();
+ } else {
+ ScSchool scSchool = new ScSchool();
+ scSchool.setSchoolName(schoolName);
+ this.save(scSchool);
+ return scSchool.getSchoolId();
+ }
+ }
+ return null;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeAttendController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeAttendController.java
new file mode 100644
index 0000000..e219a94
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeAttendController.java
@@ -0,0 +1,91 @@
+package cn.xluobo.business.sc.course.controller;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeAttend;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeAttend;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
+import cn.xluobo.business.sc.course.service.BusinessScClaTimeAttendService;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.page.RespPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 上课出勤表 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-30 02:33:26
+ */
+@RestController
+@RequestMapping("/api/sc/cla/time/attend")
+public class ScClaTimeAttendController {
+ @Autowired
+ private BusinessScClaTimeAttendService scClaTimeAttendService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScClaTimeAttend
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScClaTimeAttend reqSearchScClaTimeAttend) {
+ RespPage respPage = scClaTimeAttendService.searchList(reqSearchScClaTimeAttend);
+ return APIResponse.toAPIResponse(respPage);
+ }
+
+ /**
+ * 上课 出席详情
+ * @param courseTimeId
+ * @return
+ */
+ @GetMapping("/info/hadClaTimeAttendDetail/{courseTimeId}")
+ public APIResponse hadClaTimeAttendDetail(@PathVariable("courseTimeId") Long courseTimeId) {
+ return scClaTimeAttendService.hadClaTimeAttendDetail(courseTimeId);
+ }
+
+ /**
+ * 详情
+ *
+ * @param attendId
+ * @return
+ */
+// @GetMapping("/info/detailById/{attendId}")
+ public APIResponse detailById(@PathVariable("attendId") Long attendId) {
+ return scClaTimeAttendService.detailById(attendId);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scClaTimeAttend
+ * @return
+ */
+// @PostMapping("/add/addScClaTimeAttend")
+ public APIResponse addScClaTimeAttend(@RequestBody ScClaTimeAttend scClaTimeAttend) {
+ return scClaTimeAttendService.addScClaTimeAttend(scClaTimeAttend);
+ }
+
+ /**
+ * 修改
+ *
+ * @param scClaTimeAttend
+ * @return
+ */
+// @PutMapping("/update/updateScClaTimeAttend")
+ public APIResponse updateScClaTimeAttend(@RequestBody ScClaTimeAttend scClaTimeAttend) {
+ return scClaTimeAttendService.updateScClaTimeAttend(scClaTimeAttend);
+ }
+
+ /**
+ * 删除
+ *
+ * @param attendIds
+ * @return
+ */
+// @DeleteMapping("/delete/deleteById/{attendIds}")
+ public APIResponse deleteById(@PathVariable("attendIds") Long[] attendIds) {
+ return scClaTimeAttendService.deleteById(attendIds);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeController.java
new file mode 100644
index 0000000..4d322a1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeController.java
@@ -0,0 +1,125 @@
+package cn.xluobo.business.sc.course.controller;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchClaTime;
+import cn.xluobo.business.sc.course.domain.resp.time.RespBusinessClaTimeCalendar;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTime;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeCalendar;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.service.BusinessClaTimeService;
+import cn.xluobo.business.sc.student.domain.req.ReqClaTimeAttend;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.page.RespPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/18 14:40
+ */
+@RestController
+@RequestMapping("/api/sc/cla/time")
+public class ScClaTimeController {
+
+ @Autowired
+ private BusinessClaTimeService claTimeService;
+
+ /**
+ * 按周获取课表
+ *
+ * @param reqSearchClaTime
+ * @return 周课表 {@link RespBusinessClaTimeCalendar}
+ */
+ @GetMapping("/list/searchListForCalendar")
+ public APIResponse searchListForCalendar(ReqSearchClaTime reqSearchClaTime) {
+ return claTimeService.searchListForCalendar(reqSearchClaTime);
+ }
+
+ /**
+ * 获取最近几天的排课日程
+ *
+ * @param reqSearchClaTime
+ * @return
+ */
+ @GetMapping("/list/searchRecentDayTimeList")
+ public APIResponse searchRecentDayTimeList(ReqSearchClaTime reqSearchClaTime) {
+ List respClaTimeList = claTimeService.searchRecentDayTimeList(reqSearchClaTime);
+ return APIResponse.toAPIResponse(respClaTimeList);
+ }
+
+ /**
+ * 获取上课记录
+ *
+ * @param reqSearchClaTime
+ * @return
+ */
+ @GetMapping("/list/selectListForAttend")
+ public APIResponse selectListForAttend(ReqSearchClaTime reqSearchClaTime) {
+ RespPage respPage = claTimeService.selectListForAttend(reqSearchClaTime);
+ return APIResponse.toAPIResponse(respPage);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scClaTime
+ * @return
+ */
+ @PostMapping("/add/addScClaTime")
+ public APIResponse addScClaTime(@RequestBody ScClaTime scClaTime) {
+ return claTimeService.addClaTime(scClaTime);
+ }
+
+ /**
+ * 详情
+ *
+ * @param courseTimeId
+ * @return
+ */
+ @GetMapping("/info/detailById/{courseTimeId}")
+ public APIResponse detailById(@PathVariable("courseTimeId") Long courseTimeId) {
+ return claTimeService.detailById(courseTimeId);
+ }
+
+ /**
+ * 修改
+ *
+ * @param scClaTime
+ * @return
+ */
+ @PutMapping("/update/updateScClaTime")
+ public APIResponse updateScClaTime(@RequestBody ScClaTime scClaTime) {
+ return claTimeService.updateClaTime(scClaTime);
+ }
+
+ /**
+ * 删除
+ *
+ * @param courseTimeId
+ * @return
+ */
+ @DeleteMapping("/delete/deleteById/{courseTimeId}")
+ public APIResponse deleteById(@PathVariable("courseTimeId") Long courseTimeId) {
+ return claTimeService.deleteById(courseTimeId);
+ }
+
+ /**
+ * 变更 已记上课 信息
+ * @param reqClaTimeAttend
+ * @return
+ */
+ @PostMapping("/update/changeHadClaTimeAttend")
+ public APIResponse changeHadClaTimeAttend(@RequestBody ReqClaTimeAttend reqClaTimeAttend) {
+ return claTimeService.changeHadClaTimeAttend(reqClaTimeAttend);
+ }
+
+ /**
+ * 删除 已记上课 信息
+ * @return
+ */
+ @DeleteMapping("/delete/deleteHadClaTimeAttend/{courseTimeId}")
+ public APIResponse deleteHadClaTimeAttend(@PathVariable("courseTimeId") Long courseTimeId) {
+ return claTimeService.deleteHadClaTimeAttend(courseTimeId);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeRuleController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeRuleController.java
new file mode 100644
index 0000000..6deeb05
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScClaTimeRuleController.java
@@ -0,0 +1,79 @@
+package cn.xluobo.business.sc.course.controller;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeRule;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeRule;
+import cn.xluobo.business.sc.course.service.BusinessClaTimeRuleService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 上课时间配置规则 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-18 04:18:54
+ */
+@RestController
+@RequestMapping("/api/sc/cla/time/rule")
+public class ScClaTimeRuleController {
+
+ @Autowired
+ private BusinessClaTimeRuleService scClaTimeRuleService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScClaTimeRule
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScClaTimeRule reqSearchScClaTimeRule) {
+ return scClaTimeRuleService.searchList(reqSearchScClaTimeRule);
+ }
+
+ /**
+ * 详情
+ *
+ * @param ruleId
+ * @return
+ */
+ @GetMapping("/info/detailById/{ruleId}")
+ public APIResponse detailById(@PathVariable("ruleId") Long ruleId) {
+ return scClaTimeRuleService.detailById(ruleId);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scClaTimeRule
+ * @return
+ */
+ @PostMapping("/add/addScClaTimeRule")
+ public APIResponse addScClaTimeRule(@RequestBody ScClaTimeRule scClaTimeRule) {
+ return scClaTimeRuleService.addClaTimeRule(scClaTimeRule);
+ }
+
+ /**
+ * 修改
+ *
+ * @param scClaTimeRule
+ * @return
+ */
+ @PutMapping("/update/updateScClaTimeRule")
+ public APIResponse updateScClaTimeRule(@RequestBody ScClaTimeRule scClaTimeRule) {
+ return scClaTimeRuleService.updateClaTimeRule(scClaTimeRule);
+ }
+
+ /**
+ * 删除
+ *
+ * @param ruleId
+ * @return
+ */
+ @DeleteMapping("/delete/deleteById/{ruleId}")
+ public APIResponse deleteById(@PathVariable("ruleId") Long ruleId) {
+ return scClaTimeRuleService.deleteById(ruleId);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseClaController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseClaController.java
new file mode 100644
index 0000000..2c5cfd2
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseClaController.java
@@ -0,0 +1,94 @@
+package cn.xluobo.business.sc.course.controller;
+
+import cn.xluobo.business.sc.course.domain.req.ReqAddScCourseCla;
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseCla;
+import cn.xluobo.business.sc.course.domain.resp.cla.RespClaAllDetailInfo;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.business.sc.course.service.BusinessScCourseClaService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 课程班级信息 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 01:11:06
+ */
+@RestController
+@RequestMapping("/api/sc/course/cla")
+public class ScCourseClaController {
+ @Autowired
+ private BusinessScCourseClaService scCourseClaService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScCourseCla
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScCourseCla reqSearchScCourseCla) {
+ return scCourseClaService.searchList(reqSearchScCourseCla);
+ }
+
+ /**
+ * 详情
+ *
+ * @param claId
+ * @return
+ */
+ @GetMapping("/info/detailById/{claId}")
+ public APIResponse detailById(@PathVariable("claId") Long claId) {
+ return scCourseClaService.detailById(claId);
+ }
+
+ /**
+ * 详情
+ * 包含内容较多
+ *
+ * @param claId
+ * @return
+ */
+ @GetMapping("/info/allDetailInfoById/{claId}")
+ public APIResponse allDetailInfoById(@PathVariable("claId") Long claId) {
+ RespClaAllDetailInfo allDetailInfo = scCourseClaService.allDetailInfoById(claId);
+ return APIResponse.toAPIResponse(allDetailInfo);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scCourseCla
+ * @return
+ */
+ @PostMapping("/add/addScCourseCla")
+ public APIResponse addScCourseCla(@RequestBody ReqAddScCourseCla scCourseCla) {
+ return scCourseClaService.addScCourseCla(scCourseCla);
+ }
+
+ /**
+ * 修改
+ *
+ * @param scCourseCla
+ * @return
+ */
+ @PutMapping("/update/updateScCourseCla")
+ public APIResponse updateScCourseCla(@RequestBody ScCourseCla scCourseCla) {
+ return scCourseClaService.updateScCourseCla(scCourseCla);
+ }
+
+ /**
+ * 删除
+ *
+ * @param claIds
+ * @return
+ */
+ @DeleteMapping("/delete/deleteById/{claIds}")
+ public APIResponse deleteById(@PathVariable("claIds") Long[] claIds) {
+ return scCourseClaService.deleteById(claIds);
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseController.java
new file mode 100644
index 0000000..9130f6f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseController.java
@@ -0,0 +1,155 @@
+package cn.xluobo.business.sc.course.controller;
+
+import cn.xluobo.business.sc.course.domain.req.ReqBusinessOrderCourseDetail;
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
+import cn.xluobo.business.sc.course.domain.req.ReqSelect;
+import cn.xluobo.business.sc.course.domain.req.course.ReqAddScCourse;
+import cn.xluobo.business.sc.course.domain.req.course.ReqChangeScCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.service.BusinessScCourseService;
+import cn.xluobo.business.sc.course.service.IScCourseService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ *
+ * 课程信息 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 11:25:55
+ */
+@RestController
+@RequestMapping("/api/sc/course")
+public class ScCourseController {
+
+ @Autowired
+ private BusinessScCourseService scCourseService;
+
+ @Autowired
+ private IScCourseService courseService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScCourse
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScCourse reqSearchScCourse) {
+ return scCourseService.searchList(reqSearchScCourse);
+ }
+
+ /**
+ * 查询课程列表
+ * 含有学生报读状态
+ *
+ * @param reqSearchScCourse
+ * @return
+ */
+ @GetMapping("/list/selectCourseListWithStudentCourse")
+ public APIResponse selectCourseListWithStudentCourse(ReqSearchScCourse reqSearchScCourse) {
+ return scCourseService.selectCourseListWithStudentCourse(reqSearchScCourse);
+ }
+
+ /**
+ * 前端select
+ *
+ * @return
+ */
+ @GetMapping("/list/select")
+ public APIResponse select(ReqSelect reqSelect) {
+ return scCourseService.select(reqSelect);
+ }
+
+ /**
+ * 详情
+ *
+ * @param courseId
+ * @return
+ */
+ @GetMapping("/info/detailById/{courseId}")
+ public APIResponse detailById(@PathVariable("courseId") Long courseId) {
+ return scCourseService.detailById(courseId);
+ }
+
+ /**
+ * 添加
+ *
+ * @param reqAddScCourse
+ * @return
+ */
+ @PostMapping("/add/addScCourse")
+ public APIResponse addScCourse(@RequestBody ReqAddScCourse reqAddScCourse) {
+ return scCourseService.addScCourse(reqAddScCourse);
+ }
+
+ /**
+ * 修改
+ *
+ * @param reqChangeScCourse
+ * @return
+ */
+ @PutMapping("/update/updateScCourse")
+ public APIResponse updateScCourse(@RequestBody ReqChangeScCourse reqChangeScCourse) {
+ return scCourseService.updateScCourse(reqChangeScCourse);
+ }
+
+ /**
+ * 删除
+ *
+ * @param courseIds
+ * @return
+ */
+ @DeleteMapping("/delete/deleteById/{courseIds}")
+ public APIResponse deleteById(@PathVariable("courseIds") List courseIds) {
+ return scCourseService.deleteById(courseIds);
+ }
+
+ /**
+ * 变更是否开售
+ *
+ * @param scCourse
+ * @return
+ */
+ @PutMapping("/update/changeCourseSale")
+ public APIResponse changeCourseSale(@RequestBody ScCourse scCourse) {
+ return scCourseService.changeCourseSale(scCourse);
+ }
+
+ /**
+ * 导出
+ *
+ * @param reqSearchScCourse
+ */
+ @GetMapping("/export/exportCourse")
+ public APIResponse exportCourse(ReqSearchScCourse reqSearchScCourse) {
+ return scCourseService.exportCourse(reqSearchScCourse);
+ }
+
+ /**
+ * 课程详情
+ * 报名选择课程后获取课程详情
+ *
+ * @param orderCourseDetail
+ * @return
+ */
+ @GetMapping("/info/orderCourseDetail")
+ public APIResponse orderCourseDetail(ReqBusinessOrderCourseDetail orderCourseDetail) {
+ return scCourseService.orderCourseDetail(orderCourseDetail);
+ }
+
+ /**
+ * 学生是否可报读课程
+ *
+ * @param orderCourseDetail
+ * @return
+ */
+ @GetMapping("/info/studentCanSignUpCourse")
+ public APIResponse studentCanSignUpCourse(ReqBusinessOrderCourseDetail orderCourseDetail) {
+ return scCourseService.studentCanSignUpCourse(orderCourseDetail);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseTypeController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseTypeController.java
new file mode 100644
index 0000000..c360953
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/controller/ScCourseTypeController.java
@@ -0,0 +1,89 @@
+package cn.xluobo.business.sc.course.controller;
+
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseType;
+import cn.xluobo.business.sc.course.repo.model.ScCourseType;
+import cn.xluobo.business.sc.course.service.BusinessScCourseTypeService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 课程类型 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-09 08:10:25
+ */
+@RestController
+@RequestMapping("/api/sc/course/type")
+public class ScCourseTypeController {
+ @Autowired
+ private BusinessScCourseTypeService scCourseTypeService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScCourseType
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScCourseType reqSearchScCourseType) {
+ return scCourseTypeService.searchList(reqSearchScCourseType);
+ }
+
+ /**
+ * select
+ *
+ * @param reqSearchScCourseType
+ * @return
+ */
+ @GetMapping("/list/select")
+ public APIResponse select(ReqSearchScCourseType reqSearchScCourseType) {
+ return scCourseTypeService.select(reqSearchScCourseType);
+ }
+
+ /**
+ * 详情
+ *
+ * @param courseTypeId
+ * @return
+ */
+ @GetMapping("/info/detailById/{courseTypeId}")
+ public APIResponse detailById(@PathVariable("courseTypeId") Long courseTypeId) {
+ return scCourseTypeService.detailById(courseTypeId);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scCourseType
+ * @return
+ */
+ @PostMapping("/add/addScCourseType")
+ public APIResponse addScCourseType(@RequestBody ScCourseType scCourseType) {
+ return scCourseTypeService.addScCourseType(scCourseType);
+ }
+
+ /**
+ * 修改
+ *
+ * @param scCourseType
+ * @return
+ */
+ @PutMapping("/update/updateScCourseType")
+ public APIResponse updateScCourseType(@RequestBody ScCourseType scCourseType) {
+ return scCourseTypeService.updateScCourseType(scCourseType);
+ }
+
+ /**
+ * 删除
+ *
+ * @param courseTypeIds
+ * @return
+ */
+ @DeleteMapping("/delete/deleteById/{courseTypeIds}")
+ public APIResponse deleteById(@PathVariable("courseTypeIds") Long[] courseTypeIds) {
+ return scCourseTypeService.deleteById(courseTypeIds);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/export/ExpCourse.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/export/ExpCourse.java
new file mode 100644
index 0000000..4605887
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/export/ExpCourse.java
@@ -0,0 +1,66 @@
+package cn.xluobo.business.sc.course.domain.export;
+
+import cn.xluobo.business.tool.export.domain.ExportBaseBean;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 导出课程
+ * @author :zhangbaoyu
+ * @date :Created in 2020/7/29 11:18
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class ExpCourse extends ExportBaseBean {
+
+ private Long courseId;
+ private Long chargeId;
+
+ @ExcelProperty("课程名称")
+ private String courseName;
+
+ @ExcelProperty("课程类型")
+ private String courseTypeName;
+
+ @ExcelProperty("授课模式")
+ private String teachingMode;
+
+ @ExcelProperty("开班数")
+ private Integer claCount;
+
+ @ExcelProperty("创建时间")
+ private Date createTime;
+
+ @ExcelProperty("课程状态")
+ private String sale;
+
+ @ExcelProperty("课程简介")
+ private String courseIntro;
+
+ @ExcelProperty("开课校区")
+ private String departName;
+
+ @ExcelProperty("收费模式")
+ private String chargeTypeName;
+
+ private String chargeType;
+ private String dateUnit;
+
+ @ExcelProperty("时间周期")
+ private String dateUnitName;
+
+ @ExcelProperty("数量")
+ private BigDecimal count;
+
+ @ExcelProperty("总价")
+ private BigDecimal totalFee;
+
+ @Override
+ public String getPrimaryId() {
+ return String.valueOf(courseId);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/export/ExpCourseCharge.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/export/ExpCourseCharge.java
new file mode 100644
index 0000000..9c8a695
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/export/ExpCourseCharge.java
@@ -0,0 +1,12 @@
+package cn.xluobo.business.sc.course.domain.export;
+
+import lombok.Data;
+
+/**
+ * 课程收费模式
+ * @author :zhangbaoyu
+ * @date :Created in 2020/7/29 11:26
+ */
+@Data
+public class ExpCourseCharge {
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqAddScCourseCla.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqAddScCourseCla.java
new file mode 100644
index 0000000..4ccda8b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqAddScCourseCla.java
@@ -0,0 +1,63 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 新增课程
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020-03-23 13:53
+ */
+@Data
+public class ReqAddScCourseCla {
+
+ private Long courseId;
+
+ private Long departId;
+
+ private Long staffId;
+
+ private String claName;
+
+ private String claColor;
+
+ private Integer capacity;
+
+ private String recruitStatus;
+
+ private BigDecimal everyStuLoseHour;
+
+ private String openDate;
+
+ private String closeDate;
+
+ private String memo;
+
+ /**
+ * 获取班级实体
+ *
+ * @param loginUser
+ * @return
+ */
+ public ScCourseCla getScCourseCla(LoginUser loginUser) {
+ ScCourseCla cla = new ScCourseCla();
+ cla.setCourseId(courseId);
+ cla.setDepartId(departId);
+ cla.setStaffId(staffId);
+ cla.setClaName(claName);
+ cla.setClaColor(claColor);
+ cla.setCapacity(capacity);
+ cla.setRecruitStatus(recruitStatus);
+ cla.setEveryStuLoseHour(everyStuLoseHour);
+ cla.setEveryTeaGetHour(everyStuLoseHour);
+ cla.setOpenDate(openDate);
+ cla.setCloseDate(closeDate);
+ cla.setMemo(memo);
+ cla.setCreateUser(loginUser.getUserId());
+ return cla;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessAddClaStu.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessAddClaStu.java
new file mode 100644
index 0000000..76b4528
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessAddClaStu.java
@@ -0,0 +1,18 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 班级新增学生
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-28 19:08
+ */
+@Data
+public class ReqBusinessAddClaStu implements Serializable {
+
+ private Long claId;
+
+ private Long[] studentIds;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessAddStuCla.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessAddStuCla.java
new file mode 100644
index 0000000..0645fd8
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessAddStuCla.java
@@ -0,0 +1,18 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 学生新学课程
+ * @author :zhangbaoyu
+ * @date :Created in 2020-06-21 10:08
+ */
+@Data
+public class ReqBusinessAddStuCla implements Serializable {
+
+ private Long[] claIds;
+
+ private Long studentId;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessClaBegin.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessClaBegin.java
new file mode 100644
index 0000000..51e42b3
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessClaBegin.java
@@ -0,0 +1,72 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 上课请求参数
+ * @author :zhangbaoyu
+ * @date :Created in 2020/6/8 10:44
+ */
+@Data
+public class ReqBusinessClaBegin implements Serializable {
+
+ private Long courseTimeId;
+
+ private Long[] studentIds;
+
+ /**
+ * 实际上课时间
+ */
+ private String startTime;
+
+ /**
+ * 实际结束时间
+ */
+ private String endTime;
+
+ /**
+ * 其他说明
+ */
+ private String memo;
+
+ /**
+ * 消耗课时数量
+ */
+ private BigDecimal payHourCount;
+
+ /**
+ * 上课时课程 参数校验
+ * @return
+ */
+ public boolean checkParamForHour(){
+ if(null == courseTimeId || null == studentIds || studentIds.length == 0){
+ return false;
+ }
+ if(StringUtils.isAnyEmpty(startTime,endTime)){
+ return false;
+ }
+ if(null == payHourCount || "0".equals(payHourCount.toString())){
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * 上周期课程 参数校验
+ * @return
+ */
+ public boolean checkParamForDate(){
+ if(null == courseTimeId || null == studentIds || studentIds.length == 0){
+ return false;
+ }
+ if(StringUtils.isAnyEmpty(startTime,endTime)){
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessOrderCourseDetail.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessOrderCourseDetail.java
new file mode 100644
index 0000000..4becc7a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqBusinessOrderCourseDetail.java
@@ -0,0 +1,18 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import lombok.Data;
+
+/**
+ * 报名时 获取课程详情
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/3 11:08
+ */
+@Data
+public class ReqBusinessOrderCourseDetail {
+
+ private Long studentId;
+
+ private Long[] courseIds;
+
+ private Long deptId;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqCourseClaSelect.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqCourseClaSelect.java
new file mode 100644
index 0000000..5f08acf
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqCourseClaSelect.java
@@ -0,0 +1,18 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import lombok.Data;
+
+/**
+ * 课程班级 select
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-27 19:41
+ */
+@Data
+public class ReqCourseClaSelect {
+
+ private String search;
+
+ private Integer maxRecord = 500;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourse.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourse.java
new file mode 100644
index 0000000..f313e39
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourse.java
@@ -0,0 +1,47 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 查询课程请求参数
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScCourse extends ReqPageBase implements Serializable {
+
+ private String courseName;
+
+ /**
+ * 是否开售
+ */
+ private String sale;
+
+ /**
+ * 教学模式
+ */
+ private String teachingMode;
+
+ /**
+ * 课程类型
+ */
+ private String courseTypeId;
+
+ /**
+ * 上课校区
+ */
+ private Long departId;
+
+ /**
+ * 收费模式
+ */
+ private String chargeType;
+
+ /**
+ * 学生 区分结果是否为续费
+ */
+ private Long studentId;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourseCla.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourseCla.java
new file mode 100644
index 0000000..8f1635d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourseCla.java
@@ -0,0 +1,23 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScCourseCla extends ReqPageBase implements Serializable {
+ private Long courseId;
+ private Long staffId;
+ private String claName;
+ private String courseTime;
+ private Long departId;
+ /**
+ * 收费模式
+ */
+ private String chargeType;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourseType.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourseType.java
new file mode 100644
index 0000000..a3f6c7e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSearchScCourseType.java
@@ -0,0 +1,15 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScCourseType extends ReqPageBase implements Serializable {
+ private String courseType;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSelect.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSelect.java
new file mode 100644
index 0000000..41401a9
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/ReqSelect.java
@@ -0,0 +1,32 @@
+package cn.xluobo.business.sc.course.domain.req;
+
+import lombok.Data;
+
+/**
+ * 前端 select
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-27 19:41
+ */
+@Data
+public class ReqSelect {
+
+ private String search;
+
+ private Integer maxRecord = 50;
+
+ // 是否可分页
+ private boolean pageable;
+
+ private long pageNum = 1;
+
+ private long pageSize = 10;
+
+ public long getPageSize() {
+ if (pageable) {
+ return pageSize;
+ } else {
+ return maxRecord;
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/cla/ReqClaCount.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/cla/ReqClaCount.java
new file mode 100644
index 0000000..cd98a5e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/cla/ReqClaCount.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.sc.course.domain.req.cla;
+
+import cn.xluobo.core.page.ReqDeptCondition;
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/24 12:27
+ */
+@Data
+@Builder
+public class ReqClaCount extends ReqDeptCondition {
+
+ private Long teacherId;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqAddScCourse.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqAddScCourse.java
new file mode 100644
index 0000000..49b1a41
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqAddScCourse.java
@@ -0,0 +1,155 @@
+package cn.xluobo.business.sc.course.domain.req.course;
+
+import cn.xluobo.core.api.APIBaseResponse;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 录入课程
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/7/8 20:34
+ */
+@Data
+public class ReqAddScCourse {
+
+ /**
+ * 课程名
+ */
+ private String courseName;
+
+ /**
+ * 课程类型
+ */
+ private Long courseTypeId;
+
+ /**
+ * 教学模式
+ */
+ private String teachingMode;
+
+ /**
+ * 课程简介
+ */
+ private String courseIntro;
+
+ /**
+ * 上课校区 所有 或 部分 all part
+ */
+ private String courseCampus;
+
+ /**
+ * 上课校区
+ */
+ private String[] partCampus;
+
+ /**
+ * 收费模式
+ */
+ private boolean feeModeHour;
+
+ /**
+ * 收费模式
+ */
+ private boolean feeModeDate;
+
+ /**
+ * 收费模式
+ */
+ private boolean feeModeCycle;
+
+ private List feeModeHourList;
+
+ private List feeModeDateList;
+
+ private List feeModeCycleList;
+
+ /**
+ * 参数校验
+ *
+ * @return
+ */
+ public APIBaseResponse checkParam() {
+ if (StringUtils.isEmpty(courseName)) {
+ return APIBaseResponse.fail("请输入课程名称");
+ } else if (StringUtils.isEmpty(teachingMode)) {
+ return APIBaseResponse.fail("请选择教学模式");
+ }
+
+ if (StringUtils.isEmpty(courseCampus)) {
+ return APIBaseResponse.fail("请选择上课校区");
+ }
+ if ("part".equals(courseCampus) && null == partCampus) {
+ return APIBaseResponse.fail("请选择上课校区");
+ }
+ if ("part".equals(courseCampus) && partCampus.length == 0) {
+ return APIBaseResponse.fail("请选择上课校区");
+ }
+
+ if (!feeModeHour && !feeModeDate && !feeModeCycle) {
+ return APIBaseResponse.fail("请配置收费模式");
+ }
+
+ if (feeModeHour && (null == feeModeHourList || feeModeHourList.isEmpty())) {
+ return APIBaseResponse.fail("请配置课时收费模式");
+ }
+ if (feeModeDate && (null == feeModeDateList || feeModeDateList.isEmpty())) {
+ return APIBaseResponse.fail("请配置时间收费模式");
+ }
+ if (feeModeCycle && (null == feeModeCycleList || feeModeCycleList.isEmpty())) {
+ return APIBaseResponse.fail("请配置周期收费模式");
+ }
+
+ BigDecimal zero = BigDecimal.ZERO;
+ if (feeModeHour) {
+ for (ReqAddScCourseChargeItem item : feeModeHourList) {
+ BigDecimal cnt = item.getCnt();
+ BigDecimal totalFee = item.getTotalFee();
+ String campusName = item.getCampusName();
+ if(null == cnt || cnt.compareTo(zero)==0){
+ return APIBaseResponse.fail("请填写"+campusName+"按课时收费 数量");
+ }
+ if(null == totalFee || totalFee.compareTo(zero)==0){
+ return APIBaseResponse.fail("请填写"+campusName+"按课时收费 金额");
+ }
+ }
+ }
+
+ if (feeModeDate) {
+ for (ReqAddScCourseChargeItem item : feeModeDateList) {
+ BigDecimal cnt = item.getCnt();
+ BigDecimal totalFee = item.getTotalFee();
+ String dateType = item.getDateType();
+ String campusName = item.getCampusName();
+ if(null == cnt || cnt.compareTo(zero)==0){
+ return APIBaseResponse.fail("请填写"+campusName+"按时间收费 数量");
+ }
+ if(null == totalFee || totalFee.compareTo(zero)==0){
+ return APIBaseResponse.fail("请填写"+campusName+"按时间收费 金额");
+ }
+ if(StringUtils.isEmpty(dateType)){
+ return APIBaseResponse.fail("请填写"+campusName+"按时间收费 时间段");
+ }
+ }
+ }
+
+ if(feeModeCycle) {
+ for (ReqAddScCourseChargeItem item : feeModeCycleList) {
+ BigDecimal cnt = item.getCnt();
+ BigDecimal totalFee = item.getTotalFee();
+ String campusName = item.getCampusName();
+ if(null == cnt || cnt.compareTo(zero)==0){
+ return APIBaseResponse.fail("请填写"+campusName+"按期收费 数量");
+ }
+ if(null == totalFee || totalFee.compareTo(zero)==0){
+ return APIBaseResponse.fail("请填写"+campusName+"按期收费 金额");
+ }
+ }
+ }
+
+ return APIBaseResponse.success();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqAddScCourseChargeItem.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqAddScCourseChargeItem.java
new file mode 100644
index 0000000..d47edea
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqAddScCourseChargeItem.java
@@ -0,0 +1,42 @@
+package cn.xluobo.business.sc.course.domain.req.course;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 课程收费模式
+ * @author :zhangbaoyu
+ * @date :Created in 2020/7/23 11:07
+ */
+@Data
+public class ReqAddScCourseChargeItem {
+
+ private Long chargeId;
+
+ /**
+ * 校区id
+ */
+ private Long campusId;
+
+ /**
+ * 校区名称
+ */
+ private String campusName;
+
+ /**
+ * 数量
+ */
+ private BigDecimal cnt;
+
+ /**
+ * 总价格
+ */
+ private BigDecimal totalFee;
+
+ /**
+ * 时间段 日 月 季 年
+ */
+ private String dateType;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqChangeScCourse.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqChangeScCourse.java
new file mode 100644
index 0000000..2e0f258
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/course/ReqChangeScCourse.java
@@ -0,0 +1,28 @@
+package cn.xluobo.business.sc.course.domain.req.course;
+
+import cn.xluobo.core.api.APIBaseResponse;
+import lombok.Data;
+
+/**
+ * 修改课程
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/7/8 20:34
+ */
+@Data
+public class ReqChangeScCourse extends ReqAddScCourse{
+
+ private Long courseId;
+
+ public APIBaseResponse checkParam() {
+ APIBaseResponse checkParam = super.checkParam();
+ if(!checkParam.isSuccess()){
+ return checkParam;
+ }
+ if(null == courseId){
+ return APIBaseResponse.fail("请求参数错误,请稍后重试");
+ }
+ return APIBaseResponse.success();
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqClaTimeCount.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqClaTimeCount.java
new file mode 100644
index 0000000..535232e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqClaTimeCount.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.sc.course.domain.req.time;
+
+import cn.xluobo.core.page.ReqDeptCondition;
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/24 12:21
+ */
+@Data
+@Builder
+public class ReqClaTimeCount extends ReqDeptCondition {
+
+ private String beginDate;
+ private String endDate;
+ private Boolean hadBegin;
+ private Long teacherId;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchClaTime.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchClaTime.java
new file mode 100644
index 0000000..de7774e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchClaTime.java
@@ -0,0 +1,69 @@
+package cn.xluobo.business.sc.course.domain.req.time;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/18 14:45
+ */
+@Data
+public class ReqSearchClaTime extends ReqPageBase implements Serializable {
+
+ // 排课 编号
+ private Long courseTimeId;
+
+ // 课程
+ private Long courseId;
+
+ // 校区
+ private Long deptId;
+
+ // 当前登录用户
+ private String userId;
+
+ // 班级
+ private Long claId;
+
+ // 学生
+ private Long studentId;
+
+ private Long teacherId;
+
+ // 开始时间
+ private String beginDate;
+
+ // 结束时间
+ private String endDate;
+
+ /**
+ * 与今天相隔几天
+ * 如果设置了,将重置 beginDate、endDate
+ */
+ private Integer diffNowDay;
+
+ /**
+ * 是否已上课
+ * true 已上课
+ * false 未上课
+ */
+ private Boolean attended;
+
+ /**
+ * 排序类型
+ * claTimeAttend
+ */
+ private String orderByType;
+
+ public void setDiffNowDay(Integer diffNowDay) {
+ this.diffNowDay = diffNowDay;
+ if(null != diffNowDay) {
+ DateTime now = DateTime.now();
+ this.beginDate = now.minusDays(diffNowDay).toString("yyyy-MM-dd");
+ this.endDate = now.plusDays(diffNowDay).toString("yyyy-MM-dd");
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchScClaTimeAttend.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchScClaTimeAttend.java
new file mode 100644
index 0000000..f9beb34
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchScClaTimeAttend.java
@@ -0,0 +1,27 @@
+package cn.xluobo.business.sc.course.domain.req.time;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScClaTimeAttend extends ReqPageBase implements Serializable {
+
+ private Long courseTimeId;
+
+// private String chargeType;
+ private String attendStatus;
+
+ private Long studentCourseId;
+
+ private Long studentId;
+
+ private Long teacherId;
+
+ private String tenantId;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchScClaTimeRule.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchScClaTimeRule.java
new file mode 100644
index 0000000..8a1810d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/req/time/ReqSearchScClaTimeRule.java
@@ -0,0 +1,30 @@
+package cn.xluobo.business.sc.course.domain.req.time;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScClaTimeRule extends ReqPageBase implements Serializable {
+ private Long deptId;
+ private Long claId;
+ private Long teacherId;
+ private String[] claDate;
+ private Boolean filterHoliday;
+ private String beginDate;
+ private String endDate;
+
+ public void setClaDate(String[] claDate) {
+ this.claDate = claDate;
+ if (null != claDate && claDate.length == 2 && StringUtils.isAnyEmpty(beginDate, endDate)) {
+ this.beginDate = claDate[0];
+ this.endDate = claDate[1];
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessChooseCourseCharge.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessChooseCourseCharge.java
new file mode 100644
index 0000000..dc2b2cc
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessChooseCourseCharge.java
@@ -0,0 +1,38 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Builder;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 选择课程的可选 收费模式
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/8/26 17:16
+ */
+@Data
+@Builder
+public class RespBusinessChooseCourseCharge {
+
+ private Long chargeId;
+
+ /**
+ * 单个金额
+ */
+ private BigDecimal totalFee;
+
+ /**
+ * select label
+ */
+ private String label;
+
+ // 收费类型
+ private String chargeType;
+
+ // 数量
+ private BigDecimal count;
+
+ // 按时间 时间单位
+ private String dateUnit;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessChooseCourseInfo.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessChooseCourseInfo.java
new file mode 100644
index 0000000..efe396d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessChooseCourseInfo.java
@@ -0,0 +1,33 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Builder;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 选择课程信息
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/8/26 17:01
+ */
+@Data
+@Builder
+public class RespBusinessChooseCourseInfo {
+
+ private Long courseId;
+
+ private String courseName;
+
+ private Long deptId;
+
+ private String deptName;
+
+ private String teachingMode;
+
+ private List courseChargeList;
+
+ // 续报
+ private Boolean continueCourse;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessCla.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessCla.java
new file mode 100644
index 0000000..1cddf07
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessCla.java
@@ -0,0 +1,32 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * 班级
+ *
+ *
+ * @author zhangby
+ * @since 2020-06-21 07:13:40
+ */
+@Data
+public class RespBusinessCla implements Serializable {
+
+ private Long claId;
+
+ private String claName;
+
+ private String chargeName;
+
+ public RespBusinessCla(Long claId, String claName, String chargeName) {
+ this.claId = claId;
+ this.claName = claName;
+ this.chargeName = chargeName;
+ }
+
+ public RespBusinessCla() {
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessClaInfo.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessClaInfo.java
new file mode 100644
index 0000000..30cd5d3
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessClaInfo.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * 业务返回 班级信息
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-03 14:15
+ */
+@Data
+@Builder
+public class RespBusinessClaInfo {
+
+ private Long claId;
+ private String claColor;
+ private String claName;
+ private String teacherName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessClaStudent.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessClaStudent.java
new file mode 100644
index 0000000..d81d71f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessClaStudent.java
@@ -0,0 +1,45 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *
+ * 班级学生
+ *
+ *
+ * @author zhangby
+ * @since 2020-04-27 07:13:40
+ */
+@Data
+public class RespBusinessClaStudent implements Serializable {
+
+ /**
+ * 全部可选学生
+ */
+ private List students;
+
+ /**
+ * 已有学生
+ */
+ private List claStudentIds;
+
+ /**
+ * 班级信息
+ */
+ private RespBusinessClaInfo claInfo;
+
+ /**
+ * 课程信息
+ */
+ private RespBusinessCourseInfo courseInfo;
+
+ public RespBusinessClaStudent(List students, List claStudentIds, RespBusinessClaInfo claInfo, RespBusinessCourseInfo courseInfo) {
+ this.students = students;
+ this.claStudentIds = claStudentIds;
+ this.claInfo = claInfo;
+ this.courseInfo = courseInfo;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessCourseInfo.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessCourseInfo.java
new file mode 100644
index 0000000..77a2a81
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessCourseInfo.java
@@ -0,0 +1,18 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * 业务返回 课程信息
+ * @author :zhangbaoyu
+ * @date :Created in 2020-04-03 14:15
+ */
+@Data
+@Builder
+public class RespBusinessCourseInfo {
+
+ private Long courseId;
+
+ private String courseName;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessStudent.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessStudent.java
new file mode 100644
index 0000000..aebce5c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessStudent.java
@@ -0,0 +1,30 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * 班级学生
+ *
+ *
+ * @author zhangby
+ * @since 2020-04-27 07:13:40
+ */
+@Data
+public class RespBusinessStudent implements Serializable {
+
+ private Long studentId;
+
+ private String studentName;
+
+ public RespBusinessStudent(Long studentId) {
+ this.studentId = studentId;
+ }
+
+ public RespBusinessStudent(Long studentId, String studentName) {
+ this.studentId = studentId;
+ this.studentName = studentName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessStudentCla.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessStudentCla.java
new file mode 100644
index 0000000..dd9c9d3
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespBusinessStudentCla.java
@@ -0,0 +1,41 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import cn.xluobo.business.sc.student.repo.model.ScStudent;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *
+ * 学生班级
+ *
+ *
+ * @author zhangby
+ * @since 2020-06-21 07:13:40
+ */
+@Data
+public class RespBusinessStudentCla implements Serializable {
+
+ /**
+ * 全部可选班级
+ */
+ private List claInfoList;
+
+ /**
+ * 已有课程
+ */
+ private List claIds;
+
+ /**
+ * 班级信息
+ */
+ private ScStudent student;
+
+
+ public RespBusinessStudentCla(List claInfoList, List claIds, ScStudent student) {
+ this.claInfoList = claInfoList;
+ this.claIds = claIds;
+ this.student = student;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespCourseClaInfo.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespCourseClaInfo.java
new file mode 100644
index 0000000..a75fd6f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespCourseClaInfo.java
@@ -0,0 +1,40 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Data;
+
+/**
+ * 班级列表信息
+ * @author :zhangbaoyu
+ * @date :Created in 2020-03-23 19:36
+ */
+@Data
+public class RespCourseClaInfo {
+
+ private Long claId;
+
+ private String claName;
+
+ // 当前人数
+ private Integer studentCnt;
+
+ // 满班人数
+ private String capacity;
+
+ private String recruitStatus;
+
+ private String openDate;
+
+ private Long courseId;
+
+ private String courseName;
+
+ private Long staffId;
+
+ private String staffName;
+
+ private String deptName;
+
+ // 上课星期
+ private String weekDay;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespCourseClaSelectInfo.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespCourseClaSelectInfo.java
new file mode 100644
index 0000000..5637f65
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/RespCourseClaSelectInfo.java
@@ -0,0 +1,27 @@
+package cn.xluobo.business.sc.course.domain.resp;
+
+import lombok.Data;
+
+/**
+ * 班级 select
+ * @author :zhangbaoyu
+ * @date :Created in 2020/5/6 13:11
+ */
+@Data
+public class RespCourseClaSelectInfo {
+
+ private Long claId;
+
+ private String claName;
+
+ private Long courseId;
+
+ private String courseName;
+
+ private String staffName;
+
+ private Long deptId;
+
+ private String deptName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/cla/RespClaAllDetailInfo.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/cla/RespClaAllDetailInfo.java
new file mode 100644
index 0000000..f5ce0b8
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/cla/RespClaAllDetailInfo.java
@@ -0,0 +1,31 @@
+package cn.xluobo.business.sc.course.domain.resp.cla;
+
+import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseCharge;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import lombok.Builder;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 班级详情
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/29 18:36
+ */
+@Data
+@Builder
+public class RespClaAllDetailInfo {
+
+ // 班级信息
+ private ScCourseCla courseCla;
+
+ // 课程信息
+ private ScCourse course;
+
+ // 收费方式
+ private List courseChargeList;
+
+ // 上课时间
+ private List claTimeList;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/course/RespScCourseDetail.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/course/RespScCourseDetail.java
new file mode 100644
index 0000000..73b6a86
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/course/RespScCourseDetail.java
@@ -0,0 +1,19 @@
+package cn.xluobo.business.sc.course.domain.resp.course;
+
+import cn.xluobo.business.sc.course.domain.req.course.ReqAddScCourse;
+import lombok.Data;
+
+/**
+ * 课程详情
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/7/8 20:34
+ */
+@Data
+public class RespScCourseDetail extends ReqAddScCourse {
+
+ private Long courseId;
+
+ private String courseTypeName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/course/RespSearchCourse.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/course/RespSearchCourse.java
new file mode 100644
index 0000000..8614127
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/course/RespSearchCourse.java
@@ -0,0 +1,65 @@
+package cn.xluobo.business.sc.course.domain.resp.course;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/7/25 11:11
+ */
+@Data
+public class RespSearchCourse implements Serializable {
+
+ private Long courseId;
+
+ private String courseName;
+
+ private Long courseTypeId;
+
+ /**
+ * 课程类型
+ */
+ private String courseTypeName;
+
+ /**
+ * 授课模式
+ */
+ private String teachingMode;
+
+ /**
+ * 开班数
+ */
+ private Integer claCount;
+
+ /**
+ * 收费模式
+ */
+ private String chargeNames;
+
+ /**
+ * 开课校区
+ */
+ private String campusIds;
+
+ /**
+ * 创建日期
+ */
+ private Date createTime;
+
+ /**
+ * 课程状态
+ */
+ private String sale;
+
+ /**
+ * 课程简介
+ */
+ private String courseIntro;
+
+ /**
+ * 学生课程
+ */
+ private Long studentCourseId;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeCalendarItem.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeCalendarItem.java
new file mode 100644
index 0000000..3bf1a74
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeCalendarItem.java
@@ -0,0 +1,58 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import cn.xluobo.core.constants.SysConstant;
+import lombok.Data;
+
+/**
+ * 单节排课信息
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/23 18:54
+ */
+@Data
+public class ClaTimeCalendarItem {
+
+ private Long courseTimeId;
+
+ private String claName;
+
+ private String courseName;
+
+ // 日期
+ private String claDate;
+
+ // 星期
+ private String weekDay;
+
+ private String startTime;
+
+ private String endTime;
+
+ private String staffName;
+
+ private int studentCount;
+
+ // 教室
+ private String roomName;
+
+ private String claColor;
+
+ // 上课状态
+ private String claTimeStatus;
+
+ public ClaTimeCalendarItem transfer(RespClaTimeCalendar respClaTime) {
+ this.courseTimeId = respClaTime.getCourseTimeId();
+ this.claName = respClaTime.getClaName();
+ this.courseName = respClaTime.getCourseName();
+ this.claDate = respClaTime.getClaDate();
+ this.weekDay = SysConstant.WEEK_DAY_MAP.get(respClaTime.getWeekDay());
+ this.startTime = respClaTime.getStartTime().substring(0,5);
+ this.endTime = respClaTime.getEndTime().substring(0,5);
+ this.staffName = respClaTime.getStaffName();
+ this.studentCount = respClaTime.getStudentCount();
+ this.roomName = respClaTime.getRoomName();
+ this.claColor = respClaTime.getClaColor();
+ this.claTimeStatus = respClaTime.getStatus();
+ return this;
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeColumnTitle.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeColumnTitle.java
new file mode 100644
index 0000000..3c83c90
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeColumnTitle.java
@@ -0,0 +1,22 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import lombok.Data;
+
+/**
+ * 按时间 课表 title
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/23 17:16
+ */
+@Data
+public class ClaTimeColumnTitle {
+
+ // 星期
+ private String weekName;
+
+ // 日期
+ private String day;
+
+ // 排课数量
+ private int count;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeContainer.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeContainer.java
new file mode 100644
index 0000000..ce0b173
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/ClaTimeContainer.java
@@ -0,0 +1,23 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 具体排课数据
+ * table 单行
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/23 18:59
+ */
+@Data
+public class ClaTimeContainer {
+
+ // 上课时间
+ private String time;
+
+ // 排课信息
+ private Map> claTimeWeekDayMap;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespBusinessClaTimeCalendar.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespBusinessClaTimeCalendar.java
new file mode 100644
index 0000000..530d6a5
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespBusinessClaTimeCalendar.java
@@ -0,0 +1,21 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 按时间 课表
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/23 17:15
+ */
+@Data
+public class RespBusinessClaTimeCalendar {
+
+ // 标题
+ private List columnTitles;
+
+ // 行数据
+ private List claTimeContainer;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTime.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTime.java
new file mode 100644
index 0000000..ab4bfed
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTime.java
@@ -0,0 +1,73 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 上课记录
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/2 20:33
+ */
+@Data
+public class RespClaTime {
+
+ private Long courseTimeId;
+
+ private Long claId;
+
+ private String claName;
+
+ private Long courseId;
+
+ private String courseName;
+
+ private Long teacherId;
+
+ private String staffName;
+
+ /**
+ * 状态 1:待上课 2:已上课
+ */
+ private String status;
+
+ private String claDate;
+
+ private String startTime;
+
+ private String endTime;
+
+ private String realClaDate;
+
+ private String realStartTime;
+
+ private String realEndTime;
+
+ // 应到
+ private Integer needAttendCnt;
+
+ // 实到
+ private Integer realAttendCnt;
+
+ private Integer leaveCnt;
+
+ private Integer outCnt;
+
+ private BigDecimal payHour;
+
+ private BigDecimal payTotalHour;
+
+ private BigDecimal payTotalFee;
+
+ private String roomName;
+
+ private String classTheme;
+
+ private String memo;
+
+ // 最后变更时间 记录上课时间
+ private Date lastUpdateTime;
+ // 记录人
+ private String lastUpdateUserName;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeAttend.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeAttend.java
new file mode 100644
index 0000000..db0dce0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeAttend.java
@@ -0,0 +1,47 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 上课记录明细
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/4 20:47
+ */
+@Data
+public class RespClaTimeAttend {
+
+ private Long attendId;
+
+ private Long studentId;
+
+ private String studentName;
+
+ private String claName;
+
+ private String chargeType;
+
+ private Long teacherId;
+
+ private String teacherName;
+
+ private String attendStatus;
+
+ private BigDecimal payHour;
+
+ private BigDecimal payFee;
+
+ private String memo;
+
+ private String realClaDate;
+
+ private String realStartTime;
+
+ private String realEndTime;
+
+ // 创建时间
+ private Date createTime;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeCalendar.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeCalendar.java
new file mode 100644
index 0000000..728f2b0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeCalendar.java
@@ -0,0 +1,26 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import lombok.Data;
+
+/**
+ * 排课信息(课表)
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/18 14:50
+ */
+@Data
+public class RespClaTimeCalendar extends ScClaTime {
+
+ private String claColor;
+
+ private String staffName;
+
+ // 上课星期
+ private Integer weekDay;
+
+ // 上课 开始小时
+ private Integer startHour;
+
+ private Integer studentCount;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeRule.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeRule.java
new file mode 100644
index 0000000..e971c3a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/domain/resp/time/RespClaTimeRule.java
@@ -0,0 +1,29 @@
+package cn.xluobo.business.sc.course.domain.resp.time;
+
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeRule;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 排课信息
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/14 22:14
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class RespClaTimeRule extends ScClaTimeRule {
+
+ private String courseName;
+ private String claName;
+ private String staffName;
+ private String claDate;
+ private String claTimeBegin;
+ private String claTimeEnd;
+
+ private String weekDayName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/enums/ChargeDateUnitEnum.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/enums/ChargeDateUnitEnum.java
new file mode 100644
index 0000000..e24576b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/enums/ChargeDateUnitEnum.java
@@ -0,0 +1,41 @@
+package cn.xluobo.business.sc.course.enums;
+
+/**
+ * 按时间收费周期枚举
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/5 13:23
+ */
+public enum ChargeDateUnitEnum {
+
+ DAY("day","天"),
+ MONTH("month","月"),
+ SEASON("season","季"),
+ YEAR("year","年"),
+ ;
+
+ ChargeDateUnitEnum(String dateUnit, String dateUnitLabel) {
+ this.dateUnit = dateUnit;
+ this.dateUnitLabel = dateUnitLabel;
+ }
+
+ private final String dateUnit;
+
+ private final String dateUnitLabel;
+
+ public String getDateUnit() {
+ return dateUnit;
+ }
+
+ public String getDateUnitLabel() {
+ return dateUnitLabel;
+ }
+
+ public static String getDateUnitLabel(String dateUnit) {
+ for (ChargeDateUnitEnum dateUnitEnum : ChargeDateUnitEnum.values()) {
+ if (dateUnitEnum.getDateUnit().equals(dateUnit)) {
+ return dateUnitEnum.getDateUnitLabel();
+ }
+ }
+ return "";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/enums/CourseChargeTypeEnum.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/enums/CourseChargeTypeEnum.java
new file mode 100644
index 0000000..ee7d316
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/enums/CourseChargeTypeEnum.java
@@ -0,0 +1,42 @@
+package cn.xluobo.business.sc.course.enums;
+
+/**
+ * 课程收费模式
+ * @author :zhangbaoyu
+ * @date :Created in 2020/8/4 15:30
+ */
+public enum CourseChargeTypeEnum {
+
+ // 按课时
+ HOUR("hour", "按课时"),
+ // 按时间
+ DATE("date", "按时间"),
+ // 按期
+ CYCLE("cycle", "按期");
+
+ private final String chargeType;
+
+ private final String chargeTypeName;
+
+ CourseChargeTypeEnum(String chargeType, String chargeTypeName) {
+ this.chargeType = chargeType;
+ this.chargeTypeName = chargeTypeName;
+ }
+
+ public String getChargeType() {
+ return chargeType;
+ }
+
+ public String getChargeTypeName() {
+ return chargeTypeName;
+ }
+
+ public static String getChargeType(String chargeType) {
+ for (CourseChargeTypeEnum chargeTypeEnum : CourseChargeTypeEnum.values()) {
+ if (chargeTypeEnum.getChargeType().equals(chargeType)){
+ return chargeTypeEnum.getChargeTypeName();
+ }
+ }
+ return "未知";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeAttendStatusEnums.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeAttendStatusEnums.java
new file mode 100644
index 0000000..bd03653
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeAttendStatusEnums.java
@@ -0,0 +1,45 @@
+package cn.xluobo.business.sc.course.repo.enums;
+
+/**
+ * 到课状态
+ * @author :zhangbaoyu
+ * @date :Created in 2020/4/30 15:16
+ */
+public enum ClaTimeAttendStatusEnums {
+
+ AT_CLASS("1","到课"),
+ LEAVE_CLASS("2","请假"),
+ OUT_CLASS("3","缺勤"),
+ ;
+
+ private final String attendStatus;
+
+ private final String statusName;
+
+ ClaTimeAttendStatusEnums(String attendStatus, String statusName) {
+ this.attendStatus = attendStatus;
+ this.statusName = statusName;
+ }
+
+ public String getAttendStatus() {
+ return attendStatus;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ /**
+ * 根据状态获取名称
+ * @param status
+ * @return
+ */
+ public static String getNameByStatus(String status) {
+ for (ClaTimeAttendStatusEnums value : ClaTimeAttendStatusEnums.values()) {
+ if(value.getAttendStatus().equals(status)) {
+ return value.getStatusName();
+ }
+ }
+ return "";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeRepeatTypeEnums.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeRepeatTypeEnums.java
new file mode 100644
index 0000000..b9cba7f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeRepeatTypeEnums.java
@@ -0,0 +1,29 @@
+package cn.xluobo.business.sc.course.repo.enums;
+
+/**
+ * 排课 重复方式
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/14 22:20
+ */
+public enum ClaTimeRepeatTypeEnums {
+ EVERY_WEEK("1", "每周重复"),
+ EVERY_SECOND_DAY("2", "隔天重复"),
+ EVERY_SECOND_WEEK("3", "隔周重复"),
+ ;
+
+ private String repeatType;
+ private String repeatTypeName;
+
+ ClaTimeRepeatTypeEnums(String repeatType, String repeatTypeName) {
+ this.repeatType = repeatType;
+ this.repeatTypeName = repeatTypeName;
+ }
+
+ public String getRepeatType() {
+ return repeatType;
+ }
+
+ public String getRepeatTypeName() {
+ return repeatTypeName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeRuleTypeEnums.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeRuleTypeEnums.java
new file mode 100644
index 0000000..ccbb261
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeRuleTypeEnums.java
@@ -0,0 +1,30 @@
+package cn.xluobo.business.sc.course.repo.enums;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/14 21:55
+ */
+public enum ClaTimeRuleTypeEnums {
+
+
+ REPEAT_RULE("1", "重复排课"),
+ ONCE_RULE("2", "单次排课");
+
+
+ private String ruleType;
+
+ private String ruleTypeName;
+
+ ClaTimeRuleTypeEnums(String ruleType, String ruleTypeName) {
+ this.ruleType = ruleType;
+ this.ruleTypeName = ruleTypeName;
+ }
+
+ public String getRuleType() {
+ return ruleType;
+ }
+
+ public String getRuleTypeName() {
+ return ruleTypeName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeSourceEnums.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeSourceEnums.java
new file mode 100644
index 0000000..28e8403
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeSourceEnums.java
@@ -0,0 +1,31 @@
+package cn.xluobo.business.sc.course.repo.enums;
+
+/**
+ * 排课 来源
+ * @author :zhangbaoyu
+ * @date :Created in 2020/4/30 15:13
+ */
+public enum ClaTimeSourceEnums {
+
+ PLAN_CLA_TIME("1","排课"),
+ UN_PLAN_CLA_TIME("2","未排课上课"),
+ ONE_ADD("3","单个新增"),
+ ;
+
+ private final String source;
+
+ private final String sourceName;
+
+ ClaTimeSourceEnums(String source, String sourceName) {
+ this.source = source;
+ this.sourceName = sourceName;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public String getSourceName() {
+ return sourceName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeStatusEnums.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeStatusEnums.java
new file mode 100644
index 0000000..78e27d3
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/enums/ClaTimeStatusEnums.java
@@ -0,0 +1,31 @@
+package cn.xluobo.business.sc.course.repo.enums;
+
+/**
+ * 排课 状态
+ * @author :zhangbaoyu
+ * @date :Created in 2020/4/30 15:16
+ */
+public enum ClaTimeStatusEnums {
+
+ WAIT_CLASS("1","待上课"),
+ HAD_CLASS("2","已上课"),
+ CHANGE_CLASS("3","已调课"),
+ ;
+
+ private final String status;
+
+ private final String statusName;
+
+ ClaTimeStatusEnums(String status, String statusName) {
+ this.status = status;
+ this.statusName = statusName;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeAttendMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeAttendMapper.java
new file mode 100644
index 0000000..c2fa5b8
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeAttendMapper.java
@@ -0,0 +1,87 @@
+package cn.xluobo.business.sc.course.repo.mapper;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeAttend;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeAttend;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ *
+ * 上课出勤表 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-30 02:33:26
+ */
+public interface ScClaTimeAttendMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper {
+
+ /**
+ * 获取明细
+ *
+ * @param reqSearchScClaTimeAttend
+ * @param page
+ * @return
+ */
+ List selectTimeAttendList(@Param("reqSearchScClaTimeAttend") ReqSearchScClaTimeAttend reqSearchScClaTimeAttend, @Param("page") Page page);
+
+ /**
+ * 学生出席记录数量
+ *
+ * @param studentCourseId 学生报读课程id
+ * @param beginDate 开始时间
+ * @param endDate 结束时间
+ * @return
+ */
+ int selectStudentAttendCount(@Param("studentCourseId") Long studentCourseId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+ /**
+ * 应上课人数
+ *
+ * @param beginDate
+ * @param endDate
+ * @return
+ */
+ Integer selectNeedAttendCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+ /**
+ * 学生上课出席数量
+ *
+ * @param beginDate
+ * @param endDate
+ * @param attendStatus
+ * @return
+ */
+ Integer selectAttendCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("attendStatus") String[] attendStatus);
+
+ /**
+ * 实消 学生消耗课时数量
+ *
+ * @param beginDate
+ * @param endDate
+ * @return
+ */
+ BigDecimal selectAttendCostHour(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+ /**
+ * 应消 学生消耗课时数量
+ *
+ * @param beginDate
+ * @param endDate
+ * @return
+ */
+ BigDecimal selectNeedAttendCostHour(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+ /**
+ * 教师 指定日期范围内 累计获得课时
+ * 只统计 课时,不统计按时间缴费的
+ *
+ * @param reqClaTimeCount
+ * @return
+ */
+ BigDecimal selectTeacherSumGetHour(ReqClaTimeCount reqClaTimeCount);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeMapper.java
new file mode 100644
index 0000000..7e7c726
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeMapper.java
@@ -0,0 +1,48 @@
+package cn.xluobo.business.sc.course.repo.mapper;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchClaTime;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTime;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeCalendar;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *
+ * 排课信息 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-16
+ */
+public interface ScClaTimeMapper extends BaseMapper {
+
+ /**
+ * 获取排课信息
+ *
+ * @param searchClaTime
+ * @return
+ */
+ List selectListForCalendar(ReqSearchClaTime searchClaTime);
+
+ /**
+ * 获取上课记录
+ *
+ * @param searchClaTime
+ * @return
+ */
+ List selectListForAttend(@Param("searchClaTime") ReqSearchClaTime searchClaTime, @Param("page") Page page);
+
+ /**
+ * 数量
+ *
+ * @param reqClaTimeCount
+ * @return
+ */
+ Integer selectClaTimeCount(ReqClaTimeCount reqClaTimeCount);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeRuleMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeRuleMapper.java
new file mode 100644
index 0000000..fcf9a94
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScClaTimeRuleMapper.java
@@ -0,0 +1,52 @@
+package cn.xluobo.business.sc.course.repo.mapper;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeRule;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeRule;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *
+ * 上课时间配置规则 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-14
+ */
+public interface ScClaTimeRuleMapper extends BaseMapper {
+
+ /**
+ * 获取一定时间范围内的排课信息
+ *
+ * @param reqSearchScClaTimeRule
+ * @param page
+ * @return
+ */
+ List selectByCondition(@Param("reqSearchScClaTimeRule") ReqSearchScClaTimeRule reqSearchScClaTimeRule, @Param("page") Page page);
+
+ /**
+ * 获取制定日期的排课信息
+ * @param claId
+ * @param day
+ * @return
+ */
+ List selectByDay(@Param("claId")Long claId, @Param("day")String day);
+
+ /**
+ * 根据id获取规则
+ * @param ruleId
+ * @return
+ */
+ RespClaTimeRule selectByRuleId(Long ruleId);
+
+ /**
+ * 获取班级上课时间
+ * @param claId
+ * @return
+ */
+ List selectClaTimeInfo(Long claId);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseChargeMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseChargeMapper.java
new file mode 100644
index 0000000..d3e4d29
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseChargeMapper.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.sc.course.repo.mapper;
+
+import cn.xluobo.business.sc.course.repo.model.ScCourseCharge;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 课程收费模式 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-08
+ */
+public interface ScCourseChargeMapper extends BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseClaMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseClaMapper.java
new file mode 100644
index 0000000..0edaad8
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseClaMapper.java
@@ -0,0 +1,62 @@
+package cn.xluobo.business.sc.course.repo.mapper;
+
+import cn.xluobo.business.sc.course.domain.req.ReqCourseClaSelect;
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseCla;
+import cn.xluobo.business.sc.course.domain.req.cla.ReqClaCount;
+import cn.xluobo.business.sc.course.domain.resp.RespCourseClaInfo;
+import cn.xluobo.business.sc.course.domain.resp.RespCourseClaSelectInfo;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.annotation.SqlParser;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *
+ * 课程班级信息 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 01:11:06
+ */
+public interface ScCourseClaMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper {
+
+ /**
+ * 班级列表
+ *
+ * @param reqSearchScCourseCla
+ * @param page
+ * @return
+ */
+ List selectClaList(@Param("reqSearchScCourseCla")ReqSearchScCourseCla reqSearchScCourseCla, @Param("page")RespPage page);
+
+ /**
+ * 班级select
+ * @param courseClaSelect
+ * @return
+ */
+ List selectForSelect(ReqCourseClaSelect courseClaSelect);
+
+ /**
+ * 班级数量
+ * @param reqClaCount
+ * @return
+ */
+ Integer selectClaCount(ReqClaCount reqClaCount);
+
+ /**
+ * 班级数量
+ * @param tenantId
+ * @return
+ */
+ @SqlParser(filter = true)
+ Integer selectTenantClaCount(String tenantId);
+
+ /**
+ * 班级在读学员数量
+ * @param claId
+ * @return
+ */
+ Integer selectStudentCnt(Long claId);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseMapper.java
new file mode 100644
index 0000000..c07650c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseMapper.java
@@ -0,0 +1,64 @@
+package cn.xluobo.business.sc.course.repo.mapper;
+
+import cn.xluobo.business.sc.course.domain.export.ExpCourse;
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
+import cn.xluobo.business.sc.course.domain.resp.course.RespSearchCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.core.page.ReqDeptCondition;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.annotation.SqlParser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *
+ * 课程信息 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 11:25:55
+ */
+public interface ScCourseMapper extends BaseMapper {
+
+ /**
+ * 获取课程列表
+ * @param reqSearchScCourse
+ * @param page
+ * @return
+ */
+ List selectCourseList(@Param("reqSearchScCourse") ReqSearchScCourse reqSearchScCourse, @Param("page") RespPage page);
+
+ /**
+ * 获取课程列表
+ * 包含学生当前课程状态
+ * @param reqSearchScCourse
+ * @param page
+ * @return
+ */
+ List selectCourseListWithStudentCourse(@Param("reqSearchScCourse") ReqSearchScCourse reqSearchScCourse, @Param("page") RespPage page);
+
+ /**
+ * 导出课程
+ * @param reqSearchScCourse
+ * @return
+ */
+ List selectCourseForExport(@Param("reqSearchScCourse") ReqSearchScCourse reqSearchScCourse);
+
+ /**
+ * 课程数量
+ * @param reqDeptCondition
+ * @return
+ */
+ Integer selectCourseCount(ReqDeptCondition reqDeptCondition);
+
+ /**
+ * 租户下课程数量
+ * @param tenantId
+ * @return
+ */
+ @SqlParser(filter = true)
+ Integer selectTenantCourseCount(String tenantId);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseTypeMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseTypeMapper.java
new file mode 100644
index 0000000..a33da77
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapper/ScCourseTypeMapper.java
@@ -0,0 +1,15 @@
+package cn.xluobo.business.sc.course.repo.mapper;
+
+import cn.xluobo.business.sc.course.repo.model.ScCourseType;
+
+/**
+ *
+ * 课程类型 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-09 08:10:25
+ */
+public interface ScCourseTypeMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeAttendMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeAttendMapper.xml
new file mode 100644
index 0000000..0bfe1ae
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeAttendMapper.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeMapper.xml
new file mode 100644
index 0000000..33542ed
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeMapper.xml
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeRuleMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeRuleMapper.xml
new file mode 100644
index 0000000..981b9cf
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScClaTimeRuleMapper.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseChargeMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseChargeMapper.xml
new file mode 100644
index 0000000..843f3f2
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseChargeMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseClaMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseClaMapper.xml
new file mode 100644
index 0000000..d53a3ec
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseClaMapper.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseMapper.xml
new file mode 100644
index 0000000..b8266d0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseMapper.xml
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseTypeMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseTypeMapper.xml
new file mode 100644
index 0000000..895d17f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/mapping/ScCourseTypeMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTime.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTime.java
new file mode 100644
index 0000000..170521c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTime.java
@@ -0,0 +1,231 @@
+package cn.xluobo.business.sc.course.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * 排课信息
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_cla_time")
+public class ScClaTime implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 排课编号
+ */
+ @TableId(value = "course_time_id", type = IdType.ASSIGN_ID)
+ private Long courseTimeId;
+
+ /**
+ * 规则编号
+ */
+ @TableField("rule_id")
+ private Long ruleId;
+
+ /**
+ * 班级id
+ */
+ @TableField("cla_id")
+ private Long claId;
+
+ /**
+ * 任课教师
+ */
+ @TableField("teacher_id")
+ private Long teacherId;
+
+ /**
+ * 上课教室
+ */
+ @TableField("room_id")
+ private Long roomId;
+
+ /**
+ * 上课教室
+ */
+ @TableField("room_name")
+ private String roomName;
+
+ /**
+ * 上课主题
+ */
+ @TableField("class_theme")
+ private String classTheme;
+
+ /**
+ * 上课日期 如:2020-02-05
+ */
+ @TableField("cla_date")
+ private String claDate;
+
+ /**
+ * 上课开始时间
+ */
+ @TableField("start_time")
+ private String startTime;
+
+ /**
+ * 上课结束时间
+ */
+ @TableField("end_time")
+ private String endTime;
+
+ /**
+ * 实际上课时间
+ */
+ @TableField("real_cla_date")
+ private String realClaDate;
+
+ /**
+ * 实际开始时间
+ */
+ @TableField("real_start_time")
+ private String realStartTime;
+
+ /**
+ * 实际结束时间
+ */
+ @TableField("real_end_time")
+ private String realEndTime;
+
+ /**
+ * 课时变更数量
+ */
+ @TableField("pay_hour")
+ private BigDecimal payHour;
+
+ /**
+ * 总课时消耗
+ */
+ @TableField("pay_total_hour")
+ private BigDecimal payTotalHour;
+
+ /**
+ * 总学费消耗
+ */
+ @TableField("pay_total_fee")
+ private BigDecimal payTotalFee;
+
+ /**
+ * 来源 1:重复排课 2:未排课上课 3:单个新增
+ */
+ @TableField("source")
+ private String source;
+
+ /**
+ * 状态 1:待上课 2:已上课
+ */
+ @TableField("status")
+ private String status;
+
+ /**
+ * 应到人数
+ */
+ @TableField("need_attend_cnt")
+ private Integer needAttendCnt;
+
+ /**
+ * 实到人数
+ */
+ @TableField("real_attend_cnt")
+ private Integer realAttendCnt;
+
+ /**
+ * 到课人数
+ */
+ @TableField("at_class_cnt")
+ private Integer atClassCnt;
+
+ /**
+ * 请假人数
+ */
+ @TableField("leave_cnt")
+ private Integer leaveCnt;
+
+ /**
+ * 缺勤人数
+ */
+ @TableField("out_cnt")
+ private Integer outCnt;
+
+ /**
+ * 备注
+ */
+ @TableField("memo")
+ private String memo;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+
+ @TableField(exist = false)
+ private Long deptId;
+ @TableField(exist = false)
+ private String courseName;
+ @TableField(exist = false)
+ private String claName;
+ @TableField(exist = false)
+ private String deptName;
+
+ public boolean checkUpdateParam() {
+ if (StringUtils.isAnyEmpty(claDate, startTime, endTime)) {
+ return false;
+ }
+ if (null == teacherId) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean checkAddParam() {
+ if(null == claId || null == teacherId) {
+ return false;
+ }
+ if (StringUtils.isAnyEmpty(claDate, startTime, endTime)) {
+ return false;
+ }
+ return true;
+ }
+
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTimeAttend.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTimeAttend.java
new file mode 100644
index 0000000..2c9989a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTimeAttend.java
@@ -0,0 +1,125 @@
+package cn.xluobo.business.sc.course.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * 上课出勤表
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-30 02:33:26
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_cla_time_attend")
+public class ScClaTimeAttend implements Serializable {
+
+
+ /**
+ * 主键
+ */
+ @TableId(value = "attend_id", type = IdType.ASSIGN_ID)
+ private Long attendId;
+
+ @TableField(value = "student_course_id")
+ private Long studentCourseId;
+
+ @TableField(value = "course_order_id")
+ private Long courseOrderId;
+
+ /**
+ * sc_cla_time.course_time_id
+ */
+ @TableField("course_time_id")
+ private Long courseTimeId;
+
+ /**
+ * 学生
+ */
+ @TableField("student_id")
+ private Long studentId;
+
+ /**
+ * 班级 冗余自动
+ */
+ @TableField("cla_id")
+ private Long claId;
+
+ /**
+ * 课程 冗余自动
+ */
+ @TableField("course_id")
+ private Long courseId;
+
+ /**
+ * 上课教师
+ */
+ @TableField("teacher_id")
+ private Long teacherId;
+
+ /**
+ * 教师名
+ */
+ @TableField("teacher_name")
+ private String teacherName;
+
+ /**
+ * 收费模式 hour:课时 date:时间 cycle:期
+ */
+ @TableField("charge_type")
+ private String chargeType;
+
+ /**
+ * 出席状态 1:到课 2:请假 3:缺勤
+ */
+ @TableField("attend_status")
+ private String attendStatus;
+
+ /**
+ * 教师获取课时数量
+ */
+ @TableField("teacher_get_hour")
+ private BigDecimal teacherGetHour;
+
+ /**
+ * 扣减课时数量
+ */
+ @TableField("pay_hour")
+ private BigDecimal payHour;
+
+ /**
+ * 学费消耗
+ */
+ @TableField("pay_fee")
+ private BigDecimal payFee;
+
+ /**
+ * 备注
+ */
+ @TableField("memo")
+ private String memo;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTimeRule.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTimeRule.java
new file mode 100644
index 0000000..84c37eb
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScClaTimeRule.java
@@ -0,0 +1,190 @@
+package cn.xluobo.business.sc.course.repo.model;
+
+import cn.xluobo.business.sc.course.repo.enums.ClaTimeRepeatTypeEnums;
+import cn.xluobo.business.sc.course.repo.enums.ClaTimeRuleTypeEnums;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 上课时间配置规则
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_cla_time_rule")
+public class ScClaTimeRule implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 规则id
+ */
+ @TableId(value = "rule_id", type = IdType.ASSIGN_ID)
+ private Long ruleId;
+
+ /**
+ * 班级
+ */
+ @TableField("cla_id")
+ private Long claId;
+
+ /**
+ * 规则类型 1重复排课 2单次排课
+ */
+ @TableField("rule_type")
+ private String ruleType;
+
+ /**
+ * 开始日期
+ */
+ @TableField("begin_date")
+ private String beginDate;
+
+ /**
+ * 结束日期
+ */
+ @TableField("end_date")
+ private String endDate;
+
+ /**
+ * 单次排课 日期
+ */
+ @TableField("once_date")
+ private String onceDate;
+
+ /**
+ * 重复方式 1每周重复 2隔天重复 3隔周重复
+ */
+ @TableField("repeat_type")
+ private String repeatType;
+
+ /**
+ * 上课星期 周几上课
+ */
+ @TableField("week_day")
+ private String weekDay;
+
+ /**
+ * 是否过滤节假日 1过滤 0不过滤
+ */
+ @TableField("filter_holiday")
+ private boolean filterHoliday;
+
+ /**
+ * 上课时间
+ */
+ @TableField("start_time")
+ private String startTime;
+
+ /**
+ * 下课时间
+ */
+ @TableField("end_time")
+ private String endTime;
+
+ /**
+ * 任课教师
+ */
+ @TableField("teacher_id")
+ private Long teacherId;
+
+ /**
+ * 上课教室
+ */
+ @TableField("room_id")
+ private Long roomId;
+
+ /**
+ * 上课教室
+ */
+ @TableField("room_name")
+ private String roomName;
+
+ /**
+ * 上课主题
+ */
+ @TableField("class_theme")
+ private String classTheme;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+
+ /**
+ * 单次排课 选择的上课日期
+ */
+ @TableField(exist = false)
+ private String[] chooseDate;
+
+ /**
+ * 所属校区
+ */
+ @TableField(exist = false)
+ private Long deptId;
+
+ public boolean checkParam() {
+ if (null == claId || null == teacherId) {
+ return false;
+ }
+ if (StringUtils.isAnyEmpty(ruleType)) {
+ return false;
+ }
+ if (ClaTimeRuleTypeEnums.ONCE_RULE.getRuleType().equals(ruleType)) {
+ if (StringUtils.isAnyEmpty(startTime, endTime)) {
+ return false;
+ } else if (null == chooseDate || chooseDate.length == 0) {
+ return false;
+ }
+ }
+ if ("1".equals(ruleType) && StringUtils.isAnyEmpty(repeatType)) {
+ return false;
+ }
+ if (ClaTimeRepeatTypeEnums.EVERY_WEEK.getRepeatType().equals(repeatType)
+ || ClaTimeRepeatTypeEnums.EVERY_SECOND_WEEK.getRepeatType().equals(repeatType)) {
+ if (StringUtils.isAnyEmpty(weekDay, startTime, endTime, beginDate, endDate)) {
+ return false;
+ }
+ } else {
+ if (StringUtils.isAnyEmpty(startTime, endTime)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourse.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourse.java
new file mode 100644
index 0000000..1342026
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourse.java
@@ -0,0 +1,111 @@
+package cn.xluobo.business.sc.course.repo.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 课程信息
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 11:25:55
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_course")
+public class ScCourse implements Serializable {
+
+
+ /**
+ * 课程id
+ */
+ @TableId(value = "course_id")
+ private Long courseId;
+
+ /**
+ * 所属租户
+ */
+ @TableField("tenant_id")
+ private String tenantId;
+
+ /**
+ * 课程名称
+ */
+ @TableField("course_name")
+ private String courseName;
+
+ /**
+ * 课程类型
+ */
+ @TableField("course_type_id")
+ private Long courseTypeId;
+
+ /**
+ * 授课模式 1 班课 2 一对一
+ */
+ @TableField("teaching_mode")
+ private String teachingMode;
+
+ /**
+ * 课程简介
+ */
+ @TableField("course_intro")
+ private String courseIntro;
+
+ /**
+ * 是否在售 1在售 0停售
+ */
+ @TableField("sale")
+ private String sale;
+
+ /**
+ * 删除标志(1删除 0在用)
+ */
+ @TableField("delete_flag")
+ @TableLogic
+ private String deleteFlag;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ @JsonIgnore
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ @JsonIgnore
+ private Date lastUpdateTime;
+
+ /**
+ * 导入id
+ */
+ @TableField(value = "import_id")
+ @JsonIgnore
+ private Long importId;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseCharge.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseCharge.java
new file mode 100644
index 0000000..dc59361
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseCharge.java
@@ -0,0 +1,84 @@
+package cn.xluobo.business.sc.course.repo.model;
+
+import cn.xluobo.business.sc.course.enums.ChargeDateUnitEnum;
+import cn.xluobo.business.sc.course.enums.CourseChargeTypeEnum;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *
+ * 课程收费模式
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_course_charge")
+public class ScCourseCharge implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 收费编号
+ */
+ @TableId(value = "charge_id")
+ private Long chargeId;
+
+ /**
+ * 课程编号
+ */
+ @TableField("course_id")
+ private Long courseId;
+
+ /**
+ * 校区 -1为全部校区
+ */
+ @TableField("depart_id")
+ private Long departId;
+
+ /**
+ * 收费模式 hour:课时 date:时间 cycle:期
+ */
+ @TableField("charge_type")
+ private String chargeType;
+
+ /**
+ * 课时数量
+ */
+ @TableField("count")
+ private BigDecimal count;
+
+ /**
+ * 总价
+ */
+ @TableField("total_fee")
+ private BigDecimal totalFee;
+
+ /**
+ * 时间周期 天/月/季/年
+ */
+ @TableField("date_unit")
+ private String dateUnit;
+
+ public String getChargeName() {
+ if (CourseChargeTypeEnum.HOUR.getChargeType().equals(chargeType)) {
+ return "按课时 " + count.toString() + "课时=" + totalFee +"元";
+ } else if (CourseChargeTypeEnum.DATE.getChargeType().equals(chargeType)) {
+ return "按时间 " + count.toString() + ChargeDateUnitEnum.getDateUnitLabel(dateUnit) + "=" + totalFee+"元";
+ } else if (CourseChargeTypeEnum.CYCLE.getChargeType().equals(chargeType)) {
+ return "按周期 " + count.toString() + "课时=" + totalFee +"元";
+ }
+ return "";
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseCla.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseCla.java
new file mode 100644
index 0000000..9027b6f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseCla.java
@@ -0,0 +1,170 @@
+package cn.xluobo.business.sc.course.repo.model;
+
+import cn.xluobo.core.api.APIBaseResponse;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * 课程班级信息
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-07
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_course_cla")
+public class ScCourseCla implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 班级id
+ */
+ @TableId(value = "cla_id")
+ private Long claId;
+
+ /**
+ * 所属租户
+ */
+ @TableField("tenant_id")
+ private String tenantId;
+
+ /**
+ * 课程id
+ */
+ @TableField("course_id")
+ private Long courseId;
+
+ /**
+ * 开班校区
+ */
+ @TableField("depart_id")
+ private Long departId;
+
+ /**
+ * 班主任id
+ */
+ @TableField("staff_id")
+ private Long staffId;
+
+ /**
+ * 班级名称
+ */
+ @TableField("cla_name")
+ private String claName;
+
+ /**
+ * 班级颜色
+ */
+ @TableField("cla_color")
+ private String claColor;
+
+ /**
+ * 满班人数
+ */
+ @TableField("capacity")
+ private Integer capacity;
+
+ /**
+ * 招生状态 1开放 2满班后停止 0停止
+ */
+ @TableField("recruit_status")
+ private String recruitStatus;
+
+ /**
+ * 每次上课学生扣除课时
+ */
+ @TableField("every_stu_lose_hour")
+ private BigDecimal everyStuLoseHour;
+
+ /**
+ * 每次上课教师获得课时
+ */
+ @TableField("every_tea_get_hour")
+ private BigDecimal everyTeaGetHour;
+
+ /**
+ * 开班日期
+ */
+ @TableField("open_date")
+ private String openDate;
+
+ /**
+ * 结班日期
+ */
+ @TableField("close_date")
+ private String closeDate;
+
+ /**
+ * 备注
+ */
+ @TableField("memo")
+ private String memo;
+
+ /**
+ * 删除标志(1删除 0在用)
+ */
+ @TableField("delete_flag")
+ private String deleteFlag;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+
+ @TableField(exist = false)
+ private String deptName;
+
+ @TableField(exist = false)
+ private String teacherName;
+
+ // 当前班级人数
+ @TableField(exist = false)
+ private Integer studentCnt;
+
+ /**
+ * 校验参数
+ * @return
+ */
+ public APIBaseResponse checkParam(){
+ if(StringUtils.isAnyEmpty(claName,claColor,recruitStatus,openDate)){
+ return APIBaseResponse.fail("请求参数错误,请全部填写后,重新提交");
+ }
+ if(null == courseId || null == departId || null == staffId || null == capacity || null == everyStuLoseHour || null == everyTeaGetHour){
+ return APIBaseResponse.fail("请求参数错误,请全部填写后,重新提交");
+ }
+ return APIBaseResponse.success();
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseType.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseType.java
new file mode 100644
index 0000000..627f0fa
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/repo/model/ScCourseType.java
@@ -0,0 +1,66 @@
+package cn.xluobo.business.sc.course.repo.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 课程类型
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-09 08:10:25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_course_type")
+public class ScCourseType implements Serializable {
+
+
+ @TableId(value = "course_type_id")
+ private Long courseTypeId;
+
+ /**
+ * 所属租户
+ */
+ @TableField("tenant_id")
+ private String tenantId;
+
+ /**
+ * 课程类型名
+ */
+ @TableField("course_type")
+ private String courseType;
+
+ /**
+ * 排序
+ */
+ @TableField("sort")
+ private Integer sort;
+
+ /**
+ * 状态(1正常 0停用)
+ */
+ @TableField("in_use")
+ private String inUse;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessClaTimeRuleService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessClaTimeRuleService.java
new file mode 100644
index 0000000..460b089
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessClaTimeRuleService.java
@@ -0,0 +1,182 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+import cn.xluobo.business.sc.base.service.IScRoomService;
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeRule;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule;
+import cn.xluobo.business.sc.course.repo.mapper.ScClaTimeRuleMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeRule;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/18 15:38
+ */
+@Service
+@Transactional
+public class BusinessClaTimeRuleService {
+
+ @Autowired
+ private IScClaTimeService claTimeService;
+ @Autowired
+ private IScClaTimeRuleService claTimeRuleService;
+ @Autowired
+ private ScClaTimeRuleMapper claTimeRuleMapper;
+ @Autowired
+ private IScCourseClaService courseClaService;
+ @Autowired
+ private IScRoomService roomService;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScClaTimeRule
+ * @return
+ */
+ public APIResponse searchList(ReqSearchScClaTimeRule reqSearchScClaTimeRule) {
+ RespPage respPage = new RespPage<>(reqSearchScClaTimeRule.getPageNum(),reqSearchScClaTimeRule.getPageSize());
+ List claTimeRuleList = claTimeRuleMapper.selectByCondition(reqSearchScClaTimeRule, respPage);
+ respPage.setRows(claTimeRuleList);
+ return APIResponse.toAPIResponse(respPage);
+ }
+
+ /**
+ * 添加
+ *
+ * @param claTimeRule
+ * @return
+ */
+ public APIResponse addClaTimeRule(ScClaTimeRule claTimeRule) {
+ if (!claTimeRule.checkParam()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
+ }
+ // 教室
+ if(null != claTimeRule.getRoomId()) {
+ ScRoom room = roomService.getById(claTimeRule.getRoomId());
+ claTimeRule.setRoomName(room.getRoomName());
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ claTimeRule.setCreateUser(loginUser.getUserId());
+ claTimeRule.setCreateTime(new Date());
+ claTimeRuleService.save(claTimeRule);
+ saveBatchClaTime(claTimeRule);
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 详情
+ *
+ * @param ruleId
+ * @return
+ */
+ public APIResponse detailById(Long ruleId) {
+ if (null == ruleId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ ScClaTimeRule claTimeRule = claTimeRuleService.getById(ruleId);
+ // 设置deptId
+ Long claId = claTimeRule.getClaId();
+ ScCourseCla courseCla = courseClaService.getById(claId);
+ claTimeRule.setDeptId(courseCla.getDepartId());
+
+ return APIResponse.toAPIResponse(claTimeRule);
+ }
+
+
+ /**
+ * 更新
+ *
+ * @param claTimeRule
+ * @return
+ */
+ public APIResponse updateClaTimeRule(ScClaTimeRule claTimeRule) {
+ if (null == claTimeRule.getRuleId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
+ }
+ if (!claTimeRule.checkParam()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
+ }
+ // 教室
+ if(null != claTimeRule.getRoomId()) {
+ ScRoom room = roomService.getById(claTimeRule.getRoomId());
+ claTimeRule.setRoomName(room.getRoomName());
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ claTimeRule.setLastUpdateUser(loginUser.getUserId());
+ claTimeRule.setLastUpdateTime(new Date());
+ boolean updateScCourseType = claTimeRuleService.updateById(claTimeRule);
+ //claTimeService.deleteUnBeginTime(claTimeRule.getRuleId(), claTimeRule.getClaId(), loginUser.getNowTenantId());
+
+ saveBatchClaTime(claTimeRule);
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 删除
+ *
+ * @param ruleId
+ * @return
+ */
+ public APIResponse deleteById(Long ruleId) {
+ if (null == ruleId) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ ScClaTimeRule claTimeRule = claTimeRuleService.getById(ruleId);
+
+ claTimeRuleService.removeById(ruleId);
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ //claTimeService.deleteUnBeginTime(claTimeRule.getRuleId(), claTimeRule.getClaId(), loginUser.getNowTenantId());
+
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 保存 具体上课日期
+ *
+ * @param claTimeRule
+ */
+ private void saveBatchClaTime(ScClaTimeRule claTimeRule) {
+ Long claId = claTimeRule.getClaId();
+ ScCourseCla courseCla = courseClaService.getById(claId);
+ BigDecimal everyStuLoseHour = courseCla.getEveryStuLoseHour();
+
+ List claTimeList = claTimeRuleService.getClaTimeListByRule(claTimeRule, null);
+
+ List timeList = claTimeList.stream().map(item -> {
+ ScClaTime claTime = new ScClaTime();
+ claTime.setRuleId(claTimeRule.getRuleId());
+ claTime.setClaId(claTimeRule.getClaId());
+ claTime.setClaDate(item.getClaDate());
+ claTime.setStartTime(item.getClaTimeBegin());
+ claTime.setEndTime(item.getClaTimeEnd());
+ claTime.setPayHour(everyStuLoseHour);
+ // 排课
+ claTime.setSource("1");
+ // 待上课
+ claTime.setStatus("1");
+ claTime.setRoomId(claTimeRule.getRoomId());
+ claTime.setRoomName(claTimeRule.getRoomName());
+ claTime.setClassTheme(claTimeRule.getClassTheme());
+ claTime.setTeacherId(claTimeRule.getTeacherId());
+ claTime.setCreateUser(claTimeRule.getCreateUser());
+ return claTime;
+ }).collect(Collectors.toList());
+ claTimeService.saveBatch(timeList);
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessClaTimeService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessClaTimeService.java
new file mode 100644
index 0000000..35c0dd0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessClaTimeService.java
@@ -0,0 +1,433 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.base.repo.model.ScRoom;
+import cn.xluobo.business.sc.base.service.IScRoomService;
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchClaTime;
+import cn.xluobo.business.sc.course.domain.resp.time.*;
+import cn.xluobo.business.sc.course.repo.enums.ClaTimeStatusEnums;
+import cn.xluobo.business.sc.course.repo.mapper.ScClaTimeMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.business.sc.student.domain.req.ReqClaTimeAttend;
+import cn.xluobo.business.sc.student.service.BusinessScStudentCourseService;
+import cn.xluobo.business.sc.student.service.IScStudentCourseService;
+import cn.xluobo.business.sys.admin.service.ISysDeptService;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.constants.SysConstant;
+import cn.xluobo.core.page.RespPage;
+import cn.xluobo.core.utils.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/16 17:05
+ */
+@Service
+@Transactional
+public class BusinessClaTimeService {
+
+ @Autowired
+ private IScClaTimeService claTimeService;
+ @Autowired
+ private ScClaTimeMapper claTimeMapper;
+ @Autowired
+ private IScRoomService roomService;
+ @Autowired
+ private IScCourseClaService claService;
+ @Autowired
+ private IScCourseService courseService;
+ @Autowired
+ private ISysDeptService deptService;
+ @Autowired
+ private IScClaTimeAttendService claTimeAttendService;
+ @Autowired
+ private IScStudentCourseService studentCourseService;
+ @Autowired
+ private BusinessScStudentCourseService businessScStudentCourseService;
+
+ /**
+ * 按周获取课表
+ *
+ * @param reqSearchClaTime
+ * @return
+ */
+ public APIResponse searchListForCalendar(ReqSearchClaTime reqSearchClaTime) {
+ String beginDate = reqSearchClaTime.getBeginDate();
+ String endDate = reqSearchClaTime.getEndDate();
+ Long deptId = reqSearchClaTime.getDeptId();
+
+ if (StringUtils.isAnyEmpty(beginDate, endDate)) {
+ return APIResponse.toOkResponse();
+ }
+
+ DateTime cycleBegin = DateUtil.yyyMMddDayBegin(beginDate);
+ DateTime cycleEnd = DateUtil.yyyMMddDayEnd(endDate);
+
+ if (1 != cycleBegin.getDayOfWeek() || 7 != cycleEnd.getDayOfWeek()) {
+ return APIResponse.toOkResponse();
+ }
+
+ // 日历数据 格式为:时间->星期->课程
+ Map>> claTimeCalendarMap = Maps.newHashMap();
+ SysConstant.CLA_TIME_MAP.forEach((claTimeKey, claTimeValue) -> {
+ Map> weekDayMap = Maps.newHashMap();
+ SysConstant.WEEK_DAY_MAP.forEach((weekDayKey, weekDay) -> {
+ List claTimeArrayList = Lists.newArrayList();
+ weekDayMap.put(weekDayKey, claTimeArrayList);
+ });
+ claTimeCalendarMap.put(claTimeKey, weekDayMap);
+ });
+
+ // 获取排课信息
+ List respClaTimeList = claTimeMapper.selectListForCalendar(reqSearchClaTime);
+
+ // 将排课信息 入到 claTimeCalendarMap
+ respClaTimeList.forEach(item -> {
+ Integer weekDay = item.getWeekDay();
+ Integer startHour = item.getStartHour();
+
+ if (claTimeCalendarMap.containsKey(startHour)) {
+ claTimeCalendarMap.get(startHour).get(weekDay).add(item);
+ } else if (claTimeCalendarMap.containsKey(startHour - 1)) {
+ // 每两个小时 一个上课时段,所以-1
+ claTimeCalendarMap.get(startHour - 1).get(weekDay).add(item);
+ }
+ });
+
+
+ RespBusinessClaTimeCalendar timeCalendar = new RespBusinessClaTimeCalendar();
+ // 每行数据
+ List claTimeContainerList = Lists.newArrayList();
+ // 星期排课数量
+ Map columnTitleTimeCountMap = Maps.newHashMap();
+
+ // 每行数据
+ claTimeCalendarMap.forEach((claTimeKey, claTimeMap) -> {
+ ClaTimeContainer claTimeContainer = new ClaTimeContainer();
+ claTimeContainer.setTime(SysConstant.CLA_TIME_MAP.get(claTimeKey));
+
+ Map> claTimeWeekDayMap = Maps.newHashMap();
+ claTimeMap.forEach((weekDayKey, list) -> {
+
+ // 排课数量
+ if (columnTitleTimeCountMap.containsKey(weekDayKey)) {
+ columnTitleTimeCountMap.put(weekDayKey, columnTitleTimeCountMap.get(weekDayKey) + list.size());
+ } else {
+ columnTitleTimeCountMap.put(weekDayKey, list.size());
+ }
+
+ List timeItemList = list.stream().map(item -> {
+ ClaTimeCalendarItem claTimeItem = new ClaTimeCalendarItem();
+ claTimeItem.transfer(item);
+ return claTimeItem;
+ }).collect(Collectors.toList());
+ claTimeWeekDayMap.put(weekDayKey, timeItemList);
+ });
+ claTimeContainer.setClaTimeWeekDayMap(claTimeWeekDayMap);
+ claTimeContainerList.add(claTimeContainer);
+ });
+ Collections.sort(claTimeContainerList, (o1, o2) -> {
+ int a = Integer.parseInt(o1.getTime().substring(0, 2));
+ int b = Integer.parseInt(o2.getTime().substring(0, 2));
+ if (a > b) {
+ return 1;
+ } else if (a < b) {
+ return -1;
+ } else {
+ return 0;
+ }
+ });
+ timeCalendar.setClaTimeContainer(claTimeContainerList);
+
+
+ // 标题
+ List columnTitles = Lists.newArrayList();
+ while (cycleBegin.isBefore(cycleEnd)) {
+ int dayOfWeek = cycleBegin.getDayOfWeek();
+
+ ClaTimeColumnTitle claTimeColumnTitle = new ClaTimeColumnTitle();
+ claTimeColumnTitle.setWeekName(SysConstant.WEEK_DAY_MAP.get(dayOfWeek));
+ claTimeColumnTitle.setDay(cycleBegin.toString("MM-dd"));
+ claTimeColumnTitle.setCount(columnTitleTimeCountMap.get(dayOfWeek));
+
+ columnTitles.add(claTimeColumnTitle);
+ cycleBegin = cycleBegin.plusDays(1);
+ }
+ timeCalendar.setColumnTitles(columnTitles);
+
+ return APIResponse.toAPIResponse(timeCalendar);
+ }
+
+ /**
+ * 获取最近几天的排课
+ *
+ * @param reqSearchClaTime
+ * @return
+ */
+ public List searchRecentDayTimeList(ReqSearchClaTime reqSearchClaTime) {
+ return claTimeMapper.selectListForCalendar(reqSearchClaTime);
+ }
+
+ /**
+ * 获取上课记录
+ *
+ * @param searchClaTime
+ * @return
+ */
+ public RespPage selectListForAttend(ReqSearchClaTime searchClaTime) {
+ RespPage page = new RespPage<>(searchClaTime.getPageNum(), searchClaTime.getPageSize());
+ List claTimeList = claTimeMapper.selectListForAttend(searchClaTime, page);
+ page.setRows(claTimeList);
+ return page;
+ }
+
+ /**
+ * 添加
+ *
+ * @param claTime
+ * @return
+ */
+ public APIResponse addClaTime(ScClaTime claTime) {
+ if (!claTime.checkAddParam()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
+ }
+ // 教室
+ if (null != claTime.getRoomId()) {
+ ScRoom room = roomService.getById(claTime.getRoomId());
+ claTime.setRoomName(room.getRoomName());
+ }
+
+ ScCourseCla courseCla = claService.getById(claTime.getClaId());
+ claTime.setPayHour(courseCla.getEveryStuLoseHour());
+ claTime.setSource("3");
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ claTime.setCreateUser(loginUser.getUserId());
+ claTime.setCreateTime(new Date());
+ claTimeService.save(claTime);
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 详情
+ *
+ * @param courseTimeId
+ * @return
+ */
+ public APIResponse detailById(Long courseTimeId) {
+ if (null == courseTimeId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ ScClaTime claTime = claTimeService.getById(courseTimeId);
+ Long claId = claTime.getClaId();
+ if (null != claId) {
+ ScCourseCla courseCla = claService.getById(claId);
+ if (null != courseCla) {
+ claTime.setDeptId(courseCla.getDepartId());
+ }
+ }
+
+ return APIResponse.toAPIResponse(claTime);
+ }
+
+ /**
+ * 更新
+ *
+ * @param claTime
+ * @return
+ */
+ public APIResponse updateClaTime(ScClaTime claTime) {
+ if (null == claTime.getCourseTimeId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
+ }
+ if (!claTime.checkUpdateParam()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
+ }
+
+ ScCourseCla courseCla = claService.getById(claTime.getClaId());
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+
+ UpdateWrapper uw = new UpdateWrapper();
+ uw.eq("course_time_id", claTime.getCourseTimeId());
+ uw.eq("status", ClaTimeStatusEnums.WAIT_CLASS.getStatus());
+ // 教室
+ if (null != claTime.getRoomId()) {
+ ScRoom room = roomService.getById(claTime.getRoomId());
+ uw.set("room_name", room.getRoomName());
+ }
+ uw.set("cla_date", claTime.getClaDate());
+ uw.set("start_time", claTime.getStartTime());
+ uw.set("end_time", claTime.getEndTime());
+ uw.set("teacher_id", claTime.getTeacherId());
+ uw.set("room_id", claTime.getRoomId());
+ uw.set("pay_hour", courseCla.getEveryStuLoseHour());
+ uw.set("class_theme", claTime.getClassTheme());
+ uw.set("last_update_user", loginUser.getUserId());
+ uw.set("last_update_time", new Date());
+
+ boolean update = claTimeService.update(uw);
+ if(!update) {
+ return APIResponse.toExceptionResponse("调课失败,请稍后重试");
+ }
+
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 删除
+ *
+ * @param courseTimeId
+ * @return
+ */
+ public APIResponse deleteById(Long courseTimeId) {
+ if (null == courseTimeId) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ ScClaTime claTime = claTimeService.getById(courseTimeId);
+ String status = claTime.getStatus();
+ if ("2".equals(status)) {
+ return APIResponse.toExceptionResponse("已上课,无法删除");
+ }
+
+ claTimeService.removeById(courseTimeId);
+
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 变更 已记上课 信息
+ * @param reqClaTimeAttend
+ * @return
+ */
+ public APIResponse changeHadClaTimeAttend(ReqClaTimeAttend reqClaTimeAttend) {
+ APIResponse checkParam = reqClaTimeAttend.checkParamForUpdateHadClaTime();
+ if (!checkParam.isSuccess()) {
+ return checkParam;
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+
+ Long courseTimeId = reqClaTimeAttend.getCourseTimeId();
+ ScClaTime claTime = claTimeService.getById(courseTimeId);
+ if (!ClaTimeStatusEnums.HAD_CLASS.getStatus().equals(claTime.getStatus())) {
+ return APIResponse.toExceptionResponse("非已上课排课,无法变更!");
+ }
+
+ // 变更状态为待上课
+ ScClaTime updateClaTime = new ScClaTime();
+ updateClaTime.setCourseTimeId(courseTimeId);
+ updateClaTime.setStatus(ClaTimeStatusEnums.WAIT_CLASS.getStatus());
+ claTimeService.updateById(updateClaTime);
+
+ Long claId = claTime.getClaId();
+ ScCourseCla courseCla = claService.getById(claId);
+ if(null == courseCla) {
+ return APIResponse.toExceptionResponse("无法获取班级,无法删除");
+ }
+ Long courseId = courseCla.getCourseId();
+ ScCourse scCourse = courseService.getById(courseId);
+ if(null == scCourse) {
+ return APIResponse.toExceptionResponse("无法获取课程,无法删除");
+ }
+ SysDept sysDept = deptService.getById(courseCla.getDepartId());
+ if (null == sysDept) {
+ return APIResponse.toExceptionResponse("无法获取校区信息,请稍后重试");
+ }
+
+
+ List dbAttendList = claTimeAttendService.getAttendList(courseTimeId);
+
+ // 删除原上课记录
+ for (ScClaTimeAttend claTimeAttend : dbAttendList) {
+ // 学员日志 使用
+ claTime.setCourseName(scCourse.getCourseName());
+ claTime.setClaName(courseCla.getClaName());
+ claTime.setDeptName(sysDept.getDeptName());
+ // 恢复学员课时
+ studentCourseService.recoverStudentCourseHour(claTimeAttend, claTime, loginUser);
+ }
+
+ // 删除上课记录明细 cla_time_attend
+ UpdateWrapper uw = new UpdateWrapper<>();
+ uw.eq("course_time_id", courseTimeId);
+ claTimeAttendService.remove(uw);
+
+ // 重新记上课
+ return businessScStudentCourseService.claTimeAttend(reqClaTimeAttend);
+ }
+
+ /**
+ * 删除已上课记录
+ *
+ * @param courseTimeId
+ * @return
+ */
+ public APIResponse deleteHadClaTimeAttend(Long courseTimeId) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ ScClaTime claTime = claTimeService.getById(courseTimeId);
+ if (null == claTime) {
+ return APIResponse.toExceptionResponse("无法获取上课信息");
+ }
+ String status = claTime.getStatus();
+ if (!"2".equals(status)) {
+ return APIResponse.toExceptionResponse("暂未上课,无法删除");
+ }
+
+ Long claId = claTime.getClaId();
+ ScCourseCla courseCla = claService.getById(claId);
+ if(null == courseCla) {
+ return APIResponse.toExceptionResponse("无法获取班级,无法删除");
+ }
+ Long courseId = courseCla.getCourseId();
+ ScCourse scCourse = courseService.getById(courseId);
+ if(null == scCourse) {
+ return APIResponse.toExceptionResponse("无法获取课程,无法删除");
+ }
+ SysDept sysDept = deptService.getById(courseCla.getDepartId());
+ if (null == sysDept) {
+ return APIResponse.toExceptionResponse("无法获取校区信息,请稍后重试");
+ }
+
+ // 上课明细
+ List claTimeAttendList = claTimeAttendService.getAttendList(courseTimeId);
+
+ for (ScClaTimeAttend claTimeAttend : claTimeAttendList) {
+ // 学员日志 使用
+ claTime.setCourseName(scCourse.getCourseName());
+ claTime.setClaName(courseCla.getClaName());
+ claTime.setDeptName(sysDept.getDeptName());
+
+ // 恢复学员课时
+ studentCourseService.recoverStudentCourseHour(claTimeAttend, claTime, loginUser);
+ }
+
+ // 删除上课记录明细 cla_time_attend
+ UpdateWrapper uw = new UpdateWrapper<>();
+ uw.eq("course_time_id", courseTimeId);
+ claTimeAttendService.remove(uw);
+
+ // 删除上课记录 cla_time
+ claTimeService.removeById(courseTimeId);
+
+ return APIResponse.toOkResponse();
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScClaTimeAttendService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScClaTimeAttendService.java
new file mode 100644
index 0000000..e26ddae
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScClaTimeAttendService.java
@@ -0,0 +1,129 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeAttend;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeAttend;
+import cn.xluobo.business.sc.course.repo.mapper.ScClaTimeAttendMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:24
+ */
+@Service
+@Transactional
+public class BusinessScClaTimeAttendService {
+
+ @Autowired
+ private IScClaTimeAttendService scClaTimeAttendService;
+
+ @Autowired
+ private ScClaTimeAttendMapper attendMapper;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScClaTimeAttend
+ * @return
+ */
+ public RespPage searchList(ReqSearchScClaTimeAttend reqSearchScClaTimeAttend) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ //reqSearchScClaTimeAttend.setTenantId(loginUser.getNowTenantId());
+ RespPage page = new RespPage(reqSearchScClaTimeAttend.getPageNum(), reqSearchScClaTimeAttend.getPageSize());
+ List attendList = attendMapper.selectTimeAttendList(reqSearchScClaTimeAttend, page);
+ page.setRows(attendList);
+ return page;
+ }
+
+ /**
+ * 已上课 出席详情
+ *
+ * @param courseTimeId
+ * @return
+ */
+ public APIResponse hadClaTimeAttendDetail(Long courseTimeId) {
+ QueryWrapper qwAttend = new QueryWrapper<>();
+ qwAttend.select("student_course_id", "attend_status", "memo", "pay_hour");
+ qwAttend.eq("course_time_id", courseTimeId);
+ List claTimeAttendList = scClaTimeAttendService.list(qwAttend);
+ return APIResponse.toAPIResponse(claTimeAttendList);
+ }
+
+ /**
+ * 详情
+ *
+ * @param attendId
+ * @return
+ */
+ public APIResponse detailById(Long attendId) {
+ if (null == attendId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ ScClaTimeAttend detailInfo = scClaTimeAttendService.getById(attendId);
+ return APIResponse.toAPIResponse(detailInfo);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scClaTimeAttend
+ * @return
+ */
+ public APIResponse addScClaTimeAttend(ScClaTimeAttend scClaTimeAttend) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ scClaTimeAttend.setCreateUser(loginUser.getUserId());
+ boolean addScClaTimeAttend = scClaTimeAttendService.save(scClaTimeAttend);
+ if (addScClaTimeAttend) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 更新
+ *
+ * @param scClaTimeAttend
+ * @return
+ */
+ public APIResponse updateScClaTimeAttend(ScClaTimeAttend scClaTimeAttend) {
+ if (null == scClaTimeAttend.getAttendId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ boolean updateScClaTimeAttend = scClaTimeAttendService.updateById(scClaTimeAttend);
+ if (updateScClaTimeAttend) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 删除
+ *
+ * @param attendIds
+ * @return
+ */
+ public APIResponse deleteById(Long[] attendIds) {
+ if (null == attendIds || attendIds.length == 0) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ boolean deleteScClaTimeAttend = scClaTimeAttendService.removeByIds(Arrays.asList(attendIds));
+ if (deleteScClaTimeAttend) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseClaService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseClaService.java
new file mode 100644
index 0000000..8ec3029
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseClaService.java
@@ -0,0 +1,275 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.req.ReqAddScCourseCla;
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseCla;
+import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseCharge;
+import cn.xluobo.business.sc.course.domain.resp.RespCourseClaInfo;
+import cn.xluobo.business.sc.course.domain.resp.cla.RespClaAllDetailInfo;
+import cn.xluobo.business.sc.course.repo.mapper.ScCourseClaMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.business.sc.student.repo.mapper.ScStudentMapper;
+import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
+import cn.xluobo.business.sc.student.service.IScStudentCourseService;
+import cn.xluobo.business.sc.student.service.IScStudentService;
+import cn.xluobo.business.sys.admin.service.ISysDeptService;
+import cn.xluobo.business.sys.staff.repo.model.SysStaff;
+import cn.xluobo.business.sys.staff.service.ISysStaffService;
+import cn.xluobo.core.api.APIBaseResponse;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.common.collect.Maps;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:24
+ */
+@Service
+@Transactional
+public class BusinessScCourseClaService {
+
+ @Autowired
+ private IScCourseClaService scCourseClaService;
+ @Autowired
+ private IScCourseService courseService;
+ @Autowired
+ private IScCourseChargeService courseChargeService;
+ @Autowired
+ private ISysStaffService teacherService;
+ @Autowired
+ private ScCourseClaMapper scCourseClaMapper;
+ @Autowired
+ private ScStudentMapper studentMapper;
+ @Autowired
+ private IScStudentService studentService;
+ @Autowired
+ private IScStudentCourseService studentCourseService;
+ @Autowired
+ private ISysDeptService deptService;
+ @Autowired
+ private IScClaTimeRuleService claTimeRuleService;
+ @Autowired
+ private IScClaTimeService claTimeService;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScCourseCla
+ * @return
+ */
+ public APIResponse searchList(ReqSearchScCourseCla reqSearchScCourseCla) {
+ RespPage page = new RespPage(reqSearchScCourseCla.getPageNum(), reqSearchScCourseCla.getPageSize());
+ List claList = scCourseClaMapper.selectClaList(reqSearchScCourseCla, page);
+ page.setRows(claList);
+ return APIResponse.toAPIResponse(page);
+ }
+
+ /**
+ * 详情
+ *
+ * @param claId
+ * @return
+ */
+ public APIResponse detailById(Long claId) {
+ if (null == claId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ Map resultMap = Maps.newHashMap();
+ // 班级信息
+ ScCourseCla detailInfo = scCourseClaService.getById(claId);
+ if (null == detailInfo) {
+ return APIResponse.toAPIResponse(null);
+ }
+ // 课程信息
+ ScCourse scCourse = courseService.getById(detailInfo.getCourseId());
+ // 是否允许变更课程,有报名不允许变更课程
+ APIBaseResponse canChangeCourse = scCourseClaService.canChangeCourse(claId);
+ resultMap.put("canChangeCourse", canChangeCourse.isSuccess());
+
+ resultMap.put("claInfo", detailInfo);
+ resultMap.put("claCourseInfo", scCourse);
+
+ return APIResponse.toAPIResponse(resultMap);
+ }
+
+ /**
+ * 班级详情
+ *
+ * @param claId
+ * @return
+ */
+ public RespClaAllDetailInfo allDetailInfoById(Long claId) {
+ if (null == claId) {
+ return null;
+ }
+ // 班级信息
+ ScCourseCla courseCla = scCourseClaService.getById(claId);
+ if (null == courseCla) {
+ return null;
+ }
+
+ // 班级当前学员数量
+ Integer studentCnt = scCourseClaService.selectStudentCnt(claId);
+ courseCla.setStudentCnt(studentCnt);
+
+ // 课程信息
+ ScCourse scCourse = courseService.getById(courseCla.getCourseId());
+
+
+ // 课程收费信息
+ List courseChargeList = courseChargeService.courseChargeList(scCourse.getCourseId(), null);
+
+ // 校区
+ if (null != courseCla.getDepartId()) {
+ SysDept sysDept = deptService.getById(courseCla.getDepartId());
+ courseCla.setDeptName(sysDept.getDeptName());
+ }
+
+ // 教师
+ if (null != courseCla.getStaffId()) {
+ SysStaff staff = teacherService.getById(courseCla.getStaffId());
+ courseCla.setTeacherName(staff.getStaffName());
+ }
+
+ // 上课时间
+ List claTimeInfo = claTimeRuleService.selectClaTimeInfo(claId);
+
+ return RespClaAllDetailInfo.builder()
+ .courseCla(courseCla)
+ .course(scCourse)
+ .courseChargeList(courseChargeList)
+ .claTimeList(claTimeInfo)
+ .build();
+ }
+
+ /**
+ * 添加
+ *
+ * @param scCourseCla
+ * @return
+ */
+ public APIResponse addScCourseCla(ReqAddScCourseCla scCourseCla) {
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+
+ // 课程编号是否存在
+ ScCourse course = courseService.getById(scCourseCla.getCourseId());
+ if (null == course) {
+ return APIResponse.toExceptionResponse("课程不存在,请重新选择后提交。");
+ }
+
+ // 教师是否存在
+ SysStaff teacher = teacherService.getById(scCourseCla.getStaffId());
+ if (null == teacher) {
+ return APIResponse.toExceptionResponse("教师不存在,请重新选择后提交。");
+ }
+
+ // 新建班级
+ ScCourseCla cla = scCourseCla.getScCourseCla(loginUser);
+ APIBaseResponse checkParam = cla.checkParam();
+ if (!checkParam.isSuccess()) {
+ return APIResponse.toExceptionResponse(checkParam.getRespMsg());
+ }
+ boolean addScCourseCla = scCourseClaService.save(cla);
+ if (addScCourseCla) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 更新
+ *
+ * @param scCourseCla
+ * @return
+ */
+ public APIResponse updateScCourseCla(ScCourseCla scCourseCla) {
+ if (null == scCourseCla.getClaId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+
+ ScCourseCla dbClaInfo = scCourseClaService.getById(scCourseCla.getClaId());
+ Long dbCourseId = dbClaInfo.getCourseId();
+
+ // 课程编号是否存在
+ ScCourse course = courseService.getById(scCourseCla.getCourseId());
+ if (null == course) {
+ return APIResponse.toExceptionResponse("课程不存在,请重新选择后提交。");
+ }
+
+ // 教师是否存在
+ SysStaff teacher = teacherService.getById(scCourseCla.getStaffId());
+ if (null == teacher) {
+ return APIResponse.toExceptionResponse("教师不存在,请重新选择后提交。");
+ }
+
+ // 修改课程,校验是否允许修改所属课程
+ if (!dbCourseId.equals(scCourseCla.getCourseId())) {
+ APIBaseResponse canChangeCourse = scCourseClaService.canChangeCourse(scCourseCla.getClaId());
+ if (!canChangeCourse.isSuccess()) {
+ return APIResponse.toExceptionResponse(canChangeCourse.getRespMsg());
+ }
+ }
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ scCourseCla.setLastUpdateUser(loginUser.getUserId());
+ scCourseCla.setLastUpdateTime(new Date());
+ boolean updateScCourseCla = scCourseClaService.updateById(scCourseCla);
+ if (updateScCourseCla) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 删除
+ *
+ * @param claIds
+ * @return
+ */
+ public APIResponse deleteById(Long[] claIds) {
+ if (null == claIds || claIds.length == 0) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+
+ // 有学员无法 删除
+ QueryWrapper qwSc = new QueryWrapper<>();
+ qwSc.in("cla_id", claIds);
+ int studentCourseCount = studentCourseService.count(qwSc);
+ if (studentCourseCount != 0) {
+ return APIResponse.toExceptionResponse("该班级内有学员,无法删除班级");
+ }
+
+ // 已排课不允许删除
+ QueryWrapper qwSct = new QueryWrapper<>();
+ qwSct.in("cla_id", claIds);
+ int claTimeCount = claTimeService.count(qwSct);
+ if (claTimeCount != 0) {
+ return APIResponse.toExceptionResponse("该班级已排课,无法删除班级");
+ }
+
+ boolean deleteScCourseCla = scCourseClaService.removeByIds(Arrays.asList(claIds));
+
+ if (deleteScCourseCla) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseService.java
new file mode 100644
index 0000000..5deb5e0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseService.java
@@ -0,0 +1,537 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.export.ExpCourse;
+import cn.xluobo.business.sc.course.domain.req.ReqBusinessOrderCourseDetail;
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
+import cn.xluobo.business.sc.course.domain.req.ReqSelect;
+import cn.xluobo.business.sc.course.domain.req.course.ReqAddScCourse;
+import cn.xluobo.business.sc.course.domain.req.course.ReqAddScCourseChargeItem;
+import cn.xluobo.business.sc.course.domain.req.course.ReqChangeScCourse;
+import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseCharge;
+import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseInfo;
+import cn.xluobo.business.sc.course.domain.resp.course.RespScCourseDetail;
+import cn.xluobo.business.sc.course.domain.resp.course.RespSearchCourse;
+import cn.xluobo.business.sc.course.repo.mapper.ScCourseMapper;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCharge;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.business.sc.course.repo.model.ScCourseType;
+import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
+import cn.xluobo.business.sc.student.service.IScStudentCourseService;
+import cn.xluobo.business.sys.admin.domain.resp.RespTreeSelect;
+import cn.xluobo.business.sys.admin.service.BusinessSysDeptService;
+import cn.xluobo.business.sys.admin.service.BusinessSysDictDataService;
+import cn.xluobo.business.sys.admin.service.ISysDeptService;
+import cn.xluobo.business.tool.export.strategy.CourseExportMergeStrategy;
+import cn.xluobo.config.properties.UploadConfigProperties;
+import cn.xluobo.core.api.APIBaseResponse;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:24
+ */
+@Service
+@Transactional
+public class BusinessScCourseService {
+
+ @Autowired
+ private IScCourseService scCourseService;
+ @Autowired
+ private IScCourseClaService courseClaService;
+ @Autowired
+ private ScCourseMapper courseMapper;
+ @Autowired
+ private IScCourseChargeService courseChargeService;
+ @Autowired
+ private BusinessSysDeptService deptService;
+ @Autowired
+ private ISysDeptService sysDeptService;
+ @Autowired
+ private UploadConfigProperties uploadConfigProperties;
+ @Autowired
+ private BusinessSysDictDataService dictDataService;
+ @Autowired
+ private IScStudentCourseService studentCourseService;
+ @Autowired
+ private IScCourseTypeService courseTypeService;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScCourse
+ * @return
+ */
+ public APIResponse searchList(ReqSearchScCourse reqSearchScCourse) {
+ RespPage searchCourseRespPage = scCourseService.searchCourse(reqSearchScCourse);
+ return APIResponse.toAPIResponse(searchCourseRespPage);
+ }
+
+ /**
+ * 查询课程列表
+ * 含有学生报读状态
+ *
+ * @param reqSearchScCourse
+ * @return
+ */
+ public APIResponse selectCourseListWithStudentCourse(ReqSearchScCourse reqSearchScCourse) {
+ RespPage respPage = new RespPage(reqSearchScCourse.getPageNum(), reqSearchScCourse.getPageSize());
+ List courseList = courseMapper.selectCourseListWithStudentCourse(reqSearchScCourse, respPage);
+ respPage.setRows(courseList);
+ return APIResponse.toAPIResponse(respPage);
+ }
+
+ /**
+ * 前端select
+ *
+ * @return
+ */
+ public APIResponse select(ReqSelect reqSelect) {
+ QueryWrapper qw = new QueryWrapper();
+ qw.select("course_name", "course_id");
+
+ if (StringUtils.isNotEmpty(reqSelect.getSearch())) {
+ qw.like("course_name", reqSelect.getSearch());
+ }
+
+ qw.orderByDesc("create_time");
+ List list = scCourseService.list(qw);
+ return APIResponse.toAPIResponse(list);
+ }
+
+ /**
+ * 详情
+ *
+ * @param courseId
+ * @return
+ */
+ public APIResponse detailById(Long courseId) {
+ if (null == courseId) {
+ return APIResponse.toAPIResponse(ApiResEnums.PARAM_FAIL);
+ }
+
+ // 课程详情
+ ScCourse detailInfo = scCourseService.getById(courseId);
+
+
+ RespScCourseDetail respScCourseDetail = new RespScCourseDetail();
+ respScCourseDetail.setCourseId(detailInfo.getCourseId());
+ respScCourseDetail.setCourseName(detailInfo.getCourseName());
+ respScCourseDetail.setCourseTypeId(detailInfo.getCourseTypeId());
+ respScCourseDetail.setTeachingMode(detailInfo.getTeachingMode());
+ respScCourseDetail.setCourseIntro(detailInfo.getCourseIntro());
+ respScCourseDetail.setCourseCampus("part");
+ respScCourseDetail.setPartCampus(new String[]{});
+
+ if(null != detailInfo.getCourseTypeId()) {
+ ScCourseType courseType = courseTypeService.getById(detailInfo.getCourseTypeId());
+ respScCourseDetail.setCourseTypeName(courseType.getCourseType());
+ }
+
+
+
+ List feeModeHourList = Lists.newArrayList();
+ List feeModeDateList = Lists.newArrayList();
+ List feeModeCycleList = Lists.newArrayList();
+
+ // 上课校区
+ List partCampusList = Lists.newArrayList();
+
+ // 所有校区id 对应名称 map
+ Map campusMap = Maps.newHashMap();
+ List campusList = deptService.campusList();
+ for (RespTreeSelect respTreeSelect : campusList) {
+ campusMap.put(respTreeSelect.getId(), respTreeSelect.getLabel());
+ }
+ campusMap.put(-1L, "全部校区");
+
+ // 课程收费配置信息
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.eq("course_id", detailInfo.getCourseId());
+ List courseChargeList = courseChargeService.list(qw);
+ for (ScCourseCharge courseCharge : courseChargeList) {
+ ReqAddScCourseChargeItem chargeItem = new ReqAddScCourseChargeItem();
+ Long departId = courseCharge.getDepartId();
+ if (!partCampusList.contains(departId.toString()) && departId.compareTo(-1L) != 0) {
+ partCampusList.add(departId.toString());
+ }
+ String chargeType = courseCharge.getChargeType();
+ chargeItem.setChargeId(courseCharge.getChargeId());
+ chargeItem.setCampusId(courseCharge.getDepartId());
+ chargeItem.setCampusName(campusMap.get(courseCharge.getDepartId().toString()));
+ if ("hour".equals(chargeType)) {
+ chargeItem.setCnt(courseCharge.getCount());
+ chargeItem.setTotalFee(courseCharge.getTotalFee());
+ feeModeHourList.add(chargeItem);
+ } else if ("date".equals(chargeType)) {
+ chargeItem.setCnt(courseCharge.getCount());
+ chargeItem.setTotalFee(courseCharge.getTotalFee());
+ chargeItem.setDateType(courseCharge.getDateUnit());
+ feeModeDateList.add(chargeItem);
+ } else if ("cycle".equals(chargeType)) {
+ chargeItem.setCnt(courseCharge.getCount());
+ chargeItem.setTotalFee(courseCharge.getTotalFee());
+ feeModeCycleList.add(chargeItem);
+ }
+ }
+
+ // 上课校区 所有或部分校区
+ if (partCampusList.size() == 0) {
+ respScCourseDetail.setCourseCampus("all");
+ } else {
+ respScCourseDetail.setCourseCampus("part");
+ respScCourseDetail.setPartCampus(partCampusList.toArray(new String[partCampusList.size()]));
+ }
+
+ respScCourseDetail.setFeeModeHourList(feeModeHourList);
+ respScCourseDetail.setFeeModeDateList(feeModeDateList);
+ respScCourseDetail.setFeeModeCycleList(feeModeCycleList);
+ if (!feeModeHourList.isEmpty()) {
+ respScCourseDetail.setFeeModeHour(true);
+ }
+ if (!feeModeDateList.isEmpty()) {
+ respScCourseDetail.setFeeModeDate(true);
+ }
+ if (!feeModeCycleList.isEmpty()) {
+ respScCourseDetail.setFeeModeCycle(true);
+ }
+
+ return APIResponse.toAPIResponse(respScCourseDetail);
+ }
+
+ /**
+ * 添加课程
+ *
+ * @param reqAddScCourse
+ * @return
+ */
+ public APIResponse addScCourse(ReqAddScCourse reqAddScCourse) {
+ APIBaseResponse checkParam = reqAddScCourse.checkParam();
+ if (!checkParam.isSuccess()) {
+ return APIResponse.toExceptionResponse(checkParam.getRespMsg());
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+
+ // course 表保存
+ ScCourse scCourse = new ScCourse();
+ scCourse.setCourseName(reqAddScCourse.getCourseName());
+ scCourse.setCourseTypeId(reqAddScCourse.getCourseTypeId());
+ scCourse.setTeachingMode(reqAddScCourse.getTeachingMode());
+ scCourse.setCourseIntro(reqAddScCourse.getCourseIntro());
+ scCourse.setCreateUser(loginUser.getUserId());
+ scCourse.setLastUpdateUser(loginUser.getUserId());
+ boolean addScCourse = scCourseService.save(scCourse);
+
+ // course_charge保存
+
+ // 按课时收费
+ if (reqAddScCourse.isFeeModeHour()) {
+ List feeModeHourList = reqAddScCourse.getFeeModeHourList();
+ feeModeHourList.forEach(item -> {
+ ScCourseCharge courseCharge = new ScCourseCharge();
+ courseCharge.setCourseId(scCourse.getCourseId());
+ courseCharge.setDepartId(item.getCampusId());
+ courseCharge.setChargeType("hour");
+ courseCharge.setCount(item.getCnt());
+ courseCharge.setTotalFee(item.getTotalFee());
+ courseChargeService.save(courseCharge);
+ });
+ }
+
+ // 按时间收费
+ if (reqAddScCourse.isFeeModeDate()) {
+ List feeModeDateList = reqAddScCourse.getFeeModeDateList();
+ feeModeDateList.forEach(item -> {
+ ScCourseCharge courseCharge = new ScCourseCharge();
+ courseCharge.setCourseId(scCourse.getCourseId());
+ courseCharge.setDepartId(item.getCampusId());
+ courseCharge.setChargeType("date");
+ courseCharge.setCount(item.getCnt());
+ courseCharge.setTotalFee(item.getTotalFee());
+ courseCharge.setDateUnit(item.getDateType());
+ courseChargeService.save(courseCharge);
+ });
+ }
+
+ // 按期收费
+ if (reqAddScCourse.isFeeModeCycle()) {
+ List feeModeCycleList = reqAddScCourse.getFeeModeCycleList();
+ feeModeCycleList.forEach(item -> {
+ ScCourseCharge courseCharge = new ScCourseCharge();
+ courseCharge.setCourseId(scCourse.getCourseId());
+ courseCharge.setDepartId(item.getCampusId());
+ courseCharge.setChargeType("cycle");
+ courseCharge.setCount(item.getCnt());
+ courseCharge.setTotalFee(item.getTotalFee());
+ courseChargeService.save(courseCharge);
+ });
+ }
+
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 更新
+ *
+ * @param reqChangeScCourse
+ * @return
+ */
+ public APIResponse updateScCourse(ReqChangeScCourse reqChangeScCourse) {
+ APIBaseResponse checkParam = reqChangeScCourse.checkParam();
+ if (!checkParam.isSuccess()) {
+ return APIResponse.toExceptionResponse(checkParam.getRespMsg());
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+
+ // 更新课程信息
+ ScCourse updateCourse = new ScCourse();
+ updateCourse.setCourseId(reqChangeScCourse.getCourseId());
+ updateCourse.setCourseName(reqChangeScCourse.getCourseName());
+ updateCourse.setCourseTypeId(reqChangeScCourse.getCourseTypeId());
+ updateCourse.setTeachingMode(reqChangeScCourse.getTeachingMode());
+ updateCourse.setCourseIntro(reqChangeScCourse.getCourseIntro());
+ updateCourse.setLastUpdateUser(loginUser.getUserId());
+ updateCourse.setLastUpdateTime(new Date());
+ boolean updateScCourse = scCourseService.updateById(updateCourse);
+
+ // course_charge 删除
+ UpdateWrapper uw = new UpdateWrapper();
+ uw.eq("course_id", updateCourse.getCourseId());
+ courseChargeService.remove(uw);
+
+ // course_charge 新增
+
+ // 按课时收费
+ if (reqChangeScCourse.isFeeModeHour()) {
+ List feeModeHourList = reqChangeScCourse.getFeeModeHourList();
+ feeModeHourList.forEach(item -> {
+ ScCourseCharge courseCharge = new ScCourseCharge();
+ courseCharge.setCourseId(updateCourse.getCourseId());
+ courseCharge.setDepartId(item.getCampusId());
+ courseCharge.setChargeType("hour");
+ courseCharge.setCount(item.getCnt());
+ courseCharge.setTotalFee(item.getTotalFee());
+ courseChargeService.save(courseCharge);
+ });
+ }
+
+ // 按时间收费
+ if (reqChangeScCourse.isFeeModeDate()) {
+ List feeModeDateList = reqChangeScCourse.getFeeModeDateList();
+ feeModeDateList.forEach(item -> {
+ ScCourseCharge courseCharge = new ScCourseCharge();
+ courseCharge.setCourseId(updateCourse.getCourseId());
+ courseCharge.setDepartId(item.getCampusId());
+ courseCharge.setChargeType("date");
+ courseCharge.setCount(item.getCnt());
+ courseCharge.setTotalFee(item.getTotalFee());
+ courseCharge.setDateUnit(item.getDateType());
+ courseChargeService.save(courseCharge);
+ });
+ }
+
+ // 按期收费
+ if (reqChangeScCourse.isFeeModeCycle()) {
+ List feeModeCycleList = reqChangeScCourse.getFeeModeCycleList();
+ feeModeCycleList.forEach(item -> {
+ ScCourseCharge courseCharge = new ScCourseCharge();
+ courseCharge.setCourseId(updateCourse.getCourseId());
+ courseCharge.setDepartId(item.getCampusId());
+ courseCharge.setChargeType("cycle");
+ courseCharge.setCount(item.getCnt());
+ courseCharge.setTotalFee(item.getTotalFee());
+ courseChargeService.save(courseCharge);
+ });
+ }
+
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 删除
+ *
+ * @param courseIds
+ * @return
+ */
+ public APIResponse deleteById(List courseIds) {
+ if (null == courseIds || courseIds.isEmpty()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+
+ // 如课程对应在用班级,不允许删除
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.in("course_id", courseIds);
+ int courseClaCount = courseClaService.count(qw);
+ if (courseClaCount != 0) {
+ return APIResponse.toExceptionResponse("该课程下存在在用班级,无法删除课程");
+ }
+
+ // 有报读记录 不允许删除
+ QueryWrapper qwSc = new QueryWrapper<>();
+ qwSc.in("course_id", courseIds);
+ int studentCourseCount = studentCourseService.count(qwSc);
+ if (studentCourseCount != 0) {
+ return APIResponse.toExceptionResponse("该课程已报读,无法删除课程");
+ }
+
+ boolean deleteScCourse = scCourseService.removeByIds(courseIds);
+ if (deleteScCourse) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 变更是否开售
+ *
+ * @param scCourse
+ * @return
+ */
+ public APIResponse changeCourseSale(ScCourse scCourse) {
+ if (null == scCourse.getCourseId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ if (StringUtils.isEmpty(scCourse.getSale())) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ UpdateWrapper uw = new UpdateWrapper();
+ uw.set("sale", scCourse.getSale());
+ uw.eq("course_id", scCourse.getCourseId());
+ boolean updateScCourse = scCourseService.update(uw);
+ if (updateScCourse) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 导出课程
+ *
+ * @param reqSearchScCourse
+ * @return
+ */
+ public APIResponse exportCourse(ReqSearchScCourse reqSearchScCourse) {
+ try {
+ List courseList = courseMapper.selectCourseForExport(reqSearchScCourse);
+ String fileName = "exportCourse_" + System.currentTimeMillis() + UUID.randomUUID().toString();
+ String fullPath = uploadConfigProperties.getTempSaveExportPath() + "/" + fileName + ".xlsx";
+ CourseExportMergeStrategy mergeStrategy = new CourseExportMergeStrategy<>(courseList, 0, 6);
+ EasyExcel.write(fullPath, ExpCourse.class)
+ .registerWriteHandler(mergeStrategy)
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+ .sheet("课程列表").doWrite(courseList);
+ return APIResponse.toAPIResponse(fileName);
+ } catch (Exception e) {
+ return APIResponse.toExceptionResponse("下载文件失败" + e.getMessage());
+ }
+ }
+
+ /**
+ * 报名-课程详情
+ *
+ * @param orderCourseDetail
+ * @return
+ */
+ public APIResponse orderCourseDetail(ReqBusinessOrderCourseDetail orderCourseDetail) {
+ Long[] courseIds = orderCourseDetail.getCourseIds();
+ Long deptId = orderCourseDetail.getDeptId();
+ Long studentId = orderCourseDetail.getStudentId();
+
+ if (null == courseIds || courseIds.length == 0) {
+ return APIResponse.toExceptionResponse("请选择课程");
+ }
+
+ if (null == deptId) {
+ return APIResponse.toExceptionResponse("请选择校区");
+ }
+
+ // 校验学生是否可报读 课程
+ APIBaseResponse studentCanSignUpCourse = studentCourseService.checkStudentCanSignUpCourse(studentId, courseIds, deptId);
+ if (!studentCanSignUpCourse.isSuccess()) {
+ return APIResponse.toExceptionResponse(studentCanSignUpCourse.getRespMsg());
+ }
+
+ // 学生已报名课程收费模式
+ Map studentCourseChargeTypeMap = Maps.newHashMap();
+ if (null != studentId) {
+ QueryWrapper qw = new QueryWrapper();
+ qw.select("course_id", "charge_type");
+ qw.eq("student_id", studentId);
+ List studentCourseList = studentCourseService.list(qw);
+ studentCourseChargeTypeMap = studentCourseList.stream().collect(Collectors.toMap(ScStudentCourse::getCourseId, ScStudentCourse::getChargeType));
+ }
+
+ // 部门信息
+ SysDept sysDept = sysDeptService.getById(deptId);
+
+ List courseInfoList = Lists.newArrayList();
+ for (Long courseId : courseIds) {
+ ScCourse scCourse = scCourseService.getById(courseId);
+ if (null == scCourse) {
+ continue;
+ }
+ RespBusinessChooseCourseInfo chooseCourseInfo = RespBusinessChooseCourseInfo.builder()
+ .courseId(scCourse.getCourseId())
+ .courseName(scCourse.getCourseName())
+ .deptId(sysDept.getDeptId())
+ .deptName(sysDept.getDeptName())
+ .teachingMode(scCourse.getTeachingMode())
+ .build();
+
+ // 已报读的 收费方式
+ String studentCourseChargeType = studentCourseChargeTypeMap.get(courseId);
+
+ // 转换对象
+ List chooseCourseChargeList = courseChargeService.courseChargeList(courseId, studentCourseChargeType);
+
+ chooseCourseInfo.setCourseChargeList(chooseCourseChargeList);
+ // 是否为续报
+ chooseCourseInfo.setContinueCourse(StringUtils.isNotEmpty(studentCourseChargeType));
+ courseInfoList.add(chooseCourseInfo);
+ }
+ return APIResponse.toAPIResponse(courseInfoList);
+ }
+
+ /**
+ * 学生是否可报名 课程
+ *
+ * @param orderCourseDetail
+ * @return
+ */
+ public APIResponse studentCanSignUpCourse(ReqBusinessOrderCourseDetail orderCourseDetail) {
+ Long[] courseIds = orderCourseDetail.getCourseIds();
+ Long studentId = orderCourseDetail.getStudentId();
+ if (null == studentId) {
+ return APIResponse.toExceptionResponse("studentId 不能为空");
+ }
+ if (null == courseIds || courseIds.length == 0) {
+ return APIResponse.toOkResponse();
+ }
+ APIBaseResponse studentCanSignUpCourse = studentCourseService.checkStudentCanSignUpCourse(studentId, courseIds, null);
+ if (!studentCanSignUpCourse.isSuccess()) {
+ return APIResponse.toExceptionResponse(studentCanSignUpCourse.getRespMsg());
+ }
+
+ return APIResponse.toOkResponse();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseTypeService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseTypeService.java
new file mode 100644
index 0000000..4c27a46
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/BusinessScCourseTypeService.java
@@ -0,0 +1,140 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseType;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourseType;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:24
+ */
+@Service
+@Transactional
+public class BusinessScCourseTypeService {
+
+ @Autowired
+ private IScCourseTypeService scCourseTypeService;
+ @Autowired
+ private IScCourseService courseService;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScCourseType
+ * @return
+ */
+ public APIResponse searchList(ReqSearchScCourseType reqSearchScCourseType) {
+ QueryWrapper qw = new QueryWrapper();
+ if (StringUtils.isNotEmpty(reqSearchScCourseType.getCourseType())) {
+ qw.eq("course_type", reqSearchScCourseType.getCourseType());
+ }
+ RespPage page = new RespPage(reqSearchScCourseType.getPageNum(), reqSearchScCourseType.getPageSize());
+ RespPage listPage = scCourseTypeService.page(page, qw);
+ return APIResponse.toAPIResponse(listPage);
+ }
+
+ /**
+ * select
+ * @param reqSearchScCourseType
+ * @return
+ */
+ public APIResponse select(ReqSearchScCourseType reqSearchScCourseType) {
+ QueryWrapper qw = new QueryWrapper();
+ qw.select("course_type", "course_type_id");
+ if (StringUtils.isNotEmpty(reqSearchScCourseType.getCourseType())) {
+ qw.like("course_type", reqSearchScCourseType.getCourseType());
+ }
+ qw.eq("in_use", "1");
+ qw.orderByDesc("create_time");
+ List list = scCourseTypeService.list(qw);
+ return APIResponse.toAPIResponse(list);
+ }
+
+ /**
+ * 详情
+ *
+ * @param courseTypeId
+ * @return
+ */
+ public APIResponse detailById(Long courseTypeId) {
+ if (null == courseTypeId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ ScCourseType detailInfo = scCourseTypeService.getById(courseTypeId);
+ return APIResponse.toAPIResponse(detailInfo);
+ }
+
+ /**
+ * 添加
+ *
+ * @param scCourseType
+ * @return
+ */
+ public APIResponse addScCourseType(ScCourseType scCourseType) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ scCourseType.setCreateUser(loginUser.getUserId());
+ boolean addScCourseType = scCourseTypeService.save(scCourseType);
+ if (addScCourseType) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 更新
+ *
+ * @param scCourseType
+ * @return
+ */
+ public APIResponse updateScCourseType(ScCourseType scCourseType) {
+ if (null == scCourseType.getCourseTypeId()) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ boolean updateScCourseType = scCourseTypeService.updateById(scCourseType);
+ if (updateScCourseType) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+
+ /**
+ * 删除
+ *
+ * @param courseTypeIds
+ * @return
+ */
+ public APIResponse deleteById(Long[] courseTypeIds) {
+ if (null == courseTypeIds || courseTypeIds.length == 0) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.eq("course_type_id", courseTypeIds);
+ int courseCount = courseService.count(qw);
+ if (courseCount != 0) {
+ return APIResponse.toExceptionResponse("已有课程使用,无法删除");
+ }
+
+ boolean deleteScCourseType = scCourseTypeService.removeByIds(Arrays.asList(courseTypeIds));
+ if (deleteScCourseType) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeAttendService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeAttendService.java
new file mode 100644
index 0000000..0f7e702
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeAttendService.java
@@ -0,0 +1,69 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ *
+ * 上课出勤表 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-30 02:33:26
+ */
+public interface IScClaTimeAttendService extends com.baomidou.mybatisplus.extension.service.IService {
+
+ /**
+ * 学生报的的课程,指定日期 上课记录 数量
+ * @param studentCourseId
+ * @param beginDate
+ * @param endDate
+ * @return
+ */
+ int studentCourseAttendCount(Long studentCourseId, String beginDate, String endDate);
+
+ /**
+ * 指定时间段内应出席人次
+ * @param beginDate
+ * @param endDate
+ * @return
+ */
+ Integer getNeedAttendCount(String beginDate, String endDate);
+
+ /**
+ * 指定时间段内上课人次
+ * @param beginDate
+ * @param endDate
+ * @param attendStatus 到课状态
+ * @return
+ */
+ Integer getAttendCount(String beginDate, String endDate, String[] attendStatus);
+
+ /**
+ * 消耗课时
+ * @param beginDate
+ * @param endDate
+ * @param needAttend 是否应消
+ * @return
+ */
+ BigDecimal getAttendCostHour(String beginDate, String endDate, boolean needAttend);
+
+ /**
+ * 教师获得课时数量
+ * 只统计按课时收费
+ *
+ * @param reqClaTimeCount
+ * @return
+ */
+ BigDecimal getTeacherGetHour(ReqClaTimeCount reqClaTimeCount);
+
+ /**
+ * 上课记录
+ * @param courseTimeId
+ * @return
+ */
+ List getAttendList(Long courseTimeId);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeRuleService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeRuleService.java
new file mode 100644
index 0000000..ef6afc0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeRuleService.java
@@ -0,0 +1,80 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeRule;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeRule;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * 上课时间配置规则 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-14
+ */
+public interface IScClaTimeRuleService extends IService {
+
+ /**
+ * 获取具体上课时间
+ * 已排序
+ * @param reqSearchScClaTimeRule
+ * @return 排序后的上课日期 列表
+ */
+ List getClaTimeList(ReqSearchScClaTimeRule reqSearchScClaTimeRule);
+
+ /**
+ * 根据 规则获取上课时间
+ * 未排序
+ * @param ruleId
+ * @return
+ */
+ List getClaTimeListByRuleId(Long ruleId);
+
+ /**
+ * 根据 规则获取上课时间
+ * 未排序
+ * @param itemTime
+ * @param holidayMap 节假日信息
+ * @return
+ */
+ List getClaTimeListByRule(RespClaTimeRule itemTime, Map holidayMap);
+
+ /**
+ * 根据 规则获取上课时间
+ * 未排序
+ * @param claTimeRule
+ * @param holidayMap 节假日信息
+ * @return
+ */
+ List getClaTimeListByRule(ScClaTimeRule claTimeRule, Map holidayMap);
+
+ /**
+ * 校验是否排课
+ * 与 sc_cla_time 待上课进行对比
+ * @param claId
+ * @param day 日期 yyyy-MM-dd
+ * @param notEqRuleId
+ * @return 重复日期
+ */
+ List checkDayRepeat(Long claId, String[] day, Long notEqRuleId);
+
+ /**
+ * 校验排课是否重复
+ * 与 sc_cla_time 待上课进行对比
+ * @param claTimeRule
+ * @return 重复日期
+ */
+ List checkDayRepeat(ScClaTimeRule claTimeRule);
+
+ /**
+ * 获取上课时间
+ * @param claId
+ * @return
+ */
+ List selectClaTimeInfo(Long claId);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeService.java
new file mode 100644
index 0000000..fb717f9
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScClaTimeService.java
@@ -0,0 +1,32 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 排课信息 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-16
+ */
+public interface IScClaTimeService extends IService {
+
+ /**
+ * 删除 状态为 待上课 的排课信息
+ * @param ruleId
+ * @param claId
+ * @param tenantId
+ * @return
+ */
+ boolean deleteUnBeginTime(Long ruleId, Long claId, String tenantId);
+
+ /**
+ * 排课总数量
+ * @param reqClaTimeCount
+ * @return
+ */
+ Integer claTimeCount(ReqClaTimeCount reqClaTimeCount);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseChargeService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseChargeService.java
new file mode 100644
index 0000000..abfd781
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseChargeService.java
@@ -0,0 +1,33 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseCharge;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCharge;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ *
+ * 课程收费模式 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-08
+ */
+public interface IScCourseChargeService extends IService {
+
+ /**
+ * 收费模式转换
+ * @param courseChargeList
+ * @return
+ */
+ List transferCourseChargeList(List courseChargeList);
+
+ /**
+ * 课程收费模式
+ * @param courseId
+ * @param chargeType
+ * @return
+ */
+ List courseChargeList(Long courseId, String chargeType);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseClaService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseClaService.java
new file mode 100644
index 0000000..a5f543b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseClaService.java
@@ -0,0 +1,31 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.core.api.APIBaseResponse;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 课程班级信息 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 01:11:06
+ */
+public interface IScCourseClaService extends IService {
+
+ /**
+ * 班级在读学员数量
+ * @param claId
+ * @return
+ */
+ Integer selectStudentCnt(Long claId);
+
+ /**
+ * 是否允许变更 班级所属课程
+ * @param claId
+ * @return
+ */
+ APIBaseResponse canChangeCourse(Long claId);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseService.java
new file mode 100644
index 0000000..da2c799
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseService.java
@@ -0,0 +1,25 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
+import cn.xluobo.business.sc.course.domain.resp.course.RespSearchCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 课程信息 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 11:25:55
+ */
+public interface IScCourseService extends IService {
+
+ /**
+ * 查询课程列表
+ * @param reqSearchScCourse
+ * @return
+ */
+ RespPage searchCourse(ReqSearchScCourse reqSearchScCourse);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseTypeService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseTypeService.java
new file mode 100644
index 0000000..2b5c92c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/IScCourseTypeService.java
@@ -0,0 +1,15 @@
+package cn.xluobo.business.sc.course.service;
+
+import cn.xluobo.business.sc.course.repo.model.ScCourseType;
+
+/**
+ *
+ * 课程类型 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-09 08:10:25
+ */
+public interface IScCourseTypeService extends com.baomidou.mybatisplus.extension.service.IService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeAttendServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeAttendServiceImpl.java
new file mode 100644
index 0000000..c7ae33f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeAttendServiceImpl.java
@@ -0,0 +1,60 @@
+package cn.xluobo.business.sc.course.service.impl;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
+import cn.xluobo.business.sc.course.repo.mapper.ScClaTimeAttendMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
+import cn.xluobo.business.sc.course.service.IScClaTimeAttendService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ *
+ * 上课出勤表 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-30 02:33:26
+ */
+@Service
+public class ScClaTimeAttendServiceImpl extends ServiceImpl implements IScClaTimeAttendService {
+
+ @Override
+ public int studentCourseAttendCount(Long studentCourseId, String beginDate, String endDate) {
+ return baseMapper.selectStudentAttendCount(studentCourseId, beginDate, endDate);
+ }
+
+ @Override
+ public Integer getNeedAttendCount(String beginDate, String endDate) {
+ return baseMapper.selectNeedAttendCount(beginDate, endDate);
+ }
+
+ @Override
+ public Integer getAttendCount(String beginDate, String endDate, String[] attendStatus) {
+ return baseMapper.selectAttendCount(beginDate, endDate, attendStatus);
+ }
+
+ @Override
+ public BigDecimal getAttendCostHour(String beginDate, String endDate, boolean needAttend) {
+ if(needAttend) {
+ return baseMapper.selectNeedAttendCostHour(beginDate, endDate);
+ } else {
+ return baseMapper.selectAttendCostHour(beginDate, endDate);
+ }
+ }
+
+ @Override
+ public BigDecimal getTeacherGetHour(ReqClaTimeCount reqClaTimeCount) {
+ return baseMapper.selectTeacherSumGetHour(reqClaTimeCount);
+ }
+
+ @Override
+ public List getAttendList(Long courseTimeId) {
+ QueryWrapper qwAttend = new QueryWrapper<>();
+ qwAttend.eq("course_time_id", courseTimeId);
+ return this.list(qwAttend);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeRuleServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeRuleServiceImpl.java
new file mode 100644
index 0000000..85c7ee9
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeRuleServiceImpl.java
@@ -0,0 +1,300 @@
+package cn.xluobo.business.sc.course.service.impl;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeRule;
+import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule;
+import cn.xluobo.business.sc.course.repo.enums.ClaTimeRepeatTypeEnums;
+import cn.xluobo.business.sc.course.repo.enums.ClaTimeRuleTypeEnums;
+import cn.xluobo.business.sc.course.repo.mapper.ScClaTimeRuleMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.repo.model.ScClaTimeRule;
+import cn.xluobo.business.sc.course.service.IScClaTimeRuleService;
+import cn.xluobo.business.sc.course.service.IScClaTimeService;
+import cn.xluobo.business.sys.holiday.service.ISysHolidayService;
+import cn.xluobo.core.utils.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ *
+ * 上课时间配置规则 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-14
+ */
+@Service
+public class ScClaTimeRuleServiceImpl extends ServiceImpl implements IScClaTimeRuleService {
+
+ @Autowired
+ private ISysHolidayService holidayService;
+ @Autowired
+ private IScClaTimeService claTimeService;
+
+ @Override
+ public List getClaTimeList(ReqSearchScClaTimeRule reqSearchScClaTimeRule) {
+ List resultClaTimeList = Lists.newArrayList();
+
+ // 节假日缓存
+ Map holidayMap = holidayService.getHolidayMap();
+
+ // 获取满足条件的配置
+ List ruleList = baseMapper.selectByCondition(reqSearchScClaTimeRule, null);
+
+ DateTime searchBegin = DateUtil.yyyMMddDayBegin(reqSearchScClaTimeRule.getBeginDate());
+ DateTime searchEnd = DateUtil.yyyMMddDayEnd(reqSearchScClaTimeRule.getEndDate());
+
+ for (RespClaTimeRule itemTime : ruleList) {
+ List claTimeListByRuleId = this.getClaTimeListByRule(itemTime, holidayMap);
+ resultClaTimeList.addAll(claTimeListByRuleId);
+ }
+
+ Collections.sort(resultClaTimeList, (o1, o2) -> {
+ int a = Integer.parseInt(o1.getClaDate().replaceAll("-", ""));
+ int b = Integer.parseInt(o2.getClaDate().replaceAll("-", ""));
+ if (a > b) {
+ return 1;
+ } else if (a < b) {
+ return -1;
+ } else {
+ return 0;
+ }
+ });
+ return resultClaTimeList;
+ }
+
+ @Override
+ public List getClaTimeListByRuleId(Long ruleId) {
+ RespClaTimeRule itemTime = baseMapper.selectByRuleId(ruleId);
+ return this.getClaTimeListByRule(itemTime, null);
+ }
+
+ @Override
+ public List getClaTimeListByRule(RespClaTimeRule itemTime, Map holidayMap) {
+ List resultClaTimeList = Lists.newArrayList();
+
+ // 节假日缓存
+ if (null == holidayMap) {
+ holidayMap = holidayService.getHolidayMap();
+ }
+
+
+ String ruleType = itemTime.getRuleType();
+ String repeatType = itemTime.getRepeatType();
+ String weekDay = itemTime.getWeekDay();
+ boolean filterHoliday = itemTime.isFilterHoliday();
+ String[] chooseDate = itemTime.getChooseDate();
+
+ DateTime beginDate = DateUtil.yyyMMddDayBegin(itemTime.getBeginDate());
+ DateTime endDate = DateUtil.yyyMMddDayEnd(itemTime.getEndDate());
+
+ if (ClaTimeRuleTypeEnums.ONCE_RULE.getRuleType().equals(ruleType)) {
+
+ for (String date : chooseDate) {
+ RespClaTimeRule respClaTime = RespClaTimeRule.builder()
+ .claName(itemTime.getClaName())
+ .courseName(itemTime.getCourseName())
+ .staffName(itemTime.getStaffName())
+ .claDate(date)
+ .claTimeBegin(itemTime.getClaTimeBegin())
+ .claTimeEnd(itemTime.getClaTimeEnd())
+ .build();
+ respClaTime.setRuleId(itemTime.getRuleId());
+ respClaTime.setClassTheme(itemTime.getClassTheme());
+
+ resultClaTimeList.add(respClaTime);
+ }
+
+ return resultClaTimeList;
+ }
+
+ // 周几上课
+ List weekDayList = Lists.newArrayList();
+ if (ClaTimeRepeatTypeEnums.EVERY_WEEK.getRepeatType().equals(repeatType)
+ || ClaTimeRepeatTypeEnums.EVERY_SECOND_WEEK.getRepeatType().equals(repeatType)) {
+ if (StringUtils.isEmpty(weekDay)) {
+ return resultClaTimeList;
+ }
+ weekDayList = Lists.newArrayList(weekDay.split(","));
+ }
+
+ // 非单次排课 计算所有上课日期
+ DateTime cycleBeginDate = beginDate;
+ DateTime cycleEndDate = endDate;
+
+ if (ClaTimeRepeatTypeEnums.EVERY_WEEK.getRepeatType().equals(repeatType)) {
+ while (cycleBeginDate.isBefore(cycleEndDate)) {
+
+ // 每周重复
+ int dayOfWeek = cycleBeginDate.getDayOfWeek();
+ boolean contains = weekDayList.contains(String.valueOf(dayOfWeek));
+
+ if (!contains) {
+ // 不上课
+ cycleBeginDate = cycleBeginDate.plusDays(1);
+ continue;
+ }
+
+ if (filterHoliday && holidayMap.containsKey(cycleBeginDate.toString("yyyyMMdd"))) {
+ // 过滤节假日
+ cycleBeginDate = cycleBeginDate.plusDays(1);
+ continue;
+ }
+
+ RespClaTimeRule respClaTime = RespClaTimeRule.builder()
+ .claName(itemTime.getClaName())
+ .courseName(itemTime.getCourseName())
+ .staffName(itemTime.getStaffName())
+ .claDate(cycleBeginDate.toString("yyyy-MM-dd"))
+ .claTimeBegin(itemTime.getClaTimeBegin())
+ .claTimeEnd(itemTime.getClaTimeEnd())
+ .build();
+ respClaTime.setRuleId(itemTime.getRuleId());
+ respClaTime.setClassTheme(itemTime.getClassTheme());
+
+ resultClaTimeList.add(respClaTime);
+
+ cycleBeginDate = cycleBeginDate.plusDays(1);
+ }
+ } else if (ClaTimeRepeatTypeEnums.EVERY_SECOND_WEEK.getRepeatType().equals(repeatType)) {
+ while (cycleBeginDate.isBefore(cycleEndDate)) {
+ int dayOfWeek = cycleBeginDate.getDayOfWeek();
+
+ boolean contains = weekDayList.contains(String.valueOf(dayOfWeek));
+
+ if (!contains) {
+ // 不上课
+ if (dayOfWeek == 7) {
+ cycleBeginDate = cycleBeginDate.plusDays(8);
+ } else {
+ cycleBeginDate = cycleBeginDate.plusDays(1);
+ }
+ continue;
+ }
+
+ if (filterHoliday && holidayMap.containsKey(cycleBeginDate.toString("yyyyMMdd"))) {
+ // 过滤节假日
+ if (dayOfWeek == 7) {
+ cycleBeginDate = cycleBeginDate.plusDays(8);
+ } else {
+ cycleBeginDate = cycleBeginDate.plusDays(1);
+ }
+ continue;
+ }
+
+ RespClaTimeRule respClaTime = RespClaTimeRule.builder()
+ .claName(itemTime.getClaName())
+ .courseName(itemTime.getCourseName())
+ .staffName(itemTime.getStaffName())
+ .claDate(cycleBeginDate.toString("yyyy-MM-dd"))
+ .claTimeBegin(itemTime.getClaTimeBegin())
+ .claTimeEnd(itemTime.getClaTimeEnd())
+ .build();
+ respClaTime.setRuleId(itemTime.getRuleId());
+ respClaTime.setClassTheme(itemTime.getClassTheme());
+
+ resultClaTimeList.add(respClaTime);
+
+ if (dayOfWeek == 7) {
+ cycleBeginDate = cycleBeginDate.plusDays(8);
+ } else {
+ cycleBeginDate = cycleBeginDate.plusDays(1);
+ }
+ }
+ } else if (ClaTimeRepeatTypeEnums.EVERY_SECOND_DAY.getRepeatType().equals(repeatType)) {
+ while (cycleBeginDate.isBefore(cycleEndDate)) {
+
+ if (filterHoliday && holidayMap.containsKey(cycleBeginDate.toString("yyyyMMdd"))) {
+ // 过滤节假日
+ cycleBeginDate = cycleBeginDate.plusDays(2);
+ continue;
+ }
+
+ RespClaTimeRule respClaTime = RespClaTimeRule.builder()
+ .claName(itemTime.getClaName())
+ .courseName(itemTime.getCourseName())
+ .staffName(itemTime.getStaffName())
+ .claDate(cycleBeginDate.toString("yyyy-MM-dd"))
+ .claTimeBegin(itemTime.getClaTimeBegin())
+ .claTimeEnd(itemTime.getClaTimeEnd())
+ .build();
+ respClaTime.setRuleId(itemTime.getRuleId());
+ respClaTime.setClassTheme(itemTime.getClassTheme());
+
+ resultClaTimeList.add(respClaTime);
+
+ cycleBeginDate = cycleBeginDate.plusDays(2);
+ }
+ }
+ return resultClaTimeList;
+ }
+
+ @Override
+ public List getClaTimeListByRule(ScClaTimeRule claTimeRule, Map holidayMap) {
+ RespClaTimeRule respClaTime = RespClaTimeRule.builder()
+ .claTimeBegin(claTimeRule.getStartTime())
+ .claTimeEnd(claTimeRule.getEndTime())
+ .build();
+
+ BeanUtils.copyProperties(claTimeRule, respClaTime);
+
+ return this.getClaTimeListByRule(respClaTime, holidayMap);
+ }
+
+ @Override
+ public List checkDayRepeat(Long claId, String[] day, Long notEqRuleId) {
+ if (null == claId || null == day || day.length == 0) {
+ return null;
+ }
+
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.select("cla_date");
+ qw.eq("cla_id", claId);
+ qw.eq("status", "1");
+ qw.in("cla_date", day);
+ if (null != notEqRuleId) {
+ qw.ne("rule_id", notEqRuleId);
+ }
+ List list = claTimeService.list(qw);
+ return list.stream().map(ScClaTime::getClaDate).collect(Collectors.toList());
+ }
+
+ @Override
+ public List checkDayRepeat(ScClaTimeRule claTimeRule) {
+ Long claId = claTimeRule.getClaId();
+ String repeatType = claTimeRule.getRepeatType();
+ String ruleType = claTimeRule.getRuleType();
+ String[] chooseDate = claTimeRule.getChooseDate();
+ if (null == claId) {
+ return null;
+ }
+ if (StringUtils.isAnyEmpty(repeatType, ruleType)) {
+ return null;
+ }
+
+ if (ClaTimeRuleTypeEnums.ONCE_RULE.getRuleType().equals(ruleType)) {
+ if (null == chooseDate || chooseDate.length == 0) {
+ return null;
+ }
+ return this.checkDayRepeat(claId, chooseDate, claTimeRule.getRuleId());
+ }
+ // 非单次排课 计算所有上课日期
+ List claTimeListByRule = this.getClaTimeListByRule(claTimeRule, null);
+ return this.checkDayRepeat(claId, claTimeListByRule.stream().map(RespClaTimeRule::getClaDate).toArray(String[]::new), claTimeRule.getRuleId());
+ }
+
+ @Override
+ public List selectClaTimeInfo(Long claId) {
+ return baseMapper.selectClaTimeInfo(claId);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeServiceImpl.java
new file mode 100644
index 0000000..ae6d015
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScClaTimeServiceImpl.java
@@ -0,0 +1,36 @@
+package cn.xluobo.business.sc.course.service.impl;
+
+import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
+import cn.xluobo.business.sc.course.repo.mapper.ScClaTimeMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.service.IScClaTimeService;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 排课信息 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-09-16
+ */
+@Service
+public class ScClaTimeServiceImpl extends ServiceImpl implements IScClaTimeService {
+
+ @Override
+ public boolean deleteUnBeginTime(Long ruleId, Long claId, String tenantId) {
+ UpdateWrapper uw = new UpdateWrapper();
+ uw.eq("rule_id", ruleId);
+ uw.eq("cla_id", claId);
+ uw.in("status", "1");
+ uw.exists("select 1 from sc_course_cla b where sc_cla_time.cla_id = b.cla_id and b.tenant_id='" + tenantId + "'");
+ return this.remove(uw);
+ }
+
+ @Override
+ public Integer claTimeCount(ReqClaTimeCount reqClaTimeCount) {
+ return baseMapper.selectClaTimeCount(reqClaTimeCount);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseChargeServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseChargeServiceImpl.java
new file mode 100644
index 0000000..80bdc08
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseChargeServiceImpl.java
@@ -0,0 +1,77 @@
+package cn.xluobo.business.sc.course.service.impl;
+
+import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseCharge;
+import cn.xluobo.business.sc.course.enums.CourseChargeTypeEnum;
+import cn.xluobo.business.sc.course.repo.mapper.ScCourseChargeMapper;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCharge;
+import cn.xluobo.business.sc.course.service.IScCourseChargeService;
+import cn.xluobo.business.sys.admin.service.ISysDictDataService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ *
+ * 课程收费模式 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-08
+ */
+@Service
+public class ScCourseChargeServiceImpl extends ServiceImpl implements IScCourseChargeService {
+
+ @Autowired
+ private ISysDictDataService sysDictDataService;
+
+ @Override
+ public List transferCourseChargeList(List courseChargeList) {
+ List dateUnitList = sysDictDataService.dictTypeDataList("date_unit");
+ Map dictUnitMap = dateUnitList.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
+
+ List chargeTypeList = sysDictDataService.dictTypeDataList("charge_type");
+ Map chargeTypeMap = chargeTypeList.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
+
+ return courseChargeList.stream().map(item -> {
+ String label = "";
+ String chargeType = item.getChargeType();
+ String chargeTypeName = chargeTypeMap.get(chargeType);
+ if (CourseChargeTypeEnum.DATE.getChargeType().equals(chargeType)) {
+ // 按时间 100元/月
+ label = "(" + chargeTypeName + ")" + item.getTotalFee().toString() + dictUnitMap.get(item.getDateUnit());
+ } else if (CourseChargeTypeEnum.HOUR.getChargeType().equals(chargeType)) {
+ // 按课时 10课时:100元
+ label = "(" + chargeTypeName + ")" + item.getCount().toString() + "课时 " + item.getTotalFee().toString() + "元";
+ } else if (CourseChargeTypeEnum.CYCLE.getChargeType().equals(chargeType)) {
+ // 按期 100元/月
+ label = "(" + chargeTypeName + ")" + item.getCount().toString() + "课时/期 " + item.getTotalFee().toString() + "元";
+ }
+ return RespBusinessChooseCourseCharge.builder()
+ .chargeId(item.getChargeId())
+ .totalFee(item.getTotalFee())
+ .label(label)
+ .chargeType(item.getChargeType())
+ .count(item.getCount())
+ .dateUnit(item.getDateUnit())
+ .build();
+ }).collect(Collectors.toList());
+ }
+
+ @Override
+ public List courseChargeList(Long courseId, String chargeType) {
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.eq("course_id", courseId);
+ if (StringUtils.isNotEmpty(chargeType)) {
+ qw.eq("charge_type", chargeType);
+ }
+ List courseChargeList = this.list(qw);
+ return transferCourseChargeList(courseChargeList);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseClaServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseClaServiceImpl.java
new file mode 100644
index 0000000..d3699d4
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseClaServiceImpl.java
@@ -0,0 +1,56 @@
+package cn.xluobo.business.sc.course.service.impl;
+
+import cn.xluobo.business.sc.course.repo.enums.ClaTimeStatusEnums;
+import cn.xluobo.business.sc.course.repo.mapper.ScCourseClaMapper;
+import cn.xluobo.business.sc.course.repo.model.ScClaTime;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.business.sc.course.service.IScClaTimeService;
+import cn.xluobo.business.sc.course.service.IScCourseClaService;
+import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
+import cn.xluobo.business.sc.student.service.IScStudentCourseService;
+import cn.xluobo.core.api.APIBaseResponse;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 课程班级信息 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 01:11:06
+ */
+@Service
+public class ScCourseClaServiceImpl extends ServiceImpl implements IScCourseClaService {
+
+ @Autowired
+ private IScStudentCourseService studentCourseService;
+ @Autowired
+ private IScClaTimeService claTimeService;
+
+ @Override
+ public Integer selectStudentCnt(Long claId) {
+ return baseMapper.selectStudentCnt(claId);
+ }
+
+ @Override
+ public APIBaseResponse canChangeCourse(Long claId) {
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.eq("cla_id", claId);
+ int count = studentCourseService.count(qw);
+ if (count != 0) {
+ return APIBaseResponse.fail("当前班级有报读学员,无法变更所属课程.");
+ }
+
+ QueryWrapper qwClaTime = new QueryWrapper<>();
+ qwClaTime.eq("cla_id", claId);
+ qwClaTime.eq("status", ClaTimeStatusEnums.HAD_CLASS.getStatus());
+ int hadClaTimeCount = claTimeService.count(qwClaTime);
+ if (hadClaTimeCount != 0) {
+ return APIBaseResponse.fail("当前班级已有上课记录,无法变更所属课程.");
+ }
+ return APIBaseResponse.success();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseServiceImpl.java
new file mode 100644
index 0000000..8311bd6
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseServiceImpl.java
@@ -0,0 +1,39 @@
+package cn.xluobo.business.sc.course.service.impl;
+
+import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
+import cn.xluobo.business.sc.course.domain.resp.course.RespSearchCourse;
+import cn.xluobo.business.sc.course.repo.mapper.ScCourseChargeMapper;
+import cn.xluobo.business.sc.course.repo.mapper.ScCourseMapper;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.service.IScCourseService;
+import cn.xluobo.core.page.RespPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *
+ * 课程信息 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-03-17 11:25:55
+ */
+@Service
+public class ScCourseServiceImpl extends ServiceImpl implements IScCourseService {
+
+ @Autowired
+ private ScCourseMapper courseMapper;
+ @Autowired
+ private ScCourseChargeMapper courseChargeMapper;
+
+ @Override
+ public RespPage searchCourse(ReqSearchScCourse reqSearchScCourse) {
+ RespPage respPage = new RespPage(reqSearchScCourse.getPageNum(),reqSearchScCourse.getPageSize());
+ List courseList = baseMapper.selectCourseList(reqSearchScCourse, respPage);
+ respPage.setRows(courseList);
+ return respPage;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseTypeServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseTypeServiceImpl.java
new file mode 100644
index 0000000..387c5ba
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/course/service/impl/ScCourseTypeServiceImpl.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.sc.course.service.impl;
+
+import cn.xluobo.business.sc.course.repo.mapper.ScCourseTypeMapper;
+import cn.xluobo.business.sc.course.repo.model.ScCourseType;
+import cn.xluobo.business.sc.course.service.IScCourseTypeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 课程类型 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-07-09 08:10:25
+ */
+@Service
+public class ScCourseTypeServiceImpl extends ServiceImpl implements IScCourseTypeService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/controller/ScStudentCourseLogController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/controller/ScStudentCourseLogController.java
new file mode 100644
index 0000000..9beca78
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/controller/ScStudentCourseLogController.java
@@ -0,0 +1,33 @@
+package cn.xluobo.business.sc.log.controller;
+
+import cn.xluobo.business.sc.log.domain.req.ReqSearchStuCourseLog;
+import cn.xluobo.business.sc.log.service.BusinessScStudentCourseLogService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 日志
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/21 14:45
+ */
+@RestController
+@RequestMapping("/api/sc/student/log")
+public class ScStudentCourseLogController {
+
+ @Autowired
+ private BusinessScStudentCourseLogService studentCourseLogService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchStuCourseLog
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchStuCourseLog reqSearchStuCourseLog) {
+ return studentCourseLogService.searchList(reqSearchStuCourseLog);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/domain/req/ReqSearchStuCourseLog.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/domain/req/ReqSearchStuCourseLog.java
new file mode 100644
index 0000000..24ec346
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/domain/req/ReqSearchStuCourseLog.java
@@ -0,0 +1,27 @@
+package cn.xluobo.business.sc.log.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/21 14:44
+ */
+@Data
+public class ReqSearchStuCourseLog extends ReqPageBase implements Serializable {
+
+ private Long studentId;
+
+ private Long courseId;
+
+ private Long claId;
+
+ private String logType;
+
+ private String beginDate;
+
+ private String endDate;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/enums/LogTypeEnum.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/enums/LogTypeEnum.java
new file mode 100644
index 0000000..1a59d7d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/enums/LogTypeEnum.java
@@ -0,0 +1,34 @@
+package cn.xluobo.business.sc.log.enums;
+
+/**
+ * 学生日志类型
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/19 10:15
+ */
+public enum LogTypeEnum {
+
+ PAY_FEE("1","缴费"),
+ ATTEND_CLA("2","上课"),
+ DELETE_ATTEND_CLA("3","删除上课记录"),
+ INVALID_ORDER("4","作废订单"),
+ OUT_CLA("5","退出班级"),
+ IN_CLA("6","进入班级"),
+ ;
+
+ private final String logType;
+
+ private final String logTypeName;
+
+ LogTypeEnum(String logType, String logTypeName) {
+ this.logType = logType;
+ this.logTypeName = logTypeName;
+ }
+
+ public String getLogType() {
+ return logType;
+ }
+
+ public String getLogTypeName() {
+ return logTypeName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/mapper/ScStudentCourseLogMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/mapper/ScStudentCourseLogMapper.java
new file mode 100644
index 0000000..9ad56a5
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/mapper/ScStudentCourseLogMapper.java
@@ -0,0 +1,22 @@
+package cn.xluobo.business.sc.log.repo.mapper;
+
+import cn.xluobo.business.sc.log.domain.req.ReqSearchStuCourseLog;
+import cn.xluobo.business.sc.log.repo.model.ScStudentCourseLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *
+ * 课程缴费扣费记录 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-12-17
+ */
+public interface ScStudentCourseLogMapper extends BaseMapper {
+
+ List selectForSearchTable(@Param("reqSearchStuCourseLog") ReqSearchStuCourseLog reqSearchStuCourseLog, @Param("page") Page page);
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/mapping/ScStudentCourseLogMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/mapping/ScStudentCourseLogMapper.xml
new file mode 100644
index 0000000..070e6e8
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/mapping/ScStudentCourseLogMapper.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/model/ScStudentCourseLog.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/model/ScStudentCourseLog.java
new file mode 100644
index 0000000..78d8c16
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/repo/model/ScStudentCourseLog.java
@@ -0,0 +1,127 @@
+package cn.xluobo.business.sc.log.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * 课程缴费扣费记录
+ *
+ *
+ * @author zhangby
+ * @since 2020-12-17
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_student_course_log")
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ScStudentCourseLog implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ @TableId(value = "log_id", type = IdType.ASSIGN_ID)
+ private Long logId;
+
+ /**
+ * 学生
+ */
+ @TableField("student_id")
+ private Long studentId;
+
+ /**
+ * 日志类型 参照 LogTypeEnum
+ */
+ @TableField("log_type")
+ private String logType;
+
+ /**
+ * 课程
+ */
+ @TableField("course_id")
+ private Long courseId;
+
+ /**
+ * 课程名称
+ */
+ @TableField("course_name")
+ private String courseName;
+
+ /**
+ * 班级
+ */
+ @TableField("cla_id")
+ private Long claId;
+
+ /**
+ * 班级名称
+ */
+ @TableField("cla_name")
+ private String claName;
+
+ /**
+ * 经办校区
+ */
+ @TableField("dept_name")
+ private String deptName;
+
+ /**
+ * 变更课时
+ */
+ @TableField("change_hour")
+ private BigDecimal changeHour;
+
+ /**
+ * 变更后剩余课时
+ */
+ @TableField("after_balance_hour")
+ private BigDecimal afterBalanceHour;
+
+ /**
+ * 变更金额
+ */
+ @TableField("change_fee")
+ private BigDecimal changeFee;
+
+ /**
+ * 备注
+ */
+ @TableField("memo")
+ private String memo;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user_name")
+ private String createUserName;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ // 学生姓名
+ @TableField(exist = false)
+ private String studentName;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/BusinessScStudentCourseLogService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/BusinessScStudentCourseLogService.java
new file mode 100644
index 0000000..fe07564
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/BusinessScStudentCourseLogService.java
@@ -0,0 +1,39 @@
+package cn.xluobo.business.sc.log.service;
+
+import cn.xluobo.business.sc.log.domain.req.ReqSearchStuCourseLog;
+import cn.xluobo.business.sc.log.repo.mapper.ScStudentCourseLogMapper;
+import cn.xluobo.business.sc.log.repo.model.ScStudentCourseLog;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.page.RespPage;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/21 14:46
+ */
+@Service
+@Transactional
+@Slf4j
+public class BusinessScStudentCourseLogService {
+
+ @Autowired
+ private ScStudentCourseLogMapper studentCourseLogMapper;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchStuCourseLog
+ * @return
+ */
+ public APIResponse searchList(ReqSearchStuCourseLog reqSearchStuCourseLog) {
+ RespPage page = new RespPage<>(reqSearchStuCourseLog.getPageNum(), reqSearchStuCourseLog.getPageSize());
+ List orderList = studentCourseLogMapper.selectForSearchTable(reqSearchStuCourseLog, page);
+ page.setRows(orderList);
+ return APIResponse.toAPIResponse(page);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/IScStudentCourseLogService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/IScStudentCourseLogService.java
new file mode 100644
index 0000000..1857ca4
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/IScStudentCourseLogService.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.sc.log.service;
+
+import cn.xluobo.business.sc.log.repo.model.ScStudentCourseLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 课程缴费扣费记录 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-12-17
+ */
+public interface IScStudentCourseLogService extends IService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/impl/ScStudentCourseLogServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/impl/ScStudentCourseLogServiceImpl.java
new file mode 100644
index 0000000..f311b8c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/log/service/impl/ScStudentCourseLogServiceImpl.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.sc.log.service.impl;
+
+import cn.xluobo.business.sc.log.repo.mapper.ScStudentCourseLogMapper;
+import cn.xluobo.business.sc.log.repo.model.ScStudentCourseLog;
+import cn.xluobo.business.sc.log.service.IScStudentCourseLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 课程缴费扣费记录 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-12-17
+ */
+@Service
+public class ScStudentCourseLogServiceImpl extends ServiceImpl implements IScStudentCourseLogService {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/controller/ScOrderController.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/controller/ScOrderController.java
new file mode 100644
index 0000000..a98a387
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/controller/ScOrderController.java
@@ -0,0 +1,67 @@
+package cn.xluobo.business.sc.order.controller;
+
+import cn.xluobo.business.sc.order.domain.req.ReqBusinessSignUp;
+import cn.xluobo.business.sc.order.domain.req.ReqSearchScOrder;
+import cn.xluobo.business.sc.order.service.BusinessScOrderService;
+import cn.xluobo.core.api.APIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 订单 Controller
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-24 10:22:19
+ */
+@RestController
+@RequestMapping("/api/sc/order")
+public class ScOrderController {
+ @Autowired
+ private BusinessScOrderService scOrderService;
+
+ /**
+ * 列表
+ *
+ * @param reqSearchScOrder
+ * @return
+ */
+ @GetMapping("/list/searchList")
+ public APIResponse searchList(ReqSearchScOrder reqSearchScOrder) {
+ return scOrderService.searchList(reqSearchScOrder);
+ }
+
+ /**
+ * 详情
+ *
+ * @param orderId
+ * @return
+ */
+ @GetMapping("/info/detailById/{orderId}")
+ public APIResponse detailById(@PathVariable("orderId") Long orderId) {
+ return scOrderService.detailById(orderId);
+ }
+
+ /**
+ * 新办
+ *
+ * @param reqBusinessSignUp
+ * @return
+ */
+ @PostMapping("/add/signUp")
+ public APIResponse signUp(@RequestBody ReqBusinessSignUp reqBusinessSignUp) {
+ return scOrderService.signUp(reqBusinessSignUp);
+ }
+
+ /**
+ * 作废订单
+ *
+ * @param orderIds
+ * @return
+ */
+ @PostMapping("/delete/invalidById/{orderIds}")
+ public APIResponse invalidById(@PathVariable("orderIds") Long[] orderIds) {
+ return scOrderService.invalidById(orderIds);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUp.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUp.java
new file mode 100644
index 0000000..984c0f6
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUp.java
@@ -0,0 +1,102 @@
+package cn.xluobo.business.sc.order.domain.req;
+
+import cn.xluobo.core.api.APIResponse;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 新办
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/3 15:56
+ */
+@Data
+public class ReqBusinessSignUp {
+
+ private Long studentId;
+
+ // 经办校区
+ private Long handleDepartId;
+
+ // 是否使用余额支付
+ private boolean useBalancePay;
+ // 余额支付金额
+ private BigDecimal balancePayValue;
+
+ // 订单标签
+ private String[] orderTag;
+
+ // 销售员工
+ private Long saleStaffId;
+
+ // 经办日期
+ private String handleDate;
+
+ // 办理备注
+ private String memo;
+
+ // 销售来源
+ private String[] saleSourceTag;
+
+ // 实收金额
+ private BigDecimal receiptWaySumMoney;
+
+ // 应收金额
+ private BigDecimal needReceiptFee;
+
+ // 报读课程
+ List signUpItemList;
+
+ // 收款方式
+ List signUpReceiptList;
+
+ public APIResponse checkParam() {
+ if (null == signUpItemList || signUpItemList.size() == 0) {
+ return APIResponse.toExceptionResponse("请选择报读课程");
+ } else if (null == studentId) {
+ return APIResponse.toExceptionResponse("请选择学生");
+ } else if (null == handleDepartId) {
+ return APIResponse.toExceptionResponse("请选择经办校区");
+ } else if (useBalancePay && null == balancePayValue) {
+ return APIResponse.toExceptionResponse("余额支付时,请填写余额支付金额");
+ } else if (null == needReceiptFee) {
+ return APIResponse.toExceptionResponse("无应收金额");
+ } else if (null == receiptWaySumMoney) {
+ return APIResponse.toExceptionResponse("未填写实收金额");
+ }
+ for (ReqBusinessSignUpItem item : signUpItemList) {
+ if(null == item.getCourseId()) {
+ return APIResponse.toExceptionResponse("请选择课程");
+ } else if (null == item.getDepartId()) {
+ return APIResponse.toExceptionResponse("无法获取报读课程所属校区,请重试");
+ } else if (null == item.getChargeId()) {
+ return APIResponse.toExceptionResponse("请选择收费方式");
+ } else if (StringUtils.isEmpty(item.getChargeType())) {
+ return APIResponse.toExceptionResponse("请选择收费方式");
+ } else if (null == item.getBuyCount() || 0 == item.getBuyCount()) {
+ return APIResponse.toExceptionResponse("请填写购买数量");
+ } else if (item.isOpenExpire() && null == item.getExpireDate()) {
+ return APIResponse.toExceptionResponse("设置有效期但未填写失效时间");
+ } else if ("date".equals(item.getChargeType()) && null == item.getBeginDate()) {
+ return APIResponse.toExceptionResponse("按时间收费 但未填写生效时间");
+ } else if ("date".equals(item.getChargeType()) && null == item.getEndDate()) {
+ return APIResponse.toExceptionResponse("按时间收费 但未填写失效时间");
+ } else if (item.isOpenDiscount() && null == item.getDiscount()) {
+ return APIResponse.toExceptionResponse("启学费折扣,但未填写折扣");
+ } else if (item.isOpenDiscountFee() && null == item.getDiscountFee()) {
+ return APIResponse.toExceptionResponse("启学费折扣,但未填写优惠金额");
+ }
+ }
+ for (ReqBusinessSignUpReceipt signUpReceipt : signUpReceiptList) {
+ if(null == signUpReceipt.getAccountId()){
+ return APIResponse.toExceptionResponse("收款方式未填写,请选择填写已添加的收款方式");
+ } else if(null == signUpReceipt.getReceiptMoney()) {
+ return APIResponse.toExceptionResponse("请填写已选择收款方式的收款金额");
+ }
+ }
+ return APIResponse.toOkResponse();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUpItem.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUpItem.java
new file mode 100644
index 0000000..311d2c1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUpItem.java
@@ -0,0 +1,58 @@
+package cn.xluobo.business.sc.order.domain.req;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 报名详情
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/3 16:06
+ */
+@Data
+public class ReqBusinessSignUpItem {
+
+ private Long courseId;
+
+ private Long claId;
+
+ // 报读校区
+ private Long departId;
+
+ private Long chargeId;
+
+ private String chargeType;
+
+ // 购买数量
+ private Integer buyCount;
+
+ // 按课时收费 是否设置有效期
+ private boolean openExpire;
+
+ // 失效时间
+ private String expireDate;
+
+ // 按时间收费 生效时间
+ private String beginDate;
+ // 按时间收费 失效时间
+ private String endDate;
+
+ // 是否学费折扣
+ private boolean openDiscount;
+ // 是否学费优惠
+ private boolean openDiscountFee;
+ // 折扣 0-10之间
+ private BigDecimal discount;
+ // 优惠
+ private BigDecimal discountFee;
+
+ // 内部备注
+ private String insideMemo;
+ // 外部备注
+ private String outsideMemo;
+
+ // 类型 1新报 2续报
+ private String detailTag;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUpReceipt.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUpReceipt.java
new file mode 100644
index 0000000..fae2a1f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqBusinessSignUpReceipt.java
@@ -0,0 +1,20 @@
+package cn.xluobo.business.sc.order.domain.req;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 新报收款信息
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/4 16:46
+ */
+@Data
+public class ReqBusinessSignUpReceipt {
+
+ private Long accountId;
+
+ // 收款金额
+ private BigDecimal receiptMoney;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqReportMonthCourseIncome.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqReportMonthCourseIncome.java
new file mode 100644
index 0000000..bb6419f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqReportMonthCourseIncome.java
@@ -0,0 +1,24 @@
+package cn.xluobo.business.sc.order.domain.req;
+
+import lombok.Data;
+
+/**
+ * 月份、课程 营收情况
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/24 19:57
+ */
+@Data
+public class ReqReportMonthCourseIncome {
+
+ private String beginMonth;
+
+ private String endMonth;
+
+ private Long deptId;
+
+ private Long[] deptIds;
+
+ private Long[] courseIds;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqSearchScOrder.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqSearchScOrder.java
new file mode 100644
index 0000000..34ebdc6
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/req/ReqSearchScOrder.java
@@ -0,0 +1,60 @@
+package cn.xluobo.business.sc.order.domain.req;
+
+import cn.xluobo.core.page.ReqPageBase;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:30
+ */
+@Data
+public class ReqSearchScOrder extends ReqPageBase implements Serializable {
+
+ // 学员
+ private Long studentId;
+
+ // 经办日期
+ private String[] handleDate;
+
+ private String handleDateBegin;
+ private String handleDateEnd;
+
+ // 是否欠费
+ private Boolean arrears;
+
+ // 校区
+ private Long deptId;
+
+ // 课程
+ private Long courseId;
+
+ // 销售员工
+ private Long saleStaffId;
+
+ // 订单类型
+ private String orderType;
+
+ // 订单状态
+ private String orderStatus;
+
+ // 经办人
+ private Long createUser;
+
+ // 经办校区
+ private Long handleDeptId;
+
+ // 销售来源
+ private String saleSourceTag;
+
+ public void setHandleDate(String[] handleDate) {
+ this.handleDate = handleDate;
+ if (null != handleDate && handleDate.length == 2 && StringUtils.isAnyEmpty(handleDateBegin, handleDateEnd)) {
+ this.handleDateBegin = handleDate[0];
+ this.handleDateEnd = handleDate[1];
+ }
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/resp/RespOrder.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/resp/RespOrder.java
new file mode 100644
index 0000000..970b466
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/resp/RespOrder.java
@@ -0,0 +1,44 @@
+package cn.xluobo.business.sc.order.domain.resp;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/8 13:47
+ */
+@Data
+public class RespOrder {
+
+ private Long orderId;
+
+ private String orderType;
+
+ private BigDecimal actualTotalFee;
+
+ private BigDecimal receiptFee;
+
+ private BigDecimal balanceFee;
+
+ private String saleStaffName;
+
+ private String orderTag;
+
+ private String handleDeptName;
+
+ private String handleDate;
+
+ private String createUserName;
+
+ private String memo;
+
+ private String studentName;
+
+ private String phone;
+
+ private String orderDetail;
+
+ private String orderStatus;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/resp/RespReportMonthCourseIncome.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/resp/RespReportMonthCourseIncome.java
new file mode 100644
index 0000000..465d2ab
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/domain/resp/RespReportMonthCourseIncome.java
@@ -0,0 +1,24 @@
+package cn.xluobo.business.sc.order.domain.resp;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 月份、课程 营收情况
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/24 19:52
+ */
+@Data
+public class RespReportMonthCourseIncome {
+
+ private String month;
+
+ private Long courseId;
+
+ private String courseName;
+
+ private BigDecimal fee;
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderDetailTagEnum.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderDetailTagEnum.java
new file mode 100644
index 0000000..e40453c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderDetailTagEnum.java
@@ -0,0 +1,30 @@
+package cn.xluobo.business.sc.order.enums;
+
+/**
+ * 订单明细 标签
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/12 15:13
+ */
+public enum OrderDetailTagEnum {
+
+ NEW_COURSE("1", "新报"),
+ CONTINUE_COURSE("2", "续报"),
+ EXTEND_COURSE("3", "扩科"),
+ ;
+
+ private String tag;
+ private String tagName;
+
+ OrderDetailTagEnum(String tag, String tagName) {
+ this.tag = tag;
+ this.tagName = tagName;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ public String getTagName() {
+ return tagName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderStatusEnum.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderStatusEnum.java
new file mode 100644
index 0000000..5e003ac
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderStatusEnum.java
@@ -0,0 +1,32 @@
+package cn.xluobo.business.sc.order.enums;
+
+/**
+ * 订单状态
+ * @author :zhangbaoyu
+ * @date :Created in 2020/9/13 21:11
+ */
+public enum OrderStatusEnum {
+
+ WAIT_PAY("1", "待支付"),
+ HAD_PAY("2", "已支付"),
+ INVALID("3", "已作废"),
+ ;
+
+ private String orderStatus;
+
+ private String statusTxt;
+
+ OrderStatusEnum(String orderStatus, String statusTxt) {
+ this.orderStatus = orderStatus;
+ this.statusTxt = statusTxt;
+ }
+
+
+ public String getOrderStatus() {
+ return orderStatus;
+ }
+
+ public String getStatusTxt() {
+ return statusTxt;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderTypeEnum.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderTypeEnum.java
new file mode 100644
index 0000000..92d3bb6
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/enums/OrderTypeEnum.java
@@ -0,0 +1,28 @@
+package cn.xluobo.business.sc.order.enums;
+
+/**
+ * 订单类型
+ * @author :zhangbaoyu
+ * @date :Created in 2020/10/12 15:13
+ */
+public enum OrderTypeEnum {
+
+ SIGN_UP("1", "报名"),
+ ;
+
+ private String orderType;
+ private String orderTypeName;
+
+ OrderTypeEnum(String orderType, String orderTypeName) {
+ this.orderType = orderType;
+ this.orderTypeName = orderTypeName;
+ }
+
+ public String getOrderType() {
+ return orderType;
+ }
+
+ public String getOrderTypeName() {
+ return orderTypeName;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/OrderReportMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/OrderReportMapper.java
new file mode 100644
index 0000000..636b67c
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/OrderReportMapper.java
@@ -0,0 +1,23 @@
+package cn.xluobo.business.sc.order.repo.mapper;
+
+import cn.xluobo.business.sc.order.domain.req.ReqReportMonthCourseIncome;
+import cn.xluobo.business.sc.order.domain.resp.RespReportMonthCourseIncome;
+
+import java.util.List;
+
+/**
+ * 订单报表相关
+ *
+ * @author :zhangbaoyu
+ * @date :Created in 2020/12/24 19:50
+ */
+public interface OrderReportMapper {
+
+ /**
+ * 月份、课程 营收情况
+ * @param reqReportMonthCourseIncome
+ * @return
+ */
+ List selectMonthCourseIncomeList(ReqReportMonthCourseIncome reqReportMonthCourseIncome);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderAccountMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderAccountMapper.java
new file mode 100644
index 0000000..2bce3b0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderAccountMapper.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.sc.order.repo.mapper;
+
+import cn.xluobo.business.sc.order.repo.model.ScOrderAccount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 订单收款账户 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface ScOrderAccountMapper extends BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderDetailMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderDetailMapper.java
new file mode 100644
index 0000000..30bf1bc
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderDetailMapper.java
@@ -0,0 +1,16 @@
+package cn.xluobo.business.sc.order.repo.mapper;
+
+import cn.xluobo.business.sc.order.repo.model.ScOrderDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 订单详情 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface ScOrderDetailMapper extends BaseMapper {
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderMapper.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderMapper.java
new file mode 100644
index 0000000..21c146a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapper/ScOrderMapper.java
@@ -0,0 +1,28 @@
+package cn.xluobo.business.sc.order.repo.mapper;
+
+import cn.xluobo.business.sc.order.domain.req.ReqSearchScOrder;
+import cn.xluobo.business.sc.order.domain.resp.RespOrder;
+import cn.xluobo.business.sc.order.repo.model.ScOrder;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *
+ * 订单 Mapper 接口
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-24 10:22:19
+ */
+public interface ScOrderMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper {
+
+ List selectFroSearchTable(@Param("reqSearchScOrder")ReqSearchScOrder reqSearchScOrder, @Param("page")Page page);
+
+ /**
+ * 获取欠费学员数量
+ * @return
+ */
+ Integer selectArrearsStudentCount();
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/OrderReportMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/OrderReportMapper.xml
new file mode 100644
index 0000000..da9e01a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/OrderReportMapper.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderAccountMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderAccountMapper.xml
new file mode 100644
index 0000000..fa86e83
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderAccountMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderDetailMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderDetailMapper.xml
new file mode 100644
index 0000000..ff0a37e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderDetailMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderMapper.xml b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderMapper.xml
new file mode 100644
index 0000000..677654f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/mapping/ScOrderMapper.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrder.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrder.java
new file mode 100644
index 0000000..d408bf4
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrder.java
@@ -0,0 +1,175 @@
+package cn.xluobo.business.sc.order.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * 订单
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-24 10:22:19
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_order")
+public class ScOrder implements Serializable {
+
+
+ /**
+ * 订单编号
+ */
+ @TableId(value = "order_id", type = IdType.ASSIGN_ID)
+ private Long orderId;
+
+ /**
+ * 所属租户
+ */
+ @TableField("tenant_id")
+ private String tenantId;
+
+ /**
+ * 学员编号
+ */
+ @TableField("student_id")
+ private Long studentId;
+
+ /**
+ * 学员名称
+ */
+ @TableField("student_name")
+ private String studentName;
+
+ /**
+ * 联系电话
+ */
+ @TableField("phone")
+ private String phone;
+
+ /**
+ * 订单类型 1报名
+ */
+ @TableField("order_type")
+ private String orderType;
+
+ /**
+ * 原价
+ */
+ @TableField("original_total_fee")
+ private BigDecimal originalTotalFee;
+
+ /**
+ * 实际价格
+ */
+ @TableField("actual_total_fee")
+ private BigDecimal actualTotalFee;
+
+ /**
+ * 收款金额 receipt_fee+balance_fee=actual_total_fee
+ */
+ @TableField("receipt_fee")
+ private BigDecimal receiptFee;
+
+ /**
+ * 使用余额支付金额
+ */
+ @TableField("balance_fee")
+ private BigDecimal balanceFee;
+
+ /**
+ * 订单标签
+ */
+ @TableField("order_tag")
+ private String orderTag;
+
+ /**
+ * 销售来源标签
+ */
+ @TableField("sale_source_tag")
+ private String saleSourceTag;
+
+ /**
+ * 销售员工
+ */
+ @TableField("sale_staff_id")
+ private Long saleStaffId;
+
+ /**
+ * 销售员工
+ */
+ @TableField("sale_staff_name")
+ private String saleStaffName;
+
+ /**
+ * 订单状态 1待支付 2已支付 3已作废
+ */
+ @TableField("order_status")
+ private String orderStatus;
+
+ /**
+ * 内部备注
+ */
+ @TableField("memo")
+ private String memo;
+
+ /**
+ * 经办校区
+ */
+ @TableField("handle_dept_id")
+ private Long handleDeptId;
+
+ /**
+ * 经办校区
+ */
+ @TableField("handle_dept_name")
+ private String handleDeptName;
+
+ /**
+ * 经办日期
+ */
+ @TableField("handle_date")
+ private String handleDate;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+
+ /**
+ * 办理人员姓名
+ */
+ @TableField(exist = false)
+ private String handleStaffName;
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrderAccount.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrderAccount.java
new file mode 100644
index 0000000..3bbdd94
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrderAccount.java
@@ -0,0 +1,61 @@
+package cn.xluobo.business.sc.order.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *
+ * 订单收款账户
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_order_account")
+public class ScOrderAccount implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ @TableId(value = "order_account_id", type = IdType.ASSIGN_ID)
+ private Long orderAccountId;
+
+ /**
+ * 订单编号
+ */
+ @TableField("order_id")
+ private Long orderId;
+
+ /**
+ * 收款账户
+ */
+ @TableField("account_id")
+ private Long accountId;
+
+ /**
+ * 账户名称
+ */
+ @TableField("account_name")
+ private String accountName;
+
+ /**
+ * 实收
+ */
+ @TableField("fee")
+ private BigDecimal fee;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrderDetail.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrderDetail.java
new file mode 100644
index 0000000..319683f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/repo/model/ScOrderDetail.java
@@ -0,0 +1,244 @@
+package cn.xluobo.business.sc.order.repo.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * 订单详情
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Data
+@Builder
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sc_order_detail")
+public class ScOrderDetail implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 详单编号
+ */
+ @TableId(value = "order_detail_id", type = IdType.ASSIGN_ID)
+ private Long orderDetailId;
+
+ /**
+ * 订单编号
+ */
+ @TableField("order_id")
+ private Long orderId;
+
+ /**
+ * 课程
+ */
+ @TableField("course_id")
+ private Long courseId;
+
+ /**
+ * 课程
+ */
+ @TableField("course_name")
+ private String courseName;
+
+ /**
+ * 班级
+ */
+ @TableField("cla_id")
+ private Long claId;
+
+ /**
+ * 班级
+ */
+ @TableField("cla_name")
+ private String claName;
+
+ /**
+ * 校区
+ */
+ @TableField("dept_id")
+ private Long deptId;
+
+ /**
+ * 校区
+ */
+ @TableField("dept_name")
+ private String deptName;
+
+ /**
+ * 类型 1新报 2续报 3扩科
+ */
+ @TableField("detail_tag")
+ private String detailTag;
+
+ /**
+ * 收费方式名称
+ */
+ @TableField("charge_name")
+ private String chargeName;
+
+ /**
+ * 收费模式
+ */
+ @TableField("charge_type")
+ private String chargeType;
+
+ /**
+ * 收费方式包含课时数量
+ */
+ @TableField("charge_count")
+ private BigDecimal chargeCount;
+
+ /**
+ * 收费方式金额
+ */
+ @TableField("charge_fee")
+ private BigDecimal chargeFee;
+
+ /**
+ * 时间周期
+ */
+ @TableField("date_unit")
+ private String dateUnit;
+
+ /**
+ * 购买数量
+ */
+ @TableField("buy_count")
+ private BigDecimal buyCount;
+
+ /**
+ * 原价 buy_count*charge_fee
+ */
+ @TableField("original_fee")
+ private BigDecimal originalFee;
+
+ /**
+ * 生效时间
+ */
+ @TableField("begin_date")
+ private String beginDate;
+
+ /**
+ * 失效时间
+ */
+ @TableField("end_date")
+ private String endDate;
+
+ /**
+ * 过期时间
+ */
+ @TableField("expire_date")
+ private String expireDate;
+
+ /**
+ * 优惠编号
+ */
+ @TableField("discount_id")
+ private Long discountId;
+
+ /**
+ * 活动名称
+ */
+ @TableField("activity_name")
+ private String activityName;
+
+ /**
+ * 折扣类型
+ */
+ @TableField("discount_type")
+ private String discountType;
+
+ /**
+ * 优惠明细编号
+ */
+ @TableField("discount_detail_id")
+ private Long discountDetailId;
+
+ /**
+ * 满足条件 金额/课时
+ */
+ @TableField("meet_condition")
+ private BigDecimal meetCondition;
+
+ /**
+ * 赠送 金额/折扣/课时
+ */
+ @TableField("gift")
+ private BigDecimal gift;
+
+ /**
+ * 直接折扣
+ */
+ @TableField("direct_discount")
+ private BigDecimal directDiscount;
+
+ /**
+ * 直接减免金额
+ */
+ @TableField("direct_reduce_fee")
+ private BigDecimal directReduceFee;
+
+ /**
+ * 实际价格 original_fee-满减-直接减免
+ */
+ @TableField("actual_fee")
+ private BigDecimal actualFee;
+
+ /**
+ * 内部备注
+ */
+ @TableField("inside_memo")
+ private String insideMemo;
+
+ /**
+ * 外部订单备注
+ */
+ @TableField("outside_memo")
+ private String outsideMemo;
+
+ /**
+ * 订单状态 1待支付 2已支付 3已作废
+ */
+ @TableField("order_detail_status")
+ private String orderDetailStatus;
+
+ /**
+ * 创建者
+ */
+ @TableField("create_user")
+ private Long createUser;
+
+ /**
+ * 创建时间
+ */
+ @TableField("create_time")
+ private Date createTime;
+
+ /**
+ * 更新者
+ */
+ @TableField("last_update_user")
+ private Long lastUpdateUser;
+
+ /**
+ * 更新时间
+ */
+ @TableField("last_update_time")
+ private Date lastUpdateTime;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/BusinessScOrderService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/BusinessScOrderService.java
new file mode 100644
index 0000000..33f557e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/BusinessScOrderService.java
@@ -0,0 +1,757 @@
+package cn.xluobo.business.sc.order.service;
+
+import cn.xluobo.business.sc.course.enums.CourseChargeTypeEnum;
+import cn.xluobo.business.sc.course.repo.model.ScCourse;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCharge;
+import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
+import cn.xluobo.business.sc.course.service.IScClaTimeAttendService;
+import cn.xluobo.business.sc.course.service.IScCourseChargeService;
+import cn.xluobo.business.sc.course.service.IScCourseClaService;
+import cn.xluobo.business.sc.course.service.IScCourseService;
+import cn.xluobo.business.sc.log.enums.LogTypeEnum;
+import cn.xluobo.business.sc.log.repo.model.ScStudentCourseLog;
+import cn.xluobo.business.sc.log.service.IScStudentCourseLogService;
+import cn.xluobo.business.sc.order.domain.req.ReqBusinessSignUp;
+import cn.xluobo.business.sc.order.domain.req.ReqBusinessSignUpItem;
+import cn.xluobo.business.sc.order.domain.req.ReqBusinessSignUpReceipt;
+import cn.xluobo.business.sc.order.domain.req.ReqSearchScOrder;
+import cn.xluobo.business.sc.order.domain.resp.RespOrder;
+import cn.xluobo.business.sc.order.enums.OrderStatusEnum;
+import cn.xluobo.business.sc.order.repo.mapper.ScOrderMapper;
+import cn.xluobo.business.sc.order.repo.model.ScOrder;
+import cn.xluobo.business.sc.order.repo.model.ScOrderAccount;
+import cn.xluobo.business.sc.order.repo.model.ScOrderDetail;
+import cn.xluobo.business.sc.student.repo.model.ScStudent;
+import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
+import cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder;
+import cn.xluobo.business.sc.student.service.IScStudentAccountService;
+import cn.xluobo.business.sc.student.service.IScStudentCourseOrderService;
+import cn.xluobo.business.sc.student.service.IScStudentCourseService;
+import cn.xluobo.business.sc.student.service.IScStudentService;
+import cn.xluobo.business.sys.admin.service.ISysDeptService;
+import cn.xluobo.business.sys.admin.service.ISysUserService;
+import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount;
+import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService;
+import cn.xluobo.business.sys.staff.repo.model.SysStaff;
+import cn.xluobo.business.sys.staff.service.ISysStaffService;
+import cn.xluobo.business.sys.tag.service.ISysTagService;
+import cn.xluobo.config.exception.BusinessException;
+import cn.xluobo.core.api.APIBaseResponse;
+import cn.xluobo.core.api.APIResponse;
+import cn.xluobo.core.api.ApiResEnums;
+import cn.xluobo.core.page.RespPage;
+import cn.xluobo.core.utils.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.google.common.collect.Maps;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.joda.time.DateTime;
+import org.joda.time.Period;
+import org.joda.time.PeriodType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author :zhangbaoyu
+ * @date :Created in 2020-01-14 17:24
+ */
+@Service
+@Transactional
+@Slf4j
+public class BusinessScOrderService {
+
+ @Autowired
+ private IScOrderService scOrderService;
+ @Autowired
+ private IScOrderDetailService orderDetailService;
+ @Autowired
+ private ISysReceiptAccountService receiptAccountService;
+ @Autowired
+ private IScOrderAccountService orderAccountService;
+ @Autowired
+ private IScStudentCourseService studentCourseService;
+ @Autowired
+ private IScStudentCourseOrderService courseOrderService;
+ @Autowired
+ private IScCourseService scCourseService;
+ @Autowired
+ private IScCourseClaService courseClaService;
+ @Autowired
+ private IScCourseChargeService courseChargeService;
+ @Autowired
+ private IScStudentService studentService;
+ @Autowired
+ private ISysDeptService deptService;
+ @Autowired
+ private IScStudentAccountService studentAccountService;
+ @Autowired
+ private ISysTagService tagService;
+ @Autowired
+ private ScOrderMapper orderMapper;
+ @Autowired
+ private ISysStaffService staffService;
+ @Autowired
+ private ISysUserService userService;
+ @Autowired
+ private IScClaTimeAttendService claTimeAttendService;
+ @Autowired
+ private IScStudentCourseLogService scStudentCourseLogService;
+
+ /**
+ * 查询
+ *
+ * @param reqSearchScOrder
+ * @return
+ */
+ public APIResponse searchList(ReqSearchScOrder reqSearchScOrder) {
+ RespPage page = new RespPage<>(reqSearchScOrder.getPageNum(), reqSearchScOrder.getPageSize());
+ List orderList = orderMapper.selectFroSearchTable(reqSearchScOrder, page);
+ page.setRows(orderList);
+ return APIResponse.toAPIResponse(page);
+ }
+
+ /**
+ * 详情
+ *
+ * @param orderId
+ * @return
+ */
+ public APIResponse detailById(Long orderId) {
+ if (null == orderId) {
+ return APIResponse.toAPIResponse(null);
+ }
+ Map detailMap = Maps.newHashMap();
+
+ // 订单信息
+ ScOrder order = scOrderService.getById(orderId);
+ // 经办人姓名
+ if (null != order.getCreateUser()) {
+ SysUser user = userService.getById(order.getCreateUser());
+ order.setHandleStaffName(user.getUserName());
+ }
+ detailMap.put("orderInfo", order);
+
+ // 订单明细
+ List orderDetail = orderDetailService.getByOrderDetail(orderId);
+ detailMap.put("orderDetail", orderDetail);
+
+ // 收款账户
+ List orderAccountList = orderAccountService.getOrderAccountList(orderId);
+ detailMap.put("orderAccountList", orderAccountList);
+
+ return APIResponse.toAPIResponse(detailMap);
+ }
+
+ /**
+ * 新办
+ *
+ * @param reqBusinessSignUp
+ * @return
+ */
+ public APIResponse signUp(ReqBusinessSignUp reqBusinessSignUp) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ APIResponse checkParam = reqBusinessSignUp.checkParam();
+ if (!checkParam.isSuccess()) {
+ return checkParam;
+ }
+ Long studentId = reqBusinessSignUp.getStudentId();
+ Long handleDepartId = reqBusinessSignUp.getHandleDepartId();
+
+ ScStudent student = studentService.getById(studentId);
+ if (null == student) {
+ return APIResponse.toExceptionResponse("无法获取学生信息,请重试!");
+ }
+ SysDept handleDept = deptService.getById(handleDepartId);
+ if (null == handleDept) {
+ return APIResponse.toExceptionResponse("无法获取经办校区信息,请重试!");
+ }
+
+ BigDecimal reqReceiptWaySumMoney = reqBusinessSignUp.getReceiptWaySumMoney();
+ List signUpReceiptList = reqBusinessSignUp.getSignUpReceiptList();
+ List signUpItemList = reqBusinessSignUp.getSignUpItemList();
+ for (ReqBusinessSignUpItem signUpItem : signUpItemList) {
+ // 校验学生是否可报读 课程
+ APIBaseResponse studentCanSignUpCourse = studentCourseService.checkStudentCanSignUpCourse(studentId, signUpItem.getCourseId(), signUpItem.getDepartId(), null);
+ if (!studentCanSignUpCourse.isSuccess()) {
+ return APIResponse.toExceptionResponse(studentCanSignUpCourse.getRespMsg());
+ }
+ }
+
+ // 原价
+ BigDecimal originalTotalFee = BigDecimal.ZERO;
+ // 实际价格
+ BigDecimal actualTotalFee = BigDecimal.ZERO;
+ // 应收
+ BigDecimal needReceiptFee = BigDecimal.ZERO;
+ // 实收
+ BigDecimal receiptWaySumMoney = BigDecimal.ZERO;
+
+ // 计算实收
+ for (ReqBusinessSignUpReceipt signUpReceipt : signUpReceiptList) {
+ receiptWaySumMoney = receiptWaySumMoney.add(signUpReceipt.getReceiptMoney());
+ }
+ if (reqReceiptWaySumMoney.compareTo(receiptWaySumMoney) != 0) {
+ return APIResponse.toExceptionResponse("实收金额不一致,请重试");
+ }
+
+ // 课程信息、收费模式缓存
+ Map courseCacheMap = Maps.newHashMap();
+ Map chargeCacheMap = Maps.newHashMap();
+
+ // 计算原价 实际价格 应收
+ for (ReqBusinessSignUpItem signUpItem : signUpItemList) {
+ Long courseId = signUpItem.getCourseId();
+ Long chargeId = signUpItem.getChargeId();
+ boolean openDiscount = signUpItem.isOpenDiscount();
+ boolean openDiscountFee = signUpItem.isOpenDiscountFee();
+ ScCourse scCourse = scCourseService.getById(courseId);
+ ScCourseCharge courseCharge = courseChargeService.getById(chargeId);
+ if (!signUpItem.getChargeType().equals(courseCharge.getChargeType())) {
+ throw new BusinessException(scCourse.getCourseName() + "收费方式不一致,请重试");
+ }
+
+ courseCacheMap.put(courseId, scCourse);
+ chargeCacheMap.put(chargeId, courseCharge);
+
+ Integer buyCount = signUpItem.getBuyCount();
+ BigDecimal chargeTotalFee = courseCharge.getTotalFee();
+ BigDecimal courseOriginalTotalFee = chargeTotalFee.multiply(new BigDecimal(buyCount));
+ BigDecimal courseActualTotalFee = courseOriginalTotalFee;
+
+ // 折扣
+ if (openDiscount) {
+ // 实际价格= 实际价格 * 折扣(9.8/10)
+ courseActualTotalFee = courseActualTotalFee.multiply(signUpItem.getDiscount()).divide(new BigDecimal(10));
+ }
+ // 优惠金额
+ if (openDiscountFee) {
+ courseActualTotalFee = courseActualTotalFee.subtract(signUpItem.getDiscountFee());
+ }
+
+ // 原价
+ originalTotalFee = originalTotalFee.add(courseOriginalTotalFee);
+ actualTotalFee = actualTotalFee.add(courseActualTotalFee);
+ }
+ // 实收 = 应收 - 余额支付
+ needReceiptFee = actualTotalFee.subtract(reqBusinessSignUp.getBalancePayValue());
+ if (needReceiptFee.compareTo(reqBusinessSignUp.getNeedReceiptFee()) != 0) {
+ throw new BusinessException("应收金额不一致,请重试");
+ }
+
+ // 入 sc_order 表
+ Long orderId = null;
+ {
+ ScOrder order = ScOrder.builder()
+ .studentId(studentId)
+ .studentName(student.getStudentName())
+ .phone(student.getPhone())
+ .orderType("1")
+ .originalTotalFee(originalTotalFee)
+ .actualTotalFee(actualTotalFee)
+ .receiptFee(receiptWaySumMoney)
+ .balanceFee(reqBusinessSignUp.getBalancePayValue())
+ .orderStatus(OrderStatusEnum.HAD_PAY.getOrderStatus())
+ .memo(reqBusinessSignUp.getMemo())
+ .handleDeptId(handleDept.getDeptId())
+ .handleDeptName(handleDept.getDeptName())
+ .handleDate(reqBusinessSignUp.getHandleDate())
+ .createUser(loginUser.getUserId())
+ .lastUpdateUser(loginUser.getUserId())
+ .build();
+
+ if (null != reqBusinessSignUp.getOrderTag()) {
+ order.setOrderTag(String.join(",", reqBusinessSignUp.getOrderTag()));
+ }
+ if (null != reqBusinessSignUp.getSaleSourceTag()) {
+ order.setSaleSourceTag(String.join(",", reqBusinessSignUp.getSaleSourceTag()));
+ }
+ if (null != reqBusinessSignUp.getSaleStaffId()) {
+ SysStaff saleStaff = staffService.getById(reqBusinessSignUp.getSaleStaffId());
+ if (null == saleStaff) {
+ throw new BusinessException("无法获取销售员工信息");
+ }
+ order.setSaleStaffId(saleStaff.getStaffId());
+ order.setSaleStaffName(saleStaff.getStaffName());
+ }
+
+ scOrderService.save(order);
+ orderId = order.getOrderId();
+ log.info("save order success,orderId={}", orderId);
+
+ if (null != reqBusinessSignUp.getOrderTag()) {
+ tagService.autoCreateTag(reqBusinessSignUp.getOrderTag(), "2", loginUser.getNowTenantId(), loginUser.getUserId());
+ }
+ if (null != reqBusinessSignUp.getSaleSourceTag()) {
+ tagService.autoCreateTag(reqBusinessSignUp.getSaleSourceTag(), "1", loginUser.getNowTenantId(), loginUser.getUserId());
+ }
+ }
+
+ // 入sc_order_account
+ for (ReqBusinessSignUpReceipt signUpReceipt : signUpReceiptList) {
+ SysReceiptAccount receiptAccount = receiptAccountService.getById(signUpReceipt.getAccountId());
+ if (null == receiptAccount) {
+ throw new BusinessException("无发获取收款账户,请核查后重试!");
+ }
+ ScOrderAccount orderAccount = new ScOrderAccount();
+ orderAccount.setOrderId(orderId);
+ orderAccount.setAccountId(signUpReceipt.getAccountId());
+ orderAccount.setAccountName(receiptAccount.getAccountName());
+ orderAccount.setFee(signUpReceipt.getReceiptMoney());
+ orderAccountService.save(orderAccount);
+ }
+
+ // 报读课程
+ for (ReqBusinessSignUpItem signUpItem : signUpItemList) {
+ Long courseId = signUpItem.getCourseId();
+ Long departId = signUpItem.getDepartId();
+ Long claId = signUpItem.getClaId();
+ Long chargeId = signUpItem.getChargeId();
+ boolean openDiscount = signUpItem.isOpenDiscount();
+ boolean openDiscountFee = signUpItem.isOpenDiscountFee();
+ ScCourse scCourse = courseCacheMap.get(courseId);
+ ScCourseCla scCourseCla = new ScCourseCla();
+ if (null != claId) {
+ scCourseCla = courseClaService.getById(claId);
+ if (null == scCourseCla) {
+ throw new BusinessException("无法获取" + scCourse.getCourseName() + "对应的班级,请重试");
+ }
+ }
+ ScCourseCharge courseCharge = chargeCacheMap.get(chargeId);
+ if (!signUpItem.getChargeType().equals(courseCharge.getChargeType())) {
+ throw new BusinessException(scCourse.getCourseName() + "收费方式不一致,请重试");
+ }
+
+ Integer buyCount = signUpItem.getBuyCount();
+ BigDecimal chargeTotalFee = courseCharge.getTotalFee();
+ BigDecimal courseOriginalTotalFee = chargeTotalFee.multiply(new BigDecimal(buyCount));
+ BigDecimal courseActualTotalFee = courseOriginalTotalFee;
+
+ // 折扣
+ if (openDiscount) {
+ // 实际价格= 实际价格 * 折扣(9.8/10)
+ courseActualTotalFee = courseActualTotalFee.multiply(signUpItem.getDiscount()).divide(new BigDecimal(10));
+ }
+ // 优惠金额
+ if (openDiscountFee) {
+ courseActualTotalFee = courseActualTotalFee.subtract(signUpItem.getDiscountFee());
+ }
+
+ // 已报读本课程信息
+ ScStudentCourse dbStudentCourse = studentCourseService.selectByStudentIdCourseId(studentId, courseId);
+
+ BigDecimal addedHour = BigDecimal.ZERO;
+ int addedDays = 0;
+
+ if (CourseChargeTypeEnum.HOUR.getChargeType().equals(courseCharge.getChargeType())) {
+ // 新增课时
+ addedHour = courseCharge.getCount().multiply(new BigDecimal(buyCount));
+ } else if (CourseChargeTypeEnum.DATE.getChargeType().equals(courseCharge.getChargeType())) {
+ // 校验报读时间段是否重复
+ boolean checkDateCover = courseOrderService.checkDateCover(studentId, courseId, signUpItem.getBeginDate(), signUpItem.getEndDate());
+ if (checkDateCover) {
+ throw new BusinessException(scCourse.getCourseName() + "报读日期存在覆盖,请重新选择报读日期范围!");
+ }
+ // 新增天数
+ DateTime beginDate = DateUtil.yyyMMddDayBegin(signUpItem.getBeginDate());
+ DateTime endDate = DateUtil.yyyMMddDayBegin(signUpItem.getEndDate());
+ Period period = new Period(beginDate, endDate, PeriodType.days());
+ addedDays = period.getDays() + 1;
+ } else if (CourseChargeTypeEnum.CYCLE.getChargeType().equals(courseCharge.getChargeType())) {
+ // 新增课时
+ addedHour = courseCharge.getCount().multiply(new BigDecimal(buyCount));
+ }
+
+ // 插入 sc_order_detail
+ Long orderDetailId = null;
+ {
+ SysDept dept = deptService.getById(departId);
+ ScOrderDetail orderDetail = ScOrderDetail.builder()
+ .orderId(orderId)
+ .courseId(courseId)
+ .courseName(scCourse.getCourseName())
+ .claId(claId)
+ .claName(scCourseCla.getClaName())
+ .deptId(dept.getDeptId())
+ .deptName(dept.getDeptName())
+ .detailTag(signUpItem.getDetailTag())
+ .chargeName(courseCharge.getChargeName())
+ .chargeType(courseCharge.getChargeType())
+ .chargeCount(courseCharge.getCount())
+ .chargeFee(courseCharge.getTotalFee())
+ .dateUnit(courseCharge.getDateUnit())
+ .buyCount(new BigDecimal(buyCount))
+ .originalFee(courseOriginalTotalFee)
+ .actualFee(courseActualTotalFee)
+ .insideMemo(signUpItem.getInsideMemo())
+ .outsideMemo(signUpItem.getOutsideMemo())
+ .orderDetailStatus(OrderStatusEnum.HAD_PAY.getOrderStatus())
+ .createUser(loginUser.getUserId())
+ .lastUpdateUser(loginUser.getUserId())
+ .build();
+ if (openDiscount) {
+ orderDetail.setDirectDiscount(signUpItem.getDiscount());
+ }
+ if (openDiscountFee) {
+ orderDetail.setDirectReduceFee(signUpItem.getDiscountFee());
+ }
+ if (signUpItem.isOpenExpire()) {
+ orderDetail.setExpireDate(signUpItem.getExpireDate());
+ }
+ if (CourseChargeTypeEnum.DATE.getChargeType().equals(courseCharge.getChargeType())) {
+ orderDetail.setBeginDate(signUpItem.getBeginDate());
+ orderDetail.setEndDate(signUpItem.getEndDate());
+ }
+ orderDetailService.save(orderDetail);
+ orderDetailId = orderDetail.getOrderDetailId();
+ }
+
+ // 插入/更新 sc_student_course表
+ Long studentCourseId = null;
+ {
+ // db中包含
+ if (null != dbStudentCourse) {
+ UpdateWrapper uw = new UpdateWrapper<>();
+ uw.eq("student_course_id", dbStudentCourse.getStudentCourseId());
+ uw.eq("total_fee", dbStudentCourse.getTotalFee());
+
+ if (CourseChargeTypeEnum.HOUR.getChargeType().equals(courseCharge.getChargeType())) {
+ uw.eq("balance_hour", dbStudentCourse.getBalanceHour());
+ uw.eq("total_hour", dbStudentCourse.getTotalHour());
+ uw.set("balance_hour", dbStudentCourse.getBalanceHour().add(addedHour));
+ uw.set("total_hour", dbStudentCourse.getTotalHour().add(addedHour));
+ } else if (CourseChargeTypeEnum.DATE.getChargeType().equals(courseCharge.getChargeType())) {
+ uw.eq("total_day", dbStudentCourse.getTotalDay());
+ uw.set("total_day", dbStudentCourse.getTotalDay().add(new BigDecimal(addedDays)));
+ } else if (CourseChargeTypeEnum.CYCLE.getChargeType().equals(courseCharge.getChargeType())) {
+ uw.eq("balance_hour", dbStudentCourse.getBalanceHour());
+ uw.eq("total_hour", dbStudentCourse.getTotalHour());
+ uw.set("balance_hour", dbStudentCourse.getBalanceHour().add(addedHour));
+ uw.set("total_hour", dbStudentCourse.getTotalHour().add(addedHour));
+ }
+ uw.set("total_fee", dbStudentCourse.getTotalFee().add(courseActualTotalFee));
+ uw.set("last_update_user", loginUser.getUserId());
+ uw.set("last_update_time", new Date());
+
+ boolean update = studentCourseService.update(uw);
+ if (!update) {
+ throw new BusinessException("学员新增课时失败,请稍后重试");
+ }
+ studentCourseId = dbStudentCourse.getStudentCourseId();
+ } else {
+ ScStudentCourse addStudentCourse = new ScStudentCourse();
+ addStudentCourse.setStudentId(studentId);
+ addStudentCourse.setCourseId(courseId);
+ addStudentCourse.setCourseName(scCourse.getCourseName());
+ addStudentCourse.setDeptId(departId);
+ if (null != claId) {
+ addStudentCourse.setClaId(scCourseCla.getClaId());
+ addStudentCourse.setClaName(scCourseCla.getClaName());
+ }
+ addStudentCourse.setChargeType(courseCharge.getChargeType());
+ if (CourseChargeTypeEnum.HOUR.getChargeType().equals(courseCharge.getChargeType())) {
+ addStudentCourse.setTotalHour(addedHour);
+ addStudentCourse.setBalanceHour(addedHour);
+ } else if (CourseChargeTypeEnum.DATE.getChargeType().equals(courseCharge.getChargeType())) {
+ addStudentCourse.setTotalDay(new BigDecimal(addedDays));
+ } else if (CourseChargeTypeEnum.CYCLE.getChargeType().equals(courseCharge.getChargeType())) {
+ addStudentCourse.setTotalHour(addedHour);
+ addStudentCourse.setBalanceHour(addedHour);
+ }
+ addStudentCourse.setTotalFee(courseActualTotalFee);
+ addStudentCourse.setStatus("1");
+ addStudentCourse.setCreateUser(loginUser.getUserId());
+ addStudentCourse.setLastUpdateUser(loginUser.getUserId());
+ studentCourseService.save(addStudentCourse);
+ studentCourseId = addStudentCourse.getStudentCourseId();
+ }
+ }
+
+ // 插入sc_student_course_order
+ {
+ ScStudentCourseOrder studentCourseOrder = ScStudentCourseOrder.builder()
+ .studentCourseId(studentCourseId)
+ .orderId(orderId)
+ .orderDetailId(orderDetailId)
+ .totalHour(addedHour)
+ .balanceHour(addedHour)
+ .totalDay(new BigDecimal(addedDays))
+ .totalFee(courseActualTotalFee)
+ .createUser(loginUser.getUserId())
+ .lastUpdateUser(loginUser.getUserId())
+ .build();
+ if (signUpItem.isOpenExpire()) {
+ studentCourseOrder.setExpireDate(signUpItem.getExpireDate());
+ }
+ if (CourseChargeTypeEnum.DATE.getChargeType().equals(courseCharge.getChargeType())) {
+ studentCourseOrder.setBeginDate(signUpItem.getBeginDate());
+ studentCourseOrder.setEndDate(signUpItem.getEndDate());
+
+ // 单价 = 总价/天
+ studentCourseOrder.setUnitFee(courseActualTotalFee.divide(new BigDecimal(addedDays), 2, BigDecimal.ROUND_HALF_UP));
+ } else {
+ // 单价 = 总价/课时数
+ studentCourseOrder.setUnitFee(courseActualTotalFee.divide(addedHour, 2, BigDecimal.ROUND_HALF_UP));
+ }
+ courseOrderService.save(studentCourseOrder);
+ }
+
+ // 学生报读 日志
+ StringBuffer sb = new StringBuffer("");
+ if ("1".equals(signUpItem.getDetailTag())) {
+ sb.append("新报,");
+ } else if ("2".equals(signUpItem.getDetailTag())) {
+ sb.append("续报,");
+ }
+ sb.append("课程'").append(scCourse.getCourseName()).append("',");
+ sb.append("金额").append(courseActualTotalFee.toString()).append("元,");
+ ScStudentCourseLog studentCourseLog = ScStudentCourseLog.builder()
+ .studentId(studentId)
+ .logType(LogTypeEnum.PAY_FEE.getLogType())
+ .courseId(courseId)
+ .courseName(scCourse.getCourseName())
+ .claId(claId)
+ .claName(scCourseCla.getClaName())
+ .deptName(handleDept.getDeptName())
+ .changeFee(courseActualTotalFee)
+ .createUser(loginUser.getUserId())
+ .createUserName(loginUser.getUsername())
+ .createTime(new Date())
+ .build();
+ if (CourseChargeTypeEnum.DATE.getChargeType().equals(courseCharge.getChargeType())) {
+ sb.append("增加'").append(addedDays).append("'天");
+ sb.append("(").append(signUpItem.getBeginDate()).append("~").append(signUpItem.getEndDate()).append(").");
+ } else {
+ sb.append("增加'").append(addedHour.toString()).append("'课时,");
+ studentCourseLog.setChangeHour(addedHour);
+ // 增加后剩余
+ if (null != dbStudentCourse) {
+ studentCourseLog.setAfterBalanceHour(dbStudentCourse.getBalanceHour().add(addedHour));
+ sb.append("增加后剩余").append(dbStudentCourse.getBalanceHour().add(addedHour).toString()).append("'课时").append(".");
+ } else {
+ studentCourseLog.setAfterBalanceHour(addedHour);
+ sb.append("增加后剩余").append(addedHour.toString()).append("'课时").append(".");
+ }
+ }
+ studentCourseLog.setMemo(sb.toString());
+ scStudentCourseLogService.save(studentCourseLog);
+ }
+
+ // 实收 > 应收, 增加 学生账户余额
+ if (receiptWaySumMoney.compareTo(needReceiptFee) > 0) {
+ BigDecimal addBalanceFee = receiptWaySumMoney.subtract(needReceiptFee);
+ studentAccountService.addBalance(studentId, addBalanceFee, loginUser.getUserId());
+ }
+
+ return APIResponse.toOkResponse();
+ }
+
+ /**
+ * 作废订单
+ *
+ * @param orderIds
+ * @return
+ */
+ public APIResponse invalidById(Long[] orderIds) {
+ if (null == orderIds || orderIds.length == 0) {
+ return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
+ }
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+
+ Integer dealSuccessCnt = 0;
+ Integer dealFailCnt = 0;
+ StringBuffer errorSb = new StringBuffer();
+
+ for (Long orderId : orderIds) {
+ ScOrder order = scOrderService.getById(orderId);
+ if (null == order) {
+ errorSb.append("订单'").append(orderId).append("',");
+ errorSb.append("无法获取订单信息,请稍后重试;");
+ dealFailCnt++;
+ continue;
+ }
+ if (OrderStatusEnum.INVALID.getOrderStatus().equals(order.getOrderStatus())) {
+ errorSb.append("订单'").append(orderId).append("',");
+ errorSb.append("该订单已作废,无法再次作废;");
+ dealFailCnt++;
+ continue;
+ }
+
+ // 所有未作废的订单明细
+ List orderDetailList = orderDetailService.getByOrderDetail(orderId, new String[]{OrderStatusEnum.INVALID.getOrderStatus()});
+
+ // 订单明细map
+ Map orderDetailMap = Maps.newHashMap();
+ for (ScOrderDetail orderDetail : orderDetailList) {
+ orderDetailMap.put(orderDetail.getOrderDetailId(), orderDetail);
+ }
+
+ // 所有关联的课程订单
+ List orderDetailIdList = orderDetailList.stream().map(ScOrderDetail::getOrderDetailId).collect(Collectors.toList());
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.eq("order_id", orderId);
+ qw.in("order_detail_id", orderDetailIdList);
+ List courseOrderList = courseOrderService.list(qw);
+
+ // 校验 如果消耗课时 不允许作废
+ for (ScStudentCourseOrder courseOrder : courseOrderList) {
+ ScOrderDetail orderDetail = orderDetailMap.get(courseOrder.getOrderDetailId());
+ if (CourseChargeTypeEnum.DATE.getChargeType().equals(orderDetail.getChargeType())) {
+ String beginDate = courseOrder.getBeginDate();
+ String endDate = courseOrder.getEndDate();
+ Long studentCourseId = courseOrder.getStudentCourseId();
+ int studentCourseAttendCount = claTimeAttendService.studentCourseAttendCount(studentCourseId, beginDate, endDate);
+ if (0 != studentCourseAttendCount) {
+ // 订单日期范围内 有上课记录,不允许作废
+ ScStudentCourse studentCourse = studentCourseService.getById(studentCourseId);
+ ScCourse scCourse = scCourseService.getById(studentCourse.getCourseId());
+ errorSb.append("订单'").append(order.getOrderId()).append("',");
+ errorSb.append(scCourse.getCourseName()).append(",在").append(beginDate).append("~").append(endDate).append(",有上课记录(").append(studentCourseAttendCount).append("次),无发作废;");
+ dealFailCnt++;
+ continue;
+ }
+ } else {
+ if (null != courseOrder.getBalanceHour() && courseOrder.getBalanceHour().compareTo(courseOrder.getTotalHour()) < 0) {
+ // 按课时收费 并且 剩余课时<总课时 已消耗,不允许作废
+ ScStudentCourse studentCourse = studentCourseService.getById(courseOrder.getStudentCourseId());
+ ScCourse scCourse = scCourseService.getById(studentCourse.getCourseId());
+ errorSb.append("订单:").append(order.getOrderId()).append(",");
+ errorSb.append(scCourse.getCourseName()).append(",已消耗课时,无法作废;");
+ dealFailCnt++;
+ continue;
+ } else if (null != courseOrder.getBalanceHour() && courseOrder.getBalanceHour().compareTo(courseOrder.getTotalHour()) > 0) {
+ // 按课时收费 并且 剩余课时>总课时 删除上课记录 恢复课时后,剩余课时>总课时,不允许作废
+ ScStudentCourse studentCourse = studentCourseService.getById(courseOrder.getStudentCourseId());
+ ScCourse scCourse = scCourseService.getById(studentCourse.getCourseId());
+ errorSb.append("订单:").append(order.getOrderId()).append(",");
+ errorSb.append(scCourse.getCourseName()).append(",剩余课时大于总课时,无法作废");
+ dealFailCnt++;
+ continue;
+ }
+ }
+ dealSuccessCnt++;
+ }
+
+ if(dealFailCnt != 0) {
+ return APIResponse.toExceptionResponse("操作失败,成功:" + dealSuccessCnt + ",失败:" + dealFailCnt + ",原因如下:" + errorSb.toString());
+ }
+
+ // 订单作废、订单明细作废
+ scOrderService.invalidOrder(orderId);
+ orderDetailService.invalidOrder(orderId, orderDetailIdList);
+
+ // 课程订单 失效、 剩余课时、时间 作废
+ for (ScStudentCourseOrder courseOrder : courseOrderList) {
+ // 课程订单 失效
+ UpdateWrapper uw = new UpdateWrapper<>();
+ uw.eq("course_order_id", courseOrder.getCourseOrderId());
+ uw.set("valid", false);
+ courseOrderService.update(uw);
+
+ // 学生课程信息
+ ScStudentCourse studentCourse = studentCourseService.getById(courseOrder.getStudentCourseId());
+
+ ScOrderDetail orderDetail = orderDetailMap.get(courseOrder.getOrderDetailId());
+ // 收费方式
+ String chargeType = orderDetail.getChargeType();
+ // 实际价格
+ BigDecimal actualFee = orderDetail.getActualFee();
+
+ Long studentCourseId = courseOrder.getStudentCourseId();
+ BigDecimal totalDay = courseOrder.getTotalDay();
+ BigDecimal totalHour = courseOrder.getTotalHour();
+
+ // 学生日志
+ StringBuffer sb = new StringBuffer("作废订单,");
+ ScStudentCourseLog studentCourseLog = ScStudentCourseLog.builder()
+ .studentId(order.getStudentId())
+ .logType(LogTypeEnum.INVALID_ORDER.getLogType())
+ .courseId(orderDetail.getCourseId())
+ .courseName(orderDetail.getCourseName())
+ .claId(orderDetail.getClaId())
+ .claName(orderDetail.getClaName())
+ .deptName(orderDetail.getDeptName())
+ .changeFee(actualFee.negate())
+ .createUser(loginUser.getUserId())
+ .createUserName(loginUser.getUsername())
+ .createTime(new Date())
+ .build();
+
+ if (CourseChargeTypeEnum.DATE.getChargeType().equals(chargeType)) {
+
+ // 总天数 = 总天数 - 作废天数
+ // 总学费 = 总学费 - 作废学费
+ UpdateWrapper uwStudentCourse = new UpdateWrapper<>();
+ uwStudentCourse
+ .eq("student_course_id", studentCourseId)
+ .eq("total_day", studentCourse.getTotalDay())
+ .eq("total_fee", studentCourse.getTotalFee())
+ .eq("charge_type", "date")
+ .set("total_day", studentCourse.getTotalDay().subtract(totalDay))
+ .set("total_fee", studentCourse.getTotalFee().subtract(actualFee))
+ .set("last_update_user", loginUser.getUserId())
+ .set("last_update_time", new Date());
+ boolean update = studentCourseService.update(uwStudentCourse);
+ if (!update) {
+ throw new BusinessException("学员报读恢复失败,请重试!");
+ }
+
+ // 当总天数、总费用为0时,删除报读
+ studentCourseService.deleteWhenTotalDayZeroForInvalid(studentCourseId);
+
+ sb.append("作废").append(totalDay.toString()).append("天,")
+ .append(actualFee.toString()).append("元");
+ } else {
+
+ // 剩余课时 = 剩余课时 - 作废课时
+ // 总学费 = 总学费 - 作废学费
+ UpdateWrapper uwStudentCourse = new UpdateWrapper<>();
+ uwStudentCourse
+ .eq("student_course_id", studentCourseId)
+ .eq("total_hour", studentCourse.getTotalHour())
+ .eq("balance_hour", studentCourse.getBalanceHour())
+ .eq("total_fee", studentCourse.getTotalFee())
+ .ne("charge_type", "date")
+ .set("total_hour", studentCourse.getTotalHour().subtract(totalHour))
+ .set("balance_hour", studentCourse.getBalanceHour().subtract(totalHour))
+ .set("total_fee", studentCourse.getTotalFee().subtract(actualFee))
+ .set("last_update_user", loginUser.getUserId())
+ .set("last_update_time", new Date());
+ boolean update = studentCourseService.update(uwStudentCourse);
+ if (!update) {
+ throw new BusinessException("学员报读恢复失败,请重试!");
+ }
+
+ // 当总课时、总费用为0时,删除报读
+ studentCourseService.deleteWhenTotalHourZeroForInvalid(studentCourseId);
+
+ studentCourseLog.setChangeHour(totalHour.negate());
+ studentCourseLog.setAfterBalanceHour(studentCourse.getBalanceHour().subtract(totalHour));
+ sb.append("作废").append(totalHour.toString()).append("课时,")
+ .append(actualFee.toString()).append("元");
+ }
+ studentCourseLog.setMemo(sb.toString());
+ scStudentCourseLogService.save(studentCourseLog);
+ }
+ }
+
+ if (dealFailCnt == 0) {
+ return APIResponse.toOkResponse();
+ } else {
+ return APIResponse.toExceptionResponse("操作失败,成功:" + dealSuccessCnt + ",失败:" + dealFailCnt + ",原因如下:" + errorSb.toString());
+ }
+
+
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderAccountService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderAccountService.java
new file mode 100644
index 0000000..d022959
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderAccountService.java
@@ -0,0 +1,25 @@
+package cn.xluobo.business.sc.order.service;
+
+import cn.xluobo.business.sc.order.repo.model.ScOrderAccount;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ *
+ * 订单收款账户 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface IScOrderAccountService extends IService {
+
+ /**
+ * 根据订单 获取收款账户
+ * @param orderId
+ * @return
+ */
+ List getOrderAccountList(Long orderId);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderDetailService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderDetailService.java
new file mode 100644
index 0000000..48b03ac
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderDetailService.java
@@ -0,0 +1,49 @@
+package cn.xluobo.business.sc.order.service;
+
+import cn.xluobo.business.sc.order.repo.model.ScOrderDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ *
+ * 订单详情 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+public interface IScOrderDetailService extends IService {
+
+ /**
+ * 根据单号获取 订单明细
+ * @param orderId
+ * @return
+ */
+ List getByOrderDetail(Long orderId);
+
+ /**
+ * 获取订单明细
+ * @param orderId
+ * @param notEqOrderStatus 不包含的状态
+ * @return
+ */
+ List getByOrderDetail(Long orderId, String[] notEqOrderStatus);
+
+ /**
+ * 获取订单明细
+ * @param orderId
+ * @param orderStatus
+ * @return
+ */
+ List getByOrderDetail(Long orderId, String orderStatus);
+
+ /**
+ * 作废订单明细
+ * @param orderId
+ * @param orderDetailId
+ * @return
+ */
+ boolean invalidOrder(Long orderId, List orderDetailId);
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderService.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderService.java
new file mode 100644
index 0000000..ccf3fcf
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/IScOrderService.java
@@ -0,0 +1,38 @@
+package cn.xluobo.business.sc.order.service;
+
+import cn.xluobo.business.sc.order.repo.model.ScOrder;
+
+/**
+ *
+ * 订单 服务类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-24 10:22:19
+ */
+public interface IScOrderService extends com.baomidou.mybatisplus.extension.service.IService {
+
+ /**
+ * 订单作废
+ * @param orderId
+ * @return
+ */
+ boolean invalidOrder(Long orderId);
+
+ /**
+ * 订单数量
+ * @param beginDate 经办日期开始时间
+ * @param endDate 经办日期结束时间
+ * @param orderType
+ * @return
+ */
+ Integer orderCount(String beginDate, String endDate, String orderType);
+
+ /**
+ * 欠费学员数量
+ * 收款金额 + 余额支付金额 < 应收金额
+ * @return
+ */
+ Integer arrearsStudentCount();
+
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/impl/ScOrderAccountServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/impl/ScOrderAccountServiceImpl.java
new file mode 100644
index 0000000..0edbd37
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/impl/ScOrderAccountServiceImpl.java
@@ -0,0 +1,30 @@
+package cn.xluobo.business.sc.order.service.impl;
+
+import cn.xluobo.business.sc.order.repo.mapper.ScOrderAccountMapper;
+import cn.xluobo.business.sc.order.repo.model.ScOrderAccount;
+import cn.xluobo.business.sc.order.service.IScOrderAccountService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *
+ * 订单收款账户 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Service
+public class ScOrderAccountServiceImpl extends ServiceImpl implements IScOrderAccountService {
+
+ @Override
+ public List getOrderAccountList(Long orderId) {
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.select("account_name", "fee");
+ qw.eq("order_id", orderId);
+ return this.list(qw);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/impl/ScOrderDetailServiceImpl.java b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/impl/ScOrderDetailServiceImpl.java
new file mode 100644
index 0000000..2bf5bc1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/cn/xluobo/business/sc/order/service/impl/ScOrderDetailServiceImpl.java
@@ -0,0 +1,56 @@
+package cn.xluobo.business.sc.order.service.impl;
+
+import cn.xluobo.business.sc.order.enums.OrderStatusEnum;
+import cn.xluobo.business.sc.order.repo.mapper.ScOrderDetailMapper;
+import cn.xluobo.business.sc.order.repo.model.ScOrderDetail;
+import cn.xluobo.business.sc.order.service.IScOrderDetailService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *
+ * 订单详情 服务实现类
+ *
+ *
+ * @author zhangby
+ * @since 2020-08-21
+ */
+@Service
+public class ScOrderDetailServiceImpl extends ServiceImpl implements IScOrderDetailService {
+
+ @Override
+ public List getByOrderDetail(Long orderId) {
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.eq("order_id", orderId);
+ return this.list(qw);
+ }
+
+ @Override
+ public List