移植生日祝福
This commit is contained in:
+90
@@ -0,0 +1,90 @@
|
|||||||
|
package com.budwk.app.zhgh.staffmanage.birthday.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.budwk.app.base.result.Result;
|
||||||
|
import com.budwk.app.zhgh.staffmanage.birthday.param.UserBirthdayPageForm;
|
||||||
|
import com.budwk.app.zhgh.staffmanage.birthday.service.UserBirthdayService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.mvc.annotation.At;
|
||||||
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生日祝福数据导出。
|
||||||
|
* Controller 只接收查询参数并调用 Service,名单分组、日期范围和签名表布局均由 Service 处理。
|
||||||
|
*/
|
||||||
|
@IocBean
|
||||||
|
@At("/platform/staffManage/birthday/export")
|
||||||
|
@Ok("json:full")
|
||||||
|
@Api(tags = "生日祝福数据导出")
|
||||||
|
public class UserBirthdayExportController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserBirthdayService userBirthdayService;
|
||||||
|
|
||||||
|
@At("")
|
||||||
|
@Ok("beetl:/platform/zhgh/staffmanage/birthday/export/index.html")
|
||||||
|
@SaCheckPermission("staff.birthday.export")
|
||||||
|
public void index() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询待导出的生日人员。
|
||||||
|
*
|
||||||
|
* @param pageForm 分页、姓名/工号、校区、组织、人员状态和生日日期条件;校区使用 cx 或 hz
|
||||||
|
* @return Result.data 为 Pagination,list 是人员数据,totalCount 是总数
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@ApiOperation("分页查询待导出的生日人员")
|
||||||
|
@SaCheckPermission("staff.birthday.export")
|
||||||
|
public Result pageData(UserBirthdayPageForm pageForm) {
|
||||||
|
return Result.success(userBirthdayService.pageData(pageForm));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按当前查询条件导出生日人员列表。
|
||||||
|
*
|
||||||
|
* @param pageForm 与页面列表一致的筛选条件
|
||||||
|
* @param response 返回 XSSF 格式的 xlsx 文件流
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@ApiOperation("导出当前生日人员列表")
|
||||||
|
@SaCheckPermission("staff.birthday.export")
|
||||||
|
public void doExport(UserBirthdayPageForm pageForm, HttpServletResponse response) {
|
||||||
|
userBirthdayService.exportXlsx(pageForm, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按当前查询条件分别生成杭州、长兴校区生日名单 Sheet。
|
||||||
|
*
|
||||||
|
* @param pageForm 与页面列表一致的筛选条件
|
||||||
|
* @param response 返回 XSSF 格式的 xlsx 文件流
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@ApiOperation("按校区导出职工生日名单")
|
||||||
|
@SaCheckPermission("staff.birthday.export")
|
||||||
|
public void doExportCampusBirthday(UserBirthdayPageForm pageForm, HttpServletResponse response) {
|
||||||
|
userBirthdayService.exportCampusBirthdayXlsx(pageForm, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出生日签名表。
|
||||||
|
* pageForm.campusName 使用 hz 或 cx;startDate、endDate 传 yyyy-MM-dd,未传时使用默认导出月份。
|
||||||
|
*
|
||||||
|
* @param pageForm 校区、生日日期以及其他人员筛选条件
|
||||||
|
* @param response 返回 XSSF 格式的 xlsx 文件流
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@ApiOperation("导出生日签名表")
|
||||||
|
@SaCheckPermission("staff.birthday.export")
|
||||||
|
public void doExportSignature(UserBirthdayPageForm pageForm, HttpServletResponse response) {
|
||||||
|
userBirthdayService.exportSignatureXlsx(pageForm, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.budwk.app.zhgh.staffmanage.birthday.models;
|
||||||
|
|
||||||
|
import com.budwk.app.base.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.nutz.dao.entity.annotation.ColDefine;
|
||||||
|
import org.nutz.dao.entity.annotation.ColType;
|
||||||
|
import org.nutz.dao.entity.annotation.Column;
|
||||||
|
import org.nutz.dao.entity.annotation.Comment;
|
||||||
|
import org.nutz.dao.entity.annotation.Name;
|
||||||
|
import org.nutz.dao.entity.annotation.Table;
|
||||||
|
import org.nutz.dao.entity.annotation.TableMeta;
|
||||||
|
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生日祝福人员校区标记。
|
||||||
|
* campusId 使用 cx 表示长兴校区、hz 表示杭州校区,按工号覆盖人员单位推导出的默认校区。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Table("user_birthday_campus")
|
||||||
|
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||||
|
@Comment("生日祝福人员校区标记")
|
||||||
|
public class UserBirthdayCampus extends BaseModel {
|
||||||
|
|
||||||
|
@Name
|
||||||
|
@Comment("ID")
|
||||||
|
@PrevInsert(uu32 = true)
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("工号")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String loginname;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("姓名")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("校区编码,cx为长兴校区、hz为杭州校区")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String campusId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("校区名称")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||||
|
private String campusName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("备注")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
<!--#
|
||||||
|
layout("/layouts/platform.html"){
|
||||||
|
#-->
|
||||||
|
<div id="app" v-cloak>
|
||||||
|
<guava ref="guava">
|
||||||
|
<template>
|
||||||
|
<el-card shadow="never">
|
||||||
|
<search @search="searchBirthday">
|
||||||
|
<search-item label="所属校区">
|
||||||
|
<el-select v-model="pageForm.campusName" clearable filterable placeholder="请选择所属校区"
|
||||||
|
style="width:100%" @change="searchBirthday">
|
||||||
|
<el-option v-for="item in campuses" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="姓名/工号">
|
||||||
|
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名或工号"></el-input>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="所属工会">
|
||||||
|
<el-select v-model="pageForm.unionId" clearable filterable placeholder="请选择所属工会"
|
||||||
|
style="width:100%" @change="handleUnionChange" @clear="handleUnionChange">
|
||||||
|
<el-option v-for="item in unions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="所属单位">
|
||||||
|
<el-select v-model="pageForm.unitId" clearable filterable placeholder="请选择所属单位" style="width:100%">
|
||||||
|
<el-option v-for="item in units" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="在职状态">
|
||||||
|
<dict-select v-model="queryForm.userStates" code="USER_STATE" multiple placeholder="请选择在职状态"></dict-select>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="人员类型">
|
||||||
|
<dict-select v-model="queryForm.personTypes" code="USER_PERSON_TYPE" multiple placeholder="请选择人员类型"></dict-select>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="生日日期">
|
||||||
|
<el-date-picker v-model="birthdayRange" type="daterange" value-format="yyyy-MM-dd"
|
||||||
|
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||||
|
style="width:100%" @change="handleBirthdayRangeChange"></el-date-picker>
|
||||||
|
</search-item>
|
||||||
|
</search>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card shadow="never" class="mt10">
|
||||||
|
<table-tool :label="'生日人员导出(默认展示未来' + birthdayDays + '天,日期查询忽略年份)'"
|
||||||
|
:columns.sync="tableColumns">
|
||||||
|
<el-button size="small" type="primary" @click="doExport">导出当前列表</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="doExportSignature('hz')">导出杭州校区生日签名表</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="doExportSignature('cx')">导出长兴校区生日签名表</el-button>
|
||||||
|
</table-tool>
|
||||||
|
<el-table ref="table" v-loading="tableLoading" :data="tableData" :size="tableSize"
|
||||||
|
row-key="id" style="width:100%" @sort-change="pageOrder">
|
||||||
|
<el-table-column :index="indexMethod" label="序号" type="index" width="70" align="center"></el-table-column>
|
||||||
|
<el-table-column v-for="column in tableColumns" v-if="column.visible !== false"
|
||||||
|
:key="column.prop" :prop="column.prop"
|
||||||
|
:label="column.label" :width="column.width" :fixed="column.fixed"
|
||||||
|
:sortable="column.sortable"
|
||||||
|
header-align="center" show-overflow-tooltip></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--#include("/layouts/pagination.html"){}#-->
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
</guava>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script nonce="${cspNonce!}">
|
||||||
|
new Vue({
|
||||||
|
el: "#app",
|
||||||
|
store,
|
||||||
|
mixins: [initTableMixins],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageForm: {
|
||||||
|
searchKeyword: "",
|
||||||
|
campusName: "",
|
||||||
|
unionId: "",
|
||||||
|
unitId: "",
|
||||||
|
userStates: "[]",
|
||||||
|
personTypes: "[]",
|
||||||
|
startDate: "",
|
||||||
|
endDate: "",
|
||||||
|
pageNumber: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalCount: 0,
|
||||||
|
pageOrderName: "",
|
||||||
|
pageOrderBy: ""
|
||||||
|
},
|
||||||
|
queryForm: {userStates:[],personTypes:[]},
|
||||||
|
birthdayRange: [],
|
||||||
|
campuses: [
|
||||||
|
{id:"hz",name:"杭州校区"},
|
||||||
|
{id:"cx",name:"长兴校区"}
|
||||||
|
],
|
||||||
|
unions: [],
|
||||||
|
units: [],
|
||||||
|
birthdayDays: 15,
|
||||||
|
tableColumns: [
|
||||||
|
{prop:"loginname",label:"工号",sortable:true,width:"120"},
|
||||||
|
{prop:"username",label:"姓名",sortable:true,width:"110"},
|
||||||
|
{prop:"sex",label:"性别",width:"70"},
|
||||||
|
{prop:"mobile",label:"联系方式",width:"130"},
|
||||||
|
{prop:"birthday",label:"出生日期",sortable:true,width:"120"},
|
||||||
|
{prop:"daysUntilBirthday",label:"生日倒计时(天)",sortable:true,width:"150"},
|
||||||
|
{prop:"campusName",label:"所属校区",width:"120"},
|
||||||
|
{prop:"userState",label:"在职状态",width:"100"},
|
||||||
|
{prop:"personType",label:"人员类型",width:"130"},
|
||||||
|
{prop:"unionName",label:"所属工会",width:"180"},
|
||||||
|
{prop:"unitName",label:"所属单位"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initOrganizationOptions() {
|
||||||
|
if (this.$auth.hasRoleOr("SYSADMIN, SCHOOL_UNION_ADMIN, SCHOOL_UNION_MEMBER_ADMIN")) {
|
||||||
|
this.$businessTool.listUnion().then((data) => {
|
||||||
|
this.$set(this, "unions", data || [])
|
||||||
|
})
|
||||||
|
this.$businessTool.listUnit().then((data) => {
|
||||||
|
this.$set(this, "units", data || [])
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const unionId = this.$store.state.user.union.id
|
||||||
|
this.$businessTool.listUnion(unionId).then((data) => {
|
||||||
|
this.$set(this, "unions", data || [])
|
||||||
|
})
|
||||||
|
this.$businessTool.listUnit(unionId).then((data) => {
|
||||||
|
this.$set(this, "units", data || [])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleUnionChange() {
|
||||||
|
this.$set(this.pageForm, "unitId", "")
|
||||||
|
this.$set(this, "units", [])
|
||||||
|
if (this.pageForm.unionId) {
|
||||||
|
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
|
||||||
|
this.$set(this, "units", data || [])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleBirthdayRangeChange(value) {
|
||||||
|
this.$set(this.pageForm, "startDate", value && value.length ? value[0] : "")
|
||||||
|
this.$set(this.pageForm, "endDate", value && value.length ? value[1] : "")
|
||||||
|
this.searchBirthday()
|
||||||
|
},
|
||||||
|
searchBirthday() {
|
||||||
|
this.$set(this.pageForm, "userStates", JSON.stringify(this.queryForm.userStates || []))
|
||||||
|
this.$set(this.pageForm, "personTypes", JSON.stringify(this.queryForm.personTypes || []))
|
||||||
|
this.doSearch()
|
||||||
|
},
|
||||||
|
requestParams() {
|
||||||
|
return clone(this.pageForm)
|
||||||
|
},
|
||||||
|
doExport() {
|
||||||
|
this.$downLoad(loc() + "/doExport", this.requestParams())
|
||||||
|
},
|
||||||
|
doExportSignature(campusName) {
|
||||||
|
const params = this.requestParams()
|
||||||
|
this.$set(params, "campusName", campusName)
|
||||||
|
if (!params.startDate && !params.endDate) {
|
||||||
|
this.exportSignature(params)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$confirm("检测到已选择生日日期,是否按照搜索栏生日日期导出?", "提示", {
|
||||||
|
confirmButtonText:"是,按搜索日期导出",
|
||||||
|
cancelButtonText:"否,默认下月导出",
|
||||||
|
distinguishCancelAndClose:true,
|
||||||
|
type:"warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.exportSignature(params)
|
||||||
|
}).catch((action) => {
|
||||||
|
if (action !== "cancel") return
|
||||||
|
const defaultParams = clone(params)
|
||||||
|
this.$set(defaultParams, "startDate", "")
|
||||||
|
this.$set(defaultParams, "endDate", "")
|
||||||
|
this.exportSignature(defaultParams)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
exportSignature(params) {
|
||||||
|
this.$downLoad(loc() + "/doExportSignature", params)
|
||||||
|
},
|
||||||
|
loadBirthdayConfig() {
|
||||||
|
this.$axios.post("/platform/staffManage/birthday/manage/getConfig").then((res) => {
|
||||||
|
if (res.code !== 0 || !res.data) return
|
||||||
|
this.$set(this, "birthdayDays", res.data.birthdayDays || 15)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initOrganizationOptions()
|
||||||
|
this.loadBirthdayConfig()
|
||||||
|
this.pageData()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<!--#
|
||||||
|
}
|
||||||
|
#-->
|
||||||
Reference in New Issue
Block a user