30教龄教职工管理:搜索新增截止日期,新增'即将满30年 周年满30年 超30年'查询和统计; 教职工汇总的查询范围:由cnd.and("u.isThirtyTeach", "=", 1)标记,改成会员cnd.and("u.member", "=", 1);

This commit is contained in:
dd3s_206
2026-06-08 15:05:33 +08:00
parent 87d126a035
commit e969db447c
6 changed files with 178 additions and 20 deletions
@@ -41,6 +41,8 @@ import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -84,14 +86,15 @@ public class ThirtyTeachController {
@ApiOperation("一键设置三十龄教工")
@SaCheckPermission("thirtyTeach.manage")
@SLog(type = "30龄教工-教职工管理", tag = "设置三十龄教工",msg = "设置三十龄教工设置教龄${args[0]}")
public Result setThirtyTeach(Integer setNum, boolean isFlag){
public Result setThirtyTeach(Integer setNum, String deadlineDate, boolean isFlag){
if (isFlag) {
sysUserService.update(Chain.make("isThirtyTeach", 0), Cnd.NEW());
}
String teachNumDate = getTeachNumDate(deadlineDate);
Cnd cnd = Cnd.NEW();
cnd.and("arrivalAtSchoolDate", "is not", null);
cnd.and("arrivalAtSchoolDate", "!=", "");
cnd.and("TIMESTAMPDIFF(YEAR, CONCAT(arrivalAtSchoolDate, '-01'), CURDATE())", ">", setNum);
cnd.and("TIMESTAMPDIFF(YEAR, CONCAT(arrivalAtSchoolDate, '-01'), " + teachNumDate + ")", ">=", setNum);
sysUserService.update(Chain.make("isThirtyTeach", 1), cnd);
return Result.success();
}
@@ -124,6 +127,7 @@ public class ThirtyTeachController {
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
entityList.add(new ExcelExportEntity("姓名", "username", 20));
entityList.add(new ExcelExportEntity("性别", "sex", 20));
entityList.add(new ExcelExportEntity("入校时间", "arrivalAtSchoolDate", 20));
entityList.add(new ExcelExportEntity("教龄(年)", "teachNum", 20));
entityList.add(new ExcelExportEntity("电话", "mobile", 20));
entityList.add(new ExcelExportEntity("工会", "unionName", 20));
@@ -131,10 +135,12 @@ public class ThirtyTeachController {
entityList.add(new ExcelExportEntity("在职状态", "userState", 20));
entityList.add(new ExcelExportEntity("教职工类别", "personType", 20));
entityList.add(new ExcelExportEntity("荣誉证办理年月", "thirtyCertificateProcessingTime", 20));
String exportDeadlineDate = getExportDeadlineDate(pageForm.getDeadlineDate());
ExportParams exportParams = new ExportParams();
exportParams.setTitle("30教龄教职工名单(教龄计算截止日期:" + exportDeadlineDate + "");
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
CommonDownloadUtil.download("30教龄教职工名单.xlsx", workbook, response);
CommonDownloadUtil.download("30教龄教职工名单(截止" + exportDeadlineDate + ".xlsx", workbook, response);
}
@At
@@ -232,5 +238,25 @@ public class ThirtyTeachController {
}
}
private String getTeachNumDate(String deadlineDate) {
if (StrUtil.isNotBlank(deadlineDate)) {
try {
return "'" + LocalDate.parse(deadlineDate, DateTimeFormatter.ISO_LOCAL_DATE) + "'";
} catch (Exception ignored) {
}
}
return "CURDATE()";
}
private String getExportDeadlineDate(String deadlineDate) {
if (StrUtil.isNotBlank(deadlineDate)) {
try {
return LocalDate.parse(deadlineDate, DateTimeFormatter.ISO_LOCAL_DATE).toString();
} catch (Exception ignored) {
}
}
return LocalDate.now().toString();
}
}
@@ -58,14 +58,18 @@ public class ThirtyTeachSummaryController {
Sql sql = Sqls.create("""
SELECT
su.*,
COUNT( u.id ) AS userNum
COUNT( u.id ) AS userNum,
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, CONCAT(u.arrivalAtSchoolDate, '-01'), CURDATE()) = 29 THEN 1 ELSE 0 END) AS willThirtyNum,
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, CONCAT(u.arrivalAtSchoolDate, '-01'), CURDATE()) = 30 THEN 1 ELSE 0 END) AS anniversaryThirtyNum,
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, CONCAT(u.arrivalAtSchoolDate, '-01'), CURDATE()) > 30 THEN 1 ELSE 0 END) AS overThirtyNum
FROM
sys_union su
LEFT JOIN `vw_user` u ON u.unionid = su.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("u.isThirtyTeach", "=", 1);
//cnd.and("u.isThirtyTeach", "=", 1);
cnd.and("u.member", "=", 1);
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
}
@@ -87,14 +91,19 @@ public class ThirtyTeachSummaryController {
Sql sql = Sqls.create("""
SELECT
su.*,
COUNT( u.id ) AS userNum
COUNT( u.id ) AS userNum,
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, CONCAT(u.arrivalAtSchoolDate, '-01'), CURDATE()) = 29 THEN 1 ELSE 0 END) AS willThirtyNum,
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, CONCAT(u.arrivalAtSchoolDate, '-01'), CURDATE()) = 30 THEN 1 ELSE 0 END) AS anniversaryThirtyNum,
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, CONCAT(u.arrivalAtSchoolDate, '-01'), CURDATE()) > 30 THEN 1 ELSE 0 END) AS overThirtyNum
FROM
sys_union su
LEFT JOIN `vw_user` u ON u.unionid = su.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("u.isThirtyTeach", "=", 1);
// cnd.and("u.isThirtyTeach", "=", 1);
//教职工汇总范围: 由标记用户改成全体会员
cnd.and("u.member", "=", 1);
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
}
@@ -110,7 +119,16 @@ public class ThirtyTeachSummaryController {
no.setFormat("isAddIndex");
entityList.add(no);
entityList.add(new ExcelExportEntity("分工会", "name", 20));
ExcelExportEntity entity = new ExcelExportEntity("在职人数", "userNum", 20);
ExcelExportEntity willThirtyNum = new ExcelExportEntity("即将满30年", "willThirtyNum", 20);
willThirtyNum.setType(10);
entityList.add(willThirtyNum);
ExcelExportEntity anniversaryThirtyNum = new ExcelExportEntity("周年满30年", "anniversaryThirtyNum", 20);
anniversaryThirtyNum.setType(10);
entityList.add(anniversaryThirtyNum);
ExcelExportEntity overThirtyNum = new ExcelExportEntity("超过30年", "overThirtyNum", 20);
overThirtyNum.setType(10);
entityList.add(overThirtyNum);
ExcelExportEntity entity = new ExcelExportEntity("人数", "userNum", 20);
entity.setType(10);
entityList.add(entity);
ExportParams exportParams = new ExportParams();
@@ -15,6 +15,10 @@ public class ThirtyTeachPageForm extends PageForm {
private String unitId;
//进校时长
private String teachNum;
//教龄标签
private String teachYearTag;
//截止日期
private String deadlineDate;
//办证年月
private String thirtyCertificateProcessingTime;
private String userState;
@@ -15,6 +15,9 @@ import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.IocBean;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* @author zhf
* @date 2025/7/28 11:53
@@ -28,6 +31,8 @@ public class ThirtyTeachServiceImpl extends BaseServiceImpl implements ThirtyTea
@Override
public Sql getSql(ThirtyTeachPageForm pageForm) {
String teachNumDate = getTeachNumDate(pageForm.getDeadlineDate());
String teachNumSql = "TIMESTAMPDIFF(YEAR, CONCAT(arrivalAtSchoolDate, '-01'), " + teachNumDate + ")";
Sql sql = Sqls.create("""
SELECT
id,
@@ -41,13 +46,14 @@ public class ThirtyTeachServiceImpl extends BaseServiceImpl implements ThirtyTea
unitName,
mobile,
birthday,
arrivalAtSchoolDate,
thirtyCertificateProcessingTime,
false as isEditThirtyCertificateProcessingTime,
TIMESTAMPDIFF(YEAR, CONCAT(arrivalAtSchoolDate, '-01'), CURDATE()) AS teachNum
%s AS teachNum
FROM
`vw_user`
$condition
""");
""".formatted(teachNumSql));
Cnd cnd = Cnd.NEW();
cnd.and("isThirtyTeach", "=", 1);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
@@ -60,7 +66,20 @@ public class ThirtyTeachServiceImpl extends BaseServiceImpl implements ThirtyTea
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("unionId", "=", SecurityUtil.getUnionId());
}
cnd.andEX("TIMESTAMPDIFF(YEAR, CONCAT(arrivalAtSchoolDate, '-01'), CURDATE())", "=", pageForm.getTeachNum());
if ("will30".equals(pageForm.getTeachYearTag())) {
cnd.and(teachNumSql, "=", 29);
} else if ("anniversary30".equals(pageForm.getTeachYearTag())) {
cnd.and(teachNumSql, "=", 30);
} else if ("over30".equals(pageForm.getTeachYearTag())) {
cnd.and(teachNumSql, ">", 30);
} else if ("ge30".equals(pageForm.getTeachYearTag())) {
cnd.and(teachNumSql, ">=", 30);
} else {
if (StrUtil.isNotBlank(pageForm.getDeadlineDate())) {
cnd.and(teachNumSql, ">=", 30);
}
cnd.andEX(teachNumSql, "=", pageForm.getTeachNum());
}
cnd.andEX("unionId", "=", pageForm.getUnionId());
cnd.andEX("unitId", "=", pageForm.getUnitId());
cnd.andEX("personType", "=", pageForm.getPersonType());
@@ -75,4 +94,14 @@ public class ThirtyTeachServiceImpl extends BaseServiceImpl implements ThirtyTea
sql.setCondition(cnd);
return sql;
}
private String getTeachNumDate(String deadlineDate) {
if (StrUtil.isNotBlank(deadlineDate)) {
try {
return "'" + LocalDate.parse(deadlineDate, DateTimeFormatter.ISO_LOCAL_DATE) + "'";
} catch (Exception ignored) {
}
}
return "CURDATE()";
}
}
@@ -32,9 +32,24 @@ layout("/layouts/platform.html"){
<search-item label="进校时长">
<el-input placeholder="请输入进校时长" clearable v-model="pageForm.teachNum"
style="width: 100%"
@input="pageForm.teachYearTag = ''"
@keyup.enter.native="doSearch">
</el-input>
</search-item>
<search-item label="截止日期">
<el-date-picker
v-model="pageForm.deadlineDate"
type="date"
placeholder="请选择截止日期"
value-format="yyyy-MM-dd"
style="width: 100%">
</el-date-picker>
<div v-if="pageForm.deadlineDate && pageForm.deadlineDate !== currentDate"
class="text-warning"
style="font-size: 12px; margin-top: 5px">
当前按所选截止日期计算进校时长
</div>
</search-item>
<search-item label="办证年份">
<el-date-picker
format="yyyy"
@@ -61,7 +76,26 @@ layout("/layouts/platform.html"){
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="教职工管理">
<table-tool>
<template #label>
<span>教职工管理</span>
<el-tag :type="pageForm.teachYearTag === 'will30' ? '' : 'info'"
style="cursor: pointer; margin-left: 15px; margin-right: 5px; font-weight: normal"
@click="selectTeachYearTag('will30')">即将满30年
</el-tag>
<el-tag :type="pageForm.teachYearTag === 'anniversary30' ? '' : 'info'"
style="cursor: pointer; margin-right: 5px; font-weight: normal"
@click="selectTeachYearTag('anniversary30')">周年满30年
</el-tag>
<el-tag :type="pageForm.teachYearTag === 'over30' ? '' : 'info'"
style="cursor: pointer; margin-right: 10px; font-weight: normal"
@click="selectTeachYearTag('over30')">超30年
</el-tag>
<!--<el-tag :type="pageForm.teachYearTag === 'ge30' ? '' : 'info'"
style="cursor: pointer; margin-right: 10px"
@click="selectTeachYearTag('ge30')">30年及以上</el-tag>-->
</template>
<el-button size="small" @click="batchDelete" type="primary">
批量删除
</el-button>
@@ -107,6 +141,9 @@ layout("/layouts/platform.html"){
<i class="fa fa-circle ml5"></i>
</span>
</template>
<template v-else-if="column.prop==='arrivalAtSchoolDate'" v-slot="{row}">
{{ row.arrivalAtSchoolDate ? $moment(row.arrivalAtSchoolDate).format('YYYY-MM-DD') : '' }}
</template>
<template v-else-if="column.prop==='thirtyCertificateProcessingTime'" v-slot="{row}">
<span v-if="row.isEditThirtyCertificateProcessingTime">
<el-date-picker
@@ -149,12 +186,27 @@ layout("/layouts/platform.html"){
<el-diaLog title="一键设置" :visible.sync="setThirtyTeachVisible" :close-on-click-modal="false" width="50%">
<el-form label-width="120px">
<el-form-item label="设置年限">
<el-form label-width="220px">
<el-form-item label="设置年限(范围:大于等于)">
<el-input placeholder="请输入要设置的年限" v-model="setThirtyTeachData.setNum" type="number"
style="width: 80%"></el-input>
</el-form-item>
<el-form-item label="截止日期">
<el-date-picker
v-model="setThirtyTeachData.deadlineDate"
type="date"
placeholder="请选择截止日期"
value-format="yyyy-MM-dd"
style="width: 80%">
</el-date-picker>
<div v-if="setThirtyTeachData.deadlineDate && setThirtyTeachData.deadlineDate !== currentDate"
class="text-warning"
style="font-size: 12px; margin-top: 5px">
将按所选截止日期计算满足设置年限的人员
</div>
</el-form-item>
<el-form-item label="更新模式">
<el-radio-group v-model="setThirtyTeachData.isFlag">
<el-radio-button label="true">清空更新</el-radio-button>
@@ -188,6 +240,7 @@ layout("/layouts/platform.html"){
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名', sortable: true},
{prop: 'sex', label: '性别'},
{prop: 'arrivalAtSchoolDate', label: '入校时间', sortable: true, width: 120},
{prop: 'teachNum', label: '进校时长(年)', sortable: true},
{prop: 'personType', label: '教职工类别', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
@@ -199,8 +252,10 @@ layout("/layouts/platform.html"){
],
setThirtyTeachVisible: false,
currentDate: new Date().getFullYear() + '-' + String(new Date().getMonth() + 1).padStart(2, '0') + '-' + String(new Date().getDate()).padStart(2, '0'),
setThirtyTeachData: {
setNum: 30,
setNum: 29,
deadlineDate: '',
isFlag: false
},
checkUsers: [],
@@ -209,7 +264,9 @@ layout("/layouts/platform.html"){
unionId: '',
unitId: '',
personType: '',
userState: ''
userState: '',
teachYearTag: '',
deadlineDate: ''
},
}
},
@@ -241,9 +298,26 @@ layout("/layouts/platform.html"){
},
doExport() {
const {searchKeyword, unionId, unitId, personType, userState} = this.pageForm
const {
searchKeyword,
unionId,
unitId,
personType,
userState,
deadlineDate,
teachYearTag
} = this.pageForm
window.open('/platform/thirtyTeach/manage/doExport?searchKeyword=' + searchKeyword + '&unionId=' + unionId + '&unitId=' + unitId +
'&personType=' + personType + '&userState=' + userState)
'&personType=' + personType + '&userState=' + userState + '&deadlineDate=' + deadlineDate + '&teachYearTag=' + teachYearTag)
},
selectTeachYearTag(value) {
if (this.pageForm.teachYearTag === value) {
this.$set(this.pageForm, "teachYearTag", "")
} else {
this.$set(this.pageForm, "teachYearTag", value)
this.$set(this.pageForm, "teachNum", "")
}
this.doSearch()
},
doSet() {
if (!this.setThirtyTeachData.setNum) {
@@ -252,6 +326,7 @@ layout("/layouts/platform.html"){
}
this.$axios.post('/platform/thirtyTeach/manage/setThirtyTeach', {
setNum: this.setThirtyTeachData.setNum,
deadlineDate: this.setThirtyTeachData.deadlineDate,
isFlag: this.setThirtyTeachData.isFlag,
}).then(resp => {
if (resp.code === 0) {
@@ -293,7 +368,8 @@ layout("/layouts/platform.html"){
},
setThirtyTeach() {
this.setThirtyTeachData = {
setNum: 30,
setNum: 29,
deadlineDate: this.currentDate,
isFlag: false
}
this.setThirtyTeachVisible = true
@@ -330,6 +406,8 @@ layout("/layouts/platform.html"){
},
},
async created() {
this.$set(this.pageForm, "deadlineDate", this.currentDate)
this.$set(this.setThirtyTeachData, "deadlineDate", this.currentDate)
this.$businessTool.listUnion().then((res) => (this.unionOptions = res))
this.$businessTool.listUnit().then((res) => (this.unitOptions = res))
this.pageData()
@@ -71,7 +71,10 @@ layout("/layouts/platform.html"){
},
tableColumns: [
{prop: 'name', label: '分工会名称', sortable: true},
{prop: 'userNum', label: '在职人数', sortable: true},
{prop: 'willThirtyNum', label: '即将满30年', sortable: true},
{prop: 'anniversaryThirtyNum', label: '周年满30年', sortable: true},
{prop: 'overThirtyNum', label: '超过30年', sortable: true},
{prop: 'userNum', label: '人数', sortable: true},
],
unionOptions: [],
unitOptions: [],