Commit 1ccd7110 by Cat
parents 5222be6c c1696fe7
......@@ -12,7 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 部门表 sys_dept
*
*
* @author ruoyi
*/
public class SysDept extends BaseEntity
......@@ -32,7 +32,7 @@ public class SysDept extends BaseEntity
private String deptName;
/** 显示顺序 */
private Integer orderNum;
private Long orderNum;
/** 负责人 */
private String leader;
......@@ -51,7 +51,7 @@ public class SysDept extends BaseEntity
/** 父部门名称 */
private String parentName;
/** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>();
......@@ -98,12 +98,12 @@ public class SysDept extends BaseEntity
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
public Long getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
......
......@@ -116,6 +116,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/dd/user/login").permitAll()
.antMatchers( "/common/**").permitAll()
.antMatchers( "/dd/school/**").permitAll()
//打印下载接口放行
.antMatchers("/school/student/queryOne/**","/school/studentStatus/proofStatus/**").permitAll()
//网页注册登录接口放行
.antMatchers( "/web/artStudent/register","/web/artStudent/login").permitAll()
// 静态资源,可匿名访问
......
......@@ -33,4 +33,7 @@ npm run build:prod
在index页面,打开created中 this.csToken()
#生产环境
在index页面,打开created中 this.getCode()
Navbar.vue中的退出登录注销。
<!-- <el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item> -->
......@@ -15,6 +15,8 @@ const whiteList = [
"/register",
"/index",
"/dd",
"/studentRegistra",
"/printBarcodes",
];
router.beforeEach((to, from, next) => {
......
......@@ -62,6 +62,31 @@ export const constantRoutes = [
hidden: true,
},
{
path: "/studentRegistra",
component: () =>
import(
"@/views/smartSchool/teachAffairAdministration/affairStudentManage/studentRegistra"
),
hidden: true,
},
//设备台账
{
path: "/printBarcodes",
component: () =>
import(
"@/views/smartSchool/schoolProperty/equipmenTledger/printBarcodes"
),
hidden: true,
},
{
path: "/studentRegistra",
component: () =>
import(
"@/views/smartSchool/teachAffairAdministration/affairStudentManage/studentRegistra"
),
hidden: true,
},
{
path: "/register",
component: () => import("@/views/register"),
hidden: true,
......
......@@ -130,8 +130,8 @@
<script>
import { listDefinition, delDefinition, suspendOrActiveDefinition, convert2Model } from "@/api/activiti/definition.js"
import { format } from "@/utils/activiti/myUtil.js"
import { format } from "@/utils/activiti/myUtil.js"
export default {
name: "Definition",
data() {
......
......@@ -6,7 +6,7 @@
</el-form-item>
<el-form-item label="仪器分类">
<treeselect v-model="queryForm.instrumentTypeId" :options="equiList" :normalizer="normalizer"
placeholder="选择分类编码" clearable style="width: 192px" />
placeholder="选择分类编码" clearable style="width: 192px" noOptionsText="暂无数据" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
......@@ -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%" />
placeholder="选择" clearable style="width: 100%" noOptionsText="暂无数据"/>
</el-form-item>
</el-col>
</el-row>
......
......@@ -202,21 +202,33 @@ export default {
resetQuery() {
this.queryForm = {
pageNum: 1,
pageSize: 10,
curriculaId: "",
studentName: "",
classId: "",
selectedCourse: "",
pageNum: 1,
pageSize: 10
};
this.resetForm("queryForm");
this.getList();
},
// 重置
reset() {
this.postForm = {
curriculaId: '',
this.form = {
curriculaId: "",
course: "",
courseName: "",
coursePeopleNumber: "",
classesNumber: "",
peopleNumber: "",
divisionClassesRule: "",
divisionClassesFrequency: '1',
}
this.resetForm('postForm');
this.resetForm('form');
},
// 取消按钮
cancel() {
this.open = false;
......@@ -232,45 +244,32 @@ export default {
},
// 分班按钮
submitForm() {
// 检查是否已经分班
const alreadyDivided = this.selectedCourse.every(course => course.divisionClassesRule !== "");
console.log('this.selectedCourse', this.selectedCourse);
if (alreadyDivided) {
this.$message.warning("已经分班,无法重复操作");
return;
}
this.$confirm('确定要分班吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// let that = this;
// for (let i = 0; i < this.selectedCourse.length; i++) {
// that.selectedCourse[i].divisionClassesRule = that.form.divisionClassesRule;
// const course = this.selectedCourse[i];
// console.log('course.divisionClassesRule:', course.divisionClassesRule);
// console.log('course.classesNumber:', course.classesNumber);
// console.log('course.peopleNumber:', course.peopleNumber);
// if (course.divisionClassesRule === '' || course.classesNumber === '' || course.peopleNumber === '') {
// this.$message.error("分班规则、班级数量和每班人数不能为空");
// return;
// }
// let totalPeopleNumber = course.classesNumber * course.peopleNumber;
// if (totalPeopleNumber > this.selectedCourse.length) {
// this.$message.error("班级数量和每班人数相乘不能超过总人数");
// return;
// }
// }
// console.log('this.selectedCourse', this.selectedCourse);
addDivisionec(this.selectedCourse).then((response) => {
console.log('this.selectedCourse', this.selectedCourse);
this.$modal.msgSuccess("分班成功");
const formData = this.selectedCourse.map((course) => {
console.log(course);
return {
curriculaId: this.queryForm.curriculaId,
course: course.course,
classesNumber: course.classesNumber,
peopleNumber: course.peopleNumber,
coursePeopleNumber: course.peopleNumber,
divisionClassesRule: this.form.divisionClassesRule,
divisionClassesFrequency: course.divisionClassesFrequency
};
});
addDivisionec(formData).then((response) => {
console.log(response);
this.$modal.msgSuccess('分班成功');
this.open = false;
this.getList();
}).catch(error => {
console.error(error);
});
})
})
......
......@@ -49,8 +49,8 @@
<el-col :span="24">
<el-form-item label="分班规则" prop="divisionClassesRule">
<el-radio-group v-model="form.divisionClassesRule">
<el-radio label='1'>平行分班</el-radio>
<el-radio label='2'>分层分班</el-radio>
<el-radio label="1">平行分班</el-radio>
<el-radio label="2">分层分班</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
......@@ -63,9 +63,9 @@
<el-input v-model="course.peopleNumber" placeholder="每班人数"></el-input>
</div>
</el-form-item>
</div>
</el-form>
<div style="text-align: center">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
......@@ -88,15 +88,15 @@ export default {
dicts: ['section_type'],
data() {
return {
divisionClassesRule: '',
selectedCourse: [],
classList: [],
// 查询表单
queryForm: {
divisionClassesRule: '',
curriculaId: '',
studentsName: '',
classId: '',
selectedCourse: '',
curriculaId: "",
studentName: "",
classId: "",
selectedCourse: "",
pageNum: 1,
pageSize: 10
},
......@@ -188,12 +188,12 @@ export default {
coursePeopleNumber: item.peopleNumber,
classesNumber: '',
peopleNumber: '',
divisionClassesRule: '',
divisionClassesRule: "",
divisionClassesFrequency: '1'
}
});
// console.log('this.selectedCourse', this.selectedCourse);
console.log('this.selectedCourse', this.selectedCourse);
}
})
},
......@@ -202,7 +202,14 @@ export default {
resetQuery() {
this.queryForm = {
pageNum: 1,
pageSize: 10,
curriculaId: "",
studentName: "",
classId: "",
selectedCourse: "",
pageNum: 1,
pageSize: 10
};
this.resetForm("queryForm");
this.getList();
......@@ -210,10 +217,17 @@ export default {
// 重置
reset() {
this.postForm = {
curriculaId: '',
this.form = {
curriculaId: "",
course: "",
courseName: "",
coursePeopleNumber: "",
classesNumber: "",
peopleNumber: "",
divisionClassesRule: "",
divisionClassesFrequency: '1',
}
this.resetForm('postForm');
this.resetForm('form');
},
// 取消按钮
......@@ -230,47 +244,33 @@ export default {
},
// 分班按钮
submitForm() {
// 检查是否已经分班
const alreadyDivided = this.selectedCourse.every(course => course.divisionClassesRule !== "");
console.log('this.selectedCourse', this.selectedCourse);
if (alreadyDivided) {
this.$message.warning("已经分班,无法重复操作");
return;
}
this.$confirm('确定要分班吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// let that = this;
// for (let i = 0; i < this.selectedCourse.length; i++) {
// that.selectedCourse[i].divisionClassesRule = that.form.divisionClassesRule;
// const course = this.selectedCourse[i];
// console.log('course.divisionClassesRule:', course.divisionClassesRule);
// console.log('course.classesNumber:', course.classesNumber);
// console.log('course.peopleNumber:', course.peopleNumber);
// if (course.divisionClassesRule === '' || course.classesNumber === '' || course.peopleNumber === '') {
// this.$message.error("分班规则、班级数量和每班人数不能为空");
// return;
// }
// let totalPeopleNumber = course.classesNumber * course.peopleNumber;
// console.log('totalPeopleNumber', totalPeopleNumber);
// if (totalPeopleNumber > this.coursePeopleNumber) {
// console.log('this.coursePeopleNumber', this.coursePeopleNumber);
// this.$message.error("班级数量和每班人数相乘不能超过总人数");
// return;
// }
// }
// console.log('this.selectedCourse', this.selectedCourse);
addDivision(this.selectedCourse).then((response) => {
console.log('this.selectedCourse', this.selectedCourse);
this.$modal.msgSuccess("分班成功");
const formData = this.selectedCourse.map((course) => {
return {
curriculaId: this.queryForm.curriculaId,
course: course.course,
classesNumber: course.classesNumber,
peopleNumber: course.peopleNumber,
coursePeopleNumber: course.peopleNumber,
divisionClassesRule: this.form.divisionClassesRule,
divisionClassesFrequency: course.divisionClassesFrequency
};
});
addDivision(formData).then((response) => {
console.log(response);
this.$modal.msgSuccess('分班成功');
this.open = false;
this.getList();
}).catch(error => {
console.error(error);
});
})
})
......@@ -285,6 +285,8 @@ export default {
}
}
</script>
......
......@@ -72,8 +72,8 @@
<el-col :span="16">
<el-form-item label="发布时间">
<el-date-picker v-model="dateRange" type="daterange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss" :style="{ width: '100%' }">
start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" :style="{ width: '100%' }">
</el-date-picker>
</el-form-item>
</el-col>
......
......@@ -86,8 +86,6 @@
<el-option v-for="item in tableList" :key="item.id" :value="item.experimentName"
:label="item.experimentName"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
......@@ -267,7 +265,6 @@ export default {
},
methods: {
//表单查询
getList() {
getLabplanlist(this.queryForm).then(response => {
......@@ -289,10 +286,8 @@ export default {
//选择实验名称自动带出信息
getName() {
const selectedExperiment = this.tableList.find(experiment => experiment.experimentName === this.form.experimentName);
if (selectedExperiment) {
this.selectedExperiment = selectedExperiment; // 确保将选中的实验赋值给 selectedExperiment
// 将实验的字段赋值给表单字段
this.form.experimentPlanId = selectedExperiment.chapterContent?.id || "";
this.form.chapterContent = selectedExperiment.chapterContent || "";
......@@ -368,17 +363,20 @@ export default {
this.nowType = type;
this.getSchholyear();
if (type != 0) {
const id = row.id
getLabplanxq(id).then(response => {
if (response.code == 200) {
console.log(response);
Object.keys(this.form).forEach(key => {
if (response.data[key]) {
this.$set(this.form, key, response.data[key]);
}
})
}
})
if (row && row.id) {
const id = row.id;
getLabplanxq(id).then(response => {
if (response.code == 200) {
console.log(response);
Object.keys(this.form).forEach(key => {
if (response.data[key]) {
this.$set(this.form, key, response.data[key]);
}
});
}
});
}
}
this.dialogTableVisible = true;
},
......@@ -418,7 +416,7 @@ export default {
declareState: '0',
};
console.log(params);
addLabplan(params).then(response => {
this.$modal.msgSuccess('保存成功');
this.dialogTableVisible = false;
......
......@@ -8,7 +8,7 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="老师姓名" prop="teacherName">
<el-input readonly :value="infoForm.teacherName"/>
<el-input readonly :value="infoForm.teacherName" />
</el-form-item>
</el-col>
<el-col :span="12">
......@@ -23,7 +23,7 @@
<el-form-item label="请假类型">
<el-select readonly :value="infoForm.type" style="width: 100%" placeholder="">
<el-option v-for="dict in dict.type.biz_leave_type" :key="dict.value" :value="dict.value"
:label="dict.label"></el-option>
:label="dict.label"></el-option>
</el-select>
</el-form-item>
</el-col>
......@@ -32,14 +32,14 @@
<el-col :span="12">
<el-form-item label="请假开始时间" prop="startTime">
<el-date-picker readonly style="width: 100%" v-model="infoForm.startTime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择开始时间"></el-date-picker>
value-format="yyyy/MM/dd HH:mm:ss" placeholder="选择开始时间"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="请假结束时间" prop="endTime">
<el-date-picker readonly style="width: 100%" v-model="infoForm.endTime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择结束时间"></el-date-picker>
value-format="yyyy/MM/dd HH:mm:ss" placeholder="选择结束时间"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
......@@ -48,25 +48,25 @@
<el-col :span="7">
<el-form-item label="请假开始时间" prop="startTime">
<el-date-picker readonly v-model="infoForm.startTime" type="date" style="width: 100%"
value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4">
<el-select :value="infoForm.startSort" style="width: 100%" placeholder="请选择课程节次">
<el-option v-for="dict in dict.type.course_arrange" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
:value="dict.value"></el-option>
</el-select>
</el-col>
<el-col :offset="2" :span="7">
<el-form-item label="请假结束时间" prop="endTime">
<el-date-picker readonly type="date" v-model="infoForm.endTime" value-format="yyyy-MM-dd"
style="width: 100%" placeholder="选择日期"></el-date-picker>
style="width: 100%" placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4">
<el-select :value="infoForm.endSort" style="width: 100%" placeholder="请选择课程节次">
<el-option v-for="dict in dict.type.course_arrange" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
:value="dict.value"></el-option>
</el-select>
</el-col>
</el-row>
......@@ -74,7 +74,7 @@
<el-col>
<el-form-item label="请假原因">
<el-input readonly :value="infoForm.reasonForLeave" type="textarea" placeholder=""
:autosize="{ minRows: 3 }"/>
:autosize="{ minRows: 3 }" />
</el-form-item>
</el-col>
</el-row>
......@@ -82,15 +82,13 @@
<el-col :span="12">
<el-form-item label="实际开始时间" prop="realityStartTime">
<el-date-picker style="width: 100%" v-model="infoForm.realityStartTime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" placeholder=""
:picker-options="limitStartTime"></el-date-picker>
value-format="yyyy-MM-dd HH:mm:ss" placeholder="" :picker-options="limitStartTime"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实际结束时间" prop="realityEndTime">
<el-date-picker style="width: 100%" v-model="infoForm.realityEndTime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" placeholder=""
:picker-options="limitEndTime"></el-date-picker>
value-format="yyyy-MM-dd HH:mm:ss" placeholder="" :picker-options="limitEndTime"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
......@@ -100,7 +98,7 @@
</el-form>
</el-card>
<TaskResolve v-if="!$attrs.readOnly" :taskId="this.$attrs.taskId" :instanceId="instanceId" :id="id"
v-on="this.$listeners"></TaskResolve>
v-on="this.$listeners"></TaskResolve>
</div>
</template>
......@@ -156,8 +154,8 @@ export default {
limitStartTime,
infoForm: {},
rules: {
realityStartTime: [{required: true, message: '实际开始时间不能为空', trigger: 'change'}],
realityEndTime: [{required: true, message: '实际结束时间不能为空', trigger: 'change'}]
realityStartTime: [{ required: true, message: '实际开始时间不能为空', trigger: 'change' }],
realityEndTime: [{ required: true, message: '实际结束时间不能为空', trigger: 'change' }]
}
}
},
......
......@@ -5,7 +5,6 @@
:modal="false"
fullscreen
:modal-append-to-body="false"
>
<!-- <template slot="title">-->
<!-- <div class="custom-dialog__header">-->
......@@ -15,7 +14,6 @@
<!-- </div>-->
<!-- </div>-->
<!-- </template>-->
<div class="resolve-dialog-bady" >
<div class="left-menu">
<el-tabs tab-position="left" v-model="asyncComponent" @tab-click="selectMenu" style="height: 800px">
......@@ -40,8 +38,6 @@
</keep-alive>
</div>
</div>
</el-dialog>
</div>
</template>
......
......@@ -38,10 +38,15 @@
</el-table-column>
<el-table-column label="证书照片" align="center" prop="schoolAccessoryList">
<template slot-scope="scope">
<el-image style="width: 100px; height: 100px" :src="scope.row.pictureUrl"
:preview-src-list="scope.row.previewUrls"></el-image>
<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>
</template>
</el-table-column>
<el-table-column label="备注1" align="center" prop="remark1" />
<el-table-column label="备注2" align="center" prop="remark2" />
<el-table-column label="备注3" align="center" prop="remark3" />
......@@ -115,11 +120,15 @@
<el-upload v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload"
:http-request="uploadImage">
<img v-if="form.schoolAccessoryList && form.schoolAccessoryList.length > 0"
:src="form.schoolAccessoryList[0].accessoryUrl" class="avatar" />
<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>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="备注1">
......@@ -232,11 +241,13 @@ export default {
schoolAccessoryList: [
{ required: true, message: "证书照片不能为空", trigger: "change" }
],
competitionName: [
{ required: true, message: "比赛项目名称不能为空", trigger: "change" }
],
},
previewDialogVisible: false,
teacherList: [],
rules: {},
nowType: 0, // 0新增、1编辑、2查看
}
},
......@@ -301,27 +312,30 @@ export default {
// 上传图片
uploadImage(file) {
const fileData = file.file
const formData = new FormData()
formData.append('file', fileData)
this.uploadLoading = true
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
commonUpload(formData)
.then(response => {
this.uploadLoading = false
this.$modal.msgSuccess('上传成功')
this.imageUrl = process.env.VUE_APP_BASE_API + response.url
// 添加以下代码将文件信息添加到 uploadedFiles 数组中
this.uploadedFiles.push({
this.uploadLoading = false;
this.$modal.msgSuccess('上传成功');
// Add the uploaded file to the schoolAccessoryList
this.form.schoolAccessoryList.push({
accessoryUrl: process.env.VUE_APP_BASE_API + response.url,
accessoryName: fileData.name
})
});
})
.catch(error => {
this.uploadLoading = false
})
this.uploadLoading = false;
});
},
//重置
resetQuery() {
this.queryParams = {
......@@ -371,25 +385,26 @@ 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]);
}
if (response.data.schoolAccessoryList && response.data.schoolAccessoryList.length > 0) {
this.imageUrl = response.data.schoolAccessoryList[0].accessoryUrl; // 将图片地址赋值给 imageUrl
}
});
})
// Populate the schoolAccessoryList with multiple images
if (response.data.schoolAccessoryList && response.data.schoolAccessoryList.length > 0) {
this.form.schoolAccessoryList = response.data.schoolAccessoryList;
}
}
})
});
}
this.dialogVisible = true;
},
//查询老师
getTeacher() {
getTeacher().then(response => {
......@@ -412,7 +427,6 @@ export default {
accessoryName: file.accessoryName
});
}
updateCompetition(this.form).then(({ code }) => {
if (code == 200) {
this.$modal.msgSuccess('修改成功')
......
<template>
<div class="app-container">
<el-form
:model="queryForm"
ref="queryForm"
size="small"
:inline="true"
label-width="80px"
>
<el-form :model="queryForm" ref="queryForm" size="small" :inline="true" label-width="80px">
<el-form-item prop="name" label="社团名称">
<el-input v-model="queryForm.name" placeholder="社团名称"></el-input>
</el-form-item>
<el-form-item prop="teachers" label="指导教师">
<el-input
v-model="queryForm.teachers"
placeholder="指导教师"
></el-input>
<el-input v-model="queryForm.teachers" placeholder="指导教师"></el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd()"
>新增</el-button
>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd()">新增</el-button>
</el-col>
</el-row>
<!-- 列表 -->
<div class="listBlock">
<div class="itemBlock" v-for="(task, index) in tasks" :key="index">
<div
style="
<div style="
display: flex;
justify-content: space-between;
align-items: center;
"
>
">
<div style="width: 50%">
<!-- 任务详细信息 -->
<div class="task-info">
......@@ -77,49 +52,17 @@
<!-- 按钮 -->
<div class="task-buttons">
<el-button
style="margin-left: 10px"
size="mini"
type="danger"
round
@click="handleDelete(task)"
>删除
<el-button style="margin-left: 10px" size="mini" type="danger" round @click="handleDelete(task)">删除
</el-button>
<el-button
type="success"
size="small"
round
@click="clubRegistrationReview(task.id, task.teachers)"
>社团报名审核</el-button
>
<el-button
type="info"
size="small"
round
@click="clubActivityRecord(task.id)"
>社团活动记录</el-button
>
<el-button
type="warning"
size="small"
round
@click="memberManagement(task.id)"
>成员管理
<el-button type="success" size="small" round
@click="clubRegistrationReview(task.id, task.teachers)">社团报名审核</el-button>
<el-button type="info" size="small" round @click="clubActivityRecord(task.id)">社团活动记录</el-button>
<el-button type="warning" size="small" round @click="memberManagement(task.id)">成员管理
</el-button>
<el-button
class="purpleBtn"
size="small"
round
type="primary"
@click="communityStyle(task.id, task.teachers)"
>社团风采
<el-button class="purpleBtn" size="small" round type="primary"
@click="communityStyle(task.id, task.teachers)">社团风采
</el-button>
<el-button
type="primary"
size="small"
round
@click="basicInformation(task.id, task.teachers)"
>基础信息管理
<el-button type="primary" size="small" round @click="basicInformation(task.id, task.teachers)">基础信息管理
</el-button>
</div>
</div>
......@@ -129,45 +72,22 @@
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<div>
<el-form-item label="社团名称" prop="name">
<el-input
v-model="form.name"
placeholder="请输入社团名称"
></el-input>
<el-input v-model="form.name" placeholder="请输入社团名称"></el-input>
</el-form-item>
<el-form-item label="指导教师" prop="teachers">
<el-select
style="width: 100%"
multiple
v-model="form.teachers"
filterable
placeholder="请选择指导教师"
@change="changeTeacher"
>
<el-option
v-for="item in teacherInfo"
:key="item.teacherCode"
:label="item.teacherName"
:value="item.teacherCode"
>
<el-select style="width: 100%" multiple v-model="form.teachers" filterable placeholder="请选择指导教师"
@change="changeTeacher">
<el-option v-for="item in teacherInfo" :key="item.teacherCode" :label="item.teacherName"
:value="item.teacherCode">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="社团宗旨" prop="aim">
<el-input
type="textarea"
:rows="4"
v-model="form.aim"
placeholder="请输入社团宗旨"
></el-input>
<el-input type="textarea" :rows="4" v-model="form.aim" placeholder="请输入社团宗旨"></el-input>
</el-form-item>
<el-form-item label="社团简介" prop="intro">
<el-input
type="textarea"
:rows="4"
v-model="form.intro"
placeholder="请输入社团简介"
></el-input>
<el-input type="textarea" :rows="4" v-model="form.intro" placeholder="请输入社团简介"></el-input>
</el-form-item>
</div>
</el-form>
......@@ -368,7 +288,7 @@ export default {
this.$message.success("修改成功");
this.open = false;
})
.catch((err) => {});
.catch((err) => { });
} else {
// 新增
const params = {
......@@ -385,7 +305,7 @@ export default {
this.$message.success("新增成功");
this.open = false;
})
.catch((err) => {});
.catch((err) => { });
}
}
});
......@@ -403,7 +323,7 @@ export default {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
.catch(() => { });
},
// 重置表单
reset() {
......@@ -466,7 +386,7 @@ export default {
text-align: left;
}
.task-level > span {
.task-level>span {
margin-right: 25px;
}
......@@ -490,13 +410,13 @@ export default {
padding-left: 60%;
}
.task-count > .count {
.task-count>.count {
font-weight: bold;
color: #307def;
font-size: 45px;
}
.task-count > .sun {
.task-count>.sun {
color: rgba(16, 16, 16, 1);
font-size: 18px;
text-align: center;
......
<!--社团风采-->
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="标题" prop="theme">
<el-input
v-model="queryParams.theme"
placeholder="请输入标题"
clearable
/>
<el-input v-model="queryParams.theme" placeholder="请输入标题" clearable />
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除
</el-button>
</el-col>
</el-row>
<el-table
v-loading="loading"
ref="table"
:data="picList"
@selection-change="handleSelectionChange"
>
<el-table v-loading="loading" ref="table" :data="picList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" type="index" width="80" />
<el-table-column label="风采主题" align="center" prop="theme" />
......@@ -69,68 +34,32 @@
</el-table-column>
<el-table-column label="是否发布" align="center" prop="isfb">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
active-value="1"
inactive-value="0"
@change="handleIsShow(scope.row)"
></el-switch>
<el-switch v-model="scope.row.isShow" active-value="1" inactive-value="0"
@change="handleIsShow(scope.row)"></el-switch>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!-- 未发布可以修改删除 -->
<div>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除
</el-button>
</div>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleCheck(scope.row)"
>查看
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleCheck(scope.row)">查看
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改社团主题对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="90px"
style="width: 80%; margin: auto"
>
<el-form-item
prop="file"
style="
<el-form ref="form" :model="form" :rules="rules" label-width="90px" style="width: 80%; margin: auto">
<el-form-item prop="file" style="
display: flex;
text-align: center;
justify-content: center;
......@@ -159,12 +88,8 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="风采主题:" prop="theme">
<el-input
:readonly="check == true ? true : false"
v-model="form.theme"
placeholder="请输入风采主题"
style="width: 100%"
/>
<el-input :readonly="check == true ? true : false" v-model="form.theme" placeholder="请输入风采主题"
style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
......@@ -493,7 +418,7 @@ export default {
this.$message.success("修改成功");
this.open = false;
})
.catch((err) => {});
.catch((err) => { });
} else {
// 新增
const params = {
......@@ -508,7 +433,7 @@ export default {
this.$message.success("新增成功");
this.open = false;
})
.catch((err) => {});
.catch((err) => { });
}
}
});
......@@ -519,8 +444,7 @@ export default {
if (ids) {
this.$modal
.confirm(
`是否确认删除选中的${
Object.hasOwnProperty.call(ids, "length") ? ids.length : 1
`是否确认删除选中的${Object.hasOwnProperty.call(ids, "length") ? ids.length : 1
}条数据?`
)
.then(() => {
......@@ -552,7 +476,7 @@ export default {
isCommunityFb(data)
.then((response) => {
this.$modal.closeLoading();
this.$modal.msgSuccess("修改成功");
this.$message.success("修改成功");
})
.catch((error) => {
this.$modal.closeLoading();
......@@ -562,6 +486,7 @@ export default {
// 取消操作时的逻辑
});
},
},
};
</script>
......
......@@ -502,8 +502,11 @@ export default {
}
}
});
})
})();
},
// 反馈结果按钮
submitFormfk() {
this.$refs.formfk.validate((valid) => {
......
......@@ -138,7 +138,7 @@ export default {
this.getList();
},
//根据组id查询组成员
getList() {
getList() {
this.loading = true;
this.notificationId = this.$route.query.id;
console.log('this..notificationId', this.notificationId);
......@@ -188,7 +188,7 @@ export default {
/** 关闭 */
handleClose() {
this.$tab.closeOpenPage({
path: '/schoolManage/schoolInfoPush'
path: '/schoolManage/schoolNotice/school'
});
},
......
......@@ -6,7 +6,6 @@
<el-tab-pane label="停用" :name="State.STOP"></el-tab-pane>
</el-tabs>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="标题" prop="title">
<el-input size="small" v-model="queryParams.title" placeholder="请输入标题" clearable
......
......@@ -244,7 +244,7 @@ export default {
// 返回按钮
handleClose() {
const obj = { path: "/system/role" };
const obj = { path: "/schoolManage/schoolNotice/personnelGrouping" };
this.$tab.closeOpenPage(obj);
},
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" inline>
<el-row>
<el-col :span="5">
<el-form-item label="设备名称">
<el-input style="width: 100%" v-model="queryParams.equipmentName" clearable placeholder="请输入设备名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="分类编码">
<treeselect v-model="queryParams.classificationCode" :options="classificationOptions" :normalizer="normalizer"
placeholder="请选择分类编码" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="设备状态">
<el-select v-model="queryParams.equipmentState" clearable placeholder="请选择设备状态">
<el-option v-for="dict in dict.type.equipment_state" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="归属类型">
<el-select v-model="queryParams.affiliationType" clearable placeholder="请选择归属类型">
<el-option v-for="dict in dict.type.affiliation_type" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button class="ml20" type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-col>
</el-row>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="showDetail(0)">入库</el-button>
<el-button type="danger" plain icon="el-icon-minus" size="mini" @click="handleDelete(0)"
:disabled="isDisabledBtn">批量出库</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" icon="el-icon-download" size="mini" @click="upload.open = true">导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-upload2" size="mini" @click="handleExportClass">导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-printer" size="mini" @click="printBarcodes"
:disabled="isDisabledBtn">批量打印条码</el-button>
</el-col>
</el-row>
<!-- 表单数据 -->
<el-table v-loading="loading" stripe :data="deviceData" @selection-change="handleSelectionChange" width="100%">
<el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" type="index" label="序号" width="55" fixed="left" />
<el-table-column align="center" prop="encode" label="自编码" width="140" fixed="left"></el-table-column>
<el-table-column align="center" prop="equipmentName" label="设备名称" fixed="left"></el-table-column>
<el-table-column align="center" prop="model" label="型号" fixed="left"></el-table-column>
<el-table-column align="center" prop="specification" label="规格" fixed="left"></el-table-column>
<el-table-column align="center" prop="classificationCode" label="分类编码"></el-table-column>
<el-table-column align="center" prop="unit" label="单位"></el-table-column>
<el-table-column align="center" prop="affiliationType" label="归属类型">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.affiliation_type, row.affiliationType) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="equipmentState" label="设备状态">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.equipment_state, row.equipmentState) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="isAllowLend" label="是否允许借出" width="120">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.is_lend, row.isAllowLend) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="isLend" label="是否借出">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.is_lend, row.isLend) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="dateOfProduction" label="投产日期" width="120"></el-table-column>
<el-table-column align="center" prop="price" label="价格(元)" width="100"></el-table-column>
<el-table-column align="center" prop="lifeOfUtility" label="效用年限(年)" width="120"></el-table-column>
<el-table-column align="center" prop="place" label="地点"></el-table-column>
<el-table-column align="center" prop="useName" label="使用人"></el-table-column>
<el-table-column align="center" prop="remark" label="备注"></el-table-column>
<el-table-column label="操作" align="center" min-width="220px" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="showDetail(1, scope.row.id)">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-view" @click="showDetail(2, scope.row.id)">查看</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(1, scope.row)">出库</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改对话框 -->
<el-dialog title="详细信息" :visible.sync="dialogVisible" width="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item v-if="nowOptionType != 0" label="自编码:" prop="encode">
<el-input v-model="form.encode" placeholder="请输入自编码" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="分类编码:" prop="classificationCode">
<treeselect v-model="form.classificationCode" :options="classificationOptions" :normalizer="normalizer"
@select="selectNode" placeholder="请选择分类编码" :disabled="nowOptionType == 2 ? true : false" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称:" prop="equipmentName">
<el-input v-model="form.equipmentName" placeholder="请输入设备名称" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="型号:" prop="model">
<el-input v-model="form.model" placeholder="请输入型号" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格:" prop="specification">
<el-input v-model="form.specification" placeholder="请输入规格" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="单位:" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属类型:" prop="affiliationType">
<el-select v-model="form.affiliationType" clearable placeholder="请选择归属类型"
:disabled="nowOptionType == 2 ? true : false" class="selectWidth">
<el-option v-for="dict in dict.type.affiliation_type" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备状态:" prop="equipmentState">
<el-select v-model="form.equipmentState" clearable placeholder="请选择设备状态"
:disabled="nowOptionType == 2 ? true : false" class="selectWidth">
<el-option v-for="dict in dict.type.equipment_state" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</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-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">
<el-col :span="12">
<el-form-item label="是否借出:" prop="isLend">
<el-select v-model="form.isLend" clearable placeholder="请选择是否借出"
:disabled="nowOptionType == 2 ? true : false" 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-col :span="12">
<el-form-item label="投产日期:" prop="dateOfProduction">
<el-date-picker v-model="form.dateOfProduction" type="date" placeholder="选择日期" class="selectWidth"
value-format="yyyy-MM-dd" :disabled="nowOptionType == 2 ? true : false" clearable>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="价格:" prop="price">
<el-input v-model="form.price" placeholder="请输入价格" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="效用年限:" prop="lifeOfUtility">
<el-input v-model="form.lifeOfUtility" placeholder="请输入效用年限(年)"
:disabled="nowOptionType == 2 ? true : false" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="地点:" prop="place">
<el-input v-model="form.place" placeholder="请输入地点" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="使用人:" prop="useName">
<el-select v-model="form.useId" filterable placeholder="请选择使用人"
:disabled="nowOptionType == 2 ? true : false" clearable>
<el-option v-for="(item, index) in userList" :key="index" :label="item.userName" :value="item.userId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="备注:" prop="remark">
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注"
:disabled="nowOptionType == 2 ? true : false" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-if="nowOptionType != 2" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="dialogVisible = false">取 消</el-button>
</div>
</el-dialog>
<!-- 导入对话框-->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url"
:disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
:auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
@click="importTemplate">下载模板
</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
<!-- 打印二维码 弹框部分 -->
<el-dialog title="打印条码预览" :visible.sync="printDialog" width="30%">
<div class="qrCodeList">
<div v-for="(item, index) in chooseList" :key="index">
<div class="titlShow">东营市二中</div>
<div class="flexBlock qrCode">
<div class="qrCodeLeft">
<div :id="'qrcode' + index"></div>
<div>{{ item.encode }}</div>
</div>
<div class="qrCodeRight">
<div>{{ item.equipmentName }}:{{ item.model }}</div>
<div>地点:{{ item.place }}</div>
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="printCode">打 印</el-button>
</div>
</el-dialog>
<!-- 打印二维码 弹框部分 -->
<!-- 隐藏二维码页面样式 -->
<div id="printBlock">
<div v-for="(item, index) in printList" :key="index" class="printBody">
<div class="titlePrint">东营市二中</div>
<div class="flexBlock printQrCode">
<div class="printLeft">
<div :id="'print' + index" class="printImg"></div>
<div>{{ item.encode }}</div>
</div>
<div class="printRight">
<div>{{ item.equipmentName }}:{{ item.model }}</div>
<div>地点:{{ item.place }}</div>
</div>
</div>
<div style="page-break-after:always"></div>
</div>
</div>
<!-- 隐藏二维码页面样式 -->
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import {
addEquipmentLedger, deleteEquipmentLedger, editEquipmentLedger,
getEquipmentLedger,
getEquipmentLedgerDetailByID, getModelByID, getUserList
} from "../../../../api/smartSchool/schoolProperty/equipmenTledger";
import { getProduct } from "../../../../api/smartSchool/schoolProperty/classiFication";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import QRCode from "qrcodejs2"; // 生成二维码插件
import printJS from "print-js"; // 打印插件
import * as dd from 'dingtalk-jsapi';
export default {
name: "index",
dicts: ['equipment_state', 'affiliation_type', 'is_lend'],
components: { Treeselect },
data() {
return {
loading: true, // 遮罩层
total: 0, // 总条数
deviceData: [], // 设备台账表格数据
title: "", // 弹出层标题
dialogVisible: false, // 添加或修改
queryParams: { // 查询参数
pageNum: 1,
pageSize: 10,
equipmentName: '',
classificationCode: undefined,
equipmentState: '',
affiliationType: '',
},
classificationOptions: [], // 分类编码树状结构
upload: {
// 是否显示弹出层
open: false,
// 弹出层标题
title: "",
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/equipmentLedger/importData"
},
form: {
id: '',
encode: '',
equipmentName: '',
model: '',
specification: '',
classificationCode: undefined,
unit: '',
affiliationType: '',
equipmentState: '',
isAllowLend: '',
isLend: '',
dateOfProduction: '',
price: '',
lifeOfUtility: '',
place: '',
useId: '',
useName: '',
remark: '',
},
rules: { // 表单校验
equipmentName: [
{ required: true, message: '请输入设备名称', trigger: 'blur' },
],
classificationCode: [
{ required: true, message: '请选择分类编码', trigger: 'change' }
],
equipmentState: [
{ required: true, message: '请选择设备状态', trigger: 'change' }
],
affiliationType: [
{ required: true, message: '请选择归属类型', trigger: 'change' }
],
isAllowLend: [
{ required: true, message: '请选择是否允许借出', trigger: 'change' }
]
},
nowOptionType: '', // 0 入库 1 编辑 2 查看
electItem: [], // 选中的数据
isDisabledBtn: true,
chooseList: [], //用户选择的table数据
printDialog: false, // 打印二维码预览
printList: [],
userList: [] //使用人列表
};
},
created() {
this.getClassificationCodeTree()
this.getList()
},
methods: {
//获取分类编码树形下拉框
getClassificationCodeTree() {
getProduct().then(res => {
if (res.code == 200) {
this.classificationOptions = this.handleTree(res.rows, "id")
}
})
},
/** 查询列表 */
getList() {
this.loading = true
getEquipmentLedger({ ...this.queryParams }).then(res => {
if (res.code == 200) {
this.total = res.total
this.deviceData = res.rows
this.loading = false
}
})
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
equipmentName: '',
classificationCode: undefined,
equipmentState: '',
affiliationType: '',
}
this.getList()
},
/** 转换分类编码数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.classificationCode,
label: node.equipmentType,
children: node.children
};
},
//弹出层分类编码选择事件 获取当前分类编码的型号
selectNode(node) {
const id = node.classificationCode
getModelByID(id).then(res => {
if (res.code == 200) {
this.form.model = res.data.model
}
})
},
//0 入库 1 编辑 2 查看
showDetail(type, id) {
this.form = {
id: '',
encode: '',
equipmentName: '',
model: '',
specification: '',
classificationCode: undefined,
unit: '',
affiliationType: '',
equipmentState: '',
isAllowLend: '',
isLend: '',
dateOfProduction: '',
price: '',
lifeOfUtility: '',
place: '',
useName: '',
useId: '',
remark: '',
}
this.nowOptionType = type
this.getSelectUser()
if (type != 0) {
getEquipmentLedgerDetailByID(id).then(res => {
if (res.code == 200) {
Object.keys(this.form).forEach(key => {
res.data[key] && (this.form[key] = res.data[key])
})
}
})
}
this.dialogVisible = true
},
//使用人列表数据
getSelectUser() {
getUserList().then(res => {
if (res.code == 200) {
this.userList = res.rows
}
})
},
//表单提交
submitForm() {
const useId = this.form.useId
this.form.useName = useId == '' ? '' : this.userList.find(item => item.userId == useId).userName
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.nowOptionType == 0) {
//0 入库 1 编辑 2 查看
const data = {
equipmentName: this.form.equipmentName,
model: this.form.model,
specification: this.form.specification,
classificationCode: this.form.classificationCode,
unit: this.form.unit,
affiliationType: this.form.affiliationType,
equipmentState: this.form.equipmentState,
isAllowLend: this.form.isAllowLend,
isLend: this.form.isLend,
dateOfProduction: this.form.dateOfProduction,
price: this.form.price,
lifeOfUtility: this.form.lifeOfUtility,
place: this.form.place,
useName: this.form.useName,
useId,
remark: this.form.remark,
}
addEquipmentLedger(data).then(res => {
if (res.code == 200) {
this.$message.success("设备台账入库成功!")
this.dialogVisible = false
this.getList()
}
})
} else if (this.nowOptionType == 1) {
//1 编辑
editEquipmentLedger({ ...this.form }).then(res => {
if (res.code == 200) {
this.$message.success("设备台账编辑成功!")
this.dialogVisible = false
this.getList()
}
})
}
}
})
},
//出库
handleDelete(type, item) {
let idString = type == 0 ? this.electItem.toString() : item.id
let message = type == 0 ? '是否确认批量出库选中设备?' : `是否确认出库${item.model}设备?`
this.$confirm(message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteEquipmentLedger(idString).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '出库成功!'
});
this.getList();
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消出库!'
});
});
},
//模版下载
importTemplate() {
this.download(
"/equipmentLedger/importTemplate",
{},
`设备台账_template_${new Date().getTime()}.xlsx`
);
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
//导出
handleExportClass() {
const data = {
equipmentName: this.queryParams.equipmentName,
classificationCode: this.queryParams.classificationCode,
equipmentState: this.queryParams.equipmentState,
affiliationType: this.queryParams.affiliationType,
}
this.download('/equipmentLedger/export', {
...data,
}, `设备台账_${Date.now()}.xlsx`)
},
//生成批量打印条码
printBarcodes() {
const url = `http://192.168.1.109:1024`;
dd.biz.util.openLink({
url: url,
onSuccess: () => {
console.log(newURL, 'newURL');
console.log('跳转成功,准备打印');
// 打印条码
this.printCode();
},
onFail: (error) => {
console.error('跳转失败', error);
}
});
},
// 打印条码
printCode() {
this.printList = this.chooseList;
this.$nextTick(() => {
this.chooseList.map((item, index) => {
const dom = document.getElementById(`qrcode${index}`).lastElementChild;
if (dom == null) {
new QRCode(`qrcode${index}`, {
width: 150,
height: 150,
text: item.encode,
});
}
});
this.printList.map((item, index) => {
const domPrint = document.getElementById(`print${index}`).lastElementChild;
if (domPrint == null) {
new QRCode(`print${index}`, {
width: 60,
height: 60,
text: item.encode,
});
}
});
printJS({
printable: 'printBlock', // 标签元素id
type: 'html',
targetStyles: ['*'],
font_size: '10px',
style: `
@media print{
@page{
size:auto;
margin:4mm 0mm 0mm 0mm
}
@page :first {
margin-top:2mm
}
#printBlock{
display:block!important
}
}`
});
});
},
// 多选框选中数据
handleSelectionChange(selection) {
this.chooseList = selection
this.electItem = selection.map(item => {
return item.id
})
this.isDisabledBtn = selection.length != 0 ? false : true
},
},
};
</script>
<style scoped>
::v-deep .el-form-item,
::v-deep .el-select {
width: 100%;
}
::v-deep .el-form-item--small .el-form-item__content {
width: 75%;
}
.qrCodeList {
max-height: 500px;
overflow-y: scroll;
}
.qrCode {
width: 300px;
font-size: 14px;
line-height: 30px;
align-items: flex-start;
margin: 0 auto 20px auto;
}
.qrCodeLeft {
text-align: center;
}
.qrCodeRight {
padding: 20px 0 20px 15px;
}
.titlShow {
font-weight: bold;
text-align: center;
padding-bottom: 10px;
font-size: 16px;
}
#printBlock {
display: none;
margin: 0px !important;
}
.printLeft {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
.printBody {
width: 250px;
}
.printQrCode {
font-size: 6px;
line-height: 20px;
align-items: center;
padding: 8px;
}
.printRight {
width: 60%;
padding: 0 5px;
}
.titlePrint {
font-size: 8px;
font-weight: bold;
text-align: center;
}
.printImg {
display: block;
}
</style>
......@@ -316,6 +316,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import QRCode from "qrcodejs2"; // 生成二维码插件
import printJS from "print-js"; // 打印插件
import * as dd from 'dingtalk-jsapi';
export default {
......@@ -621,58 +622,55 @@ export default {
}, `设备台账_${Date.now()}.xlsx`)
},
//生成批量打印条码
//点击批量打印跳转
printBarcodes() {
this.printDialog = true
this.printList = this.chooseList
this.$nextTick(() => {
this.chooseList.map((item, index) => {
const dom = document.getElementById(`qrcode${index}`).lastElementChild
if (dom == null) {
new QRCode(`qrcode${index}`, {
width: 150,
height: 150,
text: item.encode,
});
}
})
// this.printDialog = true;
this.printList = this.chooseList;
console.log(11, this.printList);
const url = 'http://localhost:1024/printBarcodes';
console.log(url, 'url');
const ids = this.electItem.join(',');
console.log(ids, 'ids');
const encodes = this.chooseList.map(item => item.encode).join(',');
console.log(encodes, 'encodes');
const printListParam = encodeURIComponent(JSON.stringify(this.printList));
dd.biz.util.openLink({
url: `${url}?ids=${ids}&encodes=${encodes}&printList=${printListParam}`,
onSuccess: () => {
console.log('跳转成功,准备打印');
// 打印条码
// this.printCode();
},
onFail: (error) => {
console.error('跳转失败', error);
}
});
},
this.printList.map((item, index) => {
const domPrint = document.getElementById(`print${index}`).lastElementChild
if (domPrint == null) {
new QRCode(`print${index}`, {
width: 60,
height: 60,
text: item.encode,
});
}
})
})
},
//打印条码
printCode() {
printJS({
printable: 'printBlock', // 标签元素id
type: 'html',
targetStyles: ['*'],
font_size: '10px',
style: `
@media print{
@page{
size:auto;
margin:4mm 0mm 0mm 0mm
}
@page :first {
margin-top:2mm
}
#printBlock{
display:block!important
}
}`
})
},
// printCode() {
// printJS({
// printable: 'printBlock', // 标签元素id
// type: 'html',
// targetStyles: ['*'],
// font_size: '10px',
// style: `
// @media print{
// @page{
// size:auto;
// margin:4mm 0mm 0mm 0mm
// }
// @page :first {
// margin-top:2mm
// }
// #printBlock{
// display:block!important
// }
// }`
// })
// },
// 多选框选中数据
handleSelectionChange(selection) {
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" inline>
<el-row>
<el-col :span="5">
<el-form-item label="设备名称">
<el-input style="width: 100%" v-model="queryParams.equipmentName" clearable
placeholder="请输入设备名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="分类编码">
<treeselect v-model="queryParams.classificationCode" :options="classificationOptions"
:normalizer="normalizer" placeholder="请选择分类编码" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="设备状态">
<el-select v-model="queryParams.equipmentState" clearable placeholder="请选择设备状态">
<el-option v-for="dict in dict.type.equipment_state" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="归属类型">
<el-select v-model="queryParams.affiliationType" clearable placeholder="请选择归属类型">
<el-option v-for="dict in dict.type.affiliation_type" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button class="ml20" type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-col>
</el-row>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="showDetail(0)">入库</el-button>
<el-button type="danger" plain icon="el-icon-minus" size="mini" @click="handleDelete(0)"
:disabled="isDisabledBtn">批量出库</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" icon="el-icon-download" size="mini" @click="upload.open = true">导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-upload2" size="mini" @click="handleExportClass">导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-printer" size="mini" @click="printBarcodes"
:disabled="isDisabledBtn">批量打印条码</el-button>
</el-col>
</el-row>
<!-- 表单数据 -->
<el-table v-loading="loading" stripe :data="deviceData" @selection-change="handleSelectionChange" width="100%">
<el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" type="index" label="序号" width="55" fixed="left" />
<el-table-column align="center" prop="encode" label="自编码" width="140" fixed="left"></el-table-column>
<el-table-column align="center" prop="equipmentName" label="设备名称" fixed="left"></el-table-column>
<el-table-column align="center" prop="model" label="型号" fixed="left"></el-table-column>
<el-table-column align="center" prop="specification" label="规格" fixed="left"></el-table-column>
<el-table-column align="center" prop="classificationCode" label="分类编码"></el-table-column>
<el-table-column align="center" prop="unit" label="单位"></el-table-column>
<el-table-column align="center" prop="affiliationType" label="归属类型">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.affiliation_type, row.affiliationType) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="equipmentState" label="设备状态">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.equipment_state, row.equipmentState) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="isAllowLend" label="是否允许借出" width="120">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.is_lend, row.isAllowLend) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="isLend" label="是否借出">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.is_lend, row.isLend) }}</div>
</template>
</el-table-column>
<el-table-column align="center" prop="dateOfProduction" label="投产日期" width="120"></el-table-column>
<el-table-column align="center" prop="price" label="价格(元)" width="100"></el-table-column>
<el-table-column align="center" prop="lifeOfUtility" label="效用年限(年)" width="120"></el-table-column>
<el-table-column align="center" prop="place" label="地点"></el-table-column>
<el-table-column align="center" prop="useName" label="使用人"></el-table-column>
<el-table-column align="center" prop="remark" label="备注"></el-table-column>
<el-table-column label="操作" align="center" min-width="220px" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit"
@click="showDetail(1, scope.row.id)">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-view"
@click="showDetail(2, scope.row.id)">查看</el-button>
<el-button size="mini" type="text" icon="el-icon-delete"
@click="handleDelete(1, scope.row)">出库</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改对话框 -->
<el-dialog title="详细信息" :visible.sync="dialogVisible" width="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item v-if="nowOptionType != 0" label="自编码:" prop="encode">
<el-input v-model="form.encode" placeholder="请输入自编码" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="分类编码:" prop="classificationCode">
<treeselect v-model="form.classificationCode" :options="classificationOptions"
:normalizer="normalizer" @select="selectNode" placeholder="请选择分类编码"
:disabled="nowOptionType == 2 ? true : false" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称:" prop="equipmentName">
<el-input v-model="form.equipmentName" placeholder="请输入设备名称"
:disabled="nowOptionType == 2 ? true : false" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="型号:" prop="model">
<el-input v-model="form.model" placeholder="请输入型号" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格:" prop="specification">
<el-input v-model="form.specification" placeholder="请输入规格"
:disabled="nowOptionType == 2 ? true : false" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="单位:" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属类型:" prop="affiliationType">
<el-select v-model="form.affiliationType" clearable placeholder="请选择归属类型"
:disabled="nowOptionType == 2 ? true : false" class="selectWidth">
<el-option v-for="dict in dict.type.affiliation_type" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备状态:" prop="equipmentState">
<el-select v-model="form.equipmentState" clearable placeholder="请选择设备状态"
:disabled="nowOptionType == 2 ? true : false" class="selectWidth">
<el-option v-for="dict in dict.type.equipment_state" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</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-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">
<el-col :span="12">
<el-form-item label="是否借出:" prop="isLend">
<el-select v-model="form.isLend" clearable placeholder="请选择是否借出"
:disabled="nowOptionType == 2 ? true : false" 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-col :span="12">
<el-form-item label="投产日期:" prop="dateOfProduction">
<el-date-picker v-model="form.dateOfProduction" type="date" placeholder="选择日期"
class="selectWidth" value-format="yyyy-MM-dd" :disabled="nowOptionType == 2 ? true : false"
clearable>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="价格:" prop="price">
<el-input v-model="form.price" placeholder="请输入价格" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="效用年限:" prop="lifeOfUtility">
<el-input v-model="form.lifeOfUtility" placeholder="请输入效用年限(年)"
:disabled="nowOptionType == 2 ? true : false" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="地点:" prop="place">
<el-input v-model="form.place" placeholder="请输入地点" :disabled="nowOptionType == 2 ? true : false"
clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="使用人:" prop="useName">
<el-select v-model="form.useId" filterable placeholder="请选择使用人"
:disabled="nowOptionType == 2 ? true : false" clearable>
<el-option v-for="(item, index) in userList" :key="index" :label="item.userName"
:value="item.userId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="备注:" prop="remark">
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注"
:disabled="nowOptionType == 2 ? true : false" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-if="nowOptionType != 2" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="dialogVisible = false">取 消</el-button>
</div>
</el-dialog>
<!-- 导入对话框-->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url"
:disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
:auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
@click="importTemplate">下载模板
</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
<!-- 打印二维码 弹框部分 -->
<el-dialog title="打印条码预览" :visible.sync="printDialog" width="30%">
<div class="qrCodeList">
<div v-for="(item, index) in chooseList" :key="index">
<div class="titlShow">东营市二中</div>
<div class="flexBlock qrCode">
<div class="qrCodeLeft">
<div :id="'qrcode' + index"></div>
<div>{{ item.encode }}</div>
</div>
<div class="qrCodeRight">
<div>{{ item.equipmentName }}:{{ item.model }}</div>
<div>地点:{{ item.place }}</div>
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="printCode">打 印</el-button>
</div>
</el-dialog>
<!-- 打印二维码 弹框部分 -->
<!-- 隐藏二维码页面样式 -->
<div id="printBlock">
<div v-for="(item, index) in printList" :key="index" class="printBody">
<div class="titlePrint">东营市二中</div>
<div class="flexBlock printQrCode">
<div class="printLeft">
<div :id="'print' + index" class="printImg"></div>
<div>{{ item.encode }}</div>
</div>
<div class="printRight">
<div>{{ item.equipmentName }}:{{ item.model }}</div>
<div>地点:{{ item.place }}</div>
</div>
</div>
<div style="page-break-after:always"></div>
</div>
</div>
<!-- 隐藏二维码页面样式 -->
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import {
addEquipmentLedger, deleteEquipmentLedger, editEquipmentLedger,
getEquipmentLedger,
getEquipmentLedgerDetailByID, getModelByID, getUserList
} from "../../../../api/smartSchool/schoolProperty/equipmenTledger";
import { getProduct } from "../../../../api/smartSchool/schoolProperty/classiFication";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import QRCode from "qrcodejs2"; // 生成二维码插件
import printJS from "print-js"; // 打印插件
export default {
name: "index",
dicts: ['equipment_state', 'affiliation_type', 'is_lend'],
components: { Treeselect },
data() {
return {
loading: true, // 遮罩层
total: 0, // 总条数
deviceData: [], // 设备台账表格数据
title: "", // 弹出层标题
dialogVisible: false, // 添加或修改
queryParams: { // 查询参数
pageNum: 1,
pageSize: 10,
equipmentName: '',
classificationCode: undefined,
equipmentState: '',
affiliationType: '',
},
classificationOptions: [], // 分类编码树状结构
upload: {
// 是否显示弹出层
open: false,
// 弹出层标题
title: "",
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/equipmentLedger/importData"
},
form: {
id: '',
encode: '',
equipmentName: '',
model: '',
specification: '',
classificationCode: undefined,
unit: '',
affiliationType: '',
equipmentState: '',
isAllowLend: '',
isLend: '',
dateOfProduction: '',
price: '',
lifeOfUtility: '',
place: '',
useId: '',
useName: '',
remark: '',
},
rules: { // 表单校验
equipmentName: [
{ required: true, message: '请输入设备名称', trigger: 'blur' },
],
classificationCode: [
{ required: true, message: '请选择分类编码', trigger: 'change' }
],
equipmentState: [
{ required: true, message: '请选择设备状态', trigger: 'change' }
],
affiliationType: [
{ required: true, message: '请选择归属类型', trigger: 'change' }
],
isAllowLend: [
{ required: true, message: '请选择是否允许借出', trigger: 'change' }
]
},
nowOptionType: '', // 0 入库 1 编辑 2 查看
electItem: [], // 选中的数据
isDisabledBtn: true,
chooseList: [], //用户选择的table数据
printDialog: false, // 打印二维码预览
printList: [],
userList: [] //使用人列表
};
},
created() {
this.getClassificationCodeTree()
this.getList()
},
methods: {
//获取分类编码树形下拉框
getClassificationCodeTree() {
getProduct().then(res => {
if (res.code == 200) {
this.classificationOptions = this.handleTree(res.rows, "id")
}
})
},
/** 查询列表 */
getList() {
this.loading = true
getEquipmentLedger({ ...this.queryParams }).then(res => {
if (res.code == 200) {
this.total = res.total
this.deviceData = res.rows
this.loading = false
}
})
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
equipmentName: '',
classificationCode: undefined,
equipmentState: '',
affiliationType: '',
}
this.getList()
},
/** 转换分类编码数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.classificationCode,
label: node.equipmentType,
children: node.children
};
},
//弹出层分类编码选择事件 获取当前分类编码的型号
selectNode(node) {
const id = node.classificationCode
getModelByID(id).then(res => {
if (res.code == 200) {
this.form.model = res.data.model
}
})
},
//0 入库 1 编辑 2 查看
showDetail(type, id) {
this.form = {
id: '',
encode: '',
equipmentName: '',
model: '',
specification: '',
classificationCode: undefined,
unit: '',
affiliationType: '',
equipmentState: '',
isAllowLend: '',
isLend: '',
dateOfProduction: '',
price: '',
lifeOfUtility: '',
place: '',
useName: '',
useId: '',
remark: '',
}
this.nowOptionType = type
this.getSelectUser()
if (type != 0) {
getEquipmentLedgerDetailByID(id).then(res => {
if (res.code == 200) {
Object.keys(this.form).forEach(key => {
res.data[key] && (this.form[key] = res.data[key])
})
}
})
}
this.dialogVisible = true
},
//使用人列表数据
getSelectUser() {
getUserList().then(res => {
if (res.code == 200) {
this.userList = res.rows
}
})
},
//表单提交
submitForm() {
const useId = this.form.useId
this.form.useName = useId == '' ? '' : this.userList.find(item => item.userId == useId).userName
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.nowOptionType == 0) {
//0 入库 1 编辑 2 查看
const data = {
equipmentName: this.form.equipmentName,
model: this.form.model,
specification: this.form.specification,
classificationCode: this.form.classificationCode,
unit: this.form.unit,
affiliationType: this.form.affiliationType,
equipmentState: this.form.equipmentState,
isAllowLend: this.form.isAllowLend,
isLend: this.form.isLend,
dateOfProduction: this.form.dateOfProduction,
price: this.form.price,
lifeOfUtility: this.form.lifeOfUtility,
place: this.form.place,
useName: this.form.useName,
useId,
remark: this.form.remark,
}
addEquipmentLedger(data).then(res => {
if (res.code == 200) {
this.$message.success("设备台账入库成功!")
this.dialogVisible = false
this.getList()
}
})
} else if (this.nowOptionType == 1) {
//1 编辑
editEquipmentLedger({ ...this.form }).then(res => {
if (res.code == 200) {
this.$message.success("设备台账编辑成功!")
this.dialogVisible = false
this.getList()
}
})
}
}
})
},
//出库
handleDelete(type, item) {
let idString = type == 0 ? this.electItem.toString() : item.id
let message = type == 0 ? '是否确认批量出库选中设备?' : `是否确认出库${item.model}设备?`
this.$confirm(message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteEquipmentLedger(idString).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '出库成功!'
});
this.getList();
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消出库!'
});
});
},
//模版下载
importTemplate() {
this.download(
"/equipmentLedger/importTemplate",
{},
`设备台账_template_${new Date().getTime()}.xlsx`
);
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
//导出
handleExportClass() {
const data = {
equipmentName: this.queryParams.equipmentName,
classificationCode: this.queryParams.classificationCode,
equipmentState: this.queryParams.equipmentState,
affiliationType: this.queryParams.affiliationType,
}
this.download('/equipmentLedger/export', {
...data,
}, `设备台账_${Date.now()}.xlsx`)
},
//生成批量打印条码
printBarcodes() {
this.printDialog = true
this.printList = this.chooseList
this.$nextTick(() => {
this.chooseList.map((item, index) => {
const dom = document.getElementById(`qrcode${index}`).lastElementChild
if (dom == null) {
new QRCode(`qrcode${index}`, {
width: 150,
height: 150,
text: item.encode,
});
}
})
this.printList.map((item, index) => {
const domPrint = document.getElementById(`print${index}`).lastElementChild
if (domPrint == null) {
new QRCode(`print${index}`, {
width: 60,
height: 60,
text: item.encode,
});
}
})
})
},
//打印条码
printCode() {
printJS({
printable: 'printBlock', // 标签元素id
type: 'html',
targetStyles: ['*'],
font_size: '10px',
style: `
@media print{
@page{
size:auto;
margin:4mm 0mm 0mm 0mm
}
@page :first {
margin-top:2mm
}
#printBlock{
display:block!important
}
}`
})
},
// 多选框选中数据
handleSelectionChange(selection) {
this.chooseList = selection
this.electItem = selection.map(item => {
return item.id
})
this.isDisabledBtn = selection.length != 0 ? false : true
},
},
};
</script>
<style scoped>
::v-deep .el-form-item,
::v-deep .el-select {
width: 100%;
}
::v-deep .el-form-item--small .el-form-item__content {
width: 75%;
}
.qrCodeList {
max-height: 500px;
overflow-y: scroll;
}
.qrCode {
width: 300px;
font-size: 14px;
line-height: 30px;
align-items: flex-start;
margin: 0 auto 20px auto;
}
.qrCodeLeft {
text-align: center;
}
.qrCodeRight {
padding: 20px 0 20px 15px;
}
.titlShow {
font-weight: bold;
text-align: center;
padding-bottom: 10px;
font-size: 16px;
}
#printBlock {
display: none;
margin: 0px !important;
}
.printLeft {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
.printBody {
width: 250px;
}
.printQrCode {
font-size: 6px;
line-height: 20px;
align-items: center;
padding: 8px;
}
.printRight {
width: 60%;
padding: 0 5px;
}
.titlePrint {
font-size: 8px;
font-weight: bold;
text-align: center;
}
.printImg {
display: block;
}</style>
<template>
<div>
<!-- 打印二维码 弹框部分 -->
<el-dialog title="打印条码预览" :visible.sync="printDialog" width="30%">
<div class="qrCodeList">
<div v-for="(item, index) in chooseList" :key="index">
<div class="titlShow">东营市二中</div>
<div class="flexBlock qrCode">
<div class="qrCodeLeft">
<div :id="'qrcode' + index"></div>
<div>{{ item.encode }}</div>
</div>
<div class="qrCodeRight">
<div>{{ item.equipmentName }}{{ item.model }}</div>
<div>地点:{{ item.place }}</div>
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="printCode">打 印</el-button>
</div>
</el-dialog>
<!-- 打印二维码 弹框部分 -->
<!-- 隐藏二维码页面样式 -->
<div id="printBlock">
<div v-for="(item, index) in printList" :key="index" class="printBody">
<div class="titlePrint">东营市二中</div>
<div class="flexBlock printQrCode">
<div class="printLeft">
<div :id="'print' + index" class="printImg"></div>
<div>{{ item.encode }}</div>
</div>
<div class="printRight">
<div>{{ item.equipmentName }}{{ item.model }}</div>
<div>地点:{{ item.place }}</div>
</div>
</div>
<div style="page-break-after:always"></div>
</div>
</div>
<!-- 隐藏二维码页面样式 -->
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import QRCode from "qrcodejs2"; // 生成二维码插件
import printJS from "print-js"; // 打印插件
export default {
name: "index",
data() {
return {
loading: true, // 遮罩层
total: 0, // 总条数
deviceData: [], // 设备台账表格数据
title: "", // 弹出层标题
dialogVisible: false, // 添加或修改
queryParams: { // 查询参数
pageNum: 1,
pageSize: 10,
equipmentName: '',
classificationCode: undefined,
equipmentState: '',
affiliationType: '',
},
classificationOptions: [], // 分类编码树状结构
formModel: {},
nowOptionType: '', // 0 入库 1 编辑 2 查看
electItem: [], // 选中的数据
isDisabledBtn: true,
chooseList: [], //用户选择的table数据
printDialog: false, // 打印二维码预览
printList: [],
userList: [] //使用人列表
};
},
created() {
const ids = this.$route.query.ids;
const encodes = this.$route.query.encodes;
const printList = JSON.parse(decodeURIComponent(this.$route.query.printList));
this.printBarcodes(ids, encodes, printList);
},
methods: {
//生成批量打印条码
printBarcodes(ids, encodes, printList) {
this.printDialog = true;
console.log(ids, encodes);
this.printList = [...printList];
this.chooseList = [...this.printList];
console.log(this.chooseList, '122');
this.$nextTick(() => {
this.printList.map((item, index) => {
const domPrint = document.getElementById(`print${index}`).lastElementChild;
if (domPrint == null) {
new QRCode(`print${index}`, {
width: 60,
height: 60,
text: item.encode,
});
}
});
this.chooseList.map((item, index) => {
const dom = document.getElementById(`qrcode${index}`).lastElementChild;
if (dom == null) {
new QRCode(`qrcode${index}`, {
width: 150,
height: 150,
text: item.encode,
});
}
});
});
},
//打印条码
printCode() {
printJS({
printable: printBlock,
type: 'html',
targetStyles: ['*'],
font_size: '10px',
style: `
@media print{
@page{
size:auto;
margin:4mm 0mm 0mm 0mm
}
@page :first{
margin-top:2mm
}
#printBlock{
display:block!important
}
}`
});
}
},
}
</script>
<style scoped>
::v-deep .el-form-item,
::v-deep .el-select {
width: 100%;
}
::v-deep .el-form-item--small .el-form-item__content {
width: 75%;
}
.qrCodeList {
max-height: 500px;
overflow-y: scroll;
}
.qrCode {
width: 300px;
font-size: 14px;
line-height: 30px;
align-items: flex-start;
margin: 0 auto 20px auto;
}
.qrCodeLeft {
text-align: center;
}
.qrCodeRight {
padding: 20px 0 20px 15px;
}
.titlShow {
font-weight: bold;
text-align: center;
padding-bottom: 10px;
font-size: 16px;
}
#printBlock {
display: none;
margin: 0px !important;
}
.printLeft {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
.printBody {
width: 250px;
}
.printQrCode {
font-size: 6px;
line-height: 20px;
align-items: center;
padding: 8px;
}
.printRight {
width: 60%;
padding: 0 5px;
}
.titlePrint {
font-size: 8px;
font-weight: bold;
text-align: center;
}
.printImg {
display: block;
}
</style>
......@@ -100,8 +100,8 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="借用期限(天)" prop="deadline">
<el-input v-model="lendReturnForm.deadline" placeholder="请输入借用期限"
:disabled="nowType == 2 ? true : false"></el-input>
<el-input v-model="lendReturnForm.deadline" placeholder="请输入借用期限" :disabled="nowType == 2 ? true : false"
type="number"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
......
......@@ -619,7 +619,8 @@ import { uploadImage as commonUpload } from '@/api/common'
import { ExportType, Gender, Nations, Area } from '@/enums/common'
import { getYearList } from '@/utils/utilLibrary/getYearList'
import { getNewYear } from "@/api/smartSchool/teachAffairAdministration/affairClassView";
import * as dd from 'dingtalk-jsapi';
import { im_1_0 } from '@alicloud/dingtalk'
export default {
name: 'AffairStudentManage',
components: { ClassSelect, PicAvatar },
......@@ -921,17 +922,40 @@ export default {
})
},
// 学籍证明
// studentProve(row) {
// this.$router.push({
// path: '/teachAffairAdministration/studentProve',
// query: {
// id: row.id,
// name: row.studentName,
// idCard: row.idCard,
// schoolNo: row.schoolNo
// }
// })
// },
studentProve(row) {
this.$router.push({
path: '/teachAffairAdministration/studentProve',
query: {
id: row.id,
name: row.studentName,
idCard: row.idCard,
schoolNo: row.schoolNo
console.log('准备跳转');
const baseUrl = window.location.protocol + '//' + window.location.host; // 获取当前页面的协议、主机作为前缀URL
console.log('im_1_0', baseUrl);
const url = `http://localhost:1024/studentRegistra?id=${row.id}&name=${row.studentName}&idCard=${row.idCard}&schoolNo=${row.schoolNo}`;
// const newURL = `${baseUrl}/studentRegistra?id=${encodeURIComponent(row.id)}&name=${encodeURIComponent(row.studentName)}&idCard=${encodeURIComponent(row.idCard)}&schoolNo=${encodeURIComponent(row.schoolNo)}`;
dd.biz.util.openLink({
// url: newURL,
url: url,
onSuccess: () => {
console.log(newURL, 'newURL');
console.log('跳转成功,准备打印');
},
onFail: (err) => {
console.log('跳转失败', err);
}
})
});
},
/** 提交按钮 */
submitForm: function () {
this.$refs['form'].validate(valid => {
......
<template>
<div class="app-container">
<div style="width: 100%; display: flex; justify-content: center; flex-wrap: nowrap;">
<!-- <el-button type="primary" plain size="mini" @click="closeCurrentTab">关闭
</el-button> -->
<el-button type="primary" plain size="mini" @click="downloadProve">下载
</el-button>
<el-button type="primary" plain size="mini" @click="printTable">打印
</el-button>
</div>
<el-card :style="{ width: '850px', height: clientHeight, margin: '0 auto' }">
<div id="postFormContainer">
<br /><br />
<div style="display: block; font-weight: 600; font-size: 35px; text-align: center">学籍证明</div>
<br />
<span style="display: block; font-size: 25px; text-indent:50px; line-height: 40px">
{{ studentInfo.studentName }}同学,身份证号{{ studentInfo.idCard }} ,性别{{
studentInfo.sex
}}{{ studentInfo.birthday }}生,
省学籍辅号{{ studentInfo.schoolNo }},全国学籍号{{
studentInfo.nationalNumber
}},系东营市第二中学{{ studentInfo.enrollmentYear }}{{ studentInfo.classValue }}班学生,特此证明。
</span>
<br /><br /><br />
<div style="width: 100%; display:flex; justify-content: center; font-size:20px;">
<div>
<el-image style="width: 160px; height: 200px" :src="url"></el-image>
<br />
<div style="text-align: center">山东学籍管理</div>
</div>
</div>
<br /><br /><br />
<div style="position: relative; background: #1ab394">
<div style="position: absolute; right: 30px; font-size: 20px ">
<span>东营市第二中学</span>
<br /><br />
<span> {{ time }}</span>
</div>
</div>
</div>
</el-card>
</div>
</template>
<script>
import printJS from "print-js";
import { closeCurrentTab } from "@/utils/utilLibrary/routerBatch/routerBatch.js";
import { getStudent } from '@/api/smartSchool/teachAffairAdministration/affairStudentManage'
export default {
name: 'StudentProve',
data() {
return {
clientHeight: document.body.scrollHeight + 'px',
baseUrl: process.env.VUE_APP_BASE_API,
studentInfo: {},
url: '',
time: " ",
}
},
components: {},
methods: {
closeCurrentTab,
getImage() {
const studentId = this.$route.query.id;
getStudent(studentId).then((res) => {
this.studentInfo = res.data
if (res.data.sex == 0) {
this.studentInfo.sex = "男"
} else {
this.studentInfo.sex = "女"
}
if (res.data.birthday.charAt(5) == 0) {
if (res.data.birthday.charAt(8) == 0) {
this.studentInfo.birthday = res.data.birthday.slice(0, 4) + "年" + res.data.birthday.slice(6, 7) + "月" + res.data.birthday.slice(9, 10) + "日"
} else {
this.studentInfo.birthday = res.data.birthday.slice(0, 4) + "年" + res.data.birthday.slice(6, 7) + "月" + res.data.birthday.slice(8, 10) + "日"
}
} else {
if (res.data.birthday.charAt(8) == 0) {
this.studentInfo.birthday = res.data.birthday.slice(0, 4) + "年" + res.data.birthday.slice(5, 7) + "月" + res.data.birthday.slice(9, 10) + "日"
} else {
this.studentInfo.birthday = res.data.birthday.slice(0, 4) + "年" + res.data.birthday.slice(5, 7) + "月" + res.data.birthday.slice(8, 10) + "日"
}
}
this.url = this.baseUrl + this.studentInfo.avatar
console.log(this.url, 107)
});
},
// 打印
printTable() {
// 重置表单
printJS({
printable: 'postFormContainer',
targetStyles: ['*'],
type: "html",
})
},
/**
* 获取当前时间
*/
currentTime() {
var date = new Date();
var year = date.getFullYear(); //月份从0~11,所以加一
let month = date.getMonth();
console.log("month", month);
var dateArr = [
date.getMonth() + 1,
date.getDate(),
];
var strDate =
year + "年" + dateArr[0] + "月" + dateArr[1] + "日"
console.log("strDate", strDate);
return strDate
},
downloadProve() {
this.download(`/school/studentStatus/proofStatus/${this.$route.query.id}`, {}, `${this.studentInfo.studentName}.docx`)
},
},
created() {
this.getImage()
this.time = this.currentTime()
},
activated() {
this.getImage()
this.time = this.currentTime()
}
}
</script>
<style scoped></style>
......@@ -247,7 +247,7 @@ export default {
// 关闭页面
closePage() {
this.$tab.closeOpenPage({
path: '/teacherManage/teacherInforManage'
path: '/schoolManage/teacherManage/teacherInforManage'
})
},
},
......
<template>
<div class="app-container">
<span>老师信息</span>
<hr/>
<br/>
<hr />
<br />
<el-form :model="techerInfoForm" ref="reftecherInfoForm" size="small" :inline="true" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="教师名称" clearable prop="teacherName">
<el-input v-model="techerInfoForm.teacherName" disabled clearable @keyup.enter.native="handleQuery"/>
<el-input v-model="techerInfoForm.teacherName" disabled clearable @keyup.enter.native="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<el-select disabled v-model="techerInfoForm.sex" style="width: 100%" placeholder="请选择性别">
<el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
:value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
......@@ -22,19 +22,19 @@
<el-row>
<el-col :span="12">
<el-form-item label="教师电话" clearable prop="teacherTel">
<el-input disabled v-model="techerInfoForm.teacherTel" clearable @keyup.enter.native="handleQuery"/>
<el-input disabled v-model="techerInfoForm.teacherTel" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作编号" clearable prop="teacherCode">
<el-input disabled v-model="techerInfoForm.teacherCode" clearable @keyup.enter.native="handleQuery"/>
<el-input disabled v-model="techerInfoForm.teacherCode" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<span>履历信息</span>
<hr/>
<br/>
<hr />
<br />
<el-row>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="resumeAdd">增加</el-button>
<el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="resumeEdit">修改</el-button>
......@@ -42,38 +42,37 @@
</el-button>
<el-button type="info" size="mini" plain icon="el-icon-close" @click="closePage">关闭</el-button>
</el-row>
<br/>
<el-table stripe v-loading="loading" style="width: 100%" :data="resumeList"
@selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55"/>
<el-table-column label="序号" type="index" align="center" width="55"/>
<el-table-column label="学校/工作单位" width="width" align="center" prop="learnSchool"/>
<br />
<el-table stripe v-loading="loading" style="width: 100%" :data="resumeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55" />
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="学校/工作单位" width="width" align="center" prop="learnSchool" />
<el-table-column label="履历开始时间" :formatter="dateFormat" width="width" align="center"
prop="learnStart"></el-table-column>
prop="learnStart"></el-table-column>
<el-table-column label="履历结束时间" :formatter="dateFormat" width="width" align="center"
prop="learnEnd"></el-table-column>
<el-table-column label="备注" width="width" align="center" prop="remark"/>
prop="learnEnd"></el-table-column>
<el-table-column label="备注" width="width" align="center" prop="remark" />
</el-table>
<ExPagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
@pagination="getList" />
<!-- 履历编辑修改,新增弹窗-->
<el-dialog :title="title" :visible.sync="openTeacherResume" width="800px">
<el-form :model="resumeForm" :rules="resumeRules" ref="refresumeForm" size="small"
style="width: 90%; margin: auto" label-width="110px">
<el-form :model="resumeForm" :rules="resumeRules" ref="refresumeForm" size="small" style="width: 90%; margin: auto"
label-width="110px">
<el-form-item label="学校/工作单位" prop="learnSchool">
<el-input v-model="resumeForm.learnSchool" clearable style="width: 100%"/>
<el-input v-model="resumeForm.learnSchool" clearable style="width: 100%" />
</el-form-item>
<el-form-item label="履历开始时间" prop="learnStart">
<el-date-picker v-model="resumeForm.learnStart" type="date" style="width: 100%"
placeholder="履历开始时间"></el-date-picker>
placeholder="履历开始时间"></el-date-picker>
</el-form-item>
<el-form-item label="履历结束时间" clearable prop="learnEnd">
<el-date-picker v-model="resumeForm.learnEnd" type="date" style="width: 100%"
placeholder="履历结束时间"></el-date-picker>
placeholder="履历结束时间"></el-date-picker>
</el-form-item>
<el-form-item label="备注" clearable prop="remark">
<el-input type="textarea" :rows="3" style="width: 100%" v-model="resumeForm.remark" clearable/>
<el-input type="textarea" :rows="3" style="width: 100%" v-model="resumeForm.remark" clearable />
</el-form-item>
<el-form-item>
<div style="width: 300px; margin: auto">
......@@ -87,8 +86,8 @@
</template>
<script>
import {getInform} from '@/api/smartSchool/teacherManage/teacherInformation'
import {listResume, getOneResume, addResume, editResume, deleteResume} from '@/api/smartSchool/teacherManage/resume'
import { getInform } from '@/api/smartSchool/teacherManage/teacherInformation'
import { listResume, getOneResume, addResume, editResume, deleteResume } from '@/api/smartSchool/teacherManage/resume'
// import message from "@/views/home/message/message";
export default {
......@@ -126,9 +125,9 @@ export default {
resumeForm: {},
// 履历校验规则
resumeRules: {
learnSchool: [{required: true, message: '学校/工作单位不能为空', trigger: 'blur'}],
learnStart: [{required: true, message: '履历开始时间不能为空', trigger: 'blur'}],
learnEnd: [{required: true, message: '履历结束时间不能为空', trigger: 'blur'}]
learnSchool: [{ required: true, message: '学校/工作单位不能为空', trigger: 'blur' }],
learnStart: [{ required: true, message: '履历开始时间不能为空', trigger: 'blur' }],
learnEnd: [{ required: true, message: '履历结束时间不能为空', trigger: 'blur' }]
}
}
},
......@@ -280,7 +279,7 @@ export default {
// 关闭页面
closePage() {
this.$tab.closeOpenPage({
path: '/teacherManage/teacherInforManage'
path: '/schoolManage/teacherManage/teacherInforManage'
})
}
},
......
......@@ -28,7 +28,7 @@
</el-form-item>
<el-form-item label="职工类型" prop="employeeType">
<el-select v-model="queryParams.employeeType" placeholder="请选择职工类型">
<el-select v-model="queryParams.employeeType" placeholder="请选择职工类型" clearable>
<el-option v-for="dict in dict.type.employee_type" :key="dict.value" :label="dict.label"
:value="dict.value">
</el-option>
......@@ -456,6 +456,7 @@ export default {
education: null,
status: null,
deptId: null,
employeeType: null,
},
// 表单参数
form: {},
......
......@@ -10,12 +10,12 @@
<!-- </el-col>-->
<el-col :span="8" :offset="2">
<el-form-item label="登录账号" prop="phonenumber">
<el-input v-model="form.phonenumber" disabled/>
<el-input v-model="form.phonenumber" disabled />
</el-form-item>
</el-col>
<el-col :span="8" :offset="2">
<el-form-item label="用户名称" prop="userName">
<el-input v-model="form.userName" disabled/>
<el-input v-model="form.userName" disabled />
</el-form-item>
</el-col>
</el-row>
......@@ -23,24 +23,24 @@
<h4 class="form-header h4">角色信息</h4>
<el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table"
@selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)">
@selection-change="handleSelectionChange" :data="roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)">
<el-table-column type="selection" :reserve-selection="true" width="85"></el-table-column>
<el-table-column label="序号" type="index" align="center">
<template slot-scope="scope">
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="角色编号" align="center" prop="roleId"/>
<el-table-column label="角色名称" align="center" prop="roleName"/>
<el-table-column label="权限字符" align="center" prop="roleKey"/>
<!-- <el-table-column label="创建时间" align="center" prop="createTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createTime) }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="角色编号" align="center" prop="roleId" />
<el-table-column label="角色名称" align="center" prop="roleName" />
<el-table-column label="权限字符" align="center" prop="roleKey" />
<!-- <el-table-column label="创建时间" align="center" prop="createTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createTime) }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="pageNum" :limit.sync="pageSize"/>
<pagination v-show="total > 0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
<el-form label-width="100px">
<el-form-item style="text-align: center;margin-left:-120px;margin-top:30px;">
......@@ -52,7 +52,7 @@
</template>
<script>
import {getAuthRole, updateAuthRole} from "@/api/system/user";
import { getAuthRole, updateAuthRole } from "@/api/system/user";
export default {
name: "AuthRole",
......@@ -109,14 +109,14 @@ export default {
submitForm() {
const userId = this.form.userId;
const roleIds = this.roleIds.join(",");
updateAuthRole({userId: userId, roleIds: roleIds}).then((response) => {
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
this.$modal.msgSuccess("授权成功");
this.close();
});
},
/** 关闭按钮 */
close() {
const obj = {path: "/teacherManage/teacherInforManage"};
const obj = { path: "/schoolManage/teacherManage/teacherInforManage" };
this.$tab.closeOpenPage(obj);
},
},
......
<template>
<div>
<button @click="csToken">获取钉钉授权码</button>
<!-- <button @click="csToken">获取钉钉授权码</button> -->
</div>
</template>
......
......@@ -35,7 +35,7 @@ module.exports = {
host: "",
port: 1024,
hot: true,
open: true,
open: "chrome",
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
......@@ -44,10 +44,10 @@ module.exports = {
//target: ` http://43.143.63.140:8848`,
//target: ` http://43.143.63.140:8095`,
//部署时后端地址
target: `http://47.105.176.202:5131`,
//target: `http://47.105.176.202:8137`,
//学校内网
// target: `http://10.20.100.201:57321`,
// target: `http://47.105.176.202:5112`,
target: `http://47.105.176.202:5112`,
// target: `http://192.168.1.113:8848`,
changeOrigin: true,
......
......@@ -16,7 +16,9 @@ import com.ruoyi.common.annotation.Excel;
public class SchoolOrganizationSignin extends OurBaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
@Excel(name = "id")
private Long id;
/** 姓名 */
@Excel(name = "姓名")
private String name;
......
......@@ -33,4 +33,6 @@ public interface SchoolGradeMapper extends BaseMapper<SchoolGrade> {
List<SchoolGrade> selectNowSchoolGrade();
public Long selectDdClassId(String ddClssId);
String selectUpToYear();
}
......@@ -243,4 +243,9 @@ public class ISchoolGradeImpl extends ServiceImpl<SchoolGradeMapper, SchoolGrade
public Long selectDdClassId(String ddId) {
return schoolGradeMapper.selectDdClassId(ddId);
}
@Override
public String selectUpToYear() {
return schoolGradeMapper.selectUpToYear();
}
}
......@@ -26,5 +26,6 @@ public interface ISchoolGradeService extends IService<SchoolGrade> {
//获取最新学年
int isNewSchoolYear();
Long selectDdClassId(String ddId);
String selectUpToYear();
}
......@@ -6,8 +6,10 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiUserGetuserinfoRequest;
import com.dingtalk.api.request.OapiV2UserGetRequest;
import com.dingtalk.api.request.OapiV2UserGetuserinfoRequest;
import com.dingtalk.api.response.OapiUserGetuserinfoResponse;
import com.dingtalk.api.response.OapiV2UserGetResponse;
import com.dingtalk.api.response.OapiV2UserGetuserinfoResponse;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SchoolTeacher;
......@@ -55,40 +57,40 @@ public class DdLoginController {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public AjaxResult login (@RequestParam("code") String code) {
AjaxResult ajaxResult = new AjaxResult();
// // 获取access_token,注意正式代码要有异常流处理
// String access_token= accessTokenUtils.getToken();
// // 获取用户信息
// DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/getuserinfo");
// OapiUserGetuserinfoRequest request = new OapiUserGetuserinfoRequest();
// request.setCode(code);
// request.setHttpMethod("GET");
// OapiUserGetuserinfoResponse response;
// try {
// response = client.execute(request, access_token);
// } catch (ApiException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// return null;
// }
// // 查询得到当前用户的userId
// // 获得到userId之后应用应该处理应用自身的登录会话管理(session),避免后续的业务交互(前端到应用服务端)每次都要重新获取用户身份,提升用户体验
// String userId = response.getUserid();
// if (StringUtils.isEmpty(userId)){
// throw new ServiceException("免登码已失效,请重新获取");
// }
// //获取用户详细信息
// Map<String, Object> userInfo = getUserInfo(userId, access_token);
// String phone = (String) userInfo.get("phone");
// String unionId = (String) userInfo.get("unionId");
SchoolTeacher schoolTeacher = schoolTeacherService.selectTeacherByPhone("15888888888");
// 获取access_token,注意正式代码要有异常流处理
String access_token= accessTokenUtils.getToken();
// 获取用户信息
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/getuserinfo");
OapiUserGetuserinfoRequest request = new OapiUserGetuserinfoRequest();
request.setCode(code);
request.setHttpMethod("GET");
OapiUserGetuserinfoResponse response;
try {
response = client.execute(request, access_token);
} catch (ApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
// 查询得到当前用户的userId
// 获得到userId之后应用应该处理应用自身的登录会话管理(session),避免后续的业务交互(前端到应用服务端)每次都要重新获取用户身份,提升用户体验
String userId = response.getUserid();
if (StringUtils.isEmpty(userId)){
throw new ServiceException("免登码已失效,请重新获取");
}
//获取用户详细信息
Map<String, Object> userInfo = getUserInfo(userId, access_token);
String phone = (String) userInfo.get("phone");
String unionId = (String) userInfo.get("unionId");
SchoolTeacher schoolTeacher = schoolTeacherService.selectTeacherByPhone(phone);
if (StringUtils.isNull(schoolTeacher)){
throw new ServiceException("未查询到该用户信息");
}
Long userId = schoolTeacher.getId();
SysUser sysUser = sysUserService.selectUserById(userId);
Long userId1 = schoolTeacher.getId();
SysUser sysUser = sysUserService.selectUserById(userId1);
//更新钉钉用户iid和unionId
// sysUser.setUnionId(unionId);
// schoolTeacherService.updateDdUserId(sysUser, userId);
sysUser.setUnionId(unionId);
schoolTeacherService.updateDdUserId(sysUser, userId);
String token = loginService.loginNew(sysUser);
ajaxResult.put(Constants.TOKEN, token);
return ajaxResult;
......
package yangtz.cs.liu.dingding.controller;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/dd/school/dept")
public class DdSchoolDeptController {
@GetMapping("/getDeptList")
public TableDataInfo getDeptList(){
return null;
}
}
......@@ -2,44 +2,35 @@ package yangtz.cs.liu.dingding.controller;
import cn.hutool.http.HttpUtil;
//import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.entity.SchoolTeacher;
import com.ruoyi.common.core.domain.entity.SchoolTeacherCopy;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysUserService;
import org.apache.regexp.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import yangtz.cs.liu.campus.controller.schoolClass.SchoolClassController;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClass;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassCopy;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassHeadmaster;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassMentor;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGrade;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGradeCopy;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGradeMentor;
import yangtz.cs.liu.campus.domain.student.SchoolStudent;
import yangtz.cs.liu.campus.domain.student.SchoolStudentClassRelation;
import yangtz.cs.liu.campus.domain.student.SchoolStudentClasses;
import yangtz.cs.liu.campus.domain.student.SchoolStudentParent;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassCopyService;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassHeadmasterService;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassMentorService;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassService;
import yangtz.cs.liu.campus.service.schoolgrade.ISchoolGradeCopyService;
import yangtz.cs.liu.campus.service.schoolgrade.ISchoolGradeMentorService;
import yangtz.cs.liu.campus.service.schoolgrade.ISchoolGradeService;
import yangtz.cs.liu.campus.service.student.ISchoolStudentClassRelationService;
import yangtz.cs.liu.campus.service.student.ISchoolStudentClassesService;
import yangtz.cs.liu.campus.service.student.ISchoolStudentParentService;
import yangtz.cs.liu.campus.service.student.ISchoolStudentService;
import yangtz.cs.liu.campus.service.teacher.ISchoolTeacherCopyService;
import yangtz.cs.liu.campus.service.teacher.ISchoolTeacherService;
import yangtz.cs.liu.campus.vo.student.SchoolStudentVO;
import yangtz.cs.liu.campus.vo.teacher.SchoolTeacherVO;
......@@ -48,7 +39,6 @@ import yangtz.cs.liu.dingding.vo.DingJiaXiaoVo;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 家校通讯录
......@@ -68,9 +58,6 @@ public class DingJiaXiaoController {
@Autowired
ISchoolGradeService schoolGradeService;
//年级临时表
@Autowired
ISchoolGradeCopyService iSchoolGradeCopyService;
//职工与年级关系 ----------------
@Autowired
......@@ -78,9 +65,6 @@ public class DingJiaXiaoController {
//学校班级
@Autowired
ISchoolClassService iSchoolClassService;
//班级表临时
@Autowired
ISchoolClassCopyService iSchoolClassCopyService;
//班主任和班级关系 ------------------
@Autowired
ISchoolClassHeadmasterService iSchoolClassHeadmasterService;
......@@ -102,15 +86,10 @@ public class DingJiaXiaoController {
//老师表
@Autowired
ISchoolTeacherService schoolTeacherService;
//老师表 临时表
@Autowired
ISchoolTeacherCopyService schoolTeacherCopyService;
//用户表 ----------------
@Autowired
ISysUserService sysUserService;
public List<String> userTypes = new ArrayList<String>(){
{
this.add("teacher");
......@@ -284,7 +263,7 @@ public class DingJiaXiaoController {
@GetMapping("/updateLabUser")
private String updateLabUser(){
//查找当前学年 所有的班级
String nowSchoolYear = iSchoolGradeCopyService.selectUpToYear();
String nowSchoolYear = schoolGradeService.selectUpToYear();
SchoolClass schoolClass = new SchoolClass();
schoolClass.setSchoolYear(Integer.valueOf(nowSchoolYear));
List<SchoolClass> schoolClassCopies = iSchoolClassService.selectSchoolClassList(schoolClass);
......@@ -356,7 +335,7 @@ public class DingJiaXiaoController {
schoolStudentClassRelation.setClassId(date.getId());
iSchoolStudentClassRelationService.save(schoolStudentClassRelation);
//学生与班级历史关系
SchoolClassCopy school= iSchoolClassCopyService.selectSchoolClassById(date.getId());
SchoolClass school= iSchoolClassService.selectSchoolClassById(date.getId());
SchoolStudentClasses schoolStudentClasses = new SchoolStudentClasses();
schoolStudentClasses.setStudentId(schoolStudent.getId());
schoolStudentClasses.setGrade(school.getGradeName());
......
package yangtz.cs.liu.dingding.controller.dingDept;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import yangtz.cs.liu.dingding.service.impl.dingDept.DdDeptServcieImpl;
@RestController
@RequestMapping("/dd/school/dept")
public class DdDeptController extends BaseController {
@Autowired
private DdDeptServcieImpl ddDeptServcie;
/**
* 获取钉钉全部部门列表
*/
@GetMapping("/getDeptList")
public TableDataInfo getDeptList(){
return getDataTable(ddDeptServcie.getDeptList());
}
/**
* 下拉钉钉部门列表到系统
*/
@PostMapping("/addDdDept")
public AjaxResult addDdDept(){
return toAjax(ddDeptServcie.addDdDept());
}
/**
* 同步钉钉部门列表
*/
@GetMapping("/syncDdDept")
public AjaxResult syncDdDept(){
return AjaxResult.success(ddDeptServcie.syncDdDept());
}
}
......@@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yangtz.cs.liu.dingding.config.Constant;
import yangtz.cs.liu.dingding.utils.AccessTokenUtils;
import yangtz.cs.liu.dingding.service.impl.dingDept.DdDeptServcieImpl;
import yangtz.cs.liu.dingding.service.impl.dingUser.DdUserServiceImpl;
import yangtz.cs.liu.dingding.utils.DingCallbackCrypto;
import java.util.Map;
......@@ -20,6 +22,11 @@ public class DingEventController {
private static Logger log = LoggerFactory.getLogger(DingEventController.class);
@Autowired
private DdDeptServcieImpl ddDeptServcie;
@Autowired
private DdUserServiceImpl ddUserService;
@PostMapping("/callBack")
public Map<String, String> callBack(
@RequestParam(value = "msg_signature", required = false) String msg_signature,
......@@ -47,12 +54,26 @@ public class DingEventController {
// 测试回调url的正确性
log.info("测试回调url的正确性");
} else if ("user_add_org".equals(eventType)) {
// 处理通讯录用户增加事件
log.info("发生了:" + eventType + "事件");
// 处理通讯录用户增加
ddUserService.addUser(eventJson);
} else if ("user_modify_org".equals(eventType)) {
// 处理通讯录用户修改
ddUserService.updateUser(eventJson);
} else if ("user_leave_org".equals(eventType)) {
// 处理通讯录用户离职
ddUserService.leaveUser(eventJson);
} else if ("org_dept_create".equals(eventType)){
// 处理通讯录企业部门创建
ddDeptServcie.ddDeptCreate(eventJson);
} else if ("org_dept_modify".equals(eventType)){
// 处理通讯录企业部门修改
ddDeptServcie.ddDeptUpdate(eventJson);
} else if ("org_dept_remove".equals(eventType)){
// 处理通讯录企业部门删除
ddDeptServcie.ddDeptDelete(eventJson);
} else if ("bpms_instance_change".equals(eventType)){
// 处理审批实例事件
processInstance(eventJson);
log.info("发生了:" + eventType + "事件");
} else if ("bpms_task_change".equals(eventType)){
// 处理审批任务事件
eventJson.get("");
......@@ -70,16 +91,4 @@ public class DingEventController {
}
return null;
}
/**
* 处理审批实例事件
*/
public void processInstance(JSONObject eventJson){
//获取审批类型
String type = eventJson.getString("type");
//判断审批实例是否正常结束
if ("finish".equals(type)){
}
}
}
......@@ -4,10 +4,8 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import yangtz.cs.liu.dingding.service.impl.dingUser.DdUserServiceImpl;
import yangtz.cs.liu.dingding.utils.DingUserUtils;
/**
......@@ -18,42 +16,38 @@ import yangtz.cs.liu.dingding.utils.DingUserUtils;
public class DingUserController extends BaseController {
@Autowired
private DingUserUtils dingUserUtils;
private DdUserServiceImpl ddUserService;
/**
* 获取部门用户基础信息
* 获取钉钉所有用户id
*/
@GetMapping("/getUserByDeptId")
public TableDataInfo getUserByDeptId(@RequestParam("deptId") Long deptId,
@RequestParam("cursor") Long cursor,
@RequestParam("size") Long size,
@RequestParam("orderField") String orderField,
@RequestParam("containAccessLimit") String containAccessLimit,
@RequestParam("language") String language)
{
return getDataTable(dingUserUtils.getUserByDeptId(deptId, cursor, size, orderField, containAccessLimit, language));
@GetMapping("/getDdUserListAll")
public TableDataInfo getDdUserListAll(){
return getDataTable(ddUserService.getDdUserListAll());
}
/**
* 获取部门用户完整信息
* 下拉钉钉用户到系统
*/
@GetMapping("/getUserInfoByDeptId")
public TableDataInfo getUserInfoByDeptId(@RequestParam("deptId") Long deptId,
@RequestParam("cursor") Long cursor,
@RequestParam("size") Long size,
@RequestParam("orderField") String orderField,
@RequestParam("containAccessLimit") String containAccessLimit,
@RequestParam("language") String language)
{
return getDataTable(dingUserUtils.getUserInfoByDeptId(deptId, cursor, size, orderField, containAccessLimit, language));
@PostMapping("/addDdUser")
public AjaxResult addDdUser(){
return toAjax(ddUserService.addDdUser());
}
/**
* 获取用户详情
* 用户表数据同步到教师表
* @return
*/
@GetMapping("/getUser")
public AjaxResult getUser(@RequestParam("userId") String userId){
return AjaxResult.success(dingUserUtils.getUser(userId));
@PostMapping("/addDdTeacher")
public AjaxResult addDdTeacher(){
return toAjax(ddUserService.addDdTeacher());
}
/**
* 同步钉钉用户列表
*/
@GetMapping("/syncDdUser")
public AjaxResult syncDdUser(){
return AjaxResult.success(ddUserService.syncDdUser());
}
}
package yangtz.cs.liu.dingding.domain.dingDept;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
public class SysDdDept extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 部门ID */
private Long deptId;
/** 父部门ID */
private Long parentId;
/** 祖级列表 */
private String ancestors;
/** 部门名称 */
private String deptName;
/** 显示顺序 */
private Long orderNum;
/** 负责人 */
private String leader;
/** 联系电话 */
private String phone;
/** 邮箱 */
private String email;
/** 部门状态:0正常,1停用 */
private String status;
/** 钉钉部门id */
private Long ddDeptId;
/** 钉钉父部门id */
private Long ddParentId;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/** 父部门名称 */
private String parentName;
/** 子部门 */
private List<SysDdDept> children = new ArrayList<SysDdDept>();
public Long getDdDeptId() {
return ddDeptId;
}
public void setDdDeptId(Long ddDeptId) {
this.ddDeptId = ddDeptId;
}
public Long getDdParentId() {
return ddParentId;
}
public void setDdParentId(Long ddParentId) {
this.ddParentId = ddParentId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public String getAncestors()
{
return ancestors;
}
public void setAncestors(String ancestors)
{
this.ancestors = ancestors;
}
@NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName()
{
return deptName;
}
public void setDeptName(String deptName)
{
this.deptName = deptName;
}
@NotNull(message = "显示顺序不能为空")
public Long getOrderNum() {
return orderNum;
}
public void setOrderNum(Long orderNum) {
this.orderNum = orderNum;
}
public String getLeader()
{
return leader;
}
public void setLeader(String leader)
{
this.leader = leader;
}
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone()
{
return phone;
}
public void setPhone(String phone)
{
this.phone = phone;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public List<SysDdDept> getChildren() {
return children;
}
public void setChildren(List<SysDdDept> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("deptName", getDeptName())
.append("orderNum", getOrderNum())
.append("leader", getLeader())
.append("phone", getPhone())
.append("email", getEmail())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
package yangtz.cs.liu.dingding.domain.dingGrade;
import com.core.domain.OurBaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
public class SchoolGradeMentorCopy extends OurBaseEntity {
/** 老师主键 */
@NotNull(message = "级部教师不能为空")
private Long teacherId;
/** 年级级部主键 */
private Long gradeId;
/** 教师任职开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/** 教师任职结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
/** 类型(1年级部,2学科组长) */
private String type;
/** 职务 */
private String teacherPost;
/** 学科组(1物理学科组,2化学学科组,3生物学科组) */
private String subGroup;
}
package yangtz.cs.liu.dingding.domain.dingUser;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.xss.Xss;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
public class SysDdUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户ID */
@Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号")
private Long userId;
/** 部门ID */
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
private Long deptId;
/** 用户账号 */
@Excel(name = "登录名称")
private String userName;
// /** 用户昵称 */
// @Excel(name = "用户名称")
// private String nickName;
/** 登录名称 */
@Excel(name = "登录名称")
private String loginName;
/** 用户类型 */
private String userType;
/** 用户类型 */
private String userLoginType;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */
@Excel(name = "手机号码")
private String phonenumber;
/** 用户性别 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 用户头像 */
private String avatar;
/** 密码 */
private String password;
/** 盐加密 */
private String salt;
/** 帐号状态(0正常 1停用) */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/** 最后登录IP */
@Excel(name = "最后登录IP", type = Excel.Type.EXPORT)
private String loginIp;
/** 最后登录时间 */
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
private Date loginDate;
/** 密码最后更新时间 */
private Date pwdUpdateDate;
/** 微信openId */
private String openId;
/** 钉钉用户unionId */
private String unionId;
/** 钉钉用户id */
private String ddUserId;
/** 部门对象 */
@Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
})
private SysDept dept;
/** 用户所在部门列表 */
private List<Long> ddUserDepts;
/** 角色对象 */
private List<SysRole> roles;
/** 角色组 */
private Long[] roleIds;
/** 岗位组 */
private Long[] postIds;
/** 岗位组名称 */
private String postName;
/** 角色ID */
private Long roleId;
/** 职工类型(0带班,1不带班) */
private String employeeType;
/** 学生id */
private Long studentId;
/** 签名路径 */
private String sign;
public SysDdUser()
{
}
public List<Long> getDdUserDepts() {
return ddUserDepts;
}
public void setDdUserDepts(List<Long> ddUserDepts) {
this.ddUserDepts = ddUserDepts;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getDdUserId() {
return ddUserId;
}
public void setDdUserId(String ddUserId) {
this.ddUserId = ddUserId;
}
public SysDdUser(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public boolean isAdmin()
{
return isAdmin(this.userId);
}
public static boolean isAdmin(Long userId)
{
return userId != null && 1L == userId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber()
{
return phonenumber;
}
public void setPhonenumber(String phonenumber)
{
this.phonenumber = phonenumber;
}
public String getSex()
{
return sex;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getAvatar()
{
return avatar;
}
public void setAvatar(String avatar)
{
this.avatar = avatar;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getLoginIp()
{
return loginIp;
}
public void setLoginIp(String loginIp)
{
this.loginIp = loginIp;
}
public Date getLoginDate()
{
return loginDate;
}
public void setLoginDate(Date loginDate)
{
this.loginDate = loginDate;
}
public SysDept getDept()
{
return dept;
}
public void setDept(SysDept dept)
{
this.dept = dept;
}
public List<SysRole> getRoles()
{
return roles;
}
public void setRoles(List<SysRole> roles)
{
this.roles = roles;
}
public Long[] getRoleIds()
{
return roleIds;
}
public void setRoleIds(Long[] roleIds)
{
this.roleIds = roleIds;
}
public Long[] getPostIds()
{
return postIds;
}
public void setPostIds(Long[] postIds)
{
this.postIds = postIds;
}
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public Date getPwdUpdateDate() {
return pwdUpdateDate;
}
public void setPwdUpdateDate(Date pwdUpdateDate) {
this.pwdUpdateDate = pwdUpdateDate;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("deptId", getDeptId())
.append("loginName", getLoginName())
.append("userName", getUserName())
.append("userType", getUserType())
.append("email", getEmail())
.append("phonenumber", getPhonenumber())
.append("sex", getSex())
.append("avatar", getAvatar())
.append("password", getPassword())
.append("salt", getSalt())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("loginIp", getLoginIp())
.append("loginDate", getLoginDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("dept", getDept())
.append("roles", getRoles())
.toString();
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getUserLoginType() {
return userLoginType;
}
public void setUserLoginType(String userLoginType) {
this.userLoginType = userLoginType;
}
public String getEmployeeType() {
return employeeType;
}
public void setEmployeeType(String employeeType) {
this.employeeType = employeeType;
}
public Long getStudentId() {
return studentId;
}
public void setStudentId(Long studentId) {
this.studentId = studentId;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getPostName() {
return postName;
}
public void setPostName(String postName) {
this.postName = postName;
}
}
package yangtz.cs.liu.dingding.domain.dingUser;
import lombok.Data;
@Data
public class SysDdUserDept {
private Long userId;
private Long deptId;
}
package yangtz.cs.liu.dingding.domain.schoolTeacher;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.Date;
@Data
public class SysDdTeacher extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
/**
* 照片路径
*/
@Excel(name = "照片", cellType = Excel.ColumnType.IMAGE, height = 55, type = Excel.Type.EXPORT)
private String picUrl;
/**
* 老师名称
*/
@Excel(name = "老师名称")
@NotBlank(message = "老师名字不能为空")
private String teacherName;
/**
* 性别
*/
@Excel(name = "性别", readConverterExp = "0=男,1=女")
@NotBlank(message = "性别不能为空")
private String sex;
/**
* 民族
*/
@Excel(name = "民族")
private String nation;
/**
* 工作编号
*/
@Excel(name = "工作编号")
private String teacherCode;
/*
* 系统表 用户id
* */
@TableField(exist = false)
private Long userId;
/**
* 生日
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生日", width = 25, dateFormat = "yyyy-MM-dd")
private Date birthday;
/**
* 学历
*/
@Excel(name = "学历", readConverterExp = "0=高中,1=专科,2=本科,3=研究生,4=硕士,5=博士",combo = {"高中","专科","本科","研究生","硕士","博士"})
private String education;
/**
* 老师电话
*/
@Excel(name = "老师电话")
@NotBlank(message = "老师电话不能为空")
private String teacherTel;
/**
* 身份证号
*/
@Excel(name = "身份证号", width = 30)
@NotBlank(message = "身份证号不能为空")
private String idCard;
/**
* 家庭住址
*/
@Excel(name = "家庭住址", width = 35)
private String homeAddress;
/*
* 微信openid
* */
private String openId;
/*
* 钉钉用户unionId
* */
private String unionId;
/*
* 钉钉用户id
* */
private String ddUserId;
//设备工号
private String deviceNum;
/**部门id**/
@TableField(exist = false)
private Long deptId;
/**部门名称**/
@TableField(exist = false)
private String deptName;
/** 密码 */
@TableField(exist = false)
private String password;
/** 帐号状态(0正常 1停用) */
//@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
@TableField(exist = false)
private String status;
/**签名路径*/
@TableField(exist = false)
private String sign;
/**头像**/
@TableField(exist = false)
private String avatar;
/*职工类型**/
@TableField(exist = false)
private String employeeType;
@TableField(exist = false)
private String email;
/** 父部门ID */
@TableField(exist = false)
private Long parentId;
/** 父部门名称 */
@TableField(exist = false)
private String parentName;
}
package yangtz.cs.liu.dingding.mapper.dingDept;
import yangtz.cs.liu.dingding.domain.dingDept.SysDdDept;
import java.util.List;
import java.util.Map;
public interface DdDeptMapper {
/**
* 查询系统部门列表
* @param sysDdDept
* @return
*/
List<SysDdDept> selectDdDeptList(SysDdDept sysDdDept);
/**
* 根据钉钉部门id查询系统部门信息
*/
SysDdDept selectDeptByDdDeptId(Long ddDeptId);
/**
* 根据部门id查询系统部门信息
*/
SysDdDept selectDeptByDeptId(Long deptId);
/**
* 查询级部信息
*/
List<Map<String,Object>> selectGradeList();
/**
* 新增钉钉部门
* @return
*/
int insertDdDept(SysDdDept sysDdDept);
/**
* 更新钉钉部门
* @param sysDdDept
* @return
*/
int updateDdDeptByDdDeptId(SysDdDept sysDdDept);
/**
* 删除部门
* @param deptId
* @return
*/
int deleteDdDeptById(Long deptId);
/**
* 根据钉钉部门id删除部门
* @param ddDeptId
* @return
*/
int deleteDdDeptByDdDeptId(Long ddDeptId);
}
package yangtz.cs.liu.dingding.mapper.dingUser;
import org.apache.ibatis.annotations.Param;
import yangtz.cs.liu.dingding.domain.dingGrade.SchoolGradeMentorCopy;
import yangtz.cs.liu.dingding.domain.dingUser.SysDdUser;
import yangtz.cs.liu.dingding.domain.dingUser.SysDdUserDept;
import java.util.List;
public interface DdUserMapper {
/**
* 批量新增钉钉用户
*/
int batchInsertDdUser(@Param("list") List<SysDdUser> list);
/**
* 新增用户
*/
int insertDdUser(SysDdUser sysDdUser);
/**
* 更新用户
*/
int updateDdUser(SysDdUser sysDdUser);
/**
* 查询全部用户
*/
List<SysDdUser> selectDdUserList(SysDdUser sysDdUser);
/**
* 新增用户部门关系
*/
int insertDdUserDept(SysDdUserDept sysDdUserDept);
/**
* 删除用户
*/
int deleteDdUser(Long userId);
/**
* 删除用户和部门关系
*/
int deleteDdUserDept(Long userId);
/**
* 删除教师
*/
int deleteDdTeacher(Long userId);
/**
* 根据用户id查询用户部门id列表
*/
List<Long> selectDeptIdByUserId(Long userId);
/**
* 根据钉钉用户id查询用户信息
* @param ddUserId
* @return
*/
SysDdUser selectDdUserByDdUserId(String ddUserId);
/**
* 新增级部成员
* @param schoolGradeMentorCopy
* @return
*/
int insertGradeMentor(SchoolGradeMentorCopy schoolGradeMentorCopy);
/**
* 删除级部成员
* @param userId
* @return
*/
int deleteGradeMentor(Long userId);
}
package yangtz.cs.liu.dingding.mapper.schoolTeacher;
import org.apache.ibatis.annotations.Param;
import yangtz.cs.liu.dingding.domain.schoolTeacher.SysDdTeacher;
import java.util.List;
public interface DdTeacherMapper {
/**
* 批量新增教师
*/
int batchInsertTeacher(@Param("list") List<SysDdTeacher> list);
/**
* 新增教师
*/
int addTeacherList(SysDdTeacher sysDdTeacher);
/**
* 更新教师信息
*/
int updateDdTeacher(SysDdTeacher sysDdTeacher);
}
package yangtz.cs.liu.dingding.service.dingDept;
import com.alibaba.fastjson.JSONObject;
import com.dingtalk.api.response.OapiV2DepartmentListsubResponse;
import java.util.List;
public interface IDdDeptService {
/**
* 获取钉钉全部部门列表
* @return
*/
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> getDeptList();
/**
* 下拉钉钉部门列表到系统
* @return
*/
int addDdDept();
/**
* 同步钉钉部门列表
* @return
*/
String syncDdDept();
/**
* 钉钉部门创建
*/
int ddDeptCreate(JSONObject eventJson);
/**
* 钉钉部门修改
*/
int ddDeptUpdate(JSONObject eventJson);
/**
* 钉钉部门删除
*/
int ddDeptDelete(JSONObject eventJson);
}
package yangtz.cs.liu.dingding.service.dingUser;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
public interface IDdUserService {
/**
* 获取钉钉全部用户id
*/
List<String> getDdUserListAll();
/**
* 下拉钉钉用户到系统
*/
int addDdUser();
/**
* 用户表数据同步到教师表
* @return
*/
int addDdTeacher();
/**
* 同步钉钉用户
*/
String syncDdUser();
/**
* 处理通讯录用户增加
*/
int addUser(JSONObject eventJson);
/**
* 处理通讯录用户修改
*/
int updateUser(JSONObject eventJson);
/**
* 处理通讯录用户离职
*/
int leaveUser(JSONObject eventJson);
}
package yangtz.cs.liu.dingding.service.impl.dingDept;
import com.alibaba.fastjson.JSONObject;
import com.dingtalk.api.response.OapiV2DepartmentGetResponse;
import com.dingtalk.api.response.OapiV2DepartmentListsubResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import yangtz.cs.liu.dingding.domain.dingDept.SysDdDept;
import yangtz.cs.liu.dingding.mapper.dingDept.DdDeptMapper;
import yangtz.cs.liu.dingding.service.dingDept.IDdDeptService;
import yangtz.cs.liu.dingding.utils.DingDeptUtils;
import java.util.ArrayList;
import java.util.List;
@Service
public class DdDeptServcieImpl implements IDdDeptService {
@Autowired
private DingDeptUtils dingDeptUtils;
@Autowired
private DdDeptMapper ddDeptMapper;
/**
* 获取钉钉全部部门列表
* @return
*/
@Override
public List<OapiV2DepartmentListsubResponse.DeptBaseResponse> getDeptList() {
Long deptId = 1L;
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptListAll = new ArrayList<>();
//一级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList = dingDeptUtils.getDeptList(deptId, "");
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response : deptList) {
if (response.getDeptId() != -7){
deptListAll.add(response);
//二级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList1 = dingDeptUtils.getDeptList(response.getDeptId(), "");
if (deptList1.size() > 0) {
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response1 : deptList1) {
deptListAll.add(response1);
//三级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList2 = dingDeptUtils.getDeptList(response1.getDeptId(), "");
if (deptList2.size() > 0){
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response2 : deptList2) {
deptListAll.add(response2);
//四级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList3 = dingDeptUtils.getDeptList(response2.getDeptId(), "");
if (deptList3.size() > 0){
deptListAll.addAll(deptList3);
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response3 : deptList3) {
//五级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList4 = dingDeptUtils.getDeptList(response3.getDeptId(), "");
if (deptList4.size() > 0){
deptListAll.addAll(deptList4);
}
}
}
}
}
}
}
}
}
return deptListAll;
}
/**
* 下拉钉钉部门列表到系统
* @return
*/
@Override
@Transactional
public int addDdDept() {
Long deptId = 1L;
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept = dingDeptUtils.getDept(deptId, "");
//新增顶级目录
SysDdDept sysDdDept = new SysDdDept();
sysDdDept.setDeptId(100L);
sysDdDept.setParentId(0L);
sysDdDept.setAncestors("0");
sysDdDept.setDeptName(dept.getName());
sysDdDept.setOrderNum(0L);
sysDdDept.setDdDeptId(dept.getDeptId());
sysDdDept.setDdParentId(0L);
sysDdDept.setCreateBy("钉钉管理员");
ddDeptMapper.insertDdDept(sysDdDept);
//全部部门列表
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptListAll = new ArrayList<>();
//一级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList = dingDeptUtils.getDeptList(deptId, "");
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response : deptList) {
if (response.getDeptId() != -7){
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept1 = dingDeptUtils.getDept(response.getDeptId(), "");
//新增一级目录
SysDdDept sysDdDept1 = new SysDdDept();
sysDdDept1.setParentId(sysDdDept.getDeptId());
sysDdDept1.setAncestors("0," + sysDdDept.getDeptId());
sysDdDept1.setDeptName(response.getName());
sysDdDept1.setOrderNum(dept1.getOrder());
sysDdDept1.setDdDeptId(response.getDeptId());
sysDdDept1.setDdParentId(response.getParentId());
sysDdDept1.setCreateBy("钉钉管理员");
ddDeptMapper.insertDdDept(sysDdDept1);
deptListAll.add(response);
//二级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList1 = dingDeptUtils.getDeptList(response.getDeptId(), "");
if (deptList1.size() > 0) {
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response1 : deptList1) {
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept2 = dingDeptUtils.getDept(response1.getDeptId(), "");
//新增二级目录
SysDdDept sysDdDept2 = new SysDdDept();
sysDdDept2.setParentId(sysDdDept1.getDeptId());
sysDdDept2.setAncestors(sysDdDept1.getAncestors() + "," + sysDdDept1.getDeptId());
sysDdDept2.setDeptName(response1.getName());
sysDdDept2.setOrderNum(dept2.getOrder());
sysDdDept2.setDdDeptId(response1.getDeptId());
sysDdDept2.setDdParentId(response1.getParentId());
sysDdDept2.setCreateBy("钉钉管理员");
ddDeptMapper.insertDdDept(sysDdDept2);
deptListAll.add(response1);
//三级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList2 = dingDeptUtils.getDeptList(response1.getDeptId(), "");
if (deptList2.size() > 0){
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response2 : deptList2) {
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept3 = dingDeptUtils.getDept(response2.getDeptId(), "");
//新增三级目录
SysDdDept sysDdDept3 = new SysDdDept();
sysDdDept3.setParentId(sysDdDept2.getDeptId());
sysDdDept3.setAncestors(sysDdDept2.getAncestors() + "," + sysDdDept2.getDeptId());
sysDdDept3.setDeptName(response2.getName());
sysDdDept3.setOrderNum(dept3.getOrder());
sysDdDept3.setDdDeptId(response2.getDeptId());
sysDdDept3.setDdParentId(response2.getParentId());
sysDdDept3.setCreateBy("钉钉管理员");
ddDeptMapper.insertDdDept(sysDdDept3);
deptListAll.add(response2);
//四级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList3 = dingDeptUtils.getDeptList(response2.getDeptId(), "");
if (deptList3.size() > 0){
deptListAll.addAll(deptList3);
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response3 : deptList3) {
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept4 = dingDeptUtils.getDept(response3.getDeptId(), "");
//新增四级目录
SysDdDept sysDdDept4 = new SysDdDept();
sysDdDept4.setParentId(sysDdDept3.getDeptId());
sysDdDept4.setAncestors(sysDdDept3.getAncestors() + "," + sysDdDept3.getDeptId());
sysDdDept4.setDeptName(response3.getName());
sysDdDept4.setOrderNum(dept4.getOrder());
sysDdDept4.setDdDeptId(response3.getDeptId());
sysDdDept4.setDdParentId(response3.getParentId());
sysDdDept4.setCreateBy("钉钉管理员");
ddDeptMapper.insertDdDept(sysDdDept4);
//五级
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptList4 = dingDeptUtils.getDeptList(response3.getDeptId(), "");
if (deptList4.size() > 0){
deptListAll.addAll(deptList4);
for (OapiV2DepartmentListsubResponse.DeptBaseResponse response4 : deptList4) {
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept5 = dingDeptUtils.getDept(response4.getDeptId(), "");
//新增五级目录
SysDdDept sysDdDept5 = new SysDdDept();
sysDdDept5.setParentId(sysDdDept4.getDeptId());
sysDdDept5.setAncestors(sysDdDept4.getAncestors() + "," + sysDdDept4.getDeptId());
sysDdDept5.setDeptName(response4.getName());
sysDdDept5.setOrderNum(dept5.getOrder());
sysDdDept5.setDdDeptId(response4.getDeptId());
sysDdDept5.setDdParentId(response4.getParentId());
sysDdDept5.setCreateBy("钉钉管理员");
ddDeptMapper.insertDdDept(sysDdDept5);
}
}
}
}
}
}
}
}
}
}
return 1;
}
/**
* 同步钉钉部门列表
* @return
*/
@Override
@Transactional
public String syncDdDept() {
//获取钉钉所有部门列表
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> ddDeptList = getDeptList();
//存放钉钉部门不存在系统库集合
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> ddDeptList1 = new ArrayList<>();
ddDeptList1.addAll(ddDeptList);
//获取系统所有部门列表
List<SysDdDept> deptList = ddDeptMapper.selectDdDeptList(new SysDdDept());
//存放钉钉删除了的部门集合
List<SysDdDept> deptList1 = new ArrayList<>();
deptList1.addAll(deptList);
//判断钉钉部门列表是否都在系统部门列表中
for (OapiV2DepartmentListsubResponse.DeptBaseResponse ddDept : ddDeptList) {
for (SysDdDept dept : deptList) {
if (ddDept.getDeptId().equals(dept.getDdDeptId())){
//存在,从集合中去除
ddDeptList1.remove(ddDept);
}
}
}
//新增不存在系统库的部门
if(ddDeptList1.size() > 0){
for (OapiV2DepartmentListsubResponse.DeptBaseResponse ddDept : ddDeptList1) {
//钉钉父部门id
Long ddParentId = ddDept.getParentId();
//查询父部门信息
SysDdDept ddDept1 = ddDeptMapper.selectDeptByDdDeptId(ddParentId);
//新增
SysDdDept sysDdDept = new SysDdDept();
sysDdDept.setParentId(ddDept1.getDeptId());
sysDdDept.setAncestors(ddDept1.getAncestors() + ddDept1.getDeptId());
sysDdDept.setDeptName(ddDept.getName());
sysDdDept.setOrderNum(ddDept.getDeptId());
sysDdDept.setDdDeptId(ddDept.getDeptId());
sysDdDept.setDdParentId(ddParentId);
sysDdDept.setCreateBy("钉钉管理员");
ddDeptMapper.insertDdDept(sysDdDept);
}
}
//判断钉钉中删除的部门是否还存在系统部门中
for (SysDdDept dept : deptList) {
for (OapiV2DepartmentListsubResponse.DeptBaseResponse ddDept : ddDeptList) {
if (dept.getDdDeptId().equals(ddDept.getDeptId())){
deptList1.remove(dept);
}
}
}
//删除系统部门中存在的钉钉已删除的部门
if (deptList1.size() > 0){
for (SysDdDept dept : deptList1) {
if (dept.getDeptId() != 100){
ddDeptMapper.deleteDdDeptById(dept.getDeptId());
}
}
}
//更新系统部门信息
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse djDept = dingDeptUtils.getDept(1L, "");
//修改顶级目录
SysDdDept dept = new SysDdDept();
dept.setDdDeptId(djDept.getDeptId());
dept.setDeptName(djDept.getName());
dept.setUpdateBy("钉钉管理员");
ddDeptMapper.updateDdDeptByDdDeptId(dept);
for (OapiV2DepartmentListsubResponse.DeptBaseResponse ddDept : ddDeptList) {
for (SysDdDept sysDdDept : deptList) {
if (ddDept.getDeptId().equals(sysDdDept.getDdDeptId())){
//判断父部门是否发生改变
if (!(ddDept.getParentId().equals(sysDdDept.getDdParentId()))){
//钉钉父部门id
Long ddParentId = ddDept.getParentId();
//查询父部门信息
SysDdDept ddParentDept = ddDeptMapper.selectDeptByDdDeptId(ddParentId);
sysDdDept.setParentId(ddParentDept.getDeptId());
sysDdDept.setAncestors(ddParentDept.getAncestors() + "," + ddParentDept.getDeptId());
sysDdDept.setDdParentId(ddDept.getParentId());
sysDdDept.setUpdateBy("钉钉管理员");
ddDeptMapper.updateDdDeptByDdDeptId(sysDdDept);
}
//判断部门基本信息是否发生改变
if(!(ddDept.getName().equals(sysDdDept.getDeptName()))){
sysDdDept.setDeptName(ddDept.getName());
sysDdDept.setUpdateBy("钉钉管理员");
ddDeptMapper.updateDdDeptByDdDeptId(sysDdDept);
}
}
}
}
return "同步成功";
}
/**
* 钉钉部门创建
* @param eventJson
* @return
*/
@Override
@Transactional
public int ddDeptCreate(JSONObject eventJson) {
int i= 0;
String ddDeptId = eventJson.getString("DeptId");
String replace = ddDeptId.replace("[", "");
String deptIds = replace.replace("]", "");
String[] split = deptIds.split(",");
for (String deptId : split) {
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept = dingDeptUtils.getDept(Long.valueOf(deptId), "");
//获取父部门信息
Long ddParentId = dept.getParentId();
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDdDeptId(ddParentId);
//新增部门
SysDdDept ddDept = new SysDdDept();
ddDept.setParentId(sysDdDept.getDeptId());
ddDept.setAncestors(sysDdDept.getAncestors() + "," + sysDdDept.getDeptId());
ddDept.setDeptName(dept.getName());
ddDept.setOrderNum(dept.getOrder());
ddDept.setDdDeptId(dept.getDeptId());
ddDept.setDdParentId(dept.getParentId());
ddDept.setCreateBy("钉钉管理员");
i += ddDeptMapper.insertDdDept(ddDept);
}
return i;
}
/**
* 钉钉部门修改
* @param eventJson
* @return
*/
@Override
public int ddDeptUpdate(JSONObject eventJson) {
int i = 0;
String ddDeptId = eventJson.getString("DeptId");
String replace = ddDeptId.replace("[", "");
String deptIds = replace.replace("]", "");
String[] split = deptIds.split(",");
for (String deptId : split) {
//获取部门详情
OapiV2DepartmentGetResponse.DeptGetResponse dept = dingDeptUtils.getDept(Long.valueOf(deptId), "");
//获取父部门信息
Long ddParentId = dept.getParentId();
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDdDeptId(ddParentId);
//修改部门
SysDdDept ddDept = new SysDdDept();
ddDept.setParentId(sysDdDept.getDeptId());
ddDept.setAncestors(sysDdDept.getAncestors() + "," + sysDdDept.getDeptId());
ddDept.setDeptName(dept.getName());
ddDept.setOrderNum(dept.getOrder());
ddDept.setDdDeptId(dept.getDeptId());
ddDept.setDdParentId(dept.getParentId());
ddDept.setCreateBy("钉钉管理员");
i += ddDeptMapper.updateDdDeptByDdDeptId(ddDept);
}
return i;
}
/**
* 钉钉部门删除
* @param eventJson
* @return
*/
@Override
public int ddDeptDelete(JSONObject eventJson) {
int i = 0;
String ddDeptId = eventJson.getString("DeptId");
String replace = ddDeptId.replace("[", "");
String deptIds = replace.replace("]", "");
String[] split = deptIds.split(",");
for (String deptId : split) {
//删除钉钉部门
i += ddDeptMapper.deleteDdDeptByDdDeptId(Long.valueOf(deptId));
}
return i;
}
}
package yangtz.cs.liu.dingding.service.impl.dingUser;
import com.alibaba.fastjson.JSONObject;
import com.dingtalk.api.response.OapiUserListidResponse;
import com.dingtalk.api.response.OapiV2UserGetResponse;
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 org.springframework.transaction.annotation.Transactional;
import yangtz.cs.liu.dingding.domain.dingDept.SysDdDept;
import yangtz.cs.liu.dingding.domain.dingGrade.SchoolGradeMentorCopy;
import yangtz.cs.liu.dingding.domain.dingUser.SysDdUser;
import yangtz.cs.liu.dingding.domain.dingUser.SysDdUserDept;
import yangtz.cs.liu.dingding.domain.schoolTeacher.SysDdTeacher;
import yangtz.cs.liu.dingding.mapper.dingDept.DdDeptMapper;
import yangtz.cs.liu.dingding.mapper.dingUser.DdUserMapper;
import yangtz.cs.liu.dingding.mapper.schoolTeacher.DdTeacherMapper;
import yangtz.cs.liu.dingding.service.dingUser.IDdUserService;
import yangtz.cs.liu.dingding.utils.DingUserUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class DdUserServiceImpl implements IDdUserService {
@Autowired
private DingUserUtils dingUserUtils;
@Autowired
private DdDeptMapper ddDeptMapper;
@Autowired
private DdUserMapper ddUserMapper;
@Autowired
private DdTeacherMapper ddTeacherMapper;
/**
* 获取钉钉全部用户id
* @return
*/
@Override
public List<String> getDdUserListAll() {
//存放钉钉用户id的集合
List<String> ddUserIds = new ArrayList<>();
//获取系统所有部门列表
List<SysDdDept> ddDeptListAll = ddDeptMapper.selectDdDeptList(new SysDdDept());
for (SysDdDept ddDept : ddDeptListAll) {
//循环查找每个部门的用户id列表
OapiUserListidResponse.ListUserByDeptResponse ddUserIdList = dingUserUtils.getuserIdByDept(ddDept.getDdDeptId());
List<String> useridList = ddUserIdList.getUseridList();
if (useridList.size() > 0) {
for (String ddUserId : useridList) {
if (!ddUserIds.contains(ddUserId)){
ddUserIds.add(ddUserId);
}
}
}
}
return ddUserIds;
}
/**
* 下拉钉钉用户到系统
* @return
*/
@Override
@Transactional
public int addDdUser() {
int i = 1;
//查询所有级部
List<Map<String, Object>> gradeList = ddDeptMapper.selectGradeList();
//新增的用户的集合
//用户表
List<SysDdUser> userList = new ArrayList<>();
//教师表
List<SysDdTeacher> teacherList = new ArrayList<>();
//获取钉钉全部用户id
List<String> ddUserIdList = getDdUserListAll();
for (String ddUserId : ddUserIdList) {
//循环获取钉钉用户详情
OapiV2UserGetResponse.UserGetResponse ddUser = dingUserUtils.getUser(ddUserId);
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//拿取钉钉用户部门id列表的第一个存在的部门id存到用户表中
//部门列表
List<Long> deptIdList = ddUser.getDeptIdList();
//用户部门列表
List<Long> ddUserDepts = new ArrayList<>();
for (Long ddUserDeptId : deptIdList) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
}
}
//用户表数据
SysDdUser sysDdUser = new SysDdUser();
sysDdUser.setDdUserDepts(ddUserDepts);
//根据钉钉部门id查询部门信息
for (Long ddDeptId : deptIdList) {
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(ddDeptId);
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
break;
}
}
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPassword(SecurityUtils.encryptPassword("Ez2023@345"));
sysDdUser.setUserName(ddUser.getName());
sysDdUser.setUserType("00");
sysDdUser.setUserLoginType("0");
sysDdUser.setPhonenumber(ddUser.getMobile());
sysDdUser.setCreateBy("钉钉管理员");
sysDdUser.setUnionId(ddUser.getUnionid());
sysDdUser.setDdUserId(ddUser.getUserid());
if (StringUtils.isNotEmpty(ddUser.getEmail())){
sysDdUser.setEmail(ddUser.getEmail());
}
if (StringUtils.isNotEmpty(ddUser.getAvatar())){
sysDdUser.setAvatar(ddUser.getAvatar());
}
if (StringUtils.isNotEmpty(ddUser.getRemark())){
sysDdUser.setRemark(ddUser.getRemark());
}
ddUserMapper.insertDdUser(sysDdUser);
userList.add(sysDdUser);
//新增教师数据
SysDdTeacher sysDdTeacher = new SysDdTeacher();
sysDdTeacher.setId(sysDdUser.getUserId());
sysDdTeacher.setTeacherName(sysDdUser.getUserName());
sysDdTeacher.setTeacherTel(sysDdUser.getPhonenumber());
if (StringUtils.isNotEmpty(sysDdUser.getAvatar())){
sysDdTeacher.setPicUrl(sysDdUser.getAvatar());
}
sysDdTeacher.setUnionId(sysDdUser.getUnionId());
sysDdTeacher.setDdUserId(sysDdUser.getDdUserId());
sysDdTeacher.setCreateBy("钉钉管理员");
sysDdTeacher.setCreateTime(DateUtils.getNowDate());
ddTeacherMapper.addTeacherList(sysDdTeacher);
//判断用户是否为级部成员
for (Long deptId : ddUserDepts) {
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(deptId);
//判断是否是年级部成员
if ("年级部".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("1");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
//判断是否是学科组长成员
if ("学科组长".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("2");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
}
}
//新增用户和部门关系
for (SysDdUser ddUser : userList) {
SysDdUserDept sysDdUserDept = new SysDdUserDept();
sysDdUserDept.setUserId(ddUser.getUserId());
for (Long ddUserDept : ddUser.getDdUserDepts()) {
sysDdUserDept.setDeptId(ddUserDept);
ddUserMapper.insertDdUserDept(sysDdUserDept);
}
}
return i;
}
/**
* 用户表数据新增到教师表
*/
@Override
public int addDdTeacher() {
//查询所有用户
List<SysDdUser> userList = ddUserMapper.selectDdUserList(new SysDdUser());
for (SysDdUser ddUser : userList) {
}
return 1;
}
/**
* 同步钉钉用户列表
* @return
*/
@Override
@Transactional
public String syncDdUser() {
//查询所有级部
List<Map<String, Object>> gradeList = ddDeptMapper.selectGradeList();
//获取钉钉全部用户id
List<String> ddUserIdList = getDdUserListAll();
//获取钉钉全部用户详情
List<OapiV2UserGetResponse.UserGetResponse> ddUserAll = new ArrayList<>();
//存放钉钉用户不存在系统库的用户id
List<String> ddUserIdList1 = new ArrayList<>();
ddUserIdList1.addAll(ddUserIdList);
//循环获取所有用户详情
for (String ddUserId : ddUserIdList) {
OapiV2UserGetResponse.UserGetResponse ddUser = dingUserUtils.getUser(ddUserId);
ddUserAll.add(ddUser);
}
//获取系统全部用户
List<SysDdUser> userList = ddUserMapper.selectDdUserList(new SysDdUser());
//存放钉钉已删除的用户集合
List<SysDdUser> userList1 = new ArrayList<>();
userList1.addAll(userList);
//获取所有部门
List<SysDdDept> deptList = ddDeptMapper.selectDdDeptList(new SysDdDept());
//判断系统用户列表是否存在钉钉用户id
for (String ddUserId : ddUserIdList) {
for (SysDdUser ddUser : userList) {
if (ddUserId.equals(ddUser.getDdUserId())){
//存在,从集合中剔除
ddUserIdList1.remove(ddUserId);
}
}
}
//新增系统不存在的钉钉用户
if(ddUserIdList1.size() > 0){
for (String ddUserId : ddUserIdList1) {
for (OapiV2UserGetResponse.UserGetResponse ddUser : ddUserAll) {
if (ddUserId.equals(ddUser.getUserid())){
//拿取钉钉用户部门id列表的第一个存在的部门id存到用户表中
//部门列表
List<Long> deptIdList = ddUser.getDeptIdList();
//用户部门列表
List<Long> ddUserDepts = new ArrayList<>();
for (Long ddUserDeptId : deptIdList) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
}
}
//根据钉钉部门id查询部门信息
//新增用户到用户表
SysDdUser sysDdUser = new SysDdUser();
sysDdUser.setDdUserDepts(ddUserDepts);
//根据钉钉部门id查询部门信息
for (Long ddDeptId : deptIdList) {
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(ddDeptId);
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
break;
}
}
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPassword(SecurityUtils.encryptPassword("Ez2023@345"));
sysDdUser.setUserName(ddUser.getName());
sysDdUser.setUserType("00");
sysDdUser.setUserLoginType("0");
sysDdUser.setPhonenumber(ddUser.getMobile());
sysDdUser.setCreateBy("钉钉管理员");
sysDdUser.setUnionId(ddUser.getUnionid());
sysDdUser.setDdUserId(ddUser.getUserid());
if (StringUtils.isNotEmpty(ddUser.getEmail())){
sysDdUser.setEmail(ddUser.getEmail());
}
if (StringUtils.isNotEmpty(ddUser.getAvatar())){
sysDdUser.setAvatar(ddUser.getAvatar());
}
if (StringUtils.isNotEmpty(ddUser.getRemark())){
sysDdUser.setRemark(ddUser.getRemark());
}
ddUserMapper.insertDdUser(sysDdUser);
//新增用户和部门关系
SysDdUserDept sysDdUserDept = new SysDdUserDept();
sysDdUserDept.setUserId(sysDdUser.getUserId());
for (Long ddUserDept : sysDdUser.getDdUserDepts()) {
sysDdUserDept.setDeptId(ddUserDept);
ddUserMapper.insertDdUserDept(sysDdUserDept);
}
//新增用户到教师表
SysDdTeacher sysDdTeacher = new SysDdTeacher();
sysDdTeacher.setId(sysDdUser.getUserId());
sysDdTeacher.setTeacherName(sysDdUser.getUserName());
sysDdTeacher.setTeacherTel(sysDdUser.getPhonenumber());
if (StringUtils.isNotEmpty(sysDdUser.getAvatar())){
sysDdTeacher.setPicUrl(sysDdUser.getAvatar());
}
sysDdTeacher.setUnionId(sysDdUser.getUnionId());
sysDdTeacher.setDdUserId(sysDdUser.getDdUserId());
sysDdTeacher.setCreateBy("钉钉管理员");
sysDdTeacher.setCreateTime(DateUtils.getNowDate());
ddTeacherMapper.addTeacherList(sysDdTeacher);
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//判断用户是否是级部成员,如果是,新增到级部成员
for (Long deptId : ddUserDepts) {
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(deptId);
//判断是否是年级部成员
if ("年级部".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("1");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
//判断是否是学科组长成员
if ("学科组长".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("2");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
}
}
}
}
}
//判断钉钉已删除的用户
for (SysDdUser ddUser : userList) {
for (String ddUserId : ddUserIdList) {
if (ddUser.getDdUserId().equals(ddUserId)){
//存在从集合中剔除
userList1.remove(ddUser);
}
}
}
//删除钉钉中已删除的用户
if (userList1.size() > 0){
for (SysDdUser ddUser : userList1) {
//删除用户
ddUserMapper.deleteDdUser(ddUser.getUserId());
//删除用户和部门关系
ddUserMapper.deleteDdUserDept(ddUser.getUserId());
//删除教师
ddUserMapper.deleteDdTeacher(ddUser.getUserId());
//删除级部成员信息
ddUserMapper.deleteGradeMentor(ddUser.getUserId());
}
}
//更新系统用户信息
for (OapiV2UserGetResponse.UserGetResponse ddUser : ddUserAll) {
for (SysDdUser sysDdUser : userList) {
if (ddUser.getUserid().equals(sysDdUser.getDdUserId())){
//多部门任职信息
List<OapiV2UserGetResponse.DeptPosition> deptPositionList = ddUser.getDeptPositionList();
//系统用户部门列表
List<Long> ddUserDepts = ddUserMapper.selectDeptIdByUserId(sysDdUser.getUserId());
//存放钉钉部门id列表
List<Long> ddDeptIds = new ArrayList<>();
for (Long ddUserDept : ddUserDepts) {
for (SysDdDept dept : deptList) {
if (ddUserDept.equals(dept.getDeptId())){
ddDeptIds.add(dept.getDdDeptId());
}
}
}
//钉钉用户部门id列表
List<Long> deptIdList = ddUser.getDeptIdList();
//钉钉用户部门id列表(不包含钉钉已删除的部门)
List<Long> deptIdList1 = new ArrayList<>();
deptIdList1.addAll(deptIdList);
//去除掉钉钉已删除的部门id
for (Long ddUserDeptId : deptIdList) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
if (StringUtils.isNull(dept1)){
deptIdList1.remove(ddUserDeptId);
}
}
//更新的部门id列表
List<Long> deptIds = new ArrayList<>();
//判断系统用户和钉钉用户部门是否发生改变
boolean isEqual = ddDeptIds.containsAll(deptIdList1) && deptIdList1.containsAll(ddDeptIds);
if (!isEqual) {
//发生改变更新用户信息
for (Long ddUserDeptId : deptIdList1) {
SysDdDept dept1 = ddDeptMapper.selectDeptByDdDeptId(ddUserDeptId);
if (StringUtils.isNotNull(dept1)){
deptIds.add(dept1.getDeptId());
}
}
//删除原用户与部门关系
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);
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(ddUserDept);
//判断是否是年级部成员
if ("年级部".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("1");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
//判断是否是学科组长成员
if ("学科组长".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("2");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
}
sysDdUser.setUpdateBy("钉钉管理员");
ddUserMapper.updateDdUser(sysDdUser);
}
//更新系统用户信息
sysDdUser.setUserName(ddUser.getName());
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPhonenumber(ddUser.getMobile());
if (StringUtils.isNotEmpty(ddUser.getEmail())){
sysDdUser.setEmail(ddUser.getEmail());
}
if (StringUtils.isNotEmpty(ddUser.getAvatar())){
sysDdUser.setAvatar(ddUser.getAvatar());
}
if (StringUtils.isNotEmpty(ddUser.getRemark())){
sysDdUser.setRemark(ddUser.getRemark());
}
sysDdUser.setUpdateBy("钉钉管理员");
ddUserMapper.updateDdUser(sysDdUser);
//更新系统教师信息
SysDdTeacher sysDdTeacher = new SysDdTeacher();
sysDdTeacher.setId(sysDdUser.getUserId());
sysDdTeacher.setTeacherName(sysDdUser.getUserName());
sysDdTeacher.setTeacherTel(sysDdUser.getPhonenumber());
if (StringUtils.isNotEmpty(sysDdUser.getAvatar())){
sysDdTeacher.setPicUrl(sysDdUser.getAvatar());
}
sysDdTeacher.setUpdateBy("钉钉管理员");
sysDdTeacher.setUpdateTime(DateUtils.getNowDate());
ddTeacherMapper.updateDdTeacher(sysDdTeacher);
}
}
}
return "同步成功";
}
/**
* 处理通讯录用户增加
* @param eventJson
* @return
*/
@Override
@Transactional
public int addUser(JSONObject eventJson) {
int i = 0;
String ddUserId = eventJson.getString("UserId");
String replace = ddUserId.replace("[\"", "");
String userIds = replace.replace("\"]", "");
String[] split = userIds.split(",");
//查询所有级部
List<Map<String, Object>> gradeList = ddDeptMapper.selectGradeList();
for (String userId : split) {
//查询钉钉用户详情
OapiV2UserGetResponse.UserGetResponse ddUser = dingUserUtils.getUser(userId);
//多部门任职信息
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());
}
}
//用户表数据
SysDdUser sysDdUser = new SysDdUser();
sysDdUser.setDdUserDepts(ddUserDepts);
//根据钉钉部门id查询部门信息
for (Long ddDeptId : deptIdList) {
SysDdDept dept = ddDeptMapper.selectDeptByDdDeptId(ddDeptId);
if (StringUtils.isNotNull(dept)){
sysDdUser.setDeptId(dept.getDeptId());
break;
}
}
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPassword(SecurityUtils.encryptPassword("Ez2023@345"));
sysDdUser.setUserName(ddUser.getName());
sysDdUser.setUserType("00");
sysDdUser.setUserLoginType("0");
sysDdUser.setPhonenumber(ddUser.getMobile());
sysDdUser.setCreateBy("钉钉管理员");
sysDdUser.setUnionId(ddUser.getUnionid());
sysDdUser.setDdUserId(ddUser.getUserid());
if (StringUtils.isNotEmpty(ddUser.getEmail())){
sysDdUser.setEmail(ddUser.getEmail());
}
if (StringUtils.isNotEmpty(ddUser.getAvatar())){
sysDdUser.setAvatar(ddUser.getAvatar());
}
if (StringUtils.isNotEmpty(ddUser.getRemark())){
sysDdUser.setRemark(ddUser.getRemark());
}
i += ddUserMapper.insertDdUser(sysDdUser);
//新增用户和部门关系
SysDdUserDept sysDdUserDept = new SysDdUserDept();
sysDdUserDept.setUserId(sysDdUser.getUserId());
for (Long ddUserDept : sysDdUser.getDdUserDepts()) {
sysDdUserDept.setDeptId(ddUserDept);
ddUserMapper.insertDdUserDept(sysDdUserDept);
}
//新增教师表信息
SysDdTeacher sysDdTeacher = new SysDdTeacher();
sysDdTeacher.setId(sysDdUser.getUserId());
sysDdTeacher.setTeacherName(sysDdUser.getUserName());
sysDdTeacher.setTeacherTel(sysDdUser.getPhonenumber());
if (StringUtils.isNotEmpty(sysDdUser.getAvatar())){
sysDdTeacher.setPicUrl(sysDdUser.getAvatar());
}
sysDdTeacher.setUnionId(sysDdUser.getUnionId());
sysDdTeacher.setDdUserId(sysDdUser.getDdUserId());
sysDdTeacher.setCreateBy("钉钉管理员");
sysDdTeacher.setCreateTime(DateUtils.getNowDate());
ddTeacherMapper.addTeacherList(sysDdTeacher);
//判断用户是否是级部成员,如果是,新增到级部成员
for (Long deptId : ddUserDepts) {
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(deptId);
//判断是否是年级部成员
if ("年级部".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("1");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
//判断是否是学科组长成员
if ("学科组长".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("2");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
}
}
return i;
}
/**
* 处理通讯录用户修改
* @param eventJson
* @return
*/
@Override
public int updateUser(JSONObject eventJson) {
int i = 0;
String ddUserId = eventJson.getString("UserId");
String replace = ddUserId.replace("[\"", "");
String userIds = replace.replace("\"]", "");
String[] split = userIds.split(",");
//查询所有级部
List<Map<String, Object>> gradeList = ddDeptMapper.selectGradeList();
for (String userId : split) {
//查询钉钉用户详情
OapiV2UserGetResponse.UserGetResponse ddUser = dingUserUtils.getUser(userId);
//查询系统用户详情
SysDdUser sysDdUser = ddUserMapper.selectDdUserByDdUserId(userId);
//钉钉用户的钉钉部门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);
if (StringUtils.isNotNull(dept1)){
ddUserDepts.add(dept1.getDeptId());
}
}
//删除原用户与部门关系
ddUserMapper.deleteDdUserDept(sysDdUser.getUserId());
//删除级部成员信息
ddUserMapper.deleteGradeMentor(sysDdUser.getUserId());
//新增新用户与部门关系
SysDdUserDept sysDdUserDept = new SysDdUserDept();
sysDdUserDept.setUserId(sysDdUser.getUserId());
for (Long ddUserDept : ddUserDepts) {
sysDdUserDept.setDeptId(ddUserDept);
ddUserMapper.insertDdUserDept(sysDdUserDept);
//根据部门id获取部门信息
SysDdDept sysDdDept = ddDeptMapper.selectDeptByDeptId(ddUserDept);
//判断是否是年级部成员
if ("年级部".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("1");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
//判断是否是学科组长成员
if ("学科组长".equals(sysDdDept.getDeptName())){
//是,查看父部门属于那个级部
SysDdDept parentDept = ddDeptMapper.selectDeptByDeptId(sysDdDept.getParentId());
for (Map<String, Object> grade : gradeList) {
//级部id
Long gradeId = Long.parseLong(grade.get("gradeId").toString());
//级部值
String gradeYear = grade.get("gradeYear").toString();
//判断父部门名称是否包含级部值
if (parentDept.getDeptName().contains(gradeYear)){
//包含,新增用户到该级部成员
SchoolGradeMentorCopy schoolGradeMentor = new SchoolGradeMentorCopy();
//设置职位
if (StringUtils.isNotNull(deptPositionList) && deptPositionList.size() > 0){
for (OapiV2UserGetResponse.DeptPosition deptPosition : deptPositionList) {
if (deptPosition.getDeptId().equals(sysDdDept.getDdDeptId())){
schoolGradeMentor.setTeacherPost(deptPosition.getTitle());
}
}
}
schoolGradeMentor.setTeacherId(sysDdUser.getUserId());
schoolGradeMentor.setGradeId(gradeId);
schoolGradeMentor.setCreateBy("钉钉管理员");
schoolGradeMentor.setCreateTime(DateUtils.getNowDate());
schoolGradeMentor.setType("2");
ddUserMapper.insertGradeMentor(schoolGradeMentor);
}
}
}
}
//更新系统用户信息
sysDdUser.setDeptId(ddUserDepts.get(0));
sysDdUser.setUserName(ddUser.getName());
sysDdUser.setLoginName(ddUser.getName());
sysDdUser.setPhonenumber(ddUser.getMobile());
sysDdUser.setUpdateBy("钉钉管理员");
if (StringUtils.isNotEmpty(ddUser.getEmail())){
sysDdUser.setEmail(ddUser.getEmail());
}
if (StringUtils.isNotEmpty(ddUser.getAvatar())){
sysDdUser.setAvatar(ddUser.getAvatar());
}
if (StringUtils.isNotEmpty(ddUser.getRemark())){
sysDdUser.setRemark(ddUser.getRemark());
}
i += ddUserMapper.updateDdUser(sysDdUser);
//更新系统教师信息
SysDdTeacher sysDdTeacher = new SysDdTeacher();
sysDdTeacher.setId(sysDdUser.getUserId());
sysDdTeacher.setTeacherName(sysDdUser.getUserName());
sysDdTeacher.setTeacherTel(sysDdUser.getPhonenumber());
if (StringUtils.isNotEmpty(sysDdUser.getAvatar())){
sysDdTeacher.setPicUrl(sysDdUser.getAvatar());
}
sysDdTeacher.setUpdateBy("钉钉管理员");
sysDdTeacher.setUpdateTime(DateUtils.getNowDate());
ddTeacherMapper.updateDdTeacher(sysDdTeacher);
}
return i;
}
/**
* 处理通讯录用户离职
* @param eventJson
* @return
*/
@Override
public int leaveUser(JSONObject eventJson) {
int i = 0;
String ddUserId = eventJson.getString("UserId");
String replace = ddUserId.replace("[\"", "");
String userIds = replace.replace("\"]", "");
String[] split = userIds.split(",");
for (String userId : split) {
//查询系统用户详情
SysDdUser sysDdUser = ddUserMapper.selectDdUserByDdUserId(userId);
//在用户表中删除用户
i += ddUserMapper.deleteDdUser(sysDdUser.getUserId());
//删除用户和部门关系
i += ddUserMapper.deleteDdUserDept(sysDdUser.getUserId());
//在教师表中删除用户
i += ddUserMapper.deleteDdTeacher(sysDdUser.getUserId());
//在级部成员表中删除用户
i += ddUserMapper.deleteGradeMentor(sysDdUser.getUserId());
}
return i;
}
}
......@@ -195,6 +195,14 @@ public class WxSchoolOrganizationController extends BaseController {
@PostMapping
public AjaxResult add(@RequestBody SchoolOrganizationSignin schoolOrganizationSignin)
{
//判断cid和userid是否存在 如果存在则先删除 再添加
LambdaQueryWrapper<SchoolOrganizationSignin> wrapper = Wrappers.lambdaQuery();
wrapper.eq(SchoolOrganizationSignin::getCid,schoolOrganizationSignin.getCid());
wrapper.eq(SchoolOrganizationSignin::getUserId,schoolOrganizationSignin.getUserId());
SchoolOrganizationSignin one = schoolOrganizationSigninService.getOne(wrapper);
if (one!=null){
schoolOrganizationSigninService.removeById(one.getId());
}
schoolOrganizationSignin.setStatus("1"); //适配重新报名的情况
return toAjax(schoolOrganizationSigninService.save(schoolOrganizationSignin));
}
......
<?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="yangtz.cs.liu.dingding.mapper.dingDept.DdDeptMapper">
<resultMap type="SysDdDept" id="SysDdDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="ddDeptId" column="dd_dept_id" />
<result property="ddParentId" column="dd_parent_id" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDdDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.dd_dept_id, d.dd_parent_id, d.del_flag, d.create_by, d.create_time
from sys_dd_dept d
</sql>
<select id="selectDdDeptList" parameterType="SysDdDept" resultMap="SysDdDeptResult">
<include refid="selectDdDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptByDdDeptId" parameterType="Long" resultMap="SysDdDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.dd_dept_id, d.dd_parent_id, d.del_flag, d.create_by, d.create_time
from sys_dd_dept d
where d.dd_dept_id = #{ddDeptId}
</select>
<select id="selectDeptByDeptId" parameterType="Long" resultMap="SysDdDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.dd_dept_id, d.dd_parent_id, d.del_flag, d.create_by, d.create_time
from sys_dd_dept d
where d.dept_id = #{deptId}
</select>
<select id="selectGradeList" resultType="Map">
select id as gradeId, grade_year as gradeYear from school_grade_copy where del_flag = "0" order by grade_value ASC
</select>
<insert id="insertDdDept" parameterType="SysDdDept" useGeneratedKeys="true" keyProperty="deptId">
insert into sys_dd_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null ">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="ddDeptId != null">dd_dept_id,</if>
<if test="ddParentId != null">dd_parent_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="ddDeptId != null">#{ddDeptId},</if>
<if test="ddParentId != null">#{ddParentId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateDdDept" parameterType="SysDdDept">
update sys_dd_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="ddDeptId != null ">dd_dept_id = #{ddDeptId},</if>
<if test="ddParentId != null">dd_parent_id = #{ddParentId},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
</update>
<update id="updateDdDeptByDdDeptId" parameterType="SysDdDept">
update sys_dd_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="ddParentId != null">dd_parent_id = #{ddParentId},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dd_dept_id = #{ddDeptId}
</update>
<delete id="deleteDdDeptById" parameterType="Long">
update sys_dd_dept set del_flag = '2' where dept_id = #{deptId} and dept_id != 100
</delete>
<delete id="deleteDdDeptByDdDeptId" parameterType="Long">
update sys_dd_dept set del_flag = '2' where dd_dept_id = #{ddDeptId}
</delete>
</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="yangtz.cs.liu.dingding.mapper.schoolTeacher.DdTeacherMapper">
<resultMap type="SysDdTeacher" id="SysDdTeacherResult">
<result property="id" column="id"/>
<result property="teacherName" column="teacher_name"/>
<result property="teacherTel" column="teacher_tel"/>
<result property="teacherCode" column="teacher_code"/>
<result property="idCard" column="id_card"/>
<result property="deviceNum" column="device_num"/>
<result property="homeAddress" column="home_address"/>
<result property="nation" column="nation"/>
<result property="picUrl" column="pic_url"/>
<result property="birthday" column="birthday"/>
<result property="education" column="education"/>
<result property="sex" column="sex"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="openId" column="open_id"/>
<result property="ddUserId" column="dd_user_id"/>
<result property="unionId" column="union_id"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<insert id="addTeacherList" parameterType="SysDdTeacher" useGeneratedKeys="true" keyProperty="id">
insert into sys_dd_teacher
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="teacherName != null">teacher_name,</if>
<if test="teacherTel != null">teacher_tel,</if>
<if test="teacherCode != null">teacher_code,</if>
<if test="idCard != null">id_card,</if>
<if test="homeAddress != null">home_address,</if>
<if test="nation != null">nation,</if>
<if test="picUrl != null">pic_url,</if>
<if test="birthday != null">birthday,</if>
<if test="education != null">education,</if>
<if test="sex != null">sex,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="openId != null">open_id,</if>
<if test="ddUserId != null">dd_user_id,</if>
<if test="unionId != null">union_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="deviceNum != null">device_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="teacherName != null">#{teacherName},</if>
<if test="teacherTel != null">#{teacherTel},</if>
<if test="teacherCode != null">#{teacherCode},</if>
<if test="idCard != null">#{idCard},</if>
<if test="homeAddress != null">#{homeAddress},</if>
<if test="nation != null">#{nation},</if>
<if test="picUrl != null">#{picUrl},</if>
<if test="birthday != null">#{birthday},</if>
<if test="education != null">#{education},</if>
<if test="sex != null">#{sex},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="openId != null">#{openId},</if>
<if test="ddUserId != null">#{ddUserId},</if>
<if test="unionId != null">#{unionId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="deviceNum != null">#{deviceNum},</if>
</trim>
</insert>
<update id="updateDdTeacher" parameterType="SysDdTeacher">
update sys_dd_teacher
<trim prefix="SET" suffixOverrides=",">
<if test="teacherName != null">teacher_name = #{teacherName},</if>
<if test="teacherTel != null">teacher_tel = #{teacherTel},</if>
<if test="teacherCode != null">teacher_code = #{teacherCode},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="homeAddress != null">home_address = #{homeAddress},</if>
<if test="nation != null">nation = #{nation},</if>
<if test="picUrl != null">pic_url = #{picUrl},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="education != null">education = #{education},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="openId != null">open_id = #{openId}</if>
<if test="ddUserId != null">dd_user_id = #{ddUserId}</if>
<if test="unionId != null">union_id = #{unionId}</if>
</trim>
where id = #{id}
</update>
<!--批量新增教师-->
<insert id="batchInsertTeacher" parameterType="SysDdTeacher" useGeneratedKeys="true" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into sys_dd_teacher
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.id != null">id,</if>
<if test="data.teacherName != null">teacher_name,</if>
<if test="data.teacherTel != null">teacher_tel,</if>
<if test="data.teacherCode != null">teacher_code,</if>
<if test="data.idCard != null">id_card,</if>
<if test="data.homeAddress != null">home_address,</if>
<if test="data.nation != null">nation,</if>
<if test="data.picUrl != null">pic_url,</if>
<if test="data.birthday != null">birthday,</if>
<if test="data.education != null">education,</if>
<if test="data.sex != null">sex,</if>
<if test="data.createBy != null">create_by,</if>
<if test="data.createTime != null">create_time,</if>
<if test="data.updateBy != null">update_by,</if>
<if test="data.updateTime != null">update_time,</if>
<if test="data.openId != null">open_id,</if>
<if test="data.ddUserId != null">dd_user_id,</if>
<if test="data.unionId != null">union_id,</if>
<if test="data.delFlag != null and data.delFlag != ''">del_flag,</if>
<if test="data.deviceNum != null">device_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.id != null">#{data.id},</if>
<if test="data.teacherName != null">#{data.teacherName},</if>
<if test="data.teacherTel != null">#{data.teacherTel},</if>
<if test="data.teacherCode != null">#{data.teacherCode},</if>
<if test="data.idCard != null">#{data.idCard},</if>
<if test="data.homeAddress != null">#{data.homeAddress},</if>
<if test="data.nation != null">#{data.nation},</if>
<if test="data.picUrl != null">#{data.picUrl},</if>
<if test="data.birthday != null">#{data.birthday},</if>
<if test="data.education != null">#{data.education},</if>
<if test="data.sex != null">#{data.sex},</if>
<if test="data.createBy != null">#{data.createBy},</if>
<if test="data.createTime != null">#{data.createTime},</if>
<if test="data.updateBy != null">#{data.updateBy},</if>
<if test="data.updateTime != null">#{data.updateTime},</if>
<if test="data.openId != null">#{data.openId},</if>
<if test="data.ddUserId != null">#{data.ddUserId},</if>
<if test="data.unionId != null">#{data.unionId},</if>
<if test="data.delFlag != null and data.delFlag != ''">#{data.delFlag},</if>
<if test="data.deviceNum != null">#{data.deviceNum},</if>
</trim>
</foreach>
</insert>
</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="yangtz.cs.liu.dingding.mapper.dingUser.DdUserMapper">
<resultMap type="SysDdUser" id="SysDdUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="loginName" column="login_name" />
<result property="userLoginType" column="user_login_type" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="salt" column="salt" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="pwdUpdateDate" column="pwd_update_date" />
<result property="openId" column="open_id" />
<result property="unionId" column="union_id" />
<result property="ddUserId" column="dd_user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="employeeType" column="employee_type" />
<result property="studentId" column="student_id" />
<result property="sign" column="sign" />
</resultMap>
<sql id="selectDdUserVo">
select u.user_id, u.dept_id, u.user_name, u.login_name,u.user_type, u.user_login_type,u.email, u.avatar, u.phonenumber, u.password, u.salt,u.sex, u.status, u.del_flag, u.login_ip, u.login_date,u.pwd_update_date, u.create_by, u.create_time, u.remark,u.sign,u.employee_type,u.student_id,
from sys_dd_user u
</sql>
<select id="selectDdUserList" parameterType="SysDdUser" resultMap="SysDdUserResult">
select u.user_id, u.dept_id, u.login_name, u.user_name,u.user_type, u.user_login_type, u.email, u.avatar, u.phonenumber, u.sex,u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.union_id, u.dd_user_id, u.create_by, u.create_time, u.remark from sys_dd_user u
where u.del_flag = '0' and user_login_type = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</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) ))
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectDdUserByDdUserId" parameterType="String" resultMap="SysDdUserResult">
select u.user_id, u.dept_id, u.login_name, u.user_name,u.user_type, u.user_login_type, u.email, u.avatar, u.phonenumber, u.sex,u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.union_id, u.dd_user_id, u.create_by, u.create_time, u.remark from sys_dd_user u
where u.del_flag = '0' and user_login_type = '0' and dd_user_id = #{ddUserId}
</select>
<insert id="insertDdUser" parameterType="SysDdUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_dd_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="loginName != null and loginName != ''">login_name,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="userLoginType != null and userLoginType != ''">user_login_type,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="salt != null and salt != ''">salt,</if>
<if test="status != null and status != ''">status,</if>
<if test="pwdUpdateDate != null">pwd_update_date,</if>
<if test="unionId != null">union_id,</if>
<if test="ddUserId != null">dd_user_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="sign != null and sign != ''">sign,</if>
<if test="studentId != null and studentId != 0">student_id,</if>
<if test="employeeType != null and employeeType != ''">employee_type,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="loginName != null and loginName != ''">#{loginName},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="userLoginType != null and userLoginType != ''">#{userLoginType},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="salt != null and salt != ''">#{salt},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="pwdUpdateDate != null">#{pwdUpdateDate},</if>
<if test="unionId != null">#{unionId},</if>
<if test="ddUserId != null">#{ddUserId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="sign != null and sign != ''">#{sign},</if>
<if test="studentId != null and studentId != ''">#{studentId},</if>
<if test="employeeType != null and employeeType != ''">#{employeeType},</if>
sysdate()
)
</insert>
<update id="updateDdUser" parameterType="SysDdUser">
update sys_dd_user
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="loginName != null and loginName != ''">login_name = #{loginName},</if>
<if test="userType != null and userType != ''">user_type = #{userType},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="salt != null and salt != ''">salt = #{salt},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="pwdUpdateDate != null">pwd_update_date = #{pwdUpdateDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="employeeType != null and employeeType != ''">employee_type = #{employeeType},</if>
<if test="studentId != null and studentId != 0">student_id = #{studentId},</if>
<if test="sign != null and sign != ''">sign = #{sign},</if>
<if test="openId != null and openId != ''">open_id = #{openId},</if>
<if test="ddUserId != null and ddUserId != ''">dd_user_id = #{ddUserId},</if>
<if test="unionId != null and unionId != ''">union_id = #{unionId},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
</update>
<update id="updateUserList" parameterType="SysDdUser">
<foreach collection="list" item="data" separator=";">
update sys_dd_user
<trim prefix="SET" suffixOverrides=",">
<if test="data.userName != null and data.userName != ''">
user_name = #{data.userName},
</if>
</trim>
where user_id = #{data.userId}
</foreach>
</update>
<insert id="addUserList" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into sys_dd_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.userLoginType != null and data.userLoginType != ''">
user_login_type,
</if>
<if test="data.userName != null and data.userName != ''">
user_name,
</if>
<if test="data.phonenumber != null and data.phonenumber != ''">
phonenumber,
</if>
<if test="data.studentId != null">
student_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.userLoginType != null and data.userLoginType != ''">
#{data.userLoginType},
</if>
<if test="data.userName != null and data.userName != ''">
#{data.userName},
</if>
<if test="data.phonenumber != null and data.phonenumber != ''">
#{data.phonenumber},
</if>
<if test="data.studentId != null">
#{data.studentId},
</if>
</trim>
</foreach>
</insert>
<insert id="addDdUserList" parameterType="SysDdUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_dd_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="loginName != null and loginName != ''">login_name,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="userLoginType != null and userLoginType != ''">user_login_type,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="salt != null and salt != ''">salt,</if>
<if test="status != null and status != ''">status,</if>
<if test="pwdUpdateDate != null">pwd_update_date,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="sign != null and sign != ''">sign,</if>
<if test="studentId != null and studentId != 0">student_id,</if>
<if test="employeeType != null and employeeType != ''">employee_type,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="loginName != null and loginName != ''">#{loginName},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="userLoginType != null and userLoginType != ''">#{userLoginType},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="salt != null and salt != ''">#{salt},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="pwdUpdateDate != null">#{pwdUpdateDate},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="sign != null and sign != ''">#{sign},</if>
<if test="studentId != null and studentId != ''">#{studentId},</if>
<if test="employeeType != null and employeeType != ''">#{employeeType},</if>
sysdate()
)
</insert>
<!--批量新增钉钉用户-->
<insert id="batchInsertDdUser" parameterType="SysDdUser" useGeneratedKeys="true" keyProperty="userId">
<foreach collection="list" item="data" separator=";">
insert into sys_dd_user(
<if test="data.userId != null and data.userId != 0">user_id,</if>
<if test="data.deptId != null and data.deptId != 0">dept_id,</if>
<if test="data.userName != null and data.userName != ''">user_name,</if>
<if test="data.loginName != null and data.loginName != ''">login_name,</if>
<if test="data.userType != null and data.userType != ''">user_type,</if>
<if test="data.userLoginType != null and data.userLoginType != ''">user_login_type,</if>
<if test="data.email != null and data.email != ''">email,</if>
<if test="data.avatar != null and data.avatar != ''">avatar,</if>
<if test="data.phonenumber != null and data.phonenumber != ''">phonenumber,</if>
<if test="data.sex != null and data.sex != ''">sex,</if>
<if test="data.password != null and data.password != ''">password,</if>
<if test="data.salt != null and data.salt != ''">salt,</if>
<if test="data.status != null and data.status != ''">status,</if>
<if test="data.pwdUpdateDate != null">pwd_update_date,</if>
<if test="data.unionId != null">union_id,</if>
<if test="data.ddUserId != null">dd_user_id,</if>
<if test="data.createBy != null and data.createBy != ''">create_by,</if>
<if test="data.remark != null and data.remark != ''">remark,</if>
<if test="data.sign != null and data.sign != ''">sign,</if>
<if test="data.studentId != null and data.studentId != 0">student_id,</if>
<if test="data.employeeType != null and data.employeeType != ''">employee_type,</if>
create_time
)values(
<if test="data.userId != null and data.userId != ''">#{data.userId},</if>
<if test="data.deptId != null and data.deptId != ''">#{data.deptId},</if>
<if test="data.userName != null and data.userName != ''">#{data.userName},</if>
<if test="data.loginName != null and data.loginName != ''">#{data.loginName},</if>
<if test="data.userType != null and data.userType != ''">#{data.userType},</if>
<if test="data.userLoginType != null and data.userLoginType != ''">#{data.userLoginType},</if>
<if test="data.email != null and data.email != ''">#{data.email},</if>
<if test="data.avatar != null and data.avatar != ''">#{data.avatar},</if>
<if test="data.phonenumber != null and data.phonenumber != ''">#{data.phonenumber},</if>
<if test="data.sex != null and data.sex != ''">#{data.sex},</if>
<if test="data.password != null and data.password != ''">#{data.password},</if>
<if test="data.salt != null and data.salt != ''">#{data.salt},</if>
<if test="data.status != null and data.status != ''">#{data.status},</if>
<if test="data.pwdUpdateDate != null">#{data.pwdUpdateDate},</if>
<if test="data.unionId != null">#{data.unionId},</if>
<if test="data.ddUserId != null">#{data.ddUserId},</if>
<if test="data.createBy != null and data.createBy != ''">#{data.createBy},</if>
<if test="data.remark != null and data.remark != ''">#{data.remark},</if>
<if test="data.sign != null and data.sign != ''">#{data.sign},</if>
<if test="data.studentId != null and data.studentId != ''">#{data.studentId},</if>
<if test="data.employeeType != null and data.employeeType != ''">#{data.employeeType},</if>
sysdate()
)
</foreach>
</insert>
<insert id="insertDdUserDept" parameterType="SysDdUserDept">
insert into sys_dd_user_dept(user_id, dept_id) values (#{userId},#{deptId})
</insert>
<update id="deleteDdUser" parameterType="Long">
update sys_dd_user set del_flag = "2" where user_id = #{userId}
</update>
<delete id="deleteDdUserDept">
delete from sys_dd_user_dept where user_id = #{userId}
</delete>
<update id="deleteDdTeacher" parameterType="Long">
update sys_dd_teacher set del_flag = "2" where id = #{userId}
</update>
<select id="selectDeptIdByUserId" parameterType="Long" resultType="Long">
select dept_id from sys_dd_user_dept where user_id = #{userId}
</select>
<!--新增级部成员-->
<insert id="insertGradeMentor" parameterType="SchoolGradeMentorCopy">
insert into school_grade_mentor_copy
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="teacherId != null">teacher_id,</if>
<if test="gradeId != null">grade_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="type != null and type != ''">type,</if>
<if test="teacherPost != null and teacherPost != ''">teacher_post,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teacherId != null">#{teacherId},</if>
<if test="gradeId != null">#{gradeId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="teacherPost != null and teacherPost != ''">#{teacherPost},</if>
</trim>
</insert>
<!--删除级部成员-->
<update id="deleteGradeMentor" parameterType="Long">
update school_grade_mentor_copy set del_flag = "1" where teacher_id = #{userId}
</update>
</mapper>
......@@ -58,4 +58,8 @@
select sg.id from school_grade_copy sg
where sg.del_flag = '0' and sg.dd_class_id=#{ddClssId}
</select>
<select id="selectUpToYear" resultType="java.lang.String">
select max(school_year) nowYear from school_grade_copy where del_flag = '0'
</select>
</mapper>
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