master
xiaoning 1 month ago
parent 53a13352cd
commit 1d913c9a4f

@ -1,19 +1,13 @@
package cn.xluobo; package cn.xluobo;
import cn.xluobo.config.properties.AddressProperties;
import cn.xluobo.config.properties.UploadConfigProperties;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@SpringBootApplication //@SpringBootApplication
@EnableConfigurationProperties({UploadConfigProperties.class, AddressProperties.class}) //@EnableConfigurationProperties({UploadConfigProperties.class, AddressProperties.class})
@EnableScheduling //@EnableScheduling
@EnableAsync //@EnableAsync
public class BusinessServerApplication { public class BusinessServerApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {

@ -6,14 +6,14 @@ package cn.xluobo.business.enums;
public enum BusinessTableEnums { public enum BusinessTableEnums {
SYS_USER("sys_user","系统用户"), SYS_USER("sys_user","系统用户"),
SYS_STAFF("sys_staff","员工表",true), // SYS_STAFF("sys_staff","员工表",true),
SYS_DEPT("sys_dept","部门",true), SYS_DEPT("sys_dept","部门",true),
SYS_TAG("sys_tag","标签",true), SYS_TAG("sys_tag","标签",true),
SYS_RECEIPT_ACCOUNT("sys_receipt_account","机构收费账户",true), SYS_RECEIPT_ACCOUNT("sys_receipt_account","机构收费账户",true),
SC_SCHOOL("sc_school","学校",true), // SC_SCHOOL("sc_school","学校",true),
SC_ROOM("sc_room","教室",true), SC_ROOM("sc_room","教室",true),
SC_TEACHER("sc_teacher","教师",true), SC_TEACHER("sc_teacher","教师",true),
SC_COURSE("sc_course","课程",true), SC_COURSE("sc_course","课程",true),

@ -3,14 +3,19 @@ package cn.xluobo.business.report.dashboard.service;
import cn.xluobo.business.report.dashboard.domain.resp.DashboardData; import cn.xluobo.business.report.dashboard.domain.resp.DashboardData;
import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount; import cn.xluobo.business.sc.course.domain.req.time.ReqClaTimeCount;
import cn.xluobo.business.sc.course.repo.enums.ClaTimeAttendStatusEnums; import cn.xluobo.business.sc.course.repo.enums.ClaTimeAttendStatusEnums;
import cn.xluobo.business.sc.course.repo.model.ScCourse;
import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
import cn.xluobo.business.sc.course.service.IScClaTimeAttendService; import cn.xluobo.business.sc.course.service.IScClaTimeAttendService;
import cn.xluobo.business.sc.course.service.IScClaTimeService; import cn.xluobo.business.sc.course.service.IScClaTimeService;
import cn.xluobo.business.sc.course.service.IScCourseClaService; import cn.xluobo.business.sc.course.service.IScCourseClaService;
import cn.xluobo.business.sc.course.service.IScCourseService; import cn.xluobo.business.sc.course.service.IScCourseService;
import cn.xluobo.business.sc.order.enums.OrderTypeEnum; import cn.xluobo.business.sc.order.enums.OrderTypeEnum;
import cn.xluobo.business.sc.order.service.IScOrderService; import cn.xluobo.business.sc.order.service.IScOrderService;
import cn.xluobo.business.sc.student.repo.model.ScStudent;
import cn.xluobo.business.sc.student.service.IScStudentCourseService; import cn.xluobo.business.sc.student.service.IScStudentCourseService;
import cn.xluobo.business.sc.student.service.IScStudentService; import cn.xluobo.business.sc.student.service.IScStudentService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.SecurityUtils;
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;
@ -50,11 +55,12 @@ public class DashboardService {
String todayDate = DateTime.now().toString("yyyy-MM-dd"); String todayDate = DateTime.now().toString("yyyy-MM-dd");
String thisMonthBegin = DateTime.now().withDayOfMonth(1).toString("yyyy-MM-dd"); String thisMonthBegin = DateTime.now().withDayOfMonth(1).toString("yyyy-MM-dd");
String thisMonthEnd = DateTime.now().plusMonths(1).withDayOfMonth(1).minusDays(1).toString("yyyy-MM-dd"); String thisMonthEnd = DateTime.now().plusMonths(1).withDayOfMonth(1).minusDays(1).toString("yyyy-MM-dd");
int claCnt = claService.count(); String tenantId=SecurityUtils.getLoginUser().getNowTenantId();
int courseCnt = courseService.count(); int claCnt = claService.count(new QueryWrapper<ScCourseCla>().eq("tenant_id",tenantId));
int studentCnt = studentService.count(); int courseCnt = courseService.count(new QueryWrapper<ScCourse>().eq("tenant_id",tenantId));
int studentCnt = studentService.count(new QueryWrapper<ScStudent>().eq("tenant_id",tenantId));
ReqClaTimeCount reqClaTimeCount = ReqClaTimeCount.builder().beginDate(todayDate).endDate(todayDate).hadBegin(null).build(); ReqClaTimeCount reqClaTimeCount = ReqClaTimeCount.builder().beginDate(todayDate).endDate(todayDate).hadBegin(null).tenantId(tenantId).build();
Integer todayClaTimeCnt = claTimeService.claTimeCount(reqClaTimeCount); Integer todayClaTimeCnt = claTimeService.claTimeCount(reqClaTimeCount);
reqClaTimeCount.setHadBegin(true); reqClaTimeCount.setHadBegin(true);
@ -70,6 +76,7 @@ public class DashboardService {
Integer arrearsStudentCnt = orderService.arrearsStudentCount(); Integer arrearsStudentCnt = orderService.arrearsStudentCount();
Integer dateWillExpireCnt = studentCourseService.getWillExpireDateCount(10); Integer dateWillExpireCnt = studentCourseService.getWillExpireDateCount(10);
Integer hourWillExpireCnt = studentCourseService.getWillExpireHourCount(5); Integer hourWillExpireCnt = studentCourseService.getWillExpireHourCount(5);
return DashboardData.builder() return DashboardData.builder()
.todayClaTimeCnt(todayClaTimeCnt) .todayClaTimeCnt(todayClaTimeCnt)
.completeTodayClaTimeCnt(completeTodayClaTimeCnt) .completeTodayClaTimeCnt(completeTodayClaTimeCnt)

@ -1,89 +0,0 @@
package cn.xluobo.business.sc.base.controller;
import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
import cn.xluobo.business.sc.base.domain.req.ReqSearchScSchool;
import cn.xluobo.business.sc.base.repo.model.ScSchool;
import cn.xluobo.business.sc.base.service.BusinessScSchoolService;
import cn.xluobo.core.api.APIResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* Controller
* </p>
*
* @author zhangby
* @since 2020-04-27 07:13:36
*/
@RestController
@RequestMapping("/api/sc/school")
public class ScSchoolController {
@Autowired
private BusinessScSchoolService scSchoolService;
/**
*
*
* @param reqSearchScSchool
* @return
*/
@GetMapping("/list/searchList")
public APIResponse searchList(ReqSearchScSchool reqSearchScSchool) {
return scSchoolService.searchList(reqSearchScSchool);
}
/**
* select
*
* @return
*/
@GetMapping("/list/select")
public APIResponse select(ReqSchoolSelect schoolSelect) {
return scSchoolService.select(schoolSelect);
}
/**
*
*
* @param schoolId
* @return
*/
@GetMapping("/info/detailById/{schoolId}")
public APIResponse detailById(@PathVariable("schoolId") Long schoolId) {
return scSchoolService.detailById(schoolId);
}
/**
*
*
* @param scSchool
* @return
*/
@PostMapping("/add/addScSchool")
public APIResponse addScSchool(@RequestBody ScSchool scSchool) {
return scSchoolService.addScSchool(scSchool);
}
/**
*
*
* @param scSchool
* @return
*/
@PutMapping("/update/updateScSchool")
public APIResponse updateScSchool(@RequestBody ScSchool scSchool) {
return scSchoolService.updateScSchool(scSchool);
}
/**
*
*
* @param schoolIds
* @return
*/
@DeleteMapping("/delete/deleteById/{schoolIds}")
public APIResponse deleteById(@PathVariable("schoolIds") Long[] schoolIds) {
return scSchoolService.deleteById(schoolIds);
}
}

@ -12,5 +12,6 @@ import lombok.Data;
public class ReqRoomSelect { public class ReqRoomSelect {
private String deptId; private String deptId;
private String tenantId;
} }

@ -1,6 +1,7 @@
package cn.xluobo.business.sc.base.domain.req; package cn.xluobo.business.sc.base.domain.req;
import cn.xluobo.core.page.ReqPageBase; import cn.xluobo.core.page.ReqPageBase;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -14,4 +15,11 @@ public class ReqSearchScRoom extends ReqPageBase implements Serializable {
private Long deptId; private Long deptId;
private String roomName; private String roomName;
private String memo; private String memo;
private String tenantId;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
} }

@ -1,27 +0,0 @@
package cn.xluobo.business.sc.base.repo.mapper;
import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
import cn.xluobo.business.sc.base.repo.model.ScSchool;
import java.util.List;
/**
* <p>
* Mapper
* </p>
*
* @author zhangby
* @since 2020-04-27 07:13:36
*/
public interface ScSchoolMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<ScSchool> {
/**
*
*
* @param schoolSelect
* @return
*/
List<RespSchoolSelect> selectForSelect(ReqSchoolSelect schoolSelect);
}

@ -5,7 +5,7 @@
<select id="selectList" resultType="cn.xluobo.business.sc.base.domain.resp.RespRoomInfo"> <select id="selectList" resultType="cn.xluobo.business.sc.base.domain.resp.RespRoomInfo">
select a.*,b.dept_name select a.*,b.dept_name
from sc_room a left join sys_dept b on a.dept_id=b.dept_id from sc_room a left join sys_dept b on a.dept_id=b.dept_id
where 1=1 where 1=1 and b.tenant_id=#{reqSearchScRoom.tenantId}
<if test="reqSearchScRoom.deptId != null and reqSearchScRoom.deptId != ''"> <if test="reqSearchScRoom.deptId != null and reqSearchScRoom.deptId != ''">
and a.dept_id=#{reqSearchScRoom.deptId} and a.dept_id=#{reqSearchScRoom.deptId}
</if> </if>
@ -21,7 +21,7 @@
a.room_id, a.room_id,
concat(a.room_name,'(',b.dept_name,')') as room_name concat(a.room_name,'(',b.dept_name,')') as room_name
from sc_room a left join sys_dept b on a.dept_id=b.dept_id from sc_room a left join sys_dept b on a.dept_id=b.dept_id
where 1=1 where 1=1 and b.tenant_id=#{tenantId}
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
and a.dept_id=#{deptId} and a.dept_id=#{deptId}
</if> </if>

@ -1,19 +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="cn.xluobo.business.sc.base.repo.mapper.ScSchoolMapper">
<select id="selectForSelect" resultType="cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect">
select school_id,school_name,province_code,city_code,
fcn_dict_name(province_code,'province_code') as province_name,
fcn_dict_name(city_code,'city_code') as city_name
from sc_school
where 1=1
<if test="search != null and search != ''">
and school_name like concat('%',#{search} ,'%')
</if>
<if test="schoolId != null and schoolId != ''">
and school_id = #{schoolId}
</if>
limit 0,#{maxRecord}
</select>
</mapper>

@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -79,4 +80,6 @@ public class ScRoom implements Serializable {
*/ */
@TableField("last_update_time") @TableField("last_update_time")
private Date lastUpdateTime; private Date lastUpdateTime;
private BigDecimal venueFee;
} }

@ -1,79 +0,0 @@
package cn.xluobo.business.sc.base.repo.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-04-27 07:13:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sc_school")
public class ScSchool implements Serializable {
/**
* id
*/
@TableId(value = "school_id", type = IdType.AUTO)
private Long schoolId;
/**
*
*/
@TableField("tenant_id")
private String tenantId;
/**
*
*/
@TableField("province_code")
private String provinceCode;
/**
* 0431
*/
@TableField("city_code")
private String cityCode;
@TableField("school_name")
private String schoolName;
/**
*
*/
@TableField("create_user")
private Long createUser;
/**
*
*/
@TableField("create_time")
private Date createTime;
/**
*
*/
@TableField("last_update_user")
private Long lastUpdateUser;
/**
*
*/
@TableField("last_update_time")
private Date lastUpdateTime;
}

@ -56,6 +56,7 @@ public class BusinessScRoomService {
* @return * @return
*/ */
public APIResponse select(ReqRoomSelect roomSelect) { public APIResponse select(ReqRoomSelect roomSelect) {
roomSelect.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
List<RespRoomSelect> list = scRoomService.selectRoomSelect(roomSelect); List<RespRoomSelect> list = scRoomService.selectRoomSelect(roomSelect);
return APIResponse.toAPIResponse(list); return APIResponse.toAPIResponse(list);
} }
@ -82,6 +83,7 @@ public class BusinessScRoomService {
*/ */
public APIResponse addScRoom(ScRoom scRoom) { public APIResponse addScRoom(ScRoom scRoom) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
scRoom.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
scRoom.setCreateUser(loginUser.getUserId()); scRoom.setCreateUser(loginUser.getUserId());
boolean addScRoom = scRoomService.save(scRoom); boolean addScRoom = scRoomService.save(scRoom);
if (addScRoom) { if (addScRoom) {

@ -1,134 +0,0 @@
package cn.xluobo.business.sc.base.service;
import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
import cn.xluobo.business.sc.base.domain.req.ReqSearchScSchool;
import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
import cn.xluobo.business.sc.base.repo.model.ScSchool;
import cn.xluobo.core.api.APIResponse;
import cn.xluobo.core.api.ApiResEnums;
import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @author zhangbaoyu
* @date Created in 2020-01-14 17:24
*/
@Service
@Transactional
public class BusinessScSchoolService {
@Autowired
private IScSchoolService scSchoolService;
/**
*
*
* @param reqSearchScSchool
* @return
*/
public APIResponse searchList(ReqSearchScSchool reqSearchScSchool) {
QueryWrapper qw = new QueryWrapper();
if(StringUtils.isNotEmpty(reqSearchScSchool.getProvinceCode())){
qw.eq("province_code",reqSearchScSchool.getProvinceCode());
}
if(StringUtils.isNotEmpty(reqSearchScSchool.getCityCode())){
qw.eq("city_code",reqSearchScSchool.getCityCode());
}
if(StringUtils.isNotEmpty(reqSearchScSchool.getSchoolName())){
qw.like("school_name",reqSearchScSchool.getSchoolName());
}
RespPage<ScSchool> page = new RespPage(reqSearchScSchool.getPageNum(), reqSearchScSchool.getPageSize());
RespPage<ScSchool> listPage = scSchoolService.page(page, qw);
return APIResponse.toAPIResponse(listPage);
}
/**
* select
*
* @return
*/
public APIResponse select(ReqSchoolSelect schoolSelect) {
List<RespSchoolSelect> list = scSchoolService.selectSchoolSelect(schoolSelect);
return APIResponse.toAPIResponse(list);
}
/**
*
*
* @param schoolId
* @return
*/
public APIResponse detailById(Long schoolId) {
if (null == schoolId) {
return APIResponse.toAPIResponse(null);
}
ScSchool detailInfo = scSchoolService.getById(schoolId);
return APIResponse.toAPIResponse(detailInfo);
}
/**
*
*
* @param scSchool
* @return
*/
public APIResponse addScSchool(ScSchool scSchool) {
LoginUser loginUser = SecurityUtils.getLoginUser();
scSchool.setCreateUser(loginUser.getUserId());
boolean addScSchool = scSchoolService.save(scSchool);
if (addScSchool) {
return APIResponse.toOkResponse();
} else {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
}
/**
*
*
* @param scSchool
* @return
*/
public APIResponse updateScSchool(ScSchool scSchool) {
if (null == scSchool.getSchoolId()) {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
LoginUser loginUser = SecurityUtils.getLoginUser();
scSchool.setLastUpdateUser(loginUser.getUserId());
scSchool.setLastUpdateTime(new Date());
boolean updateScSchool = scSchoolService.updateById(scSchool);
if (updateScSchool) {
return APIResponse.toOkResponse();
} else {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
}
/**
*
*
* @param schoolIds
* @return
*/
public APIResponse deleteById(Long[] schoolIds) {
if (null == schoolIds || schoolIds.length == 0) {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
boolean deleteScSchool = scSchoolService.removeByIds(Arrays.asList(schoolIds));
if (deleteScSchool) {
return APIResponse.toOkResponse();
} else {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
}
}

@ -1,34 +0,0 @@
package cn.xluobo.business.sc.base.service;
import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
import cn.xluobo.business.sc.base.repo.model.ScSchool;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-04-27 07:13:36
*/
public interface IScSchoolService extends com.baomidou.mybatisplus.extension.service.IService<ScSchool> {
/**
* select
*
* @param schoolSelect
* @return
*/
List<RespSchoolSelect> selectSchoolSelect(ReqSchoolSelect schoolSelect);
/**
* ,
*
* @param schoolName
* @return
*/
Long getSchoolId(String schoolName);
}

@ -1,48 +0,0 @@
package cn.xluobo.business.sc.base.service.impl;
import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
import cn.xluobo.business.sc.base.repo.mapper.ScSchoolMapper;
import cn.xluobo.business.sc.base.repo.model.ScSchool;
import cn.xluobo.business.sc.base.service.IScSchoolService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-04-27 07:13:36
*/
@Service
public class ScSchoolServiceImpl extends ServiceImpl<ScSchoolMapper, ScSchool> implements IScSchoolService {
@Override
public List<RespSchoolSelect> selectSchoolSelect(ReqSchoolSelect schoolSelect) {
return baseMapper.selectForSelect(schoolSelect);
}
@Override
public Long getSchoolId(String schoolName) {
if(StringUtils.isNotEmpty(schoolName)) {
QueryWrapper<ScSchool> qw = new QueryWrapper<>();
qw.eq("school_name", schoolName);
List<ScSchool> list = this.list(qw);
if(null != list && list.size() >0 ){
return list.get(0).getSchoolId();
} else {
ScSchool scSchool = new ScSchool();
scSchool.setSchoolName(schoolName);
this.save(scSchool);
return scSchool.getSchoolId();
}
}
return null;
}
}

@ -61,6 +61,11 @@ public class ReqAddScCourse {
*/ */
private boolean feeModeCycle; private boolean feeModeCycle;
/**
*
*/
private BigDecimal claFee;
private List<ReqAddScCourseChargeItem> feeModeHourList; private List<ReqAddScCourseChargeItem> feeModeHourList;
private List<ReqAddScCourseChargeItem> feeModeDateList; private List<ReqAddScCourseChargeItem> feeModeDateList;

@ -1,6 +1,7 @@
package cn.xluobo.business.sc.course.domain.req.time; package cn.xluobo.business.sc.course.domain.req.time;
import cn.xluobo.core.page.ReqDeptCondition; import cn.xluobo.core.page.ReqDeptCondition;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -14,7 +15,12 @@ public class ReqClaTimeCount extends ReqDeptCondition {
private String beginDate; private String beginDate;
private String endDate; private String endDate;
private String tenantId;
private Boolean hadBegin; private Boolean hadBegin;
private Long teacherId; private Long teacherId;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
} }

@ -1,6 +1,5 @@
package cn.xluobo.business.sc.course.domain.req.time; package cn.xluobo.business.sc.course.domain.req.time;
import cn.xluobo.core.page.ReqPageBase;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import lombok.Data; import lombok.Data;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -9,10 +8,10 @@ import java.io.Serializable;
/** /**
* @author zhangbaoyu * @author zhangbaoyu
* @date Created in 2020/9/18 14:45 * @date Created in 2020/9/18 14:45 extends ReqPageBase
*/ */
@Data @Data
public class ReqSearchClaTime extends ReqPageBase implements Serializable { public class ReqSearchClaTime implements Serializable {
// 排课 编号 // 排课 编号
private String courseTimeId; private String courseTimeId;

@ -3,6 +3,7 @@ package cn.xluobo.business.sc.course.domain.resp.course;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -62,4 +63,6 @@ public class RespSearchCourse implements Serializable {
* *
*/ */
private Long studentCourseId; private Long studentCourseId;
private BigDecimal claFee;//教练课时费
} }

@ -46,7 +46,9 @@ public interface ScClaTimeAttendMapper extends com.baomidou.mybatisplus.core.map
* @param endDate * @param endDate
* @return * @return
*/ */
Integer selectNeedAttendCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate); Integer selectNeedAttendCount(@Param("beginDate") String beginDate
, @Param("endDate") String endDate
, @Param("tenantId") String tenantId);
/** /**
* *
@ -56,7 +58,10 @@ public interface ScClaTimeAttendMapper extends com.baomidou.mybatisplus.core.map
* @param attendStatus * @param attendStatus
* @return * @return
*/ */
Integer selectAttendCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("attendStatus") String[] attendStatus); Integer selectAttendCount(@Param("beginDate") String beginDate
, @Param("endDate") String endDate
, @Param("attendStatus") String[] attendStatus
, @Param("tenantId") String tenantId);
/** /**
* *
@ -65,7 +70,9 @@ public interface ScClaTimeAttendMapper extends com.baomidou.mybatisplus.core.map
* @param endDate * @param endDate
* @return * @return
*/ */
BigDecimal selectAttendCostHour(@Param("beginDate") String beginDate, @Param("endDate") String endDate); BigDecimal selectAttendCostHour(@Param("beginDate") String beginDate
, @Param("endDate") String endDate
, @Param("tenantId") String tenantId);
/** /**
* *
@ -74,7 +81,9 @@ public interface ScClaTimeAttendMapper extends com.baomidou.mybatisplus.core.map
* @param endDate * @param endDate
* @return * @return
*/ */
BigDecimal selectNeedAttendCostHour(@Param("beginDate") String beginDate, @Param("endDate") String endDate); BigDecimal selectNeedAttendCostHour(@Param("beginDate") String beginDate
, @Param("endDate") String endDate
, @Param("tenantId") String tenantId);
/** /**
* *

@ -37,7 +37,10 @@ public interface ScCourseMapper extends BaseMapper<ScCourse> {
* @param page * @param page
* @return * @return
*/ */
List<RespSearchCourse> selectCourseListWithStudentCourse(@Param("reqSearchScCourse") ReqSearchScCourse reqSearchScCourse, @Param("page") RespPage page); List<RespSearchCourse> selectCourseListWithStudentCourse(@Param("reqSearchScCourse") ReqSearchScCourse reqSearchScCourse
, @Param("page") RespPage page
, @Param("tenantId") String tenantId
);
/** /**
* *

@ -49,6 +49,7 @@
and cc.cla_id=ct.cla_id and cc.cla_id=ct.cla_id
and cc.cla_id=sc.cla_id and cc.cla_id=sc.cla_id
and sc.status='1' and sc.status='1'
and cc.tenant_id=#{tenantId}
and (sc.charge_type in ('hour','cycle') and (sc.charge_type in ('hour','cycle')
or (charge_type='date' and exists( or (charge_type='date' and exists(
select 1 from sc_student_course_order sco select 1 from sc_student_course_order sco
@ -64,12 +65,14 @@
</foreach> </foreach>
and ct.course_time_id=cta.course_time_id and ct.course_time_id=cta.course_time_id
and ct.cla_id=cc.cla_id and ct.cla_id=cc.cla_id
and cc.tenant_id=#{tenantId}
and ct.cla_date between #{beginDate} and #{endDate} and ct.cla_date between #{beginDate} and #{endDate}
</select> </select>
<select id="selectAttendCostHour" resultType="java.math.BigDecimal"> <select id="selectAttendCostHour" resultType="java.math.BigDecimal">
select ifnull(sum(cta.pay_hour),0) from sc_course_cla cc,sc_cla_time_attend cta,sc_cla_time ct select ifnull(sum(cta.pay_hour),0) from sc_course_cla cc,sc_cla_time_attend cta,sc_cla_time ct
where ct.course_time_id=cta.course_time_id where ct.course_time_id=cta.course_time_id
and ct.cla_id=cc.cla_id and ct.cla_id=cc.cla_id
and cc.tenant_id=#{tenantId}
and ct.cla_date between #{beginDate} and #{endDate} and ct.cla_date between #{beginDate} and #{endDate}
</select> </select>
<select id="selectNeedAttendCostHour" resultType="java.math.BigDecimal"> <select id="selectNeedAttendCostHour" resultType="java.math.BigDecimal">
@ -78,6 +81,7 @@
where ct.cla_date between #{beginDate} and #{endDate} where ct.cla_date between #{beginDate} and #{endDate}
and ct.cla_id=cc.cla_id and ct.cla_id=cc.cla_id
and cc.cla_id=sc.cla_id and cc.cla_id=sc.cla_id
and cc.tenant_id=#{tenantId}
and sc.status='1' and sc.status='1'
and (sc.charge_type in ('hour','cycle') and (sc.charge_type in ('hour','cycle')
or (charge_type='date' and exists( or (charge_type='date' and exists(

@ -7,16 +7,16 @@
hour(b.start_time) as start_hour,b.start_time, hour(b.start_time) as start_hour,b.start_time,
b.end_time,b.source,b.status,b.memo,b.status,b.class_theme, b.end_time,b.source,b.status,b.memo,b.status,b.class_theme,
a.cla_name,a.cla_color,course.course_name, a.cla_name,a.cla_color,course.course_name,
s.staff_id as teacher_id,s.staff_name, s.user_id as teacher_id,s.nick_name as staff_name,
r.room_id,r.room_name, r.room_id,r.room_name,
(select count(distinct student_id) from sc_student_course sc where sc.cla_id=a.cla_id and sc.status='1') as student_count, (select count(distinct student_id) from sc_student_course sc where sc.cla_id=a.cla_id and sc.status='1') as student_count,
b.pay_hour b.pay_hour
from sc_course_cla a from sc_course_cla a
left join sc_course course on a.course_id=course.course_id left join sc_course course on a.course_id=course.course_id
,sc_cla_time b ,sc_cla_time b
left join sys_staff s on b.teacher_id = s.staff_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 where a.cla_id=b.cla_id and 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>
@ -54,7 +54,7 @@
<select id="selectListForAttend" resultType="cn.xluobo.business.sc.course.domain.resp.time.RespClaTime"> <select id="selectListForAttend" resultType="cn.xluobo.business.sc.course.domain.resp.time.RespClaTime">
select ct.course_time_id,ct.cla_id,cc.cla_name, select ct.course_time_id,ct.cla_id,cc.cla_name,
course.course_id,course.course_name, course.course_id,course.course_name,
ct.teacher_id,s.staff_name, ct.teacher_id,s.nick_name as staff_name,
ct.status, ct.status,
ct.cla_date,ct.start_time,ct.end_time, ct.cla_date,ct.start_time,ct.end_time,
ct.real_cla_date,ct.real_start_time,ct.real_end_time, ct.real_cla_date,ct.real_start_time,ct.real_end_time,
@ -67,7 +67,7 @@
from sc_course_cla cc from sc_course_cla cc
left join sc_course course on cc.course_id=course.course_id, left join sc_course course on cc.course_id=course.course_id,
sc_cla_time ct sc_cla_time ct
left join sys_staff s on ct.teacher_id=s.staff_id left join sys_user s on ct.teacher_id=s.user_id
where cc.cla_id = ct.cla_id and cc.tenant_id=#{searchClaTime.tenantId} where cc.cla_id = ct.cla_id 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}
@ -107,6 +107,7 @@
<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_cla b, sc_cla_time a
where a.cla_id=b.cla_id where a.cla_id=b.cla_id
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">
and a.status='2' and a.status='2'

@ -32,18 +32,18 @@
</select> </select>
<select id="selectByDay" resultType="cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule"> <select id="selectByDay" resultType="cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule">
select b.*, select b.*,
a.cla_name,c.course_name,d.staff_name a.cla_name,c.course_name,d.nick_name as staff_name
from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_staff d from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_user d
where a.cla_id = b.cla_id and a.course_id=c.course_id where a.cla_id = b.cla_id and a.course_id=c.course_id
and b.teacher_id=d.staff_id and b.teacher_id=d.user_id
and b.cla_id=#{claId} and b.cla_id=#{claId}
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="cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule"> <select id="selectByRuleId" resultType="cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule">
select b.*, select b.*,
a.cla_name,c.course_name,d.staff_name a.cla_name,c.course_name,d.nick_name as staff_name
from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_staff d from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_user d
where a.cla_id = b.cla_id and a.course_id=c.course_id and b.teacher_id=d.staff_id where a.cla_id = b.cla_id and a.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">

@ -45,18 +45,18 @@
</select> </select>
<select id="selectForSelect" resultType="cn.xluobo.business.sc.course.domain.resp.RespCourseClaSelectInfo"> <select id="selectForSelect" resultType="cn.xluobo.business.sc.course.domain.resp.RespCourseClaSelectInfo">
select a.cla_id,a.cla_name,b.course_id,b.course_name,c.staff_name, select a.cla_id,a.cla_name,b.course_id,b.course_name,c.nick_name as staff_name,
dept.dept_id, dept.dept_id,
dept.dept_name dept.dept_name
from sc_course_cla a from sc_course_cla a
left join sc_course b on a.course_id=b.course_id left join sc_course b on a.course_id=b.course_id
left join sys_staff c on a.staff_id=c.staff_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 left join sys_dept dept on a.depart_id=dept.dept_id
where a.delete_flag='0' where a.delete_flag='0'
<if test="search != null and search != ''"> <if test="search != null and search != ''">
and (a.cla_name like concat('%',#{search},'%') and (a.cla_name like concat('%',#{search},'%')
or b.course_name like concat('%',#{search},'%') or b.course_name like concat('%',#{search},'%')
or c.staff_name like concat('%',#{search},'%') or c.nick_name like concat('%',#{search},'%')
) )
</if> </if>
order by a.create_time desc limit 0,#{maxRecord} order by a.create_time desc limit 0,#{maxRecord}

@ -11,7 +11,8 @@
(select group_concat(distinct charge.depart_id) from sc_course_charge charge where a.course_id=charge.course_id) as campus_ids, (select group_concat(distinct charge.depart_id) from sc_course_charge charge where a.course_id=charge.course_id) as campus_ids,
a.create_time, a.create_time,
a.sale, a.sale,
a.course_intro a.course_intro,
a.cla_fee
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}
@ -47,7 +48,7 @@
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'
left join sc_student_course c on a.course_id=c.course_id and c.student_id = #{reqSearchScCourse.studentId} left join sc_student_course c on a.course_id=c.course_id and c.student_id = #{reqSearchScCourse.studentId}
where a.delete_flag='0' where a.delete_flag='0' and a.tenant_id=#{tenantId}
<if test="reqSearchScCourse.courseName != null and reqSearchScCourse.courseName != ''"> <if test="reqSearchScCourse.courseName != null and reqSearchScCourse.courseName != ''">
and a.course_name like concat('%',#{reqSearchScCourse.courseName} ,'%') and a.course_name like concat('%',#{reqSearchScCourse.courseName} ,'%')
</if> </if>

@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -108,4 +109,11 @@ public class ScCourse implements Serializable {
@TableField(value = "import_id") @TableField(value = "import_id")
@JsonIgnore @JsonIgnore
private Long importId; private Long importId;
/**
*
*/
@TableField("cla_fee")
private BigDecimal claFee;
} }

@ -192,7 +192,7 @@ public class BusinessClaTimeService {
* @return * @return
*/ */
public RespPage<RespClaTime> selectListForAttend(ReqSearchClaTime searchClaTime) { public RespPage<RespClaTime> selectListForAttend(ReqSearchClaTime searchClaTime) {
RespPage<RespClaTime> page = new RespPage<>(searchClaTime.getPageNum(), searchClaTime.getPageSize()); RespPage<RespClaTime> page = new RespPage<>(1, 10);
List<RespClaTime> claTimeList = claTimeMapper.selectListForAttend(searchClaTime, page); List<RespClaTime> claTimeList = claTimeMapper.selectListForAttend(searchClaTime, page);
page.setRows(claTimeList); page.setRows(claTimeList);
return page; return page;

@ -13,8 +13,6 @@ import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
import cn.xluobo.business.sc.student.service.IScStudentCourseService; import cn.xluobo.business.sc.student.service.IScStudentCourseService;
import cn.xluobo.business.sc.student.service.IScStudentService; import cn.xluobo.business.sc.student.service.IScStudentService;
import cn.xluobo.business.sys.admin.service.ISysDeptService; import cn.xluobo.business.sys.admin.service.ISysDeptService;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.business.sys.staff.service.ISysStaffService;
import cn.xluobo.core.api.APIBaseResponse; import cn.xluobo.core.api.APIBaseResponse;
import cn.xluobo.core.api.APIResponse; import cn.xluobo.core.api.APIResponse;
import cn.xluobo.core.api.ApiResEnums; import cn.xluobo.core.api.ApiResEnums;
@ -49,8 +47,7 @@ public class BusinessScCourseClaService {
private IScCourseService courseService; private IScCourseService courseService;
@Autowired @Autowired
private IScCourseChargeService courseChargeService; private IScCourseChargeService courseChargeService;
@Autowired
private ISysStaffService teacherService;
@Autowired @Autowired
private ScCourseClaMapper scCourseClaMapper; private ScCourseClaMapper scCourseClaMapper;
@Autowired @Autowired
@ -161,13 +158,13 @@ public class BusinessScCourseClaService {
// 校区 // 校区
if (null != courseCla.getDepartId()) { if (null != courseCla.getDepartId()) {
SysDept sysDept = deptService.getById(courseCla.getDepartId()); SysDept sysDept = deptService.getById(courseCla.getDepartId());
courseCla.setDeptName(sysDept.getDeptName()); scCourseClaVo.setDeptName(sysDept.getDeptName());
} }
// 教师 // 教师
if (null != courseCla.getStaffId()) { if (null != courseCla.getStaffId()) {
SysUser staff = userService.selectUserById(courseCla.getStaffId()); SysUser staff = userService.selectUserById(courseCla.getStaffId());
courseCla.setTeacherName(staff.getNickName()); scCourseClaVo.setTeacherName(staff.getNickName());
} }
// 上课时间 // 上课时间

@ -94,7 +94,7 @@ public class BusinessScCourseService {
*/ */
public APIResponse selectCourseListWithStudentCourse(ReqSearchScCourse reqSearchScCourse) { public APIResponse selectCourseListWithStudentCourse(ReqSearchScCourse reqSearchScCourse) {
RespPage respPage = new RespPage(reqSearchScCourse.getPageNum(), reqSearchScCourse.getPageSize()); RespPage respPage = new RespPage(reqSearchScCourse.getPageNum(), reqSearchScCourse.getPageSize());
List<RespSearchCourse> courseList = courseMapper.selectCourseListWithStudentCourse(reqSearchScCourse, respPage); List<RespSearchCourse> courseList = courseMapper.selectCourseListWithStudentCourse(reqSearchScCourse, respPage,SecurityUtils.getLoginUser().getNowTenantId());
respPage.setRows(courseList); respPage.setRows(courseList);
return APIResponse.toAPIResponse(respPage); return APIResponse.toAPIResponse(respPage);
} }
@ -111,7 +111,7 @@ public class BusinessScCourseService {
if (StringUtils.isNotEmpty(reqSelect.getSearch())) { if (StringUtils.isNotEmpty(reqSelect.getSearch())) {
qw.like("course_name", reqSelect.getSearch()); qw.like("course_name", reqSelect.getSearch());
} }
qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId());
qw.orderByDesc("create_time"); qw.orderByDesc("create_time");
List<ScCourse> list = scCourseService.list(qw); List<ScCourse> list = scCourseService.list(qw);
return APIResponse.toAPIResponse(list); return APIResponse.toAPIResponse(list);
@ -138,6 +138,7 @@ public class BusinessScCourseService {
respScCourseDetail.setCourseTypeId(detailInfo.getCourseTypeId()); respScCourseDetail.setCourseTypeId(detailInfo.getCourseTypeId());
respScCourseDetail.setTeachingMode(detailInfo.getTeachingMode()); respScCourseDetail.setTeachingMode(detailInfo.getTeachingMode());
respScCourseDetail.setCourseIntro(detailInfo.getCourseIntro()); respScCourseDetail.setCourseIntro(detailInfo.getCourseIntro());
respScCourseDetail.setClaFee(detailInfo.getClaFee());
respScCourseDetail.setCourseCampus("部分校区"); respScCourseDetail.setCourseCampus("部分校区");
respScCourseDetail.setPartCampus(new String[]{}); respScCourseDetail.setPartCampus(new String[]{});
@ -239,6 +240,7 @@ public class BusinessScCourseService {
scCourse.setCreateUser(loginUser.getUserId()); scCourse.setCreateUser(loginUser.getUserId());
scCourse.setLastUpdateUser(loginUser.getUserId()); scCourse.setLastUpdateUser(loginUser.getUserId());
scCourse.setTenantId(loginUser.getNowTenantId()); scCourse.setTenantId(loginUser.getNowTenantId());
scCourse.setClaFee(reqAddScCourse.getClaFee());
boolean addScCourse = scCourseService.save(scCourse); boolean addScCourse = scCourseService.save(scCourse);
// course_charge保存 // course_charge保存
@ -309,6 +311,7 @@ public class BusinessScCourseService {
updateCourse.setCourseTypeId(reqChangeScCourse.getCourseTypeId()); updateCourse.setCourseTypeId(reqChangeScCourse.getCourseTypeId());
updateCourse.setTeachingMode(reqChangeScCourse.getTeachingMode()); updateCourse.setTeachingMode(reqChangeScCourse.getTeachingMode());
updateCourse.setCourseIntro(reqChangeScCourse.getCourseIntro()); updateCourse.setCourseIntro(reqChangeScCourse.getCourseIntro());
updateCourse.setClaFee(reqChangeScCourse.getClaFee());
updateCourse.setLastUpdateUser(loginUser.getUserId()); updateCourse.setLastUpdateUser(loginUser.getUserId());
updateCourse.setLastUpdateTime(new Date()); updateCourse.setLastUpdateTime(new Date());
updateCourse.setTenantId(loginUser.getNowTenantId()); updateCourse.setTenantId(loginUser.getNowTenantId());

@ -58,6 +58,7 @@ public class BusinessScCourseTypeService {
qw.like("course_type", reqSearchScCourseType.getCourseType()); qw.like("course_type", reqSearchScCourseType.getCourseType());
} }
qw.eq("in_use", "1"); qw.eq("in_use", "1");
qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId());
qw.orderByDesc("create_time"); qw.orderByDesc("create_time");
List<ScCourseType> list = scCourseTypeService.list(qw); List<ScCourseType> list = scCourseTypeService.list(qw);
return APIResponse.toAPIResponse(list); return APIResponse.toAPIResponse(list);

@ -6,6 +6,7 @@ import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
import cn.xluobo.business.sc.course.service.IScClaTimeAttendService; import cn.xluobo.business.sc.course.service.IScClaTimeAttendService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -29,20 +30,20 @@ public class ScClaTimeAttendServiceImpl extends ServiceImpl<ScClaTimeAttendMappe
@Override @Override
public Integer getNeedAttendCount(String beginDate, String endDate) { public Integer getNeedAttendCount(String beginDate, String endDate) {
return baseMapper.selectNeedAttendCount(beginDate, endDate); return baseMapper.selectNeedAttendCount(beginDate, endDate, SecurityUtils.getLoginUser().getNowTenantId());
} }
@Override @Override
public Integer getAttendCount(String beginDate, String endDate, String[] attendStatus) { public Integer getAttendCount(String beginDate, String endDate, String[] attendStatus) {
return baseMapper.selectAttendCount(beginDate, endDate, attendStatus); return baseMapper.selectAttendCount(beginDate, endDate, attendStatus, SecurityUtils.getLoginUser().getNowTenantId());
} }
@Override @Override
public BigDecimal getAttendCostHour(String beginDate, String endDate, boolean needAttend) { public BigDecimal getAttendCostHour(String beginDate, String endDate, boolean needAttend) {
if(needAttend) { if(needAttend) {
return baseMapper.selectNeedAttendCostHour(beginDate, endDate); return baseMapper.selectNeedAttendCostHour(beginDate, endDate, SecurityUtils.getLoginUser().getNowTenantId());
} else { } else {
return baseMapper.selectAttendCostHour(beginDate, endDate); return baseMapper.selectAttendCostHour(beginDate, endDate, SecurityUtils.getLoginUser().getNowTenantId());
} }
} }

@ -24,5 +24,5 @@ public interface ScOrderMapper extends com.baomidou.mybatisplus.core.mapper.Base
* *
* @return * @return
*/ */
Integer selectArrearsStudentCount(); Integer selectArrearsStudentCount(@Param("tenantId") String tenantId);
} }

@ -54,6 +54,9 @@
order by a.create_time desc order by a.create_time desc
</select> </select>
<select id="selectArrearsStudentCount" resultType="java.lang.Integer"> <select id="selectArrearsStudentCount" resultType="java.lang.Integer">
select count(distinct o.student_id) from sc_order o where o.order_status='2' and o.receipt_fee+o.balance_fee <![CDATA[ < ]]> o.actual_total_fee select count(distinct o.student_id) from sc_order o
where o.order_status='2'
and o.tenant_id=#{tenantId}
and o.receipt_fee+o.balance_fee <![CDATA[ < ]]> o.actual_total_fee
</select> </select>
</mapper> </mapper>

@ -34,7 +34,6 @@ import cn.xluobo.business.sys.admin.service.ISysDeptService;
import cn.xluobo.business.sys.admin.service.ISysUserService; import cn.xluobo.business.sys.admin.service.ISysUserService;
import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount; import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount;
import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService; import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService;
import cn.xluobo.business.sys.staff.service.ISysStaffService;
import cn.xluobo.business.sys.tag.service.ISysTagService; import cn.xluobo.business.sys.tag.service.ISysTagService;
import cn.xluobo.config.exception.BusinessException; import cn.xluobo.config.exception.BusinessException;
import cn.xluobo.core.api.APIBaseResponse; import cn.xluobo.core.api.APIBaseResponse;
@ -102,8 +101,7 @@ public class BusinessScOrderService {
private ISysTagService tagService; private ISysTagService tagService;
@Autowired @Autowired
private ScOrderMapper orderMapper; private ScOrderMapper orderMapper;
@Autowired
private ISysStaffService staffService;
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@Autowired @Autowired
@ -164,10 +162,12 @@ public class BusinessScOrderService {
*/ */
public APIResponse signUp(ReqBusinessSignUp reqBusinessSignUp) { public APIResponse signUp(ReqBusinessSignUp reqBusinessSignUp) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
//校验参数
APIResponse checkParam = reqBusinessSignUp.checkParam(); APIResponse checkParam = reqBusinessSignUp.checkParam();
if (!checkParam.isSuccess()) { if (!checkParam.isSuccess()) {
return checkParam; return checkParam;
} }
Long studentId = reqBusinessSignUp.getStudentId(); Long studentId = reqBusinessSignUp.getStudentId();
Long handleDepartId = reqBusinessSignUp.getHandleDepartId(); Long handleDepartId = reqBusinessSignUp.getHandleDepartId();
@ -308,7 +308,7 @@ public class BusinessScOrderService {
for (ReqBusinessSignUpReceipt signUpReceipt : signUpReceiptList) { for (ReqBusinessSignUpReceipt signUpReceipt : signUpReceiptList) {
SysReceiptAccount receiptAccount = receiptAccountService.getById(signUpReceipt.getAccountId()); SysReceiptAccount receiptAccount = receiptAccountService.getById(signUpReceipt.getAccountId());
if (null == receiptAccount) { if (null == receiptAccount) {
throw new BusinessException("无获取收款账户,请核查后重试!"); throw new BusinessException("无获取收款账户,请核查后重试!");
} }
ScOrderAccount orderAccount = new ScOrderAccount(); ScOrderAccount orderAccount = new ScOrderAccount();
orderAccount.setOrderId(orderId); orderAccount.setOrderId(orderId);

@ -7,6 +7,7 @@ import cn.xluobo.business.sc.order.service.IScOrderService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -32,12 +33,13 @@ public class ScOrderServiceImpl extends ServiceImpl<ScOrderMapper, ScOrder> impl
public Integer orderCount(String beginDate, String endDate, String orderType) { public Integer orderCount(String beginDate, String endDate, String orderType) {
QueryWrapper<ScOrder> qw = new QueryWrapper<>(); QueryWrapper<ScOrder> qw = new QueryWrapper<>();
qw.eq("order_type", orderType); qw.eq("order_type", orderType);
qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId());
qw.between("handle_date", beginDate, endDate); qw.between("handle_date", beginDate, endDate);
return this.count(qw); return this.count(qw);
} }
@Override @Override
public Integer arrearsStudentCount() { public Integer arrearsStudentCount() {
return baseMapper.selectArrearsStudentCount(); return baseMapper.selectArrearsStudentCount(SecurityUtils.getLoginUser().getNowTenantId());
} }
} }

@ -28,7 +28,9 @@ public class ScCommissionPlansController {
RespPage<ScCommissionPlans> page1 = service.page(page, Wrappers.<ScCommissionPlans>lambdaQuery() RespPage<ScCommissionPlans> page1 = service.page(page, Wrappers.<ScCommissionPlans>lambdaQuery()
.eq(StrUtil.isNotEmpty((CharSequence) params.get("planName")), .eq(StrUtil.isNotEmpty((CharSequence) params.get("planName")),
ScCommissionPlans::getPlanName, params.get("planName")) ScCommissionPlans::getPlanName, params.get("planName"))
.eq(ObjectUtil.isNotEmpty(params.get("isActive")), ScCommissionPlans::getIsActive, params.get("isActive")) .eq(ScCommissionPlans::getTenantId, SecurityUtils.getLoginUser().getNowTenantId())
.eq(ObjectUtil.isNotEmpty(params.get("isActive")),
ScCommissionPlans::getIsActive, params.get("isActive"))
); );
return AjaxResult.success(page1); return AjaxResult.success(page1);
} }
@ -37,6 +39,7 @@ public class ScCommissionPlansController {
public AjaxResult listAll(){ public AjaxResult listAll(){
List<ScCommissionPlans> page1 = service.list( Wrappers.<ScCommissionPlans>lambdaQuery() List<ScCommissionPlans> page1 = service.list( Wrappers.<ScCommissionPlans>lambdaQuery()
.eq(ScCommissionPlans::getIsActive, 1) .eq(ScCommissionPlans::getIsActive, 1)
.eq(ScCommissionPlans::getTenantId, SecurityUtils.getLoginUser().getNowTenantId())
); );
return AjaxResult.success(page1); return AjaxResult.success(page1);
} }

@ -1,10 +1,10 @@
package cn.xluobo.business.sc.salary.repo.model; package cn.xluobo.business.sc.salary.repo.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
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 com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -41,7 +41,7 @@ public class ScCommissionPlans {
private Byte isActive; private Byte isActive;
@TableField(exist = false)
private String tenantId; private String tenantId;
@ -49,4 +49,8 @@ public class ScCommissionPlans {
private Date effectiveDate; private Date effectiveDate;
private Date createdAt; private Date createdAt;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
} }

@ -1,10 +1,7 @@
package cn.xluobo.business.sc.student.controller; package cn.xluobo.business.sc.student.controller;
import cn.xluobo.business.sc.student.service.BusinessScStudentAccountService; import cn.xluobo.business.sc.student.service.BusinessScStudentAccountService;
import cn.xluobo.core.api.APIResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -27,9 +24,9 @@ public class ScStudentAccountController {
* @param studentId * @param studentId
* @return * @return
*/ */
@GetMapping("/info/studentAccountBalance/{studentId}") // @GetMapping("/info/studentAccountBalance/{studentId}")
public APIResponse studentAccountBalance(@PathVariable("studentId") Long studentId) { // public APIResponse studentAccountBalance(@PathVariable("studentId") Long studentId) {
return accountService.studentAccountBalance(studentId); // return accountService.studentAccountBalance(studentId);
} // }
} }

@ -50,10 +50,10 @@ public class ScStudentCourseController {
* *
* @return * @return
*/ */
@PostMapping("/update/studentCourseChooseCla") // @PostMapping("/update/studentCourseChooseCla")
public APIResponse studentCourseChooseCla(@RequestBody ReqStudentCourseChooseCla studentCourseChooseCla){ // public APIResponse studentCourseChooseCla(@RequestBody ReqStudentCourseChooseCla studentCourseChooseCla){
return studentCourseService.studentCourseChooseCla(studentCourseChooseCla); // return studentCourseService.studentCourseChooseCla(studentCourseChooseCla);
} // }
/** /**
* *
@ -112,8 +112,8 @@ public class ScStudentCourseController {
* @param studentCourseId * @param studentCourseId
* @return * @return
*/ */
@PostMapping("/update/removeStuFromCla/{studentCourseId}") // @PostMapping("/update/removeStuFromCla/{studentCourseId}")
public APIResponse removeStuFromCla(@PathVariable("studentCourseId") Long studentCourseId) { // public APIResponse removeStuFromCla(@PathVariable("studentCourseId") Long studentCourseId) {
return studentCourseService.removeStuFromCla(studentCourseId); // return studentCourseService.removeStuFromCla(studentCourseId);
} // }
} }

@ -1,6 +1,7 @@
package cn.xluobo.business.sc.student.domain.req; package cn.xluobo.business.sc.student.domain.req;
import cn.xluobo.core.page.ReqPageBase; import cn.xluobo.core.page.ReqPageBase;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -26,4 +27,10 @@ public class ReqSearchStuCourseSignUp extends ReqPageBase implements Serializabl
// 剩余最大课时 // 剩余最大课时
private Integer minBalanceHour; private Integer minBalanceHour;
private String tenantId;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
} }

@ -15,5 +15,6 @@ public class ReqStudentSelect extends ReqPageBase {
private String search; private String search;
private String schoolId; private String schoolId;
private String tenantId;
} }

@ -24,9 +24,6 @@ public class RespSearchStudent implements Serializable {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long studentId; private Long studentId;
private Long schoolId;
private String schoolName;
private String studentName; private String studentName;

@ -1,6 +1,8 @@
package cn.xluobo.business.sc.student.domain.resp; package cn.xluobo.business.sc.student.domain.resp;
import cn.xluobo.business.sc.course.enums.CourseChargeTypeEnum; import cn.xluobo.business.sc.course.enums.CourseChargeTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.Period; import org.joda.time.Period;
@ -17,6 +19,7 @@ import java.util.Date;
@Data @Data
public class RespStuCourseSignUpStudent { public class RespStuCourseSignUpStudent {
@JsonSerialize(using = ToStringSerializer.class)
private Long studentCourseId; private Long studentCourseId;
private Long claId; private Long claId;

@ -80,7 +80,7 @@ public interface ScStudentCourseMapper extends BaseMapper<ScStudentCourse> {
* @param minBalanceDay * @param minBalanceDay
* @return * @return
*/ */
Integer selectWillExpireDateCount(Integer minBalanceDay); Integer selectWillExpireDateCount( @Param("minBalanceDay") Integer minBalanceDay, @Param("tenantId") String tenantId);
/** /**
* minBalanceHour * minBalanceHour
@ -88,7 +88,7 @@ public interface ScStudentCourseMapper extends BaseMapper<ScStudentCourse> {
* @param minBalanceHour * @param minBalanceHour
* @return * @return
*/ */
Integer selectWillExpireHourCount(Integer minBalanceHour); Integer selectWillExpireHourCount(@Param("minBalanceHour")Integer minBalanceHour, @Param("tenantId") String tenantId);
/** /**
* *

@ -115,8 +115,9 @@
select count(1) from sc_student_course sc select count(1) from sc_student_course sc
where sc.charge_type='date' and sc.status='1' where sc.charge_type='date' and sc.status='1'
and exists(select 1 from sc_student_course_order sco and exists(select 1 from sc_student_course_order sco
where sco.student_course_id=sc.student_course_id where sc.student_course_id=sc.student_course_id
and sco.valid=1 and sco.valid=1
and sc.tenant_id=#{tenantId}
and date_format(now(),'%Y-%m-%d') between sco.begin_date and sco.end_date and date_format(now(),'%Y-%m-%d') between sco.begin_date and sco.end_date
and (datediff(sco.end_date,now())+1+((select ifnull(sum(sco.total_day),0) from sc_student_course_order sco_will_effect and (datediff(sco.end_date,now())+1+((select ifnull(sum(sco.total_day),0) from sc_student_course_order sco_will_effect
where sco_will_effect.student_course_id=sc.student_course_id where sco_will_effect.student_course_id=sc.student_course_id
@ -127,6 +128,7 @@
select count(1) from sc_student_course sc select count(1) from sc_student_course sc
where sc.charge_type <![CDATA[ <> ]]> 'date' where sc.charge_type <![CDATA[ <> ]]> 'date'
and sc.status='1' and sc.status='1'
and sc.tenant_id=#{tenantId}
and (sc.balance_hour - (select ifnull(sum(sco.balance_hour),0) and (sc.balance_hour - (select ifnull(sum(sco.balance_hour),0)
from sc_student_course_order sco from sc_student_course_order sco
where sc.student_course_id=sco.student_course_id where sc.student_course_id=sco.student_course_id
@ -160,7 +162,7 @@
from sc_student_course a from sc_student_course a
left join sys_dept d on a.dept_id=d.dept_id left join sys_dept d on a.dept_id=d.dept_id
,sc_student b ,sc_student b
where a.student_id=b.student_id where a.student_id=b.student_id and d.tenant_id=#{reqSearchStuCourseSignUp.tenantId}
<if test="reqSearchStuCourseSignUp.claId != null"> <if test="reqSearchStuCourseSignUp.claId != null">
and a.cla_id=#{reqSearchStuCourseSignUp.claId} and a.cla_id=#{reqSearchStuCourseSignUp.claId}
</if> </if>

@ -4,9 +4,8 @@
<select id="selectForSearchTable" resultType="cn.xluobo.business.sc.student.domain.resp.RespSearchStudent"> <select id="selectForSearchTable" resultType="cn.xluobo.business.sc.student.domain.resp.RespSearchStudent">
select student_id, a.school_id, student_name, birth_day, TIMESTAMPDIFF(YEAR, a.birth_day, CURDATE()) as age, sex, phone, in_time, select student_id, a.school_id, student_name, birth_day, TIMESTAMPDIFF(YEAR, a.birth_day, CURDATE()) as age, sex, phone, in_time,
b.school_name,
(select group_concat(sc.contact_nick,'(',fcn_dict_name(sc.contact_relation,'contact_relation'),') ',sc.contact_phone separator ';') from sc_student_contact sc where sc.student_id=a.student_id) as contact_info (select group_concat(sc.contact_nick,'(',fcn_dict_name(sc.contact_relation,'contact_relation'),') ',sc.contact_phone separator ';') from sc_student_contact sc where sc.student_id=a.student_id) as contact_info
from sc_student a left join sc_school b on a.school_id=b.school_id from sc_student a
where a.delete_flag='0' and a.tenant_id=#{reqSearchScStudent.tenantId} where a.delete_flag='0' and a.tenant_id=#{reqSearchScStudent.tenantId}
<if test="reqSearchScStudent.schoolId != null and reqSearchScStudent.schoolId != ''"> <if test="reqSearchScStudent.schoolId != null and reqSearchScStudent.schoolId != ''">
and a.school_id = #{reqSearchScStudent.schoolId} and a.school_id = #{reqSearchScStudent.schoolId}
@ -22,8 +21,9 @@
</if> </if>
order by a.create_time desc order by a.create_time desc
</select> </select>
<select id="selectForSelect" resultType="cn.xluobo.business.sc.student.domain.resp.RespSearchStudent"> <select id="selectForSelect" resultType="cn.xluobo.business.sc.student.domain.resp.RespSearchStudent">
select student_id,student_name from sc_student where delete_flag='0' select student_id,student_name from sc_student where delete_flag='0' and tenant_id=#{studentSelect.tenantId}
<if test="studentSelect.search != null and studentSelect.search != ''"> <if test="studentSelect.search != null and studentSelect.search != ''">
and student_name like concat('%',#{studentSelect.search} ,'%') and student_name like concat('%',#{studentSelect.search} ,'%')
</if> </if>

@ -37,6 +37,7 @@ public class ScStudent implements Serializable {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long studentId; private Long studentId;
private Long appUserId;
/** /**
* *
*/ */
@ -111,8 +112,6 @@ public class ScStudent implements Serializable {
@TableField("last_update_time") @TableField("last_update_time")
private Date lastUpdateTime; private Date lastUpdateTime;
@TableField(exist = false)
private String schoolName;
@TableField(exist = false) @TableField(exist = false)
private Integer age; private Integer age;
@TableField(exist = false) @TableField(exist = false)

@ -29,8 +29,6 @@ import cn.xluobo.business.sc.student.repo.model.ScStudentContact;
import cn.xluobo.business.sc.student.repo.model.ScStudentCourse; import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
import cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder; import cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder;
import cn.xluobo.business.sys.admin.service.ISysDeptService; import cn.xluobo.business.sys.admin.service.ISysDeptService;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.business.sys.staff.service.ISysStaffService;
import cn.xluobo.config.exception.BusinessException; import cn.xluobo.config.exception.BusinessException;
import cn.xluobo.core.api.APIResponse; import cn.xluobo.core.api.APIResponse;
import cn.xluobo.core.api.ApiResEnums; import cn.xluobo.core.api.ApiResEnums;
@ -38,8 +36,10 @@ import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.ruoyi.common.core.domain.entity.SysDept; 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.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysUserService;
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;
@ -78,7 +78,7 @@ public class BusinessScStudentCourseService {
@Autowired @Autowired
private IScClaTimeAttendService attendService; private IScClaTimeAttendService attendService;
@Autowired @Autowired
private ISysStaffService staffService; private ISysUserService staffService;
@Autowired @Autowired
private IScStudentCourseOrderService courseOrderService; private IScStudentCourseOrderService courseOrderService;
@Autowired @Autowired
@ -311,7 +311,7 @@ public class BusinessScStudentCourseService {
} }
// 教师信息 // 教师信息
SysStaff sysStaff = staffService.getById(teacherId); SysUser sysStaff = staffService.selectUserById(teacherId);
// 保存上课记录 // 保存上课记录
List<ScClaTimeAttend> saveAttendList = Lists.newArrayList(); List<ScClaTimeAttend> saveAttendList = Lists.newArrayList();
@ -395,7 +395,7 @@ public class BusinessScStudentCourseService {
addClaTimeAttend.setClaId(studentCourse.getClaId()); addClaTimeAttend.setClaId(studentCourse.getClaId());
addClaTimeAttend.setCourseId(studentCourse.getCourseId()); addClaTimeAttend.setCourseId(studentCourse.getCourseId());
addClaTimeAttend.setTeacherId(teacherId); addClaTimeAttend.setTeacherId(teacherId);
addClaTimeAttend.setTeacherName(sysStaff.getStaffName()); addClaTimeAttend.setTeacherName(sysStaff.getNickName());
addClaTimeAttend.setChargeType(studentDbChargeType); addClaTimeAttend.setChargeType(studentDbChargeType);
if (CourseChargeTypeEnum.DATE.getChargeType().equals(studentDbChargeType)) { if (CourseChargeTypeEnum.DATE.getChargeType().equals(studentDbChargeType)) {
addClaTimeAttend.setTeacherGetHour(null); addClaTimeAttend.setTeacherGetHour(null);
@ -472,10 +472,12 @@ public class BusinessScStudentCourseService {
if (StudentCourseStatusEnum.STOP_CLA.getStudentCourseStatus().equals(studentCourse.getStatus())) { if (StudentCourseStatusEnum.STOP_CLA.getStudentCourseStatus().equals(studentCourse.getStatus())) {
return APIResponse.toExceptionResponse("当前状态为停课,无需停课!"); return APIResponse.toExceptionResponse("当前状态为停课,无需停课!");
} }
ScStudentCourse update = new ScStudentCourse(); // ScStudentCourse update = new ScStudentCourse();
update.setStudentCourseId(studentCourseId); // update.setStudentCourseId(studentCourseId);
update.setStatus(StudentCourseStatusEnum.STOP_CLA.getStudentCourseStatus()); // update.setStatus(StudentCourseStatusEnum.STOP_CLA.getStudentCourseStatus());
studentCourseService.updateById(update); studentCourseService.update(new UpdateWrapper<ScStudentCourse>()
.eq("student_course_id",studentCourseId)
.set("status",StudentCourseStatusEnum.STOP_CLA.getStudentCourseStatus()));
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();
} }
@ -496,10 +498,13 @@ public class BusinessScStudentCourseService {
if (StudentCourseStatusEnum.AT_CLA.getStudentCourseStatus().equals(studentCourse.getStatus())) { if (StudentCourseStatusEnum.AT_CLA.getStudentCourseStatus().equals(studentCourse.getStatus())) {
return APIResponse.toExceptionResponse("当前状态为在读,无需变更!"); return APIResponse.toExceptionResponse("当前状态为在读,无需变更!");
} }
ScStudentCourse update = new ScStudentCourse(); // ScStudentCourse update = new ScStudentCourse();
update.setStudentCourseId(studentCourseId); // update.setStudentCourseId(studentCourseId);
update.setStatus(StudentCourseStatusEnum.AT_CLA.getStudentCourseStatus()); // update.setStatus(StudentCourseStatusEnum.AT_CLA.getStudentCourseStatus());
studentCourseService.updateById(update); // studentCourseService.updateById(update);
studentCourseService.update(new UpdateWrapper<ScStudentCourse>()
.eq("student_course_id",studentCourseId)
.set("status",StudentCourseStatusEnum.AT_CLA.getStudentCourseStatus()));
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();
} }

@ -1,7 +1,6 @@
package cn.xluobo.business.sc.student.service; package cn.xluobo.business.sc.student.service;
import cn.xluobo.business.sc.base.repo.model.ScSchool; import cn.hutool.core.util.ObjectUtil;
import cn.xluobo.business.sc.base.service.IScSchoolService;
import cn.xluobo.business.sc.student.domain.req.ReqSearchScStudent; import cn.xluobo.business.sc.student.domain.req.ReqSearchScStudent;
import cn.xluobo.business.sc.student.domain.req.ReqStudentSelect; import cn.xluobo.business.sc.student.domain.req.ReqStudentSelect;
import cn.xluobo.business.sc.student.domain.resp.RespSearchStudent; import cn.xluobo.business.sc.student.domain.resp.RespSearchStudent;
@ -17,16 +16,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import org.apache.commons.lang3.StringUtils; import com.ruoyi.system.domain.AppUser;
import com.ruoyi.system.service.YjAppUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
* @author zhangbaoyu * @author zhangbaoyu
@ -45,12 +43,12 @@ public class BusinessScStudentService {
@Autowired @Autowired
private ScStudentMapper studentMapper; private ScStudentMapper studentMapper;
@Autowired @Autowired
private IScSchoolService schoolService;
@Autowired
private IScStudentCourseService studentCourseService; private IScStudentCourseService studentCourseService;
@Autowired @Autowired
private IScStudentAccountService accountService; private IScStudentAccountService accountService;
@Autowired
private YjAppUserService appUserService;
/** /**
* *
* *
@ -93,12 +91,7 @@ public class BusinessScStudentService {
List<ScStudentContact> contactList = contactService.list(qw); List<ScStudentContact> contactList = contactService.list(qw);
detailInfo.setContactList(contactList); detailInfo.setContactList(contactList);
// 学校名称
if (null != detailInfo.getSchoolId()) {
ScSchool scSchool = schoolService.getById(detailInfo.getSchoolId());
Optional.ofNullable(scSchool)
.ifPresent(item-> detailInfo.setSchoolName(item.getSchoolName()));
}
return APIResponse.toAPIResponse(detailInfo); return APIResponse.toAPIResponse(detailInfo);
} }
@ -112,16 +105,13 @@ public class BusinessScStudentService {
public APIResponse addScStudent(ScStudent scStudent) { public APIResponse addScStudent(ScStudent scStudent) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (StringUtils.isNotEmpty(scStudent.getSchoolName())) {
Long schoolId = schoolService.getSchoolId(scStudent.getSchoolName());
scStudent.setSchoolId(schoolId);
}
// 保存学生信息 // 保存学生信息
List<ScStudentContact> contactList = scStudent.getContactList(); List<ScStudentContact> contactList = scStudent.getContactList();
if (null != contactList && contactList.size() > 0) { if (null != contactList && contactList.size() > 0) {
scStudent.setPhone(contactList.get(0).getContactPhone()); scStudent.setPhone(contactList.get(0).getContactPhone());
} }
insertAppUser(scStudent);
scStudent.setTenantId(SecurityUtils.getLoginUser().getNowTenantId()); scStudent.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
scStudent.setCreateUser(loginUser.getUserId()); scStudent.setCreateUser(loginUser.getUserId());
scStudentService.save(scStudent); scStudentService.save(scStudent);
@ -144,7 +134,20 @@ public class BusinessScStudentService {
return APIResponse.toAPIResponse(scStudent.getStudentId().toString()); return APIResponse.toAPIResponse(scStudent.getStudentId().toString());
} }
//关联appUser账号
public void insertAppUser(ScStudent scStudent){
AppUser appUser=appUserService.getOne(new QueryWrapper<AppUser>().eq("phone_number",scStudent.getPhone()));
if (ObjectUtil.isEmpty(appUser)){
appUser=new AppUser();
appUser.setNickName(scStudent.getStudentName());
appUser.setPhoneNumber(scStudent.getPhone());
appUser.setPassword(SecurityUtils.encryptPassword(scStudent.getPhone()));
appUser.setStatus(1);
appUserService.save(appUser);
}
scStudent.setAppUserId(appUser.getId());
}
/** /**
* *
* *
@ -157,10 +160,6 @@ public class BusinessScStudentService {
} }
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (StringUtils.isNotEmpty(scStudent.getSchoolName())) {
Long schoolId = schoolService.getSchoolId(scStudent.getSchoolName());
scStudent.setSchoolId(schoolId);
}
// 删除联系人信息 // 删除联系人信息
UpdateWrapper<ScStudentContact> uw = new UpdateWrapper<>(); UpdateWrapper<ScStudentContact> uw = new UpdateWrapper<>();
@ -208,12 +207,12 @@ public class BusinessScStudentService {
QueryWrapper<ScStudentAccount> qwSsa = new QueryWrapper<>(); QueryWrapper<ScStudentAccount> qwSsa = new QueryWrapper<>();
qwSsa.in("student_id", studentIds); qwSsa.in("student_id", studentIds);
List<ScStudentAccount> accountList = accountService.list(qwSsa); // List<ScStudentAccount> accountList = accountService.list(qwSsa);
for (ScStudentAccount account : accountList) { // for (ScStudentAccount account : accountList) {
if(account.getBalanceFee().compareTo(BigDecimal.ZERO) != 0) { // if(account.getBalanceFee().compareTo(BigDecimal.ZERO) != 0) {
return APIResponse.toExceptionResponse("学生账户尚有余额'"+account.getBalanceFee().toString()+"元',无法删除"); // return APIResponse.toExceptionResponse("学生账户尚有余额'"+account.getBalanceFee().toString()+"元',无法删除");
} // }
} // }
boolean deleteScStudent = scStudentService.removeByIds(Arrays.asList(studentIds)); boolean deleteScStudent = scStudentService.removeByIds(Arrays.asList(studentIds));
if (deleteScStudent) { if (deleteScStudent) {

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -138,12 +139,12 @@ public class ScStudentCourseServiceImpl extends ServiceImpl<ScStudentCourseMappe
@Override @Override
public Integer getWillExpireDateCount(Integer minBalanceDay) { public Integer getWillExpireDateCount(Integer minBalanceDay) {
return baseMapper.selectWillExpireDateCount(minBalanceDay); return baseMapper.selectWillExpireDateCount(minBalanceDay, SecurityUtils.getLoginUser().getNowTenantId());
} }
@Override @Override
public Integer getWillExpireHourCount(Integer minBalanceHour) { public Integer getWillExpireHourCount(Integer minBalanceHour) {
return baseMapper.selectWillExpireHourCount(minBalanceHour); return baseMapper.selectWillExpireHourCount(minBalanceHour, SecurityUtils.getLoginUser().getNowTenantId());
} }
@Override @Override

@ -9,6 +9,7 @@ import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -26,6 +27,7 @@ public class ScStudentServiceImpl extends ServiceImpl<ScStudentMapper, ScStudent
@Override @Override
public List<RespSearchStudent> selectStudentSelect(ReqStudentSelect studentSelect, Page page) { public List<RespSearchStudent> selectStudentSelect(ReqStudentSelect studentSelect, Page page) {
studentSelect.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
return baseMapper.selectForSelect(studentSelect, page); return baseMapper.selectForSelect(studentSelect, page);
} }

@ -1,12 +1,13 @@
package cn.xluobo.business.sys.admin.controller; package cn.xluobo.business.sys.admin.controller;
import cn.xluobo.business.sys.admin.domain.req.ReqSearchSysDept;
import cn.xluobo.business.sys.admin.domain.resp.RespTreeSelect; import cn.xluobo.business.sys.admin.domain.resp.RespTreeSelect;
import cn.xluobo.business.sys.admin.service.BusinessSysDeptService; import cn.xluobo.business.sys.admin.service.BusinessSysDeptService;
import cn.xluobo.core.api.APIResponse; import cn.xluobo.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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -25,16 +26,7 @@ public class ISysDeptController {
@Autowired @Autowired
private BusinessSysDeptService sysDeptService; private BusinessSysDeptService sysDeptService;
/**
*
*
* @param reqSearchSysDept
* @return
*/
@GetMapping("/list/searchList")
public APIResponse searchList(ReqSearchSysDept reqSearchSysDept) {
return sysDeptService.searchList(reqSearchSysDept);
}
/** /**
* select * select
@ -46,16 +38,6 @@ public class ISysDeptController {
return sysDeptService.treeSelect(); return sysDeptService.treeSelect();
} }
/**
*
*
* @param deptId
* @return
*/
@GetMapping("/info/detailById/{deptId}")
public APIResponse detailById(@PathVariable("deptId") Long deptId) {
return sysDeptService.detailById(deptId);
}
/** /**
* *
@ -68,17 +50,6 @@ public class ISysDeptController {
return APIResponse.toAPIResponse(respTreeSelects); return APIResponse.toAPIResponse(respTreeSelects);
} }
/**
*
*
* @return
*/
@GetMapping("/list/campusListLimitByUser")
public APIResponse campusListLimitByUser() {
List<RespTreeSelect> respTreeSelects = sysDeptService.campusListLimitByUser();
return APIResponse.toAPIResponse(respTreeSelects);
}
/** /**
* *
* *
@ -92,16 +63,5 @@ public class ISysDeptController {
return APIResponse.toAPIResponse(respTreeSelects); return APIResponse.toAPIResponse(respTreeSelects);
} }
/**
*
*
*
*
* @return
*/
@GetMapping("/list/campusSelectLimitByUser")
public APIResponse campusSelectLimitByUser() {
List<RespTreeSelect> respTreeSelects = sysDeptService.campusSelectLimitByUser();
return APIResponse.toAPIResponse(respTreeSelects);
}
} }

@ -1,35 +0,0 @@
package cn.xluobo.business.sys.admin.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_user_dept")
public class SysUserDept {
/**
* id
*/
@TableId(value = "user_id", type = IdType.ASSIGN_ID)
private Long userId;
/**
* id
*/
@TableField("dept_id")
private Long deptId;
/**
*
*/
@TableField("tenant_id")
private String tenantId;
}

@ -1,16 +0,0 @@
package cn.xluobo.business.sys.admin.repo.mapper;
import cn.xluobo.business.sys.admin.model.SysUserDept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author zhangby
* @since 2020-08-07
*/
public interface ISysUserDeptMapper extends BaseMapper<SysUserDept> {
}

@ -1,5 +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="cn.xluobo.business.sys.admin.repo.mapper.ISysUserDeptMapper">
</mapper>

@ -1,24 +1,21 @@
package cn.xluobo.business.sys.admin.service; package cn.xluobo.business.sys.admin.service;
import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
import cn.xluobo.business.sc.student.service.IScStudentCourseService;
import cn.xluobo.business.sys.admin.domain.req.ReqSearchSysDept;
import cn.xluobo.business.sys.admin.domain.resp.RespTreeSelect; import cn.xluobo.business.sys.admin.domain.resp.RespTreeSelect;
import cn.xluobo.business.sys.admin.model.SysUserDept;
import cn.xluobo.core.api.APIResponse; import cn.xluobo.core.api.APIResponse;
import cn.xluobo.core.api.ApiResEnums;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.mapper.SysDeptMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -34,34 +31,7 @@ public class BusinessSysDeptService {
@Autowired @Autowired
private SysDeptMapper deptMapper; private SysDeptMapper deptMapper;
@Autowired
private ISysUserDeptService userDeptService;
@Autowired
private IScStudentCourseService studentCourseService;
/**
*
*
* @param reqSearchSysDept
* @return
*/
public APIResponse searchList(ReqSearchSysDept reqSearchSysDept) {
QueryWrapper qw = new QueryWrapper();
qw.eq("delete_flag", "0");
if (StringUtils.isNotEmpty(reqSearchSysDept.getDeptName())) {
qw.like("dept_name", reqSearchSysDept.getDeptName());
}
// if (StringUtils.isNotEmpty(reqSearchSysDept.getInUse())) {
// qw.eq("in_use", reqSearchSysDept.getInUse());
// }
// qw.orderByAsc("sort");
// List<SysDept> list = sysDeptService.list(qw);
// SysDept sysDept = new SysDept();
// sysDept.setDeptId(-1L);
// sysDept.converterTree(list);
// List<SysDept> respPage = sysDept.getChildren();
return APIResponse.toAPIResponse(null);
}
/** /**
* select * select
@ -121,56 +91,6 @@ public class BusinessSysDeptService {
} }
/**
*
*
* @param deptId
* @return
*/
public APIResponse detailById(Long deptId) {
if (null == deptId) {
return APIResponse.toAPIResponse(null);
}
SysDept detailInfo = sysDeptService.getById(deptId);
return APIResponse.toAPIResponse(detailInfo);
}
/**
*
*
* @param deptIds
* @return
*/
public APIResponse deleteById(List<Long> deptIds) {
if (null == deptIds || deptIds.isEmpty()) {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
for (Long deptId : deptIds) {
if (sysDeptService.hadChild(deptId)) {
return APIResponse.toExceptionResponse("存在子部门不能删除");
}
if (sysDeptService.hadUser(deptId)) {
return APIResponse.toExceptionResponse("存在用户不能删除");
}
}
// 如果已报读 不允许删除
QueryWrapper<ScStudentCourse> qwSc = new QueryWrapper<>();
qwSc.in("dept_id", deptIds);
int studentCourseCount = studentCourseService.count(qwSc);
if (studentCourseCount != 0) {
return APIResponse.toExceptionResponse("该校区已有报读学员,无法删除");
}
boolean deleteDept = sysDeptService.removeByIds(deptIds);
if (deleteDept) {
return APIResponse.toOkResponse();
} else {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
}
/** /**
* select * select
@ -190,17 +110,6 @@ public class BusinessSysDeptService {
return list.stream().map(RespTreeSelect::new).collect(Collectors.toList()); return list.stream().map(RespTreeSelect::new).collect(Collectors.toList());
} }
/**
* select
*
* @return
*/
public List<RespTreeSelect> campusListLimitByUser() {
LoginUser loginUser = SecurityUtils.getLoginUser();
List<SysDept> deptList = sysDeptService.selectUserCampusList(loginUser.getUserId());
List<RespTreeSelect> respTreeSelects = deptList.stream().map(RespTreeSelect::new).collect(Collectors.toList());
return respTreeSelects;
}
/** /**
* *
@ -219,27 +128,5 @@ public class BusinessSysDeptService {
return list; return list;
} }
/**
*
*
*
*
* @return
*/
public List<RespTreeSelect> campusSelectLimitByUser() {
LoginUser loginUser = SecurityUtils.getLoginUser();
List<RespTreeSelect> list = Lists.newArrayList();
QueryWrapper qw = new QueryWrapper();
qw.eq("user_id",loginUser.getUserId());
qw.eq("dept_id","-1");
SysUserDept one = userDeptService.getOne(qw);
if(null != one){
list.add(new RespTreeSelect(9L,"全部校区",null));
}
list.add(new RespTreeSelect(0L,"部分校区",null));
return list;
}
} }

@ -1,16 +0,0 @@
package cn.xluobo.business.sys.admin.service;
import cn.xluobo.business.sys.admin.model.SysUserDept;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-08-07
*/
public interface ISysUserDeptService extends IService<SysUserDept> {
}

@ -1,20 +0,0 @@
package cn.xluobo.business.sys.admin.service.impl;
import cn.xluobo.business.sys.admin.model.SysUserDept;
import cn.xluobo.business.sys.admin.repo.mapper.ISysUserDeptMapper;
import cn.xluobo.business.sys.admin.service.ISysUserDeptService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-08-07
*/
@Service
public class ISysUserDeptServiceImpl extends ServiceImpl<ISysUserDeptMapper, SysUserDept> implements ISysUserDeptService {
}

@ -42,6 +42,7 @@ public class BusinessSysReceiptAccountService {
if(StringUtils.isNotEmpty(reqSearchSysReceiptAccount.getMemo())){ if(StringUtils.isNotEmpty(reqSearchSysReceiptAccount.getMemo())){
qw.eq("memo",reqSearchSysReceiptAccount.getMemo()); qw.eq("memo",reqSearchSysReceiptAccount.getMemo());
} }
qw.eq("tenant_id",SecurityUtils.getLoginUser().getNowTenantId());
RespPage<SysReceiptAccount> page = new RespPage(reqSearchSysReceiptAccount.getPageNum(), reqSearchSysReceiptAccount.getPageSize()); RespPage<SysReceiptAccount> page = new RespPage(reqSearchSysReceiptAccount.getPageNum(), reqSearchSysReceiptAccount.getPageSize());
RespPage<SysReceiptAccount> listPage = sysReceiptAccountService.page(page, qw); RespPage<SysReceiptAccount> listPage = sysReceiptAccountService.page(page, qw);
return APIResponse.toAPIResponse(listPage); return APIResponse.toAPIResponse(listPage);
@ -81,6 +82,7 @@ public class BusinessSysReceiptAccountService {
public APIResponse addSysReceiptAccount(SysReceiptAccount sysReceiptAccount) { public APIResponse addSysReceiptAccount(SysReceiptAccount sysReceiptAccount) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
sysReceiptAccount.setCreateUser(loginUser.getUserId()); sysReceiptAccount.setCreateUser(loginUser.getUserId());
sysReceiptAccount.setTenantId(loginUser.getNowTenantId());
boolean addSysReceiptAccount = sysReceiptAccountService.save(sysReceiptAccount); boolean addSysReceiptAccount = sysReceiptAccountService.save(sysReceiptAccount);
if (addSysReceiptAccount) { if (addSysReceiptAccount) {
return APIResponse.toOkResponse(); return APIResponse.toOkResponse();

@ -5,6 +5,7 @@ import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount;
import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService; import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -24,6 +25,7 @@ public class SysReceiptAccountServiceImpl extends ServiceImpl<SysReceiptAccountM
public List<SysReceiptAccount> select() { public List<SysReceiptAccount> select() {
QueryWrapper<SysReceiptAccount> qw = new QueryWrapper<>(); QueryWrapper<SysReceiptAccount> qw = new QueryWrapper<>();
qw.select("account_name", "account_id"); qw.select("account_name", "account_id");
qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId());
qw.orderByDesc("account_id"); qw.orderByDesc("account_id");
return this.list(qw); return this.list(qw);
} }

@ -1,15 +1,13 @@
package cn.xluobo.business.sys.staff.controller; package cn.xluobo.business.sys.staff.controller;
import cn.xluobo.business.sc.course.domain.req.ReqSelect; import cn.xluobo.business.sc.course.domain.req.ReqSelect;
import cn.xluobo.business.sys.staff.domain.req.ReqBusinessAddStaff;
import cn.xluobo.business.sys.staff.domain.req.ReqSearchStaff;
import cn.xluobo.business.sys.staff.service.BusinessSysStaffService;
import cn.xluobo.core.api.APIResponse;
import com.ruoyi.common.core.domain.AjaxResult; 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.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -24,22 +22,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/api/sys/staff") @RequestMapping("/api/sys/staff")
public class SysStaffController { public class SysStaffController {
@Autowired
private BusinessSysStaffService sysStaffService;
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
/**
*
*
* @param reqSearchSysStaff
* @return
*/
@GetMapping("/list/searchList")
public APIResponse searchList(ReqSearchStaff reqSearchSysStaff) {
return sysStaffService.searchList(reqSearchSysStaff);
}
/** /**
* select * select
@ -54,47 +40,5 @@ public class SysStaffController {
return AjaxResult.success(sysUsers); return AjaxResult.success(sysUsers);
} }
/**
*
*
* @param staffId
* @return
*/
@GetMapping("/info/detailById/{staffId}")
public APIResponse detailById(@PathVariable("staffId") Long staffId) {
return sysStaffService.detailById(staffId);
}
/**
*
*
* @param reqBusinessAddStaff
* @return
*/
@PostMapping("/add/addSysStaff")
public APIResponse addSysStaff(@RequestBody ReqBusinessAddStaff reqBusinessAddStaff) {
return sysStaffService.addSysStaff(reqBusinessAddStaff);
}
/**
*
*
* @param sysStaff
* @return
*/
@PutMapping("/update/updateSysStaff")
public APIResponse updateSysStaff(@RequestBody ReqBusinessAddStaff sysStaff) {
return sysStaffService.updateSysStaff(sysStaff);
}
/**
*
*
* @param staffIds
* @return
*/
@DeleteMapping("/delete/deleteById/{staffIds}")
public APIResponse deleteById(@PathVariable("staffIds") List<Long> staffIds) {
return sysStaffService.deleteById(staffIds);
}
} }

@ -1,65 +0,0 @@
package cn.xluobo.business.sys.staff.domain.req;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.core.api.APIBaseResponse;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
/**
*
*
* @author zhangbaoyu
* @date Created in 2020/8/18 08:44
*/
@Data
public class ReqBusinessAddStaff extends SysStaff {
/**
*
*/
private boolean loginUser;
/**
*
*/
private String locked;
/**
* Id
*/
private Long[] roleIds;
private String username;
private String password;
private String checkPass;
/**
* all part
*/
private String belongCampus;
/**
*
*/
private String[] partCampus;
public APIBaseResponse checkParam() {
if (StringUtils.isAnyEmpty(getStaffName(), getPhone(), getSex())) {
return APIBaseResponse.fail("请求参数错误,请完善后重试");
}
if (loginUser) {
if (StringUtils.isEmpty(belongCampus)) {
return APIBaseResponse.fail("请选择所属校区");
}
if ("part".equals(belongCampus) && null == partCampus) {
return APIBaseResponse.fail("请选择所属校区");
}
if ("part".equals(belongCampus) && partCampus.length == 0) {
return APIBaseResponse.fail("请选择所属校区");
}
}
return APIBaseResponse.success();
}
}

@ -1,19 +0,0 @@
package cn.xluobo.business.sys.staff.domain.req;
import cn.xluobo.core.page.ReqPageBase;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhangbaoyu
* @date Created in 2020-01-14 17:30
*/
@Data
public class ReqSearchStaff extends ReqPageBase implements Serializable {
private String staffName;
private String sex;
private String personnelStatus;
private Integer teacher;
private Long deptId;
}

@ -1,34 +0,0 @@
package cn.xluobo.business.sys.staff.domain.resp;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import com.ruoyi.common.core.domain.entity.SysUser;
import lombok.Data;
import java.util.List;
/**
*
* @author zhangbaoyu
* @date Created in 2020/10/25 20:19
*/
@Data
public class RespBusinessStaffDetail {
// 所属校区 全部、部分
private String belongCampus;
// 所属校区
private List<Long> partCampus;
// 所属校区名称
private List<String> partCampusName;
// 员工信息
private SysStaff staffInfo;
// 关联用户信息
private SysUser userInfo;
// 用户角色
private List<String> roleTreeIdList;
}

@ -1,21 +0,0 @@
package cn.xluobo.business.sys.staff.domain.resp;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import lombok.Data;
/**
*
* @author zhangbaoyu
* @date Created in 2020/8/18 11:03
*/
@Data
public class RespStaffInfo extends SysStaff {
private String username;
private String locked;
private String personnelStatusName;
private String deptName;
}

@ -1,38 +0,0 @@
package cn.xluobo.business.sys.staff.repo.mapper;
import cn.xluobo.business.sys.staff.domain.req.ReqSearchStaff;
import cn.xluobo.business.sys.staff.domain.resp.RespStaffInfo;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper
* </p>
*
* @author zhangby
* @since 2020-03-17 11:27:37
*/
public interface SysStaffMapper extends BaseMapper<SysStaff> {
/**
*
* @param reqSearchStaff
* @param page
* @return
*/
List<RespStaffInfo> selectStaffList(@Param("reqSearchStaff") ReqSearchStaff reqSearchStaff, @Param("page") RespPage page);
/**
*
* @param tenantId
* @return
*/
@SqlParser(filter = true)
Integer selectTenantStaffCount(String tenantId);
}

@ -1,32 +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="cn.xluobo.business.sys.staff.repo.mapper.SysStaffMapper">
<select id="selectStaffList" resultType="cn.xluobo.business.sys.staff.domain.resp.RespStaffInfo">
select a.*,b.username,b.locked,fcn_dict_name(a.personnel_status,'personnel_status') personnel_status_name,
d.dept_name
from sys_staff a
left join sys_user b on a.user_id=b.user_id
left join sys_dept d on a.dept_id=d.dept_id
where a.delete_flag='0'
<if test="reqSearchStaff.staffName != null and reqSearchStaff.staffName != ''">
and a.staff_name like concat('%',#{reqSearchStaff.staffName},'%')
</if>
<if test="reqSearchStaff.personnelStatus != null and reqSearchStaff.personnelStatus != ''">
and a.personnel_status = #{reqSearchStaff.personnelStatus,jdbcType=VARCHAR}
</if>
<if test="reqSearchStaff.teacher != null">
and a.teacher = #{reqSearchStaff.teacher}
</if>
<if test="reqSearchStaff.sex != null and reqSearchStaff.sex != ''">
and a.sex = #{reqSearchStaff.sex}
</if>
<if test="reqSearchStaff.deptId != null">
and (a.dept_id=#{reqSearchStaff.deptId} or a.dept_id in (select dept_id from sys_dept dd where find_in_set(#{reqSearchStaff.deptId} ,dd.ancestors)))
</if>
order by a.create_time desc
</select>
<select id="selectTenantStaffCount" resultType="java.lang.Integer">
select count(1) from sys_staff where tenant_id=#{tenantId} and delete_flag='0'
</select>
</mapper>

@ -1,134 +0,0 @@
package cn.xluobo.business.sys.staff.repo.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-03-17 11:27:37
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_staff")
public class SysStaff implements Serializable {
/**
* id
*/
@TableId(value = "staff_id")
private Long staffId;
/**
*
*/
@TableField("tenant_id")
private String tenantId;
@TableField("user_id")
private Long userId;
/**
*
*/
@TableField("super_staff")
private Boolean superStaff;
/**
*
*/
@TableField("staff_name")
private String staffName;
/**
*
*/
@TableField("phone")
private String phone;
/**
*
*/
@TableField("email_address")
private String emailAddress;
/**
* M F
*/
@TableField("sex")
private String sex;
/**
*
*/
@TableField("entry_date")
private String entryDate;
/**
* 1 2 3 4 5 6 7
*/
@TableField("personnel_status")
private String personnelStatus;
/**
*
*/
@TableField("teacher")
private Boolean teacher;
/**
*
*/
@TableField("avatar_img")
private String avatarImg;
/**
*
*/
@TableField("dept_id")
private Long deptId;
/**
* 1 0
*/
@TableField("delete_flag")
@TableLogic
private String deleteFlag;
/**
*
*/
@TableField("create_user")
private Long createUser;
/**
*
*/
@TableField("create_time")
private Date createTime;
/**
*
*/
@TableField("last_update_user")
private Long lastUpdateUser;
/**
*
*/
@TableField("last_update_time")
private Date lastUpdateTime;
}

@ -1,384 +0,0 @@
package cn.xluobo.business.sys.staff.service;
import cn.hutool.core.util.ObjectUtil;
import cn.xluobo.business.sc.course.domain.req.ReqSelect;
import cn.xluobo.business.sc.course.repo.model.ScClaTime;
import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
import cn.xluobo.business.sc.course.service.IScClaTimeService;
import cn.xluobo.business.sc.course.service.IScCourseClaService;
import cn.xluobo.business.sys.admin.domain.req.ReqUpdateUserRole;
import cn.xluobo.business.sys.admin.model.SysUserDept;
import cn.xluobo.business.sys.admin.model.SysUserTenant;
import cn.xluobo.business.sys.admin.service.*;
import cn.xluobo.business.sys.staff.domain.req.ReqBusinessAddStaff;
import cn.xluobo.business.sys.staff.domain.req.ReqSearchStaff;
import cn.xluobo.business.sys.staff.domain.resp.RespBusinessStaffDetail;
import cn.xluobo.business.sys.staff.domain.resp.RespStaffInfo;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.core.api.APIBaseResponse;
import cn.xluobo.core.api.APIResponse;
import cn.xluobo.core.api.ApiResEnums;
import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zhangbaoyu
* @date Created in 2020-01-14 17:24
*/
@Service
@Transactional
public class BusinessSysStaffService {
@Autowired
private ISysStaffService sysStaffService;
@Autowired
private ISysUserService userService;
@Autowired
private ISysRoleService sysRoleService;
@Autowired
private IScClaTimeService claTimeService;
@Autowired
private IScCourseClaService courseClaService;
@Autowired
private ISysUserDeptService userDeptService;
@Autowired
private ISysUserTenantService userTenantService;
/**
*
*
* @param reqSearchSysStaff
* @return
*/
public APIResponse searchList(ReqSearchStaff reqSearchSysStaff) {
RespPage<RespStaffInfo> page = new RespPage(reqSearchSysStaff.getPageNum(), reqSearchSysStaff.getPageSize());
List<RespStaffInfo> staffList = sysStaffService.searchStaffList(reqSearchSysStaff, page);
page.setRows(staffList);
return APIResponse.toAPIResponse(page);
}
/**
* select
*
* @return
*/
public APIResponse teacherSelect(ReqSelect reqSelect) {
List<SysStaff> list = sysStaffService.teacherList(reqSelect.getSearch());
return APIResponse.toAPIResponse(list);
}
/**
*
*
* @param teacherId
* @return
*/
public APIResponse detailById(Long teacherId) {
if (null == teacherId) {
return APIResponse.toAPIResponse(null);
}
LoginUser loginUser = SecurityUtils.getLoginUser();
RespBusinessStaffDetail respBusinessStaffDetail = new RespBusinessStaffDetail();
// 员工信息
SysStaff staffInfo = sysStaffService.getById(teacherId);
respBusinessStaffDetail.setStaffInfo(staffInfo);
// 用户名
if (ObjectUtil.isNotEmpty(staffInfo.getUserId())) {
QueryWrapper<SysUser> qw = new QueryWrapper<>();
qw.select("username", "locked");
qw.eq("user_id", staffInfo.getUserId());
SysUser sysUser = userService.getOne(qw);
if (null == sysUser) {
staffInfo.setUserId(null);
}
respBusinessStaffDetail.setUserInfo(sysUser);
// 员工所属校区
QueryWrapper<SysUserDept> qwUserDept = new QueryWrapper<>();
qwUserDept.eq("user_id", staffInfo.getUserId());
qwUserDept.eq("tenant_id", loginUser.getNowTenantId());
List<SysUserDept> userDeptList = userDeptService.list(qwUserDept);
boolean allCampus = userDeptList.stream().anyMatch(item -> item.getDeptId() == -1L);
if (allCampus) {
respBusinessStaffDetail.setBelongCampus("all");
respBusinessStaffDetail.setPartCampus(Lists.newArrayList());
} else {
respBusinessStaffDetail.setBelongCampus("part");
List<Long> deptIdList = userDeptList.stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
respBusinessStaffDetail.setPartCampus(deptIdList);
}
// 用户角色
List<String> roleTreeIdList = sysRoleService.selectUserRoleTreeIdList(staffInfo.getUserId(), loginUser.getNowTenantId());
respBusinessStaffDetail.setRoleTreeIdList(roleTreeIdList);
} else {
respBusinessStaffDetail.setUserInfo(null);
respBusinessStaffDetail.setRoleTreeIdList(Lists.newArrayList());
respBusinessStaffDetail.setBelongCampus("all");
respBusinessStaffDetail.setPartCampus(Lists.newArrayList());
}
return APIResponse.toAPIResponse(respBusinessStaffDetail);
}
/**
*
*
* @param staff
* @return
*/
public APIResponse addSysStaff(ReqBusinessAddStaff staff) {
APIBaseResponse checkParam = staff.checkParam();
if (!checkParam.isSuccess()) {
return APIResponse.toExceptionResponse(checkParam.getRespMsg());
}
LoginUser loginUser = SecurityUtils.getLoginUser();
boolean isLoginUser = staff.isLoginUser();
// 保存用户信息
if (isLoginUser) {
if (StringUtils.isAnyEmpty(staff.getUsername(), staff.getPassword())) {
return APIResponse.toExceptionResponse(("请求参数错误,请完善后重试"));
} else if (!staff.getPassword().equals(staff.getCheckPass())) {
return APIResponse.toExceptionResponse(("新旧密码输入不一致,请稍后重试"));
}
// 校验账号是否已被注册
boolean usernameUnique = userService.checkUsernameUnique(staff.getUsername());
if (!usernameUnique) {
return APIResponse.toExceptionResponse(("用户名已被注册,请修改后重新提交"));
}
// 添加用户
SysUser sysUser = new SysUser();
sysUser.setUserName(staff.getUsername());
sysUser.setPassword(staff.getPassword());
sysUser.setNickName(staff.getStaffName());
sysUser.setPhonenumber(staff.getPhone());
sysUser.setEmail(staff.getEmailAddress());
sysUser.setDeptId(staff.getDeptId());
// 关联当前租户
SysUserTenant sysUserTenant = new SysUserTenant();
sysUserTenant.setUserId(sysUser.getUserId());
sysUserTenant.setTenantId(loginUser.getNowTenantId());
userTenantService.save(sysUserTenant);
staff.setUserId(sysUser.getUserId());
// 保存角色信息
ReqUpdateUserRole reqUpdateUserRole = new ReqUpdateUserRole();
reqUpdateUserRole.setTenantId(loginUser.getNowTenantId());
reqUpdateUserRole.setUserId(sysUser.getUserId());
reqUpdateUserRole.setRoleIds(staff.getRoleIds());
// 所属校区
String belongCampus = staff.getBelongCampus();
if ("all".equals(belongCampus)) {
SysUserDept sysUserDept = new SysUserDept();
sysUserDept.setUserId(sysUser.getUserId());
sysUserDept.setDeptId(-1L);
sysUserDept.setTenantId(loginUser.getNowTenantId());
userDeptService.save(sysUserDept);
} else if ("part".equals(belongCampus)) {
String[] partCampus = staff.getPartCampus();
List<SysUserDept> userDeptList = Lists.newArrayList();
for (String campus : partCampus) {
SysUserDept sysUserDept = new SysUserDept();
sysUserDept.setUserId(sysUser.getUserId());
sysUserDept.setDeptId(Long.valueOf(campus));
sysUserDept.setTenantId(loginUser.getNowTenantId());
userDeptList.add(sysUserDept);
}
if (userDeptList.size() > 0) {
userDeptService.saveBatch(userDeptList);
}
}
}
// 保存员工信息
staff.setCreateUser(loginUser.getUserId());
boolean addSysStaff = sysStaffService.save(staff);
if (addSysStaff) {
return APIResponse.toOkResponse();
} else {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
}
/**
*
*
* @param staff
* @return
*/
public APIResponse updateSysStaff(ReqBusinessAddStaff staff) {
if (null == staff.getStaffId()) {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
APIBaseResponse checkParam = staff.checkParam();
if (!checkParam.isSuccess()) {
return APIResponse.toExceptionResponse(checkParam.getRespMsg());
}
LoginUser loginUser = SecurityUtils.getLoginUser();
// 可登陆信息
boolean isLoginUser = staff.isLoginUser();
SysStaff dbStaffInfo = sysStaffService.getById(staff.getStaffId());
if (ObjectUtil.isEmpty(dbStaffInfo.getUserId()) && isLoginUser) {
if (StringUtils.isAnyEmpty(staff.getUsername(), staff.getPassword())) {
return APIResponse.toExceptionResponse(("请求参数错误,请完善后重试"));
} else if (!staff.getPassword().equals(staff.getCheckPass())) {
return APIResponse.toExceptionResponse(("新旧密码输入不一致,请稍后重试"));
}
// 校验账号是否已被注册
boolean usernameUnique = userService.checkUsernameUnique(staff.getUsername());
if (!usernameUnique) {
return APIResponse.toExceptionResponse(("用户名已被注册,请修改后重新提交"));
}
}
boolean addUser = false;
if (ObjectUtil.isNotEmpty(dbStaffInfo.getUserId())) {
addUser = true;
// 如果有关联用户
// 变更用户相关信息
SysUser sysUser = new SysUser();
sysUser.setUserId(dbStaffInfo.getUserId());
sysUser.setUserName(staff.getStaffName());
sysUser.setPhonenumber(staff.getPhone());
sysUser.setEmail(staff.getEmailAddress());
sysUser.setDeptId(staff.getDeptId());
// 变更角色信息
ReqUpdateUserRole reqUpdateUserRole = new ReqUpdateUserRole();
reqUpdateUserRole.setUserId(sysUser.getUserId());
reqUpdateUserRole.setTenantId(loginUser.getNowTenantId());
reqUpdateUserRole.setRoleIds(staff.getRoleIds());
// 不变更关联用户ID
staff.setUserId(dbStaffInfo.getUserId());
} else if (ObjectUtil.isEmpty(dbStaffInfo.getUserId()) && isLoginUser) {
addUser = true;
// 没有关联用户 并且允许登录
SysUser sysUser = new SysUser();
sysUser.setUserName(staff.getUsername());
sysUser.setPassword(staff.getPassword());
sysUser.setNickName(staff.getStaffName());
sysUser.setPhonenumber(staff.getPhone());
sysUser.setEmail(staff.getEmailAddress());
sysUser.setDeptId(staff.getDeptId());
staff.setUserId(sysUser.getUserId());
// 保存角色信息
ReqUpdateUserRole reqUpdateUserRole = new ReqUpdateUserRole();
reqUpdateUserRole.setUserId(sysUser.getUserId());
reqUpdateUserRole.setTenantId(loginUser.getNowTenantId());
reqUpdateUserRole.setRoleIds(staff.getRoleIds());
}
if (addUser) {
// 删除原校区
UpdateWrapper<SysUserDept> uw = new UpdateWrapper<>();
uw.eq("user_id", staff.getUserId());
userDeptService.remove(uw);
// 所属校区
String belongCampus = staff.getBelongCampus();
if ("all".equals(belongCampus)) {
SysUserDept sysUserDept = new SysUserDept();
sysUserDept.setUserId(staff.getUserId());
sysUserDept.setDeptId(-1L);
sysUserDept.setTenantId(loginUser.getNowTenantId());
userDeptService.save(sysUserDept);
} else if ("part".equals(belongCampus)) {
String[] partCampus = staff.getPartCampus();
List<SysUserDept> userDeptList = Lists.newArrayList();
for (String campus : partCampus) {
SysUserDept sysUserDept = new SysUserDept();
sysUserDept.setUserId(staff.getUserId());
sysUserDept.setDeptId(Long.valueOf(campus));
sysUserDept.setTenantId(loginUser.getNowTenantId());
userDeptList.add(sysUserDept);
}
if (userDeptList.size() > 0) {
userDeptService.saveBatch(userDeptList);
}
}
}
// 变更员工信息
staff.setLastUpdateUser(loginUser.getUserId());
staff.setLastUpdateTime(new Date());
boolean updateSysStaff = sysStaffService.updateById(staff);
if (updateSysStaff) {
return APIResponse.toOkResponse();
} else {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
}
/**
*
*
* @param teacherIds
* @return
*/
public APIResponse deleteById(List<Long> teacherIds) {
if (null == teacherIds || teacherIds.isEmpty()) {
return APIResponse.toExceptionResponse(ApiResEnums.FAIL_WAIT_A_MINUTE);
}
// 已排课不允许删除
QueryWrapper<ScClaTime> qwSct = new QueryWrapper<>();
qwSct.in("teacher_id", teacherIds);
qwSct.eq("status", "1");
int claTimeCount = claTimeService.count(qwSct);
if (claTimeCount != 0) {
return APIResponse.toExceptionResponse("员工有待上课程,无法删除");
}
// 是否为班级班主任
QueryWrapper<ScCourseCla> qw = new QueryWrapper<>();
qw.in("staff_id", teacherIds);
int courseClaCount = courseClaService.count(qw);
if (courseClaCount != 0) {
return APIResponse.toExceptionResponse("员工当前为班级任课教师,无法删除");
}
// 用户禁用
List<Long> userIds = sysStaffService.getUserIds(teacherIds);
if (null != userIds && !userIds.isEmpty()) {
UpdateWrapper<SysUser> uw = new UpdateWrapper<>();
uw.in("user_id", userIds);
uw.set("enable", "0");
userService.update(uw);
}
// 逻辑删除员工
sysStaffService.removeByIds(teacherIds);
return APIResponse.toOkResponse();
}
}

@ -1,46 +0,0 @@
package cn.xluobo.business.sys.staff.service;
import cn.xluobo.business.sys.staff.domain.req.ReqSearchStaff;
import cn.xluobo.business.sys.staff.domain.resp.RespStaffInfo;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-03-17 11:27:37
*/
public interface ISysStaffService extends IService<SysStaff> {
List<RespStaffInfo> searchStaffList(ReqSearchStaff reqSearchStaff, RespPage page);
/**
*
* @param teacherName
* @return
*/
List<SysStaff> teacherList(String teacherName);
/**
*
* @param staffName
* @return
*/
List<SysStaff> staffList(String staffName);
/**
* id
* @param staffIds
* @return
*/
List<Long> getUserIds(List<Long> staffIds);
// 根据用户获取
Long getStaffIdByUserId(Long userId);
}

@ -1,77 +0,0 @@
package cn.xluobo.business.sys.staff.service.impl;
import cn.xluobo.business.sys.staff.domain.req.ReqSearchStaff;
import cn.xluobo.business.sys.staff.domain.resp.RespStaffInfo;
import cn.xluobo.business.sys.staff.repo.mapper.SysStaffMapper;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.business.sys.staff.service.ISysStaffService;
import cn.xluobo.core.page.RespPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-03-17 11:27:37
*/
@Service
public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> implements ISysStaffService {
@Override
public List<RespStaffInfo> searchStaffList(ReqSearchStaff reqSearchStaff, RespPage page) {
return baseMapper.selectStaffList(reqSearchStaff, page);
}
@Override
public List<SysStaff> teacherList(String teacherName) {
QueryWrapper<SysStaff> qw = new QueryWrapper<>();
qw.select("staff_name", "staff_id");
qw.eq("teacher", "1");
if (StringUtils.isNotEmpty(teacherName)) {
qw.like("staff_name", teacherName);
}
qw.orderByAsc("staff_name");
return this.list(qw);
}
@Override
public List<SysStaff> staffList(String staffName) {
QueryWrapper<SysStaff> qw = new QueryWrapper<>();
qw.select("staff_name", "staff_id");
if (StringUtils.isNotEmpty(staffName)) {
qw.like("staff_name", staffName);
}
qw.orderByAsc("staff_name");
return this.list(qw);
}
@Override
public List<Long> getUserIds(List<Long> staffIds) {
QueryWrapper<SysStaff> qw = new QueryWrapper<>();
qw.select("user_id");
qw.in("staff_id", staffIds);
qw.isNotNull("user_id");
List<SysStaff> staffList = this.list(qw);
List<Long> userIds = staffList.stream().map(SysStaff::getUserId).collect(Collectors.toList());
return userIds;
}
@Override
public Long getStaffIdByUserId(Long userId) {
QueryWrapper<SysStaff> qw = new QueryWrapper<>();
qw.eq("user_id", userId);
SysStaff sysStaff = this.getOne(qw);
if (null != sysStaff) {
return sysStaff.getStaffId();
}
return null;
}
}

@ -1,10 +1,6 @@
package cn.xluobo.business.tool.impt.listener; package cn.xluobo.business.tool.impt.listener;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
import cn.xluobo.business.sc.base.repo.model.ScSchool;
import cn.xluobo.business.sc.base.service.IScSchoolService;
import cn.xluobo.business.sc.course.domain.export.ExpCourse; import cn.xluobo.business.sc.course.domain.export.ExpCourse;
import cn.xluobo.business.sc.course.domain.req.ReqCourseClaSelect; import cn.xluobo.business.sc.course.domain.req.ReqCourseClaSelect;
import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse; import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
@ -38,8 +34,6 @@ import cn.xluobo.business.sys.admin.service.BusinessSysDeptService;
import cn.xluobo.business.sys.admin.service.BusinessSysDictDataService; import cn.xluobo.business.sys.admin.service.BusinessSysDictDataService;
import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount; import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount;
import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService; import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.business.sys.staff.service.ISysStaffService;
import cn.xluobo.business.tool.impt.domain.ImportStudentOrder; import cn.xluobo.business.tool.impt.domain.ImportStudentOrder;
import cn.xluobo.core.api.APIBaseResponse; import cn.xluobo.core.api.APIBaseResponse;
import cn.xluobo.core.page.RespPage; import cn.xluobo.core.page.RespPage;
@ -51,7 +45,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.system.service.ISysUserService;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -75,7 +71,6 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
private IScStudentService studentService; private IScStudentService studentService;
private IScOrderService orderService; private IScOrderService orderService;
private IScOrderDetailService orderDetailService; private IScOrderDetailService orderDetailService;
private IScSchoolService schoolService;
private IScStudentContactService studentContactService; private IScStudentContactService studentContactService;
private IScStudentCourseService studentCourseService; private IScStudentCourseService studentCourseService;
private IScStudentCourseOrderService courseOrderService; private IScStudentCourseOrderService courseOrderService;
@ -85,7 +80,7 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
private ScCourseMapper courseMapper; private ScCourseMapper courseMapper;
private ScCourseClaMapper claMapper; private ScCourseClaMapper claMapper;
private ISysReceiptAccountService receiptAccountService; private ISysReceiptAccountService receiptAccountService;
private ISysStaffService staffService; private ISysUserService staffService;
private IScCourseChargeService courseChargeService; private IScCourseChargeService courseChargeService;
private IScStudentCourseLogService scStudentCourseLogService; private IScStudentCourseLogService scStudentCourseLogService;
@ -145,7 +140,6 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
studentService = ContextUtils.getBean(IScStudentService.class); studentService = ContextUtils.getBean(IScStudentService.class);
orderService = ContextUtils.getBean(IScOrderService.class); orderService = ContextUtils.getBean(IScOrderService.class);
orderDetailService = ContextUtils.getBean(IScOrderDetailService.class); orderDetailService = ContextUtils.getBean(IScOrderDetailService.class);
schoolService = ContextUtils.getBean(IScSchoolService.class);
studentContactService = ContextUtils.getBean(IScStudentContactService.class); studentContactService = ContextUtils.getBean(IScStudentContactService.class);
studentCourseService = ContextUtils.getBean(IScStudentCourseService.class); studentCourseService = ContextUtils.getBean(IScStudentCourseService.class);
courseOrderService = ContextUtils.getBean(IScStudentCourseOrderService.class); courseOrderService = ContextUtils.getBean(IScStudentCourseOrderService.class);
@ -155,7 +149,6 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
courseMapper = ContextUtils.getBean(ScCourseMapper.class); courseMapper = ContextUtils.getBean(ScCourseMapper.class);
claMapper = ContextUtils.getBean(ScCourseClaMapper.class); claMapper = ContextUtils.getBean(ScCourseClaMapper.class);
receiptAccountService = ContextUtils.getBean(ISysReceiptAccountService.class); receiptAccountService = ContextUtils.getBean(ISysReceiptAccountService.class);
staffService = ContextUtils.getBean(ISysStaffService.class);
courseChargeService = ContextUtils.getBean(IScCourseChargeService.class); courseChargeService = ContextUtils.getBean(IScCourseChargeService.class);
scStudentCourseLogService = ContextUtils.getBean(IScStudentCourseLogService.class); scStudentCourseLogService = ContextUtils.getBean(IScStudentCourseLogService.class);
this.initCacheMap(); this.initCacheMap();
@ -204,19 +197,7 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
if (null == studentId) { if (null == studentId) {
ScStudent student = new ScStudent(); ScStudent student = new ScStudent();
student.setStudentName(studentName); student.setStudentName(studentName);
if (StringUtils.isNotEmpty(studentOrder.getSchoolName())) {
Long schoolId = schoolMap.get(studentOrder.getSchoolName());
if (null == schoolId) {
// 无学校信息 保存学校信息
ScSchool saveSchool = new ScSchool();
saveSchool.setSchoolName(studentOrder.getSchoolName());
saveSchool.setCreateUser(loginUserId);
schoolService.save(saveSchool);
schoolId = saveSchool.getSchoolId();
schoolMap.put(studentOrder.getSchoolName(), schoolId);
}
student.setSchoolId(schoolId);
}
if (StringUtils.isNotEmpty(studentOrder.getSex())) { if (StringUtils.isNotEmpty(studentOrder.getSex())) {
student.setSex(sexMap.get(studentOrder.getSex())); student.setSex(sexMap.get(studentOrder.getSex()));
} }
@ -698,14 +679,10 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
} }
public void initCacheMap() { public void initCacheMap() {
// 联系人关系
List<SysDictData> contactRelationList = dictDataService.dictTypeDataList("contact_relation");
// 性别 // 性别
List<SysDictData> sexList = dictDataService.dictTypeDataList("sex"); List<SysDictData> sexList = dictDataService.dictTypeDataList("sys_user_sex");
// 学校
List<RespSchoolSelect> schoolList = schoolService.selectSchoolSelect(new ReqSchoolSelect());
// 订单类型 // 订单类型
List<SysDictData> orderDetailTagList = dictDataService.dictTypeDataList("order_detail_tag"); List<SysDictData> orderDetailTagList = dictDataService.dictTypeDataList("course_order_type");
// 报读校区 // 报读校区
List<RespTreeSelect> campusList = deptService.campusList(); List<RespTreeSelect> campusList = deptService.campusList();
// 报读课程 课程-收费方式(校区) // 报读课程 课程-收费方式(校区)
@ -717,20 +694,14 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
// 收款账户 // 收款账户
List<SysReceiptAccount> receiptAccountList = receiptAccountService.select(); List<SysReceiptAccount> receiptAccountList = receiptAccountService.select();
// 销售员工 // 销售员工
List<SysStaff> staffList = staffService.staffList(null); List<SysUser> staffList = staffService.selectUserList(new SysUser());
// 收费模式 // 收费模式
QueryWrapper<ScCourseCharge> qw = new QueryWrapper<>(); QueryWrapper<ScCourseCharge> qw = new QueryWrapper<>();
List<ScCourseCharge> courseChargeList = courseChargeService.list(qw); List<ScCourseCharge> courseChargeList = courseChargeService.list(qw);
contactRelationList.forEach(item -> {
contactRelationMap.put(item.getDictLabel(), item.getDictValue());
});
sexList.forEach(item -> { sexList.forEach(item -> {
sexMap.put(item.getDictLabel(), item.getDictValue()); sexMap.put(item.getDictLabel(), item.getDictValue());
}); });
schoolList.forEach(item -> {
schoolMap.put(item.getSchoolName(), item.getSchoolId());
});
orderDetailTagList.forEach(item -> { orderDetailTagList.forEach(item -> {
orderDetailTagMap.put(item.getDictLabel(), item.getDictValue()); orderDetailTagMap.put(item.getDictLabel(), item.getDictValue());
}); });
@ -757,7 +728,7 @@ public class ImportStudentOrderListener extends AnalysisEventListener<ImportStud
receiptAccountMap.put(item.getAccountName(), item.getAccountId()); receiptAccountMap.put(item.getAccountName(), item.getAccountId());
}); });
staffList.forEach(item -> { staffList.forEach(item -> {
staffMap.put(item.getStaffName(), item.getStaffId()); staffMap.put(item.getNickName(), item.getUserId());
}); });
courseChargeList.forEach(item -> { courseChargeList.forEach(item -> {
chargeCacheMap.put(item.getChargeId(), item); chargeCacheMap.put(item.getChargeId(), item);

@ -10,8 +10,6 @@ import cn.xluobo.business.sc.course.service.IScCourseService;
import cn.xluobo.business.sys.admin.domain.resp.RespTreeSelect; import cn.xluobo.business.sys.admin.domain.resp.RespTreeSelect;
import cn.xluobo.business.sys.admin.service.BusinessSysDeptService; import cn.xluobo.business.sys.admin.service.BusinessSysDeptService;
import cn.xluobo.business.sys.admin.service.BusinessSysDictDataService; import cn.xluobo.business.sys.admin.service.BusinessSysDictDataService;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.business.sys.staff.service.ISysStaffService;
import cn.xluobo.business.tool.export.handler.bean.SelectValidationData; import cn.xluobo.business.tool.export.handler.bean.SelectValidationData;
import cn.xluobo.business.tool.impt.domain.ImportCourseCla; import cn.xluobo.business.tool.impt.domain.ImportCourseCla;
import cn.xluobo.business.tool.impt.listener.ImportCourseClaListener; import cn.xluobo.business.tool.impt.listener.ImportCourseClaListener;
@ -24,8 +22,10 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
@ -37,7 +37,10 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.*; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -56,7 +59,7 @@ public class ImportCourseClaImpl extends AbstractImportStrategy {
@Autowired @Autowired
private BusinessSysDeptService deptService; private BusinessSysDeptService deptService;
@Autowired @Autowired
private ISysStaffService staffService; private ISysUserService staffService;
@Autowired @Autowired
private BusinessSysDictDataService dictDataService; private BusinessSysDictDataService dictDataService;
@Autowired @Autowired
@ -83,8 +86,8 @@ public class ImportCourseClaImpl extends AbstractImportStrategy {
String[] campusNameStringArray = campusList.stream().map(RespTreeSelect::getLabel).toArray(String[]::new); String[] campusNameStringArray = campusList.stream().map(RespTreeSelect::getLabel).toArray(String[]::new);
// 教师列表 // 教师列表
List<SysStaff> teacherList = staffService.teacherList(""); List<SysUser> teacherList = staffService.selectUserList(new SysUser());
String[] teacherNameStringArray = teacherList.stream().map(SysStaff::getStaffName).toArray(String[]::new); String[] teacherNameStringArray = teacherList.stream().map(SysUser::getNickName).toArray(String[]::new);
// 招生状态 // 招生状态
List<SysDictData> recruitStatusList = dictDataService.dictTypeDataList("recruit_status"); List<SysDictData> recruitStatusList = dictDataService.dictTypeDataList("recruit_status");
@ -129,7 +132,7 @@ public class ImportCourseClaImpl extends AbstractImportStrategy {
// 全部校区 // 全部校区
List<RespTreeSelect> campusList = deptService.campusList(); List<RespTreeSelect> campusList = deptService.campusList();
// 教师列表 // 教师列表
List<SysStaff> teacherList = staffService.teacherList(""); List<SysUser> teacherList = staffService.selectUserList(new SysUser());
// 招生状态 // 招生状态
List<SysDictData> recruitStatusList = dictDataService.dictTypeDataList("recruit_status"); List<SysDictData> recruitStatusList = dictDataService.dictTypeDataList("recruit_status");
// 排课重复方式 // 排课重复方式
@ -155,7 +158,7 @@ public class ImportCourseClaImpl extends AbstractImportStrategy {
campusMap.put(item.getLabel(), item.getId()); campusMap.put(item.getLabel(), item.getId());
}); });
teacherList.forEach(item -> { teacherList.forEach(item -> {
teacherMap.put(item.getStaffName(), item.getStaffId()); teacherMap.put(item.getNickName(), item.getUserId());
}); });
recruitStatusList.forEach(item -> { recruitStatusList.forEach(item -> {
recruitStatusMap.put(item.getDictLabel(), item.getDictValue()); recruitStatusMap.put(item.getDictLabel(), item.getDictValue());
@ -208,7 +211,7 @@ public class ImportCourseClaImpl extends AbstractImportStrategy {
// 全部校区 // 全部校区
List<RespTreeSelect> campusList = deptService.campusList(); List<RespTreeSelect> campusList = deptService.campusList();
// 教师列表 // 教师列表
List<SysStaff> teacherList = staffService.teacherList(""); List<SysUser> teacherList = staffService.selectUserList(new SysUser());
// 招生状态 // 招生状态
List<SysDictData> recruitStatusList = dictDataService.dictTypeDataList("recruit_status"); List<SysDictData> recruitStatusList = dictDataService.dictTypeDataList("recruit_status");
// 排课重复方式 // 排课重复方式
@ -234,7 +237,7 @@ public class ImportCourseClaImpl extends AbstractImportStrategy {
campusMap.put(item.getLabel(), item.getId()); campusMap.put(item.getLabel(), item.getId());
}); });
teacherList.forEach(item -> { teacherList.forEach(item -> {
teacherMap.put(item.getStaffName(), item.getStaffId()); teacherMap.put(item.getNickName(), item.getUserId());
}); });
recruitStatusList.forEach(item -> { recruitStatusList.forEach(item -> {
recruitStatusMap.put(item.getDictLabel(), item.getDictValue()); recruitStatusMap.put(item.getDictLabel(), item.getDictValue());

@ -1,8 +1,5 @@
package cn.xluobo.business.tool.impt.service.strategy.impl; package cn.xluobo.business.tool.impt.service.strategy.impl;
import cn.xluobo.business.sc.base.domain.req.ReqSchoolSelect;
import cn.xluobo.business.sc.base.domain.resp.RespSchoolSelect;
import cn.xluobo.business.sc.base.service.IScSchoolService;
import cn.xluobo.business.sc.course.domain.export.ExpCourse; import cn.xluobo.business.sc.course.domain.export.ExpCourse;
import cn.xluobo.business.sc.course.domain.req.ReqCourseClaSelect; import cn.xluobo.business.sc.course.domain.req.ReqCourseClaSelect;
import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse; import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
@ -15,8 +12,6 @@ import cn.xluobo.business.sys.admin.service.BusinessSysDeptService;
import cn.xluobo.business.sys.admin.service.BusinessSysDictDataService; import cn.xluobo.business.sys.admin.service.BusinessSysDictDataService;
import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount; import cn.xluobo.business.sys.receipt.repo.model.SysReceiptAccount;
import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService; import cn.xluobo.business.sys.receipt.service.ISysReceiptAccountService;
import cn.xluobo.business.sys.staff.repo.model.SysStaff;
import cn.xluobo.business.sys.staff.service.ISysStaffService;
import cn.xluobo.business.tool.export.handler.bean.SelectValidationData; import cn.xluobo.business.tool.export.handler.bean.SelectValidationData;
import cn.xluobo.business.tool.impt.domain.ImportStudentOrder; import cn.xluobo.business.tool.impt.domain.ImportStudentOrder;
import cn.xluobo.business.tool.impt.listener.ImportStudentOrderListener; import cn.xluobo.business.tool.impt.listener.ImportStudentOrderListener;
@ -28,8 +23,10 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
@ -61,8 +58,6 @@ public class ImportStudentOrderImpl extends AbstractImportStrategy {
@Autowired @Autowired
private BusinessSysDictDataService dictDataService; private BusinessSysDictDataService dictDataService;
@Autowired @Autowired
private IScSchoolService schoolService;
@Autowired
private BusinessSysDeptService deptService; private BusinessSysDeptService deptService;
@Autowired @Autowired
private ScCourseMapper courseMapper; private ScCourseMapper courseMapper;
@ -71,7 +66,7 @@ public class ImportStudentOrderImpl extends AbstractImportStrategy {
@Autowired @Autowired
private ISysReceiptAccountService receiptAccountService; private ISysReceiptAccountService receiptAccountService;
@Autowired @Autowired
private ISysStaffService staffService; private ISysUserService staffService;
@Autowired @Autowired
private UploadConfigProperties uploadConfigProperties; private UploadConfigProperties uploadConfigProperties;
@ -87,9 +82,6 @@ public class ImportStudentOrderImpl extends AbstractImportStrategy {
List<SysDictData> sexList = dictDataService.dictTypeDataList("sex"); List<SysDictData> sexList = dictDataService.dictTypeDataList("sex");
String[] sexArray = sexList.stream().map(SysDictData::getDictLabel).toArray(String[]::new); String[] sexArray = sexList.stream().map(SysDictData::getDictLabel).toArray(String[]::new);
// 学校
List<RespSchoolSelect> schoolList = schoolService.selectSchoolSelect(new ReqSchoolSelect());
String[] schoolArray = schoolList.stream().map(RespSchoolSelect::getSchoolName).toArray(String[]::new);
// 订单类型 // 订单类型
List<SysDictData> orderDetailTagList = dictDataService.dictTypeDataList("order_detail_tag"); List<SysDictData> orderDetailTagList = dictDataService.dictTypeDataList("order_detail_tag");
@ -123,13 +115,12 @@ public class ImportStudentOrderImpl extends AbstractImportStrategy {
String[] receiptAccountNameArray = receiptAccountList.stream().map(SysReceiptAccount::getAccountName).toArray(String[]::new); String[] receiptAccountNameArray = receiptAccountList.stream().map(SysReceiptAccount::getAccountName).toArray(String[]::new);
// 销售员工 // 销售员工
List<SysStaff> staffList = staffService.staffList(null); List<SysUser> staffList = staffService.selectUserList(new SysUser());
String[] staffNameArray = staffList.stream().map(SysStaff::getStaffName).toArray(String[]::new); String[] staffNameArray = staffList.stream().map(SysUser::getNickName).toArray(String[]::new);
return Lists.newArrayList( return Lists.newArrayList(
SelectValidationData.builder().firstCol(1).lastCol(1).firstRow(2).lastRow(206).selectDataArray(contactRelationArray).build(), SelectValidationData.builder().firstCol(1).lastCol(1).firstRow(2).lastRow(206).selectDataArray(contactRelationArray).build(),
SelectValidationData.builder().firstCol(3).lastCol(3).firstRow(2).lastRow(206).selectDataArray(sexArray).build(), SelectValidationData.builder().firstCol(3).lastCol(3).firstRow(2).lastRow(206).selectDataArray(sexArray).build(),
SelectValidationData.builder().firstCol(4).lastCol(4).firstRow(2).lastRow(206).selectDataArray(schoolArray).build(),
SelectValidationData.builder().firstCol(6).lastCol(6).firstRow(2).lastRow(206).selectDataArray(orderDetailTagArray).build(), SelectValidationData.builder().firstCol(6).lastCol(6).firstRow(2).lastRow(206).selectDataArray(orderDetailTagArray).build(),
SelectValidationData.builder().firstCol(7).lastCol(7).firstRow(2).lastRow(206).selectDataArray(campusNameArray).build(), SelectValidationData.builder().firstCol(7).lastCol(7).firstRow(2).lastRow(206).selectDataArray(campusNameArray).build(),
SelectValidationData.builder().firstCol(8).lastCol(8).firstRow(2).lastRow(206).selectDataArray(courseNameArray).build(), SelectValidationData.builder().firstCol(8).lastCol(8).firstRow(2).lastRow(206).selectDataArray(courseNameArray).build(),

@ -1,31 +1,25 @@
package com.ruoyi.web.controller.columns; package com.ruoyi.web.controller.columns;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.columns.SysTeacher;
import com.ruoyi.system.service.columns.ISysTeacherService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.system.domain.columns.SysTeacher;
import com.ruoyi.system.service.columns.ISysTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/** /**
* Controller * Controller
* *
* @author ruoyi * @author ruoyi
* @date 2025-10-28 * @date 2025-10-28
@ -51,6 +45,15 @@ public class SysTeacherController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
@PreAuthorize("@ss.hasPermi('system:teacher:list')")
@GetMapping("/getUserForTeacher")
public AjaxResult getUserForTeacher()
{
SysTeacher sysTeacher=new SysTeacher();
sysTeacher.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
List<SysUser> list = sysTeacherService.getUserForTeacher(sysTeacher);
return AjaxResult.successData(list);
}
/** /**
* *
@ -75,10 +78,10 @@ public class SysTeacherController extends BaseController
} }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:teacher:add')") @PreAuthorize("@ss.hasPermi('system:teacher:add')")
@Log(title = "员工信息", businessType = BusinessType.INSERT) @Log(title = "教练信息", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SysTeacher sysTeacher) public AjaxResult add(@RequestBody SysTeacher sysTeacher)
{ {
@ -86,10 +89,10 @@ public class SysTeacherController extends BaseController
} }
/** /**
* *
*/ */
// @PreAuthorize("@ss.hasPermi('system:teacher:edit')") // @PreAuthorize("@ss.hasPermi('system:teacher:edit')")
@Log(title = "员工信息", businessType = BusinessType.UPDATE) @Log(title = "教练信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SysTeacher sysTeacher) public AjaxResult edit(@RequestBody SysTeacher sysTeacher)
{ {
@ -97,7 +100,7 @@ public class SysTeacherController extends BaseController
} }
/** /**
* *
*/ */
@PostMapping("/remove") @PostMapping("/remove")
public AjaxResult remove( @RequestBody Long[] ids) { public AjaxResult remove( @RequestBody Long[] ids) {

@ -1,12 +1,9 @@
package com.ruoyi.web.controller.mall; package com.ruoyi.web.controller.mall;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisService; import com.ruoyi.common.core.redis.RedisService;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.mall.domain.Aftersale;
import com.ruoyi.mall.domain.form.DealWithAftersaleForm; import com.ruoyi.mall.domain.form.DealWithAftersaleForm;
import com.ruoyi.mall.domain.form.ManagerAftersaleOrderForm; import com.ruoyi.mall.domain.form.ManagerAftersaleOrderForm;
import com.ruoyi.mall.domain.vo.ManagerRefundOrderDetailVO; import com.ruoyi.mall.domain.vo.ManagerRefundOrderDetailVO;
@ -69,13 +66,7 @@ public class AftersaleController extends BaseController {
} }
@ApiOperation("修改订单售后")
@PreAuthorize("@ss.hasPermi('oms:aftersale:edit')")
@Log(title = "订单售后", businessType = BusinessType.UPDATE)
@PutMapping
public ResponseEntity<Integer> edit(@RequestBody Aftersale aftersale) {
return ResponseEntity.ok(service.update(aftersale));
}
@ApiOperation("售后订单操作") @ApiOperation("售后订单操作")
@PostMapping("/dealWith") @PostMapping("/dealWith")

@ -1,85 +0,0 @@
package com.ruoyi.web.controller.mall;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.mall.domain.Express;
import com.ruoyi.mall.service.ExpressService;
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;
/**
* Controller
*/
@Api(description ="快递管理接口列表")
@RestController
@RequestMapping("/pms/express")
public class ExpressController extends BaseController {
@Autowired
private ExpressService service;
@ApiOperation("查询快递管理列表")
@PreAuthorize("@ss.hasPermi('pms:Express:list')")
@PostMapping("/list")
public ResponseEntity<Page<Express>> list(@RequestBody Express query, Pageable page) {
List<Express> list = service.selectList(query, page);
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
}
@ApiOperation("所有快递管理列表")
@PreAuthorize("@ss.hasPermi('pms:Express:list')")
@PostMapping("/all")
public ResponseEntity<List<Express>> all(@RequestBody Express query) {
return ResponseEntity.ok(service.selectList(query, null));
}
@ApiOperation("导出快递管理列表")
@PreAuthorize("@ss.hasPermi('pms:Express:export')")
@Log(title = "快递管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public ResponseEntity<String> export(Express query) {
// List<Express> list = service.selectList(query, null);
// ExcelUtil<ExpressVO> util = new ExcelUtil<>(ExpressVO.class);
// return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "快递管理数据"));
return null;
}
@ApiOperation("获取快递管理详细信息")
@PreAuthorize("@ss.hasPermi('pms:Express:query')")
@GetMapping(value = "/{id}")
public ResponseEntity<Express> getInfo(@PathVariable("id") Long id) {
return ResponseEntity.ok(service.selectById(id));
}
@ApiOperation("新增快递管理")
@PreAuthorize("@ss.hasPermi('pms:Express:add')")
@Log(title = "快递管理", businessType = BusinessType.INSERT)
@PostMapping
public ResponseEntity<Integer> add(@RequestBody Express Express) {
return ResponseEntity.ok(service.insert(Express));
}
@ApiOperation("修改快递管理")
@PreAuthorize("@ss.hasPermi('pms:Express:edit')")
@Log(title = "快递管理", businessType = BusinessType.UPDATE)
@PutMapping
public ResponseEntity<Integer> edit(@RequestBody Express Express) {
return ResponseEntity.ok(service.update(Express));
}
@ApiOperation("删除快递管理")
@PreAuthorize("@ss.hasPermi('pms:Express:remove')")
@Log(title = "快递管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public ResponseEntity<Integer> remove(@PathVariable Long id) {
return ResponseEntity.ok(service.deleteById(id));
}
}

@ -1,19 +1,8 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.Iterator; import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
import java.util.List; import cn.xluobo.business.sc.student.service.IScStudentCourseService;
import org.apache.commons.lang3.ArrayUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
@ -22,6 +11,14 @@ import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Iterator;
import java.util.List;
/** /**
* *
@ -34,7 +31,8 @@ public class SysDeptController extends BaseController
{ {
@Autowired @Autowired
private ISysDeptService deptService; private ISysDeptService deptService;
@Autowired
private IScStudentCourseService studentCourseService;
/** /**
* *
*/ */
@ -91,15 +89,15 @@ public class SysDeptController extends BaseController
/** /**
* *
*/ */
@GetMapping(value = "/roleDeptTreeselect/{roleId}") // @GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) // public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
{ // {
List<SysDept> depts = deptService.selectDeptList(new SysDept()); // List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success(); // AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); // ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.buildDeptTreeSelect(depts)); // ajax.put("depts", deptService.buildDeptTreeSelect(depts));
return ajax; // return ajax;
} // }
/** /**
* *
@ -158,6 +156,13 @@ public class SysDeptController extends BaseController
{ {
return AjaxResult.error("部门存在用户,不允许删除"); return AjaxResult.error("部门存在用户,不允许删除");
} }
// 如果已报读 不允许删除
QueryWrapper<ScStudentCourse> qwSc = new QueryWrapper<>();
qwSc.eq("dept_id", deptId);
int studentCourseCount = studentCourseService.count(qwSc);
if (studentCourseCount != 0) {
return AjaxResult.error("该校区已有报读学员,无法删除");
}
return toAjax(deptService.deleteDeptById(deptId)); return toAjax(deptService.deleteDeptById(deptId));
} }
} }

@ -1,17 +1,6 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -20,9 +9,10 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/** /**
* *
@ -115,27 +105,5 @@ public class SysProfileController extends BaseController
return AjaxResult.error("修改密码异常,请联系管理员"); return AjaxResult.error("修改密码异常,请联系管理员");
} }
/**
*
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
{
if (!file.isEmpty())
{
LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
{
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
// 更新缓存用户头像
loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return AjaxResult.error("上传图片异常,请联系管理员");
}
} }

@ -5,7 +5,6 @@ import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
@ -13,7 +12,6 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -133,14 +131,14 @@ public class SysRoleController extends BaseController
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:role:edit')") // @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) // @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope") // @PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role) // public AjaxResult dataScope(@RequestBody SysRole role)
{ // {
roleService.checkRoleAllowed(role); // roleService.checkRoleAllowed(role);
return toAjax(roleService.authDataScope(role)); // return toAjax(roleService.authDataScope(role));
} // }
/** /**
* *
@ -179,57 +177,57 @@ public class SysRoleController extends BaseController
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:role:list')") // @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList") // @GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(SysUser user) // public TableDataInfo allocatedList(SysUser user)
{ // {
startPage(); // startPage();
List<SysUser> list = userService.selectAllocatedList(user); // List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list); // return getDataTable(list);
} // }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:role:list')") // @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList") // @GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(SysUser user) // public TableDataInfo unallocatedList(SysUser user)
{ // {
startPage(); // startPage();
List<SysUser> list = userService.selectUnallocatedList(user); // List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list); // return getDataTable(list);
} // }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:role:edit')") // @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) // @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel") // @PutMapping("/authUser/cancel")
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) // public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
{ // {
return toAjax(roleService.deleteAuthUser(userRole)); // return toAjax(roleService.deleteAuthUser(userRole));
} // }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:role:edit')") // @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) // @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll") // @PutMapping("/authUser/cancelAll")
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) // public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
{ // {
return toAjax(roleService.deleteAuthUsers(roleId, userIds)); // return toAjax(roleService.deleteAuthUsers(roleId, userIds));
} // }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:role:edit')") // @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) // @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll") // @PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) // public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{ // {
return toAjax(roleService.insertAuthUsers(roleId, userIds)); // return toAjax(roleService.insertAuthUsers(roleId, userIds));
} // }
} }

@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -109,9 +110,14 @@ public class SysUserController extends BaseController
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId))
{ {
List<Integer> roleIds=roleService.selectRoleListByUserId(userId) ;
List<String> roleIds1=new ArrayList<>();
roleIds.forEach(l->{
roleIds1.add(l.toString());
});
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); ajax.put("roleIds",roleIds1 );
} }
return ajax; return ajax;
} }

@ -20,7 +20,7 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为8080 # 服务器的HTTP端口默认为8080
port: 8080 port: 8081
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -133,7 +133,7 @@ mybatis-plus:
global-config: global-config:
db-config: db-config:
id-type: auto id-type: auto
update-strategy: ignored # update-strategy: ignored
pagehelper: pagehelper:
helperDialect: mysql helperDialect: mysql
supportMethodsArguments: true supportMethodsArguments: true

@ -40,7 +40,9 @@ public class SysDept extends BaseEntity
private String orderNum; private String orderNum;
/** 负责人 */ /** 负责人 */
// @TableField(updateStrategy = FieldStrategy.IGNORED)
private String leader; private String leader;
// @TableField(updateStrategy = FieldStrategy.IGNORED)
private Long leaderId; private Long leaderId;
/** 联系电话 */ /** 联系电话 */

@ -84,7 +84,7 @@ public class SysUser extends BaseEntity
}) })
private SysDept dept; private SysDept dept;
private int teacher;//是否为任课教师 1是 0否 private Integer teacher;//是否为任课教师 1是 0否
/** 角色对象 */ /** 角色对象 */
private List<SysRole> roles; private List<SysRole> roles;
@ -110,11 +110,11 @@ public class SysUser extends BaseEntity
this.userId = userId; this.userId = userId;
} }
public int getTeacher() { public Integer getTeacher() {
return teacher; return teacher;
} }
public void setTeacher(int teacher) { public void setTeacher(Integer teacher) {
this.teacher = teacher; this.teacher = teacher;
} }

@ -2,7 +2,6 @@ package com.ruoyi.common.db;
import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session; import com.jcraft.jsch.Session;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
@ -18,7 +17,7 @@ public class SshTunnelConfig {
// @Value("${ssh.user}") // @Value("${ssh.user}")
private String sshUser="root"; private String sshUser="root";
// @Value("${ssh.identity}") // @Value("${ssh.identity}")
private String sshIdentity="D:\\rpkj\\yoga-app-manager\\private_key\\runpeng20250915.pem"; private String sshIdentity="E:\\runpeng\\runpeng20250915.pem";
// @Value("${ssh.remote.db.host}") // @Value("${ssh.remote.db.host}")
private String remoteDbHost="127.0.0.1"; private String remoteDbHost="127.0.0.1";

@ -1,12 +1,18 @@
package com.ruoyi.framework.config; package com.ruoyi.framework.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.framework.config.converter.CustomMappingJackson2HttpMessageConverter;
import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl; import org.springframework.http.CacheControl;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
@ -14,6 +20,8 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.math.BigInteger;
import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
@ -26,6 +34,8 @@ public class ResourcesConfig implements WebMvcConfigurer
{ {
@Autowired @Autowired
private RepeatSubmitInterceptor repeatSubmitInterceptor; private RepeatSubmitInterceptor repeatSubmitInterceptor;
@Autowired
private ObjectMapper objectMapper;
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
@ -66,4 +76,25 @@ public class ResourcesConfig implements WebMvcConfigurer
source.registerCorsConfiguration("/**", config); source.registerCorsConfiguration("/**", config);
return new CorsFilter(source); return new CorsFilter(source);
} }
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(getMappingJackson2HttpMessageConverter());
}
/**
* jsLongBigIntegerstring
*
* @return
*/
public MappingJackson2HttpMessageConverter getMappingJackson2HttpMessageConverter() {
CustomMappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new CustomMappingJackson2HttpMessageConverter();
SimpleModule simpleModule = new SimpleModule();
// 序列换成json时,将所有的long变成string 因为js中得数字类型不能包含所有的java long值
simpleModule.addSerializer(BigInteger.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
objectMapper.registerModule(simpleModule);
jackson2HttpMessageConverter.setObjectMapper(objectMapper);
return jackson2HttpMessageConverter;
}
} }

@ -0,0 +1,61 @@
package com.ruoyi.framework.config.converter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Type;
/**
* jsonweb api(/web/controller)
*
* @author zhangby
*
*/
public class CustomMappingJackson2HttpMessageConverter extends MappingJackson2HttpMessageConverter {
private final static Logger logger = LoggerFactory.getLogger(CustomMappingJackson2HttpMessageConverter.class);
/**
* Java
*/
@Override
public boolean canRead(Class<?> clazz, MediaType mediaType) {
// 不需要反序列化
return false;
}
/**
* Java
*/
@Override
public boolean canRead(Type type, Class<?> contextClass, MediaType mediaType) {
// 不需要反序列化
return false;
}
/**
* Java .
* web api(/web/xxxx)
*/
@Override
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
if (super.canWrite(clazz, mediaType)) {
ServletRequestAttributes ra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (null != ra) { // web请求
HttpServletRequest request = ra.getRequest();
String uri = request.getRequestURI();
/*if (uri.startsWith("/api/")) {
return true;
}*/
return true;
}
}
return false;
}
}

@ -1,12 +1,13 @@
package com.ruoyi.framework.web.service; package com.ruoyi.framework.web.service;
import java.util.Set;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Set;
/** /**
* RuoYi ssSpringSecurity * RuoYi ssSpringSecurity
@ -38,9 +39,12 @@ public class PermissionService
{ {
return false; return false;
} }
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
System.out.println(loginUser.getPermissions());
if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions()))
{ {
return false; return false;
} }
return hasPermissions(loginUser.getPermissions(), permission); return hasPermissions(loginUser.getPermissions(), permission);

@ -1,12 +1,13 @@
package com.ruoyi.framework.web.service; package com.ruoyi.framework.web.service;
import java.util.HashSet;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashSet;
import java.util.Set;
/** /**
* *
@ -59,7 +60,7 @@ public class SysPermissionService
} }
else else
{ {
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId(),user.getTenantId()));
} }
return perms; return perms;
} }

@ -56,9 +56,13 @@ public class UserDetailsServiceImpl implements UserDetailsService
throw new ServiceException("对不起,您的账号:" + username + " 已停用"); throw new ServiceException("对不起,您的账号:" + username + " 已停用");
} }
SysTenant tenant=tenantService.getById(user.getTenantId()); SysTenant tenant=tenantService.getById(user.getTenantId());
if (ObjectUtil.isEmpty(tenant) || !tenant.getInUse().equals("0") || !DateUtil.date().before(tenant.getEndTime()) ){ if (ObjectUtil.isEmpty(tenant)
|| !tenant.getInUse().equals("0")
|| !DateUtil.date().before(tenant.getEndTime())
|| tenant.getDeleteFlag().equals("1")
){
log.info("用户所属租户:{} 异常.", tenant.getTenantName()); log.info("用户所属租户:{} 异常.", tenant.getTenantName());
throw new ServiceException("用户所属租户:" + tenant.getTenantName() + " 异常"); throw new ServiceException("用户所属租户:" + tenant.getTenantName() + " 异常,无法登录!");
} }
return createLoginUser(user); return createLoginUser(user);

@ -1,70 +0,0 @@
package com.ruoyi.generator;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.service.IGenTableService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = SpringAppTest.class)
@ActiveProfiles("local")
public class ApplicationTest {
@Autowired
@Qualifier("genTableServiceImpl")
private IGenTableService genTableService;
@Test
public void test2() {
List<String> tableNames = Arrays.asList(
// "pms_brand",
// "pms_product_category" ,
// "pms_product",
// "pms_sku"
// "ums_member",
// "ums_member_address",
// "ums_member_wechat",
// "ums_member_cart"
// "oms_order",
// "oms_order_delivery_history",
// "oms_order_item",
// "oms_order_operate_history",
// "oms_aftersale",
// "oms_aftersale_item"
"act_coupon_activity",
"act_member_coupon"
);
// 查询表信息
List<GenTable> tableList = genTableService.selectGenTableByName(tableNames);
List<GenTable> notExist = new ArrayList<>();
try {
tableList.forEach(it -> {
if (it.getTableId() == null) {
it.setAudit(1);
notExist.add(it);
}
});
if (notExist.size() > 0) {
genTableService.importGenTable(notExist, -1L);
}
for (String tableName : tableNames) {
genTableService.generatorCode(tableName);
}
} finally {
// 删除生成
if (notExist.size() > 0) {
Long[] ids = notExist.stream().map(GenTable::getTableId).toArray(Long[]::new);
genTableService.deleteGenTableByIds(ids);
}
}
}
}

@ -1,14 +0,0 @@
package com.ruoyi.generator;
import cn.hutool.core.io.FileUtil;
import org.junit.jupiter.api.Test;
import java.io.File;
public class CommonTest {
@Test
public void testPath() {
System.out.println(System.getProperty("user.dir"));
System.out.println(FileUtil.getParent(System.getProperty("user.dir"), 1) + File.separator);
}
}

@ -1,50 +0,0 @@
package com.ruoyi.generator;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.mapper.GenTableColumnMapper;
import com.ruoyi.generator.mapper.GenTableMapper;
import com.ruoyi.generator.service.GenTableServiceImpl;
import com.ruoyi.generator.service.IGenTableService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
public class SingleComponentTest {
@TestConfiguration
static class EmployeeServiceImplTestContextConfiguration {
@Bean
public IGenTableService employeeService() {
return new GenTableServiceImpl();
}
}
@MockBean
private GenTableMapper genTableMapper;
@MockBean
private GenTableColumnMapper genTableColumnMapper;
@Autowired
private IGenTableService genTableService;
private String tableName = "sys_dept";
@Before
public void setUp() {
GenTable table = new GenTable();
table.setTableName(tableName);
Mockito.when(genTableMapper.selectGenTableByName(tableName))
.thenReturn(table);
}
@Test
public void test1() {
genTableService.generatorCode(tableName);
}
}

@ -1,16 +0,0 @@
package com.ruoyi.generator;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(
scanBasePackages = {"com.ruoyi.generator"}
)
@MapperScan("com.ruoyi.generator.mapper")
public class SpringAppTest {
public static void main(String[] args) {
SpringApplication.run(SpringAppTest.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙");
}
}

@ -1,95 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.7.0</version>
</parent>
<artifactId>ruoyi-mall</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<dependency>
<groupId>com.github.wechatpay-apiv3</groupId>
<artifactId>wechatpay-java</artifactId>
<version>0.2.9</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis.plus.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15to18</artifactId>
<version>1.64</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
<exclusion>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
</dependency>
</dependencies>
</project>

@ -1,80 +0,0 @@
package com.cyl.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.AlgorithmParameters;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.security.spec.InvalidParameterSpecException;
import java.util.Base64;
public class AESForWeixinGetPhoneNumber {
//加密方式
private static String keyAlgorithm = "AES";
//避免重复new生成多个BouncyCastleProvider对象因为GC回收不了会造成内存溢出
//只在第一次调用decrypt()方法时才new 对象
private static boolean initialized = false;
//用于Base64解密
private Base64.Decoder decoder = Base64.getDecoder();
//待解密的数据
private String originalContent;
//会话密钥sessionKey
private String encryptKey;
//加密算法的初始向量
private String iv;
public AESForWeixinGetPhoneNumber(String originalContent, String encryptKey, String iv) {
this.originalContent = originalContent;
this.encryptKey = encryptKey;
this.iv = iv;
}
/**
* AES
* AES/CBC/PKCS7Padding
* 128
*
* @return
*/
public JSONObject decrypt() {
initialize();
try {
//数据填充方式
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding","BC");
// Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
Key sKeySpec = new SecretKeySpec(decoder.decode(this.encryptKey), keyAlgorithm);
// 初始化
cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(decoder.decode(this.iv)));
byte[]data = cipher.doFinal(decoder.decode(this.originalContent));
String datastr = new String(data, StandardCharsets.UTF_8);
return JSON.parseObject(datastr);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**BouncyCastle作为安全提供防止我们加密解密时候因为jdk内置的不支持改模式运行报错。**/
private static void initialize() {
if (initialized) {
return;
}
Security.addProvider(new BouncyCastleProvider());
initialized = true;
}
// 生成iv
private static AlgorithmParameters generateIV(byte[] iv) throws NoSuchAlgorithmException, InvalidParameterSpecException {
AlgorithmParameters params = AlgorithmParameters.getInstance(keyAlgorithm);
params.init(new IvParameterSpec(iv));
return params;
}
}

@ -1,73 +0,0 @@
package com.cyl.config;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
//从连接池获取连接的超时时间,一般设置为较短;
@Value("${http-pool.connection-request-timeout}")
private int connectionRequestTimeout;
//连接超时时间
@Value("${http-pool.connection-timeout}")
private int connectionTimeout;
//完成连接后socket通信超时时间
@Value("${http-pool.socket-timeout}")
private int socketTimeout;
//单host可以理解为单域名最大并发数
@Value("${http-pool.max-per-route}")
private int maxPerRoute;
//连接池最大连接数
@Value("${http-pool.max-total}")
private int maxTotal;
@Bean
public RestTemplate restTemplate() {
return new RestTemplate(httpRequestFactory());
}
@Bean
public ClientHttpRequestFactory httpRequestFactory() {
return new HttpComponentsClientHttpRequestFactory(httpClient());
}
@Bean
public HttpClient httpClient() {
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", SSLConnectionSocketFactory.getSocketFactory())
.build();
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
//设置整个连接池最大连接数 根据自己的场景决定
connectionManager.setMaxTotal(maxTotal);
//路由是对maxTotal的细分
connectionManager.setDefaultMaxPerRoute(maxPerRoute);
RequestConfig requestConfig = RequestConfig.custom()
.setSocketTimeout(socketTimeout)//服务器返回数据(response)的时间超过该时间抛出read timeout
.setConnectTimeout(connectionTimeout)//连接上服务器(握手成功)的时间超出该时间抛出connect timeout
.setConnectionRequestTimeout(connectionRequestTimeout)//从连接池中获取连接的超时时间超过该时间未拿到可用连接会抛出org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
.build();
return HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.setConnectionManager(connectionManager)
.build();
}
}

@ -1,25 +0,0 @@
package com.cyl.config;
import com.cyl.wechat.WechatPayConfig;
import com.wechat.pay.java.service.payments.jsapi.JsapiService;
import com.wechat.pay.java.service.refund.RefundService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
@Configuration
@DependsOn("WechatPayData")
@ConditionalOnProperty(prefix = "wechat", name = "enabled", havingValue = "true")
public class WechatConfig {
@Bean
public JsapiService jsapiService(){
return new JsapiService.Builder().config(WechatPayConfig.getInstance()).build();
}
@Bean
public RefundService refundService(){
return new RefundService.Builder().config(WechatPayConfig.getInstance()).build();
}
}

@ -1,13 +0,0 @@
package com.cyl.external;
import lombok.Data;
@Data
public class ExternalException extends RuntimeException {
private String code;
public ExternalException(String code, String message) {
super(message);
this.code = code;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save