租户商品上架商城申请及审核

master
15004070936 5 days ago
parent 408096ad87
commit 78adfdc0ec

@ -33,6 +33,8 @@
<jwt.version>0.9.1</jwt.version> <jwt.version>0.9.1</jwt.version>
<lombok.version>1.16.20</lombok.version> <lombok.version>1.16.20</lombok.version>
<mybatis.plus.version>3.4.0</mybatis.plus.version> <mybatis.plus.version>3.4.0</mybatis.plus.version>
<dynamic.datasource.version>3.6.1</dynamic.datasource.version>
<liquibase.version>4.1.0</liquibase.version>
<!-- SMS 配置 --> <!-- SMS 配置 -->
<aliyun.sms.version>2.0.23</aliyun.sms.version> <aliyun.sms.version>2.0.23</aliyun.sms.version>
</properties> </properties>
@ -268,6 +270,17 @@
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis.plus.version}</version> <version>${mybatis.plus.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${dynamic.datasource.version}</version>
</dependency>
<!-- 引入 Liquibase 核心依赖 -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase.version}</version>
</dependency>
<!-- 文件系统minio --> <!-- 文件系统minio -->
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>

@ -1,257 +0,0 @@
package cn.xluobo.business.tool.impt.listener;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.school.course.enums.ClaTimeRepeatTypeEnums;
import com.ruoyi.school.course.enums.ClaTimeRuleTypeEnums;
import com.ruoyi.school.course.domain.ScClaTimeRule;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.service.BusinessClaTimeRuleService;
import com.ruoyi.school.course.service.IScCourseClaService;
import cn.xluobo.business.tool.impt.domain.ImportCourseCla;
import com.ruoyi.core.utils.DateUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.google.common.collect.Lists;
import com.ruoyi.core.api.APIBaseResponse;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @author zhangbaoyu
* @date Created in 2020/8/3 22:02
*/
@Slf4j
@Data
public class ImportCourseClaListener extends AnalysisEventListener<ImportCourseCla> {
private IScCourseClaService courseClaService;
private BusinessClaTimeRuleService businessClaTimeRuleService;
/**
*
*/
private Boolean needSave;
private Map<String, Long> courseMap;
private Map<String, Long> campusMap;
private Map<String, Long> teacherMap;
private Map<String, String> recruitStatusMap;
private Map<String, String> claTimeRepeatTypeMap;
private Map<String, Long> roomMap;
private Map<String, String> weekDayMap;
// 登录用户id
private Long loginUserId = 0L;
// 导入id
private Long importId;
// 需保存的saveCourseClaList
private List<ImportCourseCla> saveCourseClaList = Lists.newArrayList();
// 校验失败的列表
private List<ImportCourseCla> failCourseClaList = Lists.newArrayList();
/**
*
*/
int maxRecord = 100;
/**
*
*/
int hadReadRecord = 0;
public ImportCourseClaListener(IScCourseClaService courseClaService, BusinessClaTimeRuleService businessClaTimeRuleService) {
this.courseClaService = courseClaService;
this.businessClaTimeRuleService = businessClaTimeRuleService;
}
@Override
public void invoke(ImportCourseCla data, AnalysisContext context) {
APIBaseResponse checkParam = checkParam(data);
if (!checkParam.isSuccess()) {
data.setFailMsg(checkParam.getRespMsg());
failCourseClaList.add(data);
return;
}
saveCourseClaList.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
if (needSave) {
saveCourseCla();
}
log.info("doAfterAllAnalysed");
}
@Override
public boolean hasNext(AnalysisContext context) {
if (hadReadRecord++ < maxRecord) {
return true;
}
return false;
}
/**
*
*/
public void saveCourseCla() {
for (ImportCourseCla courseCla : saveCourseClaList) {
Long courseId = courseMap.get(courseCla.getCourseName());
Long deptId = campusMap.get(courseCla.getDeptName());
Long teacherId = teacherMap.get(courseCla.getTeacherName());
String recruitStatus = recruitStatusMap.get(courseCla.getRecruitStatus());
// 保存课程信息
ScCourseCla cla = new ScCourseCla();
cla.setCourseId(courseId);
cla.setDepartId(Long.valueOf(deptId));
cla.setStaffId(teacherId);
cla.setClaName(courseCla.getClaName());
cla.setCapacity(Integer.parseInt(courseCla.getCapacity()));
cla.setRecruitStatus(recruitStatus);
cla.setOpenDate(courseCla.getOpenDate());
cla.setCloseDate(courseCla.getCloseDate());
cla.setMemo(courseCla.getMemo());
cla.setCreateUser(loginUserId);
courseClaService.save(cla);
// 规则排课
if (StringUtils.isNoneEmpty(courseCla.getBeginDate(), courseCla.getEndDate())) {
Long roomId = null;
if (StringUtils.isNotEmpty(courseCla.getRoomName())) {
roomId = teacherMap.get(courseCla.getRoomName());
}
String repeatType = claTimeRepeatTypeMap.get(courseCla.getRepeatType());
// 保存规则排课信息 并生成排课信息
ScClaTimeRule claTimeRule = new ScClaTimeRule();
claTimeRule.setClaId(cla.getClaId());
claTimeRule.setRuleType(ClaTimeRuleTypeEnums.REPEAT_RULE.getRuleType());
claTimeRule.setBeginDate(courseCla.getBeginDate());
claTimeRule.setEndDate(courseCla.getEndDate());
claTimeRule.setRepeatType(repeatType);
if (ClaTimeRepeatTypeEnums.EVERY_WEEK.getRepeatType().equals(repeatType)
|| ClaTimeRepeatTypeEnums.EVERY_SECOND_WEEK.getRepeatType().equals(repeatType)) {
List<String> weekDayKeyList = Lists.newArrayList();
String weekDay = courseCla.getWeekDay();
String[] weekDayArray = weekDay.split(",");
for (String item : weekDayArray) {
String weekDayKey = weekDayMap.get(item);
weekDayKeyList.add(weekDayKey);
}
claTimeRule.setWeekDay(String.join(",", weekDayKeyList));
}
claTimeRule.setFilterHoliday("过滤".equals(courseCla.getFilterHoliday()));
claTimeRule.setStartTime(courseCla.getStartTime());
claTimeRule.setEndTime(courseCla.getEndTime());
claTimeRule.setTeacherId(teacherId);
claTimeRule.setRoomId(roomId);
businessClaTimeRuleService.addClaTimeRule(claTimeRule);
}
}
}
/**
*
*
* @param data
* @return
*/
public APIBaseResponse checkParam(ImportCourseCla data) {
if (StringUtils.isAnyEmpty(data.getClaName(), data.getCourseName(),
data.getDeptName(), data.getTeacherName(), data.getOpenDate())) {
return APIBaseResponse.fail("请填写班级名称、课程名称、校区、任课教练、开班日期");
} else if (StringUtils.isEmpty(data.getEveryStuLoseHour())) {
return APIBaseResponse.fail("请填写每次上课会员扣除课时数");
} else if (data.getClaName().length() > 30) {
return APIBaseResponse.fail("班级名称过长,最长30!");
} else if (StringUtils.isNotEmpty(data.getMemo()) && data.getMemo().length() > 200) {
return APIBaseResponse.fail("备注过长,最长200!");
}
try {
new BigDecimal(data.getEveryStuLoseHour());
}catch (NumberFormatException numberFormatException) {
return APIBaseResponse.fail("每次上课会员扣除课时数 需填写两位小数");
}
if(StringUtils.isNotEmpty(data.getCapacity())){
try {
Integer.parseInt(data.getCapacity());
}catch (NumberFormatException numberFormatException) {
return APIBaseResponse.fail("满班人数需为正整数");
}
}
Long courseId = courseMap.get(data.getCourseName());
Long deptId = campusMap.get(data.getDeptName());
Long teacherId = teacherMap.get(data.getTeacherName());
String recruitStatus = recruitStatusMap.get(data.getRecruitStatus());
if (null == courseId || null == teacherId) {
return APIBaseResponse.fail("根据课程名称、任课教练名称无法获取对应信息,请核对填写信息或重新下载导入模板进行导入");
} else if (ObjectUtil.isEmpty(deptId)) {
return APIBaseResponse.fail("根据校区名称无法获取对应信息,请核对填写信息或重新下载导入模板进行导入");
} else if (StringUtils.isEmpty(recruitStatus)) {
return APIBaseResponse.fail("根据招生状态无法获取对应信息,请核对填写信息或重新下载导入模板进行导入");
}
if (StringUtils.isNoneEmpty(data.getBeginDate(), data.getEndDate())) {
try {
DateUtil.yyyMMddDayBegin(data.getBeginDate());
DateUtil.yyyMMddDayBegin(data.getEndDate());
}catch (Exception e) {
return APIBaseResponse.fail("请按照正确格式填写排课开始日期、排课结束日期");
}
if (StringUtils.isAnyEmpty(data.getRepeatType(), data.getStartTime(), data.getEndTime())) {
return APIBaseResponse.fail("导入排课时,请填写重复方式、上课时间、下课时间。如无需导入排课信息,请删除填写的排课开始日期、排课结束日期");
} else if (!"过滤".equals(data.getFilterHoliday()) && !"不过滤".equals(data.getFilterHoliday())) {
return APIBaseResponse.fail("导入排课时,是否过滤节假日只可填写过滤/不过滤");
}
String repeatType = claTimeRepeatTypeMap.get(data.getRepeatType());
if (StringUtils.isEmpty(repeatType)) {
return APIBaseResponse.fail("根据重复方式无法获取对应信息,请核对填写信息或重新下载导入模板进行导入");
} else if (!ClaTimeRepeatTypeEnums.EVERY_SECOND_DAY.getRepeatType().equals(data.getRepeatType())) {
if (StringUtils.isEmpty(data.getWeekDay())) {
return APIBaseResponse.fail("导入排课时,每周重复、隔周重复时需填写上课星期");
}
String weekDay = data.getWeekDay();
String[] weekDayArray = weekDay.split(",");
for (String item : weekDayArray) {
if (StringUtils.isEmpty(weekDayMap.get(item))) {
return APIBaseResponse.fail("请重新填写上课星期'" + item + "',使用英文,号分隔");
}
}
}
if (StringUtils.isNotEmpty(data.getRoomName())) {
Long roomId = roomMap.get(data.getRoomName());
if (null == roomId) {
return APIBaseResponse.fail("根据教室名称无法获取对应信息,请核对填写信息或重新下载导入模板进行导入");
}
}
}
return APIBaseResponse.success();
}
public int getSuccessRecord() {
return this.saveCourseClaList.size();
}
public int getFailRecord() {
return this.failCourseClaList.size();
}
}

@ -14,7 +14,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @author ruoyi * @author ruoyi
*/ */
@SpringBootApplication( @SpringBootApplication(
exclude = {DataSourceAutoConfiguration.class}, exclude = {DataSourceAutoConfiguration.class },
scanBasePackages = {"com.ruoyi","cn.xluobo"} scanBasePackages = {"com.ruoyi","cn.xluobo"}
) )
@EnableConfigurationProperties({UploadConfigProperties.class, AddressProperties.class}) @EnableConfigurationProperties({UploadConfigProperties.class, AddressProperties.class})

@ -66,6 +66,7 @@ public class ProductCategoryController extends BaseController {
@Log(title = "商品分类", businessType = BusinessType.DELETE) @Log(title = "商品分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public ResponseEntity<Integer> remove(@PathVariable Long id) { public ResponseEntity<Integer> remove(@PathVariable Long id) {
return ResponseEntity.ok(service.deleteById(id)); throw new RuntimeException("分类删除时,租户商品的申请也会被删除,请联系管理员操作! ");
// ResponseEntity.ok(service.deleteById(id))
} }
} }

@ -0,0 +1,81 @@
package com.ruoyi.web.controller.mall;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.mall.domain.ProductShow;
import com.ruoyi.mall.domain.vo.ProductShowVO;
import com.ruoyi.mall.service.ProductShowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*/
@Api(description ="商品展示申请接口列表")
@RestController
@RequestMapping("/pms/productShow")
public class ProductShowController extends BaseController {
@Autowired
private ProductShowService service;
@ApiOperation("查询商品信息列表")
@PostMapping("/list")
public ResponseEntity<Page<ProductShowVO>> list(@RequestBody ProductShowVO query, Pageable page) {
List<ProductShowVO> list = service.selectByEntity(query, page);
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
}
@GetMapping(value = "/{id}")
public ResponseEntity<ProductShow> getInfo(@PathVariable("id") Long id) {
ProductShow productShow= service.selectProductShowDetail(id);
return ResponseEntity.ok(productShow);
}
@ApiOperation("新增商品申请(租户)")
@PreAuthorize("@ss.hasPermi('pms:publish:list')")
@PostMapping
public ResponseEntity<Boolean> add(@RequestBody ProductShow productShow) {
return ResponseEntity.ok(service.insertProductShow(productShow));
}
@ApiOperation("修改申请(租户)")
@PreAuthorize("@ss.hasPermi('pms:publish:list')")
@PutMapping
public ResponseEntity<Boolean> edit(@RequestBody ProductShow productShowUpdate) {
return ResponseEntity.ok(service.updateProductShow(productShowUpdate));
}
@ApiOperation("取消申请/删除(租户)")
@PreAuthorize("@ss.hasPermi('pms:publish:list')")
@DeleteMapping("/{id}")
public ResponseEntity<Boolean> remove(@PathVariable Long id) {
return ResponseEntity.ok(service.deleteProductShow(id));
}
//拒绝商品展示
@ApiOperation("拒绝商品展示(管理员)")
@PreAuthorize("@ss.hasPermi('pms:review:list')")
@PutMapping("/refuse/{id}")
public ResponseEntity<Boolean> refuse(@PathVariable Long id) {
return ResponseEntity.ok(service.refuseProductShow(id));
}
//审核通过
@ApiOperation("审核通过(管理员)")
@PreAuthorize("@ss.hasPermi('pms:review:list')")
@PutMapping("/pass")
public ResponseEntity<Boolean> pass(@RequestBody ProductShow productShowUpdate) {
return ResponseEntity.ok(service.passProductShow(productShowUpdate));
}
}

@ -1,15 +1,15 @@
package com.ruoyi.web.controller.school.course; package com.ruoyi.web.controller.school.course;
import com.ruoyi.common.page.RespPage; import com.ruoyi.common.page.RespPage;
import com.ruoyi.core.api.APIResponse;
import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScClaTimeVo;
import com.ruoyi.school.course.domain.req.time.ReqSearchClaTime; import com.ruoyi.school.course.domain.req.time.ReqSearchClaTime;
import com.ruoyi.school.course.domain.resp.time.RespBusinessClaTimeCalendar; import com.ruoyi.school.course.domain.resp.time.RespBusinessClaTimeCalendar;
import com.ruoyi.school.course.domain.resp.time.RespClaTime; import com.ruoyi.school.course.domain.resp.time.RespClaTime;
import com.ruoyi.school.course.domain.resp.time.RespClaTimeCalendar; import com.ruoyi.school.course.domain.resp.time.RespClaTimeCalendar;
import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScClaTimeVo;
import com.ruoyi.school.course.service.BusinessClaTimeService; import com.ruoyi.school.course.service.BusinessClaTimeService;
import com.ruoyi.school.student.domain.req.ReqClaTimeAttend; import com.ruoyi.school.student.domain.req.ReqClaTimeAttend;
import com.ruoyi.core.api.APIResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -122,5 +122,14 @@ public class ScClaTimeController {
return claTimeService.confirmCla(reqClaTimeAttend); return claTimeService.confirmCla(reqClaTimeAttend);
} }
/**
*
* @param
* @return
*/
@GetMapping("/list/searchCourseClaStudent")
public APIResponse searchCourseClaStudent(ReqSearchClaTime reqSearchClaTime) {
return claTimeService.searchCourseClaStudent(reqSearchClaTime);
}
} }

@ -1,108 +0,0 @@
package com.ruoyi.web.controller.school.course;
import com.ruoyi.core.api.APIResponse;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.domain.req.cla.ReqAddScCourseCla;
import com.ruoyi.school.course.domain.req.cla.ReqSearchScCourseCla;
import com.ruoyi.school.course.domain.req.time.ReqSearchClaTime;
import com.ruoyi.school.course.domain.resp.cla.RespClaAllDetailInfo;
import com.ruoyi.school.course.service.impl.BusinessScCourseClaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* Controller
* </p>
*
* @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
* @return
*/
@GetMapping("/list/searchCourseClaStudent")
public APIResponse searchCourseClaStudent(ReqSearchClaTime reqSearchClaTime) {
return scCourseClaService.searchCourseClaStudent(reqSearchClaTime);
}
/**
*
*
* @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);
}
}

@ -7,7 +7,6 @@ import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.core.api.APIResponse; import com.ruoyi.core.api.APIResponse;
import com.ruoyi.school.course.domain.req.course.ReqBusinessOrderCourseDetail;
import com.ruoyi.school.course.domain.resp.course.RespCourseTypeSelect; import com.ruoyi.school.course.domain.resp.course.RespCourseTypeSelect;
import com.ruoyi.school.member.domain.ScMemberCard; import com.ruoyi.school.member.domain.ScMemberCard;
import com.ruoyi.school.member.domain.ScMemberCardCharge; import com.ruoyi.school.member.domain.ScMemberCardCharge;
@ -136,7 +135,7 @@ public class ScMemberCardTypesController {
@PostMapping("/add/memberCardTypes") @PostMapping("/add/memberCardTypes")
@Transactional @Transactional
public APIResponse addScCourse(@RequestBody ScMemberCardTypes types) { public APIResponse addScCourse(@RequestBody ScMemberCardTypes types) {
//todo 会员卡项修改记录
types.checkParam(); types.checkParam();
types.setTenantId(SecurityUtils.getLoginUser().getNowTenantId()); types.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
types.setCreateUser(SecurityUtils.getUserId()); types.setCreateUser(SecurityUtils.getUserId());
@ -254,9 +253,6 @@ public class ScMemberCardTypesController {
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();
} }
@GetMapping("/info/orderCardTypeDetail")
public APIResponse orderCardTypeDetail(ReqBusinessOrderCourseDetail orderCourseDetail) {
return typesService.orderCardTypeDetail(orderCourseDetail);
}
} }

@ -13,16 +13,19 @@ spring:
username: root username: root
password: '!Runpeng888' password: '!Runpeng888'
# 从库数据源 # 从库数据源
slave: # slave:
# 从数据源开关/默认关闭 # # 从数据源开关/默认关闭
enabled: false # enabled: false
url: # url:
username: # username:
password: # password:
statViewServlet: # statViewServlet:
# 控制台管理用户名和密码 # 控制台管理用户名和密码
login-username: ruoyi # login-username: ruoyi
login-password: 123456 # login-password: 123456
# Liquibase 关闭自动运行(手动执行)
liquibase:
enabled: false
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
@ -47,3 +50,4 @@ minio:
filePath: file filePath: file
videoPath: video videoPath: video
expireIn: 180 # 文件过期时间,单位:天 expireIn: 180 # 文件过期时间,单位:天

@ -1,6 +1,7 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -23,6 +24,8 @@ public class SysDept extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 部门ID */ /** 部门ID */
@TableId
private Long deptId; private Long deptId;
/** 父部门ID */ /** 父部门ID */
@ -64,6 +67,32 @@ public class SysDept extends BaseEntity
//1部门 2校区 //1部门 2校区
private String deptType; private String deptType;
/**
*
*/
private String activationDate;
/**
*
*/
private String expiryDate;
public String getActivationDate() {
return activationDate;
}
public void setActivationDate(String activationDate) {
this.activationDate = activationDate;
}
public String getExpiryDate() {
return expiryDate;
}
public void setExpiryDate(String expiryDate) {
this.expiryDate = expiryDate;
}
/** 子部门 */ /** 子部门 */
@TableField(exist = false) @TableField(exist = false)
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();

@ -1,11 +1,14 @@
package com.ruoyi.common.db; package com.ruoyi.common.db;
import org.springframework.stereotype.Component;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
//@Component//尽量加上这个 @Component//尽量加上这个
//@WebListener//声明为监听器 @WebListener//声明为监听器
public class SshContextListener implements ServletContextListener { public class SshContextListener implements ServletContextListener {
private SshTunnelConfig sshConnectionConfig; private SshTunnelConfig sshConnectionConfig;

@ -0,0 +1,31 @@
package com.ruoyi.framework.config;
import org.springframework.web.servlet.HandlerInterceptor;
//@Component
//@RequiredArgsConstructor
public class TenantInterceptor implements HandlerInterceptor {
// private final TenantDataSourceService tenantDataSourceService;
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
// // 从请求头、JWT、Session 等获取租户ID
// String tenantId = request.getHeader("X-Tenant-Id");
// if (tenantId == null || tenantId.isEmpty()) {
// throw new RuntimeException("缺少租户标识");
// }
//
// TenantContext.setTenantId(tenantId);
// // 通知 dynamic-datasource 切换数据源
// tenantDataSourceService.switchToTenant(tenantId);
// return true;
// }
//
// @Override
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
// // 清理资源
// tenantDataSourceService.clearDataSource();
// TenantContext.clear();
// }
}

@ -1,5 +1,6 @@
package com.ruoyi.mall.domain; package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import lombok.Data; import lombok.Data;
@ -15,6 +16,7 @@ public class Address {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//"ID") //"ID")
@TableId
private Integer id; private Integer id;
//"地区邮编") //"地区邮编")

@ -1,5 +1,6 @@
package com.ruoyi.mall.domain; package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
@ -15,7 +16,7 @@ import lombok.Data;
public class Brand extends BaseAudit { public class Brand extends BaseAudit {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId
private Long id; private Long id;

@ -1,5 +1,6 @@
package com.ruoyi.mall.domain; package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
@ -16,7 +17,7 @@ import lombok.Data;
public class OrderDeliveryHistory extends BaseAudit { public class OrderDeliveryHistory extends BaseAudit {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//"ID") @TableId
private Long id; private Long id;
//"订单id") //"订单id")

@ -1,5 +1,6 @@
package com.ruoyi.mall.domain; package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
@ -17,6 +18,7 @@ public class OrderOperateHistory extends BaseAudit {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//"ID") //"ID")
@TableId
private Long id; private Long id;
//"订单id") //"订单id")

@ -2,6 +2,7 @@ package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
@ -20,6 +21,7 @@ public class Product extends BaseAudit {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId
private Long id; private Long id;
@ -101,4 +103,5 @@ public class Product extends BaseAudit {
*/ */
private Long instructor; private Long instructor;
private Long storeId; private Long storeId;
private String tenantId;
} }

@ -1,5 +1,6 @@
package com.ruoyi.mall.domain; package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
@ -16,6 +17,7 @@ public class ProductCategory extends BaseAudit {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId
private Long id; private Long id;

@ -0,0 +1,75 @@
package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
*
* : mall_product_show
*/
@Data
@TableName("mall_product_show")
public class ProductShow {
/**
* ID
*/
@TableId
private Long id;
/**
* ID
*/
private Long productId;
/**
* ID
*/
private Long storeId;
/**
* ID
*/
private String tenantId;
/**
* 0- 1-
*/
private String showFlag;
/**
* ID
*/
private Long showCategory;
/**
*
*/
private LocalDate showStartTime;
/**
*
*/
private LocalDate showEndTime;
/**
* 0- 1- 2- 3- 4-
*/
private String applyStatus;
/**
*
*/
private LocalDateTime applyTime;
private LocalDateTime reviewTime;
/**
*
*/
private Integer sort;
}

@ -1,5 +1,6 @@
package com.ruoyi.mall.domain; package com.ruoyi.mall.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
@ -18,6 +19,7 @@ public class Sku extends BaseAudit {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId
private Long id; private Long id;

@ -0,0 +1,14 @@
package com.ruoyi.mall.domain.vo;
import com.ruoyi.mall.domain.ProductShow;
import lombok.Data;
@Data
public class ProductShowVO extends ProductShow {
private String productName;
private String productCategoryName;
private String tenantName;
private String storeName;
}

@ -0,0 +1,19 @@
package com.ruoyi.mall.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.mall.domain.ProductShow;
import com.ruoyi.mall.domain.vo.ProductShowVO;
import java.util.List;
/**
* Mapper
*/
public interface ProductShowMapper extends BaseMapper<ProductShow> {
List<ProductShowVO> selectProductShowList(ProductShowVO productShowVO);
int onSaleProductShow();
int expireProductShow();
}

@ -183,6 +183,7 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
Product product = BeanUtil.toBean(productVO,Product.class); Product product = BeanUtil.toBean(productVO,Product.class);
product.setCreateTime(LocalDateTime.now()); product.setCreateTime(LocalDateTime.now());
product.setStoreId(SecurityUtils.getDeptId()); product.setStoreId(SecurityUtils.getDeptId());
product.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
setProductManager(productVO,product); setProductManager(productVO,product);
List<Sku> skuList = productVO.getSkuList(); List<Sku> skuList = productVO.getSkuList();
@ -299,6 +300,7 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
if (orderCount>0){ if (orderCount>0){
throw new RuntimeException("商品已生成订单,无法删除!"); throw new RuntimeException("商品已生成订单,无法删除!");
} }
//sku product_show 数据库级联删除
return productMapper.deleteById(id); return productMapper.deleteById(id);
} }

@ -0,0 +1,145 @@
package com.ruoyi.mall.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.mall.domain.ProductCategory;
import com.ruoyi.mall.domain.ProductShow;
import com.ruoyi.mall.domain.vo.ProductShowVO;
import com.ruoyi.mall.mapper.ProductCategoryMapper;
import com.ruoyi.mall.mapper.ProductShowMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* Service
*
*
* @author zcc
*/
@Service
@Slf4j
public class ProductShowService extends ServiceImpl<ProductShowMapper, ProductShow> implements IService<ProductShow> {
@Autowired
private ProductCategoryMapper productCategoryMapper; // 注入权限验证服务
public List<ProductShowVO> selectByEntity(ProductShowVO productShow, Pageable page) {
if (page != null) {
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
}
LoginUser loginUser= SecurityUtils.getLoginUser();
//审核页list
if(loginUser.getPermissions().contains("pms:review:list")){
return baseMapper.selectProductShowList(productShow);
}
//申请页list
productShow.setTenantId(loginUser.getNowTenantId());
productShow.setStoreId(loginUser.getDeptId());
return baseMapper.selectProductShowList(productShow);
}
//申请商品展示
public Boolean insertProductShow(ProductShow productShow) {
LoginUser loginUser= SecurityUtils.getLoginUser();
productShow.setTenantId(loginUser.getNowTenantId());
productShow.setStoreId(loginUser.getDeptId());
productShow.setApplyStatus("0");
productShow.setApplyTime(LocalDateTime.now());
return this.save(productShow);
}
//获取商品展示详情
public ProductShow selectProductShowDetail(Long id) {
return this.getById(id);
}
//修改申请(租户)
public Boolean updateProductShow(ProductShow productShowUpdate) {
ProductShow dbProductShow =this.getById(productShowUpdate.getId());
if ("1,3".contains(dbProductShow.getApplyStatus())){
throw new RuntimeException("审核通过或正在展示期的商品不允许修改");
}
if (dbProductShow.getApplyStatus().equals("4")){
throw new RuntimeException("本次申请展示期已结束,如需继续展示请重新提交申请");
}
ProductShow productShow = new ProductShow();
productShow.setId(productShowUpdate.getId());
productShow.setProductId(productShowUpdate.getProductId());
productShow.setShowStartTime(productShowUpdate.getShowStartTime());
productShow.setShowEndTime(productShowUpdate.getShowEndTime());
productShow.setApplyStatus("0");
return this.updateById(productShow);
}
//取消申请
public Boolean deleteProductShow(Long id) {
return this.removeById(id);
}
//拒绝商品展示
public Boolean refuseProductShow(Long id) {
ProductShow dbProductShow =this.getById(id);
if (!dbProductShow.getApplyStatus().equals("0")){
throw new RuntimeException("当前状态不允许此项操作");
}
ProductShow productShow = new ProductShow();
productShow.setId(id);
productShow.setApplyStatus("2");
return this.updateById(productShow);
}
//审核通过
public Boolean passProductShow(ProductShow productShowUpdate) {
ProductShow dbProductShow =this.getById(productShowUpdate.getId());
if (ObjectUtil.isEmpty(dbProductShow)){
throw new RuntimeException("租户已取消申请");
}
if (!dbProductShow.getApplyStatus().equals("0")){
throw new RuntimeException("当前状态不允许此项操作");
}
if (dbProductShow.getShowStartTime().isBefore(LocalDateTime.now().toLocalDate())){
throw new RuntimeException("展示开始日期已过,请联系租户修改展示时间后,重新提交申请");
}
if (ObjectUtil.hasNull(productShowUpdate.getSort(),productShowUpdate.getShowCategory())){
throw new RuntimeException("请将上架商品所属分类及排序补充完整");
}
ProductCategory category=productCategoryMapper.selectById(productShowUpdate.getShowCategory());
if (ObjectUtil.isNull(category)){
throw new RuntimeException("上架商品所属分类不存在");
}
ProductShow productShow = new ProductShow();
productShow.setId(productShowUpdate.getId());
productShow.setReviewTime(productShowUpdate.getReviewTime());
productShow.setApplyStatus("1");
productShow.setSort(productShowUpdate.getSort());
productShow.setShowCategory(productShowUpdate.getShowCategory());
productShow.setReviewTime(LocalDateTime.now());
return this.updateById(productShow);
}
//上架商品展示 (定时器触发事件)
@Transactional
public int onSaleProductShow() {
int updatedRows=baseMapper.onSaleProductShow();
System.out.println("今天开始的展示任务已启动,影响记录数:" + updatedRows);
return updatedRows;
}
//商品展示到期 (定时器触发事件)
@Transactional
public int expireProductShow() {
int updatedRows=baseMapper.onSaleProductShow();
System.out.println("昨天结束的展示任务已停止,影响记录数:" + updatedRows);
return updatedRows;
}
}

@ -0,0 +1,26 @@
package com.ruoyi.quartz.task;
import com.ruoyi.mall.service.ProductShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("productShowTask")
public class ProductShowTask {
@Autowired
private ProductShowService productShowService;
/**
* 00:01
*/
public void onSaleProductShow() {
productShowService.onSaleProductShow();
}
/**
* 00:02
*/
public void expireProductShow() {
productShowService.expireProductShow();
}
}

@ -47,6 +47,9 @@ public class ScClaTime implements Serializable {
@TableField("cla_id") @TableField("cla_id")
private Long claId; private Long claId;
@TableField( "course_id")
private Long courseId;
/** /**
* *
*/ */
@ -65,6 +68,12 @@ public class ScClaTime implements Serializable {
@TableField("room_name") @TableField("room_name")
private String roomName; private String roomName;
@TableField("cla_color")
private String claColor;
@TableField("font_size")
private Integer fontSize;
@TableField("font_color")
private String fontColor;
/** /**
* *
*/ */
@ -191,7 +200,7 @@ public class ScClaTime implements Serializable {
@TableField("last_update_time") @TableField("last_update_time")
private Date lastUpdateTime; private Date lastUpdateTime;
@TableField(exist = false) @TableField("dept_id")
private Long deptId; private Long deptId;
@TableField(exist = false) @TableField(exist = false)
private String courseName; private String courseName;
@ -211,7 +220,7 @@ public class ScClaTime implements Serializable {
} }
public boolean checkAddParam() { public boolean checkAddParam() {
if(null == claId || null == teacherId) { if(null == deptId || null == teacherId || null == courseId) {
return false; return false;
} }
if (StringUtils.isAnyEmpty(claDate, startTime, endTime)) { if (StringUtils.isAnyEmpty(claDate, startTime, endTime)) {

@ -42,12 +42,21 @@ public class ScClaTimeRule implements Serializable {
@TableField("cla_id") @TableField("cla_id")
private Long claId; private Long claId;
@TableField( "course_id")
private Long courseId;
/** /**
* 1 2 * 1 2
*/ */
@TableField("rule_type") @TableField("rule_type")
private String ruleType; private String ruleType;
@TableField("cla_color")
private String claColor;
@TableField("font_size")
private Integer fontSize;
@TableField("font_color")
private String fontColor;
/** /**
* *
*/ */
@ -171,11 +180,11 @@ public class ScClaTimeRule implements Serializable {
/** /**
* *
*/ */
@TableField(exist = false) @TableField("dept_id")
private Long deptId; private Long deptId;
public boolean checkParam() { public boolean checkParam() {
if (null == claId || null == teacherId) { if (null == deptId || null == teacherId || null == courseId ) {
return false; return false;
} }
if (StringUtils.isAnyEmpty(ruleType)) { if (StringUtils.isAnyEmpty(ruleType)) {

@ -164,14 +164,17 @@ public class ScClaTimeRuleVo implements Serializable {
/** /**
* *
*/ */
@TableField(exist = false)
private String[] chooseDate; private String[] chooseDate;
/** /**
* *
*/ */
@TableField(exist = false)
private Long deptId; private Long deptId;
private Long courseId;
private String claColor;
private Integer fontSize;
private String fontColor;
public boolean checkParam() { public boolean checkParam() {
if (null == claId || null == teacherId) { if (null == claId || null == teacherId) {

@ -3,7 +3,6 @@ package com.ruoyi.school.course.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -23,7 +22,6 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sc_cla_time")
public class ScClaTimeVo implements Serializable { public class ScClaTimeVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -137,14 +135,6 @@ public class ScClaTimeVo implements Serializable {
@TableField("at_class_cnt") @TableField("at_class_cnt")
private Integer atClassCnt; private Integer atClassCnt;
/**
*
*/
// @TableField("leave_cnt")
// private Integer leaveCnt;
/** /**
* *
*/ */
@ -175,13 +165,17 @@ public class ScClaTimeVo implements Serializable {
@TableField("last_update_time") @TableField("last_update_time")
private Date lastUpdateTime; private Date lastUpdateTime;
@TableField(exist = false) private String claColor;
private Integer fontSize;
private String fontColor;
private Long deptId; private Long deptId;
@TableField(exist = false)
private String courseName; private String courseName;
@TableField(exist = false)
private String claName; private String claName;
@TableField(exist = false)
private String deptName; private String deptName;
public boolean checkUpdateParam() { public boolean checkUpdateParam() {

@ -67,6 +67,10 @@ public class ScCourse implements Serializable {
*/ */
@TableField("sale") @TableField("sale")
private String sale; private String sale;
@TableField("remark")
private String remark;
@TableField("star")
private Integer star;
/** /**
* 1 0 * 1 0
@ -117,7 +121,7 @@ public class ScCourse implements Serializable {
@TableField("tuition_fee") @TableField("tuition_fee")
private BigDecimal tuitionFee; private BigDecimal tuitionFee;
@TableField(value = "depart_id", typeHandler = LongArrayTypeHandler.class,updateStrategy = FieldStrategy.IGNORED) @TableField(value = "depart_id", typeHandler = LongArrayTypeHandler.class)
private Long[] departId; private Long[] departId;
} }

@ -1,165 +0,0 @@
package com.ruoyi.school.course.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.core.api.APIBaseResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @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("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;
private String teacherName;
// 当前班级人数
@TableField(exist = false)
private Integer studentCnt;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
/**
*
* @return
*/
public APIBaseResponse checkParam(){
if(StringUtils.isAnyEmpty(claName,claColor)){
return APIBaseResponse.fail("请求参数错误,请全部填写后,重新提交");
}
if(null == courseId || null == departId
// || null == staffId || null == capacity
// || null == everyStuLoseHour || null == everyTeaGetHour
){
return APIBaseResponse.fail("请求参数错误,请全部填写后,重新提交");
}
return APIBaseResponse.success();
}
}

@ -1,175 +0,0 @@
package com.ruoyi.school.course.domain;
import com.ruoyi.core.api.APIBaseResponse;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.utils.SecurityUtils;
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;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-08-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sc_course_cla")
public class ScCourseClaVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "cla_id")
private String claId;
/**
*
*/
@TableField("tenant_id")
private String tenantId;
/**
* id
*/
@TableField("course_id")
private String 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;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
/**
*
* @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();
}
}

@ -1,57 +0,0 @@
package com.ruoyi.school.course.domain.req.cla;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.school.course.domain.ScCourseCla;
import lombok.Data;
/**
*
*
* @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 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.setOpenDate(openDate);
cla.setCloseDate(closeDate);
cla.setMemo(memo);
cla.setCreateUser(loginUser.getUserId());
return cla;
}
}

@ -1,16 +0,0 @@
package com.ruoyi.school.course.domain.req.cla;
import com.ruoyi.common.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;
}

@ -1,18 +0,0 @@
package com.ruoyi.school.course.domain.req.cla;
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;
}

@ -1,21 +0,0 @@
package com.ruoyi.school.course.domain.req.cla;
import com.ruoyi.common.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 String courseId;
private String staffId;
private String claName;
private String courseTime;
private Long departId;
private String tenantId;
}

@ -52,6 +52,10 @@ public class ReqAddScCourse {
private BigDecimal tuitionFee; private BigDecimal tuitionFee;
private String remark;
private Integer star;
/** /**
* *
* *

@ -13,6 +13,8 @@ public class ReqSelect {
private String search; private String search;
private Long departId;
private Integer maxRecord = 50; private Integer maxRecord = 50;
// 是否可分页 // 是否可分页

@ -27,7 +27,7 @@ public class ReqSearchClaTime implements Serializable {
private String userId; private String userId;
// 班级 // 班级
private String claId;
// 会员 // 会员
private Long studentId; private Long studentId;

@ -1,31 +0,0 @@
package com.ruoyi.school.course.domain.resp.cla;
import com.ruoyi.school.course.domain.ScCourseClaVo;
import com.ruoyi.school.course.domain.resp.course.RespBusinessChooseCourseCharge;
import com.ruoyi.school.course.domain.resp.course.ScCourseVo;
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 ScCourseClaVo courseCla;
// 课程信息
private ScCourseVo course;
// 收费方式
private List<RespBusinessChooseCourseCharge> courseChargeList;
// 上课时间
private List<String> claTimeList;
}

@ -1,40 +0,0 @@
package com.ruoyi.school.course.domain.resp.cla;
import lombok.Data;
/**
*
* @author zhangbaoyu
* @date Created in 2020-03-23 19:36
*/
@Data
public class RespCourseClaInfo {
private String claId;
private String claName;
// 当前人数
private Integer studentCnt;
// 满班人数
private String capacity;
private String recruitStatus;
private String openDate;
private String courseId;
private String courseName;
private Long staffId;
private String teacherName;
private String deptName;
// 上课星期
private String weekDay;
}

@ -1,27 +0,0 @@
package com.ruoyi.school.course.domain.resp.cla;
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;
}

@ -67,4 +67,8 @@ public class RespSearchCourse implements Serializable {
private BigDecimal claFee;//教练课时费 private BigDecimal claFee;//教练课时费
private BigDecimal tuitionFee;//课程价值 private BigDecimal tuitionFee;//课程价值
private String storeNames; private String storeNames;
private String remark;
private Integer star;
} }

@ -50,6 +50,8 @@ public class ClaTimeCalendarItem {
private String roomName; private String roomName;
private String claColor; private String claColor;
private Integer fontSize;
private String fontColor;
// 上课状态 // 上课状态
private String claTimeStatus; private String claTimeStatus;
@ -66,6 +68,8 @@ public class ClaTimeCalendarItem {
this.staffName = respClaTime.getStaffName(); this.staffName = respClaTime.getStaffName();
this.roomName = respClaTime.getRoomName(); this.roomName = respClaTime.getRoomName();
this.claColor = respClaTime.getClaColor(); this.claColor = respClaTime.getClaColor();
this.fontSize = respClaTime.getFontSize();
this.fontColor = respClaTime.getFontColor();
this.claTimeStatus = respClaTime.getStatus(); this.claTimeStatus = respClaTime.getStatus();
this.atClassCnt=respClaTime.getAtClassCnt(); this.atClassCnt=respClaTime.getAtClassCnt();
this.lessCnt=respClaTime.getLessCnt(); this.lessCnt=respClaTime.getLessCnt();

@ -79,4 +79,5 @@ public class RespClaTime {
private Date lastUpdateTime; private Date lastUpdateTime;
// 记录人 // 记录人
private String lastUpdateUserName; private String lastUpdateUserName;
private String deptName;
} }

@ -16,6 +16,8 @@ import java.util.Date;
public class RespClaTimeCalendar { public class RespClaTimeCalendar {
private String claColor; private String claColor;
private Integer fontSize;
private String fontColor;
private String staffName; private String staffName;

@ -42,6 +42,7 @@ public class RespClaTimeRule {
@TableField("cla_id") @TableField("cla_id")
private String claId; private String claId;
private Long courseId;
/** /**
* 1 2 * 1 2
*/ */
@ -147,13 +148,12 @@ public class RespClaTimeRule {
/** /**
* *
*/ */
@TableField(exist = false)
private String[] chooseDate; private String[] chooseDate;
/** /**
* *
*/ */
@TableField(exist = false)
private Long deptId; private Long deptId;
private String deptName;
} }

@ -75,16 +75,7 @@ public interface ScClaTimeAttendMapper extends com.baomidou.mybatisplus.core.map
, @Param("tenantId") String tenantId); , @Param("tenantId") String tenantId);
BigDecimal selectMemberByDay( @Param("tenantId") String tenantId); BigDecimal selectMemberByDay( @Param("tenantId") String tenantId);
/**
*
*
* @param beginDate
* @param endDate
* @return
*/
BigDecimal selectNeedAttendCostHour(@Param("beginDate") String beginDate
, @Param("endDate") String endDate
, @Param("tenantId") String tenantId);
/** /**
* *

@ -3,10 +3,12 @@ package com.ruoyi.school.course.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.school.course.domain.ScClaTime; import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScClaTimeVo;
import com.ruoyi.school.course.domain.req.time.ReqClaTimeCount; import com.ruoyi.school.course.domain.req.time.ReqClaTimeCount;
import com.ruoyi.school.course.domain.req.time.ReqSearchClaTime; import com.ruoyi.school.course.domain.req.time.ReqSearchClaTime;
import com.ruoyi.school.course.domain.resp.time.RespClaTime; import com.ruoyi.school.course.domain.resp.time.RespClaTime;
import com.ruoyi.school.course.domain.resp.time.RespClaTimeCalendar; import com.ruoyi.school.course.domain.resp.time.RespClaTimeCalendar;
import com.ruoyi.school.student.domain.resp.RespCourseClaStudent;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -46,9 +48,21 @@ public interface ScClaTimeMapper extends BaseMapper<ScClaTime> {
Integer selectClaTimeCount(ReqClaTimeCount reqClaTimeCount); Integer selectClaTimeCount(ReqClaTimeCount reqClaTimeCount);
Integer selectBookCount(@Param("ruleId") Long ruleId Integer selectBookCount(@Param("ruleId") Long ruleId
,@Param("claId") Long claId
,@Param("courseTimeId") String courseTimeId ,@Param("courseTimeId") String courseTimeId
, @Param("tenantId") String tenantId ); , @Param("tenantId") String tenantId );
ScClaTimeVo serlectByClaTimeId(Long courseTimeId);
List<RespCourseClaStudent> selectStudenForClaTime(String courseTimeId);
int checkTeacherConflict(@Param("teacherId")Long teacherId,
@Param("date")String date,
@Param("startTime")String startTime,
@Param("endTime")String endTime,
@Param("excludeScheduleId")String excludeScheduleId);
int checkClassroomConflict(@Param("classroomId")Long classroomId,
@Param("date")String date,
@Param("startTime")String startTime,
@Param("endTime")String endTime,
@Param("excludeScheduleId")String excludeScheduleId);
} }

@ -34,7 +34,7 @@ public interface ScClaTimeRuleMapper extends BaseMapper<ScClaTimeRule> {
* @param day * @param day
* @return * @return
*/ */
List<RespClaTimeRule> selectByDay(@Param("claId")Long claId, @Param("day")String day); List<RespClaTimeRule> selectByDay(@Param("courseId")Long courseId, @Param("day")String day);
/** /**
* id * id
@ -45,8 +45,10 @@ public interface ScClaTimeRuleMapper extends BaseMapper<ScClaTimeRule> {
/** /**
* *
* @param claId * @param
* @return * @return
*/ */
List<String> selectClaTimeInfo(Long claId); List<String> selectClaTimeInfo(@Param("deptId") Long deptId,@Param("courseId")Long courseId);
} }

@ -1,66 +0,0 @@
package com.ruoyi.school.course.mapper;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.ruoyi.common.page.RespPage;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.domain.req.cla.ReqClaCount;
import com.ruoyi.school.course.domain.req.cla.ReqCourseClaSelect;
import com.ruoyi.school.course.domain.req.cla.ReqSearchScCourseCla;
import com.ruoyi.school.course.domain.resp.cla.RespCourseClaInfo;
import com.ruoyi.school.course.domain.resp.cla.RespCourseClaSelectInfo;
import com.ruoyi.school.student.domain.resp.RespCourseClaStudent;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper
* </p>
*
* @author zhangby
* @since 2020-03-17 01:11:06
*/
public interface ScCourseClaMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<ScCourseCla> {
/**
*
*
* @param reqSearchScCourseCla
* @param page
* @return
*/
List<RespCourseClaInfo> selectClaList(@Param("reqSearchScCourseCla") ReqSearchScCourseCla reqSearchScCourseCla, @Param("page") RespPage page);
/**
* select
* @param courseClaSelect
* @return
*/
List<RespCourseClaSelectInfo> 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);
List <RespCourseClaStudent> selectStudenForClaTime(@Param("courseTimeId") String courseTimeId);
}

@ -35,8 +35,6 @@ public class BusinessClaTimeRuleService {
@Autowired @Autowired
private ScClaTimeRuleMapper claTimeRuleMapper; private ScClaTimeRuleMapper claTimeRuleMapper;
@Autowired @Autowired
private IScCourseClaService courseClaService;
@Autowired
private IScRoomService roomService; private IScRoomService roomService;
/** /**
@ -60,6 +58,7 @@ public class BusinessClaTimeRuleService {
*/ */
@Transactional @Transactional
public APIResponse addClaTimeRule(ScClaTimeRule claTimeRule) { public APIResponse addClaTimeRule(ScClaTimeRule claTimeRule) {
if (!claTimeRule.checkParam()) { if (!claTimeRule.checkParam()) {
return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL); return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
} }
@ -90,10 +89,7 @@ public class BusinessClaTimeRuleService {
ScClaTimeRuleVo scClaTimeRuleVo = new ScClaTimeRuleVo(); ScClaTimeRuleVo scClaTimeRuleVo = new ScClaTimeRuleVo();
BeanUtil.copyProperties(claTimeRule,scClaTimeRuleVo); BeanUtil.copyProperties(claTimeRule,scClaTimeRuleVo);
// 设置deptId // 设置deptId
Long claId = claTimeRule.getClaId(); scClaTimeRuleVo.setDeptId(claTimeRule.getDeptId());
ScCourseCla courseCla = courseClaService.getById(claId);
claTimeRule.setDeptId(courseCla.getDepartId());
scClaTimeRuleVo.setDeptId(courseCla.getDepartId());
return APIResponse.toAPIResponse(scClaTimeRuleVo); return APIResponse.toAPIResponse(scClaTimeRuleVo);
} }
@ -114,7 +110,7 @@ public class BusinessClaTimeRuleService {
return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL); return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
} }
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
Integer bookCount= claTimeService.selectBookCount(claTimeRule.getRuleId(), claTimeRule.getClaId(),null); Integer bookCount= claTimeService.selectBookCount(claTimeRule.getRuleId(), null);
if(bookCount.intValue()>0){ if(bookCount.intValue()>0){
return APIResponse.toExceptionResponse("无法修改:相关课表中有会员预约!"); return APIResponse.toExceptionResponse("无法修改:相关课表中有会员预约!");
} }
@ -128,7 +124,7 @@ public class BusinessClaTimeRuleService {
claTimeRule.setLastUpdateTime(new Date()); claTimeRule.setLastUpdateTime(new Date());
boolean updateScCourseType = claTimeRuleService.updateById(claTimeRule); boolean updateScCourseType = claTimeRuleService.updateById(claTimeRule);
claTimeService.deleteUnBeginTime(claTimeRule.getRuleId(), claTimeRule.getClaId(), loginUser.getNowTenantId()); claTimeService.deleteUnBeginTime(claTimeRule.getRuleId(), loginUser.getNowTenantId());
saveBatchClaTime(claTimeRule); saveBatchClaTime(claTimeRule);
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();
@ -149,7 +145,7 @@ public class BusinessClaTimeRuleService {
//是否有会员预约 //是否有会员预约
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
Integer bookCount= claTimeService.selectBookCount(claTimeRule.getRuleId(), claTimeRule.getClaId(),null); Integer bookCount= claTimeService.selectBookCount(claTimeRule.getRuleId(), null);
if(bookCount.intValue()>0){ if(bookCount.intValue()>0){
return APIResponse.toExceptionResponse("无法删除:相关课表中有会员预约!"); return APIResponse.toExceptionResponse("无法删除:相关课表中有会员预约!");
@ -157,7 +153,7 @@ public class BusinessClaTimeRuleService {
claTimeRuleService.removeById(ruleId); claTimeRuleService.removeById(ruleId);
claTimeService.deleteUnBeginTime(claTimeRule.getRuleId(), claTimeRule.getClaId(), loginUser.getNowTenantId()); claTimeService.deleteUnBeginTime(claTimeRule.getRuleId(), loginUser.getNowTenantId());
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();
} }
@ -170,17 +166,24 @@ public class BusinessClaTimeRuleService {
* @param claTimeRule * @param claTimeRule
*/ */
private void saveBatchClaTime(ScClaTimeRule claTimeRule) { private void saveBatchClaTime(ScClaTimeRule claTimeRule) {
Long claId = claTimeRule.getClaId();
ScCourseCla courseCla = courseClaService.getById(claId); ScCourse course=courseService.getById(claTimeRule.getCourseId());
ScCourse course=courseService.getById(courseCla.getCourseId());
List<RespClaTimeRule> claTimeList = claTimeRuleService.getClaTimeListByRule(claTimeRule, null); List<RespClaTimeRule> claTimeList = claTimeRuleService.getClaTimeListByRule(claTimeRule, null);
List<ScClaTime> timeList = claTimeList.stream().map(item -> { List<ScClaTime> timeList = claTimeList.stream().map(item -> {
if (
claTimeService.checkTeacherConflict(claTimeRule.getTeacherId(), item.getClaDate(), item.getClaTimeBegin(), item.getClaTimeEnd(), null)
||
claTimeService.checkClassroomConflict(claTimeRule.getRoomId(), item.getClaDate(), item.getClaTimeBegin(), item.getClaTimeEnd(), null)
){
throw new RuntimeException("存在教师或教室冲突,请重新选择上课时间");
}
ScClaTime claTime = new ScClaTime(); ScClaTime claTime = new ScClaTime();
claTime.setRuleId(claTimeRule.getRuleId()); claTime.setRuleId(claTimeRule.getRuleId());
claTime.setClaId(claTimeRule.getClaId()); claTime.setCourseId(claTimeRule.getCourseId());
claTime.setDeptId(claTimeRule.getDeptId());
claTime.setClaDate(item.getClaDate()); claTime.setClaDate(item.getClaDate());
claTime.setStartTime(item.getClaTimeBegin()); claTime.setStartTime(item.getClaTimeBegin());
claTime.setEndTime(item.getClaTimeEnd()); claTime.setEndTime(item.getClaTimeEnd());
@ -188,6 +191,9 @@ public class BusinessClaTimeRuleService {
claTime.setAtClassCnt(claTimeRule.getAtClassCnt()); claTime.setAtClassCnt(claTimeRule.getAtClassCnt());
claTime.setLessCnt(claTimeRule.getLessCnt()); claTime.setLessCnt(claTimeRule.getLessCnt());
claTime.setTeacherFee(course.getClaFee()); claTime.setTeacherFee(course.getClaFee());
claTime.setClaColor(claTimeRule.getClaColor());
claTime.setFontSize(claTimeRule.getFontSize());
claTime.setFontColor(claTimeRule.getFontColor());
// 排课 // 排课
claTime.setSource("1"); claTime.setSource("1");
// 待上课 // 待上课
@ -197,10 +203,11 @@ public class BusinessClaTimeRuleService {
claTime.setClassTheme(claTimeRule.getClassTheme()); claTime.setClassTheme(claTimeRule.getClassTheme());
claTime.setTeacherId(claTimeRule.getTeacherId()); claTime.setTeacherId(claTimeRule.getTeacherId());
claTime.setCreateUser(claTimeRule.getCreateUser()); claTime.setCreateUser(claTimeRule.getCreateUser());
claTime.setTenantId(courseCla.getTenantId()); claTime.setTenantId(course.getTenantId());
return claTime; return claTime;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
claTimeService.saveBatch(timeList); claTimeService.saveBatch(timeList);
} }
} }

@ -1,6 +1,5 @@
package com.ruoyi.school.course.service; package com.ruoyi.school.course.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -27,11 +26,13 @@ import com.ruoyi.school.room.domain.ScRoom;
import com.ruoyi.school.room.mapper.ScRoomMapper; import com.ruoyi.school.room.mapper.ScRoomMapper;
import com.ruoyi.school.room.service.IScRoomService; import com.ruoyi.school.room.service.IScRoomService;
import com.ruoyi.school.student.domain.req.ReqClaTimeAttend; import com.ruoyi.school.student.domain.req.ReqClaTimeAttend;
import com.ruoyi.school.student.domain.resp.RespCourseClaStudent;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
@ -49,8 +50,6 @@ public class BusinessClaTimeService {
@Autowired @Autowired
private IScRoomService roomService; private IScRoomService roomService;
@Autowired @Autowired
private IScCourseClaService claService;
@Autowired
private IScCourseService courseService; private IScCourseService courseService;
@Autowired @Autowired
private ScBookCourseMapper bookCourseMapper; private ScBookCourseMapper bookCourseMapper;
@ -83,19 +82,35 @@ public class BusinessClaTimeService {
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();
} }
// 日历数据 格式为:时间->星期->课程 // 1. 查询真实课表数据
List<RespClaTimeCalendar> respClaTimeList = claTimeMapper.selectListForCalendar(reqSearchClaTime);
// 2. 根据返回的 开始时间(startHour) + 时长(claDuration) 自动生成时间段 MAP
Map<Integer, String> AUTO_CLA_TIME_MAP = generateTimeMapFromData(respClaTimeList);
// 3. 使用自动生成的时间段构建日历结构
Map<Integer, Map<Integer, List<RespClaTimeCalendar>>> claTimeCalendarMap = Maps.newHashMap(); Map<Integer, Map<Integer, List<RespClaTimeCalendar>>> claTimeCalendarMap = Maps.newHashMap();
SysConstant.CLA_TIME_MAP.forEach((claTimeKey, claTimeValue) -> { AUTO_CLA_TIME_MAP.forEach((claTimeKey, claTimeValue) -> {
Map<Integer, List<RespClaTimeCalendar>> weekDayMap = Maps.newHashMap(); Map<Integer, List<RespClaTimeCalendar>> weekDayMap = Maps.newHashMap();
SysConstant.WEEK_DAY_MAP.forEach((weekDayKey, weekDay) -> { SysConstant.WEEK_DAY_MAP.forEach((weekDayKey, weekDay) -> {
List<RespClaTimeCalendar> claTimeArrayList = Lists.newArrayList(); weekDayMap.put(weekDayKey, Lists.newArrayList());
weekDayMap.put(weekDayKey, claTimeArrayList);
}); });
claTimeCalendarMap.put(claTimeKey, weekDayMap); claTimeCalendarMap.put(claTimeKey, weekDayMap);
}); });
// ======================================================
// 日历数据 格式为:时间->星期->课程
List<RespClaTimeCalendar> respClaTimeList = claTimeMapper.selectListForCalendar(reqSearchClaTime); // Map<Integer, Map<Integer, List<RespClaTimeCalendar>>> claTimeCalendarMap = Maps.newHashMap();
// SysConstant.CLA_TIME_MAP.forEach((claTimeKey, claTimeValue) -> {
// Map<Integer, List<RespClaTimeCalendar>> weekDayMap = Maps.newHashMap();
// SysConstant.WEEK_DAY_MAP.forEach((weekDayKey, weekDay) -> {
// List<RespClaTimeCalendar> claTimeArrayList = Lists.newArrayList();
// weekDayMap.put(weekDayKey, claTimeArrayList);
// });
// claTimeCalendarMap.put(claTimeKey, weekDayMap);
// });
//
//
// List<RespClaTimeCalendar> respClaTimeList = claTimeMapper.selectListForCalendar(reqSearchClaTime);
// 将排课信息 入到 claTimeCalendarMap // 将排课信息 入到 claTimeCalendarMap
respClaTimeList.forEach(item -> { respClaTimeList.forEach(item -> {
@ -120,7 +135,7 @@ public class BusinessClaTimeService {
// 每行数据 // 每行数据
claTimeCalendarMap.forEach((claTimeKey, claTimeMap) -> { claTimeCalendarMap.forEach((claTimeKey, claTimeMap) -> {
ClaTimeContainer claTimeContainer = new ClaTimeContainer(); ClaTimeContainer claTimeContainer = new ClaTimeContainer();
claTimeContainer.setTime(SysConstant.CLA_TIME_MAP.get(claTimeKey)); claTimeContainer.setTime(AUTO_CLA_TIME_MAP.get(claTimeKey));
Map<Integer, List<ClaTimeCalendarItem>> claTimeWeekDayMap = Maps.newHashMap(); Map<Integer, List<ClaTimeCalendarItem>> claTimeWeekDayMap = Maps.newHashMap();
claTimeMap.forEach((weekDayKey, list) -> { claTimeMap.forEach((weekDayKey, list) -> {
@ -142,17 +157,23 @@ public class BusinessClaTimeService {
claTimeContainer.setClaTimeWeekDayMap(claTimeWeekDayMap); claTimeContainer.setClaTimeWeekDayMap(claTimeWeekDayMap);
claTimeContainerList.add(claTimeContainer); claTimeContainerList.add(claTimeContainer);
}); });
Collections.sort(claTimeContainerList, (o1, o2) -> { // Collections.sort(claTimeContainerList, (o1, o2) -> {
int a = Integer.parseInt(o1.getTime().substring(0, 2)); // int a = Integer.parseInt(o1.getTime().substring(0, 2));
int b = Integer.parseInt(o2.getTime().substring(0, 2)); // int b = Integer.parseInt(o2.getTime().substring(0, 2));
if (a > b) { // if (a > b) {
return 1; // return 1;
} else if (a < b) { // } else if (a < b) {
return -1; // return -1;
} else { // } else {
return 0; // return 0;
} // }
}); // });
// 按小时正序排序
Collections.sort(claTimeContainerList, Comparator.comparingInt(o -> {
String time = o.getTime();
return Integer.parseInt(time.substring(0, 2));
}));
timeCalendar.setClaTimeContainer(claTimeContainerList); timeCalendar.setClaTimeContainer(claTimeContainerList);
@ -184,7 +205,12 @@ public class BusinessClaTimeService {
return claTimeMapper.selectListForCalendar(reqSearchClaTime); return claTimeMapper.selectListForCalendar(reqSearchClaTime);
} }
public APIResponse searchCourseClaStudent(ReqSearchClaTime reqSearchClaTime){
String courseTimeId=reqSearchClaTime.getCourseTimeId();
//预约的会员
List<RespCourseClaStudent> scStudentList= claTimeMapper.selectStudenForClaTime(courseTimeId);
return APIResponse.toAPIResponse(scStudentList);
}
/** /**
@ -244,8 +270,7 @@ public class BusinessClaTimeService {
claTime.setRoomName(room.getRoomName()); claTime.setRoomName(room.getRoomName());
} }
ScCourseCla courseCla = claService.getById(claTime.getClaId()); ScCourse course=courseService.getById(claTime.getCourseId());
ScCourse course=courseService.getById(courseCla.getCourseId());
claTime.setSource("3"); claTime.setSource("3");
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
claTime.setTeacherFee(course.getClaFee()); claTime.setTeacherFee(course.getClaFee());
@ -266,17 +291,12 @@ public class BusinessClaTimeService {
if (null == courseTimeId) { if (null == courseTimeId) {
return APIResponse.toAPIResponse(null); return APIResponse.toAPIResponse(null);
} }
ScClaTime claTime = claTimeService.getById(courseTimeId); // ScClaTime claTime = claTimeService.getById(courseTimeId);
Long claId = claTime.getClaId(); ScClaTimeVo scClaTimeVo =claTimeMapper.serlectByClaTimeId(courseTimeId);
if (null != claId) {
ScCourseCla courseCla = claService.getById(claId);
if (null != courseCla) {
claTime.setDeptId(courseCla.getDepartId());
}
}
ScClaTimeVo scClaTimeVo = new ScClaTimeVo(); // ScClaTimeVo scClaTimeVo = new ScClaTimeVo();
BeanUtil.copyProperties(claTime,scClaTimeVo); // BeanUtil.copyProperties(claTime,scClaTimeVo);
return APIResponse.toAPIResponse(scClaTimeVo); return APIResponse.toAPIResponse(scClaTimeVo);
} }
@ -295,11 +315,25 @@ public class BusinessClaTimeService {
return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL); return APIResponse.toExceptionResponse(ApiResEnums.PARAM_FAIL);
} }
ScCourseCla courseCla = claService.getById(claTime.getClaId()); if (
claTimeService.checkTeacherConflict(claTime.getTeacherId(),
claTime.getClaDate(),
claTime.getStartTime(),
claTime.getEndTime(),
claTime.getCourseTimeId())
||
claTimeService.checkClassroomConflict(new Long(claTime.getRoomId()),
claTime.getClaDate(),
claTime.getEndTime(),
claTime.getEndTime(),
claTime.getCourseTimeId())
){
throw new RuntimeException("存在教师或教室冲突,请重新选择上课时间");
}
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
//是否有会员预约 //是否有会员预约
Integer bookCount= claTimeService.selectBookCount(null, null,claTime.getCourseTimeId()); Integer bookCount= claTimeService.selectBookCount(null, claTime.getCourseTimeId());
if(bookCount.intValue()>0){ if(bookCount.intValue()>0){
return APIResponse.toExceptionResponse("无法修改:有会员预约,请联系会员取消预约后再作修改!"); return APIResponse.toExceptionResponse("无法修改:有会员预约,请联系会员取消预约后再作修改!");
@ -313,6 +347,9 @@ public class BusinessClaTimeService {
uw.set("room_name", room.getRoomName()); uw.set("room_name", room.getRoomName());
} }
uw.set("cla_date", claTime.getClaDate()); uw.set("cla_date", claTime.getClaDate());
uw.set("cla_color", claTime.getClaColor());
uw.set("font_size", claTime.getFontSize());
uw.set("font_color", claTime.getFontColor());
uw.set("start_time", claTime.getStartTime()); uw.set("start_time", claTime.getStartTime());
uw.set("end_time", claTime.getEndTime()); uw.set("end_time", claTime.getEndTime());
uw.set("teacher_id", claTime.getTeacherId()); uw.set("teacher_id", claTime.getTeacherId());
@ -345,7 +382,7 @@ public class BusinessClaTimeService {
return APIResponse.toExceptionResponse("已上课,无法删除"); return APIResponse.toExceptionResponse("已上课,无法删除");
} }
//是否有会员预约 //是否有会员预约
Integer bookCount= claTimeService.selectBookCount(null, null,claTime.getCourseTimeId().toString()); Integer bookCount= claTimeService.selectBookCount(null, claTime.getCourseTimeId().toString());
if(bookCount.intValue()>0){ if(bookCount.intValue()>0){
return APIResponse.toExceptionResponse("无法删除:相关课表中有会员预约,请联系会员取消预约后再进行操作!"); return APIResponse.toExceptionResponse("无法删除:相关课表中有会员预约,请联系会员取消预约后再进行操作!");
@ -440,5 +477,43 @@ public class BusinessClaTimeService {
log.setBookId(bookId); log.setBookId(bookId);
bookCourseLogMapper.insert(log); bookCourseLogMapper.insert(log);
} }
/**
* 2 MAP
*
* 1. 2
* 2.
* 3.
*/
private Map<Integer, String> generateTimeMapFromData(List<RespClaTimeCalendar> respClaTimeList) {
// TreeMap 自动按 key 升序排列
Map<Integer, String> timeMap = new TreeMap<>();
if (CollectionUtils.isEmpty(respClaTimeList)) {
timeMap=SysConstant.CLA_TIME_MAP;
return timeMap;
}
// 第一步收集所有【合法的2小时制开始小时】8、10、12、14、16、18...
Set<Integer> validStartHours = new HashSet<>();
for (RespClaTimeCalendar item : respClaTimeList) {
Integer startHour = item.getStartHour();
if (startHour == null) continue;
// 计算属于哪个2小时时段核心向下取整到偶数整点
int sectionStart = (startHour / 2) * 2;
// 限制在合理范围 0~24
if (sectionStart >= 0 && sectionStart <= 22) {
validStartHours.add(sectionStart);
}
}
// 第二步:生成 2小时间隔、不重叠 的时间段
for (Integer start : validStartHours) {
int end = start + 2;
String startTime = String.format("%02d:00", start);
String endTime = String.format("%02d:00", end);
timeMap.put(start, startTime + " ~ " + endTime);
}
return timeMap;
}
} }

@ -14,7 +14,6 @@ import com.ruoyi.core.api.ApiResEnums;
import com.ruoyi.mall.domain.Product; import com.ruoyi.mall.domain.Product;
import com.ruoyi.mall.service.ProductService; import com.ruoyi.mall.service.ProductService;
import com.ruoyi.school.course.domain.ScCourse; import com.ruoyi.school.course.domain.ScCourse;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.domain.ScCourseType; import com.ruoyi.school.course.domain.ScCourseType;
import com.ruoyi.school.course.domain.req.course.ReqAddScCourse; import com.ruoyi.school.course.domain.req.course.ReqAddScCourse;
import com.ruoyi.school.course.domain.req.course.ReqChangeScCourse; import com.ruoyi.school.course.domain.req.course.ReqChangeScCourse;
@ -94,7 +93,10 @@ public class BusinessScCourseService {
qw.like("course_name", reqSelect.getSearch()); qw.like("course_name", reqSelect.getSearch());
} }
qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId()); qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId());
qw.orderByDesc("create_time"); if (ObjectUtil.isNotEmpty(reqSelect.getDepartId())) {
qw.last(" and (JSON_CONTAINS(depart_id, CAST("+reqSelect.getDepartId()+" AS JSON)) or depart_id is null)");
}
// qw.orderByDesc("create_time");
List<ScCourse> list = scCourseService.list(qw); List<ScCourse> list = scCourseService.list(qw);
return APIResponse.toAPIResponse(list); return APIResponse.toAPIResponse(list);
} }
@ -123,7 +125,8 @@ public class BusinessScCourseService {
respScCourseDetail.setClaFee(detailInfo.getClaFee()); respScCourseDetail.setClaFee(detailInfo.getClaFee());
respScCourseDetail.setCourseCampus(ObjectUtil.isEmpty(detailInfo.getDepartId())?"全部校区":"部分校区"); respScCourseDetail.setCourseCampus(ObjectUtil.isEmpty(detailInfo.getDepartId())?"全部校区":"部分校区");
respScCourseDetail.setPartCampus(detailInfo.getDepartId()); respScCourseDetail.setPartCampus(detailInfo.getDepartId());
respScCourseDetail.setRemark(detailInfo.getRemark());
respScCourseDetail.setStar(detailInfo.getStar());
if(null != detailInfo.getCourseTypeId()) { if(null != detailInfo.getCourseTypeId()) {
ScCourseType courseType = courseTypeService.getById(detailInfo.getCourseTypeId()); ScCourseType courseType = courseTypeService.getById(detailInfo.getCourseTypeId());
@ -160,6 +163,8 @@ public class BusinessScCourseService {
scCourse.setClaFee(reqAddScCourse.getClaFee()); scCourse.setClaFee(reqAddScCourse.getClaFee());
scCourse.setDepartId(reqAddScCourse.getPartCampus()); scCourse.setDepartId(reqAddScCourse.getPartCampus());
scCourse.setTuitionFee(reqAddScCourse.getTuitionFee()); scCourse.setTuitionFee(reqAddScCourse.getTuitionFee());
scCourse.setRemark(reqAddScCourse.getRemark());
scCourse.setStar(reqAddScCourse.getStar());
boolean addScCourse = scCourseService.save(scCourse); boolean addScCourse = scCourseService.save(scCourse);
//默认班级 //默认班级
@ -196,13 +201,13 @@ public class BusinessScCourseService {
updateCourse.setSale("1"); updateCourse.setSale("1");
// updateCourse.setDepartId(reqChangeScCourse.getPartCampus()); // updateCourse.setDepartId(reqChangeScCourse.getPartCampus());
updateCourse.setImportId(-1L); updateCourse.setImportId(-1L);
updateCourse.setRemark(reqChangeScCourse.getRemark());
updateCourse.setStar(reqChangeScCourse.getStar());
boolean updateScCourse = scCourseService.updateById(updateCourse); boolean updateScCourse = scCourseService.updateById(updateCourse);
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();
} }
@Autowired
private IScCourseClaService courseClaService;
@Autowired @Autowired
private ScMemberCardCourseService cardCourseService; private ScMemberCardCourseService cardCourseService;
/** /**
@ -216,14 +221,6 @@ public class BusinessScCourseService {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE); return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
} }
// 如课程对应在用班级,不允许删除
QueryWrapper<ScCourseCla> qw = new QueryWrapper<>();
qw.in("course_id", courseIds);
int courseClaCount = courseClaService.count(qw);
if (courseClaCount != 0) {
return APIResponse.toExceptionResponse("该课程下存在在用班级,无法删除课程");
}
String arrayAsString = courseIds.stream() String arrayAsString = courseIds.stream()
.map(Object::toString) // 将Long转换为String .map(Object::toString) // 将Long转换为String
.collect(Collectors.joining(",")); // 使用逗号和空格连接字符串 .collect(Collectors.joining(",")); // 使用逗号和空格连接字符串

@ -75,6 +75,6 @@ public interface IScClaTimeRuleService extends IService<ScClaTimeRule> {
* @param claId * @param claId
* @return * @return
*/ */
List<String> selectClaTimeInfo(Long claId); List<String> selectClaTimeInfo(Long deptId,Long courseId);
} }

@ -21,7 +21,7 @@ public interface IScClaTimeService extends IService<ScClaTime> {
* @param tenantId * @param tenantId
* @return * @return
*/ */
boolean deleteUnBeginTime(Long ruleId, Long claId, String tenantId); boolean deleteUnBeginTime(Long ruleId, String tenantId);
/** /**
* *
@ -36,6 +36,28 @@ public interface IScClaTimeService extends IService<ScClaTime> {
* @param claId * @param claId
* @return * @return
*/ */
Integer selectBookCount( Long ruleId, Long claId,String courseTimeId); Integer selectBookCount( Long ruleId, String courseTimeId);
/**
*
* @param teacherId
* @param date
* @param startTime
* @param endTime
* @param excludeScheduleId
* @return
*/
boolean checkTeacherConflict(Long teacherId, String date, String startTime, String endTime, String excludeScheduleId);
/**
*
* @param classroomId
* @param date
* @param startTime
* @param endTime
* @param excludeSchedule
* @return
*/
boolean checkClassroomConflict(Long classroomId, String date, String startTime, String endTime, String excludeSchedule);
} }

@ -1,26 +0,0 @@
package com.ruoyi.school.course.service;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.core.api.APIBaseResponse;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-03-17 01:11:06
*/
public interface IScCourseClaService extends IService<ScCourseCla> {
/**
*
* @param claId
* @return
*/
APIBaseResponse canChangeCourse(Long claId);
}

@ -1,299 +0,0 @@
package com.ruoyi.school.course.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
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.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.page.RespPage;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.core.api.APIBaseResponse;
import com.ruoyi.core.api.APIResponse;
import com.ruoyi.core.api.ApiResEnums;
import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScCourse;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.domain.ScCourseClaVo;
import com.ruoyi.school.course.domain.req.cla.ReqAddScCourseCla;
import com.ruoyi.school.course.domain.req.cla.ReqSearchScCourseCla;
import com.ruoyi.school.course.domain.req.time.ReqSearchClaTime;
import com.ruoyi.school.course.domain.resp.cla.RespClaAllDetailInfo;
import com.ruoyi.school.course.domain.resp.cla.RespCourseClaInfo;
import com.ruoyi.school.course.domain.resp.course.ScCourseVo;
import com.ruoyi.school.course.mapper.ScCourseClaMapper;
import com.ruoyi.school.course.service.*;
import com.ruoyi.school.student.domain.resp.RespCourseClaStudent;
import com.ruoyi.school.student.service.IScStudentService;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
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 ScCourseClaMapper scCourseClaMapper;
@Autowired
private IScStudentService studentService;
@Autowired
private ISysDeptService deptService;
@Autowired
private IScClaTimeService claTimeService;
@Autowired
private ISysUserService userService;
//
public APIResponse searchCourseClaStudent(ReqSearchClaTime reqSearchClaTime){
String courseTimeId=reqSearchClaTime.getCourseTimeId();
//预约的会员
List<RespCourseClaStudent> scStudentList= scCourseClaMapper.selectStudenForClaTime(courseTimeId);
return APIResponse.toAPIResponse(scStudentList);
}
/**
*
*
* @param reqSearchScCourseCla
* @return
*/
public APIResponse searchList(ReqSearchScCourseCla reqSearchScCourseCla) {
com.ruoyi.common.page.RespPage<RespCourseClaInfo> page = new RespPage<>(reqSearchScCourseCla.getPageNum(), reqSearchScCourseCla.getPageSize());
String nowTenantId = SecurityUtils.getLoginUser().getNowTenantId();
reqSearchScCourseCla.setTenantId(nowTenantId);
List<RespCourseClaInfo> 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<String, Object> resultMap = Maps.newHashMap();
// 班级信息
ScCourseCla detailInfo = scCourseClaService.getById(claId);
if (null == detailInfo) {
return APIResponse.toAPIResponse(null);
}
ScCourseClaVo scCourseCla = new ScCourseClaVo();
BeanUtil.copyProperties(detailInfo,scCourseCla);
scCourseCla.setClaId(detailInfo.getClaId().toString());
scCourseCla.setCourseId(detailInfo.getCourseId().toString());
// 课程信息
ScCourse scCourse = courseService.getById(detailInfo.getCourseId());
ScCourseVo scCourseVo = new ScCourseVo();
BeanUtil.copyProperties(scCourse,scCourseVo);
scCourseVo.setCourseId(scCourse.getCourseId().toString());
// 是否允许变更课程,有报名不允许变更课程
APIBaseResponse canChangeCourse = scCourseClaService.canChangeCourse(claId);
resultMap.put("canChangeCourse", canChangeCourse.isSuccess());
resultMap.put("claInfo", scCourseCla);
resultMap.put("claCourseInfo", scCourseVo);
return APIResponse.toAPIResponse(resultMap);
}
@Autowired
private IScClaTimeRuleService claTimeRuleService;
/**
*
*
* @param claId
* @return
*/
public RespClaAllDetailInfo allDetailInfoById(Long claId) {
if (null == claId) {
return null;
}
// 班级信息
ScCourseCla courseCla = scCourseClaService.getById(claId);
if (null == courseCla) {
return null;
}
ScCourseClaVo scCourseClaVo = new ScCourseClaVo();
BeanUtil.copyProperties(courseCla,scCourseClaVo);
scCourseClaVo.setClaId(courseCla.getClaId().toString());
// 课程信息
ScCourse scCourse = courseService.getById(courseCla.getCourseId());
ScCourseVo scCourseVo = new ScCourseVo();
BeanUtil.copyProperties(scCourse,scCourseVo);
scCourseVo.setCourseId(scCourse.getCourseId().toString());
// 校区
if (null != courseCla.getDepartId()) {
SysDept sysDept = deptService.getById(courseCla.getDepartId());
scCourseClaVo.setDeptName(sysDept.getDeptName());
}
// 教练
if (null != courseCla.getStaffId()) {
SysUser staff = userService.selectUserById(courseCla.getStaffId());
scCourseClaVo.setTeacherName(staff.getNickName());
}
// 上课时间
List<String> claTimeInfo = claTimeRuleService.selectClaTimeInfo(claId);
return RespClaAllDetailInfo.builder()
.courseCla(scCourseClaVo)
.course(scCourseVo)
.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("课程不存在,请重新选择后提交。");
}
// 新建班级
ScCourseCla cla = scCourseCla.getScCourseCla(loginUser);
// 教练是否存在
SysUser teacher = userService.selectUserById(scCourseCla.getStaffId());
if (ObjectUtil.isEmpty(teacher)) {
return APIResponse.toExceptionResponse("教练不存在,请重新选择后提交。");
}
cla.setTeacherName(teacher.getNickName());
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("课程不存在,请重新选择后提交。");
}
// 教练是否存在
SysUser teacher = userService.selectUserById(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.setTeacherName(teacher.getNickName());
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<ScClaTime> 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);
}
}
}

@ -293,7 +293,7 @@ public class ScClaTimeRuleServiceImpl extends ServiceImpl<ScClaTimeRuleMapper, S
} }
@Override @Override
public List<String> selectClaTimeInfo(Long claId) { public List<String> selectClaTimeInfo(Long deptId,Long courseId) {
return baseMapper.selectClaTimeInfo(claId); return baseMapper.selectClaTimeInfo(deptId,courseId);
} }
} }

@ -21,12 +21,10 @@ import org.springframework.stereotype.Service;
public class ScClaTimeServiceImpl extends ServiceImpl<ScClaTimeMapper, ScClaTime> implements IScClaTimeService { public class ScClaTimeServiceImpl extends ServiceImpl<ScClaTimeMapper, ScClaTime> implements IScClaTimeService {
@Override @Override
public boolean deleteUnBeginTime(Long ruleId, Long claId, String tenantId) { public boolean deleteUnBeginTime(Long ruleId, String tenantId) {
UpdateWrapper uw = new UpdateWrapper(); UpdateWrapper uw = new UpdateWrapper();
uw.eq("rule_id", ruleId); uw.eq("rule_id", ruleId);
uw.eq("cla_id", claId);
uw.in("status", "1"); 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); return this.remove(uw);
} }
@ -35,8 +33,27 @@ public class ScClaTimeServiceImpl extends ServiceImpl<ScClaTimeMapper, ScClaTime
return baseMapper.selectClaTimeCount(reqClaTimeCount); return baseMapper.selectClaTimeCount(reqClaTimeCount);
} }
public Integer selectBookCount( Long ruleId, Long claId,String courseTimeId){ public Integer selectBookCount( Long ruleId, String courseTimeId){
return baseMapper.selectBookCount(ruleId,claId,courseTimeId, SecurityUtils.getLoginUser().getNowTenantId()); return baseMapper.selectBookCount(ruleId,courseTimeId, SecurityUtils.getLoginUser().getNowTenantId());
} }
// 检查教师冲突
public boolean checkTeacherConflict(Long teacherId, String date, String startTime, String endTime, String excludeScheduleId) {
// 查询该教师在同一天内,时间段重叠的排期
int i= baseMapper.checkTeacherConflict(teacherId, date, startTime, endTime, excludeScheduleId);
if(i>0){
return true;
}
return false;
}
// 检查教室冲突
public boolean checkClassroomConflict(Long classroomId, String date, String startTime, String endTime, String excludeScheduleId) {
// 查询该教室在同一天内,时间段重叠的排期
int i= baseMapper.checkClassroomConflict(classroomId, date, startTime, endTime, excludeScheduleId);
if(i>0){
return true;
}
return false;
}
} }

@ -1,46 +0,0 @@
package com.ruoyi.school.course.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.core.api.APIBaseResponse;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.mapper.ScCourseClaMapper;
import com.ruoyi.school.course.service.IScClaTimeService;
import com.ruoyi.school.course.service.IScCourseClaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-03-17 01:11:06
*/
@Service
public class ScCourseClaServiceImpl extends ServiceImpl<ScCourseClaMapper, ScCourseCla> implements IScCourseClaService {
@Autowired
private IScClaTimeService claTimeService;
//todo 当前是否有人预约
@Override
public APIBaseResponse canChangeCourse(Long claId) {
// QueryWrapper<ScStudentCourse> qw = new QueryWrapper<>();
// qw.eq("cla_id", claId);
// int count = studentCourseService.count(qw);
// if (count != 0) {
// return APIBaseResponse.fail("当前班级有报读会员,无法变更所属课程.");
// }
//
// QueryWrapper<ScClaTime> 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();
}
}

@ -5,12 +5,10 @@ import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.school.course.domain.ScCourse; import com.ruoyi.school.course.domain.ScCourse;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.domain.req.time.ReqClaTimeCount; import com.ruoyi.school.course.domain.req.time.ReqClaTimeCount;
import com.ruoyi.school.course.enums.ClaTimeAttendStatusEnums; import com.ruoyi.school.course.enums.ClaTimeAttendStatusEnums;
import com.ruoyi.school.course.service.IScClaTimeAttendService; import com.ruoyi.school.course.service.IScClaTimeAttendService;
import com.ruoyi.school.course.service.IScClaTimeService; import com.ruoyi.school.course.service.IScClaTimeService;
import com.ruoyi.school.course.service.IScCourseClaService;
import com.ruoyi.school.course.service.IScCourseService; import com.ruoyi.school.course.service.IScCourseService;
import com.ruoyi.school.dashboard.domain.resp.DashboardData; import com.ruoyi.school.dashboard.domain.resp.DashboardData;
import com.ruoyi.school.member.domain.ScStudent; import com.ruoyi.school.member.domain.ScStudent;
@ -42,8 +40,7 @@ public class DashboardService {
@Autowired @Autowired
private IScOrderService orderService; private IScOrderService orderService;
@Autowired
private IScCourseClaService claService;
@Autowired @Autowired
private IScClaTimeService claTimeService; private IScClaTimeService claTimeService;
@ -66,7 +63,6 @@ public class DashboardService {
String thisMonthEnd = DateUtil.endOfMonth(DateTime.now()).toString("yyyy-MM-dd"); String thisMonthEnd = DateUtil.endOfMonth(DateTime.now()).toString("yyyy-MM-dd");
String tenantId=SecurityUtils.getLoginUser().getNowTenantId(); String tenantId=SecurityUtils.getLoginUser().getNowTenantId();
int claCnt = claService.count(new QueryWrapper<ScCourseCla>().eq("tenant_id",tenantId));
int courseCnt = courseService.count(new QueryWrapper<ScCourse>().eq("tenant_id",tenantId)); int courseCnt = courseService.count(new QueryWrapper<ScCourse>().eq("tenant_id",tenantId));
int studentCnt = studentService.count(new QueryWrapper<ScStudent>().eq("tenant_id",tenantId)); int studentCnt = studentService.count(new QueryWrapper<ScStudent>().eq("tenant_id",tenantId));
//排课数 //排课数
@ -104,7 +100,7 @@ public class DashboardService {
// .todayNeedCostHour(todayNeedCostHour) // .todayNeedCostHour(todayNeedCostHour)
.todayRealCostHour(todayRealCostHour) .todayRealCostHour(todayRealCostHour)
.studentCnt(studentCnt) .studentCnt(studentCnt)
.claCnt(claCnt) // .claCnt(claCnt)
.courseCnt(courseCnt) .courseCnt(courseCnt)
.feeWillExpireCnt(feeWillExpireCnt) .feeWillExpireCnt(feeWillExpireCnt)
.dateWillExpireCnt(dateWillExpireCnt) .dateWillExpireCnt(dateWillExpireCnt)

@ -45,6 +45,7 @@ public interface ScMemberCardMapper extends BaseMapper<ScMemberCard> {
@Select("SELECT count(1) FROM sc_member_cards WHERE remaining_total_fee <= #{fee} AND status = 'ACTIVE' AND is_deleted = 0") @Select("SELECT count(1) FROM sc_member_cards WHERE remaining_total_fee <= #{fee} AND status = 'ACTIVE' AND is_deleted = 0")
Integer selectFeeWillExpireCards(@Param("fee") Integer fee); Integer selectFeeWillExpireCards(@Param("fee") Integer fee);
@Select("SELECT count(1) FROM sc_member_cards WHERE remaining_count <= #{hour} AND status = 'ACTIVE' AND is_deleted = 0") @Select("SELECT count(1) FROM sc_member_cards WHERE remaining_count <= #{hour} AND status = 'ACTIVE' AND is_deleted = 0")
Integer selectHourWillExpireCards(@Param("hour") Integer hour); Integer selectHourWillExpireCards(@Param("hour") Integer hour);

@ -1,14 +1,11 @@
package com.ruoyi.school.member.service; package com.ruoyi.school.member.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.core.api.APIResponse;
import com.ruoyi.school.course.domain.req.course.ReqBusinessOrderCourseDetail;
import com.ruoyi.school.member.domain.ScMemberCardTypes; import com.ruoyi.school.member.domain.ScMemberCardTypes;
public interface ScMemberCardTypesService extends IService<ScMemberCardTypes> { public interface ScMemberCardTypesService extends IService<ScMemberCardTypes> {
APIResponse orderCardTypeDetail(ReqBusinessOrderCourseDetail orderCourseDetail);
void memberTypeDetail(ScMemberCardTypes l); void memberTypeDetail(ScMemberCardTypes l);
} }

@ -11,10 +11,12 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.page.RespPage; import com.ruoyi.common.page.RespPage;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.core.api.APIResponse; import com.ruoyi.core.api.APIResponse;
import com.ruoyi.school.course.domain.*; import com.ruoyi.school.course.domain.ScBookCourse;
import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScClaTimeAttend;
import com.ruoyi.school.course.domain.ScCourse;
import com.ruoyi.school.course.enums.ClaTimeStatusEnums; import com.ruoyi.school.course.enums.ClaTimeStatusEnums;
import com.ruoyi.school.course.mapper.ScClaTimeMapper; import com.ruoyi.school.course.mapper.ScClaTimeMapper;
import com.ruoyi.school.course.mapper.ScCourseClaMapper;
import com.ruoyi.school.course.mapper.ScCourseMapper; import com.ruoyi.school.course.mapper.ScCourseMapper;
import com.ruoyi.school.course.service.IScClaTimeAttendService; import com.ruoyi.school.course.service.IScClaTimeAttendService;
import com.ruoyi.school.course.service.impl.ScBookCourseServiceImpl; import com.ruoyi.school.course.service.impl.ScBookCourseServiceImpl;
@ -225,8 +227,6 @@ public class ScMemberCardServiceImpl extends ServiceImpl<ScMemberCardMapper, ScM
@Autowired @Autowired
private ScClaTimeMapper claTimeMapper; private ScClaTimeMapper claTimeMapper;
@Autowired @Autowired
private ScCourseClaMapper claMapper;
@Autowired
private ScCourseMapper courseMapper; private ScCourseMapper courseMapper;
@Autowired @Autowired
private IScClaTimeAttendService attendService; private IScClaTimeAttendService attendService;
@ -249,19 +249,13 @@ public class ScMemberCardServiceImpl extends ServiceImpl<ScMemberCardMapper, ScM
if (!ClaTimeStatusEnums.WAIT_CLASS.getStatus().equals(claTime.getStatus())) { if (!ClaTimeStatusEnums.WAIT_CLASS.getStatus().equals(claTime.getStatus())) {
return APIResponse.toExceptionResponse("课程非 待上课 状态,无法签到!"); return APIResponse.toExceptionResponse("课程非 待上课 状态,无法签到!");
} }
//班级信息
Long claId = claTime.getClaId();
ScCourseCla dbCla = claMapper.selectById(claId);
if (null == dbCla) {
return APIResponse.toExceptionResponse("无法获取班级信息,请稍后重试");
}
//课程信息 //课程信息
Long courseId = dbCla.getCourseId(); Long courseId = claTime.getCourseId();
ScCourse scCourse = courseMapper.selectById(courseId); ScCourse scCourse = courseMapper.selectById(courseId);
if (null == scCourse) { if (null == scCourse) {
return APIResponse.toExceptionResponse("无法获取课程信息,请稍后重试"); return APIResponse.toExceptionResponse("无法获取课程信息,请稍后重试");
} }
Long departId = dbCla.getDepartId(); Long departId = claTime.getDeptId();
SysDept sysDept = deptService.getById(departId); SysDept sysDept = deptService.getById(departId);
if (null == sysDept) { if (null == sysDept) {
return APIResponse.toExceptionResponse("无法获取校区信息,请稍后重试"); return APIResponse.toExceptionResponse("无法获取校区信息,请稍后重试");
@ -669,4 +663,6 @@ public class ScMemberCardServiceImpl extends ServiceImpl<ScMemberCardMapper, ScM
// .map(this::convertToVO) // .map(this::convertToVO)
// .collect(Collectors.toList()); // .collect(Collectors.toList());
// } // }
} }

@ -74,32 +74,6 @@ public class ScMemberCardTypesServiceImpl extends ServiceImpl<ScMemberCardTypesM
} }
} }
@Override
public APIResponse orderCardTypeDetail(ReqBusinessOrderCourseDetail orderCourseDetail){
Long cardTypeId = orderCourseDetail.getCardTypeId();
Long studentId = orderCourseDetail.getStudentId();
if (null == cardTypeId ) {
return APIResponse.toExceptionResponse("请选择会员卡项");
}
if (null == studentId) {
return APIResponse.toExceptionResponse("请选择会员");
}
ScMemberCardTypes memberCardType=this.getById(cardTypeId);
//是否为续报
List<MemberCardVO> memberCardVOS= memberCardService.getMemberCards(studentId);
RespBusinessChooseCourseInfo chooseCourseInfo = RespBusinessChooseCourseInfo.builder()
.cardTypeId(memberCardType.getCardTypeId())
.cardTypeName(memberCardType.getCardName())
.continueCourse(memberCardVOS.size()>0?true:false)
// .deptId(sysDept.getDeptId())
// .deptName(sysDept.getDeptName())
// .teachingMode(scCourse.getTeachingMode())
.build();
return APIResponse.toAPIResponse(chooseCourseInfo);
}
} }

@ -120,6 +120,7 @@ public class BusinessScStudentService {
appUser.setNickName(scStudent.getStudentName()); appUser.setNickName(scStudent.getStudentName());
appUser.setPhoneNumber(scStudent.getPhone()); appUser.setPhoneNumber(scStudent.getPhone());
appUser.setPassword(SecurityUtils.encryptPassword(scStudent.getPhone())); appUser.setPassword(SecurityUtils.encryptPassword(scStudent.getPhone()));
appUser.setVisitStore(SecurityUtils.getLoginUser().getDeptId());
appUser.setStatus(1); appUser.setStatus(1);
appUserService.save(appUser); appUserService.save(appUser);
} }

@ -5,10 +5,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.school.course.domain.ScClaTime; import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScClaTimeRule; import com.ruoyi.school.course.domain.ScClaTimeRule;
import com.ruoyi.school.course.domain.ScCourseCla;
import com.ruoyi.school.course.service.IScClaTimeRuleService; import com.ruoyi.school.course.service.IScClaTimeRuleService;
import com.ruoyi.school.course.service.IScClaTimeService; import com.ruoyi.school.course.service.IScClaTimeService;
import com.ruoyi.school.course.service.IScCourseClaService;
import com.ruoyi.school.member.domain.ScMemberCardTypes; import com.ruoyi.school.member.domain.ScMemberCardTypes;
import com.ruoyi.school.member.service.ScMemberCardTypesService; import com.ruoyi.school.member.service.ScMemberCardTypesService;
import com.ruoyi.system.domain.columns.SysTeacher; import com.ruoyi.system.domain.columns.SysTeacher;
@ -33,8 +31,7 @@ public class SysTeacherServiceImpl implements ISysTeacherService
@Autowired @Autowired
private SysTeacherMapper sysTeacherMapper; private SysTeacherMapper sysTeacherMapper;
@Autowired
private IScCourseClaService claService;
@Autowired @Autowired
private IScClaTimeRuleService claTimeRuleService; private IScClaTimeRuleService claTimeRuleService;
@Autowired @Autowired
@ -138,10 +135,7 @@ public class SysTeacherServiceImpl implements ISysTeacherService
public boolean isUsed(List<Long> userIds){ public boolean isUsed(List<Long> userIds){
int claCount=claService.count(new QueryWrapper<ScCourseCla>().in("staff_id", userIds));
if (claCount>0 ){
return true;
}
int timeRuleCount=claTimeRuleService.count(new QueryWrapper<ScClaTimeRule>().in("teacher_id",userIds)); int timeRuleCount=claTimeRuleService.count(new QueryWrapper<ScClaTimeRule>().in("teacher_id",userIds));
if (timeRuleCount>0 ){ if (timeRuleCount>0 ){
return true; return true;

@ -14,9 +14,9 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdGenerator; import com.ruoyi.common.utils.uuid.IdGenerator;
import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScCourse; import com.ruoyi.school.course.domain.ScCourse;
import com.ruoyi.school.course.domain.ScCourseCla; import com.ruoyi.school.course.service.IScClaTimeService;
import com.ruoyi.school.course.service.IScCourseClaService;
import com.ruoyi.school.course.service.IScCourseService; import com.ruoyi.school.course.service.IScCourseService;
import com.ruoyi.school.room.domain.ScRoom; import com.ruoyi.school.room.domain.ScRoom;
import com.ruoyi.school.room.service.IScRoomService; import com.ruoyi.school.room.service.IScRoomService;
@ -54,7 +54,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> imp
@Autowired @Autowired
private IScCourseService courseService; private IScCourseService courseService;
@Autowired @Autowired
private IScCourseClaService claService; private IScClaTimeService claTimeService;
@Autowired @Autowired
private IScRoomService roomService; private IScRoomService roomService;
@ -66,8 +66,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> imp
if (courseCount>0){ if (courseCount>0){
return true; return true;
} }
int claCount= claService.count(new QueryWrapper<ScCourseCla>() //已排课
.eq("depart_id",deptId)); int claCount= claTimeService.count(new QueryWrapper<ScClaTime>()
.eq("dept_id",deptId));
if (claCount>0){ if (claCount>0){
return true; return true;
} }
@ -265,7 +266,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> imp
throw new ServiceException("部门停用,不允许新增"); throw new ServiceException("部门停用,不允许新增");
} }
dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
dept.setTenantId(SecurityUtils.getLoginUser().getNowTenantId()); dept.setTenantId(info.getTenantId());
dept.setDeptId(IdGenerator.nextId()); dept.setDeptId(IdGenerator.nextId());
int i= deptMapper.insertDept(dept); int i= deptMapper.insertDept(dept);
if (dept.getDeptType().equals("2")){ if (dept.getDeptType().equals("2")){

@ -167,6 +167,8 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
sysDept.setDeptType("2");//默认为校区 sysDept.setDeptType("2");//默认为校区
sysDept.setParentId(0l); sysDept.setParentId(0l);
sysDept.setAncestors("0"); sysDept.setAncestors("0");
sysDept.setActivationDate(sysTenant.getBeginTime().toString());
sysDept.setExpiryDate(sysTenant.getEndTime().toString());
sysDept.setDeptId(IdGenerator.nextId()); sysDept.setDeptId(IdGenerator.nextId());
deptMapper.insertDept(sysDept); deptMapper.insertDept(sysDept);

@ -262,6 +262,7 @@ public class SysUserServiceImpl implements ISysUserService
appUser.setPassword(user.getPassword()); appUser.setPassword(user.getPassword());
appUser.setStatus(1); appUser.setStatus(1);
appUser.setManageAccountId(user.getStatus().equals("0")?user.getUserId():null); appUser.setManageAccountId(user.getStatus().equals("0")?user.getUserId():null);
appUser.setVisitStore(user.getDeptId());
appUserService.save(appUser); appUserService.save(appUser);
}else { }else {
if (user.getStatus().equals("0")) if (user.getStatus().equals("0"))
@ -391,6 +392,10 @@ public class SysUserServiceImpl implements ISysUserService
//修改关联app账号 //修改关联app账号
if (user.getStatus().equals("1")){ if (user.getStatus().equals("1")){
removeAppUserManager(user.getUserId()); removeAppUserManager(user.getUserId());
SysTeacher teacher=new SysTeacher();
teacher.setUserId(teacher.getUserId());
teacher.setReleases(0);
teacherService.updateSysTeacher(teacher);
}else { }else {
addAppUserManager(user.getUserId()); addAppUserManager(user.getUserId());
} }

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mall.mapper.ProductShowMapper">
<select id="selectProductShowList" resultType="com.ruoyi.mall.domain.vo.ProductShowVO">
SELECT
a.*,
p.name AS product_name,
s.store_name,
t.tenant_name,
c.type_name AS product_category_name
FROM mall_product_show a
LEFT JOIN mall_product p ON a.product_id = p.id
LEFT JOIN yj_store s ON a.store_id = s.dept_id
LEFT JOIN sys_tenant t ON a.tenant_id = t.tenant_id
LEFT JOIN mall_product_category c ON a.show_category = c.id
WHERE 1=1
<if test="tenantId != null and tenantId != ''">
and a.tenant_id = #{tenantId}
</if>
<if test="storeId != null ">
and a.store_id =#{storeId}
</if>
<if test="productName != null and productName != ''">
and p.name like concat('%',#{productName},'%')
</if>
<if test="productName != null and productName != ''">
and p.name like concat('%',#{productName},'%')
</if>
<if test="storeName != null and storeName != ''">
and s.store_name like concat('%',#{storeName},'%')
</if>
<if test="showFlag != null AND showFlag !=''">
and a.show_flag =#{showFlag}
</if>
<if test="applyStatus != null AND applyStatus !=''">
and a.apply_status =#{applyStatus}
</if>
ORDER BY a.apply_time DESC,a.sort ASC
</select>
<update id="onSaleProductShow" parameterType="int">
UPDATE mall_product_show
SET show_flag = '1', apply_status = '3'
WHERE show_start_time = CURDATE();
</update>
<update id="expireProductShow" parameterType="int">
UPDATE mall_product_show
SET show_flag = '0', apply_status = '4'
WHERE show_end_time = DATE_SUB(CURDATE(), INTERVAL 1 DAY);
</update>
</mapper>

@ -9,9 +9,7 @@
a.id as book_id, a.id as book_id,
a.book_status, a.book_status,
c.course_time_id, c.course_time_id,
b.cla_name, c.cla_color,
b.cla_color,
b.cla_pic,
c.cla_date, c.cla_date,
c.start_time, c.start_time,
c.end_time, c.end_time,
@ -22,13 +20,11 @@
d.store_name d.store_name
from from
sc_book_course a, sc_book_course a,
sc_course_cla b,
sc_cla_time c, sc_cla_time c,
yj_store d yj_store d
where b.cla_id=c.cla_id and a.course_time_id =c.course_time_id where a.course_time_id =c.course_time_id
and b.depart_id=d.dept_id and c.dept_id=d.dept_id
and a.student_id=#{studentId} and a.student_id=#{studentId}
ORDER BY a.create_time ORDER BY a.create_time
</select> </select>
@ -47,20 +43,17 @@
b.start_time, b.start_time,
b.end_time, b.end_time,
c.teacher_name, c.teacher_name,
d.cla_name,
e.store_name e.store_name
from from
sc_book_course a, sc_book_course a,
sc_cla_time b, sc_cla_time b,
sys_teacher c, sys_teacher c,
sc_course_cla d,
yj_store e yj_store e
WHERE a.course_time_id=b.course_time_id WHERE a.course_time_id=b.course_time_id
and b.teacher_id=c.user_id and b.teacher_id=c.user_id
and b.cla_id=d.cla_id and b.dept_id=e.dept_id
and d.depart_id=e.dept_id
and a.id=#{bookId} and a.id=#{bookId}
</select> </select>
</mapper> </mapper>

@ -12,12 +12,10 @@
cta.pay_hour, cta.pay_hour,
cta.pay_fee, cta.pay_fee,
cta.memo, cta.memo,
ct.real_cla_date,ct.real_start_time,ct.real_end_time,cta.create_time, ct.real_cla_date,ct.real_start_time,ct.real_end_time,cta.create_time
scc.cla_name
from sc_cla_time_attend cta from sc_cla_time_attend cta
left join sc_student s on cta.student_id=s.student_id left join sc_student s on cta.student_id=s.student_id
left join sc_cla_time ct on cta.course_time_id=ct.course_time_id left join sc_cla_time ct on cta.course_time_id=ct.course_time_id
left join sc_course_cla scc on cta.cla_id=scc.cla_id
where s.tenant_id=#{reqSearchScClaTimeAttend.tenantId} where s.tenant_id=#{reqSearchScClaTimeAttend.tenantId}
<if test="reqSearchScClaTimeAttend.courseTimeId != null"> <if test="reqSearchScClaTimeAttend.courseTimeId != null">
and cta.course_time_id=#{reqSearchScClaTimeAttend.courseTimeId} and cta.course_time_id=#{reqSearchScClaTimeAttend.courseTimeId}
@ -35,7 +33,7 @@
and cta.attend_status=#{reqSearchScClaTimeAttend.attendStatus} and cta.attend_status=#{reqSearchScClaTimeAttend.attendStatus}
</if> </if>
<if test="reqSearchScClaTimeAttend.deptId != null"> <if test="reqSearchScClaTimeAttend.deptId != null">
and scc.depart_id=#{reqSearchScClaTimeAttend.deptId} and ct.dept_id=#{reqSearchScClaTimeAttend.deptId}
</if> </if>
order by cta.attend_id desc order by cta.attend_id desc
</select> </select>
@ -73,35 +71,19 @@
and expiry_date > CURDATE() and expiry_date > CURDATE()
and tenant_id=#{tenantId} and tenant_id=#{tenantId}
</select> </select>
<select id="selectNeedAttendCostHour" resultType="java.math.BigDecimal">
select ifnull(sum(ct.pay_hour),0)
from sc_course_cla cc,sc_cla_time ct,sc_student_course sc
where ct.cla_date between #{beginDate} and #{endDate}
and ct.cla_id=cc.cla_id
and cc.cla_id=sc.cla_id
and cc.tenant_id=#{tenantId}
and sc.status='1'
and (sc.charge_type in ('hour','cycle')
or (charge_type='date' and exists(
select 1 from sc_student_course_order sco
where sc.student_course_id=sco.student_course_id
and sco.valid=1
and date_format(now(),'%Y-%m-%d') between sco.begin_date and sco.end_date)))
</select>
<select id="selectTeacherSumGetHour" resultType="java.math.BigDecimal"> <select id="selectTeacherSumGetHour" resultType="java.math.BigDecimal">
select ifnull(sum(b.teacher_get_hour),0) from sc_course_cla a,sc_cla_time_attend b select ifnull(sum(b.teacher_get_hour),0) from sc_cla_time a,sc_cla_time_attend b
where a.delete_flag='0' and a.cla_id=b.cla_id and b.teacher_id=#{teacherId} and b.charge_type <![CDATA[ <> ]]> 'date' where a.course_time_id=b.course_time_id
and exists(select 1 from sc_cla_time c and b.teacher_id=#{teacherId}
where b.course_time_id=c.course_time_id and b.charge_type <![CDATA[ <> ]]> 'date'
and c.real_cla_date between #{beginDate} and #{endDate} ) and b.real_cla_date between #{beginDate} and #{endDate}
<if test="deptId != null"> <if test="deptId != null">
and a.depart_id=#{deptId} and a.dept_id=#{deptId}
</if> </if>
<if test="deptId == null and userId != null and userId != ''"> <if test="deptId == null and userId != null and userId != ''">
and exists(select 1 from sys_user_dept ud and exists(select 1 from sys_user_dept ud
where ud.user_id=#{userId} where ud.user_id=#{userId}
and (ud.dept_id=a.depart_id or ud.dept_id=-1)) and (ud.dept_id=a.dept_id or ud.dept_id=-1))
</if> </if>
</select> </select>
</mapper> </mapper>

@ -4,7 +4,6 @@
<select id="selectListForCalendar" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeCalendar"> <select id="selectListForCalendar" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeCalendar">
select b.course_time_id, select b.course_time_id,
b.cla_id,
b.cla_date, b.cla_date,
WEEKDAY(b.cla_date) + 1 as week_day, WEEKDAY(b.cla_date) + 1 as week_day,
hour(b.start_time) as start_hour, hour(b.start_time) as start_hour,
@ -14,8 +13,9 @@
b.status, b.status,
b.memo, b.memo,
b.class_theme, b.class_theme,
a.cla_name, b.cla_color,
a.cla_color, b.font_size,
b.font_color,
course.course_name, course.course_name,
s.user_id as teacher_id, s.user_id as teacher_id,
s.nick_name as staff_name, s.nick_name as staff_name,
@ -25,32 +25,29 @@
b.less_cnt, b.less_cnt,
b.at_class_cnt b.at_class_cnt
from sc_course_cla a from sc_cla_time b
left join sc_course course on a.course_id=course.course_id left join sc_course course on b.course_id=course.course_id
,sc_cla_time b
left join sys_user s on b.teacher_id = s.user_id left join sys_user s on b.teacher_id = s.user_id
left join sc_room r on b.room_id = r.room_id left join sc_room r on b.room_id = r.room_id
where a.cla_id=b.cla_id and course.tenant_id=#{tenantId} where course.tenant_id=#{tenantId}
<if test="courseTimeId != null"> <if test="courseTimeId != null">
and b.course_time_id=#{courseTimeId} and b.course_time_id=#{courseTimeId}
</if> </if>
<if test="beginDate != null and beginDate != '' and endDate != null and endDate != ''"> <if test="beginDate != null and beginDate != '' and endDate != null and endDate != ''">
and b.cla_date between #{beginDate} and #{endDate} and b.cla_date between #{beginDate} and #{endDate}
</if> </if>
<if test="claId != null">
and a.cla_id=#{claId}
</if>
<if test="deptId != null"> <if test="deptId != null">
and a.depart_id=#{deptId} and b.dept_id=#{deptId}
</if> </if>
<if test="teacherId != null"> <if test="teacherId != null">
and b.teacher_id=#{teacherId} and b.teacher_id=#{teacherId}
</if> </if>
<if test="courseId != null"> <if test="courseId != null">
and a.course_id = #{courseId} and b.course_id = #{courseId}
</if> </if>
<if test="courseIds!= null"> <if test="courseIds!= null">
and a.course_id in and b.course_id in
<foreach item="id" collection="courseIds" open="(" separator="," close=")"> <foreach item="id" collection="courseIds" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -66,8 +63,6 @@
<select id="selectListForAttend" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTime"> <select id="selectListForAttend" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTime">
select ct.course_time_id, select ct.course_time_id,
ct.cla_id,
cc.cla_name,
course.course_id, course.course_id,
course.course_name, course.course_name,
ct.teacher_id, ct.teacher_id,
@ -86,31 +81,27 @@
ct.at_class_cnt, ct.at_class_cnt,
ct.less_cnt, ct.less_cnt,
ct.memo, ct.memo,
(select dept.dept_name from sys_dept dept where dept.dept_id= ct.dept_id) as dept_name,
(select u.user_name from sys_user u where u.user_id=ct.last_update_user) as last_update_user_name, (select u.user_name from sys_user u where u.user_id=ct.last_update_user) as last_update_user_name,
(select sum(cta.pay_fee) from sc_cla_time_attend cta where cta.course_time_id=ct.course_time_id) as pay_total_fee, (select sum(cta.pay_fee) from sc_cla_time_attend cta where cta.course_time_id=ct.course_time_id) as pay_total_fee,
(select sum(cta.pay_hour) from sc_cla_time_attend cta where cta.course_time_id=ct.course_time_id) as pay_total_hour, (select sum(cta.pay_hour) from sc_cla_time_attend cta where cta.course_time_id=ct.course_time_id) as pay_total_hour,
ct.create_time, ct.create_time,
ct.last_update_time ct.last_update_time
from sc_course_cla cc from sc_cla_time ct
left join sc_course course on cc.course_id=course.course_id, left join sc_course course on ct.course_id=course.course_id
sc_cla_time ct
left join sys_user s on ct.teacher_id=s.user_id left join sys_user s on ct.teacher_id=s.user_id
where cc.cla_id = ct.cla_id where course.tenant_id=#{searchClaTime.tenantId}
and cc.tenant_id=#{searchClaTime.tenantId}
<if test="searchClaTime.beginDate != null and searchClaTime.beginDate != '' and searchClaTime.endDate != null and searchClaTime.endDate != ''"> <if test="searchClaTime.beginDate != null and searchClaTime.beginDate != '' and searchClaTime.endDate != null and searchClaTime.endDate != ''">
and ct.cla_date between #{searchClaTime.beginDate} and #{searchClaTime.endDate} and ct.cla_date between #{searchClaTime.beginDate} and #{searchClaTime.endDate}
</if> </if>
<if test="searchClaTime.claId != null">
and ct.cla_id=#{searchClaTime.claId}
</if>
<if test="searchClaTime.deptId != null"> <if test="searchClaTime.deptId != null">
and cc.depart_id=#{searchClaTime.deptId} and ct.dept_id=#{searchClaTime.deptId}
</if> </if>
<if test="searchClaTime.teacherId != null"> <if test="searchClaTime.teacherId != null">
and ct.teacher_id=#{searchClaTime.teacherId} and ct.teacher_id=#{searchClaTime.teacherId}
</if> </if>
<if test="searchClaTime.courseId != null"> <if test="searchClaTime.courseId != null">
and cc.course_id = #{searchClaTime.courseId} and ct.course_id = #{searchClaTime.courseId}
</if> </if>
<if test="searchClaTime.attended != null and searchClaTime.attended == false"> <if test="searchClaTime.attended != null and searchClaTime.attended == false">
and ct.status = '1' and ct.status = '1'
@ -128,8 +119,8 @@
</choose> </choose>
</select> </select>
<select id="selectClaTimeCount" resultType="java.lang.Integer"> <select id="selectClaTimeCount" resultType="java.lang.Integer">
select count(1) from sc_course_cla b, sc_cla_time a select count(1) from sc_course b, sc_cla_time a
where a.cla_id=b.cla_id where a.course_id=b.course_id
and b.tenant_id=#{tenantId} and b.tenant_id=#{tenantId}
and a.cla_date between #{beginDate} and #{endDate} and a.cla_date between #{beginDate} and #{endDate}
<if test="hadBegin != null and hadBegin == true"> <if test="hadBegin != null and hadBegin == true">
@ -142,7 +133,7 @@
and a.teacher_id=#{teacherId} and a.teacher_id=#{teacherId}
</if> </if>
<if test="deptId != null"> <if test="deptId != null">
and b.depart_id=#{deptId} and a.dept_id=#{deptId}
</if> </if>
<if test="deptId == null and userId != null and userId != ''"> <if test="deptId == null and userId != null and userId != ''">
and exists(select 1 from sys_user_dept ud and exists(select 1 from sys_user_dept ud
@ -155,15 +146,67 @@
WHERE a.course_time_id=b.course_time_id WHERE a.course_time_id=b.course_time_id
and a.status='1' and a.status='1'
and b.book_status not in ('3','5') and b.book_status not in ('3','5')
<if test="claId !=null">
and a.cla_id=#{claId}
</if>
<if test="ruleId !=null"> <if test="ruleId !=null">
and a.rule_id=#{ruleId} and a.rule_id=#{ruleId}
</if> </if>
<if test="courseTimeId !=null"> <if test="courseTimeId !=null">
and a.course_time_id=#{courseTimeId} and a.course_time_id=#{courseTimeId}
</if> </if>
and exists(select 1 from sc_course_cla c where a.cla_id = c.cla_id and c.tenant_id=#{tenantId}) and exists(select 1 from sc_course c where a.course_id = c.course_id and c.tenant_id=#{tenantId})
</select>
<select id="serlectByClaTimeId" resultType="ScClaTimeVo">
select a.*
,(select course_name from sc_course where course_id= a.course_id) as course_name
,(select dept_name from sys_dept where dept_id= a.dept_id) as dept_name
from sc_cla_time a where a.course_time_id=#{courseTimeId}
</select>
<select id="selectStudenForClaTime" resultType="RespCourseClaStudent">
SELECT
b.student_id,b.student_name,b.sex,b.phone,
a.course_time_id,
a.id as book_id,
a.card_no,
(select type.card_name from sc_member_card_types type where card.card_type_id=type.card_type_id) as card_type_name,
a.charge_type,
a.deduct_cnt,
a.deduct_fee,
card.remaining_count,
card.remaining_total_fee,
card.expiry_date,
a.book_status,
a.create_time,
a.check_in,
a.check_in_time,
c.count_before,
c.count_after,
c.fee_before,
c.fee_after
from sc_student b ,
sc_member_cards card,
sc_book_course a
LEFT JOIN sc_cla_time_attend c on a.id=c.book_id
WHERE
a.card_no=card.card_no
and a.student_id=b.student_id
and a.course_time_id=#{courseTimeId}
</select>
<select id="checkTeacherConflict" resultType="int">
select count(1) from sc_cla_time where teacher_id=#{teacherId}
and cla_date=#{date}
and (#{startTime} <![CDATA[ < ]]> end_time
and #{endTime} <![CDATA[ > ]]> start_time)
<if test="excludeScheduleId != null">
and course_time_id != #{excludeScheduleId}
</if>
</select>
<select id="checkClassroomConflict" resultType="int">
select count(1) from sc_cla_time where room_id=#{classroomId}
and cla_date=#{date}
and (#{startTime} <![CDATA[ < ]]> end_time
and #{endTime} <![CDATA[ > ]]> start_time)
<if test="excludeScheduleId != null">
and course_time_id != #{excludeScheduleId}
</if>
</select> </select>
</mapper> </mapper>

@ -4,25 +4,20 @@
<select id="selectByCondition" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule"> <select id="selectByCondition" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule">
select b.*, select b.*,
(select dept_name from sys_dept where sys_dept.dept_id=b.dept_id ) as deptName,
fcn_dict_name_list(b.week_day,'week_day') as week_day_name, fcn_dict_name_list(b.week_day,'week_day') as week_day_name,
a.cla_name,
c.course_name, c.course_name,
d.nick_name staff_name d.nick_name staff_name
from sc_course_cla a, from
sc_cla_time_rule b, sc_cla_time_rule b,
sc_course c, sc_course c,
sys_user d sys_user d
where where b.course_id=c.course_id
a.cla_id = b.cla_id
and a.course_id=c.course_id
and b.teacher_id=d.user_id and b.teacher_id=d.user_id
and a.tenant_id=#{reqSearchScClaTimeRule.tenantId} and c.tenant_id=#{reqSearchScClaTimeRule.tenantId}
<if test="reqSearchScClaTimeRule.deptId != null"> <if test="reqSearchScClaTimeRule.deptId != null">
and a.depart_id=#{reqSearchScClaTimeRule.deptId} and b.dept_id=#{reqSearchScClaTimeRule.deptId}
</if>
<if test="reqSearchScClaTimeRule.claId != null">
and b.cla_id=#{reqSearchScClaTimeRule.claId}
</if> </if>
<if test="reqSearchScClaTimeRule.teacherId != null"> <if test="reqSearchScClaTimeRule.teacherId != null">
and b.teacher_id=#{reqSearchScClaTimeRule.teacherId} and b.teacher_id=#{reqSearchScClaTimeRule.teacherId}
@ -43,27 +38,38 @@
</select> </select>
<select id="selectByDay" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule"> <select id="selectByDay" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule">
select b.*, select b.*,
a.cla_name,c.course_name,d.nick_name as staff_name c.course_name,
from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_user d d.nick_name as staff_name
where a.cla_id = b.cla_id and a.course_id=c.course_id from sc_cla_time_rule b,
sc_course c,
sys_user d
where b.course_id=c.course_id
and b.teacher_id=d.user_id and b.teacher_id=d.user_id
and b.cla_id=#{claId} and b.course_id=#{courseId}
and b.dept_id=#{deptId}
and #{day} between b.begin_date and b.end_date and #{day} between b.begin_date and b.end_date
</select> </select>
<select id="selectByRuleId" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule"> <select id="selectByRuleId" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule">
select b.*, select b.*,
a.cla_name,c.course_name,d.nick_name as staff_name c.course_name,
from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_user d d.nick_name as staff_name
where a.cla_id = b.cla_id and a.course_id=c.course_id and b.teacher_id=d.user_id from
sc_cla_time_rule b,
sc_course c,
sys_user d
where b.course_id=c.course_id and b.teacher_id=d.user_id
and b.rule_id=#{ruleId} and b.rule_id=#{ruleId}
</select> </select>
<select id="selectClaTimeInfo" resultType="java.lang.String"> <select id="selectClaTimeInfo" resultType="java.lang.String">
select concat(fcn_dict_name_list(a.week_day,'week_day'),' ',substr(a.start_time,1,5),'~',substr(a.end_time,1,5),' (',a.begin_date,'~',a.end_date,')') as cla_time select concat(fcn_dict_name_list(a.week_day,'week_day'),' ',substr(a.start_time,1,5),'~',substr(a.end_time,1,5),' (',a.begin_date,'~',a.end_date,')') as cla_time
from sc_cla_time_rule a from sc_cla_time_rule a
where a.cla_id=#{claId} where a.course_id=#{courseId}
and a.dept_id=#{deptId}
and a.rule_type='1' and a.rule_type='1'
and repeat_type in ('1','3') and repeat_type in ('1','3')
and (date_format(now(),'%Y-%m-%d') between a.begin_date and a.end_date or date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> a.begin_date) and (date_format(now(),'%Y-%m-%d') between a.begin_date and a.end_date or date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> a.begin_date)
order by a.begin_date order by a.begin_date
</select> </select>
</mapper> </mapper>

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.school.course.mapper.ScCourseClaMapper">
<select id="selectClaList" resultType="com.ruoyi.school.course.domain.resp.cla.RespCourseClaInfo">
select
a.cla_id,a.cla_name,
a.capacity,a.recruit_status,a.open_date,
b.course_id,b.course_name,
a.staff_id,a.teacher_name,
sd.dept_name,
(select group_concat(fcn_dict_name_list(r.week_day,'week_day'),' ',substr(r.start_time,1,5),'~',substr(r.end_time,1,5),' (',r.begin_date,'~',r.end_date,')' SEPARATOR ';')
from sc_cla_time_rule r
where r.cla_id=a.cla_id
and r.rule_type='1'
and r.repeat_type in ('1','3')
and (date_format(now(),'%Y-%m-%d') between r.begin_date and r.end_date or date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> r.begin_date)) as week_day
from sc_course_cla a
left join sc_course b on a.course_id=b.course_id
left join sys_dept sd on a.depart_id=sd.dept_id
where a.delete_flag='0' and a.tenant_id=#{reqSearchScCourseCla.tenantId}
<if test="reqSearchScCourseCla.courseId != null">
and a.course_id=#{reqSearchScCourseCla.courseId}
</if>
<if test="reqSearchScCourseCla.staffId != null">
and a.staff_id=#{reqSearchScCourseCla.staffId}
</if>
<if test="reqSearchScCourseCla.claName != null and reqSearchScCourseCla.claName != ''">
and a.cla_name like concat('%',#{reqSearchScCourseCla.claName},'%')
</if>
<if test="reqSearchScCourseCla.departId != null">
and a.depart_id=#{reqSearchScCourseCla.departId}
</if>
and a.delete_flag='0'
order by a.create_time desc
</select>
<select id="selectForSelect" resultType="com.ruoyi.school.course.domain.resp.cla.RespCourseClaSelectInfo">
select a.cla_id,a.cla_name,b.course_id,b.course_name,c.nick_name as staff_name,
dept.dept_id,
dept.dept_name
from sc_course_cla a
left join sc_course b on a.course_id=b.course_id
left join sys_user c on a.staff_id=c.user_id
left join sys_dept dept on a.depart_id=dept.dept_id
where a.delete_flag='0'
<if test="search != null and search != ''">
and (a.cla_name like concat('%',#{search},'%')
or b.course_name like concat('%',#{search},'%')
or c.nick_name like concat('%',#{search},'%')
)
</if>
order by a.create_time desc limit 0,#{maxRecord}
</select>
<select id="selectClaCount" resultType="java.lang.Integer">
select count(1) from sc_course_cla cc
where cc.delete_flag='0'
<if test="teacherId != null">
and cc.staff_id=#{teacherId}
</if>
<if test="deptId != null">
and cc.depart_id=#{deptId}
</if>
<if test="deptId == null and userId != null and userId != ''">
and exists(select 1 from sys_user_dept ud
where ud.user_id=#{userId}
and (ud.dept_id=cc.depart_id or ud.dept_id=-1))
</if>
</select>
<select id="selectTenantClaCount" resultType="java.lang.Integer">
select count(1) from sc_course_cla where tenant_id=#{tenantId} and delete_flag='0'
</select>
<select id="selectStudentCnt" resultType="java.lang.Integer">
select count(1) from sc_student_course sc where sc.cla_id=#{claId} and sc.status='1'
</select>
<select id="selectStudenForClaTime" resultType="RespCourseClaStudent">
SELECT
b.student_id,b.student_name,b.sex,b.phone,
a.course_time_id,
a.id as book_id,
a.card_no,
(select type.card_name from sc_member_card_types type where card.card_type_id=type.card_type_id) as card_type_name,
a.charge_type,
a.deduct_cnt,
a.deduct_fee,
card.remaining_count,
card.remaining_total_fee,
card.expiry_date,
a.book_status,
a.create_time,
a.check_in,
a.check_in_time,
c.count_before,
c.count_after,
c.fee_before,
c.fee_after
from sc_student b ,
sc_member_cards card,
sc_book_course a
LEFT JOIN sc_cla_time_attend c on a.id=c.book_id
WHERE
a.card_no=card.card_no
and a.student_id=b.student_id
and a.course_time_id=#{courseTimeId}
</select>
</mapper>

@ -7,7 +7,6 @@
a.course_type_id, a.course_type_id,
b.course_type as course_type_name, b.course_type as course_type_name,
a.teaching_mode, a.teaching_mode,
(select count(1) from sc_course_cla cc where a.course_id=cc.course_id) as cla_count,
TRIM(LEADING '[' FROM TRIM(TRAILING ']' FROM CONVERT(a.depart_id, CHAR))) as campus_ids, TRIM(LEADING '[' FROM TRIM(TRAILING ']' FROM CONVERT(a.depart_id, CHAR))) as campus_ids,
(SELECT GROUP_CONCAT(c.dept_name SEPARATOR ',') (SELECT GROUP_CONCAT(c.dept_name SEPARATOR ',')
FROM sys_dept c FROM sys_dept c
@ -17,7 +16,9 @@
a.sale, a.sale,
a.course_intro, a.course_intro,
a.cla_fee, a.cla_fee,
a.tuition_fee a.tuition_fee,
a.star,
a.remark
from sc_course a from sc_course a
left join sc_course_type b on a.course_type_id = b.course_type_id and b.in_use='1' left join sc_course_type b on a.course_type_id = b.course_type_id and b.in_use='1'
where a.delete_flag='0' and a.tenant_id=#{reqSearchScCourse.tenantId} where a.delete_flag='0' and a.tenant_id=#{reqSearchScCourse.tenantId}
@ -44,7 +45,6 @@
a.course_name, a.course_name,
b.course_type as course_type_name, b.course_type as course_type_name,
a.teaching_mode, a.teaching_mode,
(select count(1) from sc_course_cla cc where a.course_id=cc.course_id) as cla_count,
TRIM(LEADING '[' FROM TRIM(TRAILING ']' FROM CONVERT(a.depart_id, CHAR))) as campus_ids, TRIM(LEADING '[' FROM TRIM(TRAILING ']' FROM CONVERT(a.depart_id, CHAR))) as campus_ids,
a.create_time, a.create_time,
a.sale, a.sale,

@ -23,11 +23,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="leaderId" column="leader_id" /> <result property="leaderId" column="leader_id" />
<result property="deptType" column="dept_type" /> <result property="deptType" column="dept_type" />
<result property="tenantId" column="tenant_id" /> <result property="tenantId" column="tenant_id" />
<result property="activationDate" column="activation_date" />
<result property="expiryDate" column="expiry_date" />
</resultMap> </resultMap>
<sql id="selectDeptVo"> <sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.delete_flag, d.create_by select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.delete_flag, d.create_by
, d.create_time,d.leader_id,d.dept_type,d.tenant_id , d.create_time,d.leader_id,d.dept_type,d.tenant_id,expiry_date,activation_date
from sys_dept d from sys_dept d
</sql> </sql>
@ -112,6 +114,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptType != null and deptType != ''">dept_type,</if> <if test="deptType != null and deptType != ''">dept_type,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="activationDate != null and activationDate != ''">activation_date,</if>
<if test="expiryDate != null and expiryDate != ''">expiry_date,</if>
create_time create_time
)values( )values(
<if test="deptId != null and deptId != 0">#{deptId},</if> <if test="deptId != null and deptId != 0">#{deptId},</if>
@ -126,6 +130,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptType != null and deptType != ''">#{deptType},</if> <if test="deptType != null and deptType != ''">#{deptType},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="activationDate != null and activationDate != ''">#{activationDate},</if>
<if test="expiryDate != null and expiryDate != ''">#{expiryDate},</if>
sysdate() sysdate()
) )
</insert> </insert>
@ -146,6 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptType != null and deptType != ''">dept_type =#{deptType},</if> <if test="deptType != null and deptType != ''">dept_type =#{deptType},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="activationDate != null and activationDate != ''">activation_date= #{activationDate},</if>
<if test="expiryDate != null and expiryDate != ''">expiry_date= #{expiryDate},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where dept_id = #{deptId} where dept_id = #{deptId}

@ -25,12 +25,10 @@
sum(CASE sum(CASE
WHEN s.student_name is not null THEN 1 WHEN s.student_name is not null THEN 1
WHEN c.course_name is not null THEN 1 WHEN c.course_name is not null THEN 1
WHEN a.cla_name is not null THEN 1
ELSE 0 END) ELSE 0 END)
from sys_tenant t from sys_tenant t
LEFT JOIN sc_student s on t.tenant_id=s.tenant_id LEFT JOIN sc_student s on t.tenant_id=s.tenant_id
LEFT JOIN sc_course c on t.tenant_id=c.tenant_id LEFT JOIN sc_course c on t.tenant_id=c.tenant_id
LEFT JOIN sc_course_cla a on t.tenant_id=a.tenant_id
WHERE t.tenant_id=#{tenantId} WHERE t.tenant_id=#{tenantId}
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save