diff --git a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachController.java b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachController.java
index 9f51a38a..1d4ea6d1 100644
--- a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachController.java
+++ b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachController.java
@@ -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();
+ }
+
}
diff --git a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachSummaryController.java b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachSummaryController.java
index 6ee98697..895a0984 100644
--- a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachSummaryController.java
+++ b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/controller/ThirtyTeachSummaryController.java
@@ -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();
diff --git a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/param/ThirtyTeachPageForm.java b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/param/ThirtyTeachPageForm.java
index 7e0f41e9..f4b95b8d 100644
--- a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/param/ThirtyTeachPageForm.java
+++ b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/param/ThirtyTeachPageForm.java
@@ -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;
diff --git a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/service/impl/ThirtyTeachServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/service/impl/ThirtyTeachServiceImpl.java
index 1ca70fb6..54de6eb1 100644
--- a/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/service/impl/ThirtyTeachServiceImpl.java
+++ b/src/main/java/com/budwk/app/zhgh/staffmanage/thirtyTeach/service/impl/ThirtyTeachServiceImpl.java
@@ -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()";
+ }
}
diff --git a/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/manage/index.html b/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/manage/index.html
index 38a82e97..d6320f5f 100644
--- a/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/manage/index.html
+++ b/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/manage/index.html
@@ -32,9 +32,24 @@ layout("/layouts/platform.html"){
+
+
+
+
+ 当前按所选截止日期计算进校时长
+
+
-
+
+
+ 教职工管理
+ 即将满30年
+
+ 周年满30年
+
+ 超30年
+
+
+
+
批量删除
@@ -107,6 +141,9 @@ layout("/layouts/platform.html"){
否
+
+ {{ row.arrivalAtSchoolDate ? $moment(row.arrivalAtSchoolDate).format('YYYY-MM-DD') : '' }}
+
-
-
+
+
+
+
+
+
+ 将按所选截止日期计算满足设置年限的人员
+
+
+
清空更新
@@ -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()
diff --git a/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/summary/index.html b/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/summary/index.html
index 3b95bd70..5a7b49e5 100644
--- a/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/summary/index.html
+++ b/src/main/resources/views/platform/zhgh/staffmanage/thirtyTeach/summary/index.html
@@ -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: [],