Commit 195221ab by Cat
parents dc8716ce 0e3c7e73
......@@ -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);
}
......@@ -121,4 +121,17 @@ public interface ISysDeptService
* @return 结果
*/
public int deleteDeptById(Long deptId);
/**
* 根据用户ID获取单位
*/
List<SysDept> getDeptdByUserId(Long userId);
/**
* 查询级部
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectGrade(SysDept dept);
}
......@@ -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>
......@@ -119,7 +119,7 @@ export default {
},
selectedRows: [], // 用于存储选择的行数据
//表格数据
tableData: [ ],
tableData: [],
nowType: 0, // 0新增、1编辑、2查看
title: '',
// 弹窗
......@@ -140,9 +140,9 @@ export default {
// 重新渲染表格状态
refreshTable: true,
rules: {
parentId: [
{ required: true, message: "上级分类不能为空", trigger: "blur" }
],
// parentId: [
// { required: true, message: "上级分类不能为空", trigger: "blur" }
// ],
instrumentTypeName: [
{ required: true, message: "仪器名称不能为空", trigger: "blur" }
],
......
......@@ -58,7 +58,7 @@
<el-col :span="20">
<el-form-item label="仪器分类" prop="instrumentTypeName">
<treeselect v-model="form.instrumentTypeName" :options="equiList" :normalizer="normalizer"
placeholder="选择" clearable style="width: 100%" noOptionsText="暂无数据"/>
placeholder="选择" clearable style="width: 100%" noOptionsText="暂无数据" />
</el-form-item>
</el-col>
</el-row>
......@@ -399,6 +399,8 @@ export default {
},
// 仪器确定
submitparentForm: function () {
const useId = this.form.useId
this.form.useName = useId == '' ? '' : this.equiList.find(item => item.userId == useId).userName
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
......
......@@ -19,6 +19,7 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleOption(0)">新增</el-button>
</el-col>
</el-row>
<el-table border v-loading="loading" :data="competitionData" stripe>
<el-table-column fixed="left" label="序号" type="index" width="55" align="center" />
......@@ -36,14 +37,13 @@
<div>{{ selectDictLabel(dict.type.competition_level, row.competitionLevel) }}</div>
</template>
</el-table-column>
<el-table-column label="证书照片" align="center" prop="schoolAccessoryList">
<el-table-column label="证书照片" align="center">
<template slot-scope="scope">
<el-carousel :interval="4000" height="100px">
<el-carousel-item v-for="(item, index) in scope.row.schoolAccessoryList" :key="index">
<el-image style="width: 100px; height: 100px" :src="item.accessoryUrl"
:preview-src-list="[item.accessoryUrl]"></el-image>
</el-carousel-item>
</el-carousel>
<div>
<el-image v-for="(accessory, index) in scope.row.schoolAccessoryList" :key="index"
style="width: 100px; height: 100px" :src="accessory.accessoryUrl"
:preview-src-list="[accessory.accessoryUrl]"></el-image>
</div>
</template>
</el-table-column>
......@@ -60,6 +60,7 @@
</el-table>
<pagination ref="pageBlock" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 新增、编辑、查看弹窗 -->
<el-dialog title="详细信息" :visible.sync="dialogVisible" width="50%">
<el-form :model="form" ref="form" size="small" label-width="108px" :disabled="isEdit" :rules="rules">
......@@ -71,8 +72,8 @@
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="参赛老师" prop="teacherName">
<el-select v-model="form.teacherName" placeholder="请选择级部" clearable style="width: 100%;"
<el-form-item label="参赛老师" prop="teacherId">
<el-select v-model="form.teacherId" placeholder="请选择" clearable style="width: 100%;"
:disabled="nowType == 2 ? true : false">
<el-option v-for="(item, index) in teacherList" :key="index" :label="item.userName"
:value="item.userId"></el-option>
......@@ -120,12 +121,9 @@
<el-upload v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload"
:http-request="uploadImage">
<div v-if="form.schoolAccessoryList && form.schoolAccessoryList.length > 0">
<el-image v-for="(photo, index) in form.schoolAccessoryList" :key="index"
style="width: 100px; height: 100px; margin-right: 10px" :src="photo.accessoryUrl"
:preview-src-list="[photo.accessoryUrl]"></el-image>
</div>
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
<img v-for="item in form.schoolAccessoryList" :key="item.accessoryUrl" :src="item.accessoryUrl"
class="avatar" />
<i v-if="form.schoolAccessoryList.length === 0" class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
......@@ -157,12 +155,14 @@
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<el-dialog ref="previewDialog" title="预览图片" :visible.sync="previewDialogVisible">
<el-image style="width: 100%; max-height: 80vh; object-fit: contain" :src="previewImageUrl"
fit="contain"></el-image>
</el-dialog>
</div>
</template>
<script>
import {
addCompetition,
......@@ -189,14 +189,10 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
competitionType: "",
competitionName: "",
},
previewImageUrl: '',
//获取子组件传来的信息
pic: [],
// 图片路径
imageUrl: undefined,
isEdit: false,
nowType: 0, // 0新增、1修改、2查看
uploadLoading: false,
......@@ -238,13 +234,12 @@ export default {
competitionLevel: [
{ required: true, message: "比赛级别不能为空", trigger: "change" }
],
schoolAccessoryList: [
{ required: true, message: "证书照片不能为空", trigger: "change" }
],
// schoolAccessoryList: [
// { required: true, message: "证书照片不能为空", trigger: "change" }
// ],
competitionName: [
{ required: true, message: "比赛项目名称不能为空", trigger: "change" }
],
},
previewDialogVisible: false,
teacherList: [],
......@@ -271,19 +266,25 @@ export default {
},
//获取列表数据
getList() {
getCompetition(this.queryParams).then(response => {
this.competitionData = response.rows.map(item => {
item.previewUrls = item.schoolAccessoryList.map(accessory => accessory.accessoryUrl);
item.pictureUrl = item.schoolAccessoryList[0]?.accessoryUrl || ''; // 取第一个照片的URL或者为空字符串
return item;
});
getCompetition(this.queryForm).then(response => {
this.competitionData = response.rows;
console.log('response', response);
this.total = response.total;
this.loading = false;
this.competitionData.forEach(item => {
if (item.schoolAccessoryList) {
item.previewUrls = [item.schoolAccessoryList.map(accessory => accessory.accessoryUrl)];
item.pictureUrl = item.schoolAccessoryList.map(accessory => accessory.accessoryUrl);
} else {
item.previewUrls = [];
item.pictureUrl = [];
}
});
},
});
},
//获取图片信息
getSchoolInfoPic(val) {
this.pic = val
......@@ -293,10 +294,17 @@ export default {
this.imageUrl = undefined
},
// 上传成功回调
handleAvatarSuccess(res, file) {
this.imageUrl = res.data.url
this.commonUpload(file)
handleAvatarSuccess(response, file) {
// 处理上传成功的逻辑
const accessoryUrl = response.data.url; // 假设响应中包含了图片的访问URL
const accessoryName = file.name; // 获取上传文件的名称
this.form.schoolAccessoryList.push({
accessoryUrl: accessoryUrl,
accessoryName: accessoryName
});
},
// 上传前格式和图片大小限制
beforeAvatarUpload(file) {
const type = file.type === 'image/jpeg' || 'image/jpg' || 'image/webp' || 'image/png'
......@@ -312,30 +320,26 @@ export default {
// 上传图片
uploadImage(file) {
const fileData = file.file;
const formData = new FormData();
formData.append('file', fileData);
this.uploadLoading = true;
// Upload the file and add the uploaded file to the schoolAccessoryList
const fileData = file.file
const formData = new FormData()
formData.append('file', fileData)
this.uploadLoading = true
commonUpload(formData)
.then(response => {
this.uploadLoading = false;
this.$modal.msgSuccess('上传成功');
// Add the uploaded file to the schoolAccessoryList
this.form.schoolAccessoryList.push({
this.uploadLoading = false
this.$modal.msgSuccess('上传成功')
this.imageUrl = process.env.VUE_APP_BASE_API + response.url
// 添加以下代码将文件信息添加到 uploadedFiles 数组中
this.uploadedFiles.push({
accessoryUrl: process.env.VUE_APP_BASE_API + response.url,
accessoryName: fileData.name
});
})
})
.catch(error => {
this.uploadLoading = false;
});
this.uploadLoading = false
})
},
//重置
resetQuery() {
this.queryParams = {
......@@ -348,6 +352,7 @@ export default {
},
//删除
handleDelete(row) {
this.$modal.confirm('是否确认删除选中数据?').then(() => {
......@@ -368,7 +373,6 @@ export default {
//编辑 0新增 1编辑 2查看
handleOption(type, row) {
this.imageUrl = '';
this.form.schoolAccessoryList = [];
this.form = {
id: '',
schoolYear: '',
......@@ -385,26 +389,23 @@ export default {
}
this.nowType = type;
if (type != 0) {
const id = row.id;
const id = row.id
getCompetitionxq(id).then(response => {
if (response.code == 200) {
Object.keys(this.form).forEach(key => {
if (response.data[key]) {
this.$set(this.form, key, response.data[key]);
}
});
// Populate the schoolAccessoryList with multiple images
if (response.data.schoolAccessoryList && response.data.schoolAccessoryList.length > 0) {
this.form.schoolAccessoryList = response.data.schoolAccessoryList;
this.imageUrls = response.data.schoolAccessoryList.map(item => item.accessoryUrl); // 将所有证书照片的地址赋值给 imageUrls
}
})
}
});
})
}
this.dialogVisible = true;
},
//查询老师
getTeacher() {
getTeacher().then(response => {
......@@ -415,11 +416,13 @@ export default {
},
/** 提交按钮 */
submitForm: function () {
const teacherId = this.form.teacherId
this.form.teacherName = teacherId == '' ? '' : this.teacherList.find(item => item.userId == teacherId).userName
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != "") {
// 清空原有图片
this.form.schoolAccessoryList = [];
this.form.schoolAccessoryList.splice(0);
for (let i = 0; i < this.uploadedFiles.length; i++) {
const file = this.uploadedFiles[i];
this.form.schoolAccessoryList.push({
......@@ -427,6 +430,7 @@ export default {
accessoryName: file.accessoryName
});
}
updateCompetition(this.form).then(({ code }) => {
if (code == 200) {
this.$modal.msgSuccess('修改成功')
......@@ -449,6 +453,7 @@ export default {
}
addCompetition(this.form).then(response => {
console.log(this.form, 'this.form');
this.$modal.msgSuccess('新增成功')
this.dialogVisible = false
this.getList()
......@@ -461,6 +466,7 @@ export default {
},
cancel() {
this.dialogVisible = false;
},
......
......@@ -502,14 +502,13 @@ export default {
this.reset();
this.$set(this.form, 'teacherName', this.$store.state.user.name);
const id = row.id || this.ids;
this.formReady();
// this.formReady();
getTeacherLeave(id).then(response => {
this.form = response.data;
if (this.form.applyType == 0) {
this.form.startTime = this.getFormatDate(this.form.startTime)
this.form.endTime = this.getFormatDate(this.form.endTime)
}
this.dialogTeacherLeave = true;
this.dialogTitle = "修改教师请假信息";
});
......@@ -717,7 +716,6 @@ export default {
},
/** 【已提交】查看详情 */
handleDetail(row) {
this.form = row
this.progress.open = true;
},
......
......@@ -166,11 +166,17 @@
</el-col>
<el-col :span="12">
<el-form-item label="是否允许借出:" prop="isAllowLend">
<el-select v-model="form.isAllowLend" clearable placeholder="请选择是否允许借出"
:disabled="nowOptionType == 2 ? true : false" class="selectWidth">
<el-select v-if="form.affiliationType === '3'" v-model="form.isAllowLend" clearable placeholder="请选择是否允许借出"
:disabled="true" class="selectWidth">
<el-option :key="'0'" :label="'否'" :value="'0'" />
</el-select>
<el-select v-else v-model="form.isAllowLend" clearable placeholder="请选择是否允许借出"
:disabled="isAllowLendDisabled || (nowOptionType == 2)" class="selectWidth">
<el-option v-for="dict in dict.type.is_lend" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
......@@ -370,7 +376,10 @@ export default {
useId: '',
useName: '',
remark: '',
affiliationType: '', // 其他属性
isAllowLend: '', // 其他属性
},
isAllowLendDisabled: false, // 默认禁用状态为false
rules: { // 表单校验
equipmentName: [
{ required: true, message: '请输入设备名称', trigger: 'blur' },
......@@ -397,6 +406,17 @@ export default {
userList: [] //使用人列表
};
},
watch: {
'form.affiliationType'(newVal) {
if (newVal === '3') {
this.form.isAllowLend = '0'; // 固定为0
this.isAllowLendDisabled = true; // 禁用状态为true
} else {
this.isAllowLendDisabled = false; // 禁用状态为false
}
},
},
created() {
this.getClassificationCodeTree()
this.getList()
......@@ -624,7 +644,7 @@ export default {
//点击批量打印跳转
printBarcodes() {
const baseUrl = window.location.origin +'/printBarcodes';
const baseUrl = window.location.origin + '/printBarcodes';
console.log(baseUrl, 'baseUrl');
this.printList = this.chooseList;
console.log(11, this.printList);
......
......@@ -15,7 +15,7 @@
</el-form-item>
<el-form-item label="处理状态" prop="disposeState">
<el-select v-model="queryParams.disposeState" placeholder="维修状态" clearable>
<el-option v-for="(item, index) in dict.type.repair_state" :key="index" :label="item.label"
<el-option v-for="(item, index) in dict.type.dispose_state" :key="index" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
......@@ -43,12 +43,12 @@
<el-table-column align="center" prop="repairTime" label="修理时间" width="160px" />
<el-table-column align="center" prop="repairState" label="修理结果">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.dispose_state, row.repairState) }}</div>
<div>{{ selectDictLabel(dict.type.repair_state, row.repairState) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="disposeState" label="处理状态">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.repair_state, row.disposeState) }}</div>
<div>{{ selectDictLabel(dict.type.dispose_state, row.disposeState) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="evaluate" label="评价" width="150px">
......@@ -145,10 +145,19 @@
<el-form-item label="处理状态" prop="disposeState">
<el-select v-model="postForm.disposeState" placeholder="处理状态" clearable style="width: 100%;"
:disabled="nowType == 2 ? true : false">
<el-option v-for="(item, index) in dict.type.dispose_state" :key="index" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<!-- 根据处理状态为1显示repairState下拉框 -->
<el-form-item v-if="postForm.disposeState === '1'" label="维修状态" prop="repairState">
<el-select v-model="postForm.repairState" placeholder="维修状态" clearable style="width: 100%;">
<el-option v-for="(item, index) in dict.type.repair_state" :key="index" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
......@@ -260,7 +269,9 @@ export default {
reportRepairTime: "",
model: null,
place: null,
dateOfProduction: null
dateOfProduction: null,
disposeState: '', // 处理状态
repairState: '' // 维修状态
},
//报修人列表
......@@ -292,6 +303,14 @@ export default {
}
},
watch: {
'postForm.disposeState'(newVal) {
if (newVal === 0) {
this.postForm.repairState = ''; // 将repairState重置为空
}
}
},
created() {
this.getList();
......@@ -432,14 +451,6 @@ export default {
this.$refs["postForm"].validate(valid => {
if (valid) {
if (this.nowType == 1) { // 修改操作
if (this.postForm.disposeState === "1" || this.postForm.disposeState === "0") {
this.postForm.repairState = "1";
} else if (this.postForm.disposeState === null) {
this.postForm.repairState = "0";
} else {
this.postForm.repairState = "0"; // 当 disposeState 不满足上述条件时,默认设置为 0
}
if (this.postForm.id != null) {
editRepair(this.postForm)
.then(response => {
......@@ -453,14 +464,6 @@ export default {
});
}
} else if (this.nowType == 0) { // 新增操作
if (this.postForm.disposeState === "1" || this.postForm.disposeState === "0") {
this.postForm.repairState = "1";
} else if (this.postForm.disposeState === null) {
this.postForm.repairState = "0";
} else {
this.postForm.repairState = "0"; // 当 disposeState 不满足上述条件时,默认设置为 0
}
addRepair(this.postForm)
.then(response => {
console.log('this.postForm', this.postForm);
......
......@@ -3,12 +3,10 @@
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="queryParams.idCard" placeholder="请输入学生身份证" clearable
@keyup.enter.native="handleQuery"/>
<el-input v-model="queryParams.idCard" placeholder="请输入学生身份证" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="姓名" prop="studentName">
<el-input v-model="queryParams.studentName" placeholder="请输入姓名" clearable
@keyup.enter.native="handleQuery"/>
<el-input v-model="queryParams.studentName" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
......@@ -61,20 +59,20 @@
</el-row>
<el-table v-loading="loading" :data="turnoverList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="姓名" align="center" prop="studentName" minWidth="100"/>
<el-table-column label="性别" align="center" minWidth="55" prop="sex">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="姓名" align="center" prop="studentName" minWidth="100" />
<!-- <el-table-column label="性别" align="center" minWidth="55" prop="sex">
<template slot-scope="scope">
<div v-if="scope.row.sex == 0"></div>
<div v-if="scope.row.sex == 1"></div>
<div v-if="scope.row.sex == 1"></div> -->
<!-- <el-select v-model="scope.row.sex" disabled filterable remote >
<el-option style="margin-left:5px " v-for="item in sex" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select> -->
</template>
</el-table-column>
<el-table-column label="学生身份证" minWidth="160" align="center" prop="idCard"/>
<el-table-column label="全国学籍号" minWidth="120" align="center" prop="nationalNumber"/>
<!-- </template> -->
<!-- </el-table-column> -->
<!-- <el-table-column label="学生身份证" minWidth="160" align="center" prop="idCard" /> -->
<el-table-column label="全国学籍号" minWidth="120" align="center" prop="nationalNumber" />
<el-table-column label="变更类型" minWidth="80" align="center" prop="changeType">
<template slot-scope="scope">
<dict-tag :options="dict.type.change_type" :value="scope.row.changeType"></dict-tag>
......@@ -121,7 +119,7 @@
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
@pagination="getList" />
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body inline @close="cancel">
......@@ -146,78 +144,76 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="学生身份证" prop="idCard" style="width: 340px;">
<!-- <el-col :span="12"> -->
<!-- <el-form-item label="学生身份证" prop="idCard" style="width: 340px;">
<el-input v-model="form.idCard" placeholder="请输入学生身份证" @change="searchInfo"/>
</el-form-item> -->
<!-- </el-col> -->
<el-col :span="12">
<el-form-item label="学生姓名" prop="studentName" style="width: 340px;">
<el-input v-model="form.studentName" placeholder="请选择学生" readonly @focus="selectStudent" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="姓名" prop="studentName" style="width:340px;">
<el-input v-model="form.studentName" placeholder="请输入姓名"/>
<el-form-item label="监护人关系" prop="relationship">
<!-- <el-input v-model="form.relationship" placeholder="请输入监护人关系" /> -->
<el-select v-model="form.relationship" placeholder="请选择监护人关系" @change="searchRelationship">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<!-- <el-row> -->
<!-- <el-col :span="12"> -->
<!-- <el-form-item label="性别" prop="sex"> -->
<!-- <el-input v-model="form.isSave" placeholder="请输入是否保留" /> -->
<el-select v-model="form.sex" placeholder="请选择性别">
<!-- <el-select v-model="form.sex" placeholder="请选择性别">
<el-option v-for="item in sex" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
</el-form-item> -->
<!-- </el-col> -->
<!-- <el-col :span="12">
<el-form-item label="出生年月" prop="birthday">
<el-date-picker clearable v-model="form.birthday" type="date" value-format="yyyy-MM-dd"
placeholder="请选择出生年月">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-col> -->
<!-- </el-row> -->
<el-row>
<el-col :span="12">
<el-form-item label="监护人关系" prop="relationship">
<!-- <el-input v-model="form.relationship" placeholder="请输入监护人关系" /> -->
<el-select v-model="form.relationship" placeholder="请选择监护人关系" @change="searchRelationship">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="家长姓名" prop="parentName" style="width: 340px;">
<el-input v-model="form.parentName" placeholder="请输入家长姓名"/>
<el-input v-model="form.parentName" placeholder="请输入家长姓名" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="年级班级" prop="classAlias" style="width: 340px;">
<el-input v-model="form.classAlias" placeholder="请输入年级班级" @focus="selectClass"/>
<el-input v-model="form.classAlias" placeholder="请输入年级班级" @focus="selectClass" />
<!-- <el-cascader v-model="value" :options="classTree" clearable @change="handleChange" ></el-cascader> -->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="全国学籍号" prop="nationalNumber" style="width: 340px;">
<el-input v-model="form.nationalNumber" placeholder="请输入全国学籍号"/>
<el-input v-model="form.nationalNumber" placeholder="请输入全国学籍号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="住址" prop="homeAddress" style="width: 340px;">
<el-input v-model="form.homeAddress" placeholder="请输入住址"/>
<el-input v-model="form.homeAddress" placeholder="请输入住址" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="联系电话" prop="telephone" style="width: 340px;">
<el-input v-model="form.telephone" placeholder="请输入联系电话"/>
<el-input v-model="form.telephone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否保留" prop="isSave">
<!-- <el-input v-model="form.isSave" placeholder="请输入是否保留" /> -->
......@@ -227,9 +223,12 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="转出(入)学校" prop="turnSchool" style="width: 340px;">
<el-input v-model="form.turnSchool" placeholder="请输入转出(入)学校"/>
<el-input v-model="form.turnSchool" placeholder="请输入转出(入)学校" />
</el-form-item>
</el-col>
</el-row>
......@@ -265,12 +264,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="学生身份证" prop="idCard" style="width: 340px;">
<el-input v-model="form.idCard" placeholder="请输入学生身份证" @change="searchInfo" readonly/>
<el-input v-model="form.idCard" placeholder="请输入学生身份证" @change="searchInfo" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="姓名" prop="studentName" style="width:340px;">
<el-input v-model="form.studentName" placeholder="请输入姓名" readonly/>
<el-input v-model="form.studentName" placeholder="请输入姓名" readonly />
</el-form-item>
</el-col>
</el-row>
......@@ -296,8 +295,7 @@
<el-col :span="12">
<el-form-item label="监护人关系" prop="relationship">
<!-- <el-input v-model="form.relationship" placeholder="请输入监护人关系" /> -->
<el-select v-model="form.relationship" placeholder="请选择监护人关系" @change="searchRelationship"
disabled>
<el-select v-model="form.relationship" placeholder="请选择监护人关系" @change="searchRelationship" disabled>
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
......@@ -305,20 +303,20 @@
</el-col>
<el-col :span="12">
<el-form-item label="家长姓名" prop="parentName" style="width: 340px;">
<el-input v-model="form.parentName" placeholder="请输入家长姓名" readonly/>
<el-input v-model="form.parentName" placeholder="请输入家长姓名" readonly />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="年级班级" prop="classAlias" style="width: 340px;">
<el-input v-model="form.classAlias" placeholder="请输入年级班级" readonly/>
<el-input v-model="form.classAlias" placeholder="请输入年级班级" readonly />
<!-- <el-cascader v-model="value" :options="classTree" clearable @change="handleChange" ></el-cascader> -->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="全国学籍号" prop="nationalNumber" style="width: 340px;">
<el-input v-model="form.nationalNumber" placeholder="请输入全国学籍号" readonly/>
<el-input v-model="form.nationalNumber" placeholder="请输入全国学籍号" readonly />
</el-form-item>
</el-col>
</el-row>
......@@ -326,12 +324,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="住址" prop="homeAddress" style="width: 340px;">
<el-input v-model="form.homeAddress" placeholder="请输入住址" readonly/>
<el-input v-model="form.homeAddress" placeholder="请输入住址" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="telephone" style="width: 340px;">
<el-input v-model="form.telephone" placeholder="请输入联系电话" readonly/>
<el-input v-model="form.telephone" placeholder="请输入联系电话" readonly />
</el-form-item>
</el-col>
</el-row>
......@@ -347,7 +345,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="转出(入)学校" prop="turnSchool" style="width: 340px;">
<el-input v-model="form.turnSchool" placeholder="请输入转出(入)学校" readonly/>
<el-input v-model="form.turnSchool" placeholder="请输入转出(入)学校" readonly />
</el-form-item>
</el-col>
</el-row>
......@@ -367,9 +365,8 @@
<el-form ref="finishedForm" :model="form" :rules="finishedRules" label-width="70px">
<el-form-item v-if="this.title == '办结'" label="附 件:" prop="dataUrl">
<el-upload class="upload-demo" drag ref="upload" action="#" :before-remove="beforeRemove" multiple :limit="1"
accept="image/jpg,image/jpeg,image/png"
:on-exceed="handleExceed" :on-remove="uploadRemove" :before-upload="beforeUpload"
:http-request="uploadFile">
accept="image/jpg,image/jpeg,image/png" :on-exceed="handleExceed" :on-remove="uploadRemove"
:before-upload="beforeUpload" :http-request="uploadFile">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</el-upload>
......@@ -383,11 +380,17 @@
<!-- 选择班级 -->
<ClassSelect v-if="classOptions.open" :openSelect.sync="classOptions.open" :title="classOptions.title"
@getClassList="getClassList" @setClassInfo="setClassInfo"></ClassSelect>
<!-- 选择学生 -->
<StudentInfoSelect v-if="studentOptions.open" :openSelect.sync="studentOptions.open" :title="studentOptions.title"
@getStudentList="getStudentList" @setStudentInfo="setStudentInfo"></StudentInfoSelect>
</div>
</template>
<script>
import {
listStudent,
} from "@/api/smartSchool/teachAffairAdministration/stuEssentialInfAlert/index.js";
import {
listTurnover,
getTurnover,
delTurnover,
......@@ -400,13 +403,14 @@ import {
getRelationship,
} from "@/api/smartSchool/teachAffairAdministration/alterManage/index.js";
import ClassSelect from '@/views/smartSchool/teachAffairAdministration/alterManage/components/classSelect'
import {getClassList} from '@/api/smartSchool/classManage'
import { getClassList } from '@/api/smartSchool/classManage'
import StudentInfoSelect from '@/views/components/moduleComponets/studentInfoSelect/index';
export default {
name: "alterManage",
dicts: ["change_status", "change_type", "grade_type", "Grade"],
components: {
ClassSelect
ClassSelect,
StudentInfoSelect
},
data() {
return {
......@@ -458,6 +462,11 @@ export default {
open: false,
title: '选择班级'
},
// 选择学生对话框
studentOptions: {
open: false,
title: '选择学生'
},
// 行信息
rowData: {},
// 表单参数
......@@ -465,49 +474,49 @@ export default {
// 表单校验
rules: {
studentName: [
{required: true, message: "学生姓名不能为空", trigger: "blur"}
],
idCard: [
{required: true, message: "身份证不能为空", trigger: "blur"}
{ required: true, message: "学生姓名不能为空", trigger: "blur" }
],
// idCard: [
// { required: true, message: "身份证不能为空", trigger: "blur" }
// ],
applyTime: [
{required: true, message: "申请时间不能为空", trigger: "blur"}
{ required: true, message: "申请时间不能为空", trigger: "blur" }
],
changeType: [
{required: true, message: "申请时间不能为空", trigger: "change"}
],
sex: [
{required: true, message: "性别不能为空", trigger: "change"}
],
birthday: [
{required: true, message: "出生日期不能为空", trigger: "change"}
{ required: true, message: "申请时间不能为空", trigger: "change" }
],
// sex: [
// { required: true, message: "性别不能为空", trigger: "change" }
// ],
// birthday: [
// { required: true, message: "出生日期不能为空", trigger: "change" }
// ],
relationship: [
{required: true, message: "监护人关系不能为空", trigger: "change"}
{ required: true, message: "监护人关系不能为空", trigger: "change" }
],
parentName: [
{required: true, message: "家长姓名不能为空", trigger: "blur"}
{ required: true, message: "家长姓名不能为空", trigger: "blur" }
],
classAlias: [
{required: true, message: "年级班级不能为空", trigger: "change"}
],
nationalNumber: [
{required: true, message: "全国学籍号不能为空", trigger: "blur"}
],
homeAddress: [
{required: true, message: "住址不能为空", trigger: "blur"}
{ required: true, message: "年级班级不能为空", trigger: "change" }
],
// nationalNumber: [
// { required: true, message: "全国学籍号不能为空", trigger: "blur" }
// ],
// homeAddress: [
// { required: true, message: "住址不能为空", trigger: "blur" }
// ],
telephone: [
{required: true, message: "联系电话不能为空", trigger: "blur"}
{ required: true, message: "联系电话不能为空", trigger: "blur" }
],
isSave: [
{required: true, message: "请选择是否保留", trigger: "change"}
{ required: true, message: "请选择是否保留", trigger: "change" }
],
turnSchool: [
{required: true, message: "转出入学校不能为空", trigger: "blur"}
{ required: true, message: "转出入学校不能为空", trigger: "blur" }
],
dataUrl: [
{required: true, message: "请上传附件", trigger: "change"}
{ required: true, message: "请上传附件", trigger: "change" }
],
},
finishedRules: {
......@@ -565,6 +574,28 @@ export default {
this.loading = false;
});
},
// 选择学生
selectStudent() {
this.studentOptions.open = true;
},
/** 获取学生信息列表 */
getStudentList(queryForm, callback) {
listStudent({ ...queryForm, gradeId: this.gradeId }).then(response => {
callback(response.rows, response.total);
}).catch(error => {
callback([], 0);
})
},
/** 设置学生信息 */
setStudentInfo(item) {
this.$set(this.form, 'studentName', item.studentName);
this.$set(this.form, 'idCard', item.idCard);
this.$set(this.form, 'studentId', item.id);
this.$set(this.form, 'nation', item.nation);
this.$set(this.form, 'newIdCard', item.idCard);
this.$set(this.form, 'newNation', item.nation);
this.$set(this.form, 'newStudentName', item.studentName);
},
// 取消按钮
cancel() {
this.open = false;
......
......@@ -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;
}
}
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);
}
return AjaxResult.success(gradeTreeSelectList);
}
//职工
return AjaxResult.success(deptService.selectDeptTreeList(new SysDept()));
if (!depts.contains(sysDept)){
depts.add(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());
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);
}
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);
return productCategoryMapper.getAdminGr(schoolProductCategory);
}
}
if (roles.size() <= 0){
if (user.isAdmin()){
list = productCategoryMapper.getAdmin(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("该设备不再您管辖范围内");
}
return productCategoryMapper.selectOne(wrapper);
}
}
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 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;
}
}
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
}
}
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;
}
}
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;
}
}
if (labSubs.size() > 0){
schoolLabVo.setLabSubs(labSubs);
}
return schoolLabMapper.selectSchoolLabList(schoolLabVo);
}
......
......@@ -318,7 +318,9 @@ public class SchoolTeacherLabApplyServiceImpl extends ServiceImpl<SchoolTeacherL
default:break;
}
}
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;
/**
* 生日
*/
......
......@@ -85,31 +85,45 @@ public class DdUserServiceImpl implements IDdUserService {
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//拿取钉钉用户部门id列表的第一个存在的部门id存到用户表中
//部门列表
List<Long> deptIdList = ddUser.getDeptIdList();
//用户部门列表
List<Long> ddUserDepts = new ArrayList<>();
//用户部门列表(用于判断是否是级部成员)
List<Long> ddUserDepts1 = new ArrayList<>();
for (Long ddUserDeptId : deptIdList) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
//用户表数据
SysDdUser sysDdUser = new SysDdUser();
//设置主部门和任职部门
if (deptPositionList.size()>0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (StringUtils.isNotNull(deptPosition.getIsMain())){
if (deptPosition.getIsMain()){
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
ddUserDepts1.add(dept.getDeptId());
}
}else {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
ddUserDepts1.add(dept1.getDeptId());
}
}
//用户表数据
SysDdUser sysDdUser = new SysDdUser();
sysDdUser.setDdUserDepts(ddUserDepts);
//根据钉钉部门id查询部门信息
for (Long ddDeptId : deptIdList) {
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(ddDeptId);
}else {
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
break;
ddUserDepts.add(dept.getDeptId());
ddUserDepts1.add(dept.getDeptId());
}
}
}
}
if (StringUtils.isNull(sysDdUser.getDeptId())){
sysDdUser.setDeptId(ddUserDepts.get(0));
ddUserDepts.remove(ddUserDepts.get(0));
}
sysDdUser.setDdUserDepts(ddUserDepts);
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPassword(SecurityUtils.encryptPassword("Ez2023@345"));
sysDdUser.setUserName(ddUser.getName());
......@@ -146,7 +160,7 @@ public class DdUserServiceImpl implements IDdUserService {
ddTeacherMapper.addTeacherList(sysDdTeacher);
//判断用户是否为级部成员
for (Long deptId : ddUserDepts) {
for (Long deptId : ddUserDepts1) {
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(deptId);
//判断是否是年级部成员
......@@ -163,10 +177,15 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -193,10 +212,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -283,30 +306,41 @@ public class DdUserServiceImpl implements IDdUserService {
for (OapiV2UserGetResponse.UserGetResponse ddUser : ddUserAll) {
if (ddUserId.equals(ddUser.getUserid())){
//拿取钉钉用户部门id列表的第一个存在的部门id存到用户表中
//部门列表
List<Long> deptIdList = ddUser.getDeptIdList();
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//用户部门列表
List<Long> ddUserDepts = new ArrayList<>();
for (Long ddUserDeptId : deptIdList) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
}
}
//用户部门列表(用于判断是否是级部成员)
List<Long> ddUserDepts1 = new ArrayList<>();
//根据钉钉部门id查询部门信息
//新增用户到用户表
SysDdUser sysDdUser = new SysDdUser();
sysDdUser.setDdUserDepts(ddUserDepts);
//根据钉钉部门id查询部门信息
for (Long ddDeptId : deptIdList) {
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(ddDeptId);
//设置主部门和任职部门
if (deptPositionList.size()>0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getIsMain()){
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
break;
ddUserDepts1.add(dept.getDeptId());
}
}else {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
ddUserDepts1.add(dept1.getDeptId());
}
}
}
}
if (StringUtils.isNull(sysDdUser.getDeptId())){
sysDdUser.setDeptId(ddUserDepts1.get(0));
ddUserDepts.remove(ddUserDepts1.get(0));
}
sysDdUser.setDdUserDepts(ddUserDepts);
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPassword(SecurityUtils.encryptPassword("Ez2023@345"));
sysDdUser.setUserName(ddUser.getName());
......@@ -349,11 +383,8 @@ public class DdUserServiceImpl implements IDdUserService {
sysDdTeacher.setCreateTime(DateUtils.getNowDate());
ddTeacherMapper.addTeacherList(sysDdTeacher);
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//判断用户是否是级部成员,如果是,新增到级部成员
for (Long deptId : ddUserDepts) {
for (Long deptId : ddUserDepts1) {
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(deptId);
//判断是否是年级部成员
......@@ -370,10 +401,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -400,10 +435,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -476,27 +515,46 @@ public class DdUserServiceImpl implements IDdUserService {
}
//更新的部门id列表
List<Long> deptIds = new ArrayList<>();
//更新的部门id列表(用于判断是否是级部成员)
List<Long> deptIds1 = new ArrayList<>();
//判断系统用户和钉钉用户部门是否发生改变
boolean isEqual = ddDeptIds.containsAll(deptIdList1) && deptIdList1.containsAll(ddDeptIds);
if (!isEqual) {
//发生改变更新用户信息
for (Long ddUserDeptId : deptIdList1) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
//设置主部门和任职部门
if (deptPositionList.size()>0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getIsMain()){
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
deptIds1.add(dept.getDeptId());
}
}else {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept1)){
deptIds.add(dept1.getDeptId());
deptIds1.add(dept1.getDeptId());
}
}
}
}
if (!deptIds1.contains(sysDdUser.getDeptId())){
sysDdUser.setDeptId(deptIds1.get(0));
deptIds.remove(deptIds1.get(0));
}
//删除原用户与部门关系
ddUserMapper.deleteDdUserDept(sysDdUser.getUserId());
//删除级部成员信息
ddUserMapper.deleteGradeMentor(sysDdUser.getUserId());
//新增用户和部门关系
sysDdUser.setDeptId(deptIds.get(0));
SysDdUserDept sysDdUserDept = new SysDdUserDept();
sysDdUserDept.setUserId(sysDdUser.getUserId());
for (Long ddUserDept : deptIds) {
sysDdUserDept.setDeptId(ddUserDept);
ddUserMapper.insertDdUserDept(sysDdUserDept);
}
for (Long ddUserDept : deptIds1){
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(ddUserDept);
//判断是否是年级部成员
......@@ -513,10 +571,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -543,10 +605,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -616,29 +682,39 @@ public class DdUserServiceImpl implements IDdUserService {
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//钉钉用户的钉钉部门id列表
List<Long> deptIdList = ddUser.getDeptIdList();
//用户系统部门id列表
List<Long> ddUserDepts = new ArrayList<>();
for (Long ddUserDeptId : deptIdList) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
}
}
//用户系统部门id列表(用于判断是否是级部成员)
List<Long> ddUserDepts1 = new ArrayList<>();
//用户表数据
SysDdUser sysDdUser = new SysDdUser();
sysDdUser.setDdUserDepts(ddUserDepts);
//根据钉钉部门id查询部门信息
for (Long ddDeptId : deptIdList) {
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(ddDeptId);
//设置主部门和任职部门
if (deptPositionList.size()>0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getIsMain()){
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
break;
ddUserDepts1.add(dept.getDeptId());
}
}else {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
ddUserDepts1.add(dept1.getDeptId());
}
}
}
}
if (StringUtils.isNull(sysDdUser.getDeptId())){
sysDdUser.setDeptId(ddUserDepts1.get(0));
ddUserDepts.remove(ddUserDepts1.get(0));
}
sysDdUser.setDdUserDepts(ddUserDepts);
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPassword(SecurityUtils.encryptPassword("Ez2023@345"));
sysDdUser.setUserName(ddUser.getName());
......@@ -680,7 +756,7 @@ public class DdUserServiceImpl implements IDdUserService {
ddTeacherMapper.addTeacherList(sysDdTeacher);
//判断用户是否是级部成员,如果是,新增到级部成员
for (Long deptId : ddUserDepts) {
for (Long deptId : ddUserDepts1) {
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(deptId);
//判断是否是年级部成员
......@@ -697,10 +773,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -727,10 +807,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -767,18 +851,41 @@ public class DdUserServiceImpl implements IDdUserService {
OapiV2UserGetResponse.UserGetResponse ddUser = dingUserUtils.getUser(userId);
//查询系统用户详情
SysDdUser sysDdUser = ddUserMapper.selectDdUserByDdUserId(userId);
if (StringUtils.isNull(sysDdUser)){
return 1;
}
//钉钉用户的钉钉部门id列表
List<Long> deptIdList = ddUser.getDeptIdList();
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//用户系统部门id列表
List<Long> ddUserDepts = new ArrayList<>();
for (Long ddUserDeptId : deptIdList) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
//用户系统部门id列表(用于判断是否是级部成员)
List<Long> ddUserDepts1 = new ArrayList<>();
//设置主部门和任职部门
if (deptPositionList.size()>0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getIsMain()){
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
ddUserDepts1.add(dept.getDeptId());
}
}else {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(deptPosition.getDeptId());
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
ddUserDepts1.add(dept1.getDeptId());
}
}
}
}
if (!ddUserDepts1.contains(sysDdUser.getDeptId())){
sysDdUser.setDeptId(ddUserDepts1.get(0));
ddUserDepts.remove(ddUserDepts1.get(0));
}
//删除原用户与部门关系
ddUserMapper.deleteDdUserDept(sysDdUser.getUserId());
//删除级部成员信息
......@@ -789,6 +896,8 @@ public class DdUserServiceImpl implements IDdUserService {
for (Long ddUserDept : ddUserDepts) {
sysDdUserDept.setDeptId(ddUserDept);
ddUserMapper.insertDdUserDept(sysDdUserDept);
}
for (Long ddUserDept : ddUserDepts1) {
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(ddUserDept);
......@@ -806,10 +915,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......@@ -836,10 +949,14 @@ public class DdUserServiceImpl implements IDdUserService {
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
if (deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
if (StringUtils.isNotEmpty(deptPosition.getTitle())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}else {
schoolGradeMentor.setTeacherPost(ddUser.getTitle());
}
}
}
}
......
......@@ -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>
<!--批量新增学生和选课关系-->
<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