Commit cb477164 by xuwenhao

10.27修改测试问题

parent b969a69b
......@@ -117,6 +117,12 @@ public class SysUser extends BaseEntity
/** 岗位组名称 */
private String postName;
/** 部门组 */
private Long[] deptIds;
/** 部门名称 */
private String deptNames;
/** 角色ID */
private Long roleId;
......@@ -134,6 +140,22 @@ public class SysUser extends BaseEntity
}
public Long[] getDeptIds() {
return deptIds;
}
public void setDeptIds(Long[] deptIds) {
this.deptIds = deptIds;
}
public String getDeptNames() {
return deptNames;
}
public void setDeptNames(String deptNames) {
this.deptNames = deptNames;
}
public String getUnionId() {
return unionId;
}
......
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class SysUserDept {
/** 用户ID */
private Long userId;
/** 岗位ID */
private Long deptId;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("deptId", getDeptId())
.toString();
}
}
......@@ -125,4 +125,29 @@ public interface SysDeptMapper
* 查询部门
* */
public SysDept selectDeptByDeptName(String deptName);
/**
* 根据用户ID获取单位选择框列表
* @param userId
* @return
*/
List<Long> selectDeptListByUserId(Long userId);
/**
* 根据用户ID获取单位
*/
List<SysDept> getDeptdByUserId(Long userId);
/**
* 查询级部
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectGrade(SysDept dept);
/**
* 根据学年查询级部
*/
public SysDept selectDeptGrade(String schoolYear);
}
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.SysUserDept;
import java.util.List;
public interface SysUserDeptMapper {
/**
* 通过用户ID删除用户和部门关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserDeptByUserId(Long userId);
/**
* 通过部门ID查询部门使用数量
*
* @param deptId 部门ID
* @return 结果
*/
public int countUserDeptById(Long deptId);
/**
* 批量删除用户和部门关联
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserDept(Long[] ids);
/**
* 批量新增用户部门信息
*
* @param userDeptList 用户部门列表
* @return 结果
*/
public int batchUserDept(List<SysUserDept> userDeptList);
int saveUserDept(SysUserDept userDept);
}
......@@ -6,14 +6,14 @@ import com.ruoyi.common.core.domain.entity.SysDept;
/**
* 部门管理 服务层
*
*
* @author ruoyi
*/
public interface ISysDeptService
{
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
......@@ -21,7 +21,7 @@ public interface ISysDeptService
/**
* 查询部门树结构信息
*
*
* @param dept 部门信息
* @return 部门树信息集合
*/
......@@ -29,7 +29,7 @@ public interface ISysDeptService
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
......@@ -37,7 +37,7 @@ public interface ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
......@@ -45,7 +45,7 @@ public interface ISysDeptService
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
......@@ -53,7 +53,7 @@ public interface ISysDeptService
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
......@@ -61,7 +61,7 @@ public interface ISysDeptService
/**
* 根据ID查询所有子部门(正常状态)
*
*
* @param deptId 部门ID
* @return 子部门数
*/
......@@ -69,7 +69,7 @@ public interface ISysDeptService
/**
* 是否存在部门子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
......@@ -77,7 +77,7 @@ public interface ISysDeptService
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
......@@ -85,7 +85,7 @@ public interface ISysDeptService
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -93,14 +93,14 @@ public interface ISysDeptService
/**
* 校验部门是否有数据权限
*
*
* @param deptId 部门id
*/
public void checkDeptDataScope(Long deptId);
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -108,7 +108,7 @@ public interface ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -116,9 +116,22 @@ public interface ISysDeptService
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
/**
* 根据用户ID获取单位
*/
List<SysDept> getDeptdByUserId(Long userId);
/**
* 查询级部
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectGrade(SysDept dept);
}
......@@ -23,7 +23,7 @@ import com.ruoyi.system.service.ISysDeptService;
/**
* 部门管理 服务实现
*
*
* @author ruoyi
*/
@Service
......@@ -37,7 +37,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
......@@ -50,7 +50,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门树结构信息
*
*
* @param dept 部门信息
* @return 部门树信息集合
*/
......@@ -64,7 +64,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
......@@ -95,7 +95,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
......@@ -108,7 +108,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
......@@ -121,7 +121,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
......@@ -133,7 +133,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据ID查询所有子部门(正常状态)
*
*
* @param deptId 部门ID
* @return 子部门数
*/
......@@ -145,7 +145,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 是否存在子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
......@@ -158,7 +158,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
......@@ -171,7 +171,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -189,7 +189,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 校验部门是否有数据权限
*
*
* @param deptId 部门id
*/
@Override
......@@ -209,7 +209,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -228,7 +228,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -256,7 +256,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改该部门的父级部门状态
*
*
* @param dept 当前部门
*/
private void updateParentDeptStatusNormal(SysDept dept)
......@@ -268,7 +268,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改子元素关系
*
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
......@@ -288,7 +288,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
......@@ -298,6 +298,7 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.deleteDeptById(deptId);
}
/**
* 递归列表
*/
......@@ -340,4 +341,22 @@ public class SysDeptServiceImpl implements ISysDeptService
{
return getChildList(list, t).size() > 0;
}
/**
* 根据用户ID获取单位
*/
@Override
public List<SysDept> getDeptdByUserId(Long userId) {
return deptMapper.getDeptdByUserId(userId);
}
/**
* 查询级部
* @param dept 部门信息
* @return
*/
@Override
public List<SysDept> selectGrade(SysDept dept) {
return deptMapper.selectGrade(dept);
}
}
......@@ -7,6 +7,8 @@ import java.util.stream.Collectors;
import javax.validation.Validator;
import com.ruoyi.common.core.domain.entity.SchoolTeacher;
import com.ruoyi.system.domain.SysUserDept;
import com.ruoyi.system.mapper.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,11 +27,6 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysPostMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserPostMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
......@@ -58,6 +55,9 @@ public class SysUserServiceImpl implements ISysUserService {
private SysUserPostMapper userPostMapper;
@Autowired
private SysUserDeptMapper userDeptMapper;
@Autowired
private ISysConfigService configService;
@Autowired
......@@ -249,6 +249,8 @@ public class SysUserServiceImpl implements ISysUserService {
insertUserPost(user);
// 新增用户与角色管理
insertUserRole(user);
//新增用户与部门关联
insertUserDept(user);
return rows;
}
......@@ -281,6 +283,10 @@ public class SysUserServiceImpl implements ISysUserService {
userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理
insertUserPost(user);
// 删除用户与部门关联
userDeptMapper.deleteUserDeptByUserId(userId);
// 新增用户与部门关联
insertUserDept(user);
return userMapper.updateUser(user);
}
......@@ -394,6 +400,26 @@ public class SysUserServiceImpl implements ISysUserService {
}
/**
* 新增用户部门信息
*
* @param user 用户对象
*/
public void insertUserDept(SysUser user) {
Long[] depts = user.getDeptIds();
if (StringUtils.isNotEmpty(depts)) {
// 新增用户与部门关联
List<SysUserDept> list = new ArrayList<SysUserDept>(depts.length);
for (Long deptId : depts) {
SysUserDept ud = new SysUserDept();
ud.setUserId(user.getUserId());
ud.setDeptId(deptId);
list.add(ud);
}
userDeptMapper.batchUserDept(list);
}
}
/**
* 新增用户角色信息
*
* @param userId 用户ID
......
......@@ -165,4 +165,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
<select id="selectDeptListByUserId" parameterType="Long" resultType="Long">
select d.dept_id
from sys_dept d
left join sys_user_dept ud on ud.dept_id =d.dept_id
left join sys_user u on u.user_id = ud.user_id
where u.user_id = #{userId}
</select>
<select id="getDeptdByUserId" resultMap="SysDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
left join sys_user_dept ud on ud.dept_id = d.dept_id
left join sys_user u on u.user_id = ud.user_id
where u.user_id = #{userId}
</select>
<select id="selectGrade" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
WHERE dept_name like concat('%', "级部", '%') AND parent_id = 100
</select>
<select id="selectDeptGrade" parameterType="String" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
WHERE dept_name like concat('%', #{schoolYear}, '%') AND parent_id = 100
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysUserDeptMapper">
<resultMap type="SysUserDept" id="SysUserDeptResult">
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
</resultMap>
<delete id="deleteUserDeptByUserId" parameterType="Long">
delete from sys_user_dept where user_id=#{userId}
</delete>
<select id="countUserDeptById" resultType="Integer">
select count(1) from sys_user_dept where dept_id=#{deptId}
</select>
<delete id="deleteUserDept" parameterType="Long">
delete from sys_user_dept where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserDept">
insert into sys_user_dept(user_id, dept_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.deptId})
</foreach>
</insert>
<insert id="saveUserDept">
insert into sys_user_dept(user_id, dept_id) values(#{userId},#{deptId})
</insert>
</mapper>
......@@ -182,38 +182,38 @@ public class SchoolAuditoriumController extends BaseController
//发送钉钉消息到分管领导
//获取钉钉用户id
String ddUserId = teacherService.getDdUserIdByUserId(schoolAuditorium.getLeadershipId());
//发送钉钉消息给分管领导
DingMessageVo messageVo = new DingMessageVo();
OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
msg.setOa(new OapiMessageCorpconversationAsyncsendV2Request.OA());
msg.getOa().setHead(new OapiMessageCorpconversationAsyncsendV2Request.Head());
msg.getOa().getHead().setText("二中校园测试");
msg.getOa().setBody(new OapiMessageCorpconversationAsyncsendV2Request.Body());
msg.getOa().getBody().setAuthor(schoolAuditorium.getApplyName());
msg.getOa().getBody().setContent("申请内容:" + schoolAuditorium.getActivityName());
msg.getOa().getBody().setTitle("您好,您有礼堂预约申请等待审批!");
OapiMessageCorpconversationAsyncsendV2Request.Form form1 = new OapiMessageCorpconversationAsyncsendV2Request.Form();
form1.setKey("申请时间:");
form1.setValue(applyTime);
msg.getOa().getBody().setForm(Arrays.asList(form1));
msg.getOa().setPcMessageUrl("https://open.dingtalk.com/");
msg.getOa().setMessageUrl("https://open.dingtalk.com/");
msg.setMsgtype("oa");
OapiMessageCorpconversationAsyncsendV2Request.StatusBar statusBar = new OapiMessageCorpconversationAsyncsendV2Request.StatusBar();
statusBar.setStatusBg("0xFFF65E5E");
statusBar.setStatusValue("进行中");
msg.getOa().setStatusBar(statusBar);
messageVo.setMsg(msg);
messageVo.setToAllUser(false);
messageVo.setUseridList(ddUserId);
Long ddTaskId = dingMessageUtils.sendMessage(messageVo);
//更新消息任务id、钉钉流程实例id
SchoolAuditorium auditorium = new SchoolAuditorium();
auditorium.setId(id);
auditorium.setDdTaskId(ddTaskId);
auditorium.setDdInstanceId(ddInstanceId);
schoolAuditoriumService.updateById(auditorium);
// String ddUserId = teacherService.getDdUserIdByUserId(schoolAuditorium.getLeadershipId());
// //发送钉钉消息给分管领导
// DingMessageVo messageVo = new DingMessageVo();
// OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
// msg.setOa(new OapiMessageCorpconversationAsyncsendV2Request.OA());
// msg.getOa().setHead(new OapiMessageCorpconversationAsyncsendV2Request.Head());
// msg.getOa().getHead().setText("二中校园测试");
// msg.getOa().setBody(new OapiMessageCorpconversationAsyncsendV2Request.Body());
// msg.getOa().getBody().setAuthor(schoolAuditorium.getApplyName());
// msg.getOa().getBody().setContent("申请内容:" + schoolAuditorium.getActivityName());
// msg.getOa().getBody().setTitle("您好,您有礼堂预约申请等待审批!");
// OapiMessageCorpconversationAsyncsendV2Request.Form form1 = new OapiMessageCorpconversationAsyncsendV2Request.Form();
// form1.setKey("申请时间:");
// form1.setValue(applyTime);
// msg.getOa().getBody().setForm(Arrays.asList(form1));
// msg.getOa().setPcMessageUrl("https://open.dingtalk.com/");
// msg.getOa().setMessageUrl("https://open.dingtalk.com/");
// msg.setMsgtype("oa");
// OapiMessageCorpconversationAsyncsendV2Request.StatusBar statusBar = new OapiMessageCorpconversationAsyncsendV2Request.StatusBar();
// statusBar.setStatusBg("0xFFF65E5E");
// statusBar.setStatusValue("进行中");
// msg.getOa().setStatusBar(statusBar);
// messageVo.setMsg(msg);
// messageVo.setToAllUser(false);
// messageVo.setUseridList(ddUserId);
// Long ddTaskId = dingMessageUtils.sendMessage(messageVo);
// //更新消息任务id、钉钉流程实例id
// SchoolAuditorium auditorium = new SchoolAuditorium();
// auditorium.setId(id);
// auditorium.setDdTaskId(ddTaskId);
// auditorium.setDdInstanceId(ddInstanceId);
// schoolAuditoriumService.updateById(auditorium);
/**发送模板消息到分管领导*/
//获取用户openid
// String openId = teacherService.getOpenIdByUserId(schoolAuditorium.getLeadershipId());
......@@ -288,25 +288,25 @@ public class SchoolAuditoriumController extends BaseController
//获取钉钉用户id
String ddUserId = teacherService.getDdUserIdByUserId(leave.getApplyId());
//发送钉钉消息给分管领导
DingMessageVo messageVo = new DingMessageVo();
OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
msg.setOa(new OapiMessageCorpconversationAsyncsendV2Request.OA());
msg.getOa().setHead(new OapiMessageCorpconversationAsyncsendV2Request.Head());
msg.getOa().getHead().setText("二中校园测试");
msg.getOa().setBody(new OapiMessageCorpconversationAsyncsendV2Request.Body());
msg.getOa().getBody().setAuthor(leave.getLeadershipName());
msg.getOa().getBody().setContent(flag ? "已通过" : "已驳回");
msg.getOa().getBody().setTitle("您好,您的礼堂预约申请已回复。");
msg.getOa().setPcMessageUrl("https://open.dingtalk.com/");
msg.getOa().setMessageUrl("https://open.dingtalk.com/");
msg.setMsgtype("oa");
messageVo.setMsg(msg);
messageVo.setToAllUser(false);
messageVo.setUseridList(ddUserId);
dingMessageUtils.sendMessage(messageVo);
// DingMessageVo messageVo = new DingMessageVo();
// OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
// msg.setOa(new OapiMessageCorpconversationAsyncsendV2Request.OA());
// msg.getOa().setHead(new OapiMessageCorpconversationAsyncsendV2Request.Head());
// msg.getOa().getHead().setText("二中校园测试");
// msg.getOa().setBody(new OapiMessageCorpconversationAsyncsendV2Request.Body());
// msg.getOa().getBody().setAuthor(leave.getLeadershipName());
// msg.getOa().getBody().setContent(flag ? "已通过" : "已驳回");
// msg.getOa().getBody().setTitle("您好,您的礼堂预约申请已回复。");
// msg.getOa().setPcMessageUrl("https://open.dingtalk.com/");
// msg.getOa().setMessageUrl("https://open.dingtalk.com/");
// msg.setMsgtype("oa");
// messageVo.setMsg(msg);
// messageVo.setToAllUser(false);
// messageVo.setUseridList(ddUserId);
// dingMessageUtils.sendMessage(messageVo);
//修改消息任务状态为已完成
dingMessageUtils.updateStatusBar(leave.getDdTaskId(), "已完成", "0xFF78C06E");
// dingMessageUtils.updateStatusBar(leave.getDdTaskId(), "已完成", "0xFF78C06E");
/**发送模板消息到申请人,审批结果*/
//获取申请人openId
......
......@@ -3,6 +3,7 @@ package yangtz.cs.liu.campus.controller.educationalStatistics;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.io.resource.ClassPathResource;
import com.core.utils.StringUtil;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
......@@ -87,9 +88,12 @@ public class StatisticsController extends BaseController {
* 教务-统计-年龄统计
*/
@GetMapping("/age/{schoolYear}")
public TableDataInfo age(@PathVariable("schoolYear") int schoolYear)
public TableDataInfo age(@PathVariable("schoolYear") String schoolYear)
{
return getDataTable(statisticsService.getAgeNum(schoolYear));
if (StringUtils.isEmpty(schoolYear)){
throw new ServiceException("请选择学年!");
}
return getDataTable(statisticsService.getAgeNum(Integer.parseInt(schoolYear)));
}
/**年龄导出*/
......
......@@ -113,11 +113,18 @@ public class SchoolMessageParentsPushsController extends BaseController
if(StringUtils.isNull(pList) || pList.size() == 0){
return getDataTable(new ArrayList<>());
}
//获取所有家长信息
List<SchoolStudentParent> schoolStudentParents = schoolStudentParentService.list();
//获取家长的用户id
List<Long> pIdList = new ArrayList<>();
for(SchoolStudentParentVO vo : pList){
SchoolStudentParent p = schoolStudentParentService.getById(vo.getId());
pIdList.add(p.getUserId());
// SchoolStudentParent p = schoolStudentParentService.getById(vo.getId());
for (SchoolStudentParent schoolStudentParent : schoolStudentParents) {
if (vo.getId().equals(schoolStudentParent.getId())){
pIdList.add(schoolStudentParent.getUserId());
}
}
// pIdList.add(p.getUserId());
}
//获取几张信息推送ID
List<Long> pushIds = parentsPushsService.queryDetailsList(pIdList);
......
......@@ -290,8 +290,9 @@ public class SchoolTeacherExperimentApplyController extends BaseController
default:break;
}
}
schoolTeacherExperimentApplyVo.setSubs(labSubs);
if (labSubs.size() > 0 ){
schoolTeacherExperimentApplyVo.setSubs(labSubs);
}
startPage();
List<SchoolTeacherExperimentApplyVo> list = schoolTeacherExperimentApplyService.getTeacherList(schoolTeacherExperimentApplyVo);
list.forEach(list1 -> {
......
......@@ -5,7 +5,9 @@ import com.core.utils.HolidayDateUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
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.exception.ServiceException;
......@@ -26,9 +28,8 @@ import yangtz.cs.liu.campus.service.student.ISchoolStudentService;
import yangtz.cs.liu.campus.vo.schoolgrade.GradeTreeSelect;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.StringUtils.isNull;
import static yangtz.cs.liu.campus.constant.EmployeeType.EMPLOYEE;
......@@ -69,25 +70,53 @@ public class SchoolGradeController extends BaseController {
*/
@GetMapping("/getList")
public AjaxResult getList() {
String employeeType = getLoginUser().getUser().getEmployeeType();
//是教工
if (employeeType.equals(TEACH)) {
//获取最新学年
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改当前最新学年
int schoolYear = schoolGradeService.isNewSchoolYear();
SchoolGrade schoolGrade = new SchoolGrade();
//schoolGrade.setSfzxxn(NEWTERM);
schoolGrade.setSchoolYear(String.valueOf(schoolYear));
List<SchoolGrade> list = schoolGradeService.queryList(schoolGrade);
List<GradeTreeSelect> gradeTreeSelectList = new ArrayList<>();
if (StringUtils.isNotNull(list)) {
gradeTreeSelectList = schoolGradeService.buildGradeTreeList(list);
//TODO 改造
//获取当前登录用户
SysUser user = getLoginUser().getUser();
List<SysDept> depts = new ArrayList<>();
//获取用户所在部门
List<SysDept> deptList = deptService.getDeptdByUserId(user.getUserId());
for (SysDept sysDept : deptList) {
String[] split = sysDept.getAncestors().split(",");
for (int i = split.length -1; i>0; i--) {
SysDept sysDept1 = deptService.selectDeptById(Long.valueOf(split[i]));
if (!depts.contains(sysDept1)) {
depts.add(sysDept1);
}
}
if (!depts.contains(sysDept)){
depts.add(sysDept);
}
return AjaxResult.success(gradeTreeSelectList);
}
//职工
return AjaxResult.success(deptService.selectDeptTreeList(new SysDept()));
SysDept sysDept = deptService.selectDeptById(user.getDeptId());
if (!depts.contains(sysDept)){
depts.add(sysDept);
}
ArrayList<SysDept> sysDepts = depts.stream().collect(Collectors
.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator
.comparing(SysDept::getDeptId))), ArrayList::new));
return AjaxResult.success(deptService.buildDeptTreeSelect(sysDepts));
// //TODO 原方式
// String employeeType = getLoginUser().getUser().getEmployeeType();
// //是教工
// if (employeeType.equals(TEACH)) {
// //获取最新学年
//// int schoolYear = HolidayDateUtil.getSchoolYear();
// // TODO 修改当前最新学年
// int schoolYear = schoolGradeService.isNewSchoolYear();
// SchoolGrade schoolGrade = new SchoolGrade();
// //schoolGrade.setSfzxxn(NEWTERM);
// schoolGrade.setSchoolYear(String.valueOf(schoolYear));
// List<SchoolGrade> list = schoolGradeService.queryList(schoolGrade);
// List<GradeTreeSelect> gradeTreeSelectList = new ArrayList<>();
// if (StringUtils.isNotNull(list)) {
// gradeTreeSelectList = schoolGradeService.buildGradeTreeList(list);
// }
// return AjaxResult.success(gradeTreeSelectList);
// }
// //职工
// return AjaxResult.success(deptService.selectDeptTreeList(new SysDept()));
}
/**
......@@ -147,14 +176,57 @@ public class SchoolGradeController extends BaseController {
*/
@GetMapping("/getDeptOrGrade")
public AjaxResult getDeptOrGrade() {
String employeeType = getLoginUser().getUser().getEmployeeType();
//是教工
if (employeeType.equals(TEACH)) {
//判断所在班级所在级部(存在一个老师跨几个级部教学,比如体育老师,所以获取教授班级所在级部,随便选择某个级部即可)
return AjaxResult.success(schoolGradeService.getGradeId(getUserId()));
}
// String employeeType = getLoginUser().getUser().getEmployeeType();
// //是教工
// if (employeeType.equals(TEACH)) {
// //判断所在班级所在级部(存在一个老师跨几个级部教学,比如体育老师,所以获取教授班级所在级部,随便选择某个级部即可)
// return AjaxResult.success(schoolGradeService.getGradeId(getUserId()));
// }
//职工
return AjaxResult.success(getDeptId());
AjaxResult ajaxResult = AjaxResult.success();
//当前用户主部门id
Long deptId = getDeptId();
ajaxResult.put("data",deptId);
//判断该部门是属于级部还是科室
SysDept sysDept = deptService.selectDeptById(deptId);
String ancestors = sysDept.getAncestors();
//查询级部
List<SysDept> sysDepts = deptService.selectGrade(new SysDept());
if (sysDepts.size() > 0){
for (SysDept dept : sysDepts) {
if (ancestors.contains(dept.getDeptId().toString())){
ajaxResult.put("employeeType","0");
return ajaxResult;
}
}
}
ajaxResult.put("employeeType","1");
return ajaxResult;
}
/**
* 判断用户所选部门是属于级部还是科室
*/
@GetMapping("/judgeDeptOrGrade/{deptId}")
public AjaxResult judgeDeptOrGrade(@PathVariable("deptId") Long deptId) {
AjaxResult ajaxResult = AjaxResult.success();
ajaxResult.put("data",deptId);
//判断该部门是属于级部还是科室
SysDept sysDept = deptService.selectDeptById(deptId);
String ancestors = sysDept.getAncestors();
//查询级部
List<SysDept> sysDepts = deptService.selectGrade(new SysDept());
if (sysDepts.size() > 0){
for (SysDept dept : sysDepts) {
if (ancestors.contains(dept.getDeptId().toString())){
ajaxResult.put("employeeType","0");
return ajaxResult;
}
}
}
ajaxResult.put("employeeType","1");
return ajaxResult;
}
/**
......
......@@ -6,12 +6,14 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SchoolTeacher;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
......@@ -92,6 +94,9 @@ public class SchoolTeacherLeaveController extends BaseController {
@Autowired
private TaskService taskService;
@Autowired
private ISysDeptService deptService;
//职工
private static final String TYPE = "1";
......@@ -143,7 +148,22 @@ public class SchoolTeacherLeaveController extends BaseController {
*/
@PostMapping("/add")
public AjaxResult add(@RequestBody @Validated SchoolTeacherLeave schoolTeacherLeave) {
schoolTeacherLeave.setApplyType(getLoginUser().getUser().getEmployeeType());
schoolTeacherLeave.setApplyType("1");
//判断部门是科室还是级部
Long applyOrgid = schoolTeacherLeave.getApplyOrgid();
SysDept sysDept = deptService.selectDeptById(applyOrgid);
String ancestors = sysDept.getAncestors();
//查询级部
List<SysDept> sysDepts = deptService.selectGrade(new SysDept());
if (sysDepts.size() > 0){
for (SysDept dept : sysDepts) {
if (ancestors.contains(dept.getDeptId().toString())){
schoolTeacherLeave.setApplyType("0");
break;
}
}
}
// schoolTeacherLeave.setApplyType(getLoginUser().getUser().getEmployeeType());
schoolTeacherLeave.setState(SAVE);
schoolTeacherLeave.setApplyUserId(getUserId());
schoolTeacherLeave.setApplyUser(getUsername());
......@@ -170,6 +190,24 @@ public class SchoolTeacherLeaveController extends BaseController {
}
schoolTeacherLeaveService.judgeDate(schoolTeacherLeave);
schoolTeacherLeaveService.judgeHandUser(schoolTeacherLeave);
//判断部门属于级部还是科室
schoolTeacherLeave.setApplyType("1");
Long applyOrgid = schoolTeacherLeave.getApplyOrgid();
SysDept sysDept = deptService.selectDeptById(applyOrgid);
schoolTeacherLeave.setApplyOrgname(sysDept.getDeptName());
String ancestors = sysDept.getAncestors();
//查询级部
List<SysDept> sysDepts = deptService.selectGrade(new SysDept());
if (sysDepts.size() > 0){
for (SysDept dept : sysDepts) {
if (ancestors.contains(dept.getDeptId().toString())){
schoolTeacherLeave.setApplyType("0");
break;
}
}
}
//return toAjax(schoolTeacherLeaveService.updateById(schoolTeacherLeave));
return toAjax(schoolTeacherLeaveService.editLeave(schoolTeacherLeave));
}
......@@ -219,6 +257,9 @@ public class SchoolTeacherLeaveController extends BaseController {
if (StringUtils.isNull(schoolTeacherLeave)) {
throw new ServiceException("提交申请失败,未查询到相关信息");
}
if (StringUtils.isNull(schoolTeacherLeave.getHandUserId1())){
throw new ServiceException("提交申请失败,请选择级部/处室主任后重试");
}
String userName = getUsername();
schoolTeacherLeave.setApplyTime(DateUtils.getNowDate());
......@@ -429,7 +470,8 @@ public class SchoolTeacherLeaveController extends BaseController {
@GetMapping("/getDeptLeader/{applyOrgid}")
public TableDataInfo getLeader(@PathVariable Long applyOrgid,SchoolTeacherVO teacherVO) {
//判断用户是职工还是教工,来确定传过来的id是级部id还是部门id
String employeeType = getLoginUser().getUser().getEmployeeType();
// String employeeType = getLoginUser().getUser().getEmployeeType();
String employeeType = "1";
startPage();
return getDataTable(schoolTeacherLeaveService.getLeader(applyOrgid,employeeType,teacherVO));
}
......
......@@ -193,10 +193,10 @@ public class SchoolTimeTableController extends BaseController {
Long teacherId = getUserId();
//获取当前登录用户
SysUser user = getLoginUser().getUser();
if(user.getEmployeeType().equals(EMPLOYEE)){
//throw new ServiceException("您的用户类型为职工,无法查询个人课表");
return getDataTable(new ArrayList<>());
}
// if(user.getEmployeeType().equals(EMPLOYEE)){
// //throw new ServiceException("您的用户类型为职工,无法查询个人课表");
// return getDataTable(new ArrayList<>());
// }
List<TableVO> list = schoolTimeTableService.getTeacherTable(teacherId);
return getDataTable(list);
}
......
......@@ -19,10 +19,10 @@ public class CurriculaVariable extends OurBaseEntity
/** 任务名称 */
private String taskName;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
/** 级部 */
private String grade;
......
package yangtz.cs.liu.campus.domain.introduce;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.core.domain.OurBaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
......@@ -22,6 +24,7 @@ public class SchoolIntroduce extends OurBaseEntity
// 版本号
/** */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 园所类型 */
......
......@@ -58,4 +58,11 @@ public interface CurriculaStudentMapper extends BaseMapper<CurriculaStudent> {
* @return
*/
List<CurriculaStudentVo> selectCurriculaStudentListYt(CurriculaStudentVo curriculaStudentVo);
/**
* 批量新增学生和选课关系
* @param list
* @return
*/
int batchInsertCurriculaStudent(List<CurriculaStudent> list);
}
......@@ -30,6 +30,11 @@ public interface SchoolGradeMentorMapper extends BaseMapper<SchoolGradeMentor> {
@Param("role") String role,
@Param("entity")SchoolTeacherVO entity);
//(改造)获取级部主任
List<SchoolTeacher> getGradeDirector(@Param("deptId") Long deptId,
@Param("role") String role,
@Param("entity")SchoolTeacherVO entity);
/**获取用户所在级部列表,*/
List<SchoolGrade> getGradeByUserId(@Param("userId") Long userId,
@Param("schoolYear")int schoolYear);
......
......@@ -83,6 +83,13 @@ public interface SchoolTeacherMapper extends BaseMapper<SchoolTeacher>{
@Param("role") String role,
@Param("entity") SchoolTeacherVO entity);
/**
* (改造)获取所在处室处室主任
*/
List<SchoolTeacher> getSectionDirector(@Param("deptId") Long deptId,
@Param("role") String role,
@Param("entity") SchoolTeacherVO entity);
//根据设备号部门姓名,查询当前系统是否有该教职工
SchoolTeacherVO judge(String deviceNum);
......
......@@ -86,13 +86,16 @@ public class CurriculaVariableServiceImpl extends ServiceImpl<CurriculaVariableM
CurriculaVariable variable = curriculaVariableMapper.selectById(curriculaVariable.getId());
//新增学生与选课任务关系
List<Long> studentIds = curriculaVariableMapper.selectByGrade(variable.getGrade());
if (studentIds.size() > 0){
List<CurriculaStudent> curriculaStudents = new ArrayList<>();
for (Long studentId : studentIds) {
CurriculaStudent curriculaStudent = new CurriculaStudent();
curriculaStudent.setStudentId(studentId);
curriculaStudent.setCurriculaId(curriculaVariable.getId());
curriculaStudentMapper.insert(curriculaStudent);
curriculaStudents.add(curriculaStudent);
}
curriculaStudentMapper.batchInsertCurriculaStudent(curriculaStudents);
}
return i;
}
......
......@@ -2,6 +2,7 @@ package yangtz.cs.liu.campus.service.impl.educationStatistics;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.utils.HolidayDateUtil;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -242,8 +243,11 @@ public class EducationStatisticsServiceImpl implements IEducationStatisticsServi
stuLqw.eq(SchoolStudent::getClassId, c.getId());
List<SchoolStudent> schoolStudents = studentMapper.selectList(stuLqw);
for (SchoolStudent schoolStudent : schoolStudents) {
//计算学生年龄
int age = getAge(schoolStudent.getBirthday());
// TODO 修改 计算学生年龄
int age = 0;
if (StringUtils.isNotNull(schoolStudent.getBirthday())){
age = getAge(schoolStudent.getBirthday());
}
switch (age) {
case 13:
num13++;
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
......@@ -98,6 +99,11 @@ public class CirculationServiceImpl extends ServiceImpl<CirculationMapper, Schoo
@Override
@Transactional
public int insertSchoolCirculation(SchoolCirculation schoolCirculation) {
//判断该设备是否允许借出
SchoolEquipmentLedger schoolEquipmentLedger1 = equipmentLedgerMapper.selectById(schoolCirculation.getEquipmentId());
if (schoolEquipmentLedger1.getIsAllowLend().equals("0")){
throw new ServiceException("该设备不允许借出");
}
if (StringUtils.isNotNull(schoolCirculation.getBorrowById())){
String userName = sysUserMapper.selectUserById(schoolCirculation.getBorrowById()).getUserName();
schoolCirculation.setBorrowBy(userName);
......
......@@ -89,6 +89,11 @@ public class EquipmentRepairServiceImpl extends ServiceImpl<EquipmentRepairMappe
String userName = sysUserMapper.selectUserById(schoolEquipmentRepair.getRepairId()).getUserName();
schoolEquipmentRepair.setRepairName(userName);
}
if (StringUtils.isNotEmpty(schoolEquipmentRepair.getDisposeState())){
if (schoolEquipmentRepair.getDisposeState().equals("0")){
schoolEquipmentRepair.setRepairState("");
}
}
schoolEquipmentRepair.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolEquipmentRepair.setCreateTime(DateUtils.getNowDate());
return equipmentRepairMapper.insert(schoolEquipmentRepair);
......@@ -110,6 +115,11 @@ public class EquipmentRepairServiceImpl extends ServiceImpl<EquipmentRepairMappe
String userName = sysUserMapper.selectUserById(schoolEquipmentRepair.getRepairId()).getUserName();
schoolEquipmentRepair.setRepairName(userName);
}
if (StringUtils.isNotEmpty(schoolEquipmentRepair.getDisposeState())){
if (schoolEquipmentRepair.getDisposeState().equals("0")){
schoolEquipmentRepair.setRepairState("");
}
}
schoolEquipmentRepair.setUpdateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolEquipmentRepair.setUpdateTime(DateUtils.getNowDate());
return equipmentRepairMapper.updateById(schoolEquipmentRepair);
......
......@@ -88,6 +88,38 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
}
String[] split = schoolProductCategory.getAncestors().split(",");
schoolProductCategory.setRank((long) split.length);
switch (split.length){
case 1:
if (schoolProductCategory.getClassificationCode().length() < 2) {
throw new ServiceException("一级分类编码最小长度为2");
}
break;
case 2:
if (schoolProductCategory.getClassificationCode().length() < 4) {
throw new ServiceException("二级分类编码最小长度为4");
}
break;
case 3:
if (schoolProductCategory.getClassificationCode().length() < 6) {
throw new ServiceException("三级分类编码最小长度为6");
}
break;
case 4:
if (schoolProductCategory.getClassificationCode().length() < 8) {
throw new ServiceException("四级分类编码最小长度为8");
}
break;
case 5:
if (schoolProductCategory.getClassificationCode().length() < 10) {
throw new ServiceException("五级分类编码最小长度为10");
}
break;
case 6:
if (schoolProductCategory.getClassificationCode().length() < 12) {
throw new ServiceException("六级分类编码最小长度为12");
}
break;
}
String userName = sysUserMapper.selectUserById(schoolProductCategory.getAdminId()).getUserName();
schoolProductCategory.setAdmin(userName);
schoolProductCategory.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
......@@ -112,16 +144,52 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
if (schoolProductCategories != null && schoolProductCategories.size() > 0){
throw new ServiceException("该分类编码已存在");
}
String[] split = schoolProductCategory.getAncestors().split(",");
schoolProductCategory.setRank((long) split.length);
switch (split.length){
case 1:
if (schoolProductCategory.getClassificationCode().length() < 2) {
throw new ServiceException("一级分类编码最小长度为2");
}
break;
case 2:
if (schoolProductCategory.getClassificationCode().length() < 4) {
throw new ServiceException("二级分类编码最小长度为4");
}
break;
case 3:
if (schoolProductCategory.getClassificationCode().length() < 6) {
throw new ServiceException("三级分类编码最小长度为6");
}
break;
case 4:
if (schoolProductCategory.getClassificationCode().length() < 8) {
throw new ServiceException("四级分类编码最小长度为8");
}
break;
case 5:
if (schoolProductCategory.getClassificationCode().length() < 10) {
throw new ServiceException("五级分类编码最小长度为10");
}
break;
case 6:
if (schoolProductCategory.getClassificationCode().length() < 12) {
throw new ServiceException("六级分类编码最小长度为12");
}
break;
}
//父id
if (StringUtils.isNotNull(schoolProductCategory.getParentId())){
SchoolProductCategory schoolProductCategory1 = productCategoryMapper.selectById(schoolProductCategory.getParentId());
schoolProductCategory.setAncestors(schoolProductCategory1.getAncestors() + "," + schoolProductCategory.getParentId());
if (StringUtils.isNotNull(schoolProductCategory1)){
schoolProductCategory.setAncestors(schoolProductCategory1.getAncestors() + "," + schoolProductCategory.getParentId());
}
}else {
schoolProductCategory.setParentId((long) 0);
schoolProductCategory.setAncestors("0");
}
String[] split = schoolProductCategory.getAncestors().split(",");
schoolProductCategory.setRank((long) split.length);
// String[] split = schoolProductCategory.getAncestors().split(",");
// schoolProductCategory.setRank((long) split.length);
//根据用户id获取用户名
String userName = sysUserMapper.selectUserById(schoolProductCategory.getAdminId()).getUserName();
......@@ -154,24 +222,20 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
@Override
// @DataScope(userAlias = "u")
public List<Map<String, String>> getEquipmentType(SchoolProductCategory schoolProductCategory) {
List<Map<String, String>> list = new ArrayList<>();
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
list = productCategoryMapper.getEquipmentType(schoolProductCategory);
break;
return productCategoryMapper.getEquipmentType(schoolProductCategory);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolProductCategory.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
list = productCategoryMapper.getEquipmentTypeGr(schoolProductCategory);
return productCategoryMapper.getEquipmentTypeGr(schoolProductCategory);
}
}
if (roles.size() <= 0){
if (user.isAdmin()){
list = productCategoryMapper.getEquipmentType(schoolProductCategory);
}
if (user.isAdmin()){
return productCategoryMapper.getEquipmentType(schoolProductCategory);
}
return list;
return new ArrayList<>();
}
/**
......@@ -181,24 +245,20 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
@Override
// @DataScope(userAlias = "u")
public List<Map<String, String>> getAdmin(SchoolProductCategory schoolProductCategory) {
List<Map<String, String>> list = new ArrayList<>();
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
if (user.isAdmin()){
return productCategoryMapper.getAdmin(schoolProductCategory);
}
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
list = productCategoryMapper.getAdmin(schoolProductCategory);
break;
return productCategoryMapper.getAdmin(schoolProductCategory);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolProductCategory.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
list = productCategoryMapper.getAdminGr(schoolProductCategory);
}
}
if (roles.size() <= 0){
if (user.isAdmin()){
list = productCategoryMapper.getAdmin(schoolProductCategory);
return productCategoryMapper.getAdminGr(schoolProductCategory);
}
}
return list;
return new ArrayList<>();
}
/**
......@@ -208,35 +268,31 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
*/
@Override
public SchoolProductCategory getEquipmentByCode(String code) {
List<SchoolProductCategory> list = new ArrayList<>();
// List<SchoolProductCategory> list = new ArrayList<>();
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
if (user.isAdmin()){
// list.clear();
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code);
return productCategoryMapper.selectOne(wrapper);
}
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
list.clear();
// list.clear();
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code);
list.add(productCategoryMapper.selectOne(wrapper));
break;
// list.add(productCategoryMapper.selectOne(wrapper));
return productCategoryMapper.selectOne(wrapper);
// break;
}else if (role.getRoleKey().equals("productCategoryAdmin")){
list.clear();
// list.clear();
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code)
.eq(SchoolProductCategory::getAdminId,SecurityUtils.getLoginUser().getUser().getUserId());
list.add(productCategoryMapper.selectOne(wrapper));
if (list.size() <= 0){
throw new ServiceException("该设备不再您管辖范围内");
}
}
}
if (roles.size() <= 0){
if (user.isAdmin()){
list.clear();
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code);
list.add(productCategoryMapper.selectOne(wrapper));
return productCategoryMapper.selectOne(wrapper);
}
}
return list.get(0);
throw new ServiceException("该设备不再您管辖范围内");
}
}
......@@ -111,7 +111,8 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, SchoolReceive
String userName = sysUserMapper.selectUserById(schoolReceive.getReceivedById()).getUserName();
schoolReceive.setReceivedBy(userName);
}
if (schoolReceive.getReturnState().equals("1")){
if (StringUtils.isNotNull(schoolReceive.getReturnTime())){
schoolReceive.setReturnState("1");
SchoolEquipmentLedger schoolEquipmentLedger = new SchoolEquipmentLedger();
schoolEquipmentLedger.setId(schoolReceive.getEquipmentId());
schoolEquipmentLedger.setAffiliationType("2");
......
package yangtz.cs.liu.campus.service.impl.schoolInstrument;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import yangtz.cs.liu.campus.domain.schoolInstrument.SchoolInstrument;
import yangtz.cs.liu.campus.domain.schoolInstrument.SchoolInstrumentClassify;
import yangtz.cs.liu.campus.mapper.schoolInstrument.SchoolInstrumentClassifyMapper;
import yangtz.cs.liu.campus.mapper.schoolInstrument.SchoolInstrumentMapper;
import yangtz.cs.liu.campus.service.schoolInstrument.ISchoolInstrumentClassifyService;
import java.util.List;
......@@ -24,6 +28,8 @@ public class SchoolInstrumentClassifyServiceImpl extends ServiceImpl<SchoolInstr
@Autowired
private SchoolInstrumentClassifyMapper schoolInstrumentClassifyMapper;
@Autowired
private SchoolInstrumentMapper schoolInstrumentMapper;
/**
* 查询仪器药品分类
......@@ -118,6 +124,13 @@ public class SchoolInstrumentClassifyServiceImpl extends ServiceImpl<SchoolInstr
@Override
public int deleteSchoolInstrumentClassifyById(Long id)
{
//查询该分类下是否有仪器
LambdaQueryWrapper<SchoolInstrument> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolInstrument::getInstrumentTypeId,id);
List<SchoolInstrument> list = schoolInstrumentMapper.selectList(wrapper);
if (list.size() > 0){
throw new ServiceException("该分类下存在仪器,不可删除");
}
return schoolInstrumentClassifyMapper.deleteSchoolInstrumentClassifyById(id);
}
}
......@@ -322,7 +322,9 @@ public class SchoolExperimentPlanServiceImpl extends ServiceImpl<SchoolExperimen
default:break;
}
}
schoolExperimentPlanVo.setSubs(labSubs);
if (labSubs.size() > 0){
schoolExperimentPlanVo.setSubs(labSubs);
}
List<SchoolExperimentPlanVo> list = schoolExperimentPlanMapper.getExperimentList(schoolExperimentPlanVo);
list.forEach(list1 -> {
String semester = "";
......@@ -462,7 +464,9 @@ public class SchoolExperimentPlanServiceImpl extends ServiceImpl<SchoolExperimen
}
}
schoolExperimentPlanVo.setSubs(labSubs);
if (labSubs.size() > 0){
schoolExperimentPlanVo.setSubs(labSubs);
}
List<Map<String, Object>> list = schoolExperimentPlanMapper.countExperiment(schoolExperimentPlanVo);
list.forEach(list1 -> {
//总班级数
......
......@@ -275,7 +275,9 @@ public class SchoolLabClassYearServiceImpl extends ServiceImpl<SchoolLabClassYea
default:break;
}
}
schoolLabClassYearVo.setSubs(labSubs);
if (labSubs.size() > 0){
schoolLabClassYearVo.setSubs(labSubs);
}
List<SchoolLabClassYearVo> labClassYear = schoolLabClassYearMapper.getLabClassYear(schoolLabClassYearVo);
labClassYear.forEach(list1 -> {
String semester = "";
......
......@@ -88,7 +88,9 @@ public class SchoolLabServiceImpl extends ServiceImpl<SchoolLabMapper,SchoolLab>
default:break;
}
}
schoolLabVo.setLabSubs(labSubs);
if (labSubs.size() > 0){
schoolLabVo.setLabSubs(labSubs);
}
return schoolLabMapper.selectSchoolLabList(schoolLabVo);
}
......
......@@ -318,7 +318,9 @@ public class SchoolTeacherLabApplyServiceImpl extends ServiceImpl<SchoolTeacherL
default:break;
}
}
schoolTeacherLabApplyVo.setSubs(subs);
if (subs.size() > 0){
schoolTeacherLabApplyVo.setSubs(subs);
}
List<SchoolTeacherLabApplyVo> schoolTeacherLabApplyVos = schoolTeacherLabApplyMapper.selectSchoolTeacherLabApplyList(schoolTeacherLabApplyVo);
for (SchoolTeacherLabApplyVo teacherLabApplyVo : schoolTeacherLabApplyVos) {
LambdaQueryWrapper<SchoolAccessory> wrapper = new LambdaQueryWrapper<>();
......
......@@ -72,6 +72,18 @@ public class ISchoolGradeMentorImpl extends ServiceImpl<SchoolGradeMentorMapper,
return schoolGradeMentorMapper.getGradeLeader(gradeId,role,teacherVO);
}
/**
* (改造)获取级部主任
* @param deptId
* @param role
* @param teacherVO
* @return
*/
@Override
public List<SchoolTeacher> getGradeDirector(Long deptId, String role, SchoolTeacherVO teacherVO) {
return schoolGradeMentorMapper.getGradeDirector(deptId,role,teacherVO);
}
@Override
public List<SchoolGrade> selectGradeList(Long userId) {
return schoolGradeMentorMapper.getGrades(userId);
......
......@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.core.utils.HolidayDateUtil;
import com.ruoyi.common.core.domain.entity.SchoolTeacher;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import lombok.var;
import org.activiti.engine.HistoryService;
......@@ -95,6 +97,9 @@ public class SchoolTeacherLeaveServiceImpl extends ServiceImpl<SchoolTeacherLeav
@Autowired
private TaskService taskService;
@Autowired
private ISysDeptService deptService;
//请假状态为通过
public static final String PASS = "0";
......@@ -412,13 +417,32 @@ public class SchoolTeacherLeaveServiceImpl extends ServiceImpl<SchoolTeacherLeav
*/
@Override
public List<SchoolTeacher> getLeader(Long applyOrgid, String employeeType, SchoolTeacherVO teacherVO) {
//判断用户所有部门是属于级部还是科室
SysDept sysDept = deptService.selectDeptById(applyOrgid);
String ancestors = sysDept.getAncestors();
//查询级部
List<SysDept> sysDepts = deptService.selectGrade(new SysDept());
if (sysDepts.size() > 0){
for (SysDept dept : sysDepts) {
if (ancestors.contains(dept.getDeptId().toString())){
employeeType = "0";
applyOrgid = dept.getDeptId();
break;
}
}
}
//如果是教工,则传过来的是级部id
if (employeeType.equals(TEACH)) {
List<SchoolTeacher> teacherList = gradeMentorService.getGradeLeader(applyOrgid, GRADELEADER, teacherVO);
List<SchoolTeacher> teacherList = gradeMentorService.getGradeDirector(applyOrgid, GRADELEADER, teacherVO);
return teacherList;
}
//职工,所处处室(部门)id
return schoolTeacherService.getSectionLeader(applyOrgid, SECTIONLEADER, teacherVO);
String[] split = ancestors.split(",");
if (split.length >= 4){
//获取第三级部门
applyOrgid = Long.parseLong(split[3]);
}
return schoolTeacherService.getSectionDirector(applyOrgid, SECTIONLEADER, teacherVO);
}
/**
......@@ -542,14 +566,18 @@ public class SchoolTeacherLeaveServiceImpl extends ServiceImpl<SchoolTeacherLeav
.set(SchoolTeacherLeave::getHandUserName1,schoolTeacherLeave.getHandUserName1())
.set(SchoolTeacherLeave::getState,schoolTeacherLeave.getState())
;
//判断这种情况,新增时教师类型是教工0,,后来修改为职工1,则课次需要从表里删除
// TODO 修改 判断这种情况,新增时教师类型是教工0,,后来修改为职工1,则课次、级部/处室主任需要从表里删除
if(EMPLOYEE.equals(schoolTeacherLeave.getApplyType())){
luw
.set(SchoolTeacherLeave::getStartSort,null)
.set(SchoolTeacherLeave::getEndSort,null)
.set(SchoolTeacherLeave::getHandUserId1,null)
.set(SchoolTeacherLeave::getHandUserName1,null)
;
schoolTeacherLeave.setStartSort(null);
schoolTeacherLeave.setEndSort(null);
schoolTeacherLeave.setHandUserId1(null);
schoolTeacherLeave.setHandUserName1(null);
}
double time = schoolTeacherLeave.getTotalTime();
//处理请假时长与分管领导、主要领导
......
......@@ -526,6 +526,12 @@ public class SchoolTeacherServiceImpl extends ServiceImpl<SchoolTeacherMapper, S
List<SysPost> sysPosts = postMapper.getPostsByUserId(userId);
schoolTeacherVO.setPostName(sysPosts.stream().map(SysPost::getPostName).collect(Collectors.joining(",")));
//查询任职部门信息
List<Long> deptList = deptMapper.selectDeptListByUserId(userId);
schoolTeacherVO.setDeptIds((Long[]) deptList.toArray(new Long[deptList.size()]));
List<SysDept> sysDepts = deptMapper.getDeptdByUserId(userId);
schoolTeacherVO.setDeptNames(sysDepts.stream().map(SysDept::getDeptName).collect(Collectors.joining(",")));
SysUser user = userService.selectUserById(userId);
schoolTeacherVO.setStatus(user.getStatus());
schoolTeacherVO.setDeptId(user.getDeptId());
......@@ -565,6 +571,12 @@ public class SchoolTeacherServiceImpl extends ServiceImpl<SchoolTeacherMapper, S
return schoolTeacherMapper.getSectionLeader(deptId, role,teacher);
}
//(改造)获取处室主任
@Override
public List<SchoolTeacher> getSectionDirector(Long deptId, String role, SchoolTeacherVO teacher) {
return schoolTeacherMapper.getSectionDirector(deptId, role,teacher);
}
@Override
public List<TeacherNameListVo> selectSchoolTeacherNameList() {
return schoolTeacherMapper.selectSchoolTeacherNameList();
......
......@@ -24,6 +24,9 @@ public interface ISchoolGradeMentorService extends IService<SchoolGradeMentor> {
List<SchoolTeacher> getGradeLeader(Long gradeId, String role, SchoolTeacherVO teacherVO);
//(改造)获取级部主任
List<SchoolTeacher> getGradeDirector(Long deptId, String role, SchoolTeacherVO teacherVO);
//获取用户所在级部列表
List<SchoolGrade> selectGrades(Long userId,int schoolYear);
List<SchoolGrade> selectGradeList(Long userId);
......
......@@ -135,6 +135,11 @@ public interface ISchoolTeacherService extends IService<SchoolTeacher> {
*/
List<SchoolTeacher> getSectionLeader(Long deptId, String role,SchoolTeacherVO teacher);
/**
* (改造)获取所在处室处室主任
*/
List<SchoolTeacher> getSectionDirector(Long deptId, String role,SchoolTeacherVO teacher);
List<SchoolTeacherVO> getTeachers(Long classId);
public boolean updatePic(Long userId, String avatar);
......
......@@ -15,10 +15,10 @@ public class CurriculaVariableVo {
/** 任务名称 */
private String taskName;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
/** 级部 */
private String grade;
......
......@@ -25,12 +25,12 @@ public class SchoolStudentVO {
/**身份证号**/
@Excel(name = "*身份证号",width = 25)
@NotBlank(message = "身份证号不能为空")
// @NotBlank(message = "身份证号不能为空")
private String idCard;
/**性别**/
@Excel(name = "学生性别",combo = {"男","女"},readConverterExp = "0=男,1=女")
@NotBlank(message = "学生性别不能为空")
// @NotBlank(message = "学生性别不能为空")
private String sex;
/**民族**/
......@@ -50,7 +50,7 @@ public class SchoolStudentVO {
private String nativePlace;
/**出生日期**/
@NotNull(message = "出生日期不能为空")
// @NotNull(message = "出生日期不能为空")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生日期", dateFormat = "yyyy-MM-dd",width = 25)
private Date birthday;
......
......@@ -29,14 +29,14 @@ public class SchoolTeacherVO extends OurBaseEntity {
* 性别
*/
@Excel(name = "性别")
@NotBlank(message = "性别不能为空")
// @NotBlank(message = "性别不能为空")
private String sex;
/**
* 身份证
*/
@Excel(name = "身份证")
@NotBlank(message = "身份证不能为空")
// @NotBlank(message = "身份证不能为空")
private String idCard;
/**
......@@ -58,6 +58,12 @@ public class SchoolTeacherVO extends OurBaseEntity {
/**岗位名称**/
private String postName;
/** 部门id */
private Long[] deptIds;
/** 部门名称 */
private String deptNames;
/**
* 生日
*/
......
......@@ -217,4 +217,13 @@
GROUP BY xk.id,xk.student_id,xk.curricula_id,xs.class_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject
</select>
</mapper>
\ No newline at end of file
<!--批量新增学生和选课关系-->
<insert id="batchInsertCurriculaStudent">
insert into curricula_student(student_id,curricula_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.studentId}, #{item.curriculaId})
</foreach>
</insert>
</mapper>
......@@ -80,6 +80,21 @@
order by st.id
</select>
<!--(改造)获取级部主任-->
<select id="getGradeDirector" resultType="SchoolTeacher">
SELECT st.id, st.teacher_name, st.teacher_tel, st.teacher_code, st.sex FROM school_teacher st
LEFT JOIN sys_user u ON u.user_id = st.id
LEFT JOIN sys_user_role sur ON sur.user_id = st.id
LEFT JOIN sys_role sr ON sr.role_id = sur.role_id
WHERE u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set( #{deptId}, ancestors ) ) AND sr.role_name = #{role} AND st.del_flag = '0'
AND sr.del_flag = '0'
<if test="entity.teacherName != null and entity.teacherName != ''">and st.teacher_name like concat('%', #{entity.teacherName},'%')
</if>
<if test="entity.teacherTel != null and entity.teacherTel != ''">and st.teacher_tel like concat('%', #{entity.teacherTel}, '%')
</if>
order by st.id
</select>
<select id="getGradeByUserId" resultType="yangtz.cs.liu.campus.domain.schoolgrade.SchoolGrade">
select sg.id, sg.grade_value, sg.school_year, sg.grade_year, sg.grade_name, sg.sfzxxn, sg.remark from school_grade sg
left join school_grade_mentor sgm on sgm.grade_id = sg.id
......
......@@ -372,7 +372,7 @@
<if test="education != null and education != ''">and t.education = #{education}</if>
<if test="status != null and status != ''">and u.status = #{status}</if>
<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set( #{deptId}, ancestors ) )) or #{deptId} in (SELECT ud.dept_id FROM sys_user_dept ud WHERE ud.user_id = t.id)
</if>
</where>
order by t.id
......@@ -397,6 +397,25 @@
order by su.dept_id
</select>
<!--(改造)获取处室主任-->
<select id="getSectionDirector" resultType="com.ruoyi.common.core.domain.entity.SchoolTeacher">
SELECT st.id, st.teacher_name, st.teacher_tel, st.teacher_code, st.sex, st.dept_Id, st.dept_name, st.avatar FROM
( SELECT t.id, t.device_num, t.teacher_name, t.teacher_tel, t.teacher_code, t.id_card, t.home_address, t.nation, t.pic_url,
t.birthday, t.education, t.sex, u.dept_id, d.dept_name, u.STATUS, u.sign, u.avatar, u.user_id, u.employee_type FROM school_teacher t
LEFT JOIN sys_user u ON t.id = u.user_id
LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
WHERE t.del_flag = '0' AND u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set( #{deptId}, ancestors ) ) OR #{deptId} IN ( SELECT ud.dept_id FROM sys_user_dept ud WHERE ud.user_id = t.id )) st
LEFT JOIN sys_user_role ur ON ur.user_id = st.id
LEFT JOIN sys_role r ON r.role_id = ur.role_id
WHERE r.role_name = #{role} AND r.del_flag = '0'
<if test="entity.teacherName != null and entity.teacherName != ''">and st.teacher_name like concat('%', #{entity.teacherName},
'%')
</if>
<if test="entity.teacherTel != null and entity.teacherTel != ''">and st.teacher_tel like concat('%', #{entity.teacherTel}, '%')
</if>
order by st.dept_id
</select>
<select id="judge" resultType="yangtz.cs.liu.campus.vo.teacher.SchoolTeacherVO">
select t.id, t.teacher_name, t.teacher_code, u.dept_id, d.dept_name, u.employee_type
from school_teacher t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment